diff --git a/app/Config/Database.php b/app/Config/Database.php index f230b3280..78bd6d1a6 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -118,13 +118,12 @@ class Database extends Config break; } - foreach ([&$this->development, &$this->tests, &$this->default] as &$config) { + foreach ([&$this->development, &$this->tests, &$this->default] as &$config) + { $config['hostname'] = !getenv('MYSQL_HOST_NAME') ? $config['hostname'] : getenv('MYSQL_HOST_NAME'); $config['username'] = !getenv('MYSQL_USERNAME') ? $config['username'] : getenv('MYSQL_USERNAME'); $config['password'] = !getenv('MYSQL_PASSWORD') ? $config['password'] : getenv('MYSQL_PASSWORD'); $config['database'] = !getenv('MYSQL_DB_NAME') ? $config['database'] : getenv('MYSQL_DB_NAME'); - - } } } diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 2a4330480..99e8209a0 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -504,14 +504,14 @@ class Config extends Secure_Controller 'timezone' => $this->request->getPost('timezone'), 'dateformat' => $this->request->getPost('dateformat'), 'timeformat' => $this->request->getPost('timeformat'), - 'thousands_separator' => !empty($this->request->getPost('thousands_separator', FILTER_SANITIZE_NUMBER_INT)), + 'thousands_separator' => !empty($this->request->getPost('thousands_separator')), 'number_locale' => $this->request->getPost('number_locale'), 'currency_decimals' => $this->request->getPost('currency_decimals', FILTER_SANITIZE_NUMBER_INT), 'tax_decimals' => $this->request->getPost('tax_decimals', FILTER_SANITIZE_NUMBER_INT), 'quantity_decimals' => $this->request->getPost('quantity_decimals', FILTER_SANITIZE_NUMBER_INT), - 'country_codes' => $this->request->getPost('country_codes'), + 'country_codes' => htmlspecialchars($this->request->getPost('country_codes')), 'payment_options_order' => $this->request->getPost('payment_options_order'), - 'date_or_time_format' => $this->request->getPost('date_or_time_format', FILTER_SANITIZE_NUMBER_INT), + 'date_or_time_format' => $this->request->getPost('date_or_time_format'), 'cash_decimals' => $this->request->getPost('cash_decimals', FILTER_SANITIZE_NUMBER_INT), 'cash_rounding_code' => $this->request->getPost('cash_rounding_code'), 'financial_year' => $this->request->getPost('financial_year', FILTER_SANITIZE_NUMBER_INT) diff --git a/app/Models/Attribute.php b/app/Models/Attribute.php index 01371857d..e59bcdc64 100644 --- a/app/Models/Attribute.php +++ b/app/Models/Attribute.php @@ -743,12 +743,11 @@ class Attribute extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Cashup.php b/app/Models/Cashup.php index 17816df4b..f47fb6b53 100644 --- a/app/Models/Cashup.php +++ b/app/Models/Cashup.php @@ -98,7 +98,7 @@ class Cashup extends Model if($count_only) { $builder->select('COUNT(cash_up.cashup_id) as count'); - } + } else { $builder->select(' @@ -221,12 +221,11 @@ class Cashup extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Customer.php b/app/Models/Customer.php index beacf6f8e..676b287c9 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -118,12 +118,11 @@ class Customer extends Person $empty_obj = parent::get_info(NEW_ENTRY); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Expense.php b/app/Models/Expense.php index 0c7debc65..ce948fc8f 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -262,12 +262,11 @@ class Expense extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Giftcard.php b/app/Models/Giftcard.php index a7cdd0fbb..ffd50d079 100644 --- a/app/Models/Giftcard.php +++ b/app/Models/Giftcard.php @@ -93,12 +93,11 @@ class Giftcard extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Item.php b/app/Models/Item.php index 35c31179f..c2a4b6493 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -354,13 +354,11 @@ class Item extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - foreach($this->db->getFieldData($table_name) as $field) { - $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Person.php b/app/Models/Person.php index 41aaea681..dcac3a0a0 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -108,12 +108,11 @@ class Person extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Reports/Summary_payments.php b/app/Models/Reports/Summary_payments.php index 6a0c57183..0f9558ffb 100644 --- a/app/Models/Reports/Summary_payments.php +++ b/app/Models/Reports/Summary_payments.php @@ -44,9 +44,12 @@ class Summary_payments extends Summary_report $where = ''; //TODO: Duplicated code //TODO: this needs to be converted to ternary notation - if(empty($config['date_or_time_format'])) { + if(empty($config['date_or_time_format'])) + { $where .= 'DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); - } else { + } + else + { $where .= 'sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); } @@ -76,8 +79,10 @@ class Summary_payments extends Summary_report // At this point in time refunds are assumed to be cash refunds. $total_cash_refund = 0; - foreach($sales as $key => $sale_summary) { - if($sale_summary['trans_refunded'] <> 0) { + foreach($sales as $key => $sale_summary) + { + if($sale_summary['trans_refunded'] <> 0) + { $total_cash_refund += $sale_summary['trans_refunded']; } } @@ -103,8 +108,10 @@ class Summary_payments extends Summary_report // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; - foreach($payments as $key => $payment) { - if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== false) { + foreach($payments as $key => $payment) + { + if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== false) + { $gift_card_count += $payment['trans_sales']; $gift_card_amount += $payment['trans_amount']; @@ -113,7 +120,8 @@ class Summary_payments extends Summary_report } } - if($gift_card_count > 0) { + if($gift_card_count > 0) + { $payments[] = [ 'trans_group' => lang('Reports.trans_payments'), 'trans_type' => lang('Sales.giftcard'), diff --git a/app/Views/attributes/form.php b/app/Views/attributes/form.php index 8bea58cc4..67afc5614 100644 --- a/app/Views/attributes/form.php +++ b/app/Views/attributes/form.php @@ -105,7 +105,7 @@ = form_close() ?> - diff --git a/app/Views/configs/message_config.php b/app/Views/configs/message_config.php index 4e0f5efa3..4cefe1ad2 100644 --- a/app/Views/configs/message_config.php +++ b/app/Views/configs/message_config.php @@ -77,7 +77,7 @@ = form_close() ?> - +