From 94ea15bc18bec2bc2e25a0a1bc89def5785a43a6 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sun, 4 Jun 2017 14:31:50 +0100 Subject: [PATCH] Fixed notification pop up issues in Config with tables & rewards --- application/controllers/Config.php | 32 ++++++++++++------------- application/models/Customer_rewards.php | 16 ++++++------- application/models/Dinner_table.php | 10 ++++---- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 630d4754d..61b4f7da4 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -245,10 +245,10 @@ class Config extends Secure_Controller 'return_policy' => $this->input->post('return_policy') ); - if (!empty($upload_data['orig_name'])) + if(!empty($upload_data['orig_name'])) { // XSS file image sanity check - if ($this->xss_clean($upload_data['raw_name'], TRUE) === TRUE) + if($this->xss_clean($upload_data['raw_name'], TRUE) === TRUE) { $batch_save_data['company_logo'] = $upload_data['raw_name'] . $upload_data['file_ext']; } @@ -309,7 +309,7 @@ class Config extends Secure_Controller $number_locale = $this->input->post('number_locale'); $fmt = new \NumberFormatter($number_locale, \NumberFormatter::CURRENCY); $currency_symbol = empty($this->input->post('currency_symbol')) ? $fmt->getSymbol(\NumberFormatter::CURRENCY_SYMBOL) : $this->input->post('currency_symbol'); - if ($this->input->post('thousands_separator') == 'false') + if($this->input->post('thousands_separator') == 'false') { $fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ''); } @@ -519,13 +519,13 @@ class Config extends Secure_Controller $deleted_locations = $this->Stock_location->get_allowed_locations(); foreach($this->input->post() as $key => $value) { - if (strstr($key, 'stock_location')) + if(strstr($key, 'stock_location')) { $location_id = preg_replace("/.*?_(\d+)$/", "$1", $key); unset($deleted_locations[$location_id]); // save or update $location_data = array('location_name' => $value); - if ($this->Stock_location->save($location_data, $location_id)) + if($this->Stock_location->save($location_data, $location_id)) { $this->_clear_session_state(); } @@ -533,7 +533,7 @@ class Config extends Secure_Controller } // all locations not available in post will be deleted now - foreach ($deleted_locations as $location_id => $location_name) + foreach($deleted_locations as $location_id => $location_name) { $this->Stock_location->delete($location_id); } @@ -558,7 +558,7 @@ class Config extends Secure_Controller $not_to_delete = array(); foreach($this->input->post() as $key => $value) { - if (strstr($key, 'dinner_table') && $key != 'dinner_table_enable') + if(strstr($key, 'dinner_table') && $key != 'dinner_table_enable') { $dinner_table_id = preg_replace("/.*?_(\d+)$/", "$1", $key); @@ -566,7 +566,7 @@ class Config extends Secure_Controller // save or update $table_data = array('name' => $value); - if ($this->Dinner_table->save($table_data, $dinner_table_id)) + if($this->Dinner_table->save($table_data, $dinner_table_id)) { $this->_clear_session_state(); } @@ -574,7 +574,7 @@ class Config extends Secure_Controller } // all locations not available in post will be deleted now - foreach ($deleted_tables as $dinner_table) + foreach($deleted_tables as $dinner_table) { if(!in_array($dinner_table['dinner_table_id'],$not_to_delete)) { @@ -596,7 +596,7 @@ class Config extends Secure_Controller { $this->db->trans_start(); - $this->Appconfig->save('customer_reward_enable',$this->input->post('customer_reward_enable')); + $this->Appconfig->save('customer_reward_enable', $this->input->post('customer_reward_enable')); $deleted_packages = $this->Customer_rewards->get_all()->result_array(); $not_to_delete = array(); @@ -622,9 +622,9 @@ class Config extends Secure_Controller { foreach($array_save as $key => $value) { - // save or update - $table_data = array('package_name' => $value['package_name'],'points_percent' => $value['points_percent']); - if ($this->Customer_rewards->save($table_data, $key)) + // save or update + $table_data = array('package_name' => $value['package_name'], 'points_percent' => $value['points_percent']); + if($this->Customer_rewards->save($table_data, $key)) { $this->_clear_session_state(); } @@ -634,7 +634,7 @@ class Config extends Secure_Controller // all locations not available in post will be deleted now foreach($deleted_packages as $customer_reward) { - if(!in_array($customer_reward['customer_reward_id'],$not_to_delete)) + if(!in_array($customer_reward['customer_reward_id'], $not_to_delete)) { $this->Customer_rewards->delete($customer_reward['customer_reward_id']); } @@ -725,9 +725,9 @@ class Config extends Secure_Controller // Update the register mode with the latest change so that if the user // switches immediately back to the register the mode reflects the change - if ($success == TRUE) + if($success == TRUE) { - if ($this->config->item('invoice_enable') == '1') + if($this->config->item('invoice_enable') == '1') { $this->sale_lib->set_mode($batch_save_data['default_register_mode']); } diff --git a/application/models/Customer_rewards.php b/application/models/Customer_rewards.php index 35fbd2906..432993f30 100644 --- a/application/models/Customer_rewards.php +++ b/application/models/Customer_rewards.php @@ -9,17 +9,17 @@ class Customer_rewards extends CI_Model return ($this->db->get()->num_rows() >= 1); } - public function save(&$table_data, $package_id) + public function save($package_data, $package_id) { - $name = $$table_data['package_name']; - $points_percent = $$table_data['points_percent']; + $name = $package_data['package_name']; + $points_percent = $package_data['points_percent']; if(!$this->exists($package_id)) { $this->db->trans_start(); - $location_data = array('package_name'=>$name, 'deleted'=>0, 'points_percent'=>$points_percent); - $this->db->insert('customers_packages', $table_data); + $location_data = array('package_name' => $name, 'deleted' => 0, 'points_percent'=>$points_percent); + $this->db->insert('customers_packages', $package_data); $package_id = $this->db->insert_id(); $this->db->trans_complete(); @@ -30,14 +30,14 @@ class Customer_rewards extends CI_Model { $this->db->where('package_id', $package_id); - return $this->db->update('customers_packages', $table_data); + return $this->db->update('customers_packages', $package_data); } } public function get_name($package_id) { $this->db->from('customers_packages'); - $this->db->where('package_id',$package_id); + $this->db->where('package_id', $package_id); return $this->db->get()->row()->package_name; } @@ -45,7 +45,7 @@ class Customer_rewards extends CI_Model public function get_points_percent($package_id) { $this->db->from('customers_packages'); - $this->db->where('package_id',$package_id); + $this->db->where('package_id', $package_id); return $this->db->get()->row()->points_percent; } diff --git a/application/models/Dinner_table.php b/application/models/Dinner_table.php index 27d224c20..4dcdc8c66 100644 --- a/application/models/Dinner_table.php +++ b/application/models/Dinner_table.php @@ -9,15 +9,15 @@ class Dinner_table extends CI_Model return ($this->db->get()->num_rows() >= 1); } - public function save(&$table_data, $dinner_table_id) + public function save($table_data, $dinner_table_id) { - $name = $$table_data['name']; + $name = $table_data['name']; if(!$this->exists($dinner_table_id)) { $this->db->trans_start(); - $location_data = array('name'=>$name, 'deleted'=>0); + $location_data = array('name' => $name, 'deleted' => 0); $this->db->insert('dinner_tables', $table_data); $dinner_table_id = $this->db->insert_id(); @@ -42,7 +42,7 @@ class Dinner_table extends CI_Model $this->db->where('status', 0); $this->db->where('deleted', 0); - $empty_tables = $this->db->get()->result_array(); + $empty_tables = $this->db->get()->result_array(); $empty_tables_array = array(); foreach($empty_tables as $empty_table) @@ -63,7 +63,7 @@ class Dinner_table extends CI_Model else { $this->db->from('dinner_tables'); - $this->db->where('dinner_table_id',$dinner_table_id); + $this->db->where('dinner_table_id', $dinner_table_id); return $this->db->get()->row()->name; }