diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 3502cae6b..5688f0a8c 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -173,4 +173,3 @@ const CASH_MODE_FALSE = 0; */ const GOODS_SUPPLIER = 0; const COST_SUPPLIER = 1; - diff --git a/app/Config/Routing.php b/app/Config/Routing.php index c71af42a4..0a1847789 100644 --- a/app/Config/Routing.php +++ b/app/Config/Routing.php @@ -81,17 +81,17 @@ class Routing extends BaseRouting public ?string $override404 = null; /** - * If TRUE, the system will attempt to match the URI against + * If true, the system will attempt to match the URI against * Controllers by matching each segment against folders/files * in APPPATH/Controllers, when a match wasn't found against * defined routes. * - * If FALSE, will stop searching and do NO automatic routing. + * If false, will stop searching and do NO automatic routing. */ public bool $autoRoute = true; /** - * If TRUE, will enable the use of the 'prioritize' option + * If true, will enable the use of the 'prioritize' option * when defining routes. * * Default: false diff --git a/app/Config/Session.php b/app/Config/Session.php index c3e116c18..2edd477b8 100644 --- a/app/Config/Session.php +++ b/app/Config/Session.php @@ -86,7 +86,7 @@ class Session extends BaseConfig * -------------------------------------------------------------------------- * * Whether to destroy session data associated with the old session ID - * when auto-regenerating the session ID. When set to FALSE, the data + * when auto-regenerating the session ID. When set to false, the data * will be later deleted by the garbage collector. */ public bool $regenerateDestroy = true; diff --git a/app/Config/Validation/OSPOSRules.php b/app/Config/Validation/OSPOSRules.php index 2c36f3bca..9e6ff662b 100644 --- a/app/Config/Validation/OSPOSRules.php +++ b/app/Config/Validation/OSPOSRules.php @@ -81,15 +81,15 @@ class OSPOSRules $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify"); - curl_setopt($ch, CURLOPT_POST, TRUE); + curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($check)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); - $status = json_decode($result, TRUE); + $status = json_decode($result, true); if(!empty($status['success'])) { diff --git a/app/Controllers/Attributes.php b/app/Controllers/Attributes.php index d122f5088..207676d5d 100644 --- a/app/Controllers/Attributes.php +++ b/app/Controllers/Attributes.php @@ -109,12 +109,12 @@ class Attributes extends Secure_Controller //Save definition data $definition_data = [ 'definition_name' => $this->request->getPost('definition_name'), - 'definition_unit' => $this->request->getPost('definition_unit') != '' ? $this->request->getPost('definition_unit') : NULL, + 'definition_unit' => $this->request->getPost('definition_unit') != '' ? $this->request->getPost('definition_unit') : null, 'definition_flags' => $definition_flags, - 'definition_fk' => $this->request->getPost('definition_group') != '' ? $this->request->getPost('definition_group') : NULL + 'definition_fk' => $this->request->getPost('definition_group') != '' ? $this->request->getPost('definition_group') : null ]; - if ($this->request->getPost('definition_type') != NULL) + if ($this->request->getPost('definition_type') != null) { $definition_data['definition_type'] = DEFINITION_TYPES[$this->request->getPost('definition_type')]; } @@ -134,7 +134,7 @@ class Attributes extends Secure_Controller } echo json_encode([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Attributes.definition_successful_adding') . ' ' . $definition_name, 'id' => $definition_data['definition_id'] ]); @@ -143,7 +143,7 @@ class Attributes extends Secure_Controller else { echo json_encode([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Attributes.definition_successful_updating') . ' ' . $definition_name, 'id' => $definition_id ]); @@ -153,7 +153,7 @@ class Attributes extends Secure_Controller else { echo json_encode([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Attributes.definition_error_adding_updating', [$definition_name]), 'id' => NEW_ENTRY ]); @@ -243,11 +243,11 @@ class Attributes extends Secure_Controller if($this->attribute->delete_definition_list($attributes_to_delete)) { $message = lang('Attributes.definition_successful_deleted') . ' ' . count($attributes_to_delete) . ' ' . lang('Attributes.definition_one_or_multiple'); - echo json_encode(['success' => TRUE, 'message' => $message]); + echo json_encode(['success' => true, 'message' => $message]); } else { - echo json_encode(['success' => FALSE, 'message' => lang('Attributes.definition_cannot_be_deleted')]); + echo json_encode(['success' => false, 'message' => lang('Attributes.definition_cannot_be_deleted')]); } } } diff --git a/app/Controllers/Cashups.php b/app/Controllers/Cashups.php index 8d68407bd..73158fa0e 100644 --- a/app/Controllers/Cashups.php +++ b/app/Controllers/Cashups.php @@ -45,11 +45,11 @@ class Cashups extends Secure_Controller $filters = [ 'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS), //TODO: Is this the best way to filter dates 'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'is_deleted' => FALSE + 'is_deleted' => false ]; // check if any filter is set in the multiselect dropdown - $filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), TRUE); //TODO: $filledup doesn't follow variable naming patterns we are using. + $filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), true); //TODO: $filledup doesn't follow variable naming patterns we are using. $filters = array_merge($filters, $filledup); $cash_ups = $this->cashup->search($search, $filters, $limit, $offset, $sort, $order); $total_rows = $this->cashup->get_found_rows($search, $filters); @@ -171,12 +171,12 @@ class Cashups extends Secure_Controller // lookup expenses paid in cash $filters = [ - 'only_cash' => TRUE, - 'only_due' => FALSE, - 'only_check' => FALSE, - 'only_credit' => FALSE, - 'only_debit' => FALSE, - 'is_deleted' => FALSE + 'only_cash' => true, + 'only_due' => false, + 'only_check' => false, + 'only_credit' => false, + 'only_debit' => false, + 'is_deleted' => false ]; $payments = $this->expense->get_payments_summary('', array_merge($inputs, $filters)); @@ -220,11 +220,11 @@ class Cashups extends Secure_Controller 'closed_amount_card' => parse_decimals($this->request->getPost('closed_amount_card', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), 'closed_amount_check' => parse_decimals($this->request->getPost('closed_amount_check', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), 'closed_amount_total' => parse_decimals($this->request->getPost('closed_amount_total', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), - 'note' => $this->request->getPost('note') != NULL, + 'note' => $this->request->getPost('note') != null, 'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'open_employee_id' => $this->request->getPost('open_employee_id', FILTER_SANITIZE_NUMBER_INT), 'close_employee_id' => $this->request->getPost('close_employee_id', FILTER_SANITIZE_NUMBER_INT), - 'deleted' => $this->request->getPost('deleted') != NULL + 'deleted' => $this->request->getPost('deleted') != null ]; if($this->cashup->save_value($cash_up_data, $cashup_id)) @@ -232,16 +232,16 @@ class Cashups extends Secure_Controller //New cashup_id if($cashup_id == NEW_ENTRY) { - echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_adding'), 'id' => $cash_up_data['cashup_id']]); + echo json_encode(['success' => true, 'message' => lang('Cashups.successful_adding'), 'id' => $cash_up_data['cashup_id']]); } else // Existing Cashup { - echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_updating'), 'id' => $cashup_id]); + echo json_encode(['success' => true, 'message' => lang('Cashups.successful_updating'), 'id' => $cashup_id]); } } else//failure { - echo json_encode(['success' => FALSE, 'message' => lang('Cashups.error_adding_updating'), 'id' => NEW_ENTRY]); + echo json_encode(['success' => false, 'message' => lang('Cashups.error_adding_updating'), 'id' => NEW_ENTRY]); } } @@ -251,11 +251,11 @@ class Cashups extends Secure_Controller if($this->cashup->delete_list($cash_ups_to_delete)) { - echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_deleted') . ' ' . count($cash_ups_to_delete) . ' ' . lang('Cashups.one_or_multiple'), 'ids' => $cash_ups_to_delete]); + echo json_encode(['success' => true, 'message' => lang('Cashups.successful_deleted') . ' ' . count($cash_ups_to_delete) . ' ' . lang('Cashups.one_or_multiple'), 'ids' => $cash_ups_to_delete]); } else { - echo json_encode(['success' => FALSE, 'message' => lang('Cashups.cannot_be_deleted'), 'ids' => $cash_ups_to_delete]); + echo json_encode(['success' => false, 'message' => lang('Cashups.cannot_be_deleted'), 'ids' => $cash_ups_to_delete]); } } diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 4b169b0ad..a6a44113e 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -80,15 +80,15 @@ class Config extends Secure_Controller private function _licenses(): array //TODO: remove hungarian notation. Super long function. Perhaps we need to refactor out functions? { $i = 0; - $bower = FALSE; - $composer = FALSE; + $bower = false; + $composer = false; $license = []; $license[$i]['title'] = 'Open Source Point Of Sale ' . config('App')->application_version; if(file_exists('license/LICENSE')) { - $license[$i]['text'] = file_get_contents('license/LICENSE', false, NULL, 0, 2000); + $license[$i]['text'] = file_get_contents('license/LICENSE', false, null, 0, 2000); } else { @@ -108,13 +108,13 @@ class Config extends Secure_Controller $basename = 'license/' . $fileinfo->getBasename('.version'); - $license[$i]['title'] = file_get_contents($basename . '.version', false, NULL, 0, 100); + $license[$i]['title'] = file_get_contents($basename . '.version', false, null, 0, 100); $license_text_file = $basename . '.license'; if(file_exists($license_text_file)) { - $license[$i]['text'] = file_get_contents($license_text_file , false, NULL, 0, 2000); + $license[$i]['text'] = file_get_contents($license_text_file , false, null, 0, 2000); } else { @@ -124,12 +124,12 @@ class Config extends Secure_Controller elseif($fileinfo->getBasename() == 'bower.LICENSES') { // set a flag to indicate that the JS Plugin bower.LICENSES file is available and needs to be attached at the end - $bower = TRUE; + $bower = true; } elseif($fileinfo->getBasename() == 'composer.LICENSES') { // set a flag to indicate that the composer.LICENSES file is available and needs to be attached at the end - $composer = TRUE; + $composer = true; } } } @@ -142,7 +142,7 @@ class Config extends Secure_Controller $license[$i]['text'] = ''; $file = file_get_contents('license/composer.LICENSES'); - $array = json_decode($file, TRUE); + $array = json_decode($file, true); foreach($array as $key => $val) { @@ -192,7 +192,7 @@ class Config extends Secure_Controller $license[$i]['text'] = ''; $file = file_get_contents('license/bower.LICENSES'); - $array = json_decode($file, TRUE); + $array = json_decode($file, true); foreach($array as $key => $val) { @@ -335,7 +335,7 @@ class Config extends Secure_Controller 'return_policy' => $this->request->getPost('return_policy') ]; - if(!empty($upload_data['orig_name']) && $upload_data['raw_name'] === TRUE) + if(!empty($upload_data['orig_name']) && $upload_data['raw_name']) { $batch_save_data['company_logo'] = $upload_data['raw_name'] . $upload_data['file_ext']; } @@ -396,12 +396,12 @@ class Config extends Secure_Controller $batch_save_data = [ '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_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, + 'default_receivings_discount_type' => $this->request->getPost('default_receivings_discount_type') != null, 'default_receivings_discount' => $this->request->getPost('default_receivings_discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 'enforce_privacy' => $this->request->getPost('enforce_privacy', FILTER_SANITIZE_NUMBER_INT), - 'receiving_calculate_average_price' => $this->request->getPost('receiving_calculate_average_price') != NULL, + 'receiving_calculate_average_price' => $this->request->getPost('receiving_calculate_average_price') != null, 'lines_per_page' => $this->request->getPost('lines_per_page', FILTER_SANITIZE_NUMBER_INT), 'notify_horizontal_position' => $this->request->getPost('notify_horizontal_position', FILTER_SANITIZE_NUMBER_INT), 'notify_vertical_position' => $this->request->getPost('notify_vertical_position', FILTER_SANITIZE_NUMBER_INT), @@ -409,20 +409,20 @@ class Config extends Secure_Controller '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')), - 'gcaptcha_enable' => $this->request->getPost('gcaptcha_enable') != NULL, + 'gcaptcha_enable' => $this->request->getPost('gcaptcha_enable') != null, '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, - 'category_dropdown' => $this->request->getPost('category_dropdown') != NULL + '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, + 'category_dropdown' => $this->request->getPost('category_dropdown') != null ]; - $this->module->set_show_office_group($this->request->getPost('show_office_group') != NULL); + $this->module->set_show_office_group($this->request->getPost('show_office_group') != null); if($batch_save_data['category_dropdown'] == 1) { @@ -474,7 +474,7 @@ class Config extends Secure_Controller $number_local_example = $fmt->format(1234567890.12300); echo json_encode([ - 'success' => $number_local_example != FALSE, + 'success' => $number_local_example != false, 'save_number_locale' => $save_number_locale, 'number_locale_example' => $number_local_example, 'currency_symbol' => $currency_symbol, @@ -580,7 +580,7 @@ class Config extends Secure_Controller $result = []; $lists = $mailchimp_lib->getLists(); - if($lists !== FALSE) + if($lists !== false) { if(is_array($lists) && !empty($lists['lists']) && is_array($lists['lists'])) { @@ -688,7 +688,7 @@ class Config extends Secure_Controller $this->db->transStart(); $not_to_delete = []; - foreach($this->request->getPost(NULL) as $key => $value) + foreach($this->request->getPost() as $key => $value) { if(strstr($key, 'stock_location')) { @@ -731,14 +731,14 @@ class Config extends Secure_Controller { $this->db->transStart(); - $dinner_table_enable = $this->request->getPost('dinner_table_enable') != NULL; + $dinner_table_enable = $this->request->getPost('dinner_table_enable') != null; $this->appconfig->save(['dinner_table_enable' => $dinner_table_enable]); if($dinner_table_enable) { $not_to_delete = []; - foreach($this->request->getPost(NULL) as $key => $value) //TODO: Not sure if this is the best way to filter the array + foreach($this->request->getPost() 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,8 +785,8 @@ class Config extends Secure_Controller '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'), - 'tax_included' => $this->request->getPost('tax_included') != NULL, - 'use_destination_based_tax' => $this->request->getPost('use_destination_based_tax') != NULL, + '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'), 'default_tax_category' => $this->request->getPost('default_tax_category'), 'default_tax_jurisdiction' => $this->request->getPost('default_tax_jurisdiction'), @@ -811,7 +811,7 @@ class Config extends Secure_Controller { $this->db->transStart(); - $customer_reward_enable = $this->request->getPost('customer_reward_enable') != NULL; + $customer_reward_enable = $this->request->getPost('customer_reward_enable') != null; $this->appconfig->save(['customer_reward_enable' => $customer_reward_enable]); @@ -819,7 +819,7 @@ class Config extends Secure_Controller { $not_to_delete = []; $array_save = []; - foreach($this->request->getPost(NULL) as $key => $value) + foreach($this->request->getPost() as $key => $value) { if(strstr($key, 'customer_reward') && $key != 'customer_reward_enable') { @@ -880,8 +880,8 @@ class Config extends Secure_Controller '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_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'), 'barcode_formats' => json_encode($this->request->getPost('barcode_formats')) ]; @@ -902,15 +902,15 @@ class Config extends Secure_Controller 'print_delay_autoreturn' => $this->request->getPost('print_delay_autoreturn', FILTER_SANITIZE_NUMBER_INT), '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), - 'receipt_show_total_discount' => $this->request->getPost('receipt_show_total_discount') != NULL, - 'receipt_show_description' => $this->request->getPost('receipt_show_description') != NULL, - 'receipt_show_serialnumber' => $this->request->getPost('receipt_show_serialnumber') != NULL, - 'print_silently' => $this->request->getPost('print_silently') != NULL, - 'print_header' => $this->request->getPost('print_header') != NULL, - 'print_footer' => $this->request->getPost('print_footer') != NULL, + '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), + 'receipt_show_total_discount' => $this->request->getPost('receipt_show_total_discount') != null, + 'receipt_show_description' => $this->request->getPost('receipt_show_description') != null, + 'receipt_show_serialnumber' => $this->request->getPost('receipt_show_serialnumber') != null, + 'print_silently' => $this->request->getPost('print_silently') != null, + 'print_header' => $this->request->getPost('print_header') != null, + 'print_footer' => $this->request->getPost('print_footer') != null, 'print_top_margin' => $this->request->getPost('print_top_margin', FILTER_SANITIZE_NUMBER_INT), 'print_left_margin' => $this->request->getPost('print_left_margin', FILTER_SANITIZE_NUMBER_INT), 'print_bottom_margin' => $this->request->getPost('print_bottom_margin', FILTER_SANITIZE_NUMBER_INT), @@ -928,7 +928,7 @@ class Config extends Secure_Controller public function postSaveInvoice(): void { $batch_save_data = [ - 'invoice_enable' => $this->request->getPost('invoice_enable') != NULL, + 'invoice_enable' => $this->request->getPost('invoice_enable') != null, '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'), @@ -938,7 +938,7 @@ class Config extends Secure_Controller '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'), - 'work_order_enable' => $this->request->getPost('work_order_enable') != NULL, + 'work_order_enable' => $this->request->getPost('work_order_enable') != null, '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') @@ -948,7 +948,7 @@ 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) { if($this->config['invoice_enable']) { diff --git a/app/Controllers/Customers.php b/app/Controllers/Customers.php index 9fb326e51..d6945cd74 100644 --- a/app/Controllers/Customers.php +++ b/app/Controllers/Customers.php @@ -124,14 +124,14 @@ class Customers extends Persons */ public function getSuggest(): void { - $suggestions = $this->customer->get_search_suggestions($this->request->getGet('term'), 25,TRUE); + $suggestions = $this->customer->get_search_suggestions($this->request->getGet('term'), 25,true); echo json_encode($suggestions); } public function suggest_search(): void { - $suggestions = $this->customer->get_search_suggestions($this->request->getPost('term'), 25, FALSE); + $suggestions = $this->customer->get_search_suggestions($this->request->getPost('term'), 25, false); echo json_encode($suggestions); } @@ -162,7 +162,7 @@ class Customers extends Persons $tax_code_info = $this->tax_code->get_info($info->sales_tax_code_id); - if($tax_code_info->tax_code != NULL) + if($tax_code_info->tax_code != null) { $data['sales_tax_code_label'] = $tax_code_info->tax_code . ' ' . $tax_code_info->tax_code_name; } @@ -181,11 +181,11 @@ class Customers extends Persons if($this->config['use_destination_based_tax']) //TODO: This can be shortened for ternary notation { - $data['use_destination_based_tax'] = TRUE; + $data['use_destination_based_tax'] = true; } else { - $data['use_destination_based_tax'] = FALSE; + $data['use_destination_based_tax'] = false; } // retrieve the total amount the customer spent so far together with min, max and average values @@ -203,12 +203,12 @@ class Customers extends Persons if(!empty($info->email)) { // collect mailchimp customer info - if(($mailchimp_info = $this->mailchimp_lib->getMemberInfo($this->_list_id, $info->email)) !== FALSE) + if(($mailchimp_info = $this->mailchimp_lib->getMemberInfo($this->_list_id, $info->email)) !== false) { $data['mailchimp_info'] = $mailchimp_info; // collect customer mailchimp emails activities (stats) - if(($activities = $this->mailchimp_lib->getMemberActivity($this->_list_id, $info->email)) !== FALSE) + if(($activities = $this->mailchimp_lib->getMemberActivity($this->_list_id, $info->email)) !== false) { if(array_key_exists('activity', $activities)) { @@ -288,17 +288,17 @@ class Customers extends Persons $date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $this->request->getPost('date')); $customer_data = [ - 'consent' => $this->request->getPost('consent') != NULL, - 'account_number' => $this->request->getPost('account_number') == '' ? NULL : $this->request->getPost('account_number'), + 'consent' => $this->request->getPost('consent') != null, + 'account_number' => $this->request->getPost('account_number') == '' ? null : $this->request->getPost('account_number'), 'tax_id' => $this->request->getPost('tax_id'), - 'company_name' => $this->request->getPost('company_name') == '' ? NULL : $this->request->getPost('company_name'), + 'company_name' => $this->request->getPost('company_name') == '' ? null : $this->request->getPost('company_name'), 'discount' => $this->request->getPost('discount') == '' ? 0.00 : $this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), - 'discount_type' => $this->request->getPost('discount_type') == NULL ? PERCENT : $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT), - 'package_id' => $this->request->getPost('package_id') == '' ? NULL : $this->request->getPost('package_id'), - 'taxable' => $this->request->getPost('taxable') != NULL, + 'discount_type' => $this->request->getPost('discount_type') == null ? PERCENT : $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT), + 'package_id' => $this->request->getPost('package_id') == '' ? null : $this->request->getPost('package_id'), + 'taxable' => $this->request->getPost('taxable') != null, 'date' => $date_formatter->format('Y-m-d H:i:s'), 'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT), - 'sales_tax_code_id' => $this->request->getPost('sales_tax_code_id') == '' ? NULL : $this->request->getPost('sales_tax_code_id', FILTER_SANITIZE_NUMBER_INT) + 'sales_tax_code_id' => $this->request->getPost('sales_tax_code_id') == '' ? null : $this->request->getPost('sales_tax_code_id', FILTER_SANITIZE_NUMBER_INT) ]; if($this->customer->save_customer($person_data, $customer_data, $customer_id)) @@ -311,14 +311,14 @@ class Customers extends Persons $first_name, $last_name, $mailchimp_status == null ? "" : $mailchimp_status, - ['vip' => $this->request->getPost('mailchimp_vip') != NULL] + ['vip' => $this->request->getPost('mailchimp_vip') != null] ); // New customer if($customer_id == NEW_ENTRY) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Customers.successful_adding') . ' ' . $first_name . ' ' . $last_name, 'id' => $customer_data['person_id'] ]); @@ -326,7 +326,7 @@ class Customers extends Persons else // Existing customer { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Customers.successful_updating') . ' ' . $first_name . ' ' . $last_name, 'id' => $customer_id ]); @@ -335,7 +335,7 @@ class Customers extends Persons else // Failure { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Customers.error_adding_updating') . ' ' . $first_name . ' ' . $last_name, 'id' => NEW_ENTRY ]); @@ -385,12 +385,12 @@ class Customers extends Persons if($count == count($customers_to_delete)) { - echo json_encode (['success' => TRUE, + echo json_encode (['success' => true, 'message' => lang('Customers.successful_deleted') . ' ' . $count . ' ' . lang('Customers.one_or_multiple')]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Customers.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Customers.cannot_be_deleted')]); } } @@ -413,11 +413,11 @@ class Customers extends Persons { if($_FILES['file_path']['error'] != UPLOAD_ERR_OK) { - echo json_encode (['success' => FALSE, 'message' => lang('Customers.csv_import_failed')]); + echo json_encode (['success' => false, 'message' => lang('Customers.csv_import_failed')]); } else { - if(($handle = fopen($_FILES['file_path']['tmp_name'], 'r')) !== FALSE) + if(($handle = fopen($_FILES['file_path']['tmp_name'], 'r')) !== false) { // Skip the first row as it's the table description fgetcsv($handle); @@ -425,7 +425,7 @@ class Customers extends Persons $failCodes = []; - while(($data = fgetcsv($handle)) !== FALSE) + while(($data = fgetcsv($handle)) !== false) { $consent = $data[3] == '' ? 0 : 1; @@ -469,7 +469,7 @@ class Customers extends Persons } else { - $invalidated = TRUE; + $invalidated = true; } if($invalidated) @@ -493,16 +493,16 @@ class Customers extends Persons { $message = lang('Customers.csv_import_partially_failed', [count($failCodes), implode(', ', $failCodes)]); - echo json_encode (['success' => FALSE, 'message' => $message]); + echo json_encode (['success' => false, 'message' => $message]); } else { - echo json_encode (['success' => TRUE, 'message' => lang('Customers.csv_import_success')]); + echo json_encode (['success' => true, 'message' => lang('Customers.csv_import_success')]); } } else { - echo json_encode (['success' => FALSE, 'message' => lang('Customers.csv_import_nodata_wrongformat')]); + echo json_encode (['success' => false, 'message' => lang('Customers.csv_import_nodata_wrongformat')]); } } } diff --git a/app/Controllers/Employees.php b/app/Controllers/Employees.php index 195cd433e..5cb822946 100644 --- a/app/Controllers/Employees.php +++ b/app/Controllers/Employees.php @@ -127,12 +127,12 @@ class Employees extends Persons foreach($this->module->get_all_permissions()->getResult() as $permission) { $grants = []; - $grant = $this->request->getPost('grant_'.$permission->permission_id) != NULL ? $this->request->getPost('grant_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; + $grant = $this->request->getPost('grant_'.$permission->permission_id) != null ? $this->request->getPost('grant_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; if($grant == $permission->permission_id) { $grants['permission_id'] = $permission->permission_id; - $grants['menu_group'] = $this->request->getPost('menu_group_'.$permission->permission_id) != NULL ? $this->request->getPost('menu_group_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '--'; + $grants['menu_group'] = $this->request->getPost('menu_group_'.$permission->permission_id) != null ? $this->request->getPost('menu_group_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '--'; $grants_array[] = $grants; } } @@ -165,7 +165,7 @@ class Employees extends Persons if($employee_id == NEW_ENTRY) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Employees.successful_adding') . ' ' . $first_name . ' ' . $last_name, 'id' => $employee_data['person_id'] ]); @@ -173,7 +173,7 @@ class Employees extends Persons else // Existing employee { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Employees.successful_updating') . ' ' . $first_name . ' ' . $last_name, 'id' => $employee_id ]); @@ -182,7 +182,7 @@ class Employees extends Persons else // Failure { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Employees.error_adding_updating') . ' ' . $first_name . ' ' . $last_name, 'id' => NEW_ENTRY ]); @@ -199,13 +199,13 @@ class Employees extends Persons if($this->employee->delete_list($employees_to_delete)) //TODO: this is passing a string, but delete_list expects an array { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Employees.successful_deleted') . ' ' . count($employees_to_delete) . ' ' . lang('Employees.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Employees.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Employees.cannot_be_deleted')]); } } diff --git a/app/Controllers/Expenses.php b/app/Controllers/Expenses.php index 30e7bfceb..d7c11fe87 100644 --- a/app/Controllers/Expenses.php +++ b/app/Controllers/Expenses.php @@ -55,7 +55,7 @@ class Expenses extends Secure_Controller ]; // check if any filter is set in the multiselect dropdown - $filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), TRUE); //TODO: variable naming does not match standard + $filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), true); //TODO: variable naming does not match standard $filters = array_merge($filters, $filledup); $expenses = $this->expense->search($search, $filters, $limit, $offset, $sort, $order); $total_rows = $this->expense->get_found_rows($search, $filters); @@ -94,7 +94,7 @@ class Expenses extends Secure_Controller $data['expenses_info'] = $this->expense->get_info($expense_id); $expense_categories = []; - foreach($this->expense_category->get_all(0, 0, TRUE)->getResultArray() as $row) + foreach($this->expense_category->get_all(0, 0, true)->getResultArray() as $row) { $expense_categories[$row['expense_category_id']] = $row['category_name']; } @@ -142,7 +142,7 @@ class Expenses extends Secure_Controller $expense_data = [ 'date' => $date_formatter->format('Y-m-d H:i:s'), - 'supplier_id' => $this->request->getPost('supplier_id') == '' ? NULL : $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT), + 'supplier_id' => $this->request->getPost('supplier_id') == '' ? null : $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT), 'supplier_tax_code' => $this->request->getPost('supplier_tax_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'amount' => parse_decimals($this->request->getPost('amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), 'tax_amount' => parse_decimals($this->request->getPost('tax_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), @@ -150,7 +150,7 @@ class Expenses extends Secure_Controller 'expense_category_id' => $this->request->getPost('expense_category_id', FILTER_SANITIZE_NUMBER_INT), 'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT), - 'deleted' => $this->request->getPost('deleted') != NULL + 'deleted' => $this->request->getPost('deleted') != null ]; if($this->expense->save_value($expense_data, $expense_id)) @@ -158,24 +158,24 @@ class Expenses extends Secure_Controller //New Expense if($expense_id == NEW_ENTRY) { - echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_adding'), 'id' => $expense_data['expense_id']]); + echo json_encode (['success' => true, 'message' => lang('Expenses.successful_adding'), 'id' => $expense_data['expense_id']]); } else // Existing Expense { - echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_updating'), 'id' => $expense_id]); + echo json_encode (['success' => true, 'message' => lang('Expenses.successful_updating'), 'id' => $expense_id]); } } else//failure { - echo json_encode (['success' => FALSE, 'message' => lang('Expenses.error_adding_updating'), 'id' => NEW_ENTRY]); + echo json_encode (['success' => false, 'message' => lang('Expenses.error_adding_updating'), 'id' => NEW_ENTRY]); } } public function ajax_check_amount(): void { - $value = $this->request->getPost(NULL, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); + $value = $this->request->getPost(null, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $parsed_value = parse_decimals(array_pop($value)); - echo json_encode (['success' => $parsed_value !== FALSE]); + echo json_encode (['success' => $parsed_value !== false]); } public function postDelete(): void @@ -184,11 +184,11 @@ class Expenses extends Secure_Controller if($this->expense->delete_list($expenses_to_delete)) { - echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_deleted') . ' ' . count($expenses_to_delete) . ' ' . lang('Expenses.one_or_multiple'), 'ids' => $expenses_to_delete]); + echo json_encode (['success' => true, 'message' => lang('Expenses.successful_deleted') . ' ' . count($expenses_to_delete) . ' ' . lang('Expenses.one_or_multiple'), 'ids' => $expenses_to_delete]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Expenses.cannot_be_deleted'), 'ids' => $expenses_to_delete]); + echo json_encode (['success' => false, 'message' => lang('Expenses.cannot_be_deleted'), 'ids' => $expenses_to_delete]); } } } diff --git a/app/Controllers/Giftcards.php b/app/Controllers/Giftcards.php index dc60dcfd3..8658dc472 100644 --- a/app/Controllers/Giftcards.php +++ b/app/Controllers/Giftcards.php @@ -107,7 +107,7 @@ class Giftcards extends Secure_Controller 'record_time' => date('Y-m-d H:i:s'), 'giftcard_number' => $giftcard_number, 'value' => parse_decimals($this->request->getPost('giftcard_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)), - 'person_id' => $this->request->getPost('person_id') == '' ? NULL : $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT) + 'person_id' => $this->request->getPost('person_id') == '' ? null : $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT) ]; if($this->giftcard->save_value($giftcard_data, $giftcard_id)) @@ -116,7 +116,7 @@ class Giftcards extends Secure_Controller if($giftcard_id == NEW_ENTRY) //TODO: Constant needed { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Giftcards.successful_adding') . ' ' . $giftcard_data['giftcard_number'], 'id' => $giftcard_data['giftcard_id'] ]); @@ -124,7 +124,7 @@ class Giftcards extends Secure_Controller else //Existing giftcard { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Giftcards.successful_updating') . ' ' . $giftcard_data['giftcard_number'], 'id' => $giftcard_id ]); @@ -133,7 +133,7 @@ class Giftcards extends Secure_Controller else //failure { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Giftcards.error_adding_updating') . ' ' . $giftcard_data['giftcard_number'], 'id' => NEW_ENTRY ]); @@ -148,7 +148,7 @@ class Giftcards extends Secure_Controller public function postCheckNumberGiftcard(): void { $parsed_value = parse_decimals($this->request->getPost('giftcard_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); - echo json_encode (['success' => $parsed_value !== FALSE, 'giftcard_amount' => to_currency_no_money($parsed_value)]); + echo json_encode (['success' => $parsed_value !== false, 'giftcard_amount' => to_currency_no_money($parsed_value)]); } public function postDelete(): void @@ -158,13 +158,13 @@ class Giftcards extends Secure_Controller if($this->giftcard->delete_list($giftcards_to_delete)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Giftcards.successful_deleted') . ' ' . count($giftcards_to_delete).' '.lang('Giftcards.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Giftcards.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Giftcards.cannot_be_deleted')]); } } } diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index aebd34c46..eeb6e0d92 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -8,7 +8,7 @@ class Home extends Secure_Controller { public function __construct() { - parent::__construct('home', NULL, 'home'); + parent::__construct('home', null, 'home'); } public function getIndex(): void @@ -56,7 +56,7 @@ class Home extends Secure_Controller if($this->employee->change_password($employee_data, $employee_id)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Employees.successful_change_password'), 'id' => $employee_id ]); @@ -64,7 +64,7 @@ class Home extends Secure_Controller else//failure {//TODO: Replace -1 with constant echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Employees.unsuccessful_change_password'), 'id' => -1 ]); @@ -73,7 +73,7 @@ class Home extends Secure_Controller else {//TODO: Replace -1 with constant echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Employees.current_password_invalid'), 'id' => -1 ]); @@ -82,7 +82,7 @@ class Home extends Secure_Controller else {//TODO: Replace -1 with constant echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Employees.current_password_invalid'), 'id' => -1 ]); diff --git a/app/Controllers/Item_kits.php b/app/Controllers/Item_kits.php index b08c8c06d..14ceef49c 100644 --- a/app/Controllers/Item_kits.php +++ b/app/Controllers/Item_kits.php @@ -152,35 +152,35 @@ class Item_kits extends Secure_Controller $item_kit_data = [ 'name' => $this->request->getPost('name'), 'item_kit_number' => $this->request->getPost('item_kit_number'), - 'item_id' => empty($this->request->getPost('kit_item_id')) ? NULL : intval($this->request->getPost('kit_item_id')), + 'item_id' => empty($this->request->getPost('kit_item_id')) ? null : intval($this->request->getPost('kit_item_id')), 'kit_discount' => parse_decimals($this->request->getPost('kit_discount')), - 'kit_discount_type' => $this->request->getPost('kit_discount_type') === NULL ? PERCENT : intval($this->request->getPost('kit_discount_type')), - 'price_option' => $this->request->getPost('price_option') === NULL ? PRICE_ALL : intval($this->request->getPost('price_option')), - 'print_option' => $this->request->getPost('print_option') === NULL ? PRINT_ALL : intval($this->request->getPost('print_option')), + 'kit_discount_type' => $this->request->getPost('kit_discount_type') === null ? PERCENT : intval($this->request->getPost('kit_discount_type')), + 'price_option' => $this->request->getPost('price_option') === null ? PRICE_ALL : intval($this->request->getPost('price_option')), + 'print_option' => $this->request->getPost('print_option') === null ? PRINT_ALL : intval($this->request->getPost('print_option')), 'description' => $this->request->getPost('description') ]; if($this->item_kit->save_value($item_kit_data, $item_kit_id)) { - $new_item = FALSE; + $new_item = false; //New item kit if($item_kit_id == NEW_ENTRY) { $item_kit_id = $item_kit_data['item_kit_id']; - $new_item = TRUE; + $new_item = true; } - $item_kit_items_array = $this->request->getPost('item_kit_qty') === NULL ? NULL : $this->request->getPost('item_kit_qty'); + $item_kit_items_array = $this->request->getPost('item_kit_qty') === null ? null : $this->request->getPost('item_kit_qty'); - if($item_kit_items_array != NULL) + if($item_kit_items_array != null) { $item_kit_items = []; foreach($item_kit_items_array as $item_id => $item_kit_qty) { $item_kit_items[] = [ 'item_id' => $item_id, - 'quantity' => $item_kit_qty === NULL ? 0 : parse_quantity($item_kit_qty), - 'kit_sequence' => $this->request->getPost("item_kit_seq[$item_id]") === NULL ? 0 : intval($this->request->getPost("item_kit_seq[$item_id]")) + 'quantity' => $item_kit_qty === null ? 0 : parse_quantity($item_kit_qty), + 'kit_sequence' => $this->request->getPost("item_kit_seq[$item_id]") === null ? 0 : intval($this->request->getPost("item_kit_seq[$item_id]")) ]; } } @@ -191,7 +191,7 @@ class Item_kits extends Secure_Controller } else { - $success = TRUE; + $success = true; } if($new_item) @@ -215,7 +215,7 @@ class Item_kits extends Secure_Controller else//failure { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Item_kits.error_adding_updating') . ' ' . $item_kit_data['name'], 'id' => NEW_ENTRY ]); @@ -229,13 +229,13 @@ class Item_kits extends Secure_Controller if($this->item_kit->delete_list($item_kits_to_delete)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Item_kits.successful_deleted') . ' ' . count($item_kits_to_delete) . ' ' . lang('Item_kits.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Item_kits.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Item_kits.cannot_be_deleted')]); } } diff --git a/app/Controllers/Items.php b/app/Controllers/Items.php index 93f54a0cf..ab5cd144b 100644 --- a/app/Controllers/Items.php +++ b/app/Controllers/Items.php @@ -1221,7 +1221,7 @@ class Items extends Secure_Controller $dropdown_values = $attribute_data[$definition_name]['dropdown_values']; $dropdown_values[] = ''; - if(!empty($attribute_value) && in_array($attribute_value, $dropdown_values) === false) + if(!empty($attribute_value) && !in_array($attribute_value, $dropdown_values)) { log_message('Error',"Value: '$attribute_value' is not an acceptable DROPDOWN value"); return true; @@ -1235,7 +1235,7 @@ class Items extends Secure_Controller } break; case DATE: - if(valid_date($attribute_value) === false && !empty($attribute_value)) + if(!valid_date($attribute_value) && !empty($attribute_value)) { log_message('Error',"'$attribute_value' is not an acceptable DATE value. The value must match the set locale."); return true; @@ -1282,7 +1282,7 @@ class Items extends Secure_Controller return true; } - if($attribute_id === false) + if(!$attribute_id) { return true; } @@ -1300,11 +1300,11 @@ class Items extends Secure_Controller $this->attribute->delete_link($item_id, $attribute_data['definition_id']); - if($attribute_id === false) + if(!$attribute_id) { $attribute_id = $this->attribute->save_value($value, $attribute_data['definition_id'], $item_id, false, $attribute_data['definition_type']); } - else if($this->attribute->save_link($item_id, $attribute_data['definition_id'], $attribute_id) === false) + else if(!$this->attribute->save_link($item_id, $attribute_data['definition_id'], $attribute_id)) { return false; } diff --git a/app/Controllers/Messages.php b/app/Controllers/Messages.php index 153ef9a91..27a25f4a7 100644 --- a/app/Controllers/Messages.php +++ b/app/Controllers/Messages.php @@ -45,11 +45,11 @@ class Messages extends Secure_Controller if($response) { - echo json_encode (['success' => TRUE, 'message' => lang('Messages.successfully_sent') . ' ' . esc($phone)]); + echo json_encode (['success' => true, 'message' => lang('Messages.successfully_sent') . ' ' . esc($phone)]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone)]); + echo json_encode (['success' => false, 'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone)]); } } @@ -69,7 +69,7 @@ class Messages extends Secure_Controller if($response) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Messages.successfully_sent') . ' ' . esc($phone), 'person_id' => $person_id ]); @@ -77,7 +77,7 @@ class Messages extends Secure_Controller else { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone), 'person_id' => NEW_ENTRY ]); diff --git a/app/Controllers/Office.php b/app/Controllers/Office.php index f0b3c586f..70e7dbfaf 100644 --- a/app/Controllers/Office.php +++ b/app/Controllers/Office.php @@ -13,7 +13,7 @@ class Office extends Secure_Controller function __construct() { - parent::__construct('office', NULL, 'office'); + parent::__construct('office', null, 'office'); } public function getIndex(): void diff --git a/app/Controllers/Persons.php b/app/Controllers/Persons.php index 7bb6ebc73..99ba4b53b 100644 --- a/app/Controllers/Persons.php +++ b/app/Controllers/Persons.php @@ -9,7 +9,7 @@ abstract class Persons extends Secure_Controller { protected Person $person; - public function __construct(string $module_id = NULL) + public function __construct(string $module_id = null) { parent::__construct($module_id); diff --git a/app/Controllers/Receivings.php b/app/Controllers/Receivings.php index 634b73b27..91931ea5d 100644 --- a/app/Controllers/Receivings.php +++ b/app/Controllers/Receivings.php @@ -233,7 +233,7 @@ class Receivings extends Secure_Controller /** * @throws ReflectionException */ - public function postDelete(int $receiving_id = -1, bool $update_inventory = TRUE) : void + public function postDelete(int $receiving_id = -1, bool $update_inventory = true) : void { $employee_id = $this->employee->get_logged_in_employee_info()->person_id; $receiving_ids = $receiving_id == -1 ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$receiving_id]; //TODO: Replace -1 with constant @@ -241,13 +241,13 @@ class Receivings extends Secure_Controller if($this->receiving->delete_list($receiving_ids, $employee_id, $update_inventory)) //TODO: Likely need to surround this block of code in a try-catch to catch the ReflectionException { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Receivings.successfully_deleted') . ' ' . count($receiving_ids) . ' ' . lang('Receivings.one_or_multiple'), 'ids' => $receiving_ids]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Receivings.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Receivings.cannot_be_deleted')]); } } @@ -279,7 +279,7 @@ class Receivings extends Secure_Controller $data['payment_type'] = $this->request->getPost('payment_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS); $data['show_stock_locations'] = $this->stock_location->show_locations('receivings'); $data['stock_location'] = $this->receiving_lib->get_stock_source(); - if($this->request->getPost('amount_tendered') != NULL) + if($this->request->getPost('amount_tendered') != null) { $data['amount_tendered'] = $this->request->getPost('amount_tendered', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $data['amount_change'] = to_currency($data['amount_tendered'] - $data['total']); @@ -388,7 +388,7 @@ class Receivings extends Secure_Controller } } - $data['print_after_sale'] = FALSE; + $data['print_after_sale'] = false; echo view("receivings/receipt", $data); @@ -452,17 +452,17 @@ class Receivings extends Secure_Controller $receiving_data = [ 'receiving_time' => $receiving_time, - 'supplier_id' => $this->request->getPost('supplier_id') ? $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT) : NULL, + 'supplier_id' => $this->request->getPost('supplier_id') ? $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT) : null, 'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT), 'comment' => $this->request->getPost('comment', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'reference' => $this->request->getPost('reference') != '' ? $this->request->getPost('reference', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL + 'reference' => $this->request->getPost('reference') != '' ? $this->request->getPost('reference', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null ]; $this->inventory->update('RECV '.$receiving_id, ['trans_date' => $receiving_time]); if($this->receiving->update($receiving_id, $receiving_data)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Receivings.successfully_updated'), 'id' => $receiving_id ]); @@ -470,7 +470,7 @@ class Receivings extends Secure_Controller else { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Receivings.unsuccessfully_updated'), 'id' => $receiving_id ]); diff --git a/app/Controllers/Reports.php b/app/Controllers/Reports.php index 08da498be..96861fe5a 100644 --- a/app/Controllers/Reports.php +++ b/app/Controllers/Reports.php @@ -534,7 +534,7 @@ class Reports extends Secure_Controller $stock_locations = $data = $this->stock_location->get_allowed_locations('sales'); $stock_locations['all'] = lang('Reports.all'); - $data['stock_locations'] = array_reverse($stock_locations, TRUE); + $data['stock_locations'] = array_reverse($stock_locations, true); $data['mode'] = 'sale'; $data['discount_type_options'] = ['0' => lang('Reports.discount_percent'), '1'=> lang('Reports.discount_fixed')]; $data['sale_type_options'] = $this->get_sale_type_options(); @@ -649,7 +649,7 @@ class Reports extends Secure_Controller $stock_locations = $data = $this->stock_location->get_allowed_locations('sales'); $stock_locations['all'] = lang('Reports.all'); - $data['stock_locations'] = array_reverse($stock_locations, TRUE); + $data['stock_locations'] = array_reverse($stock_locations, true); $data['mode'] = 'sale'; $data['sale_type_options'] = $this->get_sale_type_options(); @@ -672,7 +672,7 @@ class Reports extends Secure_Controller $stock_locations = $data = $this->stock_location->get_allowed_locations('sales'); $stock_locations['all'] = lang('Reports.all'); - $data['stock_locations'] = array_reverse($stock_locations, TRUE); + $data['stock_locations'] = array_reverse($stock_locations, true); $data['mode'] = 'sale'; $data['sale_type_options'] = $this->get_sale_type_options(); @@ -683,7 +683,7 @@ class Reports extends Secure_Controller { $stock_locations = $data = $this->stock_location->get_allowed_locations('receivings'); $stock_locations['all'] = lang('Reports.all'); - $data['stock_locations'] = array_reverse($stock_locations, TRUE); + $data['stock_locations'] = array_reverse($stock_locations, true); $data['mode'] = 'receiving'; echo view('reports/date_input', $data); @@ -721,7 +721,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -760,7 +760,7 @@ class Reports extends Secure_Controller 'summary_data_1' => $summary, 'yaxis_title' => lang('Reports.revenue'), 'xaxis_title' => lang('Reports.date'), - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -800,7 +800,7 @@ class Reports extends Secure_Controller 'summary_data_1' => $summary, 'yaxis_title' => lang('Reports.items'), 'xaxis_title' => lang('Reports.revenue'), - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -836,7 +836,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -874,7 +874,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -911,7 +911,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -948,7 +948,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -985,7 +985,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -1024,7 +1024,7 @@ class Reports extends Secure_Controller 'summary_data_1' => $summary, 'yaxis_title' => lang('Reports.customers'), 'xaxis_title' => lang('Reports.revenue'), - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -1064,7 +1064,7 @@ class Reports extends Secure_Controller 'summary_data_1' => $summary, 'yaxis_title' => lang('Reports.count'), 'xaxis_title' => lang('Reports.discount'), - 'show_currency' => FALSE + 'show_currency' => false ]; echo view('reports/graphical', $data); @@ -1104,7 +1104,7 @@ class Reports extends Secure_Controller 'labels_1' => $labels, 'series_data_1' => $series, 'summary_data_1' => $summary, - 'show_currency' => TRUE + 'show_currency' => true ]; echo view('reports/graphical', $data); @@ -1884,7 +1884,7 @@ class Reports extends Secure_Controller $stock_locations = $this->stock_location->get_allowed_locations(); $stock_locations['all'] = lang('Reports.all'); - $data['stock_locations'] = array_reverse($stock_locations, TRUE); + $data['stock_locations'] = array_reverse($stock_locations, true); echo view('reports/inventory_summary_input', $data); } diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index c3f1e7f48..57a8a650b 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -114,10 +114,10 @@ class Sales extends Secure_Controller 'location_id' => 'all', 'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'only_cash' => FALSE, - 'only_due' => FALSE, - 'only_check' => FALSE, - 'only_creditcard' => FALSE, + 'only_cash' => false, + 'only_due' => false, + 'only_check' => false, + 'only_creditcard' => false, 'only_invoices' => $this->config['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT), 'is_valid_receipt' => $this->sale->is_valid_receipt($search) ]; @@ -152,14 +152,14 @@ class Sales extends Secure_Controller public function getItemSearch(): void { $suggestions = []; - $receipt = $search = $this->request->getGet('term') != '' ? $this->request->getGet('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL; + $receipt = $search = $this->request->getGet('term') != '' ? $this->request->getGet('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null; if($this->sale_lib->get_mode() == 'return' && $this->sale->is_valid_receipt($receipt)) { // if a valid receipt or invoice was found the search term will be replaced with a receipt number (POS #) $suggestions[] = $receipt; } - $suggestions = array_merge($suggestions, $this->item->get_search_suggestions($search, ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE)); + $suggestions = array_merge($suggestions, $this->item->get_search_suggestions($search, ['search_custom' => false, 'is_deleted' => false], true)); $suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($search)); echo json_encode($suggestions); @@ -167,7 +167,7 @@ class Sales extends Secure_Controller public function suggest_search(): void { - $search = $this->request->getPost('term') != '' ? $this->request->getPost('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL; + $search = $this->request->getPost('term') != '' ? $this->request->getPost('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null; $suggestions = $this->sale->get_search_suggestions($search); @@ -399,7 +399,7 @@ class Sales extends Secure_Controller { $package_name = $this->customer_rewards->get_name($package_id); //TODO: this variable is never used. $points = $this->customer->get_info($customer_id)->points; - $points = ($points == NULL ? 0 : $points); + $points = ($points == null ? 0 : $points); $payments = $this->sale_lib->get_payments(); $current_payments_with_rewards = isset($payments[$payment_type]) ? $payments[$payment_type]['payment_amount'] : 0; @@ -425,7 +425,7 @@ class Sales extends Secure_Controller elseif($payment_type === lang('Sales.cash')) { $amount_due = $this->sale_lib->get_total(); - $sales_total = $this->sale_lib->get_total(FALSE); + $sales_total = $this->sale_lib->get_total(false); $amount_tendered = $this->request->getPost('amount_tendered', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $this->sale_lib->add_payment($payment_type, $amount_tendered); @@ -528,19 +528,19 @@ class Sales extends Secure_Controller } // Add item kit items to order - $stock_warning = NULL; + $stock_warning = null; if(!$this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt, $item_location, $discount, $discount_type, $kit_price_option, $kit_print_option, $stock_warning)) { $data['error'] = lang('Sales.unable_to_add_item'); } - elseif($stock_warning != NULL) + elseif($stock_warning != null) { $data['warning'] = $stock_warning; } } else { - if(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $item_location, $quantity, $discount, $discount_type, PRICE_MODE_STANDARD, NULL, NULL, $price)) + if(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $item_location, $quantity, $discount, $discount_type, PRICE_MODE_STANDARD, null, null, $price)) { $data['error'] = lang('Sales.unable_to_add_item'); } @@ -579,7 +579,7 @@ class Sales extends Secure_Controller $discount = $discount_type ? parse_quantity($this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)) : parse_decimals($this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); $item_location = $this->request->getPost('location', FILTER_SANITIZE_NUMBER_INT); - $discounted_total = $this->request->getPost('discounted_total') != '' ? $this->request->getPost('discounted_total', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : NULL; + $discounted_total = $this->request->getPost('discounted_total') != '' ? $this->request->getPost('discounted_total', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : null; $this->sale_lib->edit_item($line, $description, $serialnumber, $quantity, $discount, $discount_type, $price, $discounted_total); @@ -677,7 +677,7 @@ class Sales extends Secure_Controller $data["quote_number"] = $quote_number; $customer_info = $this->_load_customer_data($customer_id, $data); - if($customer_info != NULL) + if($customer_info != null) { $data["customer_comments"] = $customer_info->comments; $data['tax_id'] = $customer_info->tax_id; @@ -734,14 +734,14 @@ class Sales extends Secure_Controller } } - $data['print_price_info'] = TRUE; + $data['print_price_info'] = true; if($this->sale_lib->is_invoice_mode()) { $invoice_format = $this->config['sales_invoice_format']; // generate final invoice number (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way - if(!empty($invoice_format) && $invoice_number == NULL) + if(!empty($invoice_format) && $invoice_number == null) { // The user can retain the default encoded format or can manually override it. It still passes through the rendering step. $invoice_number = $this->token_lib->render($invoice_format); @@ -786,13 +786,13 @@ class Sales extends Secure_Controller if(!($data['price_work_orders'] == 1)) { - $data['print_price_info'] = FALSE; + $data['print_price_info'] = false; } $data['sales_work_order'] = lang('Sales.work_order'); $data['work_order_number_label'] = lang('Sales.work_order_number'); - if($work_order_number == NULL) + if($work_order_number == null) { // generate work order number $work_order_format = $this->config['work_order_format']; @@ -815,7 +815,7 @@ class Sales extends Secure_Controller $data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']); - $data['barcode'] = NULL; + $data['barcode'] = null; echo view('sales/work_order', $data); $this->sale_lib->clear_mode(); @@ -827,7 +827,7 @@ class Sales extends Secure_Controller $data['sales_quote'] = lang('Sales.quote'); $data['quote_number_label'] = lang('Sales.quote_number'); - if($quote_number == NULL) + if($quote_number == null) { // generate quote number $quote_format = $this->config['sales_quote_format']; @@ -849,7 +849,7 @@ class Sales extends Secure_Controller $this->sale_lib->set_suspended_id($data['sale_id_num']); $data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']); - $data['barcode'] = NULL; + $data['barcode'] = null; echo view('sales/quote', $data); $this->sale_lib->clear_mode(); @@ -898,7 +898,7 @@ class Sales extends Secure_Controller { $sale_data = $this->_load_sale_data($sale_id); - $result = FALSE; + $result = false; $message = lang('Sales.invoice_no_email'); if(!empty($sale_data['customer_email'])) @@ -923,7 +923,7 @@ class Sales extends Secure_Controller // load pdf helper helper (['dompdf', 'file']); $filename = sys_get_temp_dir() . '/' . lang('Sales.' . $type) . '-' . str_replace('/', '-', $number) . '.pdf'; - if(file_put_contents($filename, create_pdf($html)) !== FALSE) + if(file_put_contents($filename, create_pdf($html)) !== false) { $result = $this->email_lib->sendEmail($to, $subject, $text, $filename); } @@ -942,7 +942,7 @@ class Sales extends Secure_Controller { $sale_data = $this->_load_sale_data($sale_id); - $result = FALSE; + $result = false; $message = lang('Sales.receipt_no_email'); if(!empty($sale_data['customer_email'])) @@ -967,7 +967,7 @@ class Sales extends Secure_Controller return $result; } - private function _load_customer_data(int $customer_id, array &$data, bool $stats = FALSE) //TODO: Hungarian notation + private function _load_customer_data(int $customer_id, array &$data, bool $stats = false) //TODO: Hungarian notation { $customer_info = ''; @@ -1004,7 +1004,7 @@ class Sales extends Secure_Controller $data['customer_discount_type'] = $customer_info->discount_type; $package_id = $this->customer->get_info($customer_id)->package_id; - if($package_id != NULL) + if($package_id != null) { $package_name = $this->customer_rewards->get_name($package_id); $points = $this->customer->get_info($customer_id)->points; @@ -1111,8 +1111,8 @@ class Sales extends Secure_Controller } $data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['sale_id']); - $data['print_after_sale'] = FALSE; - $data['price_work_orders'] = FALSE; + $data['print_after_sale'] = false; + $data['price_work_orders'] = false; if($this->sale_lib->get_mode() == 'sale_invoice') //TODO: Duplicated code. { @@ -1161,7 +1161,7 @@ class Sales extends Secure_Controller $data['cash_rounding'] = $cash_rounding; $data['cart'] = $this->sale_lib->get_cart(); - $customer_info = $this->_load_customer_data($this->sale_lib->get_customer(), $data, TRUE); + $customer_info = $this->_load_customer_data($this->sale_lib->get_customer(), $data, true); $data['modes'] = $this->sale_lib->get_register_mode_options(); $data['mode'] = $this->sale_lib->get_mode(); @@ -1169,7 +1169,7 @@ class Sales extends Secure_Controller $data['empty_tables'] = $this->sale_lib->get_empty_tables($data['selected_table']); $data['stock_locations'] = $this->stock_location->get_allowed_locations('sales'); $data['stock_location'] = $this->sale_lib->get_sale_location(); - $data['tax_exclusive_subtotal'] = $this->sale_lib->get_subtotal(TRUE, TRUE); + $data['tax_exclusive_subtotal'] = $this->sale_lib->get_subtotal(true, true); $tax_details = $this->tax_lib->get_taxes($data['cart']); //TODO: Duplicated code. $data['taxes'] = $tax_details[0]; $data['discount'] = $this->sale_lib->get_discount(); @@ -1214,7 +1214,7 @@ class Sales extends Secure_Controller if($customer_info && $this->config['customer_reward_enable']) { - $data['payment_options'] = $this->sale->get_payment_options(TRUE, TRUE); + $data['payment_options'] = $this->sale->get_payment_options(true, true); } else { @@ -1227,9 +1227,9 @@ class Sales extends Secure_Controller $temp_invoice_number = $this->sale_lib->get_invoice_number(); $invoice_format = $this->config['sales_invoice_format']; - if ($temp_invoice_number == NULL || $temp_invoice_number == '') + if ($temp_invoice_number == null || $temp_invoice_number == '') { - $temp_invoice_number = $this->token_lib->render($invoice_format, [], FALSE); + $temp_invoice_number = $this->token_lib->render($invoice_format, [], false); } $data['invoice_number'] = $temp_invoice_number; @@ -1322,7 +1322,7 @@ class Sales extends Secure_Controller $data['balance_due'] = $balance_due != 0; // don't allow gift card to be a payment option in a sale transaction edit because it's a complex change - $payment_options = $this->sale->get_payment_options(FALSE); + $payment_options = $this->sale->get_payment_options(false); if($this->sale_lib->reset_cash_rounding()) { @@ -1342,14 +1342,14 @@ class Sales extends Secure_Controller /** * @throws ReflectionException */ - public function postDelete(int $sale_id = NEW_ENTRY, bool $update_inventory = TRUE): void + public function postDelete(int $sale_id = NEW_ENTRY, bool $update_inventory = true): void { $employee_id = $this->employee->get_logged_in_employee_info()->person_id; $has_grant = $this->employee->has_grant('sales_delete', $employee_id); if(!$has_grant) { - echo json_encode (['success' => FALSE, 'message' => lang('Sales.not_authorized')]); + echo json_encode (['success' => false, 'message' => lang('Sales.not_authorized')]); } else { @@ -1358,26 +1358,26 @@ class Sales extends Secure_Controller if($this->sale->delete_list($sale_ids, $employee_id, $update_inventory)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Sales.successfully_deleted') . ' ' . count($sale_ids) . ' ' . lang('Sales.one_or_multiple'), 'ids' => $sale_ids ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Sales.unsuccessfully_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Sales.unsuccessfully_deleted')]); } } } - public function restore(int $sale_id = NEW_ENTRY, bool $update_inventory = TRUE): void + public function restore(int $sale_id = NEW_ENTRY, bool $update_inventory = true): void { $employee_id = $this->employee->get_logged_in_employee_info()->person_id; $has_grant = $this->employee->has_grant('sales_delete', $employee_id); if(!$has_grant) { - echo json_encode (['success' => FALSE, 'message' => lang('Sales.not_authorized')]); + echo json_encode (['success' => false, 'message' => lang('Sales.not_authorized')]); } else { @@ -1386,14 +1386,14 @@ class Sales extends Secure_Controller if($this->sale->restore_list($sale_ids, $employee_id, $update_inventory)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Sales.successfully_restored') . ' ' . count($sale_ids) . ' ' . lang('Sales.one_or_multiple'), 'ids' => $sale_ids ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Sales.unsuccessfully_restored')]); + echo json_encode (['success' => false, 'message' => lang('Sales.unsuccessfully_restored')]); } } } @@ -1414,10 +1414,10 @@ class Sales extends Secure_Controller $sale_data = [ 'sale_time' => $sale_time, - 'customer_id' => $this->request->getPost('customer_id') != '' ? $this->request->getPost('customer_id', FILTER_SANITIZE_NUMBER_INT) : NULL, - 'employee_id' => $this->request->getPost('employee_id') != '' ? $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT) : NULL, + 'customer_id' => $this->request->getPost('customer_id') != '' ? $this->request->getPost('customer_id', FILTER_SANITIZE_NUMBER_INT) : null, + 'employee_id' => $this->request->getPost('employee_id') != '' ? $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT) : null, 'comment' => $this->request->getPost('comment', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'invoice_number' => $this->request->getPost('invoice_number') != '' ? $this->request->getPost('invoice_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL + 'invoice_number' => $this->request->getPost('invoice_number') != '' ? $this->request->getPost('invoice_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null ]; // In order to maintain tradition the only element that can change on prior payments is the payment type @@ -1498,11 +1498,11 @@ class Sales extends Secure_Controller $inventory->update('POS '.$sale_id, ['trans_date' => $sale_time]); //TODO: Reflection Exception if($this->sale->update($sale_id, $sale_data)) { - echo json_encode (['success' => TRUE, 'message' => lang('Sales.successfully_updated'), 'id' => $sale_id]); + echo json_encode (['success' => true, 'message' => lang('Sales.successfully_updated'), 'id' => $sale_id]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Sales.unsuccessfully_updated'), 'id' => $sale_id]); + echo json_encode (['success' => false, 'message' => lang('Sales.unsuccessfully_updated'), 'id' => $sale_id]); } } @@ -1666,7 +1666,7 @@ class Sales extends Secure_Controller $this->item->update_item_number($item_id, $item_number); $cart = $this->sale_lib->get_cart(); $x = $this->search_cart_for_item_id($item_id, $cart); - if($x != NULL) + if($x != null) { $cart[$x]['item_number'] = $item_number; } @@ -1683,7 +1683,7 @@ class Sales extends Secure_Controller $cart = $this->sale_lib->get_cart(); $x = $this->search_cart_for_item_id($item_id, $cart); - if($x != NULL) + if($x != null) { $cart[$x]['name'] = $name; } @@ -1701,7 +1701,7 @@ class Sales extends Secure_Controller $cart = $this->sale_lib->get_cart(); $x = $this->search_cart_for_item_id($item_id, $cart); - if($x != NULL) + if($x != null) { $cart[$x]['description'] = $description; } @@ -1719,6 +1719,6 @@ class Sales extends Secure_Controller } } - return NULL; + return null; } } diff --git a/app/Controllers/Secure_Controller.php b/app/Controllers/Secure_Controller.php index 3bcee2849..3012ca7ea 100644 --- a/app/Controllers/Secure_Controller.php +++ b/app/Controllers/Secure_Controller.php @@ -49,7 +49,7 @@ class Secure_Controller extends BaseController // load up global global_view_data visible to all the loaded views $this->session = session(); - if($menu_group == NULL) + if($menu_group == null) { $menu_group = $this->session->get('menu_group'); } @@ -62,6 +62,7 @@ class Secure_Controller extends BaseController ? $this->module->get_allowed_home_modules($logged_in_employee_info->person_id) : $this->module->get_allowed_office_modules($logged_in_employee_info->person_id); + $global_view_data = []; foreach($allowed_modules->getResult() as $module) { $global_view_data['allowed_modules'][] = $module; diff --git a/app/Controllers/Suppliers.php b/app/Controllers/Suppliers.php index f66df2fec..14c10b43e 100644 --- a/app/Controllers/Suppliers.php +++ b/app/Controllers/Suppliers.php @@ -128,7 +128,7 @@ class Suppliers extends Persons 'company_name' => $this->request->getPost('company_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'agency_name' => $this->request->getPost('agency_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'category' => $this->request->getPost('category', FILTER_SANITIZE_FULL_SPECIAL_CHARS), - 'account_number' => $this->request->getPost('account_number') == '' ? NULL : $this->request->getPost('account_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS), + 'account_number' => $this->request->getPost('account_number') == '' ? null : $this->request->getPost('account_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'tax_id' => $this->request->getPost('tax_id', FILTER_SANITIZE_NUMBER_INT) ]; @@ -138,7 +138,7 @@ class Suppliers extends Persons if($supplier_id == NEW_ENTRY) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Suppliers.successful_adding') . ' ' . $supplier_data['company_name'], 'id' => $supplier_data['person_id'] ]); @@ -146,7 +146,7 @@ class Suppliers extends Persons else //Existing supplier { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Suppliers.successful_updating') . ' ' . $supplier_data['company_name'], 'id' => $supplier_id]); } @@ -154,7 +154,7 @@ class Suppliers extends Persons else//failure { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Suppliers.error_adding_updating') . ' ' . $supplier_data['company_name'], 'id' => NEW_ENTRY ]); @@ -171,13 +171,13 @@ class Suppliers extends Persons if($this->supplier->delete_list($suppliers_to_delete)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Suppliers.successful_deleted') . ' ' . count($suppliers_to_delete) . ' ' . lang('Suppliers.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Suppliers.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Suppliers.cannot_be_deleted')]); } } } diff --git a/app/Controllers/Tax_categories.php b/app/Controllers/Tax_categories.php index 8dfa8c71f..8211118e3 100644 --- a/app/Controllers/Tax_categories.php +++ b/app/Controllers/Tax_categories.php @@ -75,7 +75,7 @@ class Tax_categories extends Secure_Controller if($tax_category_id == NEW_ENTRY) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_categories.successful_adding'), 'id' => $tax_category_data['tax_category_id'] ]); @@ -83,7 +83,7 @@ class Tax_categories extends Secure_Controller else { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_categories.successful_updating'), 'id' => $tax_category_id ]); @@ -92,7 +92,7 @@ class Tax_categories extends Secure_Controller else { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Tax_categories.error_adding_updating') . ' ' . $tax_category_data['tax_category'], 'id' => NEW_ENTRY ]); @@ -106,13 +106,13 @@ class Tax_categories extends Secure_Controller if($this->tax_category->delete_list($tax_categories_to_delete)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_categories.successful_deleted') . ' ' . count($tax_categories_to_delete) . ' ' . lang('Tax_categories.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Tax_categories.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Tax_categories.cannot_be_deleted')]); } } } diff --git a/app/Controllers/Tax_codes.php b/app/Controllers/Tax_codes.php index 6d88a46b3..84c349991 100644 --- a/app/Controllers/Tax_codes.php +++ b/app/Controllers/Tax_codes.php @@ -83,7 +83,7 @@ class Tax_codes extends Secure_Controller if($tax_code_id == NEW_ENTRY) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_codes.successful_adding'), 'id' => $tax_code_data['tax_code_id'] ]); @@ -91,7 +91,7 @@ class Tax_codes extends Secure_Controller else { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_codes.successful_updating'), 'id' => $tax_code_id ]); @@ -100,7 +100,7 @@ class Tax_codes extends Secure_Controller else { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Tax_codes.error_adding_updating') . ' ' . $tax_code_data['tax_code_id'], 'id' => NEW_ENTRY ]); @@ -114,13 +114,13 @@ class Tax_codes extends Secure_Controller if($this->tax_code->delete_list($tax_codes_to_delete)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_codes.successful_deleted') . ' ' . count($tax_codes_to_delete) . ' ' . lang('Tax_codes.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Tax_codes.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Tax_codes.cannot_be_deleted')]); } } } diff --git a/app/Controllers/Tax_jurisdictions.php b/app/Controllers/Tax_jurisdictions.php index a9c4d156e..d2d26008c 100644 --- a/app/Controllers/Tax_jurisdictions.php +++ b/app/Controllers/Tax_jurisdictions.php @@ -76,7 +76,7 @@ class Tax_jurisdictions extends Secure_Controller if($jurisdiction_id == NEW_ENTRY) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_jurisdictions.successful_adding'), 'id' => $tax_jurisdiction_data['jurisdiction_id'] ]); @@ -84,7 +84,7 @@ class Tax_jurisdictions extends Secure_Controller else { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_jurisdictions.successful_updating'), 'id' => $jurisdiction_id ]); @@ -93,7 +93,7 @@ class Tax_jurisdictions extends Secure_Controller else { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Tax_jurisdictions.error_adding_updating') . ' ' . $tax_jurisdiction_data['jurisdiction_name'], 'id' => NEW_ENTRY ]); @@ -107,13 +107,13 @@ class Tax_jurisdictions extends Secure_Controller if($this->tax_jurisdiction->delete_list($tax_jurisdictions_to_delete)) { echo json_encode ([ - 'success' => TRUE, + 'success' => true, 'message' => lang('Tax_jurisdictions.successful_deleted') . ' ' . count($tax_jurisdictions_to_delete) . ' ' . lang('Tax_jurisdictions.one_or_multiple') ]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Tax_jurisdictions.cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Tax_jurisdictions.cannot_be_deleted')]); } } } diff --git a/app/Controllers/Taxes.php b/app/Controllers/Taxes.php index e0981ceeb..60b6a3e1d 100644 --- a/app/Controllers/Taxes.php +++ b/app/Controllers/Taxes.php @@ -386,16 +386,16 @@ class Taxes extends Secure_Controller { if($tax_rate_id == NEW_ENTRY) {//TODO: this needs to be replaced with ternary notation - echo json_encode (['success' => TRUE, 'message' => lang('Taxes.tax_rate_successfully_added')]); + echo json_encode (['success' => true, 'message' => lang('Taxes.tax_rate_successfully_added')]); } else //Existing tax_code { - echo json_encode (['success' => TRUE, 'message' => lang('Taxes.tax_rate_successful_updated')]); + echo json_encode (['success' => true, 'message' => lang('Taxes.tax_rate_successful_updated')]); } } else { - echo json_encode (['success' => FALSE, 'message' => lang('Taxes.tax_rate_error_adding_updating')]); + echo json_encode (['success' => false, 'message' => lang('Taxes.tax_rate_error_adding_updating')]); } } @@ -405,10 +405,10 @@ class Taxes extends Secure_Controller if($this->tax->delete_list($tax_codes_to_delete)) //TODO: this needs to be replaced with ternary notation { - echo json_encode (['success' => TRUE, 'message' => lang('Taxes.tax_code_successful_deleted')]); + echo json_encode (['success' => true, 'message' => lang('Taxes.tax_code_successful_deleted')]); } else { - echo json_encode (['success' => FALSE, 'message' => lang('Taxes.tax_code_cannot_be_deleted')]); + echo json_encode (['success' => false, 'message' => lang('Taxes.tax_code_cannot_be_deleted')]); } } @@ -483,7 +483,7 @@ class Taxes extends Secure_Controller if (in_array($tax_group[$key], $unique_tax_groups)) //TODO: This can be replaced with `in_array($tax_group[$key], $unique_tax_groups)` { echo json_encode ([ - 'success' => FALSE, + 'success' => false, 'message' => lang('Taxes.tax_group_not_unique', [$tax_group[$key]]) ]); return; diff --git a/app/Database/Migrations/20170502221506_sales_tax_data.php b/app/Database/Migrations/20170502221506_sales_tax_data.php index 4f1b47027..5bcc27f0d 100644 --- a/app/Database/Migrations/20170502221506_sales_tax_data.php +++ b/app/Database/Migrations/20170502221506_sales_tax_data.php @@ -40,7 +40,7 @@ class Migration_Sales_Tax_Data extends Migration $this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id']); } } - + error_log('Migrating sales tax history. The number of sales that will be migrated is finished.'); } @@ -52,7 +52,7 @@ class Migration_Sales_Tax_Data extends Migration { $tax_decimals = $this->appconfig->get_value('tax_decimals', 2); $tax_included = $this->appconfig->get_value('tax_included', Migration_Sales_Tax_Data::YES) == Migration_Sales_Tax_Data::YES; - $customer_sales_tax_support = FALSE; + $customer_sales_tax_support = false; if($tax_included) //TODO: Convert to ternary notation. { @@ -71,7 +71,7 @@ class Migration_Sales_Tax_Data extends Migration { // This computes tax for each line item and adds it to the tax type total $tax_group = (float)$item['percent'] . '% ' . $item['name']; - $tax_basis = $this->get_item_total($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], TRUE); + $tax_basis = $this->get_item_total($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], true); $item_tax_amount = $tax_included ? $this->get_item_tax($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], $item['percent']) @@ -153,7 +153,7 @@ class Migration_Sales_Tax_Data extends Migration } } - public function get_item_total(string $quantity, string $price, string $discount_percentage, bool $include_discount = FALSE): string + public function get_item_total(string $quantity, string $price, string $discount_percentage, bool $include_discount = false): string { $total = bcmul($quantity, $price); @@ -179,7 +179,7 @@ class Migration_Sales_Tax_Data extends Migration { $tax_included = $this->appconfig->get_value('tax_included', Migration_Sales_Tax_Data::YES) == Migration_Sales_Tax_Data::YES; - $price = $this->get_item_total($quantity, $price, $discount_percentage, TRUE); + $price = $this->get_item_total($quantity, $price, $discount_percentage, true); if($tax_included) { diff --git a/app/Database/Migrations/20200202000000_taxamount.php b/app/Database/Migrations/20200202000000_taxamount.php index d1babf08b..4a0fd7aca 100644 --- a/app/Database/Migrations/20200202000000_taxamount.php +++ b/app/Database/Migrations/20200202000000_taxamount.php @@ -48,7 +48,7 @@ class Migration_TaxAmount extends Migration foreach($unmigrated_invoices as $key => $unmigrated_invoice) { - $this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id'], $tax_decimals, TRUE); + $this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id'], $tax_decimals, true); } $this->db->query('DROP TABLE ' . $this->db->prefixTable('sales_taxes_backup')); } @@ -152,7 +152,7 @@ class Migration_TaxAmount extends Migration } } - public function get_item_total(string $quantity, string $price, string $discount, bool $include_discount = FALSE): string + public function get_item_total(string $quantity, string $price, string $discount, bool $include_discount = false): string { $total = bcmul($quantity, $price); diff --git a/app/Database/Migrations/20210422000000_database_optimizations.php b/app/Database/Migrations/20210422000000_database_optimizations.php index f2d50e965..2b250bd43 100644 --- a/app/Database/Migrations/20210422000000_database_optimizations.php +++ b/app/Database/Migrations/20210422000000_database_optimizations.php @@ -5,6 +5,7 @@ namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use CodeIgniter\Database\ResultInterface; use App\Models\Attribute; +use Config\OSPOS; use DateTime; class Migration_database_optimizations extends Migration @@ -59,6 +60,7 @@ class Migration_database_optimizations extends Migration $value = $attribute_value['attribute_decimal']; break; case DATE: + $config = config(OSPOS::class)->settings; $attribute_date = DateTime::createFromFormat('Y-m-d', $attribute_value['attribute_date']); $value = $attribute_date->format($config['dateformat']); break; @@ -67,7 +69,7 @@ class Migration_database_optimizations extends Migration break; } - $attribute->save_value($value, $attribute_link['definition_id'], $attribute_link['item_id'], FALSE, $attribute_link['definition_type']); + $attribute->save_value($value, $attribute_link['definition_id'], $attribute_link['item_id'], false, $attribute_link['definition_type']); } } $this->db->transComplete(); @@ -76,10 +78,11 @@ class Migration_database_optimizations extends Migration execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.4.0_database_optimizations.sql'); error_log('Migrating database_optimizations completed'); } + /** * Given the type of attribute, deletes any duplicates it finds in the attribute_values table and reassigns those */ - private function migrate_duplicate_attribute_values($attribute_type) + private function migrate_duplicate_attribute_values($attribute_type): void { //Remove duplicate attribute values needed to make attribute_decimals and attribute_dates unique $this->db->transStart(); diff --git a/app/Database/Migrations/sqlscripts/3.4.0_ci4_conversion.sql b/app/Database/Migrations/sqlscripts/3.4.0_ci4_conversion.sql index 483b42be9..3c4e84498 100644 --- a/app/Database/Migrations/sqlscripts/3.4.0_ci4_conversion.sql +++ b/app/Database/Migrations/sqlscripts/3.4.0_ci4_conversion.sql @@ -2,10 +2,10 @@ DROP TABLE `ospos_sessions`; CREATE TABLE IF NOT EXISTS `ospos_sessions` ( - `id` varchar(128) NOT null, - `ip_address` varchar(45) NOT null, - `timestamp` timestamp DEFAULT CURRENT_TIMESTAMP NOT null, - `data` blob NOT null, + `id` varchar(128) NOT NULL, + `ip_address` varchar(45) NOT NULL, + `timestamp` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + `data` blob NOT NULL, KEY `ospos_sessions_timestamp` (`timestamp`) ); diff --git a/app/Helpers/dompdf_helper.php b/app/Helpers/dompdf_helper.php index e7b9debec..75beec525 100644 --- a/app/Helpers/dompdf_helper.php +++ b/app/Helpers/dompdf_helper.php @@ -6,10 +6,10 @@ function create_pdf(string $html, string $filename = ''): string { // need to enable magic quotes for the - $dompdf = new Dompdf\Dompdf (['isRemoteEnabled' => TRUE, 'isPhpEnabled' => TRUE]); + $dompdf = new Dompdf\Dompdf (['isRemoteEnabled' => true, 'isPhpEnabled' => true]); $dompdf->loadHtml(str_replace (['\n', '\r'], '', $html)); $dompdf->render(); - + if($filename != '') { $dompdf->stream($filename . '.pdf'); diff --git a/app/Helpers/importfile_helper.php b/app/Helpers/importfile_helper.php index 8752aa106..5162c8200 100644 --- a/app/Helpers/importfile_helper.php +++ b/app/Helpers/importfile_helper.php @@ -42,23 +42,23 @@ function get_csv_file(string $file_name): array //It must be done in a way that does not significantly negatively affect performance. ini_set('auto_detect_line_endings', true); - $csv_rows = FALSE; + $csv_rows = false; - if(($csv_file = fopen($file_name,'r')) !== FALSE) + if(($csv_file = fopen($file_name,'r')) !== false) { helper('security'); $csv_rows = []; //Skip Byte-Order Mark - if(bom_exists($csv_file) === TRUE) + if(bom_exists($csv_file)) { fseek($csv_file, 3); } $headers = fgetcsv($csv_file); - while(($row = fgetcsv($csv_file)) !== FALSE) + while(($row = fgetcsv($csv_file)) !== false) { //Skip empty lines if($row !== [null]) @@ -75,7 +75,7 @@ function get_csv_file(string $file_name): array function bom_exists(&$file_handle): bool { - $result = FALSE; + $result = false; $candidate = fread($file_handle, 3); rewind($file_handle); @@ -84,8 +84,8 @@ function bom_exists(&$file_handle): bool if (0 === strncmp($candidate, $bom, 3)) { - $result = TRUE; + $result = true; } return $result; -} \ No newline at end of file +} diff --git a/app/Helpers/locale_helper.php b/app/Helpers/locale_helper.php index 7ca77b131..cfd5f4312 100644 --- a/app/Helpers/locale_helper.php +++ b/app/Helpers/locale_helper.php @@ -20,7 +20,7 @@ function current_language_code(bool $load_system_language = false): string $config = config(OSPOS::class)->settings; // Returns the language code of the employee if set or system language code if not - if($employee->is_logged_in() && $load_system_language === false) + if($employee->is_logged_in() && !$load_system_language) { $employee_info = $employee->get_logged_in_employee_info(); @@ -35,7 +35,7 @@ function current_language_code(bool $load_system_language = false): string return empty($language_code) ? DEFAULT_LANGUAGE_CODE : $language_code; } -function current_language(bool $load_system_language = FALSE): string +function current_language(bool $load_system_language = false): string { $employee = model(Employee::class); $config = config(OSPOS::class)->settings; @@ -354,7 +354,7 @@ function to_tax_decimals($number): string // It looks like it must be creating a String value on the fly because the form is referring to the index 0 when // there IS no index[0] row in the table - // taxes that are NULL, '' or 0 don't need to be displayed + // taxes that are null, '' or 0 don't need to be displayed // NOTE: do not remove this line otherwise the items edit form will show a tax with 0, and it will save it if(empty($number)) { @@ -369,7 +369,7 @@ function to_quantity_decimals(?float $number): string return to_decimals($number, 'quantity_decimals'); } -function to_decimals(?float $number, string $decimals = NULL, int $type = NumberFormatter::DECIMAL): string +function to_decimals(?float $number, string $decimals = null, int $type = NumberFormatter::DECIMAL): string { // ignore empty strings and return // NOTE: do not change it to empty otherwise tables will show a 0 with no decimal nor currency symbol @@ -412,7 +412,7 @@ function parse_tax(string $number) /** * @param string $number - * @param int|NULL $decimals + * @param int|null $decimals * @return false|float|int|mixed|string */ function parse_decimals(string $number, int $decimals = null) @@ -435,7 +435,7 @@ function parse_decimals(string $number, int $decimals = null) $config = config(OSPOS::class)->settings; - if($decimals === false) + if(!$decimals) { $decimals = $config['currency_decimals']; //TODO: $decimals is never used. } diff --git a/app/Helpers/report_helper.php b/app/Helpers/report_helper.php index 1378ac329..5c2483bb3 100644 --- a/app/Helpers/report_helper.php +++ b/app/Helpers/report_helper.php @@ -33,7 +33,7 @@ function get_report_link(string $report_name, string $report_prefix = '', string */ function can_show_report($permission_id, array $restrict_views = []): bool { - if (strpos($permission_id, 'reports_') === false) + if (!strpos($permission_id, 'reports_')) { return false; } diff --git a/app/Helpers/security_helper.php b/app/Helpers/security_helper.php index 6973a3ffd..c484c8ae2 100644 --- a/app/Helpers/security_helper.php +++ b/app/Helpers/security_helper.php @@ -29,7 +29,7 @@ function check_encryption(): bool @chmod($config_path, 0660); @chmod($backup_path, 0660); - + $config_file = file_get_contents($config_path); $config_file = preg_replace("/(encryption\.key.*=.*)('.*')/", "$1'$key'", $config_file); @@ -41,23 +41,23 @@ function check_encryption(): bool } $handle = @fopen($config_path, 'w+'); - + if(empty($handle)) { log_message('error', "Unable to open $config_path for updating"); return false; } - + @chmod($config_path, 0660); $write_failed = !fwrite($handle, $config_file); fclose($handle); - + if($write_failed) { log_message('error', "Unable to write to $config_path for updating."); - return false; + return false; } - log_message('info', "File $config_path has been updated."); + log_message('info', "File $config_path has been updated."); } return true; @@ -71,13 +71,13 @@ function abort_encryption_conversion() $config_file = file_get_contents($backup_path); $handle = @fopen($config_path, 'w+'); - + if(empty($handle)) { log_message('error', "Unable to open $config_path to undo encryption conversion"); } - else - { + else + { @chmod($config_path, 0660); $write_failed = !fwrite($handle, $config_file); fclose($handle); @@ -87,7 +87,7 @@ function abort_encryption_conversion() log_message('error', "Unable to write to $config_path to undo encryption conversion."); return; } - log_message('info', "File $config_path has been updated to undo encryption conversion"); + log_message('info', "File $config_path has been updated to undo encryption conversion"); } } @@ -98,10 +98,10 @@ function remove_backup() { return; } - if(unlink($backup_path) === false) + if(!unlink($backup_path)) { log_message('error', "Unable to remove $backup_path."); return; } - log_message('info', "File $backup_path has been removed"); + log_message('info', "File $backup_path has been removed"); } diff --git a/app/Helpers/tabular_helper.php b/app/Helpers/tabular_helper.php index 797e5ee32..8c89c079f 100644 --- a/app/Helpers/tabular_helper.php +++ b/app/Helpers/tabular_helper.php @@ -30,13 +30,13 @@ function transform_headers_readonly(array $array): string //TODO: $array needs t /** * Basic tabular headers function */ -function transform_headers(array $array, bool $readonly = FALSE, bool $editable = TRUE): string //TODO: $array needs to be refactored to a new name. Perhaps $headers? +function transform_headers(array $array, bool $readonly = false, bool $editable = true): string //TODO: $array needs to be refactored to a new name. Perhaps $headers? { $result = []; if(!$readonly) { - $array = array_merge ([['checkbox' => 'select', 'sortable' => FALSE]], $array); + $array = array_merge ([['checkbox' => 'select', 'sortable' => false]], $array); } if($editable) @@ -53,7 +53,7 @@ function transform_headers(array $array, bool $readonly = FALSE, bool $editable 'switchable' => $element['switchable'] ?? !preg_match('(^$| )', current($element)), 'escape' => !preg_match("/(edit|phone_number|email|messages|item_pic|customer_name|note)/", key($element)) && !(isset($element['escape']) && !$element['escape']), 'sortable' => $element['sortable'] ?? current($element) != '', - 'checkbox' => $element['checkbox'] ?? FALSE, + 'checkbox' => $element['checkbox'] ?? false, 'class' => isset($element['checkbox']) || preg_match('(^$| )', current($element)) ? 'print_hide' : '', 'sorter' => $element ['sorter'] ?? '' ]; @@ -81,10 +81,10 @@ function get_sales_manage_table_headers(): string if($config['invoice_enable']) { $headers[] = ['invoice_number' => lang('Sales.invoice_number')]; - $headers[] = ['invoice' => ' ', 'sortable' => FALSE, 'escape' => FALSE]; + $headers[] = ['invoice' => ' ', 'sortable' => false, 'escape' => false]; } - $headers[] = ['receipt' => ' ', 'sortable' => FALSE, 'escape' => FALSE]; + $headers[] = ['receipt' => ' ', 'sortable' => false, 'escape' => false]; return transform_headers($headers); } @@ -204,7 +204,7 @@ function get_people_manage_table_headers(): string if($employee->has_grant('messages', $session->get('person_id'))) { - $headers[] = ['messages' => '', 'sortable' => FALSE]; + $headers[] = ['messages' => '', 'sortable' => false]; } return transform_headers($headers); @@ -257,7 +257,7 @@ function get_customer_manage_table_headers(): string ['first_name' => lang('Common.first_name')], ['email' => lang('Common.email')], ['phone_number' => lang('Common.phone_number')], - ['total' => lang('Common.total_spent'), 'sortable' => FALSE] + ['total' => lang('Common.total_spent'), 'sortable' => false] ]; $employee = model(Employee::class); @@ -265,7 +265,7 @@ function get_customer_manage_table_headers(): string if($employee->has_grant('messages', $session->get('person_id'))) { - $headers[] = ['messages' => '', 'sortable' => FALSE]; + $headers[] = ['messages' => '', 'sortable' => false]; } return transform_headers($headers); @@ -396,23 +396,23 @@ function get_items_manage_table_headers(): string if($config['use_destination_based_tax']) { - $headers[] = ['tax_percents' => lang('Items.tax_category'), 'sortable' => FALSE]; + $headers[] = ['tax_percents' => lang('Items.tax_category'), 'sortable' => false]; } else { - $headers[] = ['tax_percents' => lang('Items.tax_percents'), 'sortable' => FALSE]; + $headers[] = ['tax_percents' => lang('Items.tax_percents'), 'sortable' => false]; } - $headers[] = ['item_pic' => lang('Items.image'), 'sortable' => FALSE]; + $headers[] = ['item_pic' => lang('Items.image'), 'sortable' => false]; foreach($definition_names as $definition_id => $definition_name) { - $headers[] = [$definition_id => $definition_name, 'sortable' => FALSE]; + $headers[] = [$definition_id => $definition_name, 'sortable' => false]; } - $headers[] = ['inventory' => '', 'escape' => FALSE]; - $headers[] = ['stock' => '', 'escape' => FALSE]; + $headers[] = ['inventory' => '', 'escape' => false]; + $headers[] = ['stock' => '', 'escape' => false]; return transform_headers($headers); } @@ -429,7 +429,7 @@ function get_item_data_row(object $item): array if($config['use_destination_based_tax']) { - if($item->tax_category_id == NULL) //TODO: === ? + if($item->tax_category_id == null) //TODO: === ? { $tax_percents = '-'; } @@ -454,7 +454,7 @@ function get_item_data_row(object $item): array $controller = get_controller(); - $image = NULL; + $image = null; if($item->pic_filename != '') //TODO: !== ? { $ext = pathinfo($item->pic_filename, PATHINFO_EXTENSION); @@ -572,8 +572,8 @@ function get_item_kits_manage_table_headers(): string ['item_kit_number' => lang('Item_kits.item_kit_number')], ['name' => lang('Item_kits.name')], ['description' => lang('Item_kits.description')], - ['total_cost_price' => lang('Items.cost_price'), 'sortable' => FALSE], - ['total_unit_price' => lang('Items.unit_price'), 'sortable' => FALSE] + ['total_cost_price' => lang('Items.cost_price'), 'sortable' => false], + ['total_unit_price' => lang('Items.unit_price'), 'sortable' => false] ]; return transform_headers($headers); diff --git a/app/Libraries/Barcode_lib.php b/app/Libraries/Barcode_lib.php index aa801993a..5af98bdb7 100644 --- a/app/Libraries/Barcode_lib.php +++ b/app/Libraries/Barcode_lib.php @@ -224,9 +224,9 @@ class Barcode_lib { $array = []; //TODO: Naming of this variable should be changed. The variable should never be named the data type. $fonts would be a better name. - if(($handle = opendir($folder)) !== FALSE) + if(($handle = opendir($folder)) !== false) { - while(($file = readdir($handle)) !== FALSE) + while(($file = readdir($handle)) !== false) { if(substr($file, -4, 4) === '.ttf') { diff --git a/app/Libraries/Barcodes/BarcodeBase.php b/app/Libraries/Barcodes/BarcodeBase.php index 0ca3782a4..777f3a3e3 100644 --- a/app/Libraries/Barcodes/BarcodeBase.php +++ b/app/Libraries/Barcodes/BarcodeBase.php @@ -82,7 +82,7 @@ abstract class BarcodeBase */ public function validate($barcode) { - return TRUE; + return true; } /** diff --git a/app/Libraries/Email_lib.php b/app/Libraries/Email_lib.php index 8ebfd8585..6290716e4 100644 --- a/app/Libraries/Email_lib.php +++ b/app/Libraries/Email_lib.php @@ -54,7 +54,7 @@ class Email_lib * Email sending function * Example of use: $response = sendEmail('john@doe.com', 'Hello', 'This is a message', $filename); */ - public function sendEmail(string $to, string $subject, string $message, string $attachment = NULL): bool + public function sendEmail(string $to, string $subject, string $message, string $attachment = null): bool { $email = $this->email; diff --git a/app/Libraries/MY_Email.php b/app/Libraries/MY_Email.php index 21c5452b6..8008b2e9d 100644 --- a/app/Libraries/MY_Email.php +++ b/app/Libraries/MY_Email.php @@ -16,14 +16,14 @@ class MY_Email extends Email parent::__construct($config); } - function sendMail(string $subject, string $body, string $to = NULL, string $reply_name = NULL, string $reply_mail = NULL, string $attachment = NULL): bool + function sendMail(string $subject, string $body, string $to = null, string $reply_name = null, string $reply_mail = null, string $attachment = null): bool { $this->setReplyTo($reply_mail, $reply_name); $this->setFrom($this->default_sender_address, $this->default_sender_name, $this->default_bounce_address); $this->setMailtype('html'); $this->setSubject($subject); $this->setMessage($body); - if ($to == NULL) { + if ($to == null) { $to = $this->default_email_address; $this->setCc($this->default_cc_address); } @@ -33,4 +33,4 @@ class MY_Email extends Email $this->setTo($to); return $this->send(); } -} \ No newline at end of file +} diff --git a/app/Libraries/Mailchimp_lib.php b/app/Libraries/Mailchimp_lib.php index 9652c4d35..9ebd0cd7e 100644 --- a/app/Libraries/Mailchimp_lib.php +++ b/app/Libraries/Mailchimp_lib.php @@ -78,7 +78,7 @@ class MailchimpConnector return $this->_request($httpVerb, $method, $args); //TODO: Hungarian notation } - return FALSE; + return false; } /** @@ -107,18 +107,18 @@ class MailchimpConnector */ private function _request(string $httpVerb, string $method, array $args = []) //TODO: Hungarian notation { - $result = FALSE; + $result = false; - if(($ch = curl_init()) !== FALSE) + if(($ch = curl_init()) !== false) { curl_setopt($ch, CURLOPT_URL, $this->_build_request_url($method, $httpVerb, $args)); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); curl_setopt($ch, CURLOPT_USERPWD, "user:" . $this->_api_key); curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/3.0'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); - curl_setopt($ch, CURLOPT_POST, TRUE); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($args)); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpVerb); @@ -127,7 +127,7 @@ class MailchimpConnector curl_close($ch); } - return $result ? json_decode($result, TRUE) : FALSE; + return $result ? json_decode($result, true) : false; } } diff --git a/app/Libraries/Receiving_lib.php b/app/Libraries/Receiving_lib.php index 8459a88d1..06d6af881 100644 --- a/app/Libraries/Receiving_lib.php +++ b/app/Libraries/Receiving_lib.php @@ -182,7 +182,7 @@ class Receiving_lib $this->session->remove('recv_stock_destination'); } //TODO: This array signature needs to be reworked. It's way too long. Perhaps an object needs to be passed rather than these? - public function add_item(int $item_id, int $quantity = 1, int $item_location = NULL, float $discount = 0, int $discount_type = 0, float $price = NULL, string $description = NULL, string $serialnumber = NULL, float $receiving_quantity = NULL, int $receiving_id = NULL, bool $include_deleted = FALSE): bool + public function add_item(int $item_id, int $quantity = 1, int $item_location = null, float $discount = 0, int $discount_type = 0, float $price = null, string $description = null, string $serialnumber = null, float $receiving_quantity = null, int $receiving_id = null, bool $include_deleted = false): bool { $config = config(OSPOS::class)->settings; @@ -194,7 +194,7 @@ class Receiving_lib if(!$item_id) { - return FALSE; + return false; } } @@ -207,7 +207,7 @@ class Receiving_lib //item to the list. Since items can be deleted, we can't use a count. we use the highest key + 1. $maxkey = 0; //Highest key so far - $itemalreadyinsale = FALSE; //We did not find the item yet. + $itemalreadyinsale = false; //We did not find the item yet. $updatekey = 0; //Key to use to update(quantity) foreach($items as $item) @@ -224,7 +224,7 @@ class Receiving_lib if($item['item_id'] == $item_id && $item['item_location'] == $item_location) { - $itemalreadyinsale = TRUE; + $itemalreadyinsale = true; $updatekey = $item['line']; } } @@ -233,7 +233,7 @@ class Receiving_lib $item_info = $this->item->get_info($item_id); //array records are identified by $insertkey and item_id is just another field. - $price = $price != NULL ? $price : $item_info->cost_price; + $price = $price != null ? $price : $item_info->cost_price; if($config['multi_pack_enabled']) { @@ -267,8 +267,8 @@ class Receiving_lib 'stock_name' => $this->stock_location->get_location_name($item_location), 'line' => $insertkey, 'name' => $item_info->name, - 'description' => $description != NULL ? $description: $item_info->description, - 'serialnumber' => $serialnumber != NULL ? $serialnumber: '', + 'description' => $description != null ? $description: $item_info->description, + 'serialnumber' => $serialnumber != null ? $serialnumber: '', 'attribute_values' => $attribute_links->attribute_values, 'attribute_dtvalues' => $attribute_links->attribute_dtvalues, 'allow_alt_description' => $item_info->allow_alt_description, @@ -298,7 +298,7 @@ class Receiving_lib $this->set_cart($items); - return TRUE; + return true; } public function edit_item($line, string $description, string $serialnumber, float $quantity, float $discount, int $discount_type, float $price, float $receiving_quantity): bool @@ -323,7 +323,7 @@ class Receiving_lib $this->set_cart($items); } - return FALSE; //TODO: This function will always return false. + return false; //TODO: This function will always return false. } /** @@ -356,7 +356,7 @@ class Receiving_lib foreach($this->receiving->get_receiving_items($receiving_id)->getResult() as $row) { - $this->add_item($row->item_id, -$row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, TRUE); + $this->add_item($row->item_id, -$row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, true); } $this->set_supplier($this->receiving->get_supplier($receiving_id)->person_id); @@ -381,7 +381,7 @@ class Receiving_lib foreach($this->receiving->get_receiving_items($receiving_id)->getResult() as $row) { - $this->add_item($row->item_id, $row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, TRUE); + $this->add_item($row->item_id, $row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, true); } $this->set_supplier($this->receiving->get_supplier($receiving_id)->person_id); diff --git a/app/Libraries/Sale_lib.php b/app/Libraries/Sale_lib.php index ac25ca042..2427b2cfa 100644 --- a/app/Libraries/Sale_lib.php +++ b/app/Libraries/Sale_lib.php @@ -201,7 +201,7 @@ class Sale_lib public function get_comment(): string { - // avoid returning a NULL that results in a 0 in the comment if nothing is set/available + // avoid returning a null that results in a 0 in the comment if nothing is set/available $comment = $this->session->get('sales_comment'); return empty($comment) ? '' : $comment; @@ -237,7 +237,7 @@ class Sale_lib return $this->session->get('sale_type'); } - public function set_invoice_number(int $invoice_number, bool $keep_custom = FALSE): void + public function set_invoice_number(int $invoice_number, bool $keep_custom = false): void { $current_invoice_number = $this->session->get('sales_invoice_number'); @@ -247,7 +247,7 @@ class Sale_lib } } - public function set_quote_number(string $quote_number, bool $keep_custom = FALSE): void + public function set_quote_number(string $quote_number, bool $keep_custom = false): void { $current_quote_number = $this->session->get('sales_quote_number'); @@ -257,7 +257,7 @@ class Sale_lib } } - public function set_work_order_number(string $work_order_number, bool $keep_custom = FALSE): void + public function set_work_order_number(string $work_order_number, bool $keep_custom = false): void { $current_work_order_number = $this->session->get('sales_work_order_number'); @@ -267,7 +267,7 @@ class Sale_lib } } - public function set_sale_type(int $sale_type, bool $keep_custom = FALSE): void + public function set_sale_type(int $sale_type, bool $keep_custom = false): void { $current_sale_type = $this->session->get('sale_type'); @@ -352,11 +352,11 @@ class Sale_lib {//TODO: this needs to be converted to a switch statement if($this->config['print_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also === { - return TRUE; + return true; } elseif($this->config['print_receipt_check_behaviour'] == 'never') //TODO: === ? { - return FALSE; + return false; } else // remember last setting, session based though { @@ -379,11 +379,11 @@ class Sale_lib {//TODO: this needs to be converted to a switch statement if($this->config['email_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also === { - return TRUE; + return true; } elseif($this->config['email_receipt_check_behaviour'] == 'never') //TODO: === ? { - return FALSE; + return false; } else // remember last setting, session based though { @@ -460,10 +460,10 @@ class Sale_lib $payments[$payment_id]['payment_amount'] = $payment_amount; $this->set_payments($payments); - return TRUE; + return true; } - return FALSE; + return false; } /** @@ -798,7 +798,7 @@ class Sale_lib } //TODO: this function needs to be reworked... way too many parameters. Also, optional parameters must go after mandatory parameters. - public function add_item(int &$item_id, int $item_location, string $quantity = '1', string &$discount = '0.0', int $discount_type = 0, int $price_mode = PRICE_MODE_STANDARD, int $kit_price_option = NULL, int $kit_print_option = NULL, string $price_override = NULL, string $description = NULL, string $serialnumber = NULL, int $sale_id = NULL, bool $include_deleted = FALSE, bool $print_option = NULL, bool $line = NULL): bool + public function add_item(int &$item_id, int $item_location, string $quantity = '1', string &$discount = '0.0', int $discount_type = 0, int $price_mode = PRICE_MODE_STANDARD, int $kit_price_option = null, int $kit_print_option = null, string $price_override = null, string $description = null, string $serialnumber = null, int $sale_id = null, bool $include_deleted = false, bool $print_option = null, bool $line = null): bool { $item_info = $this->item->get_info_by_id_or_number($item_id, $include_deleted); @@ -806,7 +806,7 @@ class Sale_lib if(empty($item_info)) { $item_id = NEW_ENTRY; - return FALSE; + return false; } $applied_discount = $discount; @@ -816,7 +816,7 @@ class Sale_lib $price = $item_info->unit_price; $cost_price = $item_info->cost_price; - if($price_override != NULL) + if($price_override != null) { $price = $price_override; } @@ -863,7 +863,7 @@ class Sale_lib //item to the cart. Since items can be deleted, we can't use a count. we use the highest key + 1. $maxkey = 0; //Highest key so far - $itemalreadyinsale = FALSE; //We did not find the item yet. //TODO: variable naming here does not match the convention + $itemalreadyinsale = false; //We did not find the item yet. //TODO: variable naming here does not match the convention $insertkey = 0; //Key to use for new entry. //TODO: $insertkey is never used $updatekey = 0; //Key to use to update(quantity) @@ -879,7 +879,7 @@ class Sale_lib if($item['item_id'] == $item_id && $item['item_location'] == $item_location) //TODO: === ? { - $itemalreadyinsale = TRUE; + $itemalreadyinsale = true; $updatekey = $item['line']; if(!$item_info->is_serialized) { @@ -912,7 +912,7 @@ class Sale_lib } else { //TODO: Convert this to ternary notation - if($print_option != NULL) //TODO: === ? + if($print_option != null) //TODO: === ? { $print_option_selected = $print_option; } @@ -923,7 +923,7 @@ class Sale_lib } $total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type); - $discounted_total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type, TRUE); + $discounted_total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type, true); if($this->config['multi_pack_enabled']) { @@ -945,8 +945,8 @@ class Sale_lib 'item_number' => $item_info->item_number, 'attribute_values' => $attribute_links->attribute_values, 'attribute_dtvalues' => $attribute_links->attribute_dtvalues, - 'description' => $description != NULL ? $description : $item_info->description, - 'serialnumber' => $serialnumber != NULL ? $serialnumber : '', + 'description' => $description != null ? $description : $item_info->description, + 'serialnumber' => $serialnumber != null ? $serialnumber : '', 'allow_alt_description' => $item_info->allow_alt_description, 'is_serialized' => $item_info->is_serialized, 'quantity' => $quantity, @@ -978,7 +978,7 @@ class Sale_lib $this->set_cart($items); - return TRUE; + return true; } public function out_of_stock(int $item_id, int $item_location): string @@ -1044,16 +1044,16 @@ class Sale_lib * @param string $discount * @param string|null $discount_type * @param string|null $price - * @param string|NULL $discounted_total + * @param string|null $discounted_total * @return bool */ - public function edit_item(string $line, string $description, string $serialnumber, string $quantity, string $discount, ?string $discount_type, ?string $price, ?string $discounted_total = NULL): bool + public function edit_item(string $line, string $description, string $serialnumber, string $quantity, string $discount, ?string $discount_type, ?string $price, ?string $discounted_total = null): bool { $items = $this->get_cart(); if(isset($items[$line])) { $line = &$items[$line]; - if($discounted_total != NULL && $discounted_total != $line['discounted_total']) + if($discounted_total != null && $discounted_total != $line['discounted_total']) { // Note when entered the "discounted_total" is expected to be entered without a discount $quantity = $this->get_quantity_sold($discounted_total, $price); @@ -1070,11 +1070,11 @@ class Sale_lib $line['price'] = $price; $line['total'] = $this->get_item_total($quantity, $price, $discount, $line['discount_type']); - $line['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $line['discount_type'], TRUE); + $line['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $line['discount_type'], true); $this->set_cart($items); } - return FALSE; //TODO: This function will always return false. + return false; //TODO: This function will always return false. } /** @@ -1108,7 +1108,7 @@ class Sale_lib foreach($this->sale->get_sale_items_ordered($sale_id)->getResult() as $row) { - $this->add_item($row->item_id, $row->item_location, -$row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, NULL, NULL, $row->item_unit_price, $row->description, $row->serialnumber, NULL, TRUE); + $this->add_item($row->item_id, $row->item_location, -$row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, null, null, $row->item_unit_price, $row->description, $row->serialnumber, null, true); } $this->set_customer($this->sale->get_customer($sale_id)->person_id); @@ -1119,14 +1119,14 @@ class Sale_lib //KIT # $pieces = explode(' ', $external_item_kit_id); $item_kit_id = (count($pieces) > 1) ? $pieces[1] : $external_item_kit_id; - $result = TRUE; + $result = true; $applied_discount = $discount; foreach($this->item_kit_items->get_info($item_kit_id) as $item_kit_item) { $result &= $this->add_item($item_kit_item['item_id'], $item_location, $item_kit_item['quantity'], $discount, $discount_type, PRICE_MODE_KIT, $kit_price_option, $kit_print_option); - if($stock_warning == NULL) + if($stock_warning == null) { $stock_warning = $this->out_of_stock($item_kit_item['item_id'], $item_location); } @@ -1142,7 +1142,7 @@ class Sale_lib foreach($this->sale->get_sale_items_ordered($sale_id)->getResult() as $row) { - $this->add_item($row->item_id, $row->item_location, $row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, NULL, NULL, $row->item_unit_price, $row->description, $row->serialnumber, $sale_id, TRUE, $row->print_option); + $this->add_item($row->item_id, $row->item_location, $row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, null, null, $row->item_unit_price, $row->description, $row->serialnumber, $sale_id, true, $row->print_option); } $this->session->set('cash_mode', CASH_MODE_FALSE); @@ -1155,7 +1155,7 @@ class Sale_lib { if($row->payment_type != lang('Sales.cash') && $row->payment_type != lang('Sales.cash_adjustment')) { - $cash_types_only = FALSE; + $cash_types_only = false; } } @@ -1266,7 +1266,7 @@ class Sale_lib { $item['discount'] = $discount; $item['total'] = $this->get_item_total($quantity, $price, $discount, $discount_type); - $item['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE); + $item['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $discount_type, true); } } @@ -1288,12 +1288,12 @@ class Sale_lib return $discount; } - public function get_subtotal(bool $include_discount = FALSE, bool $exclude_tax = FALSE): string + public function get_subtotal(bool $include_discount = false, bool $exclude_tax = false): string { return $this->calculate_subtotal($include_discount, $exclude_tax); } - public function get_item_total_tax_exclusive(int $item_id, string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = FALSE): string + public function get_item_total_tax_exclusive(int $item_id, string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = false): string { $tax_info = $this->item_taxes->get_info($item_id); $item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, $include_discount); @@ -1323,7 +1323,7 @@ class Sale_lib return $discounted_extended_amount; } - public function get_item_total(string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = FALSE): string + public function get_item_total(string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = false): string { $total = bcmul($quantity, $price); if($include_discount) @@ -1372,7 +1372,7 @@ class Sale_lib public function get_item_tax(string $quantity, string $price, string $discount, int $discount_type, string $tax_percentage): string { - $item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE); + $item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, true); if($this->config['tax_included']) { @@ -1387,7 +1387,7 @@ class Sale_lib return bcmul($item_total, $tax_fraction); } - public function calculate_subtotal(bool $include_discount = FALSE, bool $exclude_tax = FALSE): string + public function calculate_subtotal(bool $include_discount = false, bool $exclude_tax = false): string { $subtotal = '0.0'; foreach($this->get_cart() as $item) @@ -1410,9 +1410,9 @@ class Sale_lib * @param bool $include_cash_rounding * @return string */ - public function get_total(bool $include_cash_rounding = TRUE): string + public function get_total(bool $include_cash_rounding = true): string { - $total = $this->calculate_subtotal(TRUE); + $total = $this->calculate_subtotal(true); $cash_mode = $this->session->get('cash_mode'); diff --git a/app/Libraries/Sms_lib.php b/app/Libraries/Sms_lib.php index aa2599c92..0ad583243 100644 --- a/app/Libraries/Sms_lib.php +++ b/app/Libraries/Sms_lib.php @@ -35,14 +35,14 @@ class Sms_lib $username = $config['msg_uid']; $originator = $config['msg_src']; - $response = FALSE; + $response = false; - // if any of the parameters is empty return with a FALSE + // if any of the parameters is empty return with a false if(empty($username) || empty($password) || empty($phone) || empty($message) || empty($originator)) //TODO: This if/else needs to be flipped. and shortened. No else needed in the code example below. //$parameters = [$username, $password, $phone, $message, $originator]; //if(count(array_filter($parameters)) === 5) //{ - // $response = TRUE; + // $response = true; // $message = rawurlencode($message); //} { @@ -50,7 +50,7 @@ class Sms_lib } else { - $response = TRUE; + $response = true; //TODO: These comments should be moved to the documentation. As is, they tend to get out of date. // make sure passed string is url encoded $message = rawurlencode($message); //TODO: $message needs to be passed by reference if you want this line to actually do anything diff --git a/app/Libraries/Tax_lib.php b/app/Libraries/Tax_lib.php index 0f2346db3..637de2f87 100644 --- a/app/Libraries/Tax_lib.php +++ b/app/Libraries/Tax_lib.php @@ -62,7 +62,7 @@ class Tax_lib $decimals = tax_decimals(); // The tax basis should be returned to the currency scale - $tax_basis = $this->sale_lib->get_item_total($quantity, $price, $discount, $discount_type, TRUE); + $tax_basis = $this->sale_lib->get_item_total($quantity, $price, $discount, $discount_type, true); return $this->get_tax_for_amount($tax_basis, $tax_percentage, $rounding_code, $decimals); } @@ -94,7 +94,7 @@ class Tax_lib { foreach($cart as $line => $item) { - $taxed = FALSE; + $taxed = false; if(!$this->config['use_destination_based_tax']) { @@ -116,7 +116,7 @@ class Tax_lib foreach($tax_info as $tax) { // This computes tax for each line item and adds it to the tax type total - $tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], TRUE); + $tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], true); $tax_amount = '0.0'; if($this->config['tax_included']) @@ -135,7 +135,7 @@ class Tax_lib $tax_group_sequence++; $this->update_taxes($taxes, $tax_type, $tax['name'], $tax['percent'], $tax_basis, $tax_amount, $tax_group_sequence, Rounding_mode::HALF_UP, -1, $tax['name']); //TODO: Replace -1 with constant. $tax_group_sequence += 1; //TODO: $tax_group_sequence++; - $taxed = TRUE; + $taxed = true; } $items_taxes_detail = []; @@ -147,9 +147,9 @@ class Tax_lib $items_taxes_detail['rounding_code'] = Rounding_mode::HALF_UP; $items_taxes_detail['cascade_sequence'] = 0; $items_taxes_detail['item_tax_amount'] = $tax_amount; - $items_taxes_detail['sales_tax_code_id'] = NULL; - $items_taxes_detail['jurisdiction_id'] = NULL; - $items_taxes_detail['tax_category_id'] = NULL; + $items_taxes_detail['sales_tax_code_id'] = null; + $items_taxes_detail['jurisdiction_id'] = null; + $items_taxes_detail['tax_category_id'] = null; $item_taxes[] = $items_taxes_detail; } @@ -157,7 +157,7 @@ class Tax_lib else { // Start of destination based tax calculations - if($item['tax_category_id'] == NULL) //TODO: === ? + if($item['tax_category_id'] == null) //TODO: === ? { $item['tax_category_id'] = $this->config['default_tax_category']; } @@ -186,7 +186,7 @@ class Tax_lib public function get_included_tax(string $quantity, string $price, string $discount_percentage, int $discount_type, string $tax_percentage, $tax_decimal, $rounding_code): string //TODO: $tax_decimal and $rounding_code are in the signature but never used in the function. { - $item_total = $this->sale_lib->get_item_total($quantity, $price, $discount_percentage, $discount_type, TRUE); + $item_total = $this->sale_lib->get_item_total($quantity, $price, $discount_percentage, $discount_type, true); $tax_fraction = bcdiv(bcadd('100', $tax_percentage), '100'); $price_tax_excl = bcdiv($item_total, $tax_fraction); return bcsub($item_total, $price_tax_excl); @@ -195,7 +195,7 @@ class Tax_lib /** * Updates the sales_tax array which is later saved to the `sales_taxes` table and used for printing taxes on receipts and invoices */ - public function update_taxes(array &$taxes, string $tax_type, string $tax_group, string $tax_rate, string $tax_basis, string $item_tax_amount, int $tax_group_sequence, int $rounding_code, int $sale_id, string $name = '', int $tax_code_id = NULL, int $jurisdiction_id = NULL, int $tax_category_id = NULL): void + public function update_taxes(array &$taxes, string $tax_type, string $tax_group, string $tax_rate, string $tax_basis, string $item_tax_amount, int $tax_group_sequence, int $rounding_code, int $sale_id, string $name = '', int $tax_code_id = null, int $jurisdiction_id = null, int $tax_category_id = null): void { $tax_group_index = $this->clean('X' . (float)$tax_rate . '% ' . $tax_group); //TODO: Not sure we should be casting to a float here. The clean() function takes a string, so it just gets converted back to a string and there's risk of inaccuracies in the value displayed. @@ -328,7 +328,7 @@ class Tax_lib */ public function apply_destination_tax(array &$item, string $city, string $state, int $sales_tax_code_id, string $register_mode, int $sale_id, array &$taxes, array &$item_taxes, int $line): bool { - $taxed = FALSE; + $taxed = false; $tax_code_id = $this->get_applicable_tax_code($register_mode, $city, $state, $sales_tax_code_id); @@ -340,7 +340,7 @@ class Tax_lib $tax_definition = $this->tax->get_taxes($tax_code_id, $item['tax_category_id']); // The tax basis should be returned to the currency scale - $tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], TRUE); + $tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], true); $row = 0; //TODO: This variable is set but never used. @@ -374,7 +374,7 @@ class Tax_lib if($tax_amount != 0) { - $taxed = TRUE; + $taxed = true; $this->update_taxes($taxes, $tax_type, $tax['tax_group'], $tax_rate, $tax_basis, $tax_amount, $tax['tax_group_sequence'], $rounding_code, $sale_id, $tax['tax_group'], $tax_code_id, $tax['rate_jurisdiction_id'], $item['tax_category_id']); } @@ -407,11 +407,11 @@ class Tax_lib } else { - if($sales_tax_code_id == NULL || $sales_tax_code_id == 0) + if($sales_tax_code_id == null || $sales_tax_code_id == 0) { $sales_tax_code_id = $this->tax_code->get_sales_tax_code($city, $state); - if($sales_tax_code_id == NULL || $sales_tax_code_id == 0) + if($sales_tax_code_id == null || $sales_tax_code_id == 0) { $sales_tax_code_id = $this->config['default_tax_code']; // overrides customer assigned code } diff --git a/app/Libraries/Token_lib.php b/app/Libraries/Token_lib.php index 96ab6aedf..170884e0c 100644 --- a/app/Libraries/Token_lib.php +++ b/app/Libraries/Token_lib.php @@ -15,10 +15,10 @@ class Token_lib /** * Expands all the tokens found in a given text string and returns the results. */ - public function render(string $tokened_text, array $tokens = [], $save = TRUE): string + public function render(string $tokened_text, array $tokens = [], $save = true): string { // Apply the transformation for the "%" tokens if any are used - if(strpos($tokened_text, '%') !== FALSE) + if(strpos($tokened_text, '%') !== false) { $tokened_text = strftime($tokened_text); //TODO: these need to be converted to IntlDateFormatter::format() } @@ -28,7 +28,7 @@ class Token_lib if(empty($token_tree)) { - if(strpos($tokened_text, '%') !== FALSE) + if(strpos($tokened_text, '%') !== false) { return strftime($tokened_text); } @@ -87,7 +87,7 @@ class Token_lib $quantity = (isset($parsed_results['W'])) ? (int) $parsed_results['W'] / 1000 : 1; $item_id_or_number_or_item_kit_or_receipt = (isset($parsed_results['I'])) ? $parsed_results['I'] : $item_id_or_number_or_item_kit_or_receipt; - $price = (isset($parsed_results['P'])) ? (double) $parsed_results['P'] : NULL; + $price = (isset($parsed_results['P'])) ? (double) $parsed_results['P'] : null; } } else @@ -130,7 +130,7 @@ class Token_lib return $results; } - public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, bool $save = TRUE): array //TODO: $tokens + public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, bool $save = true): array //TODO: $tokens { foreach($used_tokens as $token_code => $token_info) { @@ -154,7 +154,7 @@ class Token_lib return $token_values; } - private function resolve_token($token_code, array $tokens = [], $save = TRUE): string + private function resolve_token($token_code, array $tokens = [], $save = true): string { foreach(array_merge($tokens, Token::get_tokens()) as $token) { diff --git a/app/Models/Appconfig.php b/app/Models/Appconfig.php index a6bc8a111..6071304d3 100644 --- a/app/Models/Appconfig.php +++ b/app/Models/Appconfig.php @@ -80,7 +80,7 @@ class Appconfig extends Model */ public function batch_save(array $data): bool { - $success = TRUE; + $success = true; $this->db->transStart(); diff --git a/app/Models/Attribute.php b/app/Models/Attribute.php index 55bbff499..3f09213ec 100644 --- a/app/Models/Attribute.php +++ b/app/Models/Attribute.php @@ -49,7 +49,7 @@ class Attribute extends Model /** * Determines if a given definition_id is an attribute */ - public function exists(int $definition_id, bool $deleted = FALSE): bool + public function exists(int $definition_id, bool $deleted = false): bool { $builder = $this->db->table('attribute_definitions'); $builder->where('definition_id', $definition_id); @@ -116,7 +116,7 @@ class Attribute extends Model return $query->getRow()->attribute_id; } - return FALSE; + return false; } /* @@ -256,16 +256,16 @@ class Attribute extends Model /** * Returns an array of attribute definition names and IDs * - * @param boolean $groups If FALSE does not return GROUP type attributes in the array + * @param boolean $groups If false does not return GROUP type attributes in the array * @return array Array containing definition IDs, attribute names and -1 index with the local language '[SELECT]' line. */ - public function get_definition_names(bool $groups = TRUE): array + public function get_definition_names(bool $groups = true): array { $builder = $this->db->table('attribute_definitions'); $builder->where('deleted', 0); $builder->orderBy('definition_name','ASC'); - if($groups === FALSE) + if(!$groups) { $builder->whereNotIn('definition_type',GROUP); } @@ -324,11 +324,11 @@ class Attribute extends Model private function check_data_validity(int $definition_id, string $from, string $to): bool { - $success = FALSE; + $success = false; if($from === TEXT) { - $success = TRUE; + $success = true; $builder = $this->db->table('attribute_values'); $builder->distinct()->select('attribute_value'); @@ -347,7 +347,7 @@ class Attribute extends Model break; } - if($success === FALSE) + if(!$success) { $affected_items = $this->get_items_by_value($attribute->attribute_value, $definition_id); foreach($affected_items as $affected_item) @@ -389,11 +389,11 @@ class Attribute extends Model */ private function convert_definition_data(int $definition_id, string $from_type, string $to_type): bool { - $success = FALSE; + $success = false; if($from_type === TEXT) { - if(in_array($to_type, [DATE, DECIMAL], TRUE)) + if(in_array($to_type, [DATE, DECIMAL], true)) { if($this->check_data_validity($definition_id, $from_type, $to_type)) { @@ -403,7 +403,7 @@ class Attribute extends Model } else if($to_type === DROPDOWN) { - $success = TRUE; + $success = true; } else if($to_type === CHECKBOX) //TODO: duplicated code. { @@ -414,7 +414,7 @@ class Attribute extends Model $query = 'UPDATE '. $this->db->prefixTable('attribute_links') .' links '; $query .= 'JOIN '. $this->db->prefixTable('attribute_values') .' vals '; $query .= 'ON vals.attribute_id = links.attribute_id '; - $query .= "SET links.attribute_id = IF((attribute_value IN('FALSE','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) "; + $query .= "SET links.attribute_id = IF((attribute_value IN('false','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) "; $query .= 'WHERE definition_id = '. $this->db->escape($definition_id); $success = $this->db->query($query); @@ -423,7 +423,7 @@ class Attribute extends Model } else if($from_type === DROPDOWN) { - if(in_array($to_type, [TEXT, CHECKBOX], TRUE)) //TODO: This if statement is possibly unnecessary... unless we have it there so that later we can do something with TEXT types also. + if(in_array($to_type, [TEXT, CHECKBOX], true)) //TODO: This if statement is possibly unnecessary... unless we have it there so that later we can do something with TEXT types also. { if($to_type === CHECKBOX) //TODO: Duplicated code. { @@ -435,7 +435,7 @@ class Attribute extends Model $query = 'UPDATE '. $this->db->prefixTable('attribute_links') .' links '; $query .= 'JOIN '. $this->db->prefixTable('attribute_values') .' vals '; $query .= 'ON vals.attribute_id = links.attribute_id '; - $query .= "SET links.attribute_id = IF((attribute_value IN('FALSE','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) "; + $query .= "SET links.attribute_id = IF((attribute_value IN('false','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) "; $query .= 'WHERE definition_id = '. $this->db->escape($definition_id); $success = $this->db->query($query); @@ -445,7 +445,7 @@ class Attribute extends Model } else { - $success = TRUE; + $success = true; } $this->delete_orphaned_links($definition_id); @@ -458,12 +458,12 @@ class Attribute extends Model $zero_attribute_id = $this->value_exists('0'); $one_attribute_id = $this->value_exists('1'); - if($zero_attribute_id === false) + if(!$zero_attribute_id) { $zero_attribute_id = $this->save_value('0', $definition_id, false, false, CHECKBOX); } - if($one_attribute_id === false) + if(!$one_attribute_id) { $one_attribute_id = $this->save_value('1', $definition_id, false, false, CHECKBOX); $one_attribute_id = $this->save_value('1', $definition_id, false, false, CHECKBOX); @@ -482,7 +482,7 @@ class Attribute extends Model //Definition doesn't exist if($definition_id === NO_DEFINITION_ID || !$this->exists($definition_id)) { - if($this->exists($definition_id,TRUE)) + if($this->exists($definition_id,true)) { $success = $this->undelete($definition_id); } @@ -515,9 +515,9 @@ class Attribute extends Model if($from_definition_type !== $to_definition_type) { - if($this->convert_definition_data($definition_id, $from_definition_type, $to_definition_type) === FALSE) + if(!$this->convert_definition_data($definition_id, $from_definition_type, $to_definition_type)) { - return FALSE; + return false; } } } @@ -581,7 +581,7 @@ class Attribute extends Model return $this->db->transStatus(); } - public function delete_link(int $item_id, bool $definition_id = FALSE): bool + public function delete_link(int $item_id, bool $definition_id = false): bool { $delete_data = ['item_id' => $item_id]; @@ -685,7 +685,7 @@ class Attribute extends Model } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -764,7 +764,7 @@ class Attribute extends Model //Update attribute_value $attribute_id = $this->value_exists($attribute_value, $definition_type); - if($attribute_id === false) + if(!$attribute_id) { switch($definition_type) //TODO: Duplicated code { @@ -789,8 +789,8 @@ class Attribute extends Model } $data = [ - 'attribute_id' => empty($attribute_id) ? NULL : $attribute_id, - 'item_id' => empty($item_id) ? NULL : $item_id, + 'attribute_id' => empty($attribute_id) ? null : $attribute_id, + 'item_id' => empty($item_id) ? null : $item_id, 'definition_id' => $definition_id ]; @@ -842,7 +842,7 @@ class Attribute extends Model * Deletes an Attribute definition from the database and associated column in the items_import.csv * * @param int $definition_id Attribute definition ID to remove. - * @return boolean TRUE if successful and FALSE if there is a failure + * @return boolean true if successful and false if there is a failure */ public function delete_definition(int $definition_id): bool { @@ -864,7 +864,7 @@ class Attribute extends Model * Deletes any attribute_links for a specific definition that do not have an item_id associated with them and are not DROPDOWN types * * @param int $definition_id - * @return boolean TRUE is returned if the delete was successful or FALSE if there were any failures + * @return boolean true is returned if the delete was successful or false if there were any failures */ public function delete_orphaned_links(int $definition_id): bool { @@ -894,7 +894,7 @@ class Attribute extends Model /** * Deletes any orphaned values that do not have associated links * - * @return boolean TRUE is returned if the delete was successful or FALSE if there were any failures + * @return boolean true is returned if the delete was successful or false if there were any failures */ public function delete_orphaned_values(): bool { @@ -905,7 +905,7 @@ class Attribute extends Model $this->db->transStart(); $builder = $this->db->table('attribute_values'); - $builder->whereNotIn('attribute_id', $subquery, FALSE); + $builder->whereNotIn('attribute_id', $subquery, false); $builder->delete(); $this->db->transComplete(); @@ -937,13 +937,13 @@ class Attribute extends Model foreach($attributes as $attribute) { - $new_attribute_id = $this->save_value($attribute['attribute_value'], $definition_id, FALSE, $attribute['attribute_id'], $definition_type); + $new_attribute_id = $this->save_value($attribute['attribute_value'], $definition_id, false, $attribute['attribute_id'], $definition_type); if(!$this->save_link($attribute['item_id'], $definition_id, $new_attribute_id)) { log_message('Error', 'Transaction failed'); $this->db->transRollback(); - return FALSE; + return false; } } $success = $this->delete_orphaned_links($definition_id); diff --git a/app/Models/Cashup.php b/app/Models/Cashup.php index e1197f24a..a32e2674b 100644 --- a/app/Models/Cashup.php +++ b/app/Models/Cashup.php @@ -72,20 +72,20 @@ class Cashup extends Model */ public function get_found_rows(string $search, array $filters): int { - return $this->search($search, $filters, 0, 0, 'cashup_id', 'asc', TRUE); + return $this->search($search, $filters, 0, 0, 'cashup_id', 'asc', true); } /** * Searches cashups */ - public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'cashup_id', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'cashup_id', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'cashup_id'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $config = config(OSPOS::class)->settings; $builder = $this->db->table('cash_up AS cash_up'); @@ -235,7 +235,7 @@ class Cashup extends Model } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -255,10 +255,10 @@ class Cashup extends Model { $cash_up_data['cashup_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder = $this->db->table('cash_up'); diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 603193f89..1d126ba07 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -129,7 +129,7 @@ class Customer extends Person } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -207,7 +207,7 @@ class Customer extends Person // if the email is empty return like it is not existing if(empty($email)) { - return FALSE; + return false; } $builder = $this->db->table('customers'); @@ -228,7 +228,7 @@ class Customer extends Person */ public function save_customer(array &$person_data, array &$customer_data, int $customer_id = NEW_ENTRY): bool { - $success = FALSE; + $success = false; $this->db->transStart(); @@ -266,7 +266,7 @@ class Customer extends Person public function delete($customer_id = null, bool $purge = false): bool { - $result = TRUE; + $result = true; $config = config(OSPOS::class)->settings; // if privacy enforcement is selected scramble customer data @@ -279,7 +279,7 @@ class Customer extends Person 'last_name' => $customer_id, 'phone_number' => '', 'email' => '', - 'gender' => NULL, + 'gender' => null, 'address_1' => '', 'address_2' => '', 'city' => '', @@ -293,15 +293,15 @@ class Customer extends Person $builder->where('person_id', $customer_id); $result &= $builder->update([ 'consent' => 0, - 'company_name' => NULL, - 'account_number' => NULL, + 'company_name' => null, + 'account_number' => null, 'tax_id' => '', 'taxable' => 0, 'discount' => 0.00, 'discount_type' => 0, - 'package_id' => NULL, - 'points' => NULL, - 'sales_tax_code_id' => NULL, + 'package_id' => null, + 'points' => null, + 'sales_tax_code_id' => null, 'deleted' => 1 ]); } @@ -420,21 +420,21 @@ class Customer extends Person */ public function get_found_rows(string $search): int { - $result = $this->search($search, 0, 0, 'last_name', 'asc', TRUE); + $result = $this->search($search, 0, 0, 'last_name', 'asc', true); return $result; } /** * Performs a search on customers */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'last_name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('customers AS customers'); diff --git a/app/Models/Dinner_table.php b/app/Models/Dinner_table.php index 207156c1f..f5e98470b 100644 --- a/app/Models/Dinner_table.php +++ b/app/Models/Dinner_table.php @@ -83,7 +83,7 @@ class Dinner_table extends Model { if(empty($dinner_table_id)) { - return FALSE; + return false; } else //TODO: No need for this else statement. Just put it's contents outside of the else since the if has a return in it. { @@ -125,7 +125,7 @@ class Dinner_table extends Model $builder->where('dinner_table_id', $dinner_table_id); return $builder->update(['status' => 1]); } - else//TODO: THIS ELSE STATEMENT ISN'T NEEDED. JUST DO THE IF AND THEN RETURN TRUE AFTER IT. + else//TODO: THIS ELSE STATEMENT ISN'T NEEDED. JUST DO THE IF AND THEN RETURN true AFTER IT. { return true; } diff --git a/app/Models/Employee.php b/app/Models/Employee.php index 0e1a90122..7ddf9c50f 100644 --- a/app/Models/Employee.php +++ b/app/Models/Employee.php @@ -126,7 +126,7 @@ class Employee extends Person */ public function save_employee(array &$person_data, array &$employee_data, array &$grants_data, int $employee_id = NEW_ENTRY): bool { - $success = FALSE; + $success = false; //Run these queries as a transaction, we want to make sure we do all or nothing $this->db->transStart(); @@ -182,12 +182,12 @@ class Employee extends Person */ public function delete($employee_id = null, bool $purge = false): bool { - $success = FALSE; + $success = false; //Don't let employees delete themselves if($employee_id == $this->get_logged_in_employee_info()->person_id) { - return FALSE; + return false; } //Run these queries as a transaction, we want to make sure we do all or nothing @@ -213,12 +213,12 @@ class Employee extends Person */ public function delete_list(array $person_ids): bool { - $success = FALSE; + $success = false; //Don't let employees delete themselves if(in_array($this->get_logged_in_employee_info()->person_id, $person_ids)) { - return FALSE; + return false; } //Run these queries as a transaction, we want to make sure we do all or nothing @@ -244,7 +244,7 @@ class Employee extends Person /** * Get search suggestions to find employees */ - public function get_search_suggestions(string $search, int $limit = 25, bool $unique = FALSE): array + public function get_search_suggestions(string $search, int $limit = 25, bool $unique = false): array { $suggestions = []; @@ -330,20 +330,20 @@ class Employee extends Person */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'last_name', 'asc', TRUE); + return $this->search($search, 0, 0, 'last_name', 'asc', true); } /** * Performs a search on employees */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'last_name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('employees AS employees'); @@ -405,11 +405,11 @@ class Employee extends Person { $this->session->set('person_id', $row->person_id); - return TRUE; + return true; } } - return FALSE; + return false; } /** @@ -425,7 +425,7 @@ class Employee extends Person */ public function is_logged_in(): bool { - return ($this->session->get('person_id') != FALSE); + return ($this->session->get('person_id') != false); } /** @@ -438,7 +438,7 @@ class Employee extends Person return $this->get_info($this->session->get('person_id')); } - return FALSE; + return false; } /** @@ -476,13 +476,13 @@ class Employee extends Person public function has_grant(?string $permission_id, ?int $person_id): bool { //if no module_id is null, allow access - if($permission_id == NULL) + if($permission_id == null) { - return TRUE; + return true; } - if($person_id == NULL) + if($person_id == null) { - return FALSE; + return false; } $builder = $this->db->table('grants'); @@ -504,7 +504,7 @@ class Employee extends Person $row = $builder->get()->getRow(); // If no grants are assigned yet then set the default to 'home' - if($row == NULL) + if($row == null) { return 'home'; } @@ -539,19 +539,19 @@ class Employee extends Person if(password_verify($password, $row->password)) { - return TRUE; + return true; } } - return FALSE; + return false; } /** * Change password for the employee */ - public function change_password(array $employee_data, $employee_id = FALSE): bool + public function change_password(array $employee_data, $employee_id = false): bool { - $success = FALSE; + $success = false; if(ENVIRONMENT != 'testing') { diff --git a/app/Models/Expense.php b/app/Models/Expense.php index c22cc343b..5f5c1fe34 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -79,7 +79,7 @@ class Expense extends Model */ public function get_found_rows(string $search, array $filters): int { - return $this->search($search, $filters, 0, 0, 'expense_id', 'asc', TRUE); + return $this->search($search, $filters, 0, 0, 'expense_id', 'asc', true); } /** @@ -94,14 +94,14 @@ class Expense extends Model * @param bool|null $count_only * @return ResultInterface|false|string */ - public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'expense_id', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'expense_id', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'expense_id'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $config = config(OSPOS::class)->settings; $builder = $this->db->table('expenses AS expenses'); @@ -240,9 +240,9 @@ class Expense extends Model } $empty_obj = $this->getEmptyObject('expenses'); - $empty_obj->supplier_name = NULL; - $empty_obj->first_name = NULL; - $empty_obj->last_name = NULL; + $empty_obj->supplier_name = null; + $empty_obj->first_name = null; + $empty_obj->last_name = null; return $empty_obj; } @@ -269,7 +269,7 @@ class Expense extends Model } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -289,10 +289,10 @@ class Expense extends Model { $expense_data['expense_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('expense_id', $expense_id); diff --git a/app/Models/Expense_category.php b/app/Models/Expense_category.php index 5bfc8a841..43d486ef0 100644 --- a/app/Models/Expense_category.php +++ b/app/Models/Expense_category.php @@ -75,7 +75,7 @@ class Expense_category extends Model /** * Returns all the expense_categories */ - public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = FALSE): ResultInterface + public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = false): ResultInterface { $builder = $this->db->table('expense_categories'); @@ -119,10 +119,10 @@ class Expense_category extends Model { $expense_category_data['expense_category_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('expense_category_id', $expense_category_id); @@ -146,20 +146,20 @@ class Expense_category extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'category_name', 'asc', TRUE); + return $this->search($search, 0, 0, 'category_name', 'asc', true); } /** * Perform a search on expense_category */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'category_name', ?string $order='asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'category_name', ?string $order='asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'category_name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('expense_categories AS expense_categories'); diff --git a/app/Models/Giftcard.php b/app/Models/Giftcard.php index 6400d4ca0..a7cdd0fbb 100644 --- a/app/Models/Giftcard.php +++ b/app/Models/Giftcard.php @@ -104,7 +104,7 @@ class Giftcard extends Model } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -127,7 +127,7 @@ class Giftcard extends Model return $query->getRow()->giftcard_id; } - return FALSE; + return false; } /** @@ -157,10 +157,10 @@ class Giftcard extends Model $giftcard_data['giftcard_number'] = $this->db->insertID(); $giftcard_data['giftcard_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('giftcard_id', $giftcard_id); @@ -247,27 +247,27 @@ class Giftcard extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'giftcard_number', 'asc', TRUE); + return $this->search($search, 0, 0, 'giftcard_number', 'asc', true); } /** * Performs a search on giftcards */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'giftcard_number', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'giftcard_number', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'giftcard_number'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'giftcard_number'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('giftcards'); diff --git a/app/Models/Inventory.php b/app/Models/Inventory.php index 2957fb69c..e46966260 100644 --- a/app/Models/Inventory.php +++ b/app/Models/Inventory.php @@ -27,14 +27,14 @@ class Inventory extends Model 'trans_location' ]; - public function insert($inventory_data = NULL, bool $returnID = TRUE) + public function insert($inventory_data = null, bool $returnID = true) { $builder = $this->db->table('inventory'); return $builder->insert($inventory_data); } - public function update($comment = NULL, $inventory_data = NULL): bool + public function update($comment = null, $inventory_data = null): bool { $builder = $this->db->table('inventory'); $builder->where('trans_comment', $comment); @@ -48,7 +48,7 @@ class Inventory extends Model * @param bool $location_id * @return ResultInterface */ - public function get_inventory_data_for_item(int $item_id, bool $location_id = FALSE): ResultInterface + public function get_inventory_data_for_item(int $item_id, bool $location_id = false): ResultInterface { $builder = $this->db->table('inventory'); $builder->where('trans_items', $item_id); @@ -85,7 +85,7 @@ class Inventory extends Model } } - return TRUE; + return true; } public function get_inventory_sum(int $item_id): array diff --git a/app/Models/Item.php b/app/Models/Item.php index 2c3e60ffd..d92908c5b 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -47,12 +47,12 @@ class Item extends Model /** * Determines if a given item_id is an item */ - public function exists(int $item_id, bool $ignore_deleted = FALSE, bool $deleted = FALSE): bool + public function exists(int $item_id, bool $ignore_deleted = false, bool $deleted = false): bool { $builder = $this->db->table('items'); $builder->where('item_id', $item_id); - if($ignore_deleted === FALSE) + if(!$ignore_deleted) { $builder->where('deleted', $deleted); } @@ -69,7 +69,7 @@ class Item extends Model if($config['allow_duplicate_barcodes']) { - return FALSE; + return false; } $builder = $this->db->table('items'); @@ -110,26 +110,26 @@ class Item extends Model */ public function get_found_rows(string $search, array $filters): int { - return $this->search($search, $filters, 0, 0, 'items.name', 'asc', TRUE); + return $this->search($search, $filters, 0, 0, 'items.name', 'asc', true); } /** * Perform a search on items */ - public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'items.name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'items.name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values - if($rows == NULL) $rows = 0; - if($limit_from == NULL) $limit_from = 0; - if($sort == NULL) $sort = 'items.name'; - if($order == NULL) $order = 'asc'; - if($count_only == NULL) $count_only = FALSE; + if($rows == null) $rows = 0; + if($limit_from == null) $limit_from = 0; + if($sort == null) $sort = 'items.name'; + if($order == null) $order = 'asc'; + if($count_only == null) $count_only = false; $config = config(OSPOS::class)->settings; $builder = $this->db->table('items AS items'); //TODO: I'm not sure if it's needed to write items AS items... I think you can just get away with items // get_found_rows case - if($count_only === TRUE) //TODO: replace this with `if($count_only)` + if($count_only) { $builder->select('COUNT(DISTINCT items.item_id) AS count'); } @@ -229,7 +229,7 @@ class Item extends Model if($filters['empty_upc']) { - $builder->where('item_number', NULL); + $builder->where('item_number', null); } if($filters['low_inventory']) { @@ -346,7 +346,7 @@ class Item extends Model } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -356,7 +356,7 @@ class Item extends Model /** * Gets information about a particular item by item id or number */ - public function get_info_by_id_or_number(int $item_id, bool $include_deleted = TRUE) + public function get_info_by_id_or_number(int $item_id, bool $include_deleted = true) { $builder = $this->db->table('items'); $builder->groupStart(); @@ -393,7 +393,7 @@ class Item extends Model /** * Get an item id given an item number */ - public function get_item_id(string $item_number, bool $ignore_deleted = FALSE, bool $deleted = FALSE): bool + public function get_item_id(string $item_number, bool $ignore_deleted = false, bool $deleted = false): bool { $builder = $this->db->table('items'); $builder->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left'); @@ -411,7 +411,7 @@ class Item extends Model return $query->getRow()->item_id; } - return FALSE; + return false; } /** @@ -449,7 +449,7 @@ class Item extends Model { $builder = $this->db->table('items'); - if($item_id == NEW_ENTRY || !$this->exists($item_id, TRUE)) + if($item_id == NEW_ENTRY || !$this->exists($item_id, true)) { if($builder->insert($item_data)) { @@ -461,10 +461,10 @@ class Item extends Model $builder->update(['low_sell_item_id' => $item_data['item_id']]); } - return TRUE; + return true; } - return FALSE; + return false; } else { @@ -492,7 +492,7 @@ class Item extends Model * Deletes one item * @throws ReflectionException */ - public function delete($item_id = NULL, bool $purge = false) + public function delete($item_id = null, bool $purge = false) { $this->db->transStart(); @@ -556,7 +556,7 @@ class Item extends Model return $success; } - function get_search_suggestion_format(string $seed = NULL): string + function get_search_suggestion_format(string $seed = null): string { $config = config(OSPOS::class)->settings; $seed .= ',' . $config['suggestions_first_column']; @@ -636,7 +636,7 @@ class Item extends Model } } - public function get_search_suggestions(string $search, array $filters = ['is_deleted' => FALSE, 'search_custom' => FALSE], bool $unique = FALSE, int $limit = 25): array + public function get_search_suggestions(string $search, array $filters = ['is_deleted' => false, 'search_custom' => false], bool $unique = false, int $limit = 25): array { $suggestions = []; $non_kit = [ITEM, ITEM_AMOUNT_ENTRY]; @@ -686,7 +686,7 @@ class Item extends Model $builder->select('company_name'); $builder->like('company_name', $search); - // restrict to non deleted companies only if is_deleted is FALSE + // restrict to non deleted companies only if is_deleted is false $builder->where('deleted', $filters['is_deleted']); $builder->distinct(); $builder->orderBy('company_name', 'asc'); @@ -714,7 +714,7 @@ class Item extends Model } //Search in attributes - if($filters['search_custom'] !== FALSE) + if($filters['search_custom'] !== false) { $builder = $this->db->table('attribute_links'); $builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id'); @@ -741,7 +741,7 @@ class Item extends Model } - public function get_stock_search_suggestions(string $search, array $filters = ['is_deleted' => FALSE, 'search_custom' => FALSE], bool $unique = FALSE, int $limit = 25): array + public function get_stock_search_suggestions(string $search, array $filters = ['is_deleted' => false, 'search_custom' => false], bool $unique = false, int $limit = 25): array { $suggestions = []; $non_kit = [ITEM, ITEM_AMOUNT_ENTRY]; @@ -794,7 +794,7 @@ class Item extends Model $builder->select('company_name'); $builder->like('company_name', $search); - // restrict to non deleted companies only if is_deleted is FALSE + // restrict to non deleted companies only if is_deleted is false $builder->where('deleted', $filters['is_deleted']); $builder->distinct(); $builder->orderBy('company_name', 'asc'); @@ -823,7 +823,7 @@ class Item extends Model } //Search by custom fields - if($filters['search_custom'] !== FALSE) //TODO: duplicated code. We should refactor out a method... this can be replaced with `if($filters['search_custom']`... no need for the double negative + if($filters['search_custom'] !== false) //TODO: duplicated code. We should refactor out a method... this can be replaced with `if($filters['search_custom']`... no need for the double negative { $builder = $this->db->table('attribute_links'); $builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id'); @@ -849,7 +849,7 @@ class Item extends Model return array_unique($suggestions, SORT_REGULAR); } - public function get_kit_search_suggestions(string $search, array $filters = ['is_deleted' => FALSE, 'search_custom' => FALSE], bool $unique = FALSE, int $limit = 25): array + public function get_kit_search_suggestions(string $search, array $filters = ['is_deleted' => false, 'search_custom' => false], bool $unique = false, int $limit = 25): array { $suggestions = []; $non_kit = [ITEM, ITEM_AMOUNT_ENTRY]; //TODO: This variable is never used. @@ -899,7 +899,7 @@ class Item extends Model $builder->select('company_name'); $builder->like('company_name', $search); - // restrict to non deleted companies only if is_deleted is FALSE + // restrict to non deleted companies only if is_deleted is false $builder->where('deleted', $filters['is_deleted']); $builder->distinct(); $builder->orderBy('company_name', 'asc'); @@ -927,7 +927,7 @@ class Item extends Model } //Search in attributes - if($filters['search_custom'] !== FALSE) //TODO: Duplicate code... same as above... no double negatives + if($filters['search_custom'] !== false) //TODO: Duplicate code... same as above... no double negatives { $builder = $this->db->table('attribute_links'); $builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id'); @@ -1032,9 +1032,9 @@ class Item extends Model * caution: must be used before item_quantities gets updated, otherwise the average price is wrong! * */ - public function change_cost_price(int $item_id, float $items_received, float $new_price, float $old_price = NULL): bool + public function change_cost_price(int $item_id, float $items_received, float $new_price, float $old_price = null): bool { - if($old_price === NULL) + if($old_price === null) { $item_info = $this->get_info($item_id); $old_price = $item_info->cost_price; @@ -1081,11 +1081,11 @@ class Item extends Model * for a multipack environment then the item name should have the * pack appended to it */ - function get_item_name(string $as_name = NULL): string + function get_item_name(string $as_name = null): string { $config = config(OSPOS::class)->settings; - if($as_name == NULL) //TODO: Replace with ternary notation + if($as_name == null) //TODO: Replace with ternary notation { $as_name = ''; } diff --git a/app/Models/Item_kit.php b/app/Models/Item_kit.php index 4425061a9..d758a0cd9 100644 --- a/app/Models/Item_kit.php +++ b/app/Models/Item_kit.php @@ -57,7 +57,7 @@ class Item_kit extends Model } } - return FALSE; + return false; } /** @@ -69,7 +69,7 @@ class Item_kit extends Model if($config['allow_duplicate_barcodes']) { - return FALSE; + return false; } $builder = $this->db->table('item_kits'); @@ -177,10 +177,10 @@ class Item_kit extends Model { $item_kit_data['item_kit_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('item_kit_id', $item_kit_id); @@ -216,7 +216,7 @@ class Item_kit extends Model $builder = $this->db->table('item_kits'); //KIT # - if(stripos($search, 'KIT ') !== FALSE) + if(stripos($search, 'KIT ') !== false) { $builder->like('item_kit_id', str_ireplace('KIT ', '', $search)); $builder->orderBy('item_kit_id', 'asc'); @@ -252,20 +252,20 @@ class Item_kit extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'name', 'asc', TRUE); + return $this->search($search, 0, 0, 'name', 'asc', true); } /** * Perform a search on items */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('item_kits'); @@ -280,7 +280,7 @@ class Item_kit extends Model $builder->orLike('item_kit_number', $search); //KIT # - if(stripos($search, 'KIT ') !== FALSE) + if(stripos($search, 'KIT ') !== false) { $builder->orLike('item_kit_id', str_ireplace('KIT ', '', $search)); } diff --git a/app/Models/Item_kit_items.php b/app/Models/Item_kit_items.php index 13fcb0c88..7b674d6d6 100644 --- a/app/Models/Item_kit_items.php +++ b/app/Models/Item_kit_items.php @@ -53,13 +53,13 @@ class Item_kit_items extends Model */ public function save_value(array &$item_kit_items_data, int $item_kit_id): bool { - $success = TRUE; + $success = true; $this->db->transStart(); $this->delete($item_kit_id); - if($item_kit_items_data != NULL) + if($item_kit_items_data != null) { $builder = $this->db->table('item_kit_items'); diff --git a/app/Models/Item_taxes.php b/app/Models/Item_taxes.php index 3a5acc9c3..3bf6a4665 100644 --- a/app/Models/Item_taxes.php +++ b/app/Models/Item_taxes.php @@ -35,7 +35,7 @@ class Item_taxes extends Model */ public function save_value(array &$items_taxes_data, int $item_id): bool { - $success = TRUE; + $success = true; //Run these queries as a transaction, we want to make sure we do all or nothing $this->db->transStart(); @@ -62,7 +62,7 @@ class Item_taxes extends Model */ public function save_multiple(array &$items_taxes_data, string $item_ids): bool //TODO: investigate why this is sent as a : delimited string rather than an array. { - $success = TRUE; + $success = true; //Run these queries as a transaction, we want to make sure we do all or nothing $this->db->transStart(); diff --git a/app/Models/Module.php b/app/Models/Module.php index bbc2fd4ba..81b63e823 100644 --- a/app/Models/Module.php +++ b/app/Models/Module.php @@ -63,7 +63,7 @@ class Module extends Model $builder->join('modules AS modules', 'modules.module_id = permissions.module_id'); //TODO: can the table parameter just be modules instead of modules AS modules? // can't quote the parameters correctly when using different operators.. - $builder->where('modules.module_id != ', 'permission_id', FALSE); + $builder->where('modules.module_id != ', 'permission_id', false); return $builder->get(); } diff --git a/app/Models/Person.php b/app/Models/Person.php index ef8f6d828..41aaea681 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -35,7 +35,7 @@ class Person extends Model * * @param integer $person_id identifier of the person to verify the existence * - * @return boolean TRUE if the person exists, FALSE if not + * @return boolean true if the person exists, false if not */ public function exists(int $person_id): bool { @@ -119,7 +119,7 @@ class Person extends Model } else { - $empty_obj->$field_name = NULL; + $empty_obj->$field_name = null; } } @@ -146,7 +146,7 @@ class Person extends Model * * @param array $person_data array containing person information * @param int $person_id identifier of the person to update the information - * @return boolean TRUE if the save was successful, FALSE if not + * @return boolean true if the save was successful, false if not */ public function save_value(array &$person_data, int $person_id = NEW_ENTRY): bool { @@ -158,10 +158,10 @@ class Person extends Model { $person_data['person_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('person_id', $person_id); @@ -213,7 +213,7 @@ class Person extends Model * Deletes one Person (dummy base function) * * @param integer $person_id person identifier - * @return boolean always TRUE + * @return boolean always true */ public function delete($person_id = null, bool $purge = false): bool { @@ -224,10 +224,10 @@ class Person extends Model * Deletes a list of people (dummy base function) * * @param array $person_ids list of person identifiers - * @return boolean always TRUE + * @return boolean always true */ public function delete_list(array $person_ids): bool { - return TRUE; + return true; } } diff --git a/app/Models/Receiving.php b/app/Models/Receiving.php index efab75e9a..0cec5e880 100644 --- a/app/Models/Receiving.php +++ b/app/Models/Receiving.php @@ -61,7 +61,7 @@ class Receiving extends Model } } - return FALSE; + return false; } public function exists(int $receiving_id): bool @@ -72,7 +72,7 @@ class Receiving extends Model return ($builder->get()->getNumRows() == 1); } - public function update($receiving_id = NULL, $receiving_data = NULL): bool + public function update($receiving_id = null, $receiving_data = null): bool { $builder = $this->db->table('receivings'); $builder->where('receiving_id', $receiving_id); @@ -98,7 +98,7 @@ class Receiving extends Model $receivings_data = [ 'receiving_time' => date('Y-m-d H:i:s'), - 'supplier_id' => $supplier->exists($supplier_id) ? $supplier_id : NULL, + 'supplier_id' => $supplier->exists($supplier_id) ? $supplier_id : null, 'employee_id' => $employee_id, 'payment_type' => $payment_type, 'comment' => $comment, @@ -171,21 +171,16 @@ class Receiving extends Model $this->db->transComplete(); - if($this->db->transStatus() === FALSE) //TODO: Probably better written as return $this->db->transStatus() ? $receiving_id : -1; - { - return -1; - } - - return $receiving_id; + return $this->db->transStatus() ? $receiving_id : -1; } /** * @throws ReflectionException */ - public function delete_list(array $receiving_ids, int $employee_id, bool $update_inventory = TRUE): bool + public function delete_list(array $receiving_ids, int $employee_id, bool $update_inventory = true): bool { - $success = TRUE; + $success = true; // start a transaction to assure data integrity $this->db->transStart(); @@ -206,7 +201,7 @@ class Receiving extends Model /** * @throws ReflectionException */ - public function delete_value(int $receiving_id, int $employee_id, bool $update_inventory = TRUE): bool + public function delete_value(int $receiving_id, int $employee_id, bool $update_inventory = true): bool { // start a transaction to assure data integrity $this->db->transStart(); diff --git a/app/Models/Reports/Detailed_receivings.php b/app/Models/Reports/Detailed_receivings.php index 340aac093..40ee58c60 100644 --- a/app/Models/Reports/Detailed_receivings.php +++ b/app/Models/Reports/Detailed_receivings.php @@ -24,7 +24,7 @@ class Detailed_receivings extends Report return [ 'summary' => [ ['id' => lang('Reports.receiving_id')], - ['receiving_time' => lang('Reports.date'), 'sortable' => FALSE], + ['receiving_time' => lang('Reports.date'), 'sortable' => false], ['quantity' => lang('Reports.quantity')], ['employee_name' => lang('Reports.received_by')], ['supplier_name' => lang('Reports.supplied_by')], @@ -168,4 +168,4 @@ class Detailed_receivings extends Report return $builder->get()->getRowArray(); } -} \ No newline at end of file +} diff --git a/app/Models/Reports/Detailed_sales.php b/app/Models/Reports/Detailed_sales.php index 094a43e18..1bcb8e26b 100644 --- a/app/Models/Reports/Detailed_sales.php +++ b/app/Models/Reports/Detailed_sales.php @@ -25,7 +25,7 @@ class Detailed_sales extends Report 'summary' => [ ['id' => lang('Reports.sale_id')], ['type_code' => lang('Reports.code_type')], - ['sale_time' => lang('Reports.date'), 'sortable' => FALSE], + ['sale_time' => lang('Reports.date'), 'sortable' => false], ['quantity' => lang('Reports.quantity')], ['employee_name' => lang('Reports.sold_by')], ['customer_name' => lang('Reports.sold_to')], @@ -34,7 +34,7 @@ class Detailed_sales extends Report ['total' => lang('Reports.total'), 'sorter' => 'number_sorter'], ['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'], ['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'], - ['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE], + ['payment_type' => lang('Reports.payment_type'), 'sortable' => false], ['comment' => lang('Reports.comments')] ], 'details' => [ diff --git a/app/Models/Reports/Specific_customer.php b/app/Models/Reports/Specific_customer.php index 55f9b7984..6e01622c1 100644 --- a/app/Models/Reports/Specific_customer.php +++ b/app/Models/Reports/Specific_customer.php @@ -25,7 +25,7 @@ class Specific_customer extends Report 'summary' => [ ['id' => lang('Reports.sale_id')], ['type_code' => lang('Reports.code_type')], - ['sale_time' => lang('Reports.date'), 'sortable' => FALSE], + ['sale_time' => lang('Reports.date'), 'sortable' => false], ['quantity' => lang('Reports.quantity')], ['employee_name' => lang('Reports.sold_by')], ['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'], @@ -33,7 +33,7 @@ class Specific_customer extends Report ['total' => lang('Reports.total'), 'sorter' => 'number_sorter'], ['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'], ['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'], - ['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE], + ['payment_type' => lang('Reports.payment_type'), 'sortable' => false], ['comment' => lang('Reports.comments')] ], 'details' => [ @@ -210,4 +210,4 @@ class Specific_customer extends Report return $builder->get()->getRowArray(); } -} \ No newline at end of file +} diff --git a/app/Models/Reports/Specific_discount.php b/app/Models/Reports/Specific_discount.php index 5eb2829ba..a371e3f6d 100644 --- a/app/Models/Reports/Specific_discount.php +++ b/app/Models/Reports/Specific_discount.php @@ -25,7 +25,7 @@ class Specific_discount extends Report 'summary' => [ ['id' => lang('Reports.sale_id')], ['type_code' => lang('Reports.code_type')], - ['sale_time' => lang('Reports.date'), 'sortable' => FALSE], + ['sale_time' => lang('Reports.date'), 'sortable' => false], ['quantity' => lang('Reports.quantity')], ['employee_name' => lang('Reports.sold_by')], ['customer_name' => lang('Reports.sold_to')], @@ -34,7 +34,7 @@ class Specific_discount extends Report ['total' => lang('Reports.total'), 'sorter' => 'number_sorter'], ['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'], ['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'], - ['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE], + ['payment_type' => lang('Reports.payment_type'), 'sortable' => false], ['comment' => lang('Reports.comments')] ], 'details' => [ @@ -197,4 +197,4 @@ class Specific_discount extends Report return $builder->get()->getRowArray(); } -} \ No newline at end of file +} diff --git a/app/Models/Reports/Specific_employee.php b/app/Models/Reports/Specific_employee.php index b0ee586ce..bd7e93a0a 100644 --- a/app/Models/Reports/Specific_employee.php +++ b/app/Models/Reports/Specific_employee.php @@ -25,7 +25,7 @@ class Specific_employee extends Report 'summary' => [ ['id' => lang('Reports.sale_id')], ['type_code' => lang('Reports.code_type')], - ['sale_time' => lang('Reports.date'), 'sortable' => FALSE], + ['sale_time' => lang('Reports.date'), 'sortable' => false], ['quantity' => lang('Reports.quantity')], ['customer_name' => lang('Reports.sold_to')], ['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'], @@ -33,7 +33,7 @@ class Specific_employee extends Report ['total' => lang('Reports.total'), 'sorter' => 'number_sorter'], ['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'], ['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'], - ['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE], + ['payment_type' => lang('Reports.payment_type'), 'sortable' => false], ['comment' => lang('Reports.comments')] ], 'details' => [ @@ -192,4 +192,4 @@ class Specific_employee extends Report return $builder->get()->getRowArray(); } -} \ No newline at end of file +} diff --git a/app/Models/Reports/Specific_supplier.php b/app/Models/Reports/Specific_supplier.php index b5681d9b3..782823664 100644 --- a/app/Models/Reports/Specific_supplier.php +++ b/app/Models/Reports/Specific_supplier.php @@ -24,7 +24,7 @@ class Specific_supplier extends Report return [ ['id' => lang('Reports.sale_id')], ['type_code' => lang('Reports.code_type')], - ['sale_time' => lang('Reports.date'), 'sortable' => FALSE], + ['sale_time' => lang('Reports.date'), 'sortable' => false], ['name' => lang('Reports.name')], ['category' => lang('Reports.category')], ['item_number' => lang('Reports.item_number')], @@ -158,4 +158,4 @@ class Specific_supplier extends Report return $builder->get()->getRowArray(); } -} \ No newline at end of file +} diff --git a/app/Models/Reports/Summary_payments.php b/app/Models/Reports/Summary_payments.php index 502fc675a..037c6e343 100644 --- a/app/Models/Reports/Summary_payments.php +++ b/app/Models/Reports/Summary_payments.php @@ -97,7 +97,7 @@ class Summary_payments extends Summary_report $gift_card_count = 0; $gift_card_amount = 0; foreach($payments as $key => $payment) { - if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== FALSE) { + if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== false) { $gift_card_count += $payment['trans_sales']; $gift_card_amount += $payment['trans_amount']; diff --git a/app/Models/Reports/Summary_sales.php b/app/Models/Reports/Summary_sales.php index 084e4dd2c..89379a68a 100644 --- a/app/Models/Reports/Summary_sales.php +++ b/app/Models/Reports/Summary_sales.php @@ -7,7 +7,7 @@ class Summary_sales extends Summary_report protected function _get_data_columns(): array { return [ - ['sale_date' => lang('Reports.date'), 'sortable' => FALSE], + ['sale_date' => lang('Reports.date'), 'sortable' => false], ['sales' => lang('Reports.sales'), 'sorter' => 'number_sorter'], ['quantity' => lang('Reports.quantity'), 'sorter' => 'number_sorter'], ['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'], @@ -34,4 +34,4 @@ class Summary_sales extends Summary_report $builder->groupBy('sale_date'); $builder->orderBy('sale_date'); } -} \ No newline at end of file +} diff --git a/app/Models/Reports/Summary_taxes.php b/app/Models/Reports/Summary_taxes.php index aff5cd58a..b4bbb7a6f 100644 --- a/app/Models/Reports/Summary_taxes.php +++ b/app/Models/Reports/Summary_taxes.php @@ -17,7 +17,7 @@ class Summary_taxes extends Summary_report protected function _get_data_columns(): array //TODO: hungarian notation { return [ - ['tax_name' => lang('Reports.tax_name'), 'sortable' => FALSE], + ['tax_name' => lang('Reports.tax_name'), 'sortable' => false], ['tax_percent' => lang('Reports.tax_percent'), 'sorter' => 'number_sorter'], ['report_count' => lang('Reports.sales'), 'sorter' => 'number_sorter'], ['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'], diff --git a/app/Models/Rewards.php b/app/Models/Rewards.php index 0afbee8ee..60cde306d 100644 --- a/app/Models/Rewards.php +++ b/app/Models/Rewards.php @@ -23,7 +23,7 @@ class Rewards extends Model //TODO: This class is named with plural while the ge /** * Inserts or updates a rewards */ - public function save_value(array &$rewards_data, bool $rewards_id = FALSE): bool + public function save_value(array &$rewards_data, bool $rewards_id = false): bool { $builder = $this->db->table('sales_reward_points'); if(!$rewards_id || !$this->exists($rewards_id)) //TODO: looks like we are missing the exists function in this class @@ -32,10 +32,10 @@ class Rewards extends Model //TODO: This class is named with plural while the ge { $rewards_data['id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('id', $rewards_id); diff --git a/app/Models/Sale.php b/app/Models/Sale.php index 59cd4b034..5733837e4 100644 --- a/app/Models/Sale.php +++ b/app/Models/Sale.php @@ -45,8 +45,8 @@ class Sale extends Model $this->create_temp_table (['sale_id' => $sale_id]); $decimals = totals_decimals(); - $sales_tax = 'IFNULL(SUM(sales_items_taxes.sales_tax), 0)'; - $cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)'; + $sales_tax = 'IFnull(SUM(sales_items_taxes.sales_tax), 0)'; + $cash_adjustment = 'IFnull(SUM(payments.sale_cash_adjustment), 0)'; $sale_price = 'CASE WHEN sales_items.discount_type = ' . PERCENT . " THEN sales_items.quantity_purchased * sales_items.item_unit_price - ROUND(sales_items.quantity_purchased * sales_items.item_unit_price * sales_items.discount / 100, $decimals) " . 'ELSE sales_items.quantity_purchased * (sales_items.item_unit_price - sales_items.discount) END'; @@ -74,11 +74,11 @@ class Sale extends Model MAX(customer_p.last_name) AS last_name, MAX(customer_p.email) AS email, MAX(customer_p.comments) AS comments, - MAX(IFNULL(payments.sale_cash_adjustment, 0)) AS cash_adjustment, - MAX(IFNULL(payments.sale_cash_refund, 0)) AS cash_refund, + MAX(IFnull(payments.sale_cash_adjustment, 0)) AS cash_adjustment, + MAX(IFnull(payments.sale_cash_refund, 0)) AS cash_refund, ' . " $sale_total AS amount_due, - MAX(IFNULL(payments.sale_payment_amount, 0)) AS amount_tendered, + MAX(IFnull(payments.sale_payment_amount, 0)) AS amount_tendered, (MAX(payments.sale_payment_amount)) - ($sale_total) AS change_due, " . ' MAX(payments.payment_type) AS payment_type'; @@ -107,20 +107,20 @@ class Sale extends Model */ public function get_found_rows(string $search, array $filters): int { - return $this->search($search, $filters, 0, 0, 'sales.sale_time', 'desc', TRUE); + return $this->search($search, $filters, 0, 0, 'sales.sale_time', 'desc', true); } /** * Get the sales data for the takings (sales/manage) view */ - public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'sales.sale_time', ?string $order = 'desc', ?bool $count_only = FALSE) + public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'sales.sale_time', ?string $order = 'desc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'sales.sale_time'; if($order == null) $order = 'desc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $config = config(OSPOS::class)->settings; @@ -161,10 +161,10 @@ class Sale extends Model $sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)'; - $tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)'; - $sales_tax = 'IFNULL(SUM(sales_items_taxes.sales_tax), 0)'; - $internal_tax = 'IFNULL(SUM(sales_items_taxes.internal_tax), 0)'; - $cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)'; + $tax = 'IFnull(SUM(sales_items_taxes.tax), 0)'; + $sales_tax = 'IFnull(SUM(sales_items_taxes.sales_tax), 0)'; + $internal_tax = 'IFnull(SUM(sales_items_taxes.internal_tax), 0)'; + $cash_adjustment = 'IFnull(SUM(payments.sale_cash_adjustment), 0)'; $sale_subtotal = "ROUND(SUM($sale_price), $decimals) - $internal_tax"; $sale_total = "ROUND(SUM($sale_price), $decimals) + $sales_tax + $cash_adjustment"; @@ -533,12 +533,12 @@ class Sale extends Model { $receipt_sale_id = 'POS ' . $sale_info->getRow()->sale_id; - return TRUE; + return true; } } } - return FALSE; + return false; } /** @@ -555,7 +555,7 @@ class Sale extends Model /** * Update sale */ - public function update($sale_id = NULL, $sale_data = NULL): bool + public function update($sale_id = null, $sale_data = null): bool { $builder = $this->db->table('sales'); $builder->where('sale_id', $sale_id); @@ -651,7 +651,7 @@ class Sale extends Model $sales_data = [ 'sale_time' => date('Y-m-d H:i:s'), - 'customer_id' => $customer->exists($customer_id) ? $customer_id : NULL, + 'customer_id' => $customer->exists($customer_id) ? $customer_id : null, 'employee_id' => $employee_id, 'comment' => $comment, 'sale_status' => $sale_status, @@ -800,12 +800,7 @@ class Sale extends Model $this->db->transComplete(); - if($this->db->transStatus() === FALSE) - { - return -1; //TODO: this should also be replaced with a FAIL or NO_PERSON constant or something similar instead of -1 - } - - return $sale_id; + return $this->db->transStatus() ? $sale_id : -1; } /** @@ -886,13 +881,13 @@ class Sale extends Model * Deletes list of sales * @throws ReflectionException */ - public function delete_list(array $sale_ids, int $employee_id, bool $update_inventory = TRUE): bool + public function delete_list(array $sale_ids, int $employee_id, bool $update_inventory = true): bool { - $result = TRUE; + $result = true; foreach($sale_ids as $sale_id) { - $result &= $this->delete($sale_id, FALSE, $update_inventory, $employee_id); + $result &= $this->delete($sale_id, false, $update_inventory, $employee_id); } return $result; @@ -901,14 +896,14 @@ class Sale extends Model /** * Restores list of sales */ - public function restore_list(array $sale_ids, int $employee_id, bool $update_inventory = TRUE): bool //TODO: $employee_id and $update_inventory are never used in the function. + public function restore_list(array $sale_ids, int $employee_id, bool $update_inventory = true): bool //TODO: $employee_id and $update_inventory are never used in the function. { foreach($sale_ids as $sale_id) { $this->update_sale_status($sale_id, SUSPENDED); } - return TRUE; + return true; } /** @@ -917,7 +912,7 @@ class Sale extends Model * However, if applicable the inventory still needs to be updated * @throws ReflectionException */ - public function delete($sale_id = NULL, bool $purge = FALSE, bool $update_inventory = TRUE, $employee_id = null): bool + public function delete($sale_id = null, bool $purge = false, bool $update_inventory = true, $employee_id = null): bool { // start a transaction to assure data integrity $this->db->transStart(); @@ -1196,11 +1191,11 @@ class Sale extends Model $sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)'; - $tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)'; - $sales_tax = 'IFNULL(SUM(sales_items_taxes.sales_tax), 0)'; - $internal_tax = 'IFNULL(SUM(sales_items_taxes.internal_tax), 0)'; + $tax = 'IFnull(SUM(sales_items_taxes.tax), 0)'; + $sales_tax = 'IFnull(SUM(sales_items_taxes.sales_tax), 0)'; + $internal_tax = 'IFnull(SUM(sales_items_taxes.internal_tax), 0)'; - $cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)'; + $cash_adjustment = 'IFnull(SUM(payments.sale_cash_adjustment), 0)'; if($config['tax_included']) { @@ -1323,7 +1318,7 @@ class Sale extends Model /** * Retrieves all sales that are in a suspended state */ - public function get_all_suspended(int $customer_id = NULL): array + public function get_all_suspended(int $customer_id = null): array { if($customer_id == NEW_ENTRY) { @@ -1342,11 +1337,11 @@ class Sale extends Model /** * Gets the dinner table for the selected sale */ - public function get_dinner_table(int $sale_id) //TODO: this is returning NULL or the table_id. We can keep it this way but multiple return types can't be declared until PHP 8.x + public function get_dinner_table(int $sale_id) //TODO: this is returning null or the table_id. We can keep it this way but multiple return types can't be declared until PHP 8.x { if($sale_id == NEW_ENTRY) { - return NULL; + return null; } $builder = $this->db->table('sales'); @@ -1395,12 +1390,12 @@ class Sale extends Model $row = $builder->get()->getRow(); - if($row != NULL) + if($row != null) { return $row->quote_number; } - return NULL; + return null; } /** @@ -1413,12 +1408,12 @@ class Sale extends Model $row = $builder->get()->getRow(); - if($row != NULL) //TODO: === ? + if($row != null) //TODO: === ? { return $row->work_order_number; } - return NULL; + return null; } /** @@ -1431,12 +1426,12 @@ class Sale extends Model $row = $builder->get()->getRow(); - if($row != NULL) //TODO: === ? + if($row != null) //TODO: === ? { return $row->comment; } - return NULL; + return null; } /** @@ -1543,8 +1538,8 @@ class Sale extends Model { $points_percent = $customer_rewards->get_points_percent($package_id); $points = $customer->get_info($customer_id)->points; - $points = ($points == NULL ? 0 : $points); - $points_percent = ($points_percent == NULL ? 0 : $points_percent); + $points = ($points == null ? 0 : $points); + $points_percent = ($points_percent == null ? 0 : $points_percent); $total_amount_earned = ($total_amount * $points_percent / 100); $points = $points + $total_amount_earned; diff --git a/app/Models/Stock_location.php b/app/Models/Stock_location.php index 666fdea4f..efb2987a7 100644 --- a/app/Models/Stock_location.php +++ b/app/Models/Stock_location.php @@ -218,7 +218,7 @@ class Stock_location extends Model * @param bool $purge * @return bool */ - public function delete($location_id = null, bool $purge = FALSE): bool + public function delete($location_id = null, bool $purge = false): bool { $this->db->transStart(); diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index d88c9b1a5..95d7386d1 100644 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -112,7 +112,7 @@ class Supplier extends Person */ public function save_supplier(array &$person_data, array &$supplier_data, int $supplier_id = NEW_ENTRY): bool { - $success = FALSE; + $success = false; //Run these queries as a transaction, we want to make sure we do all or nothing $this->db->transStart(); @@ -164,7 +164,7 @@ class Supplier extends Person /** * Get search suggestions to find suppliers */ - public function get_search_suggestions(string $search, int $limit = 25, bool $unique = FALSE): array //TODO: Parent is looking for the 2nd parameter to be an int + public function get_search_suggestions(string $search, int $limit = 25, bool $unique = false): array //TODO: Parent is looking for the 2nd parameter to be an int { $suggestions = []; @@ -257,7 +257,7 @@ class Supplier extends Person */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'last_name', 'asc', TRUE); + return $this->search($search, 0, 0, 'last_name', 'asc', true); } /** diff --git a/app/Models/Tax.php b/app/Models/Tax.php index 012dd32ef..1fb2d310d 100644 --- a/app/Models/Tax.php +++ b/app/Models/Tax.php @@ -90,15 +90,15 @@ class Tax extends Model { //Get empty base parent object $tax_rate_obj = new stdClass(); - $tax_rate_obj->tax_rate_id = NULL; - $tax_rate_obj->rate_tax_code_id = NULL; + $tax_rate_obj->tax_rate_id = null; + $tax_rate_obj->rate_tax_code_id = null; $tax_rate_obj->tax_code = ''; $tax_rate_obj->tax_code_name = ''; - $tax_rate_obj->rate_tax_category_id = NULL; + $tax_rate_obj->rate_tax_category_id = null; $tax_rate_obj->tax_category = ''; $tax_rate_obj->tax_rate = 0.0; $tax_rate_obj->tax_rounding_code = '0'; - $tax_rate_obj->rate_jurisdiction_id = NULL; + $tax_rate_obj->rate_jurisdiction_id = null; $tax_rate_obj->jurisdiction_name = ''; return $tax_rate_obj; @@ -172,7 +172,7 @@ class Tax extends Model { $tax_rate_data['tax_rate_id'] = $this->db->insertID(); - return TRUE; + return true; } } else @@ -181,11 +181,11 @@ class Tax extends Model if($builder->update($tax_rate_data)) { - return TRUE; + return true; } } - return FALSE; + return false; } /** @@ -214,20 +214,20 @@ class Tax extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE); + return $this->search($search, 0, 0, 'tax_code_name', 'asc', true); } /** * Performs a search on tax_rates */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'tax_code_name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('tax_rates'); diff --git a/app/Models/Tax_category.php b/app/Models/Tax_category.php index f628b3d89..2c6af6ecc 100644 --- a/app/Models/Tax_category.php +++ b/app/Models/Tax_category.php @@ -75,7 +75,7 @@ class Tax_category extends Model /** * Returns all rows from the table *///TODO: I think we should work toward having all these get_all functions with the same signature. It makes it easier to use them. This signature is different from the others. - public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = TRUE): ResultInterface //TODO: $no_deleted needs a new name. $not_deleted is the correct grammar, but it's a bit confusing by naming the variable a negative. Probably better to name it is_deleted and flip the logic + public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = true): ResultInterface //TODO: $no_deleted needs a new name. $not_deleted is the correct grammar, but it's a bit confusing by naming the variable a negative. Probably better to name it is_deleted and flip the logic { $builder = $this->db->table('tax_categories'); if($no_deleted) @@ -119,10 +119,10 @@ class Tax_category extends Model { $tax_category_data['tax_category_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('tax_category_id', $tax_category_id); @@ -202,20 +202,20 @@ class Tax_category extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'tax_category', 'asc', TRUE); + return $this->search($search, 0, 0, 'tax_category', 'asc', true); } /** * Perform a search for a set of rows */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_category', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_category', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'tax_category'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('tax_categories AS tax_categories'); diff --git a/app/Models/Tax_code.php b/app/Models/Tax_code.php index 43a679833..95929d660 100644 --- a/app/Models/Tax_code.php +++ b/app/Models/Tax_code.php @@ -122,9 +122,9 @@ class Tax_code extends Model { if($builder->insert($tax_code_data)) //TODO: this should be refactored to return $builder->insert($tax_code_data); in the same way that $builder->update() below is the return. Look for this in the other save functions as well. { - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('tax_code', $tax_code_data['tax_code']); @@ -197,20 +197,20 @@ class Tax_code extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE); + return $this->search($search, 0, 0, 'tax_code_name', 'asc', true); } /** * Perform a search for a set of rows */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'tax_code_name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('tax_codes AS tax_codes'); diff --git a/app/Models/Tax_jurisdiction.php b/app/Models/Tax_jurisdiction.php index 94951b6fc..96902fa5c 100644 --- a/app/Models/Tax_jurisdiction.php +++ b/app/Models/Tax_jurisdiction.php @@ -79,7 +79,7 @@ class Tax_jurisdiction extends Model /** * Returns all rows from the table */ - public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = TRUE): ResultInterface + public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = true): ResultInterface { $builder = $this->db->table('tax_jurisdictions'); @@ -121,10 +121,10 @@ class Tax_jurisdiction extends Model if($builder->insert($jurisdiction_data)) //TODO: Replace this with simply a return of the result of insert()... see update() below. { $jurisdiction_data['jurisdiction_id'] = $this->db->insertID(); - return TRUE; + return true; } - return FALSE; + return false; } $builder->where('jurisdiction_id', $jurisdiction_id); @@ -207,20 +207,20 @@ class Tax_jurisdiction extends Model */ public function get_found_rows(string $search): int { - return $this->search($search, 0, 0, 'jurisdiction_name', 'asc', TRUE); + return $this->search($search, 0, 0, 'jurisdiction_name', 'asc', true); } /** * Perform a search for a set of rows */ - public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'jurisdiction_name', ?string $order = 'asc', ?bool $count_only = FALSE) + public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'jurisdiction_name', ?string $order = 'asc', ?bool $count_only = false) { // Set default values if($rows == null) $rows = 0; if($limit_from == null) $limit_from = 0; if($sort == null) $sort = 'jurisdiction_name'; if($order == null) $order = 'asc'; - if($count_only == null) $count_only = FALSE; + if($count_only == null) $count_only = false; $builder = $this->db->table('tax_jurisdictions AS tax_jurisdictions'); diff --git a/app/Models/Tokens/Token_invoice_sequence.php b/app/Models/Tokens/Token_invoice_sequence.php index 22c096bce..0cfb79f9c 100644 --- a/app/Models/Tokens/Token_invoice_sequence.php +++ b/app/Models/Tokens/Token_invoice_sequence.php @@ -27,7 +27,7 @@ class Token_invoice_sequence extends Token /** * @throws ReflectionException */ - public function get_value(bool $save = TRUE): string + public function get_value(bool $save = true): string { return $this->appconfig->acquire_next_invoice_sequence($save); } diff --git a/app/Models/Tokens/Token_quote_sequence.php b/app/Models/Tokens/Token_quote_sequence.php index b45ab29c0..efce8b92f 100644 --- a/app/Models/Tokens/Token_quote_sequence.php +++ b/app/Models/Tokens/Token_quote_sequence.php @@ -27,7 +27,7 @@ class Token_quote_sequence extends Token /** * @throws ReflectionException */ - public function get_value(bool $save = TRUE): string + public function get_value(bool $save = true): string { return $this->appconfig->acquire_next_quote_sequence($save); } diff --git a/app/Models/Tokens/Token_work_order_sequence.php b/app/Models/Tokens/Token_work_order_sequence.php index 5a48af15e..bc63ca685 100644 --- a/app/Models/Tokens/Token_work_order_sequence.php +++ b/app/Models/Tokens/Token_work_order_sequence.php @@ -26,7 +26,7 @@ class Token_work_order_sequence extends Token /** * @throws ReflectionException */ - public function get_value(bool $save = TRUE): string + public function get_value(bool $save = true): string { return $this->appconfig->acquire_next_work_order_sequence($save); } diff --git a/app/Views/attributes/form.php b/app/Views/attributes/form.php index b14f5fa77..25976db8e 100644 --- a/app/Views/attributes/form.php +++ b/app/Views/attributes/form.php @@ -9,17 +9,17 @@ * @var array $definition_values */ ?> -
+
- 'attribute_form', 'class' => 'form-horizontal'])?> + 'attribute_form', 'class' => 'form-horizontal'])?>
- 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
- 'definition_name', 'id' => 'definition_name', 'class' => 'form-control input-sm', @@ -30,16 +30,16 @@
- 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
- definition_type, DEFINITION_TYPES), 'id="definition_type" class="form-control"') ?> + definition_type, DEFINITION_TYPES), 'id="definition_type" class="form-control"') ?>
- 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
- definition_fk, @@ -49,10 +49,10 @@
- + -false, 'selected_printer' => 'takings_printer']) ?> +false, 'selected_printer' => 'takings_printer']) ?>
- + diff --git a/app/Views/configs/barcode_config.php b/app/Views/configs/barcode_config.php index 9ff2db5e4..92eee2099 100644 --- a/app/Views/configs/barcode_config.php +++ b/app/Views/configs/barcode_config.php @@ -1,18 +1,20 @@ - 'barcode_config_form', 'class' => 'form-horizontal']) ?> + 'barcode_config_form', 'class' => 'form-horizontal']) ?>
-
+
    - 'control-label col-xs-2']) ?> + 'control-label col-xs-2']) ?>
    -
    - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
    - '5', 'max' => '350', 'min' => '60', @@ -38,9 +40,9 @@
    - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
    - 'number', 'min' => 10, 'max' => 120, @@ -53,9 +55,9 @@
    - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
    -
    - 'number', 'min' => '1', 'max' => '30', @@ -76,9 +78,9 @@
    - 'control-label col-xs-2']) ?> + 'control-label col-xs-2']) ?>
    - 'allow_duplicate_barcodes', 'id' => 'allow_duplicate_barcodes', 'value' => 'allow_duplicate_barcodes', @@ -86,45 +88,45 @@ ]) ?>  
    - 'control-label col-xs-2']) ?> + 'control-label col-xs-2']) ?>
       
    - 'control-label col-xs-2']) ?> + 'control-label col-xs-2']) ?>
    - 'control-label col-xs-2']) ?> + 'control-label col-xs-2']) ?>
    - +
    - lang('Config.none'), 'name' => lang('Items.name'), @@ -156,9 +158,9 @@ $config['barcode_first_row'], ['class' => 'form-control input-sm']); ?>
    - +
    - lang('Config.none'), 'name' => lang('Items.name'), 'category' => lang('Items.category'), @@ -169,9 +171,9 @@ ], $config['barcode_second_row'], ['class' => 'form-control input-sm']) ?>
    - +
    - lang('Config.none'), 'name' => lang('Items.name'), 'category' => lang('Items.category'), @@ -187,9 +189,9 @@
    - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
    - 'barcode_num_in_row', 'id' => 'barcode_num_in_row', 'class' => 'form-control input-sm required', @@ -199,10 +201,10 @@
    - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
    - 'barcode_page_width', 'id' => 'barcode_page_width', 'class' => 'form-control input-sm required', @@ -214,10 +216,10 @@
    - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
    - 'barcode_page_cellspacing', 'id' => 'barcode_page_cellspacing', 'class' => 'form-control input-sm required', @@ -228,14 +230,14 @@
    - 'submit_barcode', 'id' => 'submit_barcode', 'value' => lang('Common.submit'), 'class' => 'btn btn-primary btn-sm pull-right']) ?>
    - +
    diff --git a/app/Views/configs/table_config.php b/app/Views/configs/table_config.php index c3a864ae2..96295fae0 100644 --- a/app/Views/configs/table_config.php +++ b/app/Views/configs/table_config.php @@ -1,18 +1,19 @@ - 'table_config_form', 'class' => 'form-horizontal']) ?> + 'table_config_form', 'class' => 'form-horizontal']) ?>
    -
    +
    -
    - 'control-label col-xs-2']) ?> +
    + 'control-label col-xs-2']) ?>
    - 'dinner_table_enable', 'value' => 'dinner_table_enable', 'id' => 'dinner_table_enable', @@ -22,10 +23,10 @@
    - $dinner_tables]) ?> + $dinner_tables]) ?>
    - - 'submit_table', 'id' => 'submit_table', 'value' => lang('Common.submit'), @@ -33,7 +34,7 @@ ]) ?>
    - + - false, 'selected_printer' => 'takings_printer']) ?> + false, 'selected_printer' => 'takings_printer']) ?>
    @@ -77,4 +78,4 @@ $(document).ready(function()
    - + diff --git a/app/Views/expenses_categories/form.php b/app/Views/expenses_categories/form.php index 361a2020e..4b6a198b7 100644 --- a/app/Views/expenses_categories/form.php +++ b/app/Views/expenses_categories/form.php @@ -4,16 +4,16 @@ * @var string $controller_name */ ?> -
    +
    -expense_category_id", ['id' => 'expense_category_edit_form', 'class' => 'form-horizontal']) ?> +expense_category_id", ['id' => 'expense_category_edit_form', 'class' => 'form-horizontal']) ?>
    - 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
    - 'category_name', 'id' => 'category_name', 'class' => 'form-control input-sm', @@ -23,9 +23,9 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'category_description', 'id' => 'category_description', 'class' => 'form-control input-sm', @@ -35,7 +35,7 @@
    - +
    -
    @@ -46,4 +47,4 @@ $(document).ready(function()
    - + diff --git a/app/Views/giftcards/form.php b/app/Views/giftcards/form.php index 6a8322b87..e2abee5f0 100644 --- a/app/Views/giftcards/form.php +++ b/app/Views/giftcards/form.php @@ -6,28 +6,29 @@ * @var string $giftcard_number * @var float $giftcard_value * @var string $controller_name + * @var array $config */ ?> -
    +
    - 'giftcard_form', 'class' => 'form-horizontal']) ?> + 'giftcard_form', 'class' => 'form-horizontal']) ?>
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'person_name', 'id' => 'person_name', 'class' => 'form-control input-sm', 'value' => esc($selected_person_name) ]) ?> - +
    -
    - "control-label col-xs-3$class"]) ?> + "control-label col-xs-3$class"]) ?>
    - 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
    - + - 'giftcard_amount', 'id' => 'giftcard_amount', 'class' => 'form-control input-sm', 'value'=>to_currency_no_money($giftcard_value) ]) ?> - +
    - +
    -
    @@ -37,4 +38,4 @@ $(document).ready(function()
    - + diff --git a/app/Views/home/form_change_password.php b/app/Views/home/form_change_password.php index 516f63778..4352f3414 100644 --- a/app/Views/home/form_change_password.php +++ b/app/Views/home/form_change_password.php @@ -3,20 +3,20 @@ * @var object $person_info */ ?> -
    +
    -person_id", ['id' => 'employee_form', 'class' => 'form-horizontal']) ?> +person_id", ['id' => 'employee_form', 'class' => 'form-horizontal']) ?>
    - 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
    - 'username', 'id' => 'username', 'class' => 'form-control input-sm', @@ -30,11 +30,11 @@ person_id == "" ? ['class' => 'required'] : []; ?>
    - 'control-label col-xs-3'])) ?> + 'control-label col-xs-3'])) ?>
    - 'current_password', 'id' => 'current_password', 'class' => 'form-control input-sm' @@ -44,11 +44,11 @@
    - 'control-label col-xs-3'])) ?> + 'control-label col-xs-3'])) ?>
    - 'password', 'id' => 'password', 'class' => 'form-control input-sm' @@ -58,11 +58,11 @@
    - 'control-label col-xs-3'])) ?> + 'control-label col-xs-3'])) ?>
    - 'repeat_password', 'id' => 'repeat_password', 'class' => 'form-control input-sm' @@ -73,7 +73,7 @@
    - +
    -
    -
    @@ -52,4 +53,4 @@ $(document).ready(function()
    - + diff --git a/app/Views/items/form.php b/app/Views/items/form.php index 860a2a66c..1132194b3 100644 --- a/app/Views/items/form.php +++ b/app/Views/items/form.php @@ -126,7 +126,7 @@ if($standard_item_locked) { - $radio_button['disabled'] = TRUE; + $radio_button['disabled'] = true; } echo form_radio($radio_button) ?> @@ -142,7 +142,7 @@ if($item_kit_disabled) { - $radio_button['disabled'] = TRUE; + $radio_button['disabled'] = true; } echo form_radio($radio_button) ?> diff --git a/app/Views/items/form_bulk.php b/app/Views/items/form_bulk.php index 5d77472f5..734d388d4 100644 --- a/app/Views/items/form_bulk.php +++ b/app/Views/items/form_bulk.php @@ -4,18 +4,19 @@ * @var array $allow_alt_description_choices * @var array $serialization_choices * @var string $controller_name + * @var array $config */ ?> -
    +
    - 'item_form', 'class' => 'form-horizontal']) ?> + 'item_form', 'class' => 'form-horizontal']) ?>
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'name', 'id' => 'name', 'class' => 'form-control input-sm' @@ -24,11 +25,11 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'category', 'id' => 'category', 'class' => 'form-control input-sm' @@ -38,54 +39,54 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'form-control']) ?> + 'form-control']) ?>
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - + - 'cost_price', 'id' => 'cost_price', 'class' => 'form-control input-sm' ]) ?> - +
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - + - 'unit_price', 'id' => 'unit_price', 'class' => 'form-control input-sm' ]) ?> - +
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'tax_names[]', 'id' => 'tax_name_1', 'class' => 'form-control input-sm', @@ -94,7 +95,7 @@
    - 'tax_percents[]', 'id' => 'tax_percent_name_1', 'class' => 'form-control input-sm', @@ -106,9 +107,9 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'tax_names[]', 'id' => 'tax_name_2', 'class' => 'form-control input-sm', @@ -117,7 +118,7 @@
    - 'tax_percents[]', 'id' => 'tax_percent_name_2', 'class' => 'form-control input-sm', @@ -129,9 +130,9 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'reorder_level', 'id' => 'reorder_level', 'class' => 'form-control input-sm' @@ -140,9 +141,9 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'description', 'id' => 'description', 'class' => 'form-control input-sm' @@ -151,27 +152,27 @@
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'form-control']) ?> + 'form-control']) ?>
    - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
    - 'form-control']) ?> + 'form-control']) ?>
    - + diff --git a/app/Views/items/manage.php b/app/Views/items/manage.php index 5aaa40602..63cc47da8 100644 --- a/app/Views/items/manage.php +++ b/app/Views/items/manage.php @@ -5,12 +5,13 @@ * @var array $filters * @var array $stock_locations * @var int $stock_location + * @var array $config */ use App\Models\Employee; ?> - +
    - + diff --git a/app/Views/messages/form_sms.php b/app/Views/messages/form_sms.php index 09b5df623..d68b2dd73 100644 --- a/app/Views/messages/form_sms.php +++ b/app/Views/messages/form_sms.php @@ -2,43 +2,44 @@ /** * @var object $person_info * @var string $controller_name + * @var array $config */ ?> -
    +
      - -person_id"), ['id' => 'send_sms_form', 'class' => 'form-horizontal']) ?> + +person_id"), ['id' => 'send_sms_form', 'class' => 'form-horizontal']) ?>
      - 'first_name', 'class' => 'control-label col-xs-2']) ?> + 'first_name', 'class' => 'control-label col-xs-2']) ?>
      - 'form-control input-sm', 'type' => 'text', 'name' => 'first_name', 'value' => esc($person_info->first_name), 'readonly' => 'true']) ?> + 'form-control input-sm', 'type' => 'text', 'name' => 'first_name', 'value' => esc($person_info->first_name), 'readonly' => 'true']) ?>
      - 'last_name', 'class' => 'control-label col-xs-2']) ?> + 'last_name', 'class' => 'control-label col-xs-2']) ?>
      - 'form-control input-sm', 'type' => 'text', 'name' => 'last_name', 'value' => esc($person_info->last_name), 'readonly' => 'true']) ?> + 'form-control input-sm', 'type' => 'text', 'name' => 'last_name', 'value' => esc($person_info->last_name), 'readonly' => 'true']) ?>
      -
      +
      - 'phone', 'class' => 'control-label col-xs-2 required']) ?> + 'phone', 'class' => 'control-label col-xs-2 required']) ?>
      - 'form-control input-sm required', 'type' => 'text', 'name' => 'phone', 'value' => esc($person_info->phone_number)]) ?> + 'form-control input-sm required', 'type' => 'text', 'name' => 'phone', 'value' => esc($person_info->phone_number)]) ?>
      - 'message', 'class' => 'control-label col-xs-2 required']) ?> + 'message', 'class' => 'control-label col-xs-2 required']) ?>
      - 'form-control input-sm required', 'name' => 'message', 'id' => 'message', 'value' => esc($config['msg_msg'])]) ?> + 'form-control input-sm required', 'name' => 'message', 'id' => 'message', 'value' => esc($config['msg_msg'])]) ?>
      - +
      - 'send_sms_form', 'enctype' => 'multipart/form-data', 'method' => 'post', 'class' => 'form-horizontal']) ?> + 'send_sms_form', 'enctype' => 'multipart/form-data', 'method' => 'post', 'class' => 'form-horizontal']) ?>
      - +
      - +
      - - + +
      - +
      - +
      - 'submit_form', 'id' => 'submit_form', 'value' => lang('Common.submit'), 'class' => 'btn btn-primary btn-sm pull-right']) ?>
      - +
      - + \ No newline at end of file + diff --git a/app/Views/partial/print_receipt.php b/app/Views/partial/print_receipt.php index 545acd66b..1f49e9cb8 100644 --- a/app/Views/partial/print_receipt.php +++ b/app/Views/partial/print_receipt.php @@ -2,6 +2,7 @@ /** * @var string $selected_printer * @var bool $print_after_sale + * @var array $config */ ?> diff --git a/app/Views/people/manage.php b/app/Views/people/manage.php index 12ce85883..036791cf8 100644 --- a/app/Views/people/manage.php +++ b/app/Views/people/manage.php @@ -2,19 +2,20 @@ /** * @var string $controller_name * @var string $table_headers + * @var array $config */ ?> - + - + diff --git a/app/Views/reports/date_input.php b/app/Views/reports/date_input.php index ff6d13836..6a5792a0d 100644 --- a/app/Views/reports/date_input.php +++ b/app/Views/reports/date_input.php @@ -1,16 +1,17 @@ - + -
      +
      - 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?> + 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
      - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
      - 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?> + 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
      - @@ -36,18 +37,18 @@ if(isset($error)) if($mode == 'sale') { ?> - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - 'input_type', 'class' => 'form-control']) ?> + 'input_type', 'class' => 'form-control']) ?>
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - lang('Reports.all'), @@ -66,28 +67,28 @@ if(isset($error)) } ?> -
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - 'discount_type_id', 'class' => 'form-control']) ?> + 'discount_type_id', 'class' => 'form-control']) ?>
      - 2) { ?>
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - 'location_id', 'class' => 'form-control']) ?> + 'location_id', 'class' => 'form-control']) ?>
      lang('Common.submit'), 'class' => 'btn btn-primary btn-sm'] ); ?> - + - + -
      +
      -
      +
      - +
      $value) { ?> -
      +
      - \ No newline at end of file + diff --git a/app/Views/reports/graphs/bar.php b/app/Views/reports/graphs/bar.php index 6be2ce9a7..29e183ae4 100644 --- a/app/Views/reports/graphs/bar.php +++ b/app/Views/reports/graphs/bar.php @@ -5,15 +5,16 @@ * @var array $series_data_1 * @var bool $show_currency * @var string $xaxis_title + * @var array $config */ ?> -
      +
      - 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?> + 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      @@ -43,9 +43,9 @@ if(isset($error)) 'content' => lang('Common.submit'), 'class' => 'btn btn-primary btn-sm' ]) ?> - + - + -
      +
      - 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?> + 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
      - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
      - 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?> + 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      @@ -58,14 +58,14 @@ if(isset($error)) 'content' => lang('Common.submit'), 'class' => 'btn btn-primary btn-sm' ]); ?> - + - + -
      +
      - 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?> + 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
      - 'control-label col-xs-2 required']) ?> + 'control-label col-xs-2 required']) ?>
      - 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?> + 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
      -
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - 'discount_type_id', 'class' => 'form-control']) ?> + 'discount_type_id', 'class' => 'form-control']) ?>
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      -
      - 'discount_fixed', 'id' => 'discount_fixed', 'class' => 'form-control input-sm required', @@ -68,27 +69,27 @@ if(isset($error))
      - 'required control-label col-xs-2']) ?> + 'required control-label col-xs-2']) ?>
      - +
      - 'generate_report', 'id' => 'generate_report', 'content'=>lang('Common.submit'), 'class' => 'btn btn-primary btn-sm' ]) ?> - + - + -
      +
      -
      +
      @@ -28,13 +29,13 @@ if($name == "total_quantity") { ?> -
      +
      -
      +
      $(document).ready(function() { - + $('#table') .addClass("table-striped") .addClass("table-bordered") .bootstrapTable({ - columns: , + columns: , stickyHeader: true, stickyHeaderOffsetLeft: $('#table').offset().left + 'px', stickyHeaderOffsetRight: $('#table').offset().right + 'px', - pageSize: , + pageSize: , sortable: true, showExport: true, exportDataType: 'all', exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'], pagination: true, showColumns: true, - data: , + data: , iconSize: 'sm', paginationVAlign: 'bottom', escape: false, @@ -72,4 +73,4 @@ }); - + diff --git a/app/Views/reports/tabular_details.php b/app/Views/reports/tabular_details.php index b8e7cb4e4..c055e7f00 100644 --- a/app/Views/reports/tabular_details.php +++ b/app/Views/reports/tabular_details.php @@ -6,13 +6,14 @@ * @var array $details_data * @var array $headers * @var array $summary_data + * @var array $config */ ?> - + -
      +
      -
      +
      @@ -23,7 +24,7 @@ foreach($overall_summary_data as $name => $value) { ?> -
      +
      @@ -32,14 +33,14 @@ - + diff --git a/app/Views/sales/form.php b/app/Views/sales/form.php index 9a255ef47..ebf2cebed 100644 --- a/app/Views/sales/form.php +++ b/app/Views/sales/form.php @@ -13,38 +13,39 @@ * @var string $selected_employee_name * @var int $selected_employee_id * @var string $controller_name + * @var array $config */ ?> -
      +
        - 'sales_edit_form', 'class' => 'form-horizontal']) ?> + 'sales_edit_form', 'class' => 'form-horizontal']) ?>
        - 'control-label col-xs-3']) ?> - '_blank', 'class' => 'control-label col-xs-8', "style"=>"text-align:left"]) ?> + 'control-label col-xs-3']) ?> + '_blank', 'class' => 'control-label col-xs-8', "style"=>"text-align:left"]) ?>
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - 'date','value' => to_datetime(strtotime($sale_info['sale_time'])), 'class' => 'datetime form-control input-sm']) ?> + 'date','value' => to_datetime(strtotime($sale_info['sale_time'])), 'class' => 'datetime form-control input-sm']) ?>
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - 'invoice_number', 'size'=>10, 'value' => esc($sale_info['invoice_number']), 'id' => 'invoice_number', 'class' => 'form-control input-sm']) ?> - + 'invoice_number', 'size'=>10, 'value' => esc($sale_info['invoice_number']), 'id' => 'invoice_number', 'class' => 'form-control input-sm']) ?> + - 'invoice_number', 'value' => esc($sale_info['invoice_number']), 'id' => 'invoice_number', 'class' => 'form-control input-sm']) ?> + 'invoice_number', 'value' => esc($sale_info['invoice_number']), 'id' => 'invoice_number', 'class' => 'form-control input-sm']) ?>
        @@ -57,18 +58,18 @@ { ?>
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - 'payment_types_new', 'class' => 'form-control']) ?> + 'payment_types_new', 'class' => 'form-control']) ?>
        - + - 'payment_amount_new', 'value' => $payment_amount_new, 'id' => 'payment_amount_new', 'class' => 'form-control input-sm']) //TODO: potentially we need to add type to be float/decimal/numeric to reduce improper data entry ?> + 'payment_amount_new', 'value' => $payment_amount_new, 'id' => 'payment_amount_new', 'class' => 'form-control input-sm']) //TODO: potentially we need to add type to be float/decimal/numeric to reduce improper data entry ?> - +
        @@ -83,47 +84,47 @@ { ?>
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - payment_id) ?> + payment_id) ?> payment_type, lang('Sales.giftcard'))) ): ?> - "payment_type_$i", 'value' => esc($row->payment_type), 'id' => "payment_type_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> + "payment_type_$i", 'value' => esc($row->payment_type), 'id' => "payment_type_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> - payment_type), ['id' => "payment_types_$i", 'class' => 'form-control']) ?> + payment_type), ['id' => "payment_types_$i", 'class' => 'form-control']) ?>
        - + - "payment_amount_$i", 'value' => $row->payment_amount, 'id' => "payment_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) //TODO: add type attribute ?> + "payment_amount_$i", 'value' => $row->payment_amount, 'id' => "payment_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) //TODO: add type attribute ?> - +
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        payment_type, lang('Sales.giftcard')))): ?> - "refund_type_$i", 'value'=>lang('Sales.cash'), 'id' => "refund_type_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> + "refund_type_$i", 'value'=>lang('Sales.cash'), 'id' => "refund_type_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> - "refund_types_$i", 'class' => 'form-control']) ?> + "refund_types_$i", 'class' => 'form-control']) ?>
        - + - "refund_amount_$i", 'value' => $row->cash_refund, 'id' => "refund_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> + "refund_amount_$i", 'value' => $row->cash_refund, 'id' => "refund_amount_$i", 'class' => 'form-control input-sm', 'readonly' => 'true']) ?> - +
        @@ -135,37 +136,37 @@ ?>
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - 'customer_name', 'value' => esc($selected_customer_name), 'id' => 'customer_name', 'class' => 'form-control input-sm']) ?> - + 'customer_name', 'value' => esc($selected_customer_name), 'id' => 'customer_name', 'class' => 'form-control input-sm']) ?> +
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - 'employee_name', 'value' => esc($selected_employee_name), 'id' => 'employee_name', 'class' => 'form-control input-sm']) ?> - + 'employee_name', 'value' => esc($selected_employee_name), 'id' => 'employee_name', 'class' => 'form-control input-sm']) ?> +
        - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
        - 'comment', 'value' => esc($sale_info['comment']), 'id' => 'comment', 'class' => 'form-control input-sm']) ?> + 'comment', 'value' => esc($sale_info['comment']), 'id' => 'comment', 'class' => 'form-control input-sm']) ?>
        - + - $print_after_sale, 'selected_printer' => 'invoice_printer']) ?> + $print_after_sale, 'selected_printer' => 'invoice_printer']) ?>
        - +
        -
        +
        @@ -82,7 +83,7 @@ $(document).ready(function() if($config['company_logo'] != '') { ?> - company_logo + company_logo @@ -91,7 +92,7 @@ $(document).ready(function() if($config['receipt_show_company_name']) { ?> -
        +
        @@ -99,50 +100,50 @@ $(document).ready(function()
        -
        +
        - - + + - - + + - - + +
        - + - + - - - - + + + + 0) { $invoice_columns += 1; ?> - + - + - + - + - - - - + + + + 0): ?> - + - + - - + + - + - - - + + + - - - + + + - - - + + + $payment) { $only_sale_check |= $payment['payment_type'] == lang('Sales.check'); @@ -218,9 +219,9 @@ $(document).ready(function() $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - - + + + - - - + + + - - - + + +
        - - - + + +
        -
        +
        - <?php echo esc($barcode) ?>
        - + <?= esc($barcode) ?>
        +
        @@ -296,4 +297,4 @@ $(window).on("load", function() }); - + diff --git a/app/Views/sales/invoice_email.php b/app/Views/sales/invoice_email.php index 76384f8ff..7504fe84b 100644 --- a/app/Views/sales/invoice_email.php +++ b/app/Views/sales/invoice_email.php @@ -15,14 +15,15 @@ * @var float $amount_change * @var string $barcode * @var int $sale_id + * @var array $config */ ?> - + - - <?php echo lang('Sales.email_receipt') ?> + + <?= lang('Sales.email_receipt') ?> @@ -36,14 +37,14 @@ if(isset($error_message)) ?>
        - +
        = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?> = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>
        -
        - +
        +
        - - + + - - + + 0) { ?> - - + + - - - - - + + + + + 0) { $invoice_columns = $invoice_columns + 1; ?> - + - + - - - - - + + + + + 0): ?> - + - + - + - - - + + + - - - + + + - - - + + + $payment) { @@ -163,9 +164,9 @@ if(isset($error_message)) $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - - + + + - - - + + + - - - + + +
        - - + +
        - +
        - <?php echo esc($barcode) ?>
        - + <?= esc($barcode) ?>
        +
        diff --git a/app/Views/sales/manage.php b/app/Views/sales/manage.php index 228267366..59724bc9c 100644 --- a/app/Views/sales/manage.php +++ b/app/Views/sales/manage.php @@ -3,9 +3,10 @@ * @var string $controller_name * @var string $table_headers * @var array $filters + * @var array $config */ ?> - + -false, 'selected_printer' => 'takings_printer']) ?> +false, 'selected_printer' => 'takings_printer']) ?>
        @@ -84,4 +85,4 @@ $(document).ready(function()
        - + diff --git a/app/Views/sales/quote.php b/app/Views/sales/quote.php index 165f2efe0..41c40ea97 100644 --- a/app/Views/sales/quote.php +++ b/app/Views/sales/quote.php @@ -12,9 +12,10 @@ * @var float $subtotal * @var array $taxes * @var array $payments + * @var array $config */ ?> - +', + $.get('', function(response) { $.notify( { message: response.message }, { type: response.success ? 'success' : 'danger'} ) @@ -47,27 +48,27 @@ if (isset($error_message)) - $print_after_sale, 'selected_printer' => 'invoice_printer']) ?> + $print_after_sale, 'selected_printer' => 'invoice_printer']) ?>
        - +
        -
        +
        @@ -78,7 +79,7 @@ if (isset($error_message)) if($config['company_logo'] != '') { ?> - company_logo + company_logo @@ -87,7 +88,7 @@ if (isset($error_message)) if($config['receipt_show_company_name']) { ?> -
        +
        @@ -95,41 +96,41 @@ if (isset($error_message))
        -
        +
        = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?> = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>
        - - + + - - + + - - + +
        - - - - - + + + + + 0) { $quote_columns = $quote_columns + 1; ?> - + - + - - - - - + + + + + 0): ?> - + - + - - + + - + - - - + + + - - - + + + - - - + + + $payment) { @@ -203,9 +204,9 @@ if (isset($error_message)) $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - - + + +
        - - + +
        @@ -252,4 +253,4 @@ if (isset($error_message)) }); - + diff --git a/app/Views/sales/quote_email.php b/app/Views/sales/quote_email.php index 83fc2b2c6..18e700463 100644 --- a/app/Views/sales/quote_email.php +++ b/app/Views/sales/quote_email.php @@ -10,14 +10,15 @@ * @var array $cart * @var float $subtotal * @var array $taxes + * @var array $config */ ?> - + - - <?php echo lang('Sales.send_quote') ?> + + <?= lang('Sales.send_quote') ?> @@ -30,14 +31,14 @@ ?>
        - +
        - - + +
        - - + + - - + + 0) { ?> - - + + - - - - - + + + + + 0) { $quote_columns = $quote_columns + 1; ?> - + - + - - - - - + + + + + 0): ?> - + - + - + - - - + + + - - - + + + - - - + + +
        - - + +
        - +
        - +
        diff --git a/app/Views/sales/receipt.php b/app/Views/sales/receipt.php index f3b3dad4b..da4366718 100644 --- a/app/Views/sales/receipt.php +++ b/app/Views/sales/receipt.php @@ -2,12 +2,13 @@ /** * @var int $sale_id_num * @var bool $print_after_sale + * @var array $config */ use App\Models\Employee; ?> - + ', + $.get('', function(response) { $.notify( { message: response.message }, { type: response.success ? 'success' : 'danger'} ) @@ -40,21 +41,21 @@ if (isset($error_message)) - $print_after_sale, 'selected_printer' => 'receipt_printer']) ?> + $print_after_sale, 'selected_printer' => 'receipt_printer']) ?> - + - + diff --git a/app/Views/sales/receipt_default.php b/app/Views/sales/receipt_default.php index d432094f1..80d8d171d 100644 --- a/app/Views/sales/receipt_default.php +++ b/app/Views/sales/receipt_default.php @@ -13,17 +13,18 @@ * @var array $payments * @var float $amount_change * @var string $barcode + * @var array $config */ ?> -
        +
        - company_logo + company_logo
        -
        +
        -
        -
        -
        -
        +
        +
        +
        +
        @@ -49,31 +50,31 @@ if(isset($customer)) { ?> -
        +
        -
        +
        -
        +
        -
        +
        - - - - + + + + - - - - + + + + - + @@ -108,14 +109,14 @@ if($config['receipt_show_description']) { ?> - + - + @@ -129,17 +130,17 @@ if($item['discount_type'] == FIXED) { ?> - + - + - + - - + + - - + + - - + + $tax) { ?> - - + + 0)); ?> - - + + @@ -200,8 +201,8 @@ $payment) { $only_sale_check |= $payment['payment_type'] == lang('Sales.check'); @@ -209,8 +210,8 @@ $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - + + - - + + - - + +
        ::
        ::
        = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?> = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>
        - +
        - <?php echo esc($barcode) ?>
        - + <?= esc($barcode) ?>
        +
        diff --git a/app/Views/sales/receipt_email.php b/app/Views/sales/receipt_email.php index 29709f186..0462d2e09 100644 --- a/app/Views/sales/receipt_email.php +++ b/app/Views/sales/receipt_email.php @@ -11,6 +11,7 @@ * @var array $payments * @var float $amount_change * @var string $barcode + * @var array $config */ ?>
        @@ -20,7 +21,7 @@ { ?>
        - company_logo + company_logo
        -
        +
        -
        -
        +
        +

        -
        -
        +
        +

        @@ -49,23 +50,23 @@ if(isset($customer)) { ?> -
        +
        -
        -
        +
        +

        - - - - + + + + $item) @@ -74,24 +75,24 @@ { ?> - - - - + + + + - + - + @@ -105,17 +106,17 @@ if($item['discount_type'] == FIXED) { ?> - + - + - + - - + + - - + + - - + + $tax) { ?> - - + + 0)) ?> - - + + @@ -174,8 +175,8 @@ $payment) { $only_sale_check |= $payment['payment_type'] == lang('Sales.check'); @@ -183,8 +184,8 @@ $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - + + - - + + - - + + @@ -216,13 +217,13 @@
        ::
        ::
        = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?> = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>
        - +

        - <?php echo esc($barcode) ?>
        - + <?= esc($barcode) ?>
        +
        diff --git a/app/Views/sales/receipt_short.php b/app/Views/sales/receipt_short.php index 823bb84c5..8e9508b91 100644 --- a/app/Views/sales/receipt_short.php +++ b/app/Views/sales/receipt_short.php @@ -11,16 +11,17 @@ * @var array $payments * @var float $amount_change * @var string $barcode + * @var array $config */ ?> -
        +
        - company_logo + company_logo
        -
        +
        -
        -
        -
        -
        +
        +
        +
        +
        @@ -46,46 +47,46 @@ if(isset($customer)) { ?> -
        +
        -
        +
        -
        +
        -
        +
        - - - + + + $item) { ?> - - - + + + - + @@ -93,7 +94,7 @@ if($config['receipt_show_serialnumber']) { ?> - + @@ -107,17 +108,17 @@ if($item['discount_type'] == FIXED) { ?> - + - + - + - - + + - - + + - - + + $tax) { ?> - - + + 0)); ?> - - + + $payment) { $only_sale_check |= $payment['payment_type'] == lang('Sales.check'); @@ -186,8 +187,8 @@ $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - + + - - + + - - + +
        ::
        ::
        = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?> = 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>
        - +
        - <?php echo esc($barcode) ?>
        - + <?= esc($barcode) ?>
        +
        diff --git a/app/Views/sales/register.php b/app/Views/sales/register.php index 9c6b24b7c..798c23586 100644 --- a/app/Views/sales/register.php +++ b/app/Views/sales/register.php @@ -36,12 +36,13 @@ * @var int $cash_mode * @var float $non_cash_total * @var float $cash_amount_due + * @var array $config */ use App\Models\Employee; ?> - + - 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?> + 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
        • - +
        • - "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?> + "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
        • - +
        • - "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?> + "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
        • - +
        • - "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?> + "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
        • -
        • @@ -110,7 +111,7 @@ if(isset($success)) { ?>
        • -  ' . lang('Sales.takings'), +  ' . lang('Sales.takings'), array('class' => 'btn btn-primary btn-sm', 'id' => 'sales_takings_button', 'title' => lang('Sales.takings'))) ?>
        - + - 'add_item_form', 'class' => 'form-horizontal panel panel-default']) ?> + 'add_item_form', 'class' => 'form-horizontal panel panel-default']) ?>
        • - +
        • - 'item', 'id' => 'item', 'class' => 'form-control input-sm', 'size' => '50', 'tabindex' => ++$tabindex]) ?> + 'item', 'id' => 'item', 'class' => 'form-control input-sm', 'size' => '50', 'tabindex' => ++$tabindex]) ?>
        • -
        - + @@ -148,14 +149,14 @@ if(isset($success)) - - - - - - - - + + + + + + + + @@ -166,17 +167,17 @@ if(isset($success)) ?> $item) + foreach(array_reverse($cart, true) as $line => $item) { ?> - 'form-horizontal', 'id' => "cart_$line"]) ?> + 'form-horizontal', 'id' => "cart_$line"]) ?> + - + @@ -238,9 +239,9 @@ if(isset($success)) @@ -258,16 +259,16 @@ if(isset($success)) ?> - + - + - + @@ -331,7 +332,7 @@ if(isset($success)) } ?> - +
        - 'select_customer_form', 'class' => 'form-horizontal']) ?> + 'select_customer_form', 'class' => 'form-horizontal']) ?>
        -
        +
        - 'item_number', 'id' => 'item_number','class' => 'form-control input-sm', 'value'=>$item['item_number'], 'tabindex'=>++$tabindex]) ?> 'item_number', 'id' => 'item_number','class' => 'form-control input-sm', 'value'=>$item['item_number'], 'tabindex'=>++$tabindex]) ?> - 'name','id' => 'name', 'class' => 'form-control input-sm', 'value'=>$item['name'], 'tabindex'=>++$tabindex]) ?> + 'name','id' => 'name', 'class' => 'form-control input-sm', 'value'=>$item['name'], 'tabindex'=>++$tabindex]) ?> - +
        - 'discount', 'class' => 'form-control input-sm', 'value' => $item['discount_type'] ? to_currency_no_money($item['discount']) : to_decimals($item['discount']), 'tabindex' => ++$tabindex, 'onClick' => 'this.select();']) ?> + 'discount', 'class' => 'form-control input-sm', 'value' => $item['discount_type'] ? to_currency_no_money($item['discount']) : to_decimals($item['discount']), 'tabindex' => ++$tabindex, 'onClick' => 'this.select();']) ?> - 'discount_toggle', 'name' => 'discount_toggle', 'value' => 1, 'data-toggle' => "toggle",'data-size' => 'small', 'data-onstyle' => 'success', 'data-on' => '' . $config['currency_symbol'] . '', 'data-off' => '%', 'data-line' => esc($line), 'checked' => $item['discount_type']]) ?> + 'discount_toggle', 'name' => 'discount_toggle', 'value' => 1, 'data-toggle' => "toggle",'data-size' => 'small', 'data-onstyle' => 'success', 'data-on' => '' . $config['currency_symbol'] . '', 'data-off' => '%', 'data-line' => esc($line), 'checked' => $item['discount_type']]) ?>
        ').submit();" title= >').submit();" title= >
        'hidden', 'name' => 'item_id', 'value' => $item['item_id']]) ?> 'hidden', 'name' => 'item_id', 'value' => $item['item_id']]) ?> - 'item_description', 'id' => 'item_description', 'class' => 'form-control input-sm', 'value' => esc($item['description']), 'tabindex' => ++$tabindex]) ?> + 'item_description', 'id' => 'item_description', 'class' => 'form-control input-sm', 'value' => esc($item['description']), 'tabindex' => ++$tabindex]) ?>
        - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + +
        'modal-dlg', 'data-btn-submit' => lang('Common.submit'), 'title' => lang('Customers.update')]) ?> 'modal-dlg', 'data-btn-submit' => lang('Common.submit'), 'title' => lang('Customers.update')]) ?>
        -  ' . lang('Common.remove') . ' ' . lang('Customers.customer'), ['class' => 'btn btn-danger btn-sm', 'id' => 'remove_customer_button', 'title' => lang('Common.remove') . ' ' . lang('Customers.customer')] @@ -437,32 +438,32 @@ if(isset($success)) { ?>
        - - 'customer', 'id' => 'customer', 'class' => 'form-control input-sm', 'value' => lang('Sales.start_typing_customer_name')]) ?> + + 'customer', 'id' => 'customer', 'class' => 'form-control input-sm', 'value' => lang('Sales.start_typing_customer_name')]) ?> - -
        - + - - + + - - + + - - + + - - + +
        @@ -490,12 +491,12 @@ if(isset($success)) ?> - - + + - - + +
        @@ -505,28 +506,28 @@ if(isset($success)) if($payments_cover_total) { ?> - 'add_payment_form', 'class' => 'form-horizontal']) ?> + 'add_payment_form', 'class' => 'form-horizontal']) ?> - + - +
        - 'payment_types', 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit', 'disabled' => 'disabled']) ?> + 'payment_types', 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit', 'disabled' => 'disabled']) ?>
        - 'amount_tendered', 'id' => 'amount_tendered', 'class' => 'form-control input-sm disabled', 'disabled' => 'disabled', 'value' => '0', 'size' => '5', 'tabindex' => ++$tabindex, 'onClick' => 'this.select();']) ?> + 'amount_tendered', 'id' => 'amount_tendered', 'class' => 'form-control input-sm disabled', 'disabled' => 'disabled', 'value' => '0', 'size' => '5', 'tabindex' => ++$tabindex, 'onClick' => 'this.select();']) ?>
        - + 0) { @@ -534,7 +535,7 @@ if(isset($success)) { if($payment['payment_type'] == lang('Sales.due')) { - $due_payment = TRUE; + $due_payment = true; } } } @@ -542,7 +543,7 @@ if(isset($success)) if(!$due_payment || ($due_payment && isset($customer))) //TODO: $due_payment is not needed because the first clause insures that it will always be true if it gets to this point. Can be shortened to if(!$due_payment || isset($customer)) { ?> -
         
        +
         
        - 'add_payment_form', 'class' => 'form-horizontal']) ?> + 'add_payment_form', 'class' => 'form-horizontal']) ?> - + - +
        - 'payment_types', 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?> + 'payment_types', 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
        - 'amount_tendered', 'id' => 'amount_tendered', 'class' => 'form-control input-sm non-giftcard-input', 'value' => to_currency_no_money($amount_due), 'size' => '5', 'tabindex' => ++$tabindex, 'onClick' => 'this.select();']) ?> - 'amount_tendered', 'id' => 'amount_tendered', 'class' => 'form-control input-sm giftcard-input', 'disabled' => true, 'value' => to_currency_no_money($amount_due), 'size' => '5', 'tabindex' => ++$tabindex]) ?> + 'amount_tendered', 'id' => 'amount_tendered', 'class' => 'form-control input-sm non-giftcard-input', 'value' => to_currency_no_money($amount_due), 'size' => '5', 'tabindex' => ++$tabindex, 'onClick' => 'this.select();']) ?> + 'amount_tendered', 'id' => 'amount_tendered', 'class' => 'form-control input-sm giftcard-input', 'disabled' => true, 'value' => to_currency_no_money($amount_due), 'size' => '5', 'tabindex' => ++$tabindex]) ?>
        - + -
         
        +
         
        @@ -583,9 +584,9 @@ if(isset($success)) - - - + + + @@ -595,9 +596,9 @@ if(isset($success)) { ?> - - - + + + - 'buttons_form']) ?> + 'buttons_form']) ?>
        -
         
        +
         
        -
         
        +
         
        -
         
        +
         
        - +
        - 'control-label', 'id' => 'comment_label', 'for' => 'comment']) ?> - 'comment', 'id' => 'comment', 'class' => 'form-control input-sm', 'value' => esc($comment), 'rows' => '2']) ?> + 'control-label', 'id' => 'comment_label', 'for' => 'comment']) ?> + 'comment', 'id' => 'comment', 'class' => 'form-control input-sm', 'value' => esc($comment), 'rows' => '2']) ?>
        @@ -644,8 +645,8 @@ if(isset($success))
        @@ -655,8 +656,8 @@ if(isset($success)) ?>
        # - 'sales_invoice_number', 'id' => 'sales_invoice_number', 'class' => 'form-control input-sm', 'value' => esc($invoice_number)]) ?> + 'sales_invoice_number', 'id' => 'sales_invoice_number', 'class' => 'form-control input-sm', 'value' => esc($invoice_number)]) ?>
        @@ -714,30 +715,30 @@ if(isset($success)) $(document).ready(function() { const redirect = function() { - window.location.href = ""; + window.location.href = ""; }; $("#remove_customer_button").click(function() { - $.post("", redirect); + $.post("", redirect); }); $(".delete_item_button").click(function() { const item_id = $(this).data('item-id'); - $.post("" + item_id, redirect); + $.post("" + item_id, redirect); }); $(".delete_payment_button").click(function() { const item_id = $(this).data('payment-id'); - $.post("" + item_id, redirect); + $.post("" + item_id, redirect); }); $("input[name='item_number']").change(function() { var item_id = $(this).parents('tr').find("input[name='item_id']").val(); var item_number = $(this).val(); $.ajax({ - url: "", + url: "", method: 'post', data: { 'item_id': item_id, @@ -751,7 +752,7 @@ $(document).ready(function() var item_id = $(this).parents('tr').find("input[name='item_id']").val(); var item_name = $(this).val(); $.ajax({ - url: "", + url: "", method: 'post', data: { 'item_id': item_id, @@ -765,7 +766,7 @@ $(document).ready(function() var item_id = $(this).parents('tr').find("input[name='item_id']").val(); var item_description = $(this).val(); $.ajax({ - url: "", + url: "", method: 'post', data: { 'item_id': item_id, @@ -778,11 +779,11 @@ $(document).ready(function() $('#item').focus(); $('#item').blur(function() { - $(this).val(""); + $(this).val(""); }); $('#item').autocomplete( { - source: "", + source: "", minChars: 0, autoFocus: false, delay: 500, @@ -801,7 +802,7 @@ $(document).ready(function() }); var clear_fields = function() { - if($(this).val().match("")) + if($(this).val().match("")) { $(this).val(''); } @@ -812,11 +813,11 @@ $(document).ready(function() }); $('#customer').blur(function() { - $(this).val(""); + $(this).val(""); }); $('#customer').autocomplete( { - source: "", + source: "", minChars: 0, delay: 10, select: function (a, ui) { @@ -834,7 +835,7 @@ $(document).ready(function() }); $('.giftcard-input').autocomplete( { - source: "", + source: "", minChars: 0, delay: 10, select: function (a, ui) { @@ -845,15 +846,15 @@ $(document).ready(function() }); $('#comment').keyup(function() { - $.post("", {comment: $('#comment').val()}); + $.post("", {comment: $('#comment').val()}); }); $('#sales_invoice_number').keyup(function() { - $.post("", {sales_invoice_number: $('#sales_invoice_number').val()}); + $.post("", {sales_invoice_number: $('#sales_invoice_number').val()}); }); $('#sales_print_after_sale').change(function() { - $.post("", {sales_print_after_sale: $(this).is(':checked')}); + $.post("", {sales_print_after_sale: $(this).is(':checked')}); }); $('#price_work_orders').change(function() { - $.post("", {price_work_orders: $(this).is(':checked')}); + $.post("", {price_work_orders: $(this).is(':checked')}); }); $('#email_receipt').change(function() { - $.post("", {email_receipt: $(this).is(':checked')}); + $.post("", {email_receipt: $(this).is(':checked')}); }); $('#finish_sale_button').click(function() { @@ -883,14 +884,14 @@ $(document).ready(function() }); $('#suspend_sale_button').click(function() { - $('#buttons_form').attr('action', ""); + $('#buttons_form').attr('action', ""); $('#buttons_form').submit(); }); $('#cancel_sale_button').click(function() { - if(confirm("")) + if(confirm("")) { - $('#buttons_form').attr('action', ""); + $('#buttons_form').attr('action', ""); $('#buttons_form').submit(); } }); @@ -964,33 +965,33 @@ $(document).ready(function() function check_payment_type() { - var cash_mode = ; + var cash_mode = ; - if($("#payment_types").val() == "") + if($("#payment_types").val() == "") { - $("#sale_total").html(""); - $("#sale_amount_due").html(""); - $("#amount_tendered_label").html(""); + $("#sale_total").html(""); + $("#sale_amount_due").html(""); + $("#amount_tendered_label").html(""); $("#amount_tendered:enabled").val('').focus(); $(".giftcard-input").attr('disabled', false); $(".non-giftcard-input").attr('disabled', true); $(".giftcard-input:enabled").val('').focus(); } - else if(($("#payment_types").val() == "" && cash_mode == '1')) + else if(($("#payment_types").val() == "" && cash_mode == '1')) { - $("#sale_total").html(""); - $("#sale_amount_due").html(""); - $("#amount_tendered_label").html(""); - $("#amount_tendered:enabled").val(""); + $("#sale_total").html(""); + $("#sale_amount_due").html(""); + $("#amount_tendered_label").html(""); + $("#amount_tendered:enabled").val(""); $(".giftcard-input").attr('disabled', true); $(".non-giftcard-input").attr('disabled', false); } else { - $("#sale_total").html(""); - $("#sale_amount_due").html(""); - $("#amount_tendered_label").html(""); - $("#amount_tendered:enabled").val(""); + $("#sale_total").html(""); + $("#sale_amount_due").html(""); + $("#amount_tendered_label").html(""); + $("#amount_tendered:enabled").val(""); $(".giftcard-input").attr('disabled', true); $(".non-giftcard-input").attr('disabled', false); } @@ -1044,4 +1045,4 @@ document.body.onkeyup = function(e) - + diff --git a/app/Views/sales/suspended.php b/app/Views/sales/suspended.php index 63a436eba..84459f529 100644 --- a/app/Views/sales/suspended.php +++ b/app/Views/sales/suspended.php @@ -1,6 +1,7 @@
        - - + + - + - - - - + + + + @@ -41,13 +42,13 @@ use App\Models\Customer; { ?> - - + + - + @@ -83,12 +84,12 @@ use App\Models\Customer; } ?> - + - +', + $.get('', function(response) { $.notify( { message: response.message }, { type: response.success ? 'success' : 'danger'} ) @@ -51,27 +52,27 @@ $(document).ready(function() - $print_after_sale, 'selected_printer' => 'invoice_printer']) ?> + $print_after_sale, 'selected_printer' => 'invoice_printer']) ?>
        - +
        -
        +
        @@ -82,7 +83,7 @@ $(document).ready(function() if($config['company_logo'] != '') { ?> - company_logo + company_logo @@ -91,7 +92,7 @@ $(document).ready(function() if($config['receipt_show_company_name']) { ?> -
        +
        @@ -99,50 +100,50 @@ $(document).ready(function()
        -
        +
        ') ?>') ?>
        Dinner_table->get_name($suspended_sale['dinner_table_id'])) ?>Dinner_table->get_name($suspended_sale['dinner_table_id'])) ?> - - - - + + + +
        - - + + - - + + - - + +
        - + - + - - - - + + + + 0) { $invoice_columns += 1; //TODO: $invoice_columns++; ? ?> - + - + - + - + - - - - + + + + 0): ?> - + - + - - + - + - + - - - + + + - - - + + + - - - + + + $payment) { $only_sale_check |= $payment['payment_type'] == lang('Sales.check'); @@ -221,9 +222,9 @@ $(document).ready(function() $show_giftcard_remainder |= $splitpayment[0] == lang('Sales.giftcard'); ?> - - - + + + - - + + - - - + + +
        - - - + + +
        -
        +
        - <?php echo esc($barcode) ?>
        - + <?= esc($barcode) ?>
        +
        @@ -298,4 +299,4 @@ $(window).on("load", function() }); - + diff --git a/app/Views/sales/work_order.php b/app/Views/sales/work_order.php index b8b32ff23..e0808c0bb 100644 --- a/app/Views/sales/work_order.php +++ b/app/Views/sales/work_order.php @@ -14,9 +14,10 @@ * @var float $subtotal * @var array $taxes * @var array $payments + * @var array $config */ ?> - +', + $.get('', function(response) { $.notify( { message: response.message }, { type: response.success ? 'success' : 'danger'} ) @@ -49,27 +50,27 @@ if(isset($error_message)) - $print_after_sale, 'selected_printer' => 'invoice_printer']) ?> + $print_after_sale, 'selected_printer' => 'invoice_printer']) ?>
        - +
        -
        +
        @@ -80,7 +81,7 @@ if(isset($error_message)) if($config['company_logo'] != '') { ?> - company_logo + company_logo @@ -89,7 +90,7 @@ if(isset($error_message)) if($config['receipt_show_company_name']) { ?> -
        +
        @@ -97,23 +98,23 @@ if(isset($error_message))
        -
        +
        - + +
        /td> - /td> +
        := 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>:= 0 ? ($only_sale_check ? 'Sales.check_balance' : 'Sales.change_due') : 'Sales.amount_due') ?>
        - - + + - - + + - - + + - - - - - - + + + + + + $item) @@ -137,11 +138,11 @@ if(isset($error_message)) { ?> - - - + + + - + @@ -151,8 +152,8 @@ if(isset($error_message)) ?> - - + + - + - - + + $tax) @@ -174,21 +175,21 @@ if(isset($error_message)) ?> - - + + - - + + $payment) { $only_sale_check |= $payment['payment_type'] == lang('Sales.check'); @@ -197,8 +198,8 @@ if(isset($error_message)) ?> - - + +
        - +
        @@ -243,4 +244,4 @@ if(isset($error_message)) }); - + diff --git a/app/Views/sales/work_order_email.php b/app/Views/sales/work_order_email.php index 637bd9a51..5216eae09 100644 --- a/app/Views/sales/work_order_email.php +++ b/app/Views/sales/work_order_email.php @@ -9,13 +9,14 @@ * @var array $cart * @var float $tax_exclusive_subtotal * @var array $taxes + * @var array $config */ ?> - - + + - + @@ -28,7 +29,7 @@ ?>
        - +
        -
        -
        +
        +
        - - + + - - + + 0) { ?> - - + + - - - - - - + + + + + + - - - - - - + + + + + + - + - - + + - - + + - - + +
        - +
        diff --git a/app/Views/suppliers/form.php b/app/Views/suppliers/form.php index bee836bb0..f0bf7d2ee 100644 --- a/app/Views/suppliers/form.php +++ b/app/Views/suppliers/form.php @@ -5,16 +5,16 @@ * @var array $categories */ ?> -
        +
          -person_id", 'url'), ['id' => 'supplier_form', 'class' => 'form-horizontal']) ?> +person_id", 'url'), ['id' => 'supplier_form', 'class' => 'form-horizontal']) ?>
          - 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
          - 'company_name', 'id' => 'company_name_input', 'class' => 'form-control input-sm', @@ -25,16 +25,16 @@
          - 'required control-label col-xs-3']) ?> + 'required control-label col-xs-3']) ?>
          - category, ['class' => 'form-control', 'id' => 'category']) ?> + category, ['class' => 'form-control', 'id' => 'category']) ?>
          - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
          - 'agency_name', 'id' => 'agency_name_input', 'class' => 'form-control input-sm', @@ -44,12 +44,12 @@
          - +
          - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
          - 'account_number', 'id' => 'account_number', 'class' => 'form-control input-sm', @@ -60,9 +60,9 @@
          - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
          - 'tax_id', 'id' => 'tax_id', 'class' => 'form-control input-sm', @@ -72,7 +72,7 @@
          - +
          -
          diff --git a/app/Views/taxes/tax_rates_form.php b/app/Views/taxes/tax_rates_form.php index 8d9ee868f..a97cde56c 100644 --- a/app/Views/taxes/tax_rates_form.php +++ b/app/Views/taxes/tax_rates_form.php @@ -14,33 +14,33 @@ ?>
            - 'tax_code_form', 'class' => 'form-horizontal']) ?> + 'tax_code_form', 'class' => 'form-horizontal']) ?>
            - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
            - 'form-control input-sm']) ?> + 'form-control input-sm']) ?>
            - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
            - 'form-control input-sm']) ?> + 'form-control input-sm']) ?>
            - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
            - 'form-control input-sm']) ?> + 'form-control input-sm']) ?>
            - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
            - 'tax_rate', 'id' => 'tax_rate', 'class' => 'form-control input-sm text-uppercase', @@ -53,14 +53,14 @@
            - 'control-label col-xs-3']) ?> + 'control-label col-xs-3']) ?>
            - 'form-control input-sm']) ?> + 'form-control input-sm']) ?>
            - +