Load OSPOS app settings to variable

- refactor class and variable
- Refactor references to OSPOS configuration
- Replaced " with ' in PHP where parser was not needed
This commit is contained in:
objecttothis
2022-12-01 12:13:46 +04:00
committed by Steve Ireland
parent 3761c75711
commit f343c6988e
56 changed files with 266 additions and 266 deletions

View File

@@ -11,5 +11,5 @@ use CodeIgniter\Config\BaseConfig;
*/
class OSPOS extends BaseConfig
{
public $settings = [];
}

View File

@@ -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 = [

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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' => '&nbsp', '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;
}

View File

@@ -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);

View File

@@ -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
{

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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
}
}
}

View File

@@ -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))

View File

@@ -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']);
}

View File

@@ -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: === ?

View File

@@ -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']));
}

View File

@@ -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']));

View File

@@ -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']));
}

View File

@@ -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']);

View File

@@ -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)"

View File

@@ -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);

View File

@@ -252,7 +252,7 @@ class Tax_code extends Model
}
else
{
return config('OSPOS')->default_tax_code;
return config('OSPOS')->settings['default_tax_code'];
}
}

View File

@@ -15,7 +15,7 @@
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers, 'js') ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'definition_id'
});
});

View File

@@ -27,7 +27,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers, 'js') ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'cashup_id',
queryParams: function() {
return $.extend(arguments[0], {

View File

@@ -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')
]) ?>
</div>
</div>
@@ -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')
]) ?>
</div>
</div>
@@ -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')
]) ?>
</div>
</div>
@@ -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')
]) ?>
</div>

View File

@@ -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']
) ?>
</div>
@@ -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']
]) ?>
<span class="input-group-addon input-sm">px</span>
</div>
@@ -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']
]) ?>
<span class="input-group-addon input-sm">s</span>
</div>
@@ -61,7 +61,7 @@
<?php echo form_radio ([
'name' => 'email_receipt_check_behaviour',
'value' => 'always',
'checked' => config('OSPOS')->email_receipt_check_behaviour == 'always'
'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'always'
]) ?>
<?php echo lang('Config.email_receipt_check_behaviour_always') ?>
</label>
@@ -69,7 +69,7 @@
<?php echo form_radio ([
'name' => 'email_receipt_check_behaviour',
'value' => 'never',
'checked' => config('OSPOS')->email_receipt_check_behaviour == 'never'
'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'never'
]) ?>
<?php echo lang('Config.email_receipt_check_behaviour_never') ?>
</label>
@@ -77,7 +77,7 @@
<?php echo form_radio ([
'name' => 'email_receipt_check_behaviour',
'value' => 'last',
'checked' => config('OSPOS')->email_receipt_check_behaviour == 'last'
'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'last'
]) ?>
<?php echo lang('Config.email_receipt_check_behaviour_last') ?>
</label>
@@ -91,7 +91,7 @@
<?php echo form_radio ([
'name' => 'print_receipt_check_behaviour',
'value' => 'always',
'checked' => config('OSPOS')->print_receipt_check_behaviour == 'always'
'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'always'
]) ?>
<?php echo lang('Config.print_receipt_check_behaviour_always') ?>
</label>
@@ -99,7 +99,7 @@
<?php echo form_radio ([
'name' => 'print_receipt_check_behaviour',
'value' => 'never',
'checked' => config('OSPOS')->print_receipt_check_behaviour == 'never'
'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'never'
]) ?>
<?php echo lang('Config.print_receipt_check_behaviour_never') ?>
</label>
@@ -107,7 +107,7 @@
<?php echo form_radio ([
'name' => 'print_receipt_check_behaviour',
'value' => 'last',
'checked' => config('OSPOS')->print_receipt_check_behaviour == 'last'
'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'last'
]) ?>
<?php echo lang('Config.print_receipt_check_behaviour_last') ?>
</label>
@@ -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']
]) ?>
</div>
</div>
@@ -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']
]) ?>
</div>
</div>
@@ -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']
]) ?>
</div>
</div>
@@ -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']
]) ?>
</div>
</div>
@@ -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']
]) ?>
</div>
</div>
@@ -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']
]) ?>
</div>
</div>
@@ -193,7 +193,7 @@
'name' => 'print_silently',
'id' => 'print_silently',
'value' => 'print_silently',
'checked' => config('OSPOS')->print_silently
'checked' => config('OSPOS')->settings['print_silently']
]) ?>
</div>
</div>
@@ -205,7 +205,7 @@
'name' => 'print_header',
'id' => 'print_header',
'value' => 'print_header',
'checked' => config('OSPOS')->print_header
'checked' => config('OSPOS')->settings['print_header']
]) ?>
</div>
</div>
@@ -217,7 +217,7 @@
'name' => 'print_footer',
'id' => 'print_footer',
'value' => 'print_footer',
'checked' => config('OSPOS')->print_footer
'checked' => config('OSPOS')->settings['print_footer']
]) ?>
</div>
</div>
@@ -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']
]) ?>
<span class="input-group-addon input-sm">px</span>
</div>
@@ -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']
]) ?>
<span class="input-group-addon input-sm">px</span>
</div>
@@ -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']
]) ?>
<span class="input-group-addon input-sm">px</span>
</div>
@@ -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']
]) ?>
<span class="input-group-addon input-sm">px</span>
</div>

View File

@@ -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']
]) ?>
</div>
</div>

View File

@@ -18,7 +18,7 @@
</div>
<div class="col-sm-8" id="issuetemplate" style="text-align: left;"><br>
<?php echo lang('Config.ospos_info') . ':' ?>
<?php echo esc(config('OSPOS')->application_version) ?> - <?php echo esc(substr(config('OSPOS')->commit_sha1, 0, 6)) ?><br>
<?php echo esc(config('OSPOS')->settings['application_version']) ?> - <?php echo esc(substr(config('OSPOS')->settings['commit_sha1'], 0, 6)) ?><br>
Language Code: <?php echo current_language_code() ?><br><br>
<div id="TimeError"></div>
Extensions & Modules:<br>
@@ -182,7 +182,7 @@
?>
<br>
<div id="timezone" style="font-weight:600;"></div><br><br>
<div id="ostimezone" style="display:none;" ><?php echo esc(config('OSPOS')->timezone) ?></div><br>
<div id="ostimezone" style="display:none;" ><?php echo esc(config('OSPOS')->settings['timezone']) ?></div><br>
<br>
</div>
</div>
@@ -204,6 +204,6 @@
});
if($('#timezone').html() !== $('#ostimezone').html())
document.getElementById("TimeError").innerHTML = '<span style="color: red;"><?php echo lang('Config.timezone_error') ?></span><br><br><?php echo lang('Config.user_timezone') ?><div id="timezoneE" style="font-weight:600;"></div><br><?php echo lang('Config.os_timezone') ?><div id="ostimezoneE" style="font-weight:600;"><?php echo esc(config('OSPOS')->timezone) ?></div><br>';
document.getElementById("TimeError").innerHTML = '<span style="color: red;"><?php echo lang('Config.timezone_error') ?></span><br><br><?php echo lang('Config.user_timezone') ?><div id="timezoneE" style="font-weight:600;"></div><br><?php echo lang('Config.os_timezone') ?><div id="ostimezoneE" style="font-weight:600;"><?php echo esc(config('OSPOS')->settings['timezone']) ?></div><br>';
</script>
</div>

View File

@@ -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']
]) ?>
</div>
</div>

View File

@@ -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')
]) ?>
</div>
</div>
@@ -31,7 +31,7 @@
'name' => 'tax_included',
'id' => 'tax_included',
'value' => 'tax_included',
'checked' => config('OSPOS')->tax_included
'checked' => config('OSPOS')->settings['tax_included']
]) ?>
</div>
</div>
@@ -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')]) ?>
</div>
<div class="col-xs-1 input-group">
<?php echo form_input ([
'name' => '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'])
]) ?>
<span class="input-group-addon input-sm">%</span>
</div>
@@ -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')
]) ?>
</div>
<div class="col-xs-1 input-group">
@@ -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'])
]) ?>
<span class="input-group-addon input-sm">%</span>
</div>
@@ -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']
]) ?>
</div>
</div>
@@ -92,21 +92,21 @@
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.default_tax_code'), 'default_tax_code', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown('default_tax_code', esc($tax_code_options, 'attr'), esc(config('OSPOS')->default_tax_code, 'attr'), ['class' => 'form-control input-sm']) ?>
<?php echo form_dropdown('default_tax_code', esc($tax_code_options, 'attr'), esc(config('OSPOS')->settings['default_tax_code'], 'attr'), ['class' => 'form-control input-sm']) ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.default_tax_category'), 'default_tax_category', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown('default_tax_category', esc($tax_category_options, 'attr'), esc(config('OSPOS')->default_tax_category, 'attr'), ['class' => 'form-control input-sm']) ?>
<?php echo form_dropdown('default_tax_category', esc($tax_category_options, 'attr'), esc(config('OSPOS')->settings['default_tax_category'], 'attr'), ['class' => 'form-control input-sm']) ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.default_tax_jurisdiction'), 'default_tax_jurisdiction', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown('default_tax_jurisdiction', esc($tax_jurisdiction_options, 'attr'), esc(config('OSPOS')->default_tax_jurisdiction, 'attr'), ['class' => 'form-control input-sm']) ?>
<?php echo form_dropdown('default_tax_jurisdiction', esc($tax_jurisdiction_options, 'attr'), esc(config('OSPOS')->settings['default_tax_jurisdiction'], 'attr'), ['class' => 'form-control input-sm']) ?>
</div>
</div>

View File

@@ -27,7 +27,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers) ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'expense_id',
onLoadSuccess: function(response) {
if($("#table tbody tr").length > 1) {

View File

@@ -14,7 +14,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers) ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'expense_category_id',
});

View File

@@ -12,7 +12,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers) ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'giftcard_id'
});
});

View File

@@ -14,7 +14,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers) ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'item_kit_id'
});

View File

@@ -32,7 +32,7 @@ $(document).ready(function()
// load the preset daterange picker
<?php echo view('partial/daterangepicker') ?>
// set the beginning of time as starting date
$('#daterangepicker').data('daterangepicker').setStartDate("<?php echo date(config('OSPOS')->dateformat, mktime(0,0,0,01,01,2010)) ?>");
$('#daterangepicker').data('daterangepicker').setStartDate("<?php echo date(config('OSPOS')->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 = "<?php echo date('Y-m-d', mktime(0,0,0,01,01,2010)) ?>";
$("#daterangepicker").on('apply.daterangepicker', function(ev, picker) {
@@ -52,7 +52,7 @@ $(document).ready(function()
employee_id: <?php echo $employee->get_logged_in_employee_info()->person_id ?>,
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers, 'js') ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'items.item_id',
queryParams: function() {
return $.extend(arguments[0], {

View File

@@ -11,12 +11,12 @@ function printdoc()
if (window.jsPrintSetup)
{
// set top margins in millimeters
jsPrintSetup.setOption('marginTop', '<?php echo config('OSPOS')->print_top_margin ?>');
jsPrintSetup.setOption('marginLeft', '<?php echo config('OSPOS')->print_left_margin ?>');
jsPrintSetup.setOption('marginBottom', '<?php echo config('OSPOS')->print_bottom_margin ?>');
jsPrintSetup.setOption('marginRight', '<?php echo config('OSPOS')->print_right_margin ?>');
jsPrintSetup.setOption('marginTop', '<?php echo config('OSPOS')->settings['print_top_margin'] ?>');
jsPrintSetup.setOption('marginLeft', '<?php echo config('OSPOS')->settings['print_left_margin'] ?>');
jsPrintSetup.setOption('marginBottom', '<?php echo config('OSPOS')->settings['print_bottom_margin'] ?>');
jsPrintSetup.setOption('marginRight', '<?php echo config('OSPOS')->settings['print_right_margin'] ?>');
<?php if (!config('OSPOS')->print_header)
<?php if (!config('OSPOS')->settings['print_header'])
{
?>
// set page header
@@ -25,7 +25,7 @@ function printdoc()
jsPrintSetup.setOption('headerStrRight', '');
<?php
}
if (!config('OSPOS')->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();
<?php if (!config('OSPOS')->print_silently)
<?php if (!config('OSPOS')->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 = "<?php echo site_url('sales') ?>";
}, <?php echo config('OSPOS')->print_delay_autoreturn * 1000 ?>);
}, <?php echo config('OSPOS')->settings['print_delay_autoreturn'] * 1000 ?>);
});
<?php

View File

@@ -14,7 +14,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($table_headers, 'js') ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'people.person_id',
enableActions: function()
{

View File

@@ -33,25 +33,25 @@
<div id="receipt_wrapper">
<div id="receipt_header">
<?php
if (config('OSPOS')->company_logo != '')
if (config('OSPOS')->settings['company_logo'] != '')
{
?>
<div id="company_name"><img id="image" src="<?php echo esc(base_url('uploads/' . config('OSPOS')->company_logo), 'url') ?>" alt="company_logo" /></div>
<div id="company_name"><img id="image" src="<?php echo esc(base_url('uploads/' . config('OSPOS')->settings['company_logo']), 'url') ?>" alt="company_logo" /></div>
<?php
}
?>
<?php
if (config('OSPOS')->receipt_show_company_name)
if (config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name"><?php echo esc(config('OSPOS')->company) ?></div>
<div id="company_name"><?php echo esc(config('OSPOS')->settings['company']) ?></div>
<?php
}
?>
<div id="company_address"><?php echo esc(nl2br(config('OSPOS')->address)) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->phone) ?></div>
<div id="company_address"><?php echo esc(nl2br(config('OSPOS')->settings['address'])) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->settings['phone']) ?></div>
<div id="sale_receipt"><?php echo lang('Receivings.receipt') ?></div>
<div id="sale_time"><?php echo esc($transaction_time) ?></div>
</div>
@@ -158,7 +158,7 @@
</table>
<div id="sale_return_policy">
<?php echo esc(nl2br(config('OSPOS')->return_policy)) ?>
<?php echo esc(nl2br(config('OSPOS')->settings['return_policy'])) ?>
</div>
<div id='barcode'>

View File

@@ -204,7 +204,7 @@ if (isset($success))
'data-toggle' => "toggle",
'data-size' => 'small',
'data-onstyle' => 'success',
'data-on' => '<b>' . esc(config('OSPOS')->currency_symbol, 'attr') .'</b>',
'data-on' => '<b>' . esc(config('OSPOS')->settings['currency_symbol'], 'attr') .'</b>',
'data-off' => '<b>%</b>',
'data-line' => esc($line, 'attr'),
'checked' => $item['discount_type']

View File

@@ -41,13 +41,13 @@
if( currency_side() )
{
?>
return value + '<?php echo esc(config('OSPOS')->currency_symbol, 'js') ?>';
return value + '<?php echo esc(config('OSPOS')->settings['currency_symbol'], 'js') ?>';
<?php
}
else
{
?>
return '<?php echo esc(config('OSPOS')->currency_symbol, 'js') ?>' + value;
return '<?php echo esc(config('OSPOS')->settings['currency_symbol'], 'js') ?>' + value;
<?php
}
}

View File

@@ -36,7 +36,7 @@ if(isset($error))
<div class="form-group form-group-sm">
<?php echo form_label(lang('Reports.discount_type'), 'reports_discount_type_label', ['class' => 'required control-label col-xs-2']) ?>
<div id='report_discount_type' class="col-xs-3">
<?php echo form_dropdown('discount_type', esc($discount_type_options, 'attr'), esc(config('OSPOS')->default_sales_discount_type, 'attr'), ['id' => 'discount_type_id', 'class' => 'form-control']) ?>
<?php echo form_dropdown('discount_type', esc($discount_type_options, 'attr'), esc(config('OSPOS')->settings['default_sales_discount_type'], 'attr'), ['id' => 'discount_type_id', 'class' => 'form-control']) ?>
</div>
</div>
<?php
@@ -60,7 +60,7 @@ if(isset($error))
'class' => 'form-control input-sm required',
'type' => 'number',
'min' => 0,
'value' => config('OSPOS')->default_sales_discount]) ?>
'value' => config('OSPOS')->settings['default_sales_discount']]) ?>
</div>
<?php
}

View File

@@ -54,7 +54,7 @@
stickyHeader: true,
stickyHeaderOffsetLeft: $('#table').offset().left + 'px',
stickyHeaderOffsetRight: $('#table').offset().right + 'px',
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
sortable: true,
showExport: true,
exportDataType: 'all',

View File

@@ -36,7 +36,7 @@
var details_data = <?php echo json_encode(esc($details_data, 'js')) ?>;
<?php
if(config('OSPOS')->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 = <?php echo json_encode(esc($details_data_rewards, 'js')) ?>;
@@ -63,7 +63,7 @@
stickyHeader: true,
stickyHeaderOffsetLeft: $('#table').offset().left + 'px',
stickyHeaderOffsetRight: $('#table').offset().right + 'px',
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
pagination: true,
sortable: true,
showColumns: true,
@@ -88,7 +88,7 @@
});
<?php
if(config('OSPOS')->customer_reward_enable == TRUE && !empty($details_data_rewards))
if(config('OSPOS')->settings['customer_reward_enable'] == TRUE && !empty($details_data_rewards))
{
?>
$detail.append('<table></table>').find("table").bootstrapTable({

View File

@@ -36,7 +36,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name),'url') ?>',
headers: <?php echo esc($table_headers, 'js') ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'sale_id',
onLoadSuccess: function(response) {
if($("#table tbody tr").length > 1) {

View File

@@ -75,19 +75,19 @@ if (isset($error_message))
<div id="logo">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo'] != '')
{
?>
<img id="image" src="<?php echo base_url('uploads/' . esc(config('OSPOS')->company_logo, 'url')) ?>" alt="company_logo" />
<img id="image" src="<?php echo base_url('uploads/' . esc(config('OSPOS')->settings['company_logo'], 'url')) ?>" alt="company_logo" />
<?php
}
?>
<div>&nbsp</div>
<?php
if(config('OSPOS')->receipt_show_company_name)
if(config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name"><?php echo esc(config('OSPOS')->company) ?></div>
<div id="company_name"><?php echo esc(config('OSPOS')->settings['company']) ?></div>
<?php
}
?>
@@ -215,7 +215,7 @@ if (isset($error_message))
<div id="sale_return_policy">
<h5>
<span style='padding:4%;'><?php echo empty($comments) ? '' : lang('Sales.comments') . ': ' . esc($comments) ?></span>
<span style='padding:4%;'><?php echo esc(config('OSPOS')->quote_default_comments) ?></span>
<span style='padding:4%;'><?php echo esc(config('OSPOS')->settings['quote_default_comments']) ?></span>
</h5>
</div>
</div>
@@ -228,7 +228,7 @@ if (isset($error_message))
if (window.jsPrintSetup)
{
<?php
if(!config('OSPOS')->print_header)
if(!config('OSPOS')->settings['print_header'])
{
?>
// set page header
@@ -238,7 +238,7 @@ if (isset($error_message))
<?php
}
if(!config('OSPOS')->print_footer)
if(!config('OSPOS')->settings['print_footer'])
{
?>
// set empty page footer

View File

@@ -34,10 +34,10 @@
<table id="info">
<tr>
<td id="logo">
<?php if(config('OSPOS')->company_logo != '')
<?php if(config('OSPOS')->settings['company_logo'] != '')
{
?>
<img id="image" src="<?php echo 'uploads/' . esc(config('OSPOS')->company_logo,'url') ?>" alt="company_logo" />
<img id="image" src="<?php echo 'uploads/' . esc(config('OSPOS')->settings['company_logo'],'url') ?>" alt="company_logo" />
<?php
}
?>
@@ -49,7 +49,7 @@
<tr>
<td id="company-title">
<div id="company">
<?php echo esc(config('OSPOS')->company) ?>
<?php echo esc(config('OSPOS')->settings['company']) ?>
<?php echo nl2br(esc($company_info)) ?>
</div>
</td>
@@ -154,10 +154,10 @@
<div id="terms">
<div id="sale_return_policy">
<h5>
<span><?php echo nl2br(esc(config('OSPOS')->payment_message)) ?></span>
<span><?php echo lang('Sales.comments') . ': ' . (empty($comments) ? config('OSPOS')->quote_default_comments : esc($comments)) ?></span>
<span><?php echo nl2br(esc(config('OSPOS')->settings['payment_message'])) ?></span>
<span><?php echo lang('Sales.comments') . ': ' . (empty($comments) ? config('OSPOS')->settings['quote_default_comments'] : esc($comments)) ?></span>
</h5>
<?php echo nl2br(esc(config('OSPOS')->return_policy)) ?>
<?php echo nl2br(esc(config('OSPOS')->settings['return_policy'])) ?>
</div>
<div id='barcode'>
<?php echo $quote_number ?>

View File

@@ -55,6 +55,6 @@ if (isset($error_message))
<?php endif; ?>
</div>
<?php echo view('sales/' . config('OSPOS')->receipt_template) ?>
<?php echo view('sales/' . config('OSPOS')->settings['receipt_template']) ?>
<?php echo view('partial/footer') ?>

View File

@@ -16,30 +16,30 @@
*/
?>
<div id="receipt_wrapper" style="font-size:<?php echo config('OSPOS')->receipt_font_size ?>px">
<div id="receipt_wrapper" style="font-size:<?php echo config('OSPOS')->settings['receipt_font_size ?>px">
<div id="receipt_header">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo != '')
{
?>
<div id="company_name">
<img id="image" src="<?php echo base_url('uploads/' . esc(config('OSPOS')->company_logo, 'url')) ?>" alt="company_logo" />
<img id="image" src="<?php echo base_url('uploads/' . esc(config('OSPOS')->settings['company_logo'], 'url')) ?>" alt="company_logo" />
</div>
<?php
}
?>
<?php
if(config('OSPOS')->receipt_show_company_name)
if(config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name"><?php echo config('OSPOS')->company ?></div>
<div id="company_name"><?php echo config('OSPOS')->settings['company'] ?></div>
<?php
}
?>
<div id="company_address"><?php echo nl2br(esc(config('OSPOS')->address)) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->phone) ?></div>
<div id="company_address"><?php echo nl2br(esc(config('OSPOS')->settings['address'])) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->settings['phone']) ?></div>
<div id="sale_receipt"><?php echo lang('Sales.receipt') ?></div>
<div id="sale_time"><?php echo($transaction_time) ?></div>
</div>
@@ -75,7 +75,7 @@
<th style="width:20%;"><?php echo lang('Sales.quantity') ?></th>
<th style="width:20%;" class="total-value"><?php echo lang('Sales.total') ?></th>
<?php
if(config('OSPOS')->receipt_show_tax_ind)
if(config('OSPOS')->settings['receipt_show_tax_ind'])
{
?>
<th style="width:20%;"></th>
@@ -93,9 +93,9 @@
<td><?php echo esc(ucfirst($item['name'] . ' ' . $item['attribute_values'])) ?></td>
<td><?php echo to_currency($item['price']) ?></td>
<td><?php echo to_quantity_decimals($item['quantity']) ?></td>
<td class="total-value"><?php echo to_currency($item[(config('OSPOS')->receipt_show_total_discount ? 'total' : 'discounted_total')]) ?></td>
<td class="total-value"><?php echo to_currency($item[(config('OSPOS')->settings['receipt_show_total_discount'] ? 'total' : 'discounted_total')]) ?></td>
<?php
if(config('OSPOS')->receipt_show_tax_ind)
if(config('OSPOS')->settings['receipt_show_tax_ind'])
{
?>
<td><?php echo $item['taxed_flag'] ?></td>
@@ -105,14 +105,14 @@
</tr>
<tr>
<?php
if(config('OSPOS')->receipt_show_description)
if(config('OSPOS')->settings['receipt_show_description'])
{
?>
<td colspan="2"><?php echo esc($item['description']) ?></td>
<?php
}
if(config('OSPOS')->receipt_show_serialnumber)
if(config('OSPOS')->settings['receipt_show_serialnumber'])
{
?>
<td><?php echo esc($item['serialnumber']) ?></td>
@@ -148,7 +148,7 @@
?>
<?php
if(config('OSPOS')->receipt_show_total_discount && $discount > 0)
if(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)
{
?>
<tr>
@@ -164,7 +164,7 @@
?>
<?php
if(config('OSPOS')->receipt_show_taxes)
if(config('OSPOS')->settings['receipt_show_taxes'])
{
?>
<tr>
@@ -189,7 +189,7 @@
<tr>
</tr>
<?php $border = (!config('OSPOS')->receipt_show_taxes && !(config('OSPOS')->receipt_show_total_discount && $discount > 0)); ?>
<?php $border = (!config('OSPOS')->settings['receipt_show_taxes'] && !(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)); ?>
<tr>
<td colspan="3" style="text-align:right;<?php echo $border ? 'border-top: 2px solid black;' : '' ?>"><?php echo lang('Sales.total') ?></td>
<td style="text-align:right;<?php echo $border ? 'border-top: 2px solid black;' : '' ?>"><?php echo to_currency($total) ?></td>
@@ -238,7 +238,7 @@
</table>
<div id="sale_return_policy">
<?php echo nl2br(config('OSPOS')->return_policy) ?>
<?php echo nl2br(config('OSPOS')->settings['return_policy']) ?>
</div>
<div id="barcode">

View File

@@ -16,27 +16,27 @@
<div id="receipt_wrapper" style="width:100%;">
<div id="receipt_header" style="text-align:center;">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo'] != '')
{
?>
<div id="company_name">
<img id="image" src="data:image/png;base64,<?php echo base64_encode(file_get_contents('uploads/' . config('OSPOS')->company_logo)) ?>" alt="company_logo" />
<img id="image" src="data:image/png;base64,<?php echo base64_encode(file_get_contents('uploads/' . config('OSPOS')->settings['company_logo'])) ?>" alt="company_logo" />
</div>
<?php
}
?>
<?php
if(config('OSPOS')->receipt_show_company_name)
if(config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name" style="font-size:150%; font-weight:bold;"><?php echo esc(config('OSPOS')->company) ?></div>
<div id="company_name" style="font-size:150%; font-weight:bold;"><?php echo esc(config('OSPOS')->settings['company']) ?></div>
<?php
}
?>
<div id="company_address"><?php echo nl2br(esc(config('OSPOS')->address)) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->phone) ?></div>
<div id="company_address"><?php echo nl2br(esc(config('OSPOS')->settings['address'])) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->settings['phone']) ?></div>
<br>
<div id="sale_receipt"><?php echo lang('Sales.receipt') ?></div>
<div id="sale_time"><?php echo esc($transaction_time) ?></div>
@@ -77,18 +77,18 @@
<td><?php echo esc(ucfirst($item['name'] . ' ' . $item['attribute_values'])) ?></td>
<td><?php echo to_currency($item['price']) ?></td>
<td><?php echo to_quantity_decimals($item['quantity']) ?></td>
<td style="text-align:right;"><?php echo to_currency($item[(config('OSPOS')->receipt_show_total_discount ? 'total' : 'discounted_total')]) ?></td>
<td style="text-align:right;"><?php echo to_currency($item[(config('OSPOS')->settings['receipt_show_total_discount'] ? 'total' : 'discounted_total')]) ?></td>
</tr>
<tr>
<?php
if(config('OSPOS')->receipt_show_description)
if(config('OSPOS')->settings['receipt_show_description'])
{
?>
<td colspan="2"><?php echo esc($item['description']) ?></td>
<?php
}
if(config('OSPOS')->receipt_show_serialnumber)
if(config('OSPOS')->settings['receipt_show_serialnumber'])
{
?>
<td><?php echo esc($item['serialnumber']) ?></td>
@@ -122,7 +122,7 @@
}
}
if(config('OSPOS')->receipt_show_total_discount && $discount > 0)
if(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)
{
?>
<tr>
@@ -138,7 +138,7 @@
?>
<?php
if(config('OSPOS')->receipt_show_taxes)
if(config('OSPOS')->settings['receipt_show_taxes'])
{
?>
<tr>
@@ -163,7 +163,7 @@
<tr>
</tr>
<?php $border = (!config('OSPOS')->receipt_show_taxes && !(config('OSPOS')->receipt_show_total_discount && $discount > 0)) ?>
<?php $border = (!config('OSPOS')->settings['receipt_show_taxes'] && !(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)) ?>
<tr>
<td colspan="3" style="<?php echo $border ? 'border-top: 2px solid black;' : '' ?>text-align:right;"><?php echo lang('Sales.total') ?></td>
<td style="<?php echo $border ? 'border-top: 2px solid black;' : '' ?>text-align:right"><?php echo to_currency($total) ?></td>
@@ -216,7 +216,7 @@
</table>
<div id="sale_return_policy" style="text-align:center">
<?php echo nl2br(esc(config('OSPOS')->return_policy)) ?>
<?php echo nl2br(esc(config('OSPOS')->settings['return_policy'])) ?>
</div>
<br>

View File

@@ -13,30 +13,30 @@
* @var string $barcode
*/
?>
<div id="receipt_wrapper" style="font-size:<?php echo esc(config('OSPOS')->receipt_font_size) ?>px">
<div id="receipt_wrapper" style="font-size:<?php echo esc(config('OSPOS')->settings['receipt_font_size) ?>px">
<div id="receipt_header">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo != '')
{
?>
<div id="company_name">
<img id="image" src="<?php echo base_url('uploads/' . esc(config('OSPOS')->company_logo, 'url')) ?>" alt="company_logo" />
<img id="image" src="<?php echo base_url('uploads/' . esc(config('OSPOS')->settings['company_logo'], 'url')) ?>" alt="company_logo" />
</div>
<?php
}
?>
<?php
if(config('OSPOS')->receipt_show_company_name)
if(config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name"><?php echo esc(config('OSPOS')->company) ?></div>
<div id="company_name"><?php echo esc(config('OSPOS')->settings['company']) ?></div>
<?php
}
?>
<div id="company_address"><?php echo nl2br(esc(config('OSPOS')->address)) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->phone) ?></div>
<div id="company_address"><?php echo nl2br(esc(config('OSPOS')->settings['address'])) ?></div>
<div id="company_phone"><?php echo esc(config('OSPOS')->settings['phone']) ?></div>
<div id="sale_receipt"><?php echo lang('Sales.receipt') ?></div>
<div id="sale_time"><?php echo esc($transaction_time) ?></div>
</div>
@@ -78,11 +78,11 @@
<tr>
<td><?php echo esc(ucfirst($item['name'] . ' ' . $item['attribute_values'])) ?></td>
<td><?php echo to_quantity_decimals($item['quantity']) ?></td>
<td class="total-value"><?php echo to_currency($item[(config('OSPOS')->receipt_show_total_discount ? 'total' : 'discounted_total')]) ?></td>
<td class="total-value"><?php echo to_currency($item[(config('OSPOS')->settings['receipt_show_total_discount'] ? 'total' : 'discounted_total')]) ?></td>
</tr>
<tr>
<?php
if(config('OSPOS')->receipt_show_description)
if(config('OSPOS')->settings['receipt_show_description'])
{
?>
<td colspan="2"><?php echo esc($item['description']) ?></td>
@@ -90,7 +90,7 @@
}
?>
<?php
if(config('OSPOS')->receipt_show_serialnumber)
if(config('OSPOS')->settings['receipt_show_serialnumber'])
{
?>
<td><?php echo esc($item['serialnumber']) ?></td>
@@ -128,7 +128,7 @@
?>
<?php
if(config('OSPOS')->receipt_show_total_discount && $discount > 0)
if(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)
{
?>
<tr>
@@ -144,7 +144,7 @@
?>
<?php
if(config('OSPOS')->receipt_show_taxes)
if(config('OSPOS')->settings['receipt_show_taxes'])
{
?>
<tr>
@@ -169,7 +169,7 @@
<tr>
</tr>
<?php $border = (!config('OSPOS')->receipt_show_taxes && !(config('OSPOS')->receipt_show_total_discount && $discount > 0)); ?>
<?php $border = (!config('OSPOS')->settings['receipt_show_taxes'] && !(config('OSPOS')->settings['receipt_show_total_discount'] && $discount > 0)); ?>
<tr>
<td colspan="2" style="text-align:right;<?php echo $border ? 'border-top: 2px solid black;' : '' ?>"><?php echo lang('Sales.total') ?></td>
<td style="text-align:right;<?php echo $border ? 'border-top: 2px solid black;' : '' ?>"><?php echo to_currency($total) ?></td>
@@ -211,7 +211,7 @@
</table>
<div id="sale_return_policy">
<?php echo nl2br(esc(config('OSPOS')->return_policy)) ?>
<?php echo nl2br(esc(config('OSPOS')->settings['return_policy'])) ?>
</div>
<div id="barcode">

View File

@@ -73,7 +73,7 @@ if(isset($success))
<?php echo form_dropdown('mode', esc($modes), esc($mode), ['onchange' => "$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
</li>
<?php
if(config('OSPOS')->dinner_table_enable == TRUE)
if(config('OSPOS')->settings['dinner_table_enable'] == TRUE)
{
?>
<li class="pull-left first_li">
@@ -240,7 +240,7 @@ if(isset($success))
<div class="input-group">
<?php echo form_input (['name' => '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();']) ?>
<span class="input-group-btn">
<?php echo form_checkbox (['id' => 'discount_toggle', 'name' => 'discount_toggle', 'value' => 1, 'data-toggle' => "toggle",'data-size' => 'small', 'data-onstyle' => 'success', 'data-on' => '<b>' . config('OSPOS')->currency_symbol . '</b>', 'data-off' => '<b>%</b>', 'data-line' => esc($line), 'checked' => $item['discount_type']]) ?>
<?php echo form_checkbox (['id' => 'discount_toggle', 'name' => 'discount_toggle', 'value' => 1, 'data-toggle' => "toggle",'data-size' => 'small', 'data-onstyle' => 'success', 'data-on' => '<b>' . config('OSPOS')->settings['currency_symbol'] . '</b>', 'data-off' => '<b>%</b>', 'data-line' => esc($line), 'checked' => $item['discount_type']]) ?>
</span>
</div>
</td>
@@ -391,7 +391,7 @@ if(isset($success))
<th style="width: 55%;"><?php echo lang('Sales.customer_discount') ?></th>
<th style="width: 45%; text-align: right;"><?php echo ($customer_discount_type == FIXED) ? to_currency($customer_discount) : $customer_discount . '%' ?></th>
</tr>
<?php if(config('OSPOS')->customer_reward_enable == TRUE): ?>
<?php if(config('OSPOS')->settings['customer_reward_enable'] == TRUE): ?>
<?php
if(!empty($customer_rewards))
{
@@ -678,7 +678,7 @@ if(isset($success))
</div>
</div>
<?php
if(($mode == 'sale_invoice') && config('OSPOS')->invoice_enable == TRUE)
if(($mode == 'sale_invoice') && config('OSPOS')->settings['invoice_enable'] == TRUE)
{
?>
<div class="row">
@@ -849,7 +849,7 @@ $(document).ready(function()
});
<?php
if(config('OSPOS')->invoice_enable == TRUE)
if(config('OSPOS')->settings['invoice_enable'] == TRUE)
{
?>
$('#sales_invoice_number').keyup(function() {

View File

@@ -22,7 +22,7 @@ use App\Models\Customer;
<th><?php echo lang('Sales.suspended_doc_id') ?></th>
<th><?php echo lang('Sales.date') ?></th>
<?php
if(config('OSPOS')->dinner_table_enable == TRUE)
if(config('OSPOS')->settings['dinner_table_enable'] == TRUE)
{
?>
<th><?php echo lang('Sales.table') ?></th>
@@ -42,9 +42,9 @@ use App\Models\Customer;
?>
<tr>
<td><?php echo $suspended_sale['doc_id'] ?></td>
<td><?php echo date(config('OSPOS')->dateformat, strtotime($suspended_sale['sale_time'])) ?></td>
<td><?php echo date(config('OSPOS')->settings['dateformat'], strtotime($suspended_sale['sale_time'])) ?></td>
<?php
if(config('OSPOS')->dinner_table_enable == TRUE)
if(config('OSPOS')->settings['dinner_table_enable'] == TRUE)
{
?>
<td><?php echo esc($this->Dinner_table->get_name($suspended_sale['dinner_table_id'])) ?></td>

View File

@@ -79,19 +79,19 @@ $(document).ready(function()
<div id="logo">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo'] != '')
{
?>
<img id="image" src="<?php echo esc(base_url('uploads/' . config('OSPOS')->company_logo), 'url') ?>" alt="company_logo" />
<img id="image" src="<?php echo esc(base_url('uploads/' . config('OSPOS')->settings['company_logo']), 'url') ?>" alt="company_logo" />
<?php
}
?>
<div>&nbsp</div>
<?php
if(config('OSPOS')->receipt_show_company_name)
if(config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name"><?php echo esc(config('OSPOS')->company) ?></div>
<div id="company_name"><?php echo esc(config('OSPOS')->settings['company']) ?></div>
<?php
}
?>
@@ -255,11 +255,11 @@ $(document).ready(function()
<div id="terms">
<div id="sale_return_policy">
<h5>
<span><?php echo nl2br(config('OSPOS')->payment_message) ?></span>
<span><?php echo nl2br(config('OSPOS')->settings['payment_message']) ?></span>
<span style='padding:4%;'><?php echo empty($comments) ? '' : lang('Sales.comments') . esc(": $comments") ?></span>
<span style='padding:4%;'><?php echo esc(config('OSPOS')->invoice_default_comments) ?></span>
<span style='padding:4%;'><?php echo esc(config('OSPOS')->settings['invoice_default_comments']) ?></span>
</h5>
<div style='padding:2%;'><?php echo nl2br(esc(config('OSPOS')->return_policy)) ?></div>
<div style='padding:2%;'><?php echo nl2br(esc(config('OSPOS')->settings['return_policy'])) ?></div>
</div>
<div id='barcode'>
<img style='padding-top:4%;' alt='<?php echo esc($barcode, 'attr') ?>' src='data:image/png;base64,<?php echo esc($barcode, 'attr') ?>' /><br>
@@ -274,7 +274,7 @@ $(window).on("load", function()
// install firefox addon in order to use this plugin
if(window.jsPrintSetup)
{
<?php if(!config('OSPOS')->print_header)
<?php if(!config('OSPOS')->settings['print_header'])
{
?>
// set page header
@@ -284,7 +284,7 @@ $(window).on("load", function()
<?php
}
if(!config('OSPOS')->print_footer)
if(!config('OSPOS')->settings['print_footer'])
{
?>
// set empty page footer

View File

@@ -77,19 +77,19 @@ if(isset($error_message))
<div id="logo">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo'] != '')
{
?>
<img id="image" src="<?php echo base_url('uploads/' . config('OSPOS')->company_logo) ?>" alt="company_logo" />
<img id="image" src="<?php echo base_url('uploads/' . config('OSPOS')->settings['company_logo']) ?>" alt="company_logo" />
<?php
}
?>
<div>&nbsp</div>
<?php
if(config('OSPOS')->receipt_show_company_name)
if(config('OSPOS')->settings['receipt_show_company_name'])
{
?>
<div id="company_name"><?php echo esc(config('OSPOS')->company) ?></div>
<div id="company_name"><?php echo esc(config('OSPOS')->settings['company']) ?></div>
<?php
}
?>
@@ -219,7 +219,7 @@ if(isset($error_message))
// install firefox addon in order to use this plugin
if(window.jsPrintSetup)
{
<?php if(!config('OSPOS')->print_header)
<?php if(!config('OSPOS')->settings['print_header'])
{
?>
// set page header
@@ -229,7 +229,7 @@ if(isset($error_message))
<?php
}
if(!config('OSPOS')->print_footer)
if(!config('OSPOS')->settings['print_footer'])
{
?>
// set empty page footer

View File

@@ -33,10 +33,10 @@
<tr>
<td id="logo">
<?php
if(config('OSPOS')->company_logo != '')
if(config('OSPOS')->settings['company_logo'] != '')
{
?>
<img id="image" src="<?php echo esc('uploads/' . config('OSPOS')->company_logo, 'url') ?>" alt="company_logo" />
<img id="image" src="<?php echo esc('uploads/' . config('OSPOS')->settings['company_logo'], 'url') ?>" alt="company_logo" />
<?php
}
?>
@@ -47,7 +47,7 @@
</tr>
<tr>
<td id="company-title">
<pre><?php echo esc(config('OSPOS')->company) ?></pre>
<pre><?php echo esc(config('OSPOS')->settings['company']) ?></pre>
<pre><?php echo esc($company_info) ?></pre>
</td>
<td id="meta">

View File

@@ -11,7 +11,7 @@ $(document).ready(function()
table_support.init({
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
headers: <?php echo esc($tax_rate_table_headers, 'js') ?>,
pageSize: <?php echo config('OSPOS')->lines_per_page ?>,
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
uniqueId: 'tax_rate_id'
});
});