diff --git a/app/Controllers/Cashups.php b/app/Controllers/Cashups.php index 75fa1aaf2..783b526b4 100644 --- a/app/Controllers/Cashups.php +++ b/app/Controllers/Cashups.php @@ -107,10 +107,26 @@ class Cashups extends Secure_Controller // if it's date mode only and not date & time truncate the open and end date to date only if(empty($this->config['date_or_time_format'])) { + if($cash_ups_info->open_date != null) + { + $start_date = substr($cash_ups_info->open_date, 0, 10); + } + else + { + $start_date = null; + } + if($cash_ups_info->close_date != null) + { + $end_date = substr($cash_ups_info->close_date, 0, 10); + } + else + { + $end_date = null; + } // search for all the payments given the time range $inputs = [ - 'start_date' => substr($cash_ups_info->open_date, 0, 10), - 'end_date' => substr($cash_ups_info->close_date, 0, 10), + 'start_date' => $start_date, + 'end_date' => $end_date, 'sale_type' => 'complete', 'location_id' => 'all' ]; diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 170baa170..1c57d409a 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -86,7 +86,7 @@ class Config extends Secure_Controller if(file_exists('license/LICENSE')) { - $license[$i]['text'] = file_get_contents('license/LICENSE', NULL, NULL, 0, 2000); + $license[$i]['text'] = file_get_contents('license/LICENSE', false, NULL, 0, 2000); } else { @@ -112,7 +112,7 @@ class Config extends Secure_Controller if(file_exists($license_text_file)) { - $license[$i]['text'] = file_get_contents($license_text_file , NULL, NULL, 0, 2000); + $license[$i]['text'] = file_get_contents($license_text_file , false, NULL, 0, 2000); } else { @@ -329,13 +329,13 @@ class Config extends Secure_Controller $upload_success = !empty($upload_data['error']); $batch_save_data = [ - 'company' => $this->request->getPost('company', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'address' => $this->request->getPost('address', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'phone' => $this->request->getPost('phone', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'company' => $this->request->getPost('company'), + 'address' => $this->request->getPost('address'), + 'phone' => $this->request->getPost('phone'), 'email' => $this->request->getPost('email', FILTER_SANITIZE_EMAIL), - 'fax' => $this->request->getPost('fax', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'fax' => $this->request->getPost('fax'), 'website' => $this->request->getPost('website', FILTER_SANITIZE_URL), - 'return_policy' => $this->request->getPost('return_policy', FILTER_SANITIZE_FULL_SPECIAL_CHARS) + 'return_policy' => $this->request->getPost('return_policy') ]; if(!empty($upload_data['orig_name']) && $upload_data['raw_name'] === TRUE) @@ -397,8 +397,8 @@ class Config extends Secure_Controller public function postSaveGeneral(): void { $batch_save_data = [ - 'theme' => $this->request->getPost('theme', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'login_form' => $this->request->getPost('login_form', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'theme' => $this->request->getPost('theme'), + 'login_form' => $this->request->getPost('login_form'), 'default_sales_discount_type' => $this->request->getPost('default_sales_discount_type') != NULL, 'default_sales_discount' => $this->request->getPost('default_sales_discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 'default_receivings_discount_type' => $this->request->getPost('default_receivings_discount_type') != NULL, @@ -411,14 +411,14 @@ class Config extends Secure_Controller 'image_max_width' => $this->request->getPost('image_max_width', FILTER_SANITIZE_NUMBER_INT), 'image_max_height' => $this->request->getPost('image_max_height', FILTER_SANITIZE_NUMBER_INT), 'image_max_size' => $this->request->getPost('image_max_size', FILTER_SANITIZE_NUMBER_INT), - 'image_allowed_types' => implode('|', $this->request->getPost('image_allowed_types', FILTER_SANITIZE_FULL_SPECIAL_CHARS)), + 'image_allowed_types' => implode('|', $this->request->getPost('image_allowed_types')), 'gcaptcha_enable' => $this->request->getPost('gcaptcha_enable') != NULL, - 'gcaptcha_secret_key' => $this->request->getPost('gcaptcha_secret_key', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'gcaptcha_site_key' => $this->request->getPost('gcaptcha_site_key', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'suggestions_first_column' => $this->request->getPost('suggestions_first_column', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'suggestions_second_column' => $this->request->getPost('suggestions_second_column', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'suggestions_third_column' => $this->request->getPost('suggestions_third_column', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'giftcard_number' => $this->request->getPost('giftcard_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'gcaptcha_secret_key' => $this->request->getPost('gcaptcha_secret_key'), + 'gcaptcha_site_key' => $this->request->getPost('gcaptcha_site_key'), + 'suggestions_first_column' => $this->request->getPost('suggestions_first_column'), + 'suggestions_second_column' => $this->request->getPost('suggestions_second_column'), + 'suggestions_third_column' => $this->request->getPost('suggestions_third_column'), + 'giftcard_number' => $this->request->getPost('giftcard_number'), 'derive_sale_quantity' => $this->request->getPost('derive_sale_quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) != NULL, 'multi_pack_enabled' => $this->request->getPost('multi_pack_enabled') != NULL, 'include_hsn' => $this->request->getPost('include_hsn') != NULL, @@ -452,8 +452,8 @@ class Config extends Secure_Controller */ public function postCheckNumberLocale(): void { - $number_locale = $this->request->getPost('number_locale', FILTER_SANITIZE_FULL_SPECIAL_CHARS); - $save_number_locale = $this->request->getPost('save_number_locale', FILTER_SANITIZE_FULL_SPECIAL_CHARS); + $number_locale = $this->request->getPost('number_locale'); + $save_number_locale = $this->request->getPost('save_number_locale'); $fmt = new NumberFormatter($number_locale, NumberFormatter::CURRENCY); if($number_locale != $save_number_locale) @@ -464,8 +464,8 @@ class Config extends Secure_Controller } else { - $currency_symbol = empty($this->request->getPost('currency_symbol')) ? $fmt->getSymbol(NumberFormatter::CURRENCY_SYMBOL) : $this->request->getPost('currency_symbol', FILTER_SANITIZE_FULL_SPECIAL_CHARS); - $currency_code = empty($this->request->getPost('currency_code')) ? $fmt->getTextAttribute(NumberFormatter::CURRENCY_CODE) : $this->request->getPost('currency_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS); + $currency_symbol = empty($this->request->getPost('currency_symbol')) ? $fmt->getSymbol(NumberFormatter::CURRENCY_SYMBOL) : $this->request->getPost('currency_symbol'); + $currency_code = empty($this->request->getPost('currency_code')) ? $fmt->getTextAttribute(NumberFormatter::CURRENCY_CODE) : $this->request->getPost('currency_code'); } if($this->request->getPost('thousands_separator') == 'false') @@ -490,25 +490,25 @@ class Config extends Secure_Controller */ public function postSaveLocale(): void { - $exploded = explode(":", $this->request->getPost('language', FILTER_SANITIZE_FULL_SPECIAL_CHARS)); + $exploded = explode(":", $this->request->getPost('language')); $batch_save_data = [ - 'currency_symbol' => $this->request->getPost('currency_symbol', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'currency_code' => $this->request->getPost('currency_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'currency_symbol' => $this->request->getPost('currency_symbol'), + 'currency_code' => $this->request->getPost('currency_code'), 'language_code' => $exploded[0], 'language' => $exploded[1], - 'timezone' => $this->request->getPost('timezone', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'dateformat' => $this->request->getPost('dateformat', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'timeformat' => $this->request->getPost('timeformat', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + '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)), - 'number_locale' => $this->request->getPost('number_locale', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + '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', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'payment_options_order' => $this->request->getPost('payment_options_order', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'country_codes' => $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), 'cash_decimals' => $this->request->getPost('cash_decimals', FILTER_SANITIZE_NUMBER_INT), - 'cash_rounding_code' => $this->request->getPost('cash_rounding_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'cash_rounding_code' => $this->request->getPost('cash_rounding_code'), 'financial_year' => $this->request->getPost('financial_year', FILTER_SANITIZE_NUMBER_INT) ]; @@ -534,14 +534,14 @@ class Config extends Secure_Controller } $batch_save_data = [ - 'protocol' => $this->request->getPost('protocol', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'mailpath' => $this->request->getPost('mailpath', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'smtp_host' => $this->request->getPost('smtp_host', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'smtp_user' => $this->request->getPost('smtp_user', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'protocol' => $this->request->getPost('protocol'), + 'mailpath' => $this->request->getPost('mailpath'), + 'smtp_host' => $this->request->getPost('smtp_host'), + 'smtp_user' => $this->request->getPost('smtp_user'), 'smtp_pass' => $password, 'smtp_port' => $this->request->getPost('smtp_port', FILTER_SANITIZE_NUMBER_INT), 'smtp_timeout' => $this->request->getPost('smtp_timeout', FILTER_SANITIZE_NUMBER_INT), - 'smtp_crypto' => $this->request->getPost('smtp_crypto', FILTER_SANITIZE_FULL_SPECIAL_CHARS) + 'smtp_crypto' => $this->request->getPost('smtp_crypto') ]; $success = $this->appconfig->batch_save($batch_save_data); @@ -562,10 +562,10 @@ class Config extends Secure_Controller } $batch_save_data = [ - 'msg_msg' => $this->request->getPost('msg_msg', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'msg_uid' => $this->request->getPost('msg_uid', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'msg_msg' => $this->request->getPost('msg_msg'), + 'msg_uid' => $this->request->getPost('msg_uid'), 'msg_pwd' => $password, - 'msg_src' => $this->request->getPost('msg_src', FILTER_SANITIZE_FULL_SPECIAL_CHARS) + 'msg_src' => $this->request->getPost('msg_src') ]; $success = $this->appconfig->batch_save($batch_save_data); @@ -602,10 +602,10 @@ class Config extends Secure_Controller * * @return void */ - public function ajax_check_mailchimp_api_key(): void + public function postCheckMailchimpApiKey(): void { // load mailchimp lists associated to the given api key, already XSS cleaned in the private function - $lists = $this->_mailchimp($this->request->getPost('mailchimp_api_key', FILTER_SANITIZE_FULL_SPECIAL_CHARS)); + $lists = $this->_mailchimp($this->request->getPost('mailchimp_api_key')); $success = count($lists) > 0; echo json_encode ([ @@ -625,18 +625,18 @@ class Config extends Secure_Controller if(check_encryption()) //TODO: Hungarian notation { - $api_key_unencrypted = $this->request->getPost('mailchimp_api_key', FILTER_SANITIZE_FULL_SPECIAL_CHARS); + $api_key_unencrypted = $this->request->getPost('mailchimp_api_key'); if(!empty($api_key_unencrypted)) { $api_key = $this->encrypter->encrypt($api_key_unencrypted); - $api_key_unencrypted = ""; + $api_key_unencrypted = ''; } - $list_id_unencrypted = $this->request->getPost('mailchimp_list_id', FILTER_SANITIZE_FULL_SPECIAL_CHARS); + $list_id_unencrypted = $this->request->getPost('mailchimp_list_id'); if(!empty($list_id_unencrypted)) { $list_id = $this->encrypter->encrypt($list_id_unencrypted); - $list_id_unencrypted = ""; + $list_id_unencrypted = ''; } } @@ -691,7 +691,7 @@ class Config extends Secure_Controller $this->db->transStart(); $not_to_delete = []; - foreach($this->request->getPost(NULL, FILTER_SANITIZE_FULL_SPECIAL_CHARS) as $key => $value) + foreach($this->request->getPost(NULL) as $key => $value) { if(strstr($key, 'stock_location')) { @@ -741,7 +741,7 @@ class Config extends Secure_Controller if($dinner_table_enable) { $not_to_delete = []; - foreach($this->request->getPost(NULL, FILTER_SANITIZE_FULL_SPECIAL_CHARS) as $key => $value) //TODO: Not sure if this is the best way to filter the array + foreach($this->request->getPost(NULL) as $key => $value) //TODO: Not sure if this is the best way to filter the array { if(strstr($key, 'dinner_table') && $key != 'dinner_table_enable') { @@ -785,14 +785,14 @@ class Config extends Secure_Controller $batch_save_data = [ 'default_tax_1_rate' => parse_tax($this->request->getPost('default_tax_1_rate', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), - 'default_tax_1_name' => $this->request->getPost('default_tax_1_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'default_tax_1_name' => $this->request->getPost('default_tax_1_name'), 'default_tax_2_rate' => parse_tax($this->request->getPost('default_tax_2_rate', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), - 'default_tax_2_name' => $this->request->getPost('default_tax_2_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'default_tax_2_name' => $this->request->getPost('default_tax_2_name'), 'tax_included' => $this->request->getPost('tax_included') != NULL, 'use_destination_based_tax' => $this->request->getPost('use_destination_based_tax') != NULL, - 'default_tax_code' => $this->request->getPost('default_tax_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'default_tax_category' => $this->request->getPost('default_tax_category', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'default_tax_jurisdiction' => $this->request->getPost('default_tax_jurisdiction', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'default_tax_code' => $this->request->getPost('default_tax_code'), + 'default_tax_category' => $this->request->getPost('default_tax_category'), + 'default_tax_jurisdiction' => $this->request->getPost('default_tax_jurisdiction'), 'tax_id' => $this->request->getPost('tax_id', FILTER_SANITIZE_NUMBER_INT) ]; @@ -822,7 +822,7 @@ class Config extends Secure_Controller { $not_to_delete = []; $array_save = []; - foreach($this->request->getPost(NULL, FILTER_SANITIZE_FULL_SPECIAL_CHARS) as $key => $value) + foreach($this->request->getPost(NULL) as $key => $value) { if(strstr($key, 'customer_reward') && $key != 'customer_reward_enable') { @@ -872,21 +872,21 @@ class Config extends Secure_Controller public function postSaveBarcode(): void { $batch_save_data = [ - 'barcode_type' => $this->request->getPost('barcode_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'barcode_type' => $this->request->getPost('barcode_type'), 'barcode_width' => $this->request->getPost('barcode_width', FILTER_SANITIZE_NUMBER_INT), 'barcode_height' => $this->request->getPost('barcode_height', FILTER_SANITIZE_NUMBER_INT), - 'barcode_font' => $this->request->getPost('barcode_font', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'barcode_font' => $this->request->getPost('barcode_font'), 'barcode_font_size' => $this->request->getPost('barcode_font_size', FILTER_SANITIZE_NUMBER_INT), - 'barcode_first_row' => $this->request->getPost('barcode_first_row', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'barcode_second_row' => $this->request->getPost('barcode_second_row', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'barcode_third_row' => $this->request->getPost('barcode_third_row', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'barcode_first_row' => $this->request->getPost('barcode_first_row'), + 'barcode_second_row' => $this->request->getPost('barcode_second_row'), + 'barcode_third_row' => $this->request->getPost('barcode_third_row'), 'barcode_num_in_row' => $this->request->getPost('barcode_num_in_row', FILTER_SANITIZE_NUMBER_INT), 'barcode_page_width' => $this->request->getPost('barcode_page_width', FILTER_SANITIZE_NUMBER_INT), 'barcode_page_cellspacing' => $this->request->getPost('barcode_page_cellspacing', FILTER_SANITIZE_NUMBER_INT), 'barcode_generate_if_empty' => $this->request->getPost('barcode_generate_if_empty') != NULL, 'allow_duplicate_barcodes' => $this->request->getPost('allow_duplicate_barcodes') != NULL, - 'barcode_content' => $this->request->getPost('barcode_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'barcode_formats' => json_encode($this->request->getPost('barcode_formats', FILTER_SANITIZE_FULL_SPECIAL_CHARS)) + 'barcode_content' => $this->request->getPost('barcode_content'), + 'barcode_formats' => json_encode($this->request->getPost('barcode_formats')) ]; $success = $this->appconfig->batch_save($batch_save_data); @@ -900,11 +900,11 @@ class Config extends Secure_Controller public function postSaveReceipt(): void { $batch_save_data = [ - 'receipt_template' => $this->request->getPost('receipt_template', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'receipt_template' => $this->request->getPost('receipt_template'), 'receipt_font_size' => $this->request->getPost('receipt_font_size', FILTER_SANITIZE_NUMBER_INT), 'print_delay_autoreturn' => $this->request->getPost('print_delay_autoreturn', FILTER_SANITIZE_NUMBER_INT), - 'email_receipt_check_behaviour' => $this->request->getPost('email_receipt_check_behaviour', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'print_receipt_check_behaviour' => $this->request->getPost('print_receipt_check_behaviour', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'email_receipt_check_behaviour' => $this->request->getPost('email_receipt_check_behaviour'), + 'print_receipt_check_behaviour' => $this->request->getPost('print_receipt_check_behaviour'), 'receipt_show_company_name' => $this->request->getPost('receipt_show_company_name') != NULL, 'receipt_show_taxes' => ($this->request->getPost('receipt_show_taxes') != NULL), 'receipt_show_tax_ind' => ($this->request->getPost('receipt_show_tax_ind') != NULL), @@ -932,19 +932,19 @@ class Config extends Secure_Controller { $batch_save_data = [ 'invoice_enable' => $this->request->getPost('invoice_enable') != NULL, - 'sales_invoice_format' => $this->request->getPost('sales_invoice_format', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'sales_quote_format' => $this->request->getPost('sales_quote_format', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'recv_invoice_format' => $this->request->getPost('recv_invoice_format', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'invoice_default_comments' => $this->request->getPost('invoice_default_comments', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'invoice_email_message' => $this->request->getPost('invoice_email_message', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'line_sequence' => $this->request->getPost('line_sequence', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'sales_invoice_format' => $this->request->getPost('sales_invoice_format'), + 'sales_quote_format' => $this->request->getPost('sales_quote_format'), + 'recv_invoice_format' => $this->request->getPost('recv_invoice_format'), + 'invoice_default_comments' => $this->request->getPost('invoice_default_comments'), + 'invoice_email_message' => $this->request->getPost('invoice_email_message'), + 'line_sequence' => $this->request->getPost('line_sequence'), 'last_used_invoice_number' => $this->request->getPost('last_used_invoice_number', FILTER_SANITIZE_NUMBER_INT), 'last_used_quote_number' => $this->request->getPost('last_used_quote_number', FILTER_SANITIZE_NUMBER_INT), - 'quote_default_comments' => $this->request->getPost('quote_default_comments', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'quote_default_comments' => $this->request->getPost('quote_default_comments'), 'work_order_enable' => $this->request->getPost('work_order_enable') != NULL, - 'work_order_format' => $this->request->getPost('work_order_format', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'work_order_format' => $this->request->getPost('work_order_format'), 'last_used_work_order_number' => $this->request->getPost('last_used_work_order_number', FILTER_SANITIZE_NUMBER_INT), - 'invoice_type' => $this->request->getPost('invoice_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS) + 'invoice_type' => $this->request->getPost('invoice_type') ]; $success = $this->appconfig->batch_save($batch_save_data); diff --git a/app/Controllers/Customers.php b/app/Controllers/Customers.php index dde8a0248..27e9b93a5 100644 --- a/app/Controllers/Customers.php +++ b/app/Controllers/Customers.php @@ -50,7 +50,7 @@ class Customers extends Persons } else { - $this->_list_id = ""; + $this->_list_id = ''; } } diff --git a/app/Models/Cashup.php b/app/Models/Cashup.php index a7a33afb2..364da4ab7 100644 --- a/app/Models/Cashup.php +++ b/app/Models/Cashup.php @@ -97,7 +97,15 @@ class Cashup extends Model $builder->select('COUNT(cash_up.cashup_id) as count'); } - $builder->select(' + if(!$count_only) + { + $builder->select(' + cash_up.cashup_id, + '); + } + else + { + $builder->select(' cash_up.cashup_id, MAX(cash_up.open_date) AS open_date, MAX(cash_up.close_date) AS close_date, @@ -117,6 +125,7 @@ class Cashup extends Model MAX(close_employees.first_name) AS close_first_name, MAX(close_employees.last_name) AS close_last_name '); + } $builder->join('people AS open_employees', 'open_employees.person_id = cash_up.open_employee_id', 'LEFT'); $builder->join('people AS close_employees', 'close_employees.person_id = cash_up.close_employee_id', 'LEFT'); diff --git a/app/Views/configs/barcode_config.php b/app/Views/configs/barcode_config.php index 70bc3ff31..e1fedc8ee 100644 --- a/app/Views/configs/barcode_config.php +++ b/app/Views/configs/barcode_config.php @@ -12,7 +12,12 @@
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'barcode_type', + 'options' => $support_barcode, + 'selected' => $config['barcode_type'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -50,12 +55,12 @@
'control-label col-xs-2 required']) ?>
- 'form-control input-sm required'] - ) ?> + 'barcode_font', + 'options' => $barcode_fonts, + 'selected' => $config['barcode_font'], + 'extra' => "class='form-control input-sm' required" + ]) ?>
'barcode_formats[]', 'id' => 'barcode_formats', - 'options' => !empty($barcode_formats) ? esc(array_combine($barcode_formats, $barcode_formats)) : [], + 'options' => !empty($barcode_formats) ? array_combine($barcode_formats, $barcode_formats) : [], 'multiple' => 'multiple', 'data-role' => 'tagsinput']) ?>
diff --git a/app/Views/configs/email_config.php b/app/Views/configs/email_config.php index 2ec482bba..cddacb639 100644 --- a/app/Views/configs/email_config.php +++ b/app/Views/configs/email_config.php @@ -7,15 +7,16 @@
'control-label col-xs-2']) ?>
- 'protocol', + 'options' => [ 'mail' => 'mail', 'sendmail' => 'sendmail', 'smtp' => 'smtp' ], - esc($config['protocol']), - ['class' => 'form-control input-sm', 'id' => 'protocol']) - ?> + 'selected' => $config['protocol'], + 'extra' => "class='form-control input-sm' id='protocol'" + ]) ?>
@@ -26,7 +27,7 @@ 'name' => 'mailpath', 'id' => 'mailpath', 'class' => 'form-control input-sm', - 'value' => esc($config['mailpath']) + 'value' => $config['mailpath'] ]) ?>
@@ -38,7 +39,7 @@ 'name' => 'smtp_host', 'id' => 'smtp_host', 'class' => 'form-control input-sm', - 'value' => esc($config['smtp_host']) + 'value' => $config['smtp_host'] ]) ?> @@ -58,14 +59,16 @@
'control-label col-xs-2']) ?>
- 'smtp_crypto', + 'options' => [ '' => 'None', 'tls' => 'TLS', 'ssl' => 'SSL' ], - esc($config['smtp_crypto']), - ['class' => 'form-control input-sm', 'id' => 'smtp_crypto']) - ?> + 'selected' => $config['smtp_crypto'], + 'extra' => "class='form-control input-sm' id='smtp_crypto'" + ]) ?>
@@ -90,7 +93,7 @@ 'name' => 'smtp_user', 'id' => 'smtp_user', 'class' => 'form-control input-sm', - 'value' => esc($config['smtp_user']) + 'value' => $config['smtp_user'] ]) ?> @@ -105,7 +108,7 @@ 'name' => 'smtp_pass', 'id' => 'smtp_pass', 'class' => 'form-control input-sm', - 'value' => esc($config['smtp_pass']) + 'value' => $config['smtp_pass'] ]) ?> diff --git a/app/Views/configs/general_config.php b/app/Views/configs/general_config.php index dc273f00a..bc4f2f214 100644 --- a/app/Views/configs/general_config.php +++ b/app/Views/configs/general_config.php @@ -18,7 +18,12 @@
- 'form-control input-sm', 'id' => 'theme-change']) ?> + 'theme', + 'options' => $themes, + 'selected' => $config['theme'], + 'extra' => "class='form-control input-sm' id='theme-change'" + ]) ?>
@@ -32,15 +37,15 @@
'control-label col-xs-2']) ?>
- lang('Config.floating_labels'), - 'input_groups' => lang('Config.input_groups') - ], - esc($config['login_form']), - ['class' => 'form-control input-sm'] - ) ?> + 'login_form', + 'options' => [ + 'floating_labels' => lang('Config.floating_labels'), + 'input_groups' => lang('Config.input_groups') + ], + 'selected' => $config['login_form'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -152,27 +157,27 @@
- 'notify_vertical_position', + 'options' => [ 'top' => lang('Config.top'), 'bottom' => lang('Config.bottom') ], - esc($config['notify_vertical_position']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['notify_vertical_position'], + 'extra' => "class='form-control input-sm'" + ]) ?>
- 'notify_horizontal_position', + 'options' => [ 'left' => lang('Config.left'), 'center' => lang('Config.center'), 'right' => lang('Config.right') ], - esc($config['notify_horizontal_position']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['notify_horizontal_position'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -236,13 +241,16 @@
- 'image_allowed_types', - 'class' => 'selectpicker show-menu-arrow', - 'data-none-selected-text'=>lang('Common.none_selected_text'), - 'data-selected-text-format' => 'count > 1', - 'data-style' => 'btn-default btn-sm', - 'data-width' => '100%' + 'image_allowed_types', + 'options' => $image_allowed_types, + 'selected' => $selected_image_allowed_types, + 'extra' => "id='image_allowed_types'". + "class='selectpicker show-menu-arrow'". + "data-none-selected-text=".lang('Common.none_selected_text'). + "data-selected-text-format='count > 1'". + "data-style='btn-default btn-sm'". + "data-width='100%'" ]) ?>
@@ -274,7 +282,7 @@ 'name' => 'gcaptcha_site_key', 'id' => 'gcaptcha_site_key', 'class' => 'form-control input-sm required', - 'value' => esc($config['gcaptcha_site_key']) + 'value' => $config['gcaptcha_site_key'] ]) ?>
@@ -286,7 +294,7 @@ 'name' => 'gcaptcha_secret_key', 'id' => 'gcaptcha_secret_key', 'class' => 'form-control input-sm required', - 'value' => esc($config['gcaptcha_secret_key']) + 'value' => $config['gcaptcha_secret_key'] ]) ?>
@@ -298,51 +306,51 @@
- 'suggestions_first_column', + 'options' => [ 'name' => lang('Items.name'), 'item_number' => lang('Items.number_information'), 'unit_price' => lang('Items.unit_price'), 'cost_price' => lang('Items.cost_price') ], - esc($config['suggestions_first_column']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['suggestions_first_column'], + 'extra' => "class='form-control input-sm'" + ]) ?>
- 'suggestions_second_column', + 'options' => [ '' => lang('Config.none'), 'name' => lang('Items.name'), 'item_number' => lang('Items.number_information'), 'unit_price' => lang('Items.unit_price'), 'cost_price' => lang('Items.cost_price') ], - esc($config['suggestions_second_column']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['suggestions_second_column'], + 'extra' => "class='form-control input-sm'" + ]) ?>
- 'suggestions_third_column', + 'options' => [ '' => lang('Config.none'), 'name' => lang('Items.name'), 'item_number' => lang('Items.number_information'), 'unit_price' => lang('Items.unit_price'), 'cost_price' => lang('Items.cost_price') ], - esc($config['suggestions_third_column']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['suggestions_third_column'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -473,12 +481,12 @@ $(document).ready(function() lines_per_page: { required: true, - remote: "" + remote: "" }, default_sales_discount: { required: true, - remote: "" + remote: "" }, gcaptcha_site_key: { diff --git a/app/Views/configs/integrations_config.php b/app/Views/configs/integrations_config.php index 2dcca5c81..384b52529 100644 --- a/app/Views/configs/integrations_config.php +++ b/app/Views/configs/integrations_config.php @@ -20,7 +20,7 @@ 'name' => 'mailchimp_api_key', 'id' => 'mailchimp_api_key', 'class' => 'form-control input-sm', - 'value' => esc($mailchimp['api_key']) + 'value' => $mailchimp['api_key'] ]) ?> @@ -36,12 +36,12 @@
- 'mailchimp_list_id', 'class' => 'form-control input-sm'] - ) ?> + 'mailchimp_list_id', + 'options' => $mailchimp['lists'], + 'selected' => $mailchimp['list_id'], + 'extra' => "id='mailchimp_list_id' class='form-control input-sm'" + ]) ?>
@@ -61,7 +61,7 @@ $(document).ready(function() { $('#mailchimp_api_key').change(function() { - $.post("", { + $.post("", { 'mailchimp_api_key': $('#mailchimp_api_key').val() }, function(response) { diff --git a/app/Views/configs/invoice_config.php b/app/Views/configs/invoice_config.php index 9214461e7..ea07450aa 100644 --- a/app/Views/configs/invoice_config.php +++ b/app/Views/configs/invoice_config.php @@ -25,7 +25,12 @@
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'invoice_type', + 'options' => $invoice_type_options, + 'selected' => $config['invoice_type'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -36,7 +41,7 @@ 'name' => 'recv_invoice_format', 'id' => 'recv_invoice_format', 'class' => 'form-control input-sm', - 'value' => esc($config['recv_invoice_format']) + 'value' => $config['recv_invoice_format'] ]) ?> @@ -48,7 +53,7 @@ 'name' => 'invoice_default_comments', 'id' => 'invoice_default_comments', 'class' => 'form-control input-sm', - 'value' => esc($config['invoice_default_comments']) + 'value' => $config['invoice_default_comments'] ]) ?> @@ -60,7 +65,7 @@ 'name' => 'invoice_email_message', 'id' => 'invoice_email_message', 'class' => 'form-control input-sm', - 'value' => esc($config['invoice_email_message']) + 'value' => $config['invoice_email_message'] ]) ?> @@ -68,7 +73,12 @@
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'line_sequence', + 'options' => $line_sequence_options, + 'selected' => $config['line_sequence'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -79,7 +89,7 @@ 'name' => 'sales_invoice_format', 'id' => 'sales_invoice_format', 'class' => 'form-control input-sm', - 'value' => esc($config['sales_invoice_format']) + 'value' => $config['sales_invoice_format'] ]) ?> @@ -104,7 +114,7 @@ 'name' => 'sales_quote_format', 'id' => 'sales_quote_format', 'class' => 'form-control input-sm', - 'value' => esc($config['sales_quote_format']) + 'value' => $config['sales_quote_format'] ]) ?> @@ -129,7 +139,7 @@ 'name' => 'quote_default_comments', 'id' => 'quote_default_comments', 'class' => 'form-control input-sm', - 'value' => esc($config['quote_default_comments']) + 'value' => $config['quote_default_comments'] ]) ?> @@ -153,7 +163,7 @@ 'name' => 'work_order_format', 'id' => 'work_order_format', 'class' => 'form-control input-sm', - 'value' => esc($config['work_order_format']) + 'value' => $config['work_order_format'] ]) ?> diff --git a/app/Views/configs/license_config.php b/app/Views/configs/license_config.php index 93086ce79..b96102151 100644 --- a/app/Views/configs/license_config.php +++ b/app/Views/configs/license_config.php @@ -12,14 +12,14 @@ { ?>
- 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
'license', 'id' => 'license_' . $counter++, //TODO: String Interpolation 'class' => 'form-control', 'readonly' => '', - 'value' => esc($license['text']) + 'value' => $license['text'] ]) ?>
diff --git a/app/Views/configs/locale_config.php b/app/Views/configs/locale_config.php index f26e56cd5..82dcf9e54 100644 --- a/app/Views/configs/locale_config.php +++ b/app/Views/configs/locale_config.php @@ -16,8 +16,15 @@ 'control-label col-xs-2']) ?>
- 'form-control input-sm', 'id' => 'number_locale']) ?> - + 'number_locale', + 'value' => $config['number_locale'], + 'extra' => "class='form-control input-sm' id='number_locale'" + ]) ?> + 'save_number_locale', + 'value' => $config['number_locale'] + ]) ?>
@@ -63,7 +70,7 @@ 'name' => 'currency_code', 'id' => 'currency_code', 'class' => 'form-control input-sm number_locale', - 'value' => esc($currency_code) + 'value' => $currency_code ]) ?> @@ -144,32 +151,37 @@
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'cash_rounding_code', + 'options' => $rounding_options, + 'selected' => $config['cash_rounding_code'], + 'extra' => "class='form-control input-sm'" + ]) ?>
'control-label col-xs-2']) ?>
- 'payment_options_order', + 'options' => [ 'cashdebitcredit' => lang('Sales.cash') . ' / ' . lang('Sales.debit') . ' / ' . lang('Sales.credit'), 'debitcreditcash' => lang('Sales.debit') . ' / ' . lang('Sales.credit') . ' / ' . lang('Sales.cash'), 'debitcashcredit' => lang('Sales.debit') . ' / ' . lang('Sales.cash') . ' / ' . lang('Sales.credit'), 'creditdebitcash' => lang('Sales.credit') . ' / ' . lang('Sales.debit') . ' / ' . lang('Sales.cash'), 'creditcashdebit' => lang('Sales.credit') . ' / ' . lang('Sales.cash') . ' / ' . lang('Sales.debit') ], - esc($config['payment_options_order']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['payment_options_order'], + 'extra' => "class='form-control input-sm'" + ]) ?>
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'form-control input-sm']) ?>
@@ -43,7 +43,7 @@ 'name' => 'msg_src', 'id' => 'msg_src', 'class' => 'form-control input-sm required', - 'value' => $config['msg_src'] == NULL ? esc($config['company']) : esc($config['msg_src']) + 'value' => $config['msg_src'] == NULL ? $config['company'] : $config['msg_src'] ]) ?> diff --git a/app/Views/configs/receipt_config.php b/app/Views/configs/receipt_config.php index 8c2cca56a..b59a0d1f5 100644 --- a/app/Views/configs/receipt_config.php +++ b/app/Views/configs/receipt_config.php @@ -7,14 +7,15 @@
'control-label col-xs-2']) ?>
- 'receipt_template', + 'options' => [ 'receipt_default' => lang('Config.receipt_default'), 'receipt_short' => lang('Config.receipt_short') ], - esc($config['receipt_template']), - ['class' => 'form-control input-sm'] - ) ?> + 'selected' => $config['receipt_template'], + 'extra' => "class='form-control input-sm'" + ]) ?>
diff --git a/app/Views/configs/table_config.php b/app/Views/configs/table_config.php index c70b8e5a4..c3a864ae2 100644 --- a/app/Views/configs/table_config.php +++ b/app/Views/configs/table_config.php @@ -117,7 +117,7 @@ $(document).ready(function() }, success: function(response) { $.notify({ message: response.message }, { type: response.success ? 'success' : 'danger'}); - $("#dinner_tables").load('', init_add_remove_tables); + $("#dinner_tables").load('', init_add_remove_tables); }, dataType: 'json' }); diff --git a/app/Views/configs/tax_config.php b/app/Views/configs/tax_config.php index 777103acd..26f1decf3 100644 --- a/app/Views/configs/tax_config.php +++ b/app/Views/configs/tax_config.php @@ -19,7 +19,7 @@ 'name' => 'tax_id', 'id' => 'tax_id', 'class' => 'form-control input-sm', - 'value' => esc($config['tax_id']) + 'value' => $config['tax_id'] ]) ?> @@ -43,7 +43,7 @@ 'name' => 'default_tax_1_name', 'id' => 'default_tax_1_name', 'class' => 'form-control input-sm', - 'value' => $config['default_tax_1_name'] !== FALSE ? esc($config['default_tax_1_name']) : lang('Items.sales_tax_1')]) ?> + 'value' => $config['default_tax_1_name'] !== FALSE ? $config['default_tax_1_name'] : lang('Items.sales_tax_1')]) ?>
'default_tax_2_name', 'id' => 'default_tax_2_name', 'class' => 'form-control input-sm', - 'value' => $config['default_tax_2_name'] !== FALSE ? esc($config['default_tax_2_name']) : lang('Items.sales_tax_2') + 'value' => $config['default_tax_2_name'] !== FALSE ? $config['default_tax_2_name'] : lang('Items.sales_tax_2') ]) ?>
@@ -92,21 +92,36 @@
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'default_tax_code', + 'options' => $tax_code_options, + 'selected' => $config['default_tax_code'], + 'extra' => "class='form-control input-sm'" + ]) ?>
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'default_tax_category', + 'options' => $tax_category_options, + 'selected' => $config['default_tax_category'], + 'extra' => "class='form-control input-sm'" + ]) ?>
'control-label col-xs-2']) ?>
- 'form-control input-sm']) ?> + 'default_tax_jurisdiction', + 'options' => $tax_jurisdiction_options, + 'selected' => $config['default_tax_jurisdiction'], + 'extra' => "class='form-control input-sm'" + ]) ?>
@@ -159,11 +174,11 @@ $(document).ready(function() { default_tax_1_rate: { - remote: "" + remote: "" }, default_tax2_rate: { - remote: "" + remote: "" }, }, @@ -171,7 +186,7 @@ $(document).ready(function() { default_tax_1_rate: { - number: "" + number: "" }, } })); diff --git a/app/Views/customers/form.php b/app/Views/customers/form.php index c7bf76540..438382721 100644 --- a/app/Views/customers/form.php +++ b/app/Views/customers/form.php @@ -137,7 +137,7 @@ 'name' => 'package_id', 'options' => $packages, 'selected' => $selected_package, - 'extra' => ['class' => 'form-control'] + 'extra' => "class='form-control input-sm'" ]) ?>