From f343c6988ec6b682fd466bb6313f89f42705fe29 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Thu, 1 Dec 2022 12:13:46 +0400 Subject: [PATCH] Load OSPOS app settings to variable - refactor class and variable - Refactor references to OSPOS configuration - Replaced " with ' in PHP where parser was not needed --- app/Config/OSPOS.php | 2 +- app/Controllers/Receivings.php | 6 +-- app/Controllers/Reports.php | 10 ++-- app/Controllers/Sales.php | 54 +++++++++---------- app/Controllers/Taxes.php | 16 +++--- app/Helpers/tabular_helper.php | 10 ++-- app/Libraries/MY_Validation.php | 2 +- app/Libraries/Mailchimp_lib.php | 2 +- app/Libraries/Receiving_lib.php | 2 +- app/Libraries/Sale_lib.php | 34 ++++++------ app/Libraries/Sms_lib.php | 6 +-- app/Libraries/Tax_lib.php | 12 ++--- app/Libraries/Token_lib.php | 2 +- app/Models/Receiving.php | 4 +- app/Models/Reports/Summary_discounts.php | 2 +- .../Reports/Summary_expenses_categories.php | 4 +- app/Models/Reports/Summary_payments.php | 2 +- app/Models/Reports/Summary_report.php | 6 +-- app/Models/Reports/Summary_sales_taxes.php | 4 +- app/Models/Reports/Summary_taxes.php | 6 +-- app/Models/Sale.php | 26 ++++----- app/Models/Tax_code.php | 2 +- app/Views/attributes/manage.php | 2 +- app/Views/cashups/manage.php | 2 +- app/Views/configs/message_config.php | 8 +-- app/Views/configs/receipt_config.php | 44 +++++++-------- app/Views/configs/reward_config.php | 2 +- app/Views/configs/system_info.php | 6 +-- app/Views/configs/table_config.php | 2 +- app/Views/configs/tax_config.php | 20 +++---- app/Views/expenses/manage.php | 2 +- app/Views/expenses_categories/manage.php | 2 +- app/Views/giftcards/manage.php | 2 +- app/Views/item_kits/manage.php | 2 +- app/Views/items/manage.php | 4 +- app/Views/partial/print_receipt.php | 16 +++--- app/Views/people/manage.php | 2 +- app/Views/receivings/receipt.php | 14 ++--- app/Views/receivings/receiving.php | 2 +- app/Views/reports/graphs/pie.php | 4 +- app/Views/reports/specific_input.php | 4 +- app/Views/reports/tabular.php | 2 +- app/Views/reports/tabular_details.php | 6 +-- app/Views/sales/manage.php | 2 +- app/Views/sales/quote.php | 14 ++--- app/Views/sales/quote_email.php | 12 ++--- app/Views/sales/receipt.php | 2 +- app/Views/sales/receipt_default.php | 32 +++++------ app/Views/sales/receipt_email.php | 26 ++++----- app/Views/sales/receipt_short.php | 28 +++++----- app/Views/sales/register.php | 10 ++-- app/Views/sales/suspended.php | 6 +-- app/Views/sales/tax_invoice.php | 18 +++---- app/Views/sales/work_order.php | 12 ++--- app/Views/sales/work_order_email.php | 6 +-- app/Views/taxes/tax_rates.php | 2 +- 56 files changed, 266 insertions(+), 266 deletions(-) diff --git a/app/Config/OSPOS.php b/app/Config/OSPOS.php index 5ed4e66a6..974709328 100644 --- a/app/Config/OSPOS.php +++ b/app/Config/OSPOS.php @@ -11,5 +11,5 @@ use CodeIgniter\Config\BaseConfig; */ class OSPOS extends BaseConfig { - + public $settings = []; } \ No newline at end of file diff --git a/app/Controllers/Receivings.php b/app/Controllers/Receivings.php index 337cbc321..a8f512420 100644 --- a/app/Controllers/Receivings.php +++ b/app/Controllers/Receivings.php @@ -135,8 +135,8 @@ class Receivings extends Secure_Controller $this->token_lib->parse_barcode($quantity, $price, $item_id_or_number_or_item_kit_or_receipt); $quantity = ($mode == 'receive' || $mode == 'requisition') ? $quantity : -$quantity; $item_location = $this->receiving_lib->get_stock_source(); - $discount = config('OSPOS')->default_receivings_discount; - $discount_type = config('OSPOS')->default_receivings_discount_type; + $discount = config('OSPOS')->settings['default_receivings_discount']; + $discount_type = config('OSPOS')->settings['default_receivings_discount_type']; if($mode == 'return' && $this->receiving->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt)) { @@ -445,7 +445,7 @@ class Receivings extends Secure_Controller { $newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING); //TODO: newdate does not follow naming conventions - $date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $newdate); + $date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate); $receiving_time = $date_formatter->format('Y-m-d H:i:s'); $receiving_data = [ diff --git a/app/Controllers/Reports.php b/app/Controllers/Reports.php index c0aa0ddf1..48678990f 100644 --- a/app/Controllers/Reports.php +++ b/app/Controllers/Reports.php @@ -1576,10 +1576,10 @@ class Reports extends Secure_Controller $sale_type_options = []; $sale_type_options['complete'] = lang('Reports.complete'); $sale_type_options['sales'] = lang('Reports.completed_sales'); - if(config('OSPOS')->invoice_enable) + if(config('OSPOS')->settings['invoice_enable']) { $sale_type_options['quotes'] = lang('Reports.quotes'); - if(config('OSPOS')->work_order_enable) + if(config('OSPOS')->settings['work_order_enable']) { $sale_type_options['work_orders'] = lang('Reports.work_orders'); } @@ -1910,13 +1910,13 @@ class Reports extends Secure_Controller { $subtitle = ''; - if(empty(config('OSPOS')->date_or_time_format)) + if(empty(config('OSPOS')->settings['date_or_time_format'])) { - $subtitle .= date(config('OSPOS')->dateformat, strtotime($inputs['start_date'])) . ' - ' . date(config('OSPOS')->dateformat, strtotime($inputs['end_date'])); + $subtitle .= date(config('OSPOS')->settings['dateformat'], strtotime($inputs['start_date'])) . ' - ' . date(config('OSPOS')->settings['dateformat'], strtotime($inputs['end_date'])); } else { - $subtitle .= date(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, strtotime(rawurldecode($inputs['end_date']))); + $subtitle .= date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], strtotime(rawurldecode($inputs['end_date']))); } return $subtitle; diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 14529cf9e..39d32cff6 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -109,7 +109,7 @@ class Sales extends Secure_Controller 'only_due' => FALSE, 'only_check' => FALSE, 'only_creditcard' => FALSE, - 'only_invoices' => config('OSPOS')->invoice_enable && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT), + 'only_invoices' => config('OSPOS')->settings['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT), 'is_valid_receipt' => $this->sale->is_valid_receipt($search) ]; @@ -210,7 +210,7 @@ class Sales extends Secure_Controller $this->sale_lib->set_sale_type(SALE_TYPE_RETURN); } - if(config('OSPOS')->dinner_table_enable) + if(config('OSPOS')->settings['dinner_table_enable']) { $occupied_dinner_table = $this->request->getPost('dinner_table', FILTER_SANITIZE_NUMBER_INT); $released_dinner_table = $this->sale_lib->get_dinner_table(); @@ -451,8 +451,8 @@ class Sales extends Secure_Controller { $data = []; - $discount = config('OSPOS')->default_sales_discount; - $discount_type = config('OSPOS')->default_sales_discount_type; + $discount = config('OSPOS')->settings['default_sales_discount']; + $discount_type = config('OSPOS')->settings['default_sales_discount_type']; // check if any discount is assigned to the selected customer $customer_id = $this->sale_lib->get_customer(); @@ -625,7 +625,7 @@ class Sales extends Secure_Controller $data['cart'] = $this->sale_lib->get_cart(); - $data['include_hsn'] = (bool)config('OSPOS')->include_hsn; + $data['include_hsn'] = (bool)config('OSPOS')->settings['include_hsn']; $__time = time(); $data['transaction_time'] = to_datetime($__time); $data['transaction_date'] = to_date($__time); @@ -635,16 +635,16 @@ class Sales extends Secure_Controller $employee_info = $this->employee->get_info($employee_id); $data['employee'] = $employee_info->first_name . ' ' . mb_substr($employee_info->last_name, 0, 1); - $data['company_info'] = implode("\n", [config('OSPOS')->address, config('OSPOS')->phone]); + $data['company_info'] = implode("\n", [config('OSPOS')->settings['address'], config('OSPOS')->settings['phone']]); - if(config('OSPOS')->account_number) + if(config('OSPOS')->settings['account_number']) { - $data['company_info'] .= "\n" . lang('Sales.account_number') . ": " . config('OSPOS')->account_number; + $data['company_info'] .= "\n" . lang('Sales.account_number') . ": " . config('OSPOS')->settings['account_number']; } - if(config('OSPOS')->tax_id != '') + if(config('OSPOS')->settings['tax_id'] != '') { - $data['company_info'] .= "\n" . lang('Sales.tax_id') . ": " . config('OSPOS')->tax_id; + $data['company_info'] .= "\n" . lang('Sales.tax_id') . ": " . config('OSPOS')->settings['tax_id']; } $data['invoice_number_enabled'] = $this->sale_lib->is_invoice_mode(); @@ -723,7 +723,7 @@ class Sales extends Secure_Controller if($this->sale_lib->is_invoice_mode()) { - $invoice_format = config('OSPOS')->sales_invoice_format; + $invoice_format = config('OSPOS')->settings['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) @@ -745,7 +745,7 @@ class Sales extends Secure_Controller $sale_type = SALE_TYPE_INVOICE; // The PHP file name is the same as the invoice_type key - $invoice_view = config('OSPOS')->invoice_type; + $invoice_view = config('OSPOS')->settings['invoice_type']; // Save the data to the sales table $data['sale_id_num'] = $this->sale->save_value($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $tax_details); @@ -780,7 +780,7 @@ class Sales extends Secure_Controller if($work_order_number == NULL) { // generate work order number - $work_order_format = config('OSPOS')->work_order_format; + $work_order_format = config('OSPOS')->settings['work_order_format']; $work_order_number = $this->token_lib->render($work_order_format); } @@ -815,7 +815,7 @@ class Sales extends Secure_Controller if($quote_number == NULL) { // generate quote number - $quote_format = config('OSPOS')->sales_quote_format; + $quote_format = config('OSPOS')->settings['sales_quote_format']; $quote_number = $this->token_lib->render($quote_format); } @@ -892,14 +892,14 @@ class Sales extends Secure_Controller $number = $sale_data[$type."_number"]; $subject = lang('Sales.' . $type) . ' ' . $number; - $text = config('OSPOS')->invoice_email_message; + $text = config('OSPOS')->settings['invoice_email_message']; $tokens = [ new Token_invoice_sequence($sale_data['invoice_number']), new Token_invoice_count('POS ' . $sale_data['sale_id']), new Token_customer((object)$sale_data) ]; $text = $this->token_lib->render($text, $tokens); - $sale_data['mimetype'] = mime_content_type('uploads/' . config('OSPOS')->company_logo); + $sale_data['mimetype'] = mime_content_type('uploads/' . config('OSPOS')->settings['company_logo']); // generate email attachment: invoice in pdf format $view = Services::renderer(); @@ -1045,7 +1045,7 @@ class Sales extends Secure_Controller $data['transaction_date'] = to_date(strtotime($sale_info['sale_time'])); $data['show_stock_locations'] = $this->stock_location->show_locations('sales'); - $data['include_hsn'] = (bool)config('OSPOS')->include_hsn; + $data['include_hsn'] = (bool)config('OSPOS')->settings['include_hsn']; // Returns 'subtotal', 'total', 'cash_total', 'payment_total', 'amount_due', 'cash_amount_due', 'payments_cover_total' $totals = $this->sale_lib->get_totals($tax_details[0]); @@ -1084,15 +1084,15 @@ class Sales extends Secure_Controller $data['quote_number'] = $sale_info['quote_number']; $data['sale_status'] = $sale_info['sale_status']; - $data['company_info'] = implode('\n', [config('OSPOS')->address, config('OSPOS')->phone]); //TODO: Duplicated code. + $data['company_info'] = implode('\n', [config('OSPOS')->settings['address'], config('OSPOS')->settings['phone']]); //TODO: Duplicated code. - if(config('OSPOS')->account_number) + if(config('OSPOS')->settings['account_number']) { - $data['company_info'] .= '\n' . lang('Sales.account_number') . ": " . config('OSPOS')->account_number; + $data['company_info'] .= '\n' . lang('Sales.account_number') . ": " . config('OSPOS')->settings['account_number']; } - if(config('OSPOS')->tax_id != '') + if(config('OSPOS')->settings['tax_id'] != '') { - $data['company_info'] .= '\n' . lang('Sales.tax_id') . ": " . config('OSPOS')->tax_id; + $data['company_info'] .= '\n' . lang('Sales.tax_id') . ": " . config('OSPOS')->settings['tax_id']; } $data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['sale_id']); @@ -1125,7 +1125,7 @@ class Sales extends Secure_Controller $data['customer_required'] = lang('Sales.customer_optional'); } - $invoice_type = config('OSPOS')->invoice_type; + $invoice_type = config('OSPOS')->settings['invoice_type']; $data['invoice_view'] = $invoice_type; return $data; @@ -1197,7 +1197,7 @@ class Sales extends Secure_Controller $data['comment'] = $this->sale_lib->get_comment(); $data['email_receipt'] = $this->sale_lib->is_email_receipt(); - if($customer_info && config('OSPOS')->customer_reward_enable) + if($customer_info && config('OSPOS')->settings['customer_reward_enable']) { $data['payment_options'] = $this->sale->get_payment_options(TRUE, TRUE); } @@ -1210,7 +1210,7 @@ class Sales extends Secure_Controller $data['change_price'] = $this->employee->has_grant('sales_change_price', $this->employee->get_logged_in_employee_info()->person_id); $temp_invoice_number = $this->sale_lib->get_invoice_number(); - $invoice_format = config('OSPOS')->sales_invoice_format; + $invoice_format = config('OSPOS')->settings['sales_invoice_format']; if ($temp_invoice_number == NULL || $temp_invoice_number == '') { @@ -1394,7 +1394,7 @@ class Sales extends Secure_Controller $newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING); $employee_id = $this->employee->get_logged_in_employee_info()->person_id; - $date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $newdate); + $date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate); $sale_time = $date_formatter->format('Y-m-d H:i:s'); $sale_data = [ @@ -1505,7 +1505,7 @@ class Sales extends Secure_Controller { $sale_type = $this->sale_lib->get_sale_type(); - if(config('OSPOS')->dinner_table_enable) + if(config('OSPOS')->settings['dinner_table_enable']) { $dinner_table = $this->sale_lib->get_dinner_table(); $this->dinner_table->release($dinner_table); diff --git a/app/Controllers/Taxes.php b/app/Controllers/Taxes.php index fe8ee61a5..2b02539ee 100644 --- a/app/Controllers/Taxes.php +++ b/app/Controllers/Taxes.php @@ -58,7 +58,7 @@ class Taxes extends Secure_Controller $data['tax_categories_table_headers'] = get_tax_categories_table_headers(); $data['tax_types'] = $this->tax_lib->get_tax_types(); - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED; } @@ -134,7 +134,7 @@ class Taxes extends Secure_Controller $tax_rate_info = $this->tax->get_rate_info($tax_code, $default_tax_category_id); - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED; } @@ -206,9 +206,9 @@ class Taxes extends Secure_Controller if($tax_rate_id == -1) //TODO: Replace -1 with constant { - $data['rate_tax_code_id'] = config('OSPOS')->default_tax_code; - $data['rate_tax_category_id'] = config('OSPOS')->default_tax_category; - $data['rate_jurisdiction_id'] = config('OSPOS')->default_tax_jurisdiction; + $data['rate_tax_code_id'] = config('OSPOS')->settings['default_tax_code']; + $data['rate_tax_category_id'] = config('OSPOS')->settings['default_tax_category']; + $data['rate_jurisdiction_id'] = config('OSPOS')->settings['default_tax_jurisdiction']; $data['tax_rounding_code'] = rounding_mode::HALF_UP; $data['tax_rate'] = '0.0000'; } @@ -237,7 +237,7 @@ class Taxes extends Secure_Controller $data['rounding_options'] = rounding_mode::get_rounding_options(); $data['html_rounding_options'] = $this->get_html_rounding_options(); - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED; } @@ -304,7 +304,7 @@ class Taxes extends Secure_Controller $data['rounding_options'] = rounding_mode::get_rounding_options(); $data['html_rounding_options'] = $this->get_html_rounding_options(); - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED; } @@ -557,7 +557,7 @@ class Taxes extends Secure_Controller { $tax_jurisdictions = $this->tax_jurisdiction->get_all()->getResultArray(); - if(config('OSPOS')->tax_included) //TODO: ternary notation + if(config('OSPOS')->settings['tax_included']) //TODO: ternary notation { $default_tax_type = Tax_lib::TAX_TYPE_INCLUDED; } diff --git a/app/Helpers/tabular_helper.php b/app/Helpers/tabular_helper.php index 534376b50..658c9e9d4 100644 --- a/app/Helpers/tabular_helper.php +++ b/app/Helpers/tabular_helper.php @@ -76,7 +76,7 @@ function get_sales_manage_table_headers(): string ['payment_type' => lang('Sales.payment_type')] ]; - if(config('OSPOS')->invoice_enable) + if(config('OSPOS')->settings['invoice_enable']) { $headers[] = ['invoice_number' => lang('Sales.invoice_number')]; $headers[] = ['invoice' => ' ', 'sortable' => FALSE, 'escape' => FALSE]; @@ -105,7 +105,7 @@ function get_sale_data_row(object $sale): array 'payment_type' => $sale->payment_type ]; - if(config('OSPOS')->invoice_enable) + if(config('OSPOS')->settings['invoice_enable']) { $row['invoice_number'] = $sale->invoice_number; $row['invoice'] = empty($sale->invoice_number) @@ -404,7 +404,7 @@ function get_items_manage_table_headers(): string ['quantity' => lang('Items.quantity')] ]; - if(config('OSPOS')->use_destination_based_tax) + if(config('OSPOS')->settings['use_destination_based_tax']) { $headers[] = ['tax_percents' => lang('Items.tax_category'), 'sortable' => FALSE]; } @@ -440,7 +440,7 @@ function get_item_data_row(object $item): array $item_taxes = model(Item_taxes::class); $tax_category = model(Tax_category::class); - if(config('OSPOS')->use_destination_based_tax) + if(config('OSPOS')->settings['use_destination_based_tax']) { if($item->tax_category_id == NULL) //TODO: === ? { @@ -489,7 +489,7 @@ function get_item_data_row(object $item): array } } - if(config('OSPOS')->multi_pack_enabled) + if(config('OSPOS')->settings['multi_pack_enabled']) { $item->name .= NAME_SEPARATOR . $item->pack_name; } diff --git a/app/Libraries/MY_Validation.php b/app/Libraries/MY_Validation.php index 468d7e950..6a4d60ffa 100644 --- a/app/Libraries/MY_Validation.php +++ b/app/Libraries/MY_Validation.php @@ -87,7 +87,7 @@ class MY_Validation extends Validation */ public function gcaptcha_check(string $recaptchaResponse, &$error = null): bool { - $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . config('OSPOS')->gcaptcha_secret_key . '&response=' . $recaptchaResponse . '&remoteip=' . $this->request->getIPAddress(); + $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . config('OSPOS')->settings['gcaptcha_secret_key'] . '&response=' . $recaptchaResponse . '&remoteip=' . $this->request->getIPAddress(); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); diff --git a/app/Libraries/Mailchimp_lib.php b/app/Libraries/Mailchimp_lib.php index 8a3e4c887..5f79f1a36 100644 --- a/app/Libraries/Mailchimp_lib.php +++ b/app/Libraries/Mailchimp_lib.php @@ -42,7 +42,7 @@ class MailchimpConnector if(empty($api_key)) { - $this->_api_key = $this->encrypter->decrypt(config('OSPOS')->mailchimp_api_key); //TODO: Hungarian notation + $this->_api_key = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_api_key']); //TODO: Hungarian notation } else { diff --git a/app/Libraries/Receiving_lib.php b/app/Libraries/Receiving_lib.php index c23a9bb08..025c532c2 100644 --- a/app/Libraries/Receiving_lib.php +++ b/app/Libraries/Receiving_lib.php @@ -234,7 +234,7 @@ class Receiving_lib //array records are identified by $insertkey and item_id is just another field. $price = $price != NULL ? $price : $item_info->cost_price; - if(config('OSPOS')->multi_pack_enabled) + if(config('OSPOS')->settings['multi_pack_enabled']) { $item_info->name .= NAME_SEPARATOR . $item_info->pack_name; } diff --git a/app/Libraries/Sale_lib.php b/app/Libraries/Sale_lib.php index d5d62f667..3e8eec954 100644 --- a/app/Libraries/Sale_lib.php +++ b/app/Libraries/Sale_lib.php @@ -66,7 +66,7 @@ class Sale_lib { $register_modes = []; - if(!config('OSPOS')->invoice_enable) + if(!config('OSPOS')->settings['invoice_enable']) { $register_modes['sale'] = lang('Sales.sale'); } @@ -75,7 +75,7 @@ class Sale_lib $register_modes['sale'] = lang('Sales.receipt'); $register_modes['sale_quote'] = lang('Sales.quote'); - if(config('OSPOS')->work_order_enable) + if(config('OSPOS')->settings['work_order_enable']) { $register_modes['sale_work_order'] = lang('Sales.work_order'); } @@ -131,7 +131,7 @@ class Sale_lib //TODO: This set of if/elseif/else needs to be converted to a switch statement // Entry sequence (this will render kits in the expected sequence) - if(config('OSPOS')->line_sequence == '0') + if(config('OSPOS')->settings['line_sequence'] == '0') { $sort = []; foreach($filtered_cart as $k => $v) @@ -141,7 +141,7 @@ class Sale_lib array_multisort($sort['line'], SORT_ASC, $filtered_cart); } // Group by Stock Type (nonstock first - type 1, stock next - type 0) - elseif(config('OSPOS')->line_sequence == '1') //TODO: Need to change these to constants + elseif(config('OSPOS')->settings['line_sequence'] == '1') //TODO: Need to change these to constants { $sort = []; foreach($filtered_cart as $k => $v) @@ -153,7 +153,7 @@ class Sale_lib array_multisort($sort['stock_type'], SORT_DESC, $sort['description'], SORT_ASC, $sort['name'], SORT_ASC, $filtered_cart); } // Group by Item Category - elseif(config('OSPOS')->line_sequence == '2') //TODO: Need to change these to constants + elseif(config('OSPOS')->settings['line_sequence'] == '2') //TODO: Need to change these to constants { $sort = []; foreach($filtered_cart as $k => $v) @@ -311,7 +311,7 @@ class Sale_lib public function is_invoice_mode(): bool { - return ($this->session->get('sales_mode') == 'sale_invoice' && config('OSPOS')->invoice_enable); + return ($this->session->get('sales_mode') == 'sale_invoice' && config('OSPOS')->settings['invoice_enable']); } public function is_sale_by_receipt_mode(): bool //TODO: This function is not called anywhere in the code. @@ -352,11 +352,11 @@ class Sale_lib public function is_print_after_sale(): bool {//TODO: this needs to be converted to a switch statement - if(config('OSPOS')->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 === + if(config('OSPOS')->settings['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; } - elseif(config('OSPOS')->print_receipt_check_behaviour == 'never') //TODO: === ? + elseif(config('OSPOS')->settings['print_receipt_check_behaviour'] == 'never') //TODO: === ? { return FALSE; } @@ -379,11 +379,11 @@ class Sale_lib public function is_email_receipt(): bool {//TODO: this needs to be converted to a switch statement - if(config('OSPOS')->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 === + if(config('OSPOS')->settings['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; } - elseif(config('OSPOS')->email_receipt_check_behaviour == 'never') //TODO: === ? + elseif(config('OSPOS')->settings['email_receipt_check_behaviour'] == 'never') //TODO: === ? { return FALSE; } @@ -720,7 +720,7 @@ class Sale_lib { if(!$this->session->get('dinner_table')) { - if(config('OSPOS')->dinner_table_enable) + if(config('OSPOS')->settings['dinner_table_enable']) { $this->set_dinner_table(1); //TODO: Replace 1 with constant } @@ -927,7 +927,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); - if(config('OSPOS')->multi_pack_enabled) + if(config('OSPOS')->settings['multi_pack_enabled']) { $item_info->name .= NAME_SEPARATOR . $item_info->pack_name; } @@ -1231,7 +1231,7 @@ class Sale_lib */ public function reset_cash_rounding(): int { - $cash_rounding_code = config('OSPOS')->cash_rounding_code; + $cash_rounding_code = config('OSPOS')->settings['cash_rounding_code']; if(cash_decimals() < totals_decimals() || $cash_rounding_code == Rounding_mode::HALF_FIVE) //TODO: convert to ternary notation. { @@ -1379,7 +1379,7 @@ class Sale_lib { $item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE); - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $tax_fraction = bcdiv(bcadd('100', $tax_percentage), '100'); $price_tax_excl = bcdiv($item_total, $tax_fraction); @@ -1397,7 +1397,7 @@ class Sale_lib $subtotal = '0.0'; foreach($this->get_cart() as $item) { - if($exclude_tax && config('OSPOS')->tax_included) + if($exclude_tax && config('OSPOS')->settings['tax_included']) { $subtotal = bcadd($subtotal, $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount'], $item['discount_type'], $include_discount)); } @@ -1421,7 +1421,7 @@ class Sale_lib $cash_mode = $this->session->get('cash_mode'); - if(!config('OSPOS')->tax_included) + if(!config('OSPOS')->settings['tax_included']) { $cart = $this->get_cart(); foreach($this->tax_lib->get_taxes($cart)[0] as $tax) @@ -1446,7 +1446,7 @@ class Sale_lib public function check_for_cash_rounding(string $total): string { $cash_decimals = cash_decimals(); - $cash_rounding_code = config('OSPOS')->cash_rounding_code; + $cash_rounding_code = config('OSPOS')->settings['cash_rounding_code']; return Rounding_mode::round_number($cash_rounding_code, (float)$total, $cash_decimals); } diff --git a/app/Libraries/Sms_lib.php b/app/Libraries/Sms_lib.php index b6f1d56f7..7d85280f9 100644 --- a/app/Libraries/Sms_lib.php +++ b/app/Libraries/Sms_lib.php @@ -30,9 +30,9 @@ class Sms_lib */ public function sendSMS(int $phone, string $message): bool { - $username = config('OSPOS')->msg_uid; - $password = $this->encrypter->decrypt(config('OSPOS')->msg_pwd); - $originator = config('OSPOS')->msg_src; + $username = config('OSPOS')->settings['msg_uid']; + $password = $this->encrypter->decrypt(config('OSPOS')->settings['msg_pwd']); + $originator = config('OSPOS')->settings['msg_src']; $response = FALSE; diff --git a/app/Libraries/Tax_lib.php b/app/Libraries/Tax_lib.php index 0ad18e95f..dd14eacd0 100644 --- a/app/Libraries/Tax_lib.php +++ b/app/Libraries/Tax_lib.php @@ -98,7 +98,7 @@ class Tax_lib { $taxed = FALSE; - if(!config('OSPOS')->use_destination_based_tax) + if(!config('OSPOS')->settings['use_destination_based_tax']) { // Start of current Base System tax calculations @@ -121,7 +121,7 @@ class Tax_lib $tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], TRUE); $tax_amount = '0.0'; - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $tax_type = Tax_lib::TAX_TYPE_INCLUDED; $tax_amount = $this->get_included_tax($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], $tax['percent'], $tax_decimals, Rounding_mode::HALF_UP); @@ -161,7 +161,7 @@ class Tax_lib // Start of destination based tax calculations if($item['tax_category_id'] == NULL) //TODO: === ? { - $item['tax_category_id'] = config('OSPOS')->default_tax_category; + $item['tax_category_id'] = config('OSPOS')->settings['default_tax_category']; } $taxed = $this->apply_destination_tax($item, $customer_info->city, $customer_info->state, $customer_info->sales_tax_code_id, $register_mode, 0, $taxes, $item_taxes, $item['line']); @@ -274,7 +274,7 @@ class Tax_lib } // If tax included then round decimal to tax decimals, otherwise round it to currency_decimals - if(config('OSPOS')->tax_included) //TODO: Convert to ternary notation + if(config('OSPOS')->settings['tax_included']) //TODO: Convert to ternary notation { $decimals = tax_decimals(); } @@ -405,7 +405,7 @@ class Tax_lib { if($register_mode == 'sale') { - $sales_tax_code_id = config('OSPOS')->default_tax_code; // overrides customer assigned code + $sales_tax_code_id = config('OSPOS')->settings['default_tax_code']; // overrides customer assigned code } else { @@ -415,7 +415,7 @@ class Tax_lib if($sales_tax_code_id == NULL || $sales_tax_code_id == 0) { - $sales_tax_code_id = config('OSPOS')->default_tax_code; // overrides customer assigned code + $sales_tax_code_id = config('OSPOS')->settings['default_tax_code']; // overrides customer assigned code } } } diff --git a/app/Libraries/Token_lib.php b/app/Libraries/Token_lib.php index ffba430e1..9fb654d4d 100644 --- a/app/Libraries/Token_lib.php +++ b/app/Libraries/Token_lib.php @@ -74,7 +74,7 @@ class Token_lib public function parse_barcode(string &$quantity, string &$price, string &$item_id_or_number_or_item_kit_or_receipt): void { - $barcode_formats = json_decode(config('OSPOS')->barcode_formats); + $barcode_formats = json_decode(config('OSPOS')->settings['barcode_formats']); $barcode_tokens = Token::get_barcode_tokens(); if(!empty($barcode_formats)) diff --git a/app/Models/Receiving.php b/app/Models/Receiving.php index b383892be..1bb7917f9 100644 --- a/app/Models/Receiving.php +++ b/app/Models/Receiving.php @@ -129,7 +129,7 @@ class Receiving extends Model $items_received = $item_data['receiving_quantity'] != 0 ? $item_data['quantity'] * $item_data['receiving_quantity'] : $item_data['quantity']; // update cost price, if changed AND is set in config as wanted - if($cur_item_info->cost_price != $item_data['price'] && config('OSPOS')->receiving_calculate_average_price) + if($cur_item_info->cost_price != $item_data['price'] && config('OSPOS')->settings['receiving_calculate_average_price']) { $item->change_cost_price($item_data['item_id'], $items_received, $item_data['price'], $cur_item_info->cost_price); } @@ -277,7 +277,7 @@ class Receiving extends Model { if(empty($inputs['receiving_id'])) { - if(empty(config('OSPOS')->date_or_time_format)) + if(empty(config('OSPOS')->settings['date_or_time_format'])) { $where = 'WHERE DATE(receiving_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); } diff --git a/app/Models/Reports/Summary_discounts.php b/app/Models/Reports/Summary_discounts.php index 280c45b0e..5150af074 100644 --- a/app/Models/Reports/Summary_discounts.php +++ b/app/Models/Reports/Summary_discounts.php @@ -19,7 +19,7 @@ class Summary_discounts extends Summary_report if($inputs['discount_type'] == FIXED) //TODO: if there are only two options for this if/else statement then it needs to be refactored to use ternary operators. Also ===? { - $builder->select('SUM(sales_items.discount) AS total, MAX(CONCAT("' . config('OSPOS')->currency_symbol . '",sales_items.discount)) AS discount, count(*) AS count'); + $builder->select('SUM(sales_items.discount) AS total, MAX(CONCAT("' . config('OSPOS')->settings['currency_symbol'] . '",sales_items.discount)) AS discount, count(*) AS count'); $builder->where('discount_type', FIXED); } elseif($inputs['discount_type'] == PERCENT) //TODO: === ? diff --git a/app/Models/Reports/Summary_expenses_categories.php b/app/Models/Reports/Summary_expenses_categories.php index a0e48bd6e..5ea60782c 100644 --- a/app/Models/Reports/Summary_expenses_categories.php +++ b/app/Models/Reports/Summary_expenses_categories.php @@ -21,7 +21,7 @@ class Summary_expenses_categories extends Summary_report $builder->join('expense_categories AS expense_categories', 'expense_categories.expense_category_id = expenses.expense_category_id', 'LEFT'); //TODO: convert this to ternary notation - if(empty(config('OSPOS')->date_or_time_format)) //TODO: Duplicated code + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code { $builder->where('DATE(expenses.date) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); } @@ -43,7 +43,7 @@ class Summary_expenses_categories extends Summary_report $builder = $this->db->table('expenses AS expenses'); $builder->select('SUM(expenses.amount) AS expenses_total_amount, SUM(expenses.tax_amount) AS expenses_total_tax_amount'); - if(empty(config('OSPOS')->date_or_time_format)) //TODO: Duplicated code + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code { $builder->where('DATE(expenses.date) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); } diff --git a/app/Models/Reports/Summary_payments.php b/app/Models/Reports/Summary_payments.php index 02478ce25..8c154fda9 100644 --- a/app/Models/Reports/Summary_payments.php +++ b/app/Models/Reports/Summary_payments.php @@ -34,7 +34,7 @@ class Summary_payments extends Summary_report $where = ''; //TODO: Duplicated code //TODO: this needs to be converted to ternary notation - if(empty(config('OSPOS')->date_or_time_format)) { + if(empty(config('OSPOS')->settings['date_or_time_format'])) { $where .= 'DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); } else { $where .= 'sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); diff --git a/app/Models/Reports/Summary_report.php b/app/Models/Reports/Summary_report.php index c00f9356a..8ad83da8f 100644 --- a/app/Models/Reports/Summary_report.php +++ b/app/Models/Reports/Summary_report.php @@ -11,7 +11,7 @@ abstract class Summary_report extends Report { $where = ''; //TODO: Duplicated code - if(empty(config('OSPOS')->date_or_time_format)) + if(empty(config('OSPOS')->settings['date_or_time_format'])) { $where .= 'DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); } @@ -32,7 +32,7 @@ abstract class Summary_report extends Report $cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)'; - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $sale_total = "ROUND(SUM($sale_price), $decimals) + $cash_adjustment"; $sale_subtotal = "$sale_total - $sales_tax"; @@ -101,7 +101,7 @@ abstract class Summary_report extends Report private function __common_where(array $inputs, &$builder): void { //TODO: Probably going to need to rework these since you can't reference $builder without it's instantiation. - if(empty(config('OSPOS')->date_or_time_format)) //TODO: Duplicated code + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code { $builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); } diff --git a/app/Models/Reports/Summary_sales_taxes.php b/app/Models/Reports/Summary_sales_taxes.php index 72b268142..9ead0c8c1 100644 --- a/app/Models/Reports/Summary_sales_taxes.php +++ b/app/Models/Reports/Summary_sales_taxes.php @@ -19,7 +19,7 @@ class Summary_sales_taxes extends Summary_report { $builder->where('sales.sale_status', COMPLETED); - if(empty(config('OSPOS')->date_or_time_format)) //TODO: Duplicated code + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code { $builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); } @@ -33,7 +33,7 @@ class Summary_sales_taxes extends Summary_report { $where = 'WHERE sale_status = ' . COMPLETED . ' '; - if(empty(config('OSPOS')->date_or_time_format)) + if(empty(config('OSPOS')->settings['date_or_time_format'])) { $where .= 'AND DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); diff --git a/app/Models/Reports/Summary_taxes.php b/app/Models/Reports/Summary_taxes.php index 90873a965..0800fb338 100644 --- a/app/Models/Reports/Summary_taxes.php +++ b/app/Models/Reports/Summary_taxes.php @@ -20,7 +20,7 @@ class Summary_taxes extends Summary_report { $builder->where('sales.sale_status', COMPLETED); - if(empty(config('OSPOS')->date_or_time_format)) + if(empty(config('OSPOS')->settings['date_or_time_format'])) { $builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); } @@ -34,7 +34,7 @@ class Summary_taxes extends Summary_report { $where = 'WHERE sale_status = ' . COMPLETED . ' '; //TODO: Duplicated code - if(empty(config('OSPOS')->date_or_time_format)) //TODO: Ternary notation + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Ternary notation { $where .= 'AND DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); } @@ -44,7 +44,7 @@ class Summary_taxes extends Summary_report } $decimals = totals_decimals(); - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $sale_total = '(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)" diff --git a/app/Models/Sale.php b/app/Models/Sale.php index 17ce3d308..c12b18451 100644 --- a/app/Models/Sale.php +++ b/app/Models/Sale.php @@ -46,7 +46,7 @@ class Sale extends Model . " 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'; - if(config('OSPOS')->tax_included) //TODO: This needs to be replaced with Ternary notation + if(config('OSPOS')->settings['tax_included']) //TODO: This needs to be replaced with Ternary notation { $sale_total = "ROUND(SUM($sale_price), $decimals) + $cash_adjustment"; } @@ -113,7 +113,7 @@ class Sale extends Model // Pick up only non-suspended records $where = 'sales.sale_status = 0 AND '; - if(empty(config('OSPOS')->date_or_time_format)) + if(empty(config('OSPOS')->settings['date_or_time_format'])) { $where .= 'DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']); } @@ -305,7 +305,7 @@ class Sale extends Model $builder->join('customers AS customer', 'sales.customer_id = customer.person_id', 'LEFT'); //TODO: This needs to be replaced with Ternary notation - if(empty(config('OSPOS')->date_or_time_format)) //TODO: duplicated code. We should think about refactoring out a method. + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: duplicated code. We should think about refactoring out a method. { $builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); } @@ -507,7 +507,7 @@ class Sale extends Model { return $this->exists($pieces[1]); } - elseif(config('OSPOS')->invoice_enable) + elseif(config('OSPOS')->settings['invoice_enable']) { $sale_info = $this->get_sale_by_invoice_number($receipt_sale_id); @@ -769,7 +769,7 @@ class Sale extends Model $this->save_sales_items_taxes($sale_id, $sales_taxes[1]); } - if(config('OSPOS')->dinner_table_enable) + if(config('OSPOS')->settings['dinner_table_enable']) { $dinner_table = model(Dinner_table::class); if($sale_status == COMPLETED) //TODO: === ? @@ -989,12 +989,12 @@ class Sale extends Model $builder->where('sales_items.sale_id', $sale_id); // Entry sequence (this will render kits in the expected sequence) - if(config('OSPOS')->line_sequence == '0') //TODO: Replace these with constants and this should be converted to a switch. + if(config('OSPOS')->settings['line_sequence'] == '0') //TODO: Replace these with constants and this should be converted to a switch. { $builder->orderBy('line', 'asc'); } // Group by Stock Type (nonstock first - type 1, stock next - type 0) - elseif(config('OSPOS')->line_sequence == '1') + elseif(config('OSPOS')->settings['line_sequence'] == '1') { $builder->orderBy('stock_type', 'desc'); $builder->orderBy('sales_items.description', 'asc'); @@ -1002,7 +1002,7 @@ class Sale extends Model $builder->orderBy('items.qty_per_pack', 'asc'); } // Group by Item Category - elseif(config('OSPOS')->line_sequence == '2') + elseif(config('OSPOS')->settings['line_sequence'] == '2') { $builder->orderBy('category', 'asc'); $builder->orderBy('sales_items.description', 'asc'); @@ -1154,7 +1154,7 @@ class Sale extends Model { if(empty($inputs['sale_id'])) { - if(empty(config('OSPOS')->date_or_time_format)) //TODO: This needs to be replaced with Ternary notation + if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: This needs to be replaced with Ternary notation { $where = 'DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); } @@ -1182,7 +1182,7 @@ class Sale extends Model $cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)'; - if(config('OSPOS')->tax_included) + if(config('OSPOS')->settings['tax_included']) { $sale_total = "ROUND(SUM($sale_price), $decimals) + $cash_adjustment"; $sale_subtotal = "$sale_total - $internal_tax"; @@ -1440,7 +1440,7 @@ class Sale extends Model //Run these queries as a transaction, we want to make sure we do all or nothing $this->db->transStart(); - if(config('OSPOS')->dinner_table_enable) + if(config('OSPOS')->settings['dinner_table_enable']) { $dinner_table = model(Dinner_table::class); $dinner_table_id = $this->get_dinner_table($sale_id); @@ -1462,7 +1462,7 @@ class Sale extends Model { $this->db->transStart(); - if(config('OSPOS')->dinner_table_enable) + if(config('OSPOS')->settings['dinner_table_enable']) { $dinner_table = model(Dinner_table::class); $dinner_table_id = $this->get_dinner_table($sale_id); @@ -1507,7 +1507,7 @@ class Sale extends Model */ private function save_customer_rewards(int $customer_id, int $sale_id, float $total_amount, float $total_amount_used): void { - if(!empty($customer_id) && config('OSPOS')->customer_reward_enable) + if(!empty($customer_id) && config('OSPOS')->settings['customer_reward_enable']) { $customer = model(Customer::class); $customer_rewards = model(Customer_rewards::class); diff --git a/app/Models/Tax_code.php b/app/Models/Tax_code.php index 11ac9d835..6ce9717cf 100644 --- a/app/Models/Tax_code.php +++ b/app/Models/Tax_code.php @@ -252,7 +252,7 @@ class Tax_code extends Model } else { - return config('OSPOS')->default_tax_code; + return config('OSPOS')->settings['default_tax_code']; } } diff --git a/app/Views/attributes/manage.php b/app/Views/attributes/manage.php index f9223099e..a03deece8 100644 --- a/app/Views/attributes/manage.php +++ b/app/Views/attributes/manage.php @@ -15,7 +15,7 @@ table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'definition_id' }); }); diff --git a/app/Views/cashups/manage.php b/app/Views/cashups/manage.php index 98c80b816..513f0f728 100644 --- a/app/Views/cashups/manage.php +++ b/app/Views/cashups/manage.php @@ -27,7 +27,7 @@ $(document).ready(function() table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'cashup_id', queryParams: function() { return $.extend(arguments[0], { diff --git a/app/Views/configs/message_config.php b/app/Views/configs/message_config.php index 0001316cf..a135e031a 100644 --- a/app/Views/configs/message_config.php +++ b/app/Views/configs/message_config.php @@ -13,7 +13,7 @@ 'name' => 'msg_uid', 'id' => 'msg_uid', 'class' => 'form-control input-sm required', - 'value' => esc(config('OSPOS')->msg_uid, 'attr') + 'value' => esc(config('OSPOS')->settings['msg_uid'], 'attr') ]) ?> @@ -28,7 +28,7 @@ 'name' => 'msg_pwd', 'id' => 'msg_pwd', 'class' => 'form-control input-sm required', - 'value' => esc(config('OSPOS')->msg_pwd, 'attr') + 'value' => esc(config('OSPOS')->settings['msg_pwd'], 'attr') ]) ?> @@ -43,7 +43,7 @@ 'name' => 'msg_src', 'id' => 'msg_src', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->msg_src == NULL ? esc(config('OSPOS')->company, 'attr') : esc(config('OSPOS')->msg_src, 'attr') + 'value' => config('OSPOS')->settings['msg_src'] == NULL ? esc(config('OSPOS')->settings['company'], 'attr') : esc(config('OSPOS')->settings['msg_src'], 'attr') ]) ?> @@ -56,7 +56,7 @@ 'name' => 'msg_msg', 'id' => 'msg_msg', 'class' => 'form-control input-sm', - 'value' => config('OSPOS')->msg_msg, + 'value' => config('OSPOS')->settings['msg_msg'], 'placeholder' => lang('Config.msg_msg_placeholder') ]) ?> diff --git a/app/Views/configs/receipt_config.php b/app/Views/configs/receipt_config.php index c426de925..d674638c7 100644 --- a/app/Views/configs/receipt_config.php +++ b/app/Views/configs/receipt_config.php @@ -12,7 +12,7 @@ 'receipt_default' => lang('Config.receipt_default'), 'receipt_short' => lang('Config.receipt_short') ], - esc(config('OSPOS')->receipt_template, 'attr'), + esc(config('OSPOS')->settings['receipt_template'], 'attr'), ['class' => 'form-control input-sm'] ) ?> @@ -29,7 +29,7 @@ 'name' => 'receipt_font_size', 'id' => 'receipt_font_size', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->receipt_font_size + 'value' => config('OSPOS')->settings['receipt_font_size'] ]) ?> px @@ -47,7 +47,7 @@ 'name' => 'print_delay_autoreturn', 'id' => 'print_delay_autoreturn', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->print_delay_autoreturn + 'value' => config('OSPOS')->settings['print_delay_autoreturn'] ]) ?> s @@ -61,7 +61,7 @@ 'email_receipt_check_behaviour', 'value' => 'always', - 'checked' => config('OSPOS')->email_receipt_check_behaviour == 'always' + 'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'always' ]) ?> @@ -69,7 +69,7 @@ 'email_receipt_check_behaviour', 'value' => 'never', - 'checked' => config('OSPOS')->email_receipt_check_behaviour == 'never' + 'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'never' ]) ?> @@ -77,7 +77,7 @@ 'email_receipt_check_behaviour', 'value' => 'last', - 'checked' => config('OSPOS')->email_receipt_check_behaviour == 'last' + 'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'last' ]) ?> @@ -91,7 +91,7 @@ 'print_receipt_check_behaviour', 'value' => 'always', - 'checked' => config('OSPOS')->print_receipt_check_behaviour == 'always' + 'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'always' ]) ?> @@ -99,7 +99,7 @@ 'print_receipt_check_behaviour', 'value' => 'never', - 'checked' => config('OSPOS')->print_receipt_check_behaviour == 'never' + 'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'never' ]) ?> @@ -107,7 +107,7 @@ 'print_receipt_check_behaviour', 'value' => 'last', - 'checked' => config('OSPOS')->print_receipt_check_behaviour == 'last' + 'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'last' ]) ?> @@ -121,7 +121,7 @@ 'name' => 'receipt_show_company_name', 'value' => 'receipt_show_company_name', 'id' => 'receipt_show_company_name', - 'checked' => config('OSPOS')->receipt_show_company_name + 'checked' => config('OSPOS')->settings['receipt_show_company_name'] ]) ?> @@ -133,7 +133,7 @@ 'name' => 'receipt_show_taxes', 'value' => 'receipt_show_taxes', 'id' => 'receipt_show_taxes', - 'checked' => config('OSPOS')->receipt_show_taxes + 'checked' => config('OSPOS')->settings['receipt_show_taxes'] ]) ?> @@ -145,7 +145,7 @@ 'name' => 'receipt_show_tax_ind', 'value' => 'receipt_show_tax_ind', 'id' => 'receipt_show_tax_ind', - 'checked' => config('OSPOS')->receipt_show_tax_ind + 'checked' => config('OSPOS')->settings['receipt_show_tax_ind'] ]) ?> @@ -157,7 +157,7 @@ 'name' => 'receipt_show_total_discount', 'value' => 'receipt_show_total_discount', 'id' => 'receipt_show_total_discount', - 'checked' => config('OSPOS')->receipt_show_total_discount + 'checked' => config('OSPOS')->settings['receipt_show_total_discount'] ]) ?> @@ -169,7 +169,7 @@ 'name' => 'receipt_show_description', 'value' => 'receipt_show_description', 'id' => 'receipt_show_description', - 'checked' => config('OSPOS')->receipt_show_description + 'checked' => config('OSPOS')->settings['receipt_show_description'] ]) ?> @@ -181,7 +181,7 @@ 'name' => 'receipt_show_serialnumber', 'value' => 'receipt_show_serialnumber', 'id' => 'receipt_show_serialnumber', - 'checked' => config('OSPOS')->receipt_show_serialnumber + 'checked' => config('OSPOS')->settings['receipt_show_serialnumber'] ]) ?> @@ -193,7 +193,7 @@ 'name' => 'print_silently', 'id' => 'print_silently', 'value' => 'print_silently', - 'checked' => config('OSPOS')->print_silently + 'checked' => config('OSPOS')->settings['print_silently'] ]) ?> @@ -205,7 +205,7 @@ 'name' => 'print_header', 'id' => 'print_header', 'value' => 'print_header', - 'checked' => config('OSPOS')->print_header + 'checked' => config('OSPOS')->settings['print_header'] ]) ?> @@ -217,7 +217,7 @@ 'name' => 'print_footer', 'id' => 'print_footer', 'value' => 'print_footer', - 'checked' => config('OSPOS')->print_footer + 'checked' => config('OSPOS')->settings['print_footer'] ]) ?> @@ -254,7 +254,7 @@ 'name' => 'print_top_margin', 'id' => 'print_top_margin', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->print_top_margin + 'value' => config('OSPOS')->settings['print_top_margin'] ]) ?> px @@ -272,7 +272,7 @@ 'name' => 'print_left_margin', 'id' => 'print_left_margin', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->print_left_margin + 'value' => config('OSPOS')->settings['print_left_margin'] ]) ?> px @@ -290,7 +290,7 @@ 'name' => 'print_bottom_margin', 'id' => 'print_bottom_margin', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->print_bottom_margin + 'value' => config('OSPOS')->settings['print_bottom_margin'] ]) ?> px @@ -308,7 +308,7 @@ 'name' => 'print_right_margin', 'id' => 'print_right_margin', 'class' => 'form-control input-sm required', - 'value' => config('OSPOS')->print_right_margin + 'value' => config('OSPOS')->settings['print_right_margin'] ]) ?> px diff --git a/app/Views/configs/reward_config.php b/app/Views/configs/reward_config.php index 9b67cebab..f5f9d64bb 100644 --- a/app/Views/configs/reward_config.php +++ b/app/Views/configs/reward_config.php @@ -16,7 +16,7 @@ 'name' => 'customer_reward_enable', 'value' => 'customer_reward_enable', 'id' => 'customer_reward_enable', - 'checked' => config('OSPOS')->customer_reward_enable + 'checked' => config('OSPOS')->settings['customer_reward_enable'] ]) ?> diff --git a/app/Views/configs/system_info.php b/app/Views/configs/system_info.php index e629fdf2c..f354062f1 100644 --- a/app/Views/configs/system_info.php +++ b/app/Views/configs/system_info.php @@ -18,7 +18,7 @@

- application_version) ?> - commit_sha1, 0, 6)) ?>
+ settings['application_version']) ?> - settings['commit_sha1'], 0, 6)) ?>
Language Code:

Extensions & Modules:
@@ -182,7 +182,7 @@ ?>


-
+

@@ -204,6 +204,6 @@ }); if($('#timezone').html() !== $('#ostimezone').html()) - document.getElementById("TimeError").innerHTML = '


timezone) ?>

'; + document.getElementById("TimeError").innerHTML = '


settings['timezone']) ?>

'; diff --git a/app/Views/configs/table_config.php b/app/Views/configs/table_config.php index 69c8afc4a..77bbe1f34 100644 --- a/app/Views/configs/table_config.php +++ b/app/Views/configs/table_config.php @@ -16,7 +16,7 @@ 'name' => 'dinner_table_enable', 'value' => 'dinner_table_enable', 'id' => 'dinner_table_enable', - 'checked' => config('OSPOS')->dinner_table_enable + 'checked' => config('OSPOS')->settings['dinner_table_enable'] ]) ?> diff --git a/app/Views/configs/tax_config.php b/app/Views/configs/tax_config.php index 2c926abe8..221b0f57c 100644 --- a/app/Views/configs/tax_config.php +++ b/app/Views/configs/tax_config.php @@ -19,7 +19,7 @@ 'name' => 'tax_id', 'id' => 'tax_id', 'class' => 'form-control input-sm', - 'value' => esc(config('OSPOS')->tax_id, 'attr') + 'value' => esc(config('OSPOS')->settings['tax_id'], 'attr') ]) ?> @@ -31,7 +31,7 @@ 'name' => 'tax_included', 'id' => 'tax_included', 'value' => 'tax_included', - 'checked' => config('OSPOS')->tax_included + 'checked' => config('OSPOS')->settings['tax_included'] ]) ?> @@ -43,14 +43,14 @@ 'name' => 'default_tax_1_name', 'id' => 'default_tax_1_name', 'class' => 'form-control input-sm', - 'value' => config('OSPOS')->default_tax_1_name !== FALSE ? esc(config('OSPOS')->default_tax_1_name, 'attr') : lang('Items.sales_tax_1')]) ?> + 'value' => config('OSPOS')->settings['default_tax_1_name'] !== FALSE ? esc(config('OSPOS')->settings['default_tax_1_name'], 'attr') : lang('Items.sales_tax_1')]) ?>
'default_tax_1_rate', 'id' => 'default_tax_1_rate', 'class' => 'form-control input-sm', - 'value' => to_tax_decimals(config('OSPOS')->default_tax_1_rate) + 'value' => to_tax_decimals(config('OSPOS')->settings['default_tax_1_rate']) ]) ?> %
@@ -63,7 +63,7 @@ 'name' => 'default_tax_2_name', 'id' => 'default_tax_2_name', 'class' => 'form-control input-sm', - 'value' => config('OSPOS')->default_tax_2_name !== FALSE ? esc(config('OSPOS')->default_tax_2_name, 'attr') : lang('Items.sales_tax_2') + 'value' => config('OSPOS')->settings['default_tax_2_name'] !== FALSE ? esc(config('OSPOS')->settings['default_tax_2_name'], 'attr') : lang('Items.sales_tax_2') ]) ?>
@@ -71,7 +71,7 @@ 'name' => 'default_tax_2_rate', 'id' => 'default_tax_2_rate', 'class' => 'form-control input-sm', - 'value' => to_tax_decimals(config('OSPOS')->default_tax_2_rate) + 'value' => to_tax_decimals(config('OSPOS')->settings['default_tax_2_rate']) ]) ?> %
@@ -84,7 +84,7 @@ 'name' => 'use_destination_based_tax', 'id' => 'use_destination_based_tax', 'value' => 'use_destination_based_tax', - 'checked' => config('OSPOS')->use_destination_based_tax + 'checked' => config('OSPOS')->settings['use_destination_based_tax'] ]) ?> @@ -92,21 +92,21 @@
'control-label col-xs-2']) ?>
- default_tax_code, 'attr'), ['class' => 'form-control input-sm']) ?> + settings['default_tax_code'], 'attr'), ['class' => 'form-control input-sm']) ?>
'control-label col-xs-2']) ?>
- default_tax_category, 'attr'), ['class' => 'form-control input-sm']) ?> + settings['default_tax_category'], 'attr'), ['class' => 'form-control input-sm']) ?>
'control-label col-xs-2']) ?>
- default_tax_jurisdiction, 'attr'), ['class' => 'form-control input-sm']) ?> + settings['default_tax_jurisdiction'], 'attr'), ['class' => 'form-control input-sm']) ?>
diff --git a/app/Views/expenses/manage.php b/app/Views/expenses/manage.php index cf56f5317..0d482f634 100644 --- a/app/Views/expenses/manage.php +++ b/app/Views/expenses/manage.php @@ -27,7 +27,7 @@ $(document).ready(function() table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'expense_id', onLoadSuccess: function(response) { if($("#table tbody tr").length > 1) { diff --git a/app/Views/expenses_categories/manage.php b/app/Views/expenses_categories/manage.php index f57b1e185..eaeb83714 100644 --- a/app/Views/expenses_categories/manage.php +++ b/app/Views/expenses_categories/manage.php @@ -14,7 +14,7 @@ $(document).ready(function() table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'expense_category_id', }); diff --git a/app/Views/giftcards/manage.php b/app/Views/giftcards/manage.php index 4f551bc20..67df3599e 100644 --- a/app/Views/giftcards/manage.php +++ b/app/Views/giftcards/manage.php @@ -12,7 +12,7 @@ $(document).ready(function() table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'giftcard_id' }); }); diff --git a/app/Views/item_kits/manage.php b/app/Views/item_kits/manage.php index 6fb4990f6..4a2ba4f5a 100644 --- a/app/Views/item_kits/manage.php +++ b/app/Views/item_kits/manage.php @@ -14,7 +14,7 @@ $(document).ready(function() table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'item_kit_id' }); diff --git a/app/Views/items/manage.php b/app/Views/items/manage.php index 02409ff46..f89c1ffa5 100644 --- a/app/Views/items/manage.php +++ b/app/Views/items/manage.php @@ -32,7 +32,7 @@ $(document).ready(function() // load the preset daterange picker // set the beginning of time as starting date - $('#daterangepicker').data('daterangepicker').setStartDate("dateformat, mktime(0,0,0,01,01,2010)) ?>"); + $('#daterangepicker').data('daterangepicker').setStartDate("settings['dateformat'], mktime(0,0,0,01,01,2010)) ?>"); // update the hidden inputs with the selected dates before submitting the search data var start_date = ""; $("#daterangepicker").on('apply.daterangepicker', function(ev, picker) { @@ -52,7 +52,7 @@ $(document).ready(function() employee_id: get_logged_in_employee_info()->person_id ?>, resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'items.item_id', queryParams: function() { return $.extend(arguments[0], { diff --git a/app/Views/partial/print_receipt.php b/app/Views/partial/print_receipt.php index db8129621..5a260062f 100644 --- a/app/Views/partial/print_receipt.php +++ b/app/Views/partial/print_receipt.php @@ -11,12 +11,12 @@ function printdoc() if (window.jsPrintSetup) { // set top margins in millimeters - jsPrintSetup.setOption('marginTop', 'print_top_margin ?>'); - jsPrintSetup.setOption('marginLeft', 'print_left_margin ?>'); - jsPrintSetup.setOption('marginBottom', 'print_bottom_margin ?>'); - jsPrintSetup.setOption('marginRight', 'print_right_margin ?>'); + jsPrintSetup.setOption('marginTop', 'settings['print_top_margin'] ?>'); + jsPrintSetup.setOption('marginLeft', 'settings['print_left_margin'] ?>'); + jsPrintSetup.setOption('marginBottom', 'settings['print_bottom_margin'] ?>'); + jsPrintSetup.setOption('marginRight', 'settings['print_right_margin'] ?>'); - print_header) + settings['print_header']) { ?> // set page header @@ -25,7 +25,7 @@ function printdoc() jsPrintSetup.setOption('headerStrRight', ''); print_footer) + if (!config('OSPOS')->settings['print_footer']) { ?> // set empty page footer @@ -47,7 +47,7 @@ function printdoc() // clears user preferences always silent print value // to enable using 'printSilent' option jsPrintSetup.clearSilentPrint(); - print_silently) + settings['print_silently']) { ?> // Suppress print dialog (for this context only) @@ -80,7 +80,7 @@ if($print_after_sale) // after a delay, return to sales view setTimeout(function () { window.location.href = ""; - }, print_delay_autoreturn * 1000 ?>); + }, settings['print_delay_autoreturn'] * 1000 ?>); }); ', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'people.person_id', enableActions: function() { diff --git a/app/Views/receivings/receipt.php b/app/Views/receivings/receipt.php index b1009cffb..e2bd12df9 100644 --- a/app/Views/receivings/receipt.php +++ b/app/Views/receivings/receipt.php @@ -33,25 +33,25 @@
company_logo != '') + if (config('OSPOS')->settings['company_logo'] != '') { ?> -
company_logo
+
company_logo
receipt_show_company_name) + if (config('OSPOS')->settings['receipt_show_company_name']) { ?> -
company) ?>
+
settings['company']) ?>
-
address)) ?>
-
phone) ?>
+
settings['address'])) ?>
+
settings['phone']) ?>
@@ -158,7 +158,7 @@
- return_policy)) ?> + settings['return_policy'])) ?>
diff --git a/app/Views/receivings/receiving.php b/app/Views/receivings/receiving.php index 0cb4218eb..ef0771312 100644 --- a/app/Views/receivings/receiving.php +++ b/app/Views/receivings/receiving.php @@ -204,7 +204,7 @@ if (isset($success)) 'data-toggle' => "toggle", 'data-size' => 'small', 'data-onstyle' => 'success', - 'data-on' => '' . esc(config('OSPOS')->currency_symbol, 'attr') .'', + 'data-on' => '' . esc(config('OSPOS')->settings['currency_symbol'], 'attr') .'', 'data-off' => '%', 'data-line' => esc($line, 'attr'), 'checked' => $item['discount_type'] diff --git a/app/Views/reports/graphs/pie.php b/app/Views/reports/graphs/pie.php index 115054b90..d6186251f 100644 --- a/app/Views/reports/graphs/pie.php +++ b/app/Views/reports/graphs/pie.php @@ -41,13 +41,13 @@ if( currency_side() ) { ?> - return value + 'currency_symbol, 'js') ?>'; + return value + 'settings['currency_symbol'], 'js') ?>'; - return 'currency_symbol, 'js') ?>' + value; + return 'settings['currency_symbol'], 'js') ?>' + value; 'required control-label col-xs-2']) ?>
- default_sales_discount_type, 'attr'), ['id' => 'discount_type_id', 'class' => 'form-control']) ?> + settings['default_sales_discount_type'], 'attr'), ['id' => 'discount_type_id', 'class' => 'form-control']) ?>
'form-control input-sm required', 'type' => 'number', 'min' => 0, - 'value' => config('OSPOS')->default_sales_discount]) ?> + 'value' => config('OSPOS')->settings['default_sales_discount']]) ?>
lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, sortable: true, showExport: true, exportDataType: 'all', diff --git a/app/Views/reports/tabular_details.php b/app/Views/reports/tabular_details.php index 1d1949965..10342fac4 100644 --- a/app/Views/reports/tabular_details.php +++ b/app/Views/reports/tabular_details.php @@ -36,7 +36,7 @@ var details_data = ; customer_reward_enable == TRUE && !empty($details_data_rewards)) //TODO: === ? + if(config('OSPOS')->settings['customer_reward_enable'] == TRUE && !empty($details_data_rewards)) //TODO: === ? { ?> var details_data_rewards = ; @@ -63,7 +63,7 @@ stickyHeader: true, stickyHeaderOffsetLeft: $('#table').offset().left + 'px', stickyHeaderOffsetRight: $('#table').offset().right + 'px', - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, pagination: true, sortable: true, showColumns: true, @@ -88,7 +88,7 @@ }); customer_reward_enable == TRUE && !empty($details_data_rewards)) + if(config('OSPOS')->settings['customer_reward_enable'] == TRUE && !empty($details_data_rewards)) { ?> $detail.append('
').find("table").bootstrapTable({ diff --git a/app/Views/sales/manage.php b/app/Views/sales/manage.php index 6af471431..0c0457f20 100644 --- a/app/Views/sales/manage.php +++ b/app/Views/sales/manage.php @@ -36,7 +36,7 @@ $(document).ready(function() table_support.init({ resource: '', headers: , - pageSize: lines_per_page ?>, + pageSize: settings['lines_per_page'] ?>, uniqueId: 'sale_id', onLoadSuccess: function(response) { if($("#table tbody tr").length > 1) { diff --git a/app/Views/sales/quote.php b/app/Views/sales/quote.php index a0cd4462c..a3fbafeb7 100644 --- a/app/Views/sales/quote.php +++ b/app/Views/sales/quote.php @@ -75,19 +75,19 @@ if (isset($error_message)) @@ -228,7 +228,7 @@ if (isset($error_message)) if (window.jsPrintSetup) { print_header) + if(!config('OSPOS')->settings['print_header']) { ?> // set page header @@ -238,7 +238,7 @@ if (isset($error_message)) print_footer) + if(!config('OSPOS')->settings['print_footer']) { ?> // set empty page footer diff --git a/app/Views/sales/quote_email.php b/app/Views/sales/quote_email.php index ac870779a..49036ca10 100644 --- a/app/Views/sales/quote_email.php +++ b/app/Views/sales/quote_email.php @@ -34,10 +34,10 @@ @@ -154,10 +154,10 @@
- payment_message)) ?> - quote_default_comments : esc($comments)) ?> + settings['payment_message'])) ?> + settings['quote_default_comments'] : esc($comments)) ?>
- return_policy)) ?> + settings['return_policy'])) ?>
diff --git a/app/Views/sales/receipt.php b/app/Views/sales/receipt.php index d4aa6048a..ed2c2a924 100644 --- a/app/Views/sales/receipt.php +++ b/app/Views/sales/receipt.php @@ -55,6 +55,6 @@ if (isset($error_message))
-receipt_template) ?> +settings['receipt_template']) ?> diff --git a/app/Views/sales/receipt_default.php b/app/Views/sales/receipt_default.php index 581a7aed1..4a49ef628 100644 --- a/app/Views/sales/receipt_default.php +++ b/app/Views/sales/receipt_default.php @@ -16,30 +16,30 @@ */ ?> -
+
company_logo != '') + if(config('OSPOS')->settings['company_logo != '') { ?>
- company_logo + company_logo
receipt_show_company_name) + if(config('OSPOS')->settings['receipt_show_company_name']) { ?> -
company ?>
+
settings['company'] ?>
-
address)) ?>
-
phone) ?>
+
settings['address'])) ?>
+
settings['phone']) ?>
@@ -75,7 +75,7 @@
receipt_show_tax_ind) + if(config('OSPOS')->settings['receipt_show_tax_ind']) { ?> @@ -93,9 +93,9 @@ - + receipt_show_tax_ind) + if(config('OSPOS')->settings['receipt_show_tax_ind']) { ?> @@ -105,14 +105,14 @@ receipt_show_description) + if(config('OSPOS')->settings['receipt_show_description']) { ?> receipt_show_serialnumber) + if(config('OSPOS')->settings['receipt_show_serialnumber']) { ?> @@ -148,7 +148,7 @@ ?> receipt_show_total_discount && $discount > 0) + if(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0) { ?> @@ -164,7 +164,7 @@ ?> receipt_show_taxes) + if(config('OSPOS')->settings['receipt_show_taxes']) { ?> @@ -189,7 +189,7 @@ - receipt_show_taxes && !(config('OSPOS')->receipt_show_total_discount && $discount > 0)); ?> + settings['receipt_show_taxes'] && !(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)); ?> @@ -238,7 +238,7 @@
- company) ?> + settings['company']) ?>
receipt_show_total_discount ? 'total' : 'discounted_total')]) ?>settings['receipt_show_total_discount'] ? 'total' : 'discounted_total')]) ?>
- return_policy) ?> + settings['return_policy']) ?>
diff --git a/app/Views/sales/receipt_email.php b/app/Views/sales/receipt_email.php index 424e15e97..2e7597ed8 100644 --- a/app/Views/sales/receipt_email.php +++ b/app/Views/sales/receipt_email.php @@ -16,27 +16,27 @@
company_logo != '') + if(config('OSPOS')->settings['company_logo'] != '') { ?>
- company_logo + company_logo
receipt_show_company_name) + if(config('OSPOS')->settings['receipt_show_company_name']) { ?> -
company) ?>
+
settings['company']) ?>
-
address)) ?>
-
phone) ?>
+
settings['address'])) ?>
+
settings['phone']) ?>

@@ -77,18 +77,18 @@ - receipt_show_total_discount ? 'total' : 'discounted_total')]) ?> + settings['receipt_show_total_discount'] ? 'total' : 'discounted_total')]) ?> receipt_show_description) + if(config('OSPOS')->settings['receipt_show_description']) { ?> receipt_show_serialnumber) + if(config('OSPOS')->settings['receipt_show_serialnumber']) { ?> @@ -122,7 +122,7 @@ } } - if(config('OSPOS')->receipt_show_total_discount && $discount > 0) + if(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0) { ?> @@ -138,7 +138,7 @@ ?> receipt_show_taxes) + if(config('OSPOS')->settings['receipt_show_taxes']) { ?> @@ -163,7 +163,7 @@ - receipt_show_taxes && !(config('OSPOS')->receipt_show_total_discount && $discount > 0)) ?> + settings['receipt_show_taxes'] && !(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)) ?> @@ -216,7 +216,7 @@
- return_policy)) ?> + settings['return_policy'])) ?>

diff --git a/app/Views/sales/receipt_short.php b/app/Views/sales/receipt_short.php index e8db5beff..662adb416 100644 --- a/app/Views/sales/receipt_short.php +++ b/app/Views/sales/receipt_short.php @@ -13,30 +13,30 @@ * @var string $barcode */ ?> -
+
company_logo != '') + if(config('OSPOS')->settings['company_logo != '') { ?>
- company_logo + company_logo
receipt_show_company_name) + if(config('OSPOS')->settings['receipt_show_company_name']) { ?> -
company) ?>
+
settings['company']) ?>
-
address)) ?>
-
phone) ?>
+
settings['address'])) ?>
+
settings['phone']) ?>
@@ -78,11 +78,11 @@ - receipt_show_total_discount ? 'total' : 'discounted_total')]) ?> + settings['receipt_show_total_discount'] ? 'total' : 'discounted_total')]) ?> receipt_show_description) + if(config('OSPOS')->settings['receipt_show_description']) { ?> @@ -90,7 +90,7 @@ } ?> receipt_show_serialnumber) + if(config('OSPOS')->settings['receipt_show_serialnumber']) { ?> @@ -128,7 +128,7 @@ ?> receipt_show_total_discount && $discount > 0) + if(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0) { ?> @@ -144,7 +144,7 @@ ?> receipt_show_taxes) + if(config('OSPOS')->settings['receipt_show_taxes']) { ?> @@ -169,7 +169,7 @@ - receipt_show_taxes && !(config('OSPOS')->receipt_show_total_discount && $discount > 0)); ?> + settings['receipt_show_taxes'] && !(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)); ?> @@ -211,7 +211,7 @@
- return_policy)) ?> + settings['return_policy'])) ?>
diff --git a/app/Views/sales/register.php b/app/Views/sales/register.php index 46227a2cd..2a183515a 100644 --- a/app/Views/sales/register.php +++ b/app/Views/sales/register.php @@ -73,7 +73,7 @@ if(isset($success)) "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?> dinner_table_enable == TRUE) + if(config('OSPOS')->settings['dinner_table_enable'] == TRUE) { ?>
  • @@ -240,7 +240,7 @@ if(isset($success))
    '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('OSPOS')->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('OSPOS')->settings['currency_symbol'] . '', 'data-off' => '%', 'data-line' => esc($line), 'checked' => $item['discount_type']]) ?>
    @@ -391,7 +391,7 @@ if(isset($success)) - customer_reward_enable == TRUE): ?> + settings['customer_reward_enable'] == TRUE): ?>
  • invoice_enable == TRUE) + if(($mode == 'sale_invoice') && config('OSPOS')->settings['invoice_enable'] == TRUE) { ?>
    @@ -849,7 +849,7 @@ $(document).ready(function() }); invoice_enable == TRUE) + if(config('OSPOS')->settings['invoice_enable'] == TRUE) { ?> $('#sales_invoice_number').keyup(function() { diff --git a/app/Views/sales/suspended.php b/app/Views/sales/suspended.php index 0f08480c6..fd914dc1f 100644 --- a/app/Views/sales/suspended.php +++ b/app/Views/sales/suspended.php @@ -22,7 +22,7 @@ use App\Models\Customer; dinner_table_enable == TRUE) + if(config('OSPOS')->settings['dinner_table_enable'] == TRUE) { ?> @@ -42,9 +42,9 @@ use App\Models\Customer; ?> - dateformat, strtotime($suspended_sale['sale_time'])) ?> + settings['dateformat'], strtotime($suspended_sale['sale_time'])) ?> dinner_table_enable == TRUE) + if(config('OSPOS')->settings['dinner_table_enable'] == TRUE) { ?> Dinner_table->get_name($suspended_sale['dinner_table_id'])) ?> diff --git a/app/Views/sales/tax_invoice.php b/app/Views/sales/tax_invoice.php index 445f8fe0b..634f78bbb 100644 --- a/app/Views/sales/tax_invoice.php +++ b/app/Views/sales/tax_invoice.php @@ -79,19 +79,19 @@ $(document).ready(function()