PSR compliance and formatting changes

- Replaced TRUE/FALSE constants with true/false keywords
- Replaced NULL constant with null keyword
- Replaced `<?php echo` in views with shortened `<?=`
- Added missing variable declaration
- Added missing function return type in declaration
- replaced `== true`, `== false`, `=== true` and `=== false` in if statements with simplified forms
This commit is contained in:
objecttothis
2023-12-04 12:10:16 +04:00
committed by jekkos
parent 588f96a945
commit 7b224be665
186 changed files with 3161 additions and 3073 deletions

View File

@@ -173,4 +173,3 @@ const CASH_MODE_FALSE = 0;
*/
const GOODS_SUPPLIER = 0;
const COST_SUPPLIER = 1;

View File

@@ -81,17 +81,17 @@ class Routing extends BaseRouting
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* If true, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
* If false, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = true;
/**
* If TRUE, will enable the use of the 'prioritize' option
* If true, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false

View File

@@ -86,7 +86,7 @@ class Session extends BaseConfig
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* when auto-regenerating the session ID. When set to false, the data
* will be later deleted by the garbage collector.
*/
public bool $regenerateDestroy = true;

View File

@@ -81,15 +81,15 @@ class OSPOSRules
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($check));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$status = json_decode($result, TRUE);
$status = json_decode($result, true);
if(!empty($status['success']))
{

View File

@@ -109,12 +109,12 @@ class Attributes extends Secure_Controller
//Save definition data
$definition_data = [
'definition_name' => $this->request->getPost('definition_name'),
'definition_unit' => $this->request->getPost('definition_unit') != '' ? $this->request->getPost('definition_unit') : NULL,
'definition_unit' => $this->request->getPost('definition_unit') != '' ? $this->request->getPost('definition_unit') : null,
'definition_flags' => $definition_flags,
'definition_fk' => $this->request->getPost('definition_group') != '' ? $this->request->getPost('definition_group') : NULL
'definition_fk' => $this->request->getPost('definition_group') != '' ? $this->request->getPost('definition_group') : null
];
if ($this->request->getPost('definition_type') != NULL)
if ($this->request->getPost('definition_type') != null)
{
$definition_data['definition_type'] = DEFINITION_TYPES[$this->request->getPost('definition_type')];
}
@@ -134,7 +134,7 @@ class Attributes extends Secure_Controller
}
echo json_encode([
'success' => TRUE,
'success' => true,
'message' => lang('Attributes.definition_successful_adding') . ' ' . $definition_name,
'id' => $definition_data['definition_id']
]);
@@ -143,7 +143,7 @@ class Attributes extends Secure_Controller
else
{
echo json_encode([
'success' => TRUE,
'success' => true,
'message' => lang('Attributes.definition_successful_updating') . ' ' . $definition_name,
'id' => $definition_id
]);
@@ -153,7 +153,7 @@ class Attributes extends Secure_Controller
else
{
echo json_encode([
'success' => FALSE,
'success' => false,
'message' => lang('Attributes.definition_error_adding_updating', [$definition_name]),
'id' => NEW_ENTRY
]);
@@ -243,11 +243,11 @@ class Attributes extends Secure_Controller
if($this->attribute->delete_definition_list($attributes_to_delete))
{
$message = lang('Attributes.definition_successful_deleted') . ' ' . count($attributes_to_delete) . ' ' . lang('Attributes.definition_one_or_multiple');
echo json_encode(['success' => TRUE, 'message' => $message]);
echo json_encode(['success' => true, 'message' => $message]);
}
else
{
echo json_encode(['success' => FALSE, 'message' => lang('Attributes.definition_cannot_be_deleted')]);
echo json_encode(['success' => false, 'message' => lang('Attributes.definition_cannot_be_deleted')]);
}
}
}

View File

@@ -45,11 +45,11 @@ class Cashups extends Secure_Controller
$filters = [
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS), //TODO: Is this the best way to filter dates
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'is_deleted' => FALSE
'is_deleted' => false
];
// check if any filter is set in the multiselect dropdown
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), TRUE); //TODO: $filledup doesn't follow variable naming patterns we are using.
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), true); //TODO: $filledup doesn't follow variable naming patterns we are using.
$filters = array_merge($filters, $filledup);
$cash_ups = $this->cashup->search($search, $filters, $limit, $offset, $sort, $order);
$total_rows = $this->cashup->get_found_rows($search, $filters);
@@ -171,12 +171,12 @@ class Cashups extends Secure_Controller
// lookup expenses paid in cash
$filters = [
'only_cash' => TRUE,
'only_due' => FALSE,
'only_check' => FALSE,
'only_credit' => FALSE,
'only_debit' => FALSE,
'is_deleted' => FALSE
'only_cash' => true,
'only_due' => false,
'only_check' => false,
'only_credit' => false,
'only_debit' => false,
'is_deleted' => false
];
$payments = $this->expense->get_payments_summary('', array_merge($inputs, $filters));
@@ -220,11 +220,11 @@ class Cashups extends Secure_Controller
'closed_amount_card' => parse_decimals($this->request->getPost('closed_amount_card', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_check' => parse_decimals($this->request->getPost('closed_amount_check', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_total' => parse_decimals($this->request->getPost('closed_amount_total', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'note' => $this->request->getPost('note') != NULL,
'note' => $this->request->getPost('note') != null,
'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'open_employee_id' => $this->request->getPost('open_employee_id', FILTER_SANITIZE_NUMBER_INT),
'close_employee_id' => $this->request->getPost('close_employee_id', FILTER_SANITIZE_NUMBER_INT),
'deleted' => $this->request->getPost('deleted') != NULL
'deleted' => $this->request->getPost('deleted') != null
];
if($this->cashup->save_value($cash_up_data, $cashup_id))
@@ -232,16 +232,16 @@ class Cashups extends Secure_Controller
//New cashup_id
if($cashup_id == NEW_ENTRY)
{
echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_adding'), 'id' => $cash_up_data['cashup_id']]);
echo json_encode(['success' => true, 'message' => lang('Cashups.successful_adding'), 'id' => $cash_up_data['cashup_id']]);
}
else // Existing Cashup
{
echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_updating'), 'id' => $cashup_id]);
echo json_encode(['success' => true, 'message' => lang('Cashups.successful_updating'), 'id' => $cashup_id]);
}
}
else//failure
{
echo json_encode(['success' => FALSE, 'message' => lang('Cashups.error_adding_updating'), 'id' => NEW_ENTRY]);
echo json_encode(['success' => false, 'message' => lang('Cashups.error_adding_updating'), 'id' => NEW_ENTRY]);
}
}
@@ -251,11 +251,11 @@ class Cashups extends Secure_Controller
if($this->cashup->delete_list($cash_ups_to_delete))
{
echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_deleted') . ' ' . count($cash_ups_to_delete) . ' ' . lang('Cashups.one_or_multiple'), 'ids' => $cash_ups_to_delete]);
echo json_encode(['success' => true, 'message' => lang('Cashups.successful_deleted') . ' ' . count($cash_ups_to_delete) . ' ' . lang('Cashups.one_or_multiple'), 'ids' => $cash_ups_to_delete]);
}
else
{
echo json_encode(['success' => FALSE, 'message' => lang('Cashups.cannot_be_deleted'), 'ids' => $cash_ups_to_delete]);
echo json_encode(['success' => false, 'message' => lang('Cashups.cannot_be_deleted'), 'ids' => $cash_ups_to_delete]);
}
}

View File

@@ -80,15 +80,15 @@ class Config extends Secure_Controller
private function _licenses(): array //TODO: remove hungarian notation. Super long function. Perhaps we need to refactor out functions?
{
$i = 0;
$bower = FALSE;
$composer = FALSE;
$bower = false;
$composer = false;
$license = [];
$license[$i]['title'] = 'Open Source Point Of Sale ' . config('App')->application_version;
if(file_exists('license/LICENSE'))
{
$license[$i]['text'] = file_get_contents('license/LICENSE', false, NULL, 0, 2000);
$license[$i]['text'] = file_get_contents('license/LICENSE', false, null, 0, 2000);
}
else
{
@@ -108,13 +108,13 @@ class Config extends Secure_Controller
$basename = 'license/' . $fileinfo->getBasename('.version');
$license[$i]['title'] = file_get_contents($basename . '.version', false, NULL, 0, 100);
$license[$i]['title'] = file_get_contents($basename . '.version', false, null, 0, 100);
$license_text_file = $basename . '.license';
if(file_exists($license_text_file))
{
$license[$i]['text'] = file_get_contents($license_text_file , false, NULL, 0, 2000);
$license[$i]['text'] = file_get_contents($license_text_file , false, null, 0, 2000);
}
else
{
@@ -124,12 +124,12 @@ class Config extends Secure_Controller
elseif($fileinfo->getBasename() == 'bower.LICENSES')
{
// set a flag to indicate that the JS Plugin bower.LICENSES file is available and needs to be attached at the end
$bower = TRUE;
$bower = true;
}
elseif($fileinfo->getBasename() == 'composer.LICENSES')
{
// set a flag to indicate that the composer.LICENSES file is available and needs to be attached at the end
$composer = TRUE;
$composer = true;
}
}
}
@@ -142,7 +142,7 @@ class Config extends Secure_Controller
$license[$i]['text'] = '';
$file = file_get_contents('license/composer.LICENSES');
$array = json_decode($file, TRUE);
$array = json_decode($file, true);
foreach($array as $key => $val)
{
@@ -192,7 +192,7 @@ class Config extends Secure_Controller
$license[$i]['text'] = '';
$file = file_get_contents('license/bower.LICENSES');
$array = json_decode($file, TRUE);
$array = json_decode($file, true);
foreach($array as $key => $val)
{
@@ -335,7 +335,7 @@ class Config extends Secure_Controller
'return_policy' => $this->request->getPost('return_policy')
];
if(!empty($upload_data['orig_name']) && $upload_data['raw_name'] === TRUE)
if(!empty($upload_data['orig_name']) && $upload_data['raw_name'])
{
$batch_save_data['company_logo'] = $upload_data['raw_name'] . $upload_data['file_ext'];
}
@@ -396,12 +396,12 @@ class Config extends Secure_Controller
$batch_save_data = [
'theme' => $this->request->getPost('theme'),
'login_form' => $this->request->getPost('login_form'),
'default_sales_discount_type' => $this->request->getPost('default_sales_discount_type') != NULL,
'default_sales_discount_type' => $this->request->getPost('default_sales_discount_type') != null,
'default_sales_discount' => $this->request->getPost('default_sales_discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'default_receivings_discount_type' => $this->request->getPost('default_receivings_discount_type') != NULL,
'default_receivings_discount_type' => $this->request->getPost('default_receivings_discount_type') != null,
'default_receivings_discount' => $this->request->getPost('default_receivings_discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'enforce_privacy' => $this->request->getPost('enforce_privacy', FILTER_SANITIZE_NUMBER_INT),
'receiving_calculate_average_price' => $this->request->getPost('receiving_calculate_average_price') != NULL,
'receiving_calculate_average_price' => $this->request->getPost('receiving_calculate_average_price') != null,
'lines_per_page' => $this->request->getPost('lines_per_page', FILTER_SANITIZE_NUMBER_INT),
'notify_horizontal_position' => $this->request->getPost('notify_horizontal_position', FILTER_SANITIZE_NUMBER_INT),
'notify_vertical_position' => $this->request->getPost('notify_vertical_position', FILTER_SANITIZE_NUMBER_INT),
@@ -409,20 +409,20 @@ class Config extends Secure_Controller
'image_max_height' => $this->request->getPost('image_max_height', FILTER_SANITIZE_NUMBER_INT),
'image_max_size' => $this->request->getPost('image_max_size', FILTER_SANITIZE_NUMBER_INT),
'image_allowed_types' => implode('|', $this->request->getPost('image_allowed_types')),
'gcaptcha_enable' => $this->request->getPost('gcaptcha_enable') != NULL,
'gcaptcha_enable' => $this->request->getPost('gcaptcha_enable') != null,
'gcaptcha_secret_key' => $this->request->getPost('gcaptcha_secret_key'),
'gcaptcha_site_key' => $this->request->getPost('gcaptcha_site_key'),
'suggestions_first_column' => $this->request->getPost('suggestions_first_column'),
'suggestions_second_column' => $this->request->getPost('suggestions_second_column'),
'suggestions_third_column' => $this->request->getPost('suggestions_third_column'),
'giftcard_number' => $this->request->getPost('giftcard_number'),
'derive_sale_quantity' => $this->request->getPost('derive_sale_quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) != NULL,
'multi_pack_enabled' => $this->request->getPost('multi_pack_enabled') != NULL,
'include_hsn' => $this->request->getPost('include_hsn') != NULL,
'category_dropdown' => $this->request->getPost('category_dropdown') != NULL
'derive_sale_quantity' => $this->request->getPost('derive_sale_quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) != null,
'multi_pack_enabled' => $this->request->getPost('multi_pack_enabled') != null,
'include_hsn' => $this->request->getPost('include_hsn') != null,
'category_dropdown' => $this->request->getPost('category_dropdown') != null
];
$this->module->set_show_office_group($this->request->getPost('show_office_group') != NULL);
$this->module->set_show_office_group($this->request->getPost('show_office_group') != null);
if($batch_save_data['category_dropdown'] == 1)
{
@@ -474,7 +474,7 @@ class Config extends Secure_Controller
$number_local_example = $fmt->format(1234567890.12300);
echo json_encode([
'success' => $number_local_example != FALSE,
'success' => $number_local_example != false,
'save_number_locale' => $save_number_locale,
'number_locale_example' => $number_local_example,
'currency_symbol' => $currency_symbol,
@@ -580,7 +580,7 @@ class Config extends Secure_Controller
$result = [];
$lists = $mailchimp_lib->getLists();
if($lists !== FALSE)
if($lists !== false)
{
if(is_array($lists) && !empty($lists['lists']) && is_array($lists['lists']))
{
@@ -688,7 +688,7 @@ class Config extends Secure_Controller
$this->db->transStart();
$not_to_delete = [];
foreach($this->request->getPost(NULL) as $key => $value)
foreach($this->request->getPost() as $key => $value)
{
if(strstr($key, 'stock_location'))
{
@@ -731,14 +731,14 @@ class Config extends Secure_Controller
{
$this->db->transStart();
$dinner_table_enable = $this->request->getPost('dinner_table_enable') != NULL;
$dinner_table_enable = $this->request->getPost('dinner_table_enable') != null;
$this->appconfig->save(['dinner_table_enable' => $dinner_table_enable]);
if($dinner_table_enable)
{
$not_to_delete = [];
foreach($this->request->getPost(NULL) as $key => $value) //TODO: Not sure if this is the best way to filter the array
foreach($this->request->getPost() as $key => $value) //TODO: Not sure if this is the best way to filter the array
{
if(strstr($key, 'dinner_table') && $key != 'dinner_table_enable')
{
@@ -785,8 +785,8 @@ class Config extends Secure_Controller
'default_tax_1_name' => $this->request->getPost('default_tax_1_name'),
'default_tax_2_rate' => parse_tax($this->request->getPost('default_tax_2_rate', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'default_tax_2_name' => $this->request->getPost('default_tax_2_name'),
'tax_included' => $this->request->getPost('tax_included') != NULL,
'use_destination_based_tax' => $this->request->getPost('use_destination_based_tax') != NULL,
'tax_included' => $this->request->getPost('tax_included') != null,
'use_destination_based_tax' => $this->request->getPost('use_destination_based_tax') != null,
'default_tax_code' => $this->request->getPost('default_tax_code'),
'default_tax_category' => $this->request->getPost('default_tax_category'),
'default_tax_jurisdiction' => $this->request->getPost('default_tax_jurisdiction'),
@@ -811,7 +811,7 @@ class Config extends Secure_Controller
{
$this->db->transStart();
$customer_reward_enable = $this->request->getPost('customer_reward_enable') != NULL;
$customer_reward_enable = $this->request->getPost('customer_reward_enable') != null;
$this->appconfig->save(['customer_reward_enable' => $customer_reward_enable]);
@@ -819,7 +819,7 @@ class Config extends Secure_Controller
{
$not_to_delete = [];
$array_save = [];
foreach($this->request->getPost(NULL) as $key => $value)
foreach($this->request->getPost() as $key => $value)
{
if(strstr($key, 'customer_reward') && $key != 'customer_reward_enable')
{
@@ -880,8 +880,8 @@ class Config extends Secure_Controller
'barcode_num_in_row' => $this->request->getPost('barcode_num_in_row', FILTER_SANITIZE_NUMBER_INT),
'barcode_page_width' => $this->request->getPost('barcode_page_width', FILTER_SANITIZE_NUMBER_INT),
'barcode_page_cellspacing' => $this->request->getPost('barcode_page_cellspacing', FILTER_SANITIZE_NUMBER_INT),
'barcode_generate_if_empty' => $this->request->getPost('barcode_generate_if_empty') != NULL,
'allow_duplicate_barcodes' => $this->request->getPost('allow_duplicate_barcodes') != NULL,
'barcode_generate_if_empty' => $this->request->getPost('barcode_generate_if_empty') != null,
'allow_duplicate_barcodes' => $this->request->getPost('allow_duplicate_barcodes') != null,
'barcode_content' => $this->request->getPost('barcode_content'),
'barcode_formats' => json_encode($this->request->getPost('barcode_formats'))
];
@@ -902,15 +902,15 @@ class Config extends Secure_Controller
'print_delay_autoreturn' => $this->request->getPost('print_delay_autoreturn', FILTER_SANITIZE_NUMBER_INT),
'email_receipt_check_behaviour' => $this->request->getPost('email_receipt_check_behaviour'),
'print_receipt_check_behaviour' => $this->request->getPost('print_receipt_check_behaviour'),
'receipt_show_company_name' => $this->request->getPost('receipt_show_company_name') != NULL,
'receipt_show_taxes' => ($this->request->getPost('receipt_show_taxes') != NULL),
'receipt_show_tax_ind' => ($this->request->getPost('receipt_show_tax_ind') != NULL),
'receipt_show_total_discount' => $this->request->getPost('receipt_show_total_discount') != NULL,
'receipt_show_description' => $this->request->getPost('receipt_show_description') != NULL,
'receipt_show_serialnumber' => $this->request->getPost('receipt_show_serialnumber') != NULL,
'print_silently' => $this->request->getPost('print_silently') != NULL,
'print_header' => $this->request->getPost('print_header') != NULL,
'print_footer' => $this->request->getPost('print_footer') != NULL,
'receipt_show_company_name' => $this->request->getPost('receipt_show_company_name') != null,
'receipt_show_taxes' => ($this->request->getPost('receipt_show_taxes') != null),
'receipt_show_tax_ind' => ($this->request->getPost('receipt_show_tax_ind') != null),
'receipt_show_total_discount' => $this->request->getPost('receipt_show_total_discount') != null,
'receipt_show_description' => $this->request->getPost('receipt_show_description') != null,
'receipt_show_serialnumber' => $this->request->getPost('receipt_show_serialnumber') != null,
'print_silently' => $this->request->getPost('print_silently') != null,
'print_header' => $this->request->getPost('print_header') != null,
'print_footer' => $this->request->getPost('print_footer') != null,
'print_top_margin' => $this->request->getPost('print_top_margin', FILTER_SANITIZE_NUMBER_INT),
'print_left_margin' => $this->request->getPost('print_left_margin', FILTER_SANITIZE_NUMBER_INT),
'print_bottom_margin' => $this->request->getPost('print_bottom_margin', FILTER_SANITIZE_NUMBER_INT),
@@ -928,7 +928,7 @@ class Config extends Secure_Controller
public function postSaveInvoice(): void
{
$batch_save_data = [
'invoice_enable' => $this->request->getPost('invoice_enable') != NULL,
'invoice_enable' => $this->request->getPost('invoice_enable') != null,
'sales_invoice_format' => $this->request->getPost('sales_invoice_format'),
'sales_quote_format' => $this->request->getPost('sales_quote_format'),
'recv_invoice_format' => $this->request->getPost('recv_invoice_format'),
@@ -938,7 +938,7 @@ class Config extends Secure_Controller
'last_used_invoice_number' => $this->request->getPost('last_used_invoice_number', FILTER_SANITIZE_NUMBER_INT),
'last_used_quote_number' => $this->request->getPost('last_used_quote_number', FILTER_SANITIZE_NUMBER_INT),
'quote_default_comments' => $this->request->getPost('quote_default_comments'),
'work_order_enable' => $this->request->getPost('work_order_enable') != NULL,
'work_order_enable' => $this->request->getPost('work_order_enable') != null,
'work_order_format' => $this->request->getPost('work_order_format'),
'last_used_work_order_number' => $this->request->getPost('last_used_work_order_number', FILTER_SANITIZE_NUMBER_INT),
'invoice_type' => $this->request->getPost('invoice_type')
@@ -948,7 +948,7 @@ class Config extends Secure_Controller
// Update the register mode with the latest change so that if the user
// switches immediately back to the register the mode reflects the change
if($success == TRUE)
if($success)
{
if($this->config['invoice_enable'])
{

View File

@@ -124,14 +124,14 @@ class Customers extends Persons
*/
public function getSuggest(): void
{
$suggestions = $this->customer->get_search_suggestions($this->request->getGet('term'), 25,TRUE);
$suggestions = $this->customer->get_search_suggestions($this->request->getGet('term'), 25,true);
echo json_encode($suggestions);
}
public function suggest_search(): void
{
$suggestions = $this->customer->get_search_suggestions($this->request->getPost('term'), 25, FALSE);
$suggestions = $this->customer->get_search_suggestions($this->request->getPost('term'), 25, false);
echo json_encode($suggestions);
}
@@ -162,7 +162,7 @@ class Customers extends Persons
$tax_code_info = $this->tax_code->get_info($info->sales_tax_code_id);
if($tax_code_info->tax_code != NULL)
if($tax_code_info->tax_code != null)
{
$data['sales_tax_code_label'] = $tax_code_info->tax_code . ' ' . $tax_code_info->tax_code_name;
}
@@ -181,11 +181,11 @@ class Customers extends Persons
if($this->config['use_destination_based_tax']) //TODO: This can be shortened for ternary notation
{
$data['use_destination_based_tax'] = TRUE;
$data['use_destination_based_tax'] = true;
}
else
{
$data['use_destination_based_tax'] = FALSE;
$data['use_destination_based_tax'] = false;
}
// retrieve the total amount the customer spent so far together with min, max and average values
@@ -203,12 +203,12 @@ class Customers extends Persons
if(!empty($info->email))
{
// collect mailchimp customer info
if(($mailchimp_info = $this->mailchimp_lib->getMemberInfo($this->_list_id, $info->email)) !== FALSE)
if(($mailchimp_info = $this->mailchimp_lib->getMemberInfo($this->_list_id, $info->email)) !== false)
{
$data['mailchimp_info'] = $mailchimp_info;
// collect customer mailchimp emails activities (stats)
if(($activities = $this->mailchimp_lib->getMemberActivity($this->_list_id, $info->email)) !== FALSE)
if(($activities = $this->mailchimp_lib->getMemberActivity($this->_list_id, $info->email)) !== false)
{
if(array_key_exists('activity', $activities))
{
@@ -288,17 +288,17 @@ class Customers extends Persons
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $this->request->getPost('date'));
$customer_data = [
'consent' => $this->request->getPost('consent') != NULL,
'account_number' => $this->request->getPost('account_number') == '' ? NULL : $this->request->getPost('account_number'),
'consent' => $this->request->getPost('consent') != null,
'account_number' => $this->request->getPost('account_number') == '' ? null : $this->request->getPost('account_number'),
'tax_id' => $this->request->getPost('tax_id'),
'company_name' => $this->request->getPost('company_name') == '' ? NULL : $this->request->getPost('company_name'),
'company_name' => $this->request->getPost('company_name') == '' ? null : $this->request->getPost('company_name'),
'discount' => $this->request->getPost('discount') == '' ? 0.00 : $this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'discount_type' => $this->request->getPost('discount_type') == NULL ? PERCENT : $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT),
'package_id' => $this->request->getPost('package_id') == '' ? NULL : $this->request->getPost('package_id'),
'taxable' => $this->request->getPost('taxable') != NULL,
'discount_type' => $this->request->getPost('discount_type') == null ? PERCENT : $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT),
'package_id' => $this->request->getPost('package_id') == '' ? null : $this->request->getPost('package_id'),
'taxable' => $this->request->getPost('taxable') != null,
'date' => $date_formatter->format('Y-m-d H:i:s'),
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
'sales_tax_code_id' => $this->request->getPost('sales_tax_code_id') == '' ? NULL : $this->request->getPost('sales_tax_code_id', FILTER_SANITIZE_NUMBER_INT)
'sales_tax_code_id' => $this->request->getPost('sales_tax_code_id') == '' ? null : $this->request->getPost('sales_tax_code_id', FILTER_SANITIZE_NUMBER_INT)
];
if($this->customer->save_customer($person_data, $customer_data, $customer_id))
@@ -311,14 +311,14 @@ class Customers extends Persons
$first_name,
$last_name,
$mailchimp_status == null ? "" : $mailchimp_status,
['vip' => $this->request->getPost('mailchimp_vip') != NULL]
['vip' => $this->request->getPost('mailchimp_vip') != null]
);
// New customer
if($customer_id == NEW_ENTRY)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Customers.successful_adding') . ' ' . $first_name . ' ' . $last_name,
'id' => $customer_data['person_id']
]);
@@ -326,7 +326,7 @@ class Customers extends Persons
else // Existing customer
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Customers.successful_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => $customer_id
]);
@@ -335,7 +335,7 @@ class Customers extends Persons
else // Failure
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Customers.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => NEW_ENTRY
]);
@@ -385,12 +385,12 @@ class Customers extends Persons
if($count == count($customers_to_delete))
{
echo json_encode (['success' => TRUE,
echo json_encode (['success' => true,
'message' => lang('Customers.successful_deleted') . ' ' . $count . ' ' . lang('Customers.one_or_multiple')]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Customers.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Customers.cannot_be_deleted')]);
}
}
@@ -413,11 +413,11 @@ class Customers extends Persons
{
if($_FILES['file_path']['error'] != UPLOAD_ERR_OK)
{
echo json_encode (['success' => FALSE, 'message' => lang('Customers.csv_import_failed')]);
echo json_encode (['success' => false, 'message' => lang('Customers.csv_import_failed')]);
}
else
{
if(($handle = fopen($_FILES['file_path']['tmp_name'], 'r')) !== FALSE)
if(($handle = fopen($_FILES['file_path']['tmp_name'], 'r')) !== false)
{
// Skip the first row as it's the table description
fgetcsv($handle);
@@ -425,7 +425,7 @@ class Customers extends Persons
$failCodes = [];
while(($data = fgetcsv($handle)) !== FALSE)
while(($data = fgetcsv($handle)) !== false)
{
$consent = $data[3] == '' ? 0 : 1;
@@ -469,7 +469,7 @@ class Customers extends Persons
}
else
{
$invalidated = TRUE;
$invalidated = true;
}
if($invalidated)
@@ -493,16 +493,16 @@ class Customers extends Persons
{
$message = lang('Customers.csv_import_partially_failed', [count($failCodes), implode(', ', $failCodes)]);
echo json_encode (['success' => FALSE, 'message' => $message]);
echo json_encode (['success' => false, 'message' => $message]);
}
else
{
echo json_encode (['success' => TRUE, 'message' => lang('Customers.csv_import_success')]);
echo json_encode (['success' => true, 'message' => lang('Customers.csv_import_success')]);
}
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Customers.csv_import_nodata_wrongformat')]);
echo json_encode (['success' => false, 'message' => lang('Customers.csv_import_nodata_wrongformat')]);
}
}
}

View File

@@ -127,12 +127,12 @@ class Employees extends Persons
foreach($this->module->get_all_permissions()->getResult() as $permission)
{
$grants = [];
$grant = $this->request->getPost('grant_'.$permission->permission_id) != NULL ? $this->request->getPost('grant_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
$grant = $this->request->getPost('grant_'.$permission->permission_id) != null ? $this->request->getPost('grant_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
if($grant == $permission->permission_id)
{
$grants['permission_id'] = $permission->permission_id;
$grants['menu_group'] = $this->request->getPost('menu_group_'.$permission->permission_id) != NULL ? $this->request->getPost('menu_group_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '--';
$grants['menu_group'] = $this->request->getPost('menu_group_'.$permission->permission_id) != null ? $this->request->getPost('menu_group_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '--';
$grants_array[] = $grants;
}
}
@@ -165,7 +165,7 @@ class Employees extends Persons
if($employee_id == NEW_ENTRY)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Employees.successful_adding') . ' ' . $first_name . ' ' . $last_name,
'id' => $employee_data['person_id']
]);
@@ -173,7 +173,7 @@ class Employees extends Persons
else // Existing employee
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Employees.successful_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => $employee_id
]);
@@ -182,7 +182,7 @@ class Employees extends Persons
else // Failure
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Employees.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => NEW_ENTRY
]);
@@ -199,13 +199,13 @@ class Employees extends Persons
if($this->employee->delete_list($employees_to_delete)) //TODO: this is passing a string, but delete_list expects an array
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Employees.successful_deleted') . ' ' . count($employees_to_delete) . ' ' . lang('Employees.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Employees.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Employees.cannot_be_deleted')]);
}
}

View File

@@ -55,7 +55,7 @@ class Expenses extends Secure_Controller
];
// check if any filter is set in the multiselect dropdown
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), TRUE); //TODO: variable naming does not match standard
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS), true); //TODO: variable naming does not match standard
$filters = array_merge($filters, $filledup);
$expenses = $this->expense->search($search, $filters, $limit, $offset, $sort, $order);
$total_rows = $this->expense->get_found_rows($search, $filters);
@@ -94,7 +94,7 @@ class Expenses extends Secure_Controller
$data['expenses_info'] = $this->expense->get_info($expense_id);
$expense_categories = [];
foreach($this->expense_category->get_all(0, 0, TRUE)->getResultArray() as $row)
foreach($this->expense_category->get_all(0, 0, true)->getResultArray() as $row)
{
$expense_categories[$row['expense_category_id']] = $row['category_name'];
}
@@ -142,7 +142,7 @@ class Expenses extends Secure_Controller
$expense_data = [
'date' => $date_formatter->format('Y-m-d H:i:s'),
'supplier_id' => $this->request->getPost('supplier_id') == '' ? NULL : $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT),
'supplier_id' => $this->request->getPost('supplier_id') == '' ? null : $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT),
'supplier_tax_code' => $this->request->getPost('supplier_tax_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'amount' => parse_decimals($this->request->getPost('amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'tax_amount' => parse_decimals($this->request->getPost('tax_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
@@ -150,7 +150,7 @@ class Expenses extends Secure_Controller
'expense_category_id' => $this->request->getPost('expense_category_id', FILTER_SANITIZE_NUMBER_INT),
'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
'deleted' => $this->request->getPost('deleted') != NULL
'deleted' => $this->request->getPost('deleted') != null
];
if($this->expense->save_value($expense_data, $expense_id))
@@ -158,24 +158,24 @@ class Expenses extends Secure_Controller
//New Expense
if($expense_id == NEW_ENTRY)
{
echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_adding'), 'id' => $expense_data['expense_id']]);
echo json_encode (['success' => true, 'message' => lang('Expenses.successful_adding'), 'id' => $expense_data['expense_id']]);
}
else // Existing Expense
{
echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_updating'), 'id' => $expense_id]);
echo json_encode (['success' => true, 'message' => lang('Expenses.successful_updating'), 'id' => $expense_id]);
}
}
else//failure
{
echo json_encode (['success' => FALSE, 'message' => lang('Expenses.error_adding_updating'), 'id' => NEW_ENTRY]);
echo json_encode (['success' => false, 'message' => lang('Expenses.error_adding_updating'), 'id' => NEW_ENTRY]);
}
}
public function ajax_check_amount(): void
{
$value = $this->request->getPost(NULL, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$value = $this->request->getPost(null, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$parsed_value = parse_decimals(array_pop($value));
echo json_encode (['success' => $parsed_value !== FALSE]);
echo json_encode (['success' => $parsed_value !== false]);
}
public function postDelete(): void
@@ -184,11 +184,11 @@ class Expenses extends Secure_Controller
if($this->expense->delete_list($expenses_to_delete))
{
echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_deleted') . ' ' . count($expenses_to_delete) . ' ' . lang('Expenses.one_or_multiple'), 'ids' => $expenses_to_delete]);
echo json_encode (['success' => true, 'message' => lang('Expenses.successful_deleted') . ' ' . count($expenses_to_delete) . ' ' . lang('Expenses.one_or_multiple'), 'ids' => $expenses_to_delete]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Expenses.cannot_be_deleted'), 'ids' => $expenses_to_delete]);
echo json_encode (['success' => false, 'message' => lang('Expenses.cannot_be_deleted'), 'ids' => $expenses_to_delete]);
}
}
}

View File

@@ -107,7 +107,7 @@ class Giftcards extends Secure_Controller
'record_time' => date('Y-m-d H:i:s'),
'giftcard_number' => $giftcard_number,
'value' => parse_decimals($this->request->getPost('giftcard_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'person_id' => $this->request->getPost('person_id') == '' ? NULL : $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT)
'person_id' => $this->request->getPost('person_id') == '' ? null : $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT)
];
if($this->giftcard->save_value($giftcard_data, $giftcard_id))
@@ -116,7 +116,7 @@ class Giftcards extends Secure_Controller
if($giftcard_id == NEW_ENTRY) //TODO: Constant needed
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Giftcards.successful_adding') . ' ' . $giftcard_data['giftcard_number'],
'id' => $giftcard_data['giftcard_id']
]);
@@ -124,7 +124,7 @@ class Giftcards extends Secure_Controller
else //Existing giftcard
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Giftcards.successful_updating') . ' ' . $giftcard_data['giftcard_number'],
'id' => $giftcard_id
]);
@@ -133,7 +133,7 @@ class Giftcards extends Secure_Controller
else //failure
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Giftcards.error_adding_updating') . ' ' . $giftcard_data['giftcard_number'],
'id' => NEW_ENTRY
]);
@@ -148,7 +148,7 @@ class Giftcards extends Secure_Controller
public function postCheckNumberGiftcard(): void
{
$parsed_value = parse_decimals($this->request->getPost('giftcard_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
echo json_encode (['success' => $parsed_value !== FALSE, 'giftcard_amount' => to_currency_no_money($parsed_value)]);
echo json_encode (['success' => $parsed_value !== false, 'giftcard_amount' => to_currency_no_money($parsed_value)]);
}
public function postDelete(): void
@@ -158,13 +158,13 @@ class Giftcards extends Secure_Controller
if($this->giftcard->delete_list($giftcards_to_delete))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Giftcards.successful_deleted') . ' ' . count($giftcards_to_delete).' '.lang('Giftcards.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Giftcards.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Giftcards.cannot_be_deleted')]);
}
}
}

View File

@@ -8,7 +8,7 @@ class Home extends Secure_Controller
{
public function __construct()
{
parent::__construct('home', NULL, 'home');
parent::__construct('home', null, 'home');
}
public function getIndex(): void
@@ -56,7 +56,7 @@ class Home extends Secure_Controller
if($this->employee->change_password($employee_data, $employee_id))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Employees.successful_change_password'),
'id' => $employee_id
]);
@@ -64,7 +64,7 @@ class Home extends Secure_Controller
else//failure
{//TODO: Replace -1 with constant
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Employees.unsuccessful_change_password'),
'id' => -1
]);
@@ -73,7 +73,7 @@ class Home extends Secure_Controller
else
{//TODO: Replace -1 with constant
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Employees.current_password_invalid'),
'id' => -1
]);
@@ -82,7 +82,7 @@ class Home extends Secure_Controller
else
{//TODO: Replace -1 with constant
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Employees.current_password_invalid'),
'id' => -1
]);

View File

@@ -152,35 +152,35 @@ class Item_kits extends Secure_Controller
$item_kit_data = [
'name' => $this->request->getPost('name'),
'item_kit_number' => $this->request->getPost('item_kit_number'),
'item_id' => empty($this->request->getPost('kit_item_id')) ? NULL : intval($this->request->getPost('kit_item_id')),
'item_id' => empty($this->request->getPost('kit_item_id')) ? null : intval($this->request->getPost('kit_item_id')),
'kit_discount' => parse_decimals($this->request->getPost('kit_discount')),
'kit_discount_type' => $this->request->getPost('kit_discount_type') === NULL ? PERCENT : intval($this->request->getPost('kit_discount_type')),
'price_option' => $this->request->getPost('price_option') === NULL ? PRICE_ALL : intval($this->request->getPost('price_option')),
'print_option' => $this->request->getPost('print_option') === NULL ? PRINT_ALL : intval($this->request->getPost('print_option')),
'kit_discount_type' => $this->request->getPost('kit_discount_type') === null ? PERCENT : intval($this->request->getPost('kit_discount_type')),
'price_option' => $this->request->getPost('price_option') === null ? PRICE_ALL : intval($this->request->getPost('price_option')),
'print_option' => $this->request->getPost('print_option') === null ? PRINT_ALL : intval($this->request->getPost('print_option')),
'description' => $this->request->getPost('description')
];
if($this->item_kit->save_value($item_kit_data, $item_kit_id))
{
$new_item = FALSE;
$new_item = false;
//New item kit
if($item_kit_id == NEW_ENTRY)
{
$item_kit_id = $item_kit_data['item_kit_id'];
$new_item = TRUE;
$new_item = true;
}
$item_kit_items_array = $this->request->getPost('item_kit_qty') === NULL ? NULL : $this->request->getPost('item_kit_qty');
$item_kit_items_array = $this->request->getPost('item_kit_qty') === null ? null : $this->request->getPost('item_kit_qty');
if($item_kit_items_array != NULL)
if($item_kit_items_array != null)
{
$item_kit_items = [];
foreach($item_kit_items_array as $item_id => $item_kit_qty)
{
$item_kit_items[] = [
'item_id' => $item_id,
'quantity' => $item_kit_qty === NULL ? 0 : parse_quantity($item_kit_qty),
'kit_sequence' => $this->request->getPost("item_kit_seq[$item_id]") === NULL ? 0 : intval($this->request->getPost("item_kit_seq[$item_id]"))
'quantity' => $item_kit_qty === null ? 0 : parse_quantity($item_kit_qty),
'kit_sequence' => $this->request->getPost("item_kit_seq[$item_id]") === null ? 0 : intval($this->request->getPost("item_kit_seq[$item_id]"))
];
}
}
@@ -191,7 +191,7 @@ class Item_kits extends Secure_Controller
}
else
{
$success = TRUE;
$success = true;
}
if($new_item)
@@ -215,7 +215,7 @@ class Item_kits extends Secure_Controller
else//failure
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Item_kits.error_adding_updating') . ' ' . $item_kit_data['name'],
'id' => NEW_ENTRY
]);
@@ -229,13 +229,13 @@ class Item_kits extends Secure_Controller
if($this->item_kit->delete_list($item_kits_to_delete))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Item_kits.successful_deleted') . ' ' . count($item_kits_to_delete) . ' ' . lang('Item_kits.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Item_kits.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Item_kits.cannot_be_deleted')]);
}
}

View File

@@ -1221,7 +1221,7 @@ class Items extends Secure_Controller
$dropdown_values = $attribute_data[$definition_name]['dropdown_values'];
$dropdown_values[] = '';
if(!empty($attribute_value) && in_array($attribute_value, $dropdown_values) === false)
if(!empty($attribute_value) && !in_array($attribute_value, $dropdown_values))
{
log_message('Error',"Value: '$attribute_value' is not an acceptable DROPDOWN value");
return true;
@@ -1235,7 +1235,7 @@ class Items extends Secure_Controller
}
break;
case DATE:
if(valid_date($attribute_value) === false && !empty($attribute_value))
if(!valid_date($attribute_value) && !empty($attribute_value))
{
log_message('Error',"'$attribute_value' is not an acceptable DATE value. The value must match the set locale.");
return true;
@@ -1282,7 +1282,7 @@ class Items extends Secure_Controller
return true;
}
if($attribute_id === false)
if(!$attribute_id)
{
return true;
}
@@ -1300,11 +1300,11 @@ class Items extends Secure_Controller
$this->attribute->delete_link($item_id, $attribute_data['definition_id']);
if($attribute_id === false)
if(!$attribute_id)
{
$attribute_id = $this->attribute->save_value($value, $attribute_data['definition_id'], $item_id, false, $attribute_data['definition_type']);
}
else if($this->attribute->save_link($item_id, $attribute_data['definition_id'], $attribute_id) === false)
else if(!$this->attribute->save_link($item_id, $attribute_data['definition_id'], $attribute_id))
{
return false;
}

View File

@@ -45,11 +45,11 @@ class Messages extends Secure_Controller
if($response)
{
echo json_encode (['success' => TRUE, 'message' => lang('Messages.successfully_sent') . ' ' . esc($phone)]);
echo json_encode (['success' => true, 'message' => lang('Messages.successfully_sent') . ' ' . esc($phone)]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone)]);
echo json_encode (['success' => false, 'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone)]);
}
}
@@ -69,7 +69,7 @@ class Messages extends Secure_Controller
if($response)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Messages.successfully_sent') . ' ' . esc($phone),
'person_id' => $person_id
]);
@@ -77,7 +77,7 @@ class Messages extends Secure_Controller
else
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone),
'person_id' => NEW_ENTRY
]);

View File

@@ -13,7 +13,7 @@ class Office extends Secure_Controller
function __construct()
{
parent::__construct('office', NULL, 'office');
parent::__construct('office', null, 'office');
}
public function getIndex(): void

View File

@@ -9,7 +9,7 @@ abstract class Persons extends Secure_Controller
{
protected Person $person;
public function __construct(string $module_id = NULL)
public function __construct(string $module_id = null)
{
parent::__construct($module_id);

View File

@@ -233,7 +233,7 @@ class Receivings extends Secure_Controller
/**
* @throws ReflectionException
*/
public function postDelete(int $receiving_id = -1, bool $update_inventory = TRUE) : void
public function postDelete(int $receiving_id = -1, bool $update_inventory = true) : void
{
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
$receiving_ids = $receiving_id == -1 ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$receiving_id]; //TODO: Replace -1 with constant
@@ -241,13 +241,13 @@ class Receivings extends Secure_Controller
if($this->receiving->delete_list($receiving_ids, $employee_id, $update_inventory)) //TODO: Likely need to surround this block of code in a try-catch to catch the ReflectionException
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Receivings.successfully_deleted') . ' ' . count($receiving_ids) . ' ' . lang('Receivings.one_or_multiple'),
'ids' => $receiving_ids]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Receivings.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Receivings.cannot_be_deleted')]);
}
}
@@ -279,7 +279,7 @@ class Receivings extends Secure_Controller
$data['payment_type'] = $this->request->getPost('payment_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$data['show_stock_locations'] = $this->stock_location->show_locations('receivings');
$data['stock_location'] = $this->receiving_lib->get_stock_source();
if($this->request->getPost('amount_tendered') != NULL)
if($this->request->getPost('amount_tendered') != null)
{
$data['amount_tendered'] = $this->request->getPost('amount_tendered', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$data['amount_change'] = to_currency($data['amount_tendered'] - $data['total']);
@@ -388,7 +388,7 @@ class Receivings extends Secure_Controller
}
}
$data['print_after_sale'] = FALSE;
$data['print_after_sale'] = false;
echo view("receivings/receipt", $data);
@@ -452,17 +452,17 @@ class Receivings extends Secure_Controller
$receiving_data = [
'receiving_time' => $receiving_time,
'supplier_id' => $this->request->getPost('supplier_id') ? $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT) : NULL,
'supplier_id' => $this->request->getPost('supplier_id') ? $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT) : null,
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
'comment' => $this->request->getPost('comment', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'reference' => $this->request->getPost('reference') != '' ? $this->request->getPost('reference', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL
'reference' => $this->request->getPost('reference') != '' ? $this->request->getPost('reference', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null
];
$this->inventory->update('RECV '.$receiving_id, ['trans_date' => $receiving_time]);
if($this->receiving->update($receiving_id, $receiving_data))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Receivings.successfully_updated'),
'id' => $receiving_id
]);
@@ -470,7 +470,7 @@ class Receivings extends Secure_Controller
else
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Receivings.unsuccessfully_updated'),
'id' => $receiving_id
]);

View File

@@ -534,7 +534,7 @@ class Reports extends Secure_Controller
$stock_locations = $data = $this->stock_location->get_allowed_locations('sales');
$stock_locations['all'] = lang('Reports.all');
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
$data['stock_locations'] = array_reverse($stock_locations, true);
$data['mode'] = 'sale';
$data['discount_type_options'] = ['0' => lang('Reports.discount_percent'), '1'=> lang('Reports.discount_fixed')];
$data['sale_type_options'] = $this->get_sale_type_options();
@@ -649,7 +649,7 @@ class Reports extends Secure_Controller
$stock_locations = $data = $this->stock_location->get_allowed_locations('sales');
$stock_locations['all'] = lang('Reports.all');
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
$data['stock_locations'] = array_reverse($stock_locations, true);
$data['mode'] = 'sale';
$data['sale_type_options'] = $this->get_sale_type_options();
@@ -672,7 +672,7 @@ class Reports extends Secure_Controller
$stock_locations = $data = $this->stock_location->get_allowed_locations('sales');
$stock_locations['all'] = lang('Reports.all');
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
$data['stock_locations'] = array_reverse($stock_locations, true);
$data['mode'] = 'sale';
$data['sale_type_options'] = $this->get_sale_type_options();
@@ -683,7 +683,7 @@ class Reports extends Secure_Controller
{
$stock_locations = $data = $this->stock_location->get_allowed_locations('receivings');
$stock_locations['all'] = lang('Reports.all');
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
$data['stock_locations'] = array_reverse($stock_locations, true);
$data['mode'] = 'receiving';
echo view('reports/date_input', $data);
@@ -721,7 +721,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -760,7 +760,7 @@ class Reports extends Secure_Controller
'summary_data_1' => $summary,
'yaxis_title' => lang('Reports.revenue'),
'xaxis_title' => lang('Reports.date'),
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -800,7 +800,7 @@ class Reports extends Secure_Controller
'summary_data_1' => $summary,
'yaxis_title' => lang('Reports.items'),
'xaxis_title' => lang('Reports.revenue'),
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -836,7 +836,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -874,7 +874,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -911,7 +911,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -948,7 +948,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -985,7 +985,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -1024,7 +1024,7 @@ class Reports extends Secure_Controller
'summary_data_1' => $summary,
'yaxis_title' => lang('Reports.customers'),
'xaxis_title' => lang('Reports.revenue'),
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -1064,7 +1064,7 @@ class Reports extends Secure_Controller
'summary_data_1' => $summary,
'yaxis_title' => lang('Reports.count'),
'xaxis_title' => lang('Reports.discount'),
'show_currency' => FALSE
'show_currency' => false
];
echo view('reports/graphical', $data);
@@ -1104,7 +1104,7 @@ class Reports extends Secure_Controller
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $summary,
'show_currency' => TRUE
'show_currency' => true
];
echo view('reports/graphical', $data);
@@ -1884,7 +1884,7 @@ class Reports extends Secure_Controller
$stock_locations = $this->stock_location->get_allowed_locations();
$stock_locations['all'] = lang('Reports.all');
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
$data['stock_locations'] = array_reverse($stock_locations, true);
echo view('reports/inventory_summary_input', $data);
}

View File

@@ -114,10 +114,10 @@ class Sales extends Secure_Controller
'location_id' => 'all',
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'only_cash' => FALSE,
'only_due' => FALSE,
'only_check' => FALSE,
'only_creditcard' => FALSE,
'only_cash' => false,
'only_due' => false,
'only_check' => false,
'only_creditcard' => false,
'only_invoices' => $this->config['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT),
'is_valid_receipt' => $this->sale->is_valid_receipt($search)
];
@@ -152,14 +152,14 @@ class Sales extends Secure_Controller
public function getItemSearch(): void
{
$suggestions = [];
$receipt = $search = $this->request->getGet('term') != '' ? $this->request->getGet('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL;
$receipt = $search = $this->request->getGet('term') != '' ? $this->request->getGet('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
if($this->sale_lib->get_mode() == 'return' && $this->sale->is_valid_receipt($receipt))
{
// if a valid receipt or invoice was found the search term will be replaced with a receipt number (POS #)
$suggestions[] = $receipt;
}
$suggestions = array_merge($suggestions, $this->item->get_search_suggestions($search, ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE));
$suggestions = array_merge($suggestions, $this->item->get_search_suggestions($search, ['search_custom' => false, 'is_deleted' => false], true));
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($search));
echo json_encode($suggestions);
@@ -167,7 +167,7 @@ class Sales extends Secure_Controller
public function suggest_search(): void
{
$search = $this->request->getPost('term') != '' ? $this->request->getPost('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL;
$search = $this->request->getPost('term') != '' ? $this->request->getPost('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
$suggestions = $this->sale->get_search_suggestions($search);
@@ -399,7 +399,7 @@ class Sales extends Secure_Controller
{
$package_name = $this->customer_rewards->get_name($package_id); //TODO: this variable is never used.
$points = $this->customer->get_info($customer_id)->points;
$points = ($points == NULL ? 0 : $points);
$points = ($points == null ? 0 : $points);
$payments = $this->sale_lib->get_payments();
$current_payments_with_rewards = isset($payments[$payment_type]) ? $payments[$payment_type]['payment_amount'] : 0;
@@ -425,7 +425,7 @@ class Sales extends Secure_Controller
elseif($payment_type === lang('Sales.cash'))
{
$amount_due = $this->sale_lib->get_total();
$sales_total = $this->sale_lib->get_total(FALSE);
$sales_total = $this->sale_lib->get_total(false);
$amount_tendered = $this->request->getPost('amount_tendered', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$this->sale_lib->add_payment($payment_type, $amount_tendered);
@@ -528,19 +528,19 @@ class Sales extends Secure_Controller
}
// Add item kit items to order
$stock_warning = NULL;
$stock_warning = null;
if(!$this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt, $item_location, $discount, $discount_type, $kit_price_option, $kit_print_option, $stock_warning))
{
$data['error'] = lang('Sales.unable_to_add_item');
}
elseif($stock_warning != NULL)
elseif($stock_warning != null)
{
$data['warning'] = $stock_warning;
}
}
else
{
if(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $item_location, $quantity, $discount, $discount_type, PRICE_MODE_STANDARD, NULL, NULL, $price))
if(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $item_location, $quantity, $discount, $discount_type, PRICE_MODE_STANDARD, null, null, $price))
{
$data['error'] = lang('Sales.unable_to_add_item');
}
@@ -579,7 +579,7 @@ class Sales extends Secure_Controller
$discount = $discount_type ? parse_quantity($this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)) : parse_decimals($this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$item_location = $this->request->getPost('location', FILTER_SANITIZE_NUMBER_INT);
$discounted_total = $this->request->getPost('discounted_total') != '' ? $this->request->getPost('discounted_total', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : NULL;
$discounted_total = $this->request->getPost('discounted_total') != '' ? $this->request->getPost('discounted_total', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : null;
$this->sale_lib->edit_item($line, $description, $serialnumber, $quantity, $discount, $discount_type, $price, $discounted_total);
@@ -677,7 +677,7 @@ class Sales extends Secure_Controller
$data["quote_number"] = $quote_number;
$customer_info = $this->_load_customer_data($customer_id, $data);
if($customer_info != NULL)
if($customer_info != null)
{
$data["customer_comments"] = $customer_info->comments;
$data['tax_id'] = $customer_info->tax_id;
@@ -734,14 +734,14 @@ class Sales extends Secure_Controller
}
}
$data['print_price_info'] = TRUE;
$data['print_price_info'] = true;
if($this->sale_lib->is_invoice_mode())
{
$invoice_format = $this->config['sales_invoice_format'];
// generate final invoice number (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way
if(!empty($invoice_format) && $invoice_number == NULL)
if(!empty($invoice_format) && $invoice_number == null)
{
// The user can retain the default encoded format or can manually override it. It still passes through the rendering step.
$invoice_number = $this->token_lib->render($invoice_format);
@@ -786,13 +786,13 @@ class Sales extends Secure_Controller
if(!($data['price_work_orders'] == 1))
{
$data['print_price_info'] = FALSE;
$data['print_price_info'] = false;
}
$data['sales_work_order'] = lang('Sales.work_order');
$data['work_order_number_label'] = lang('Sales.work_order_number');
if($work_order_number == NULL)
if($work_order_number == null)
{
// generate work order number
$work_order_format = $this->config['work_order_format'];
@@ -815,7 +815,7 @@ class Sales extends Secure_Controller
$data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']);
$data['barcode'] = NULL;
$data['barcode'] = null;
echo view('sales/work_order', $data);
$this->sale_lib->clear_mode();
@@ -827,7 +827,7 @@ class Sales extends Secure_Controller
$data['sales_quote'] = lang('Sales.quote');
$data['quote_number_label'] = lang('Sales.quote_number');
if($quote_number == NULL)
if($quote_number == null)
{
// generate quote number
$quote_format = $this->config['sales_quote_format'];
@@ -849,7 +849,7 @@ class Sales extends Secure_Controller
$this->sale_lib->set_suspended_id($data['sale_id_num']);
$data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']);
$data['barcode'] = NULL;
$data['barcode'] = null;
echo view('sales/quote', $data);
$this->sale_lib->clear_mode();
@@ -898,7 +898,7 @@ class Sales extends Secure_Controller
{
$sale_data = $this->_load_sale_data($sale_id);
$result = FALSE;
$result = false;
$message = lang('Sales.invoice_no_email');
if(!empty($sale_data['customer_email']))
@@ -923,7 +923,7 @@ class Sales extends Secure_Controller
// load pdf helper
helper (['dompdf', 'file']);
$filename = sys_get_temp_dir() . '/' . lang('Sales.' . $type) . '-' . str_replace('/', '-', $number) . '.pdf';
if(file_put_contents($filename, create_pdf($html)) !== FALSE)
if(file_put_contents($filename, create_pdf($html)) !== false)
{
$result = $this->email_lib->sendEmail($to, $subject, $text, $filename);
}
@@ -942,7 +942,7 @@ class Sales extends Secure_Controller
{
$sale_data = $this->_load_sale_data($sale_id);
$result = FALSE;
$result = false;
$message = lang('Sales.receipt_no_email');
if(!empty($sale_data['customer_email']))
@@ -967,7 +967,7 @@ class Sales extends Secure_Controller
return $result;
}
private function _load_customer_data(int $customer_id, array &$data, bool $stats = FALSE) //TODO: Hungarian notation
private function _load_customer_data(int $customer_id, array &$data, bool $stats = false) //TODO: Hungarian notation
{
$customer_info = '';
@@ -1004,7 +1004,7 @@ class Sales extends Secure_Controller
$data['customer_discount_type'] = $customer_info->discount_type;
$package_id = $this->customer->get_info($customer_id)->package_id;
if($package_id != NULL)
if($package_id != null)
{
$package_name = $this->customer_rewards->get_name($package_id);
$points = $this->customer->get_info($customer_id)->points;
@@ -1111,8 +1111,8 @@ class Sales extends Secure_Controller
}
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['sale_id']);
$data['print_after_sale'] = FALSE;
$data['price_work_orders'] = FALSE;
$data['print_after_sale'] = false;
$data['price_work_orders'] = false;
if($this->sale_lib->get_mode() == 'sale_invoice') //TODO: Duplicated code.
{
@@ -1161,7 +1161,7 @@ class Sales extends Secure_Controller
$data['cash_rounding'] = $cash_rounding;
$data['cart'] = $this->sale_lib->get_cart();
$customer_info = $this->_load_customer_data($this->sale_lib->get_customer(), $data, TRUE);
$customer_info = $this->_load_customer_data($this->sale_lib->get_customer(), $data, true);
$data['modes'] = $this->sale_lib->get_register_mode_options();
$data['mode'] = $this->sale_lib->get_mode();
@@ -1169,7 +1169,7 @@ class Sales extends Secure_Controller
$data['empty_tables'] = $this->sale_lib->get_empty_tables($data['selected_table']);
$data['stock_locations'] = $this->stock_location->get_allowed_locations('sales');
$data['stock_location'] = $this->sale_lib->get_sale_location();
$data['tax_exclusive_subtotal'] = $this->sale_lib->get_subtotal(TRUE, TRUE);
$data['tax_exclusive_subtotal'] = $this->sale_lib->get_subtotal(true, true);
$tax_details = $this->tax_lib->get_taxes($data['cart']); //TODO: Duplicated code.
$data['taxes'] = $tax_details[0];
$data['discount'] = $this->sale_lib->get_discount();
@@ -1214,7 +1214,7 @@ class Sales extends Secure_Controller
if($customer_info && $this->config['customer_reward_enable'])
{
$data['payment_options'] = $this->sale->get_payment_options(TRUE, TRUE);
$data['payment_options'] = $this->sale->get_payment_options(true, true);
}
else
{
@@ -1227,9 +1227,9 @@ class Sales extends Secure_Controller
$temp_invoice_number = $this->sale_lib->get_invoice_number();
$invoice_format = $this->config['sales_invoice_format'];
if ($temp_invoice_number == NULL || $temp_invoice_number == '')
if ($temp_invoice_number == null || $temp_invoice_number == '')
{
$temp_invoice_number = $this->token_lib->render($invoice_format, [], FALSE);
$temp_invoice_number = $this->token_lib->render($invoice_format, [], false);
}
$data['invoice_number'] = $temp_invoice_number;
@@ -1322,7 +1322,7 @@ class Sales extends Secure_Controller
$data['balance_due'] = $balance_due != 0;
// don't allow gift card to be a payment option in a sale transaction edit because it's a complex change
$payment_options = $this->sale->get_payment_options(FALSE);
$payment_options = $this->sale->get_payment_options(false);
if($this->sale_lib->reset_cash_rounding())
{
@@ -1342,14 +1342,14 @@ class Sales extends Secure_Controller
/**
* @throws ReflectionException
*/
public function postDelete(int $sale_id = NEW_ENTRY, bool $update_inventory = TRUE): void
public function postDelete(int $sale_id = NEW_ENTRY, bool $update_inventory = true): void
{
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
$has_grant = $this->employee->has_grant('sales_delete', $employee_id);
if(!$has_grant)
{
echo json_encode (['success' => FALSE, 'message' => lang('Sales.not_authorized')]);
echo json_encode (['success' => false, 'message' => lang('Sales.not_authorized')]);
}
else
{
@@ -1358,26 +1358,26 @@ class Sales extends Secure_Controller
if($this->sale->delete_list($sale_ids, $employee_id, $update_inventory))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Sales.successfully_deleted') . ' ' . count($sale_ids) . ' ' . lang('Sales.one_or_multiple'),
'ids' => $sale_ids
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Sales.unsuccessfully_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Sales.unsuccessfully_deleted')]);
}
}
}
public function restore(int $sale_id = NEW_ENTRY, bool $update_inventory = TRUE): void
public function restore(int $sale_id = NEW_ENTRY, bool $update_inventory = true): void
{
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
$has_grant = $this->employee->has_grant('sales_delete', $employee_id);
if(!$has_grant)
{
echo json_encode (['success' => FALSE, 'message' => lang('Sales.not_authorized')]);
echo json_encode (['success' => false, 'message' => lang('Sales.not_authorized')]);
}
else
{
@@ -1386,14 +1386,14 @@ class Sales extends Secure_Controller
if($this->sale->restore_list($sale_ids, $employee_id, $update_inventory))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Sales.successfully_restored') . ' ' . count($sale_ids) . ' ' . lang('Sales.one_or_multiple'),
'ids' => $sale_ids
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Sales.unsuccessfully_restored')]);
echo json_encode (['success' => false, 'message' => lang('Sales.unsuccessfully_restored')]);
}
}
}
@@ -1414,10 +1414,10 @@ class Sales extends Secure_Controller
$sale_data = [
'sale_time' => $sale_time,
'customer_id' => $this->request->getPost('customer_id') != '' ? $this->request->getPost('customer_id', FILTER_SANITIZE_NUMBER_INT) : NULL,
'employee_id' => $this->request->getPost('employee_id') != '' ? $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT) : NULL,
'customer_id' => $this->request->getPost('customer_id') != '' ? $this->request->getPost('customer_id', FILTER_SANITIZE_NUMBER_INT) : null,
'employee_id' => $this->request->getPost('employee_id') != '' ? $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT) : null,
'comment' => $this->request->getPost('comment', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'invoice_number' => $this->request->getPost('invoice_number') != '' ? $this->request->getPost('invoice_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : NULL
'invoice_number' => $this->request->getPost('invoice_number') != '' ? $this->request->getPost('invoice_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null
];
// In order to maintain tradition the only element that can change on prior payments is the payment type
@@ -1498,11 +1498,11 @@ class Sales extends Secure_Controller
$inventory->update('POS '.$sale_id, ['trans_date' => $sale_time]); //TODO: Reflection Exception
if($this->sale->update($sale_id, $sale_data))
{
echo json_encode (['success' => TRUE, 'message' => lang('Sales.successfully_updated'), 'id' => $sale_id]);
echo json_encode (['success' => true, 'message' => lang('Sales.successfully_updated'), 'id' => $sale_id]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Sales.unsuccessfully_updated'), 'id' => $sale_id]);
echo json_encode (['success' => false, 'message' => lang('Sales.unsuccessfully_updated'), 'id' => $sale_id]);
}
}
@@ -1666,7 +1666,7 @@ class Sales extends Secure_Controller
$this->item->update_item_number($item_id, $item_number);
$cart = $this->sale_lib->get_cart();
$x = $this->search_cart_for_item_id($item_id, $cart);
if($x != NULL)
if($x != null)
{
$cart[$x]['item_number'] = $item_number;
}
@@ -1683,7 +1683,7 @@ class Sales extends Secure_Controller
$cart = $this->sale_lib->get_cart();
$x = $this->search_cart_for_item_id($item_id, $cart);
if($x != NULL)
if($x != null)
{
$cart[$x]['name'] = $name;
}
@@ -1701,7 +1701,7 @@ class Sales extends Secure_Controller
$cart = $this->sale_lib->get_cart();
$x = $this->search_cart_for_item_id($item_id, $cart);
if($x != NULL)
if($x != null)
{
$cart[$x]['description'] = $description;
}
@@ -1719,6 +1719,6 @@ class Sales extends Secure_Controller
}
}
return NULL;
return null;
}
}

View File

@@ -49,7 +49,7 @@ class Secure_Controller extends BaseController
// load up global global_view_data visible to all the loaded views
$this->session = session();
if($menu_group == NULL)
if($menu_group == null)
{
$menu_group = $this->session->get('menu_group');
}
@@ -62,6 +62,7 @@ class Secure_Controller extends BaseController
? $this->module->get_allowed_home_modules($logged_in_employee_info->person_id)
: $this->module->get_allowed_office_modules($logged_in_employee_info->person_id);
$global_view_data = [];
foreach($allowed_modules->getResult() as $module)
{
$global_view_data['allowed_modules'][] = $module;

View File

@@ -128,7 +128,7 @@ class Suppliers extends Persons
'company_name' => $this->request->getPost('company_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'agency_name' => $this->request->getPost('agency_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'category' => $this->request->getPost('category', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'account_number' => $this->request->getPost('account_number') == '' ? NULL : $this->request->getPost('account_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'account_number' => $this->request->getPost('account_number') == '' ? null : $this->request->getPost('account_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'tax_id' => $this->request->getPost('tax_id', FILTER_SANITIZE_NUMBER_INT)
];
@@ -138,7 +138,7 @@ class Suppliers extends Persons
if($supplier_id == NEW_ENTRY)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Suppliers.successful_adding') . ' ' . $supplier_data['company_name'],
'id' => $supplier_data['person_id']
]);
@@ -146,7 +146,7 @@ class Suppliers extends Persons
else //Existing supplier
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Suppliers.successful_updating') . ' ' . $supplier_data['company_name'],
'id' => $supplier_id]);
}
@@ -154,7 +154,7 @@ class Suppliers extends Persons
else//failure
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Suppliers.error_adding_updating') . ' ' . $supplier_data['company_name'],
'id' => NEW_ENTRY
]);
@@ -171,13 +171,13 @@ class Suppliers extends Persons
if($this->supplier->delete_list($suppliers_to_delete))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Suppliers.successful_deleted') . ' ' . count($suppliers_to_delete) . ' ' . lang('Suppliers.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Suppliers.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Suppliers.cannot_be_deleted')]);
}
}
}

View File

@@ -75,7 +75,7 @@ class Tax_categories extends Secure_Controller
if($tax_category_id == NEW_ENTRY)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_categories.successful_adding'),
'id' => $tax_category_data['tax_category_id']
]);
@@ -83,7 +83,7 @@ class Tax_categories extends Secure_Controller
else
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_categories.successful_updating'),
'id' => $tax_category_id
]);
@@ -92,7 +92,7 @@ class Tax_categories extends Secure_Controller
else
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Tax_categories.error_adding_updating') . ' ' . $tax_category_data['tax_category'],
'id' => NEW_ENTRY
]);
@@ -106,13 +106,13 @@ class Tax_categories extends Secure_Controller
if($this->tax_category->delete_list($tax_categories_to_delete))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_categories.successful_deleted') . ' ' . count($tax_categories_to_delete) . ' ' . lang('Tax_categories.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Tax_categories.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Tax_categories.cannot_be_deleted')]);
}
}
}

View File

@@ -83,7 +83,7 @@ class Tax_codes extends Secure_Controller
if($tax_code_id == NEW_ENTRY)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_codes.successful_adding'),
'id' => $tax_code_data['tax_code_id']
]);
@@ -91,7 +91,7 @@ class Tax_codes extends Secure_Controller
else
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_codes.successful_updating'),
'id' => $tax_code_id
]);
@@ -100,7 +100,7 @@ class Tax_codes extends Secure_Controller
else
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Tax_codes.error_adding_updating') . ' ' . $tax_code_data['tax_code_id'],
'id' => NEW_ENTRY
]);
@@ -114,13 +114,13 @@ class Tax_codes extends Secure_Controller
if($this->tax_code->delete_list($tax_codes_to_delete))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_codes.successful_deleted') . ' ' . count($tax_codes_to_delete) . ' ' . lang('Tax_codes.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Tax_codes.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Tax_codes.cannot_be_deleted')]);
}
}
}

View File

@@ -76,7 +76,7 @@ class Tax_jurisdictions extends Secure_Controller
if($jurisdiction_id == NEW_ENTRY)
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_jurisdictions.successful_adding'),
'id' => $tax_jurisdiction_data['jurisdiction_id']
]);
@@ -84,7 +84,7 @@ class Tax_jurisdictions extends Secure_Controller
else
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_jurisdictions.successful_updating'),
'id' => $jurisdiction_id
]);
@@ -93,7 +93,7 @@ class Tax_jurisdictions extends Secure_Controller
else
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Tax_jurisdictions.error_adding_updating') . ' ' . $tax_jurisdiction_data['jurisdiction_name'],
'id' => NEW_ENTRY
]);
@@ -107,13 +107,13 @@ class Tax_jurisdictions extends Secure_Controller
if($this->tax_jurisdiction->delete_list($tax_jurisdictions_to_delete))
{
echo json_encode ([
'success' => TRUE,
'success' => true,
'message' => lang('Tax_jurisdictions.successful_deleted') . ' ' . count($tax_jurisdictions_to_delete) . ' ' . lang('Tax_jurisdictions.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Tax_jurisdictions.cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Tax_jurisdictions.cannot_be_deleted')]);
}
}
}

View File

@@ -386,16 +386,16 @@ class Taxes extends Secure_Controller
{
if($tax_rate_id == NEW_ENTRY)
{//TODO: this needs to be replaced with ternary notation
echo json_encode (['success' => TRUE, 'message' => lang('Taxes.tax_rate_successfully_added')]);
echo json_encode (['success' => true, 'message' => lang('Taxes.tax_rate_successfully_added')]);
}
else //Existing tax_code
{
echo json_encode (['success' => TRUE, 'message' => lang('Taxes.tax_rate_successful_updated')]);
echo json_encode (['success' => true, 'message' => lang('Taxes.tax_rate_successful_updated')]);
}
}
else
{
echo json_encode (['success' => FALSE, 'message' => lang('Taxes.tax_rate_error_adding_updating')]);
echo json_encode (['success' => false, 'message' => lang('Taxes.tax_rate_error_adding_updating')]);
}
}
@@ -405,10 +405,10 @@ class Taxes extends Secure_Controller
if($this->tax->delete_list($tax_codes_to_delete)) //TODO: this needs to be replaced with ternary notation
{
echo json_encode (['success' => TRUE, 'message' => lang('Taxes.tax_code_successful_deleted')]);
echo json_encode (['success' => true, 'message' => lang('Taxes.tax_code_successful_deleted')]);
} else
{
echo json_encode (['success' => FALSE, 'message' => lang('Taxes.tax_code_cannot_be_deleted')]);
echo json_encode (['success' => false, 'message' => lang('Taxes.tax_code_cannot_be_deleted')]);
}
}
@@ -483,7 +483,7 @@ class Taxes extends Secure_Controller
if (in_array($tax_group[$key], $unique_tax_groups)) //TODO: This can be replaced with `in_array($tax_group[$key], $unique_tax_groups)`
{
echo json_encode ([
'success' => FALSE,
'success' => false,
'message' => lang('Taxes.tax_group_not_unique', [$tax_group[$key]])
]);
return;

View File

@@ -40,7 +40,7 @@ class Migration_Sales_Tax_Data extends Migration
$this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id']);
}
}
error_log('Migrating sales tax history. The number of sales that will be migrated is finished.');
}
@@ -52,7 +52,7 @@ class Migration_Sales_Tax_Data extends Migration
{
$tax_decimals = $this->appconfig->get_value('tax_decimals', 2);
$tax_included = $this->appconfig->get_value('tax_included', Migration_Sales_Tax_Data::YES) == Migration_Sales_Tax_Data::YES;
$customer_sales_tax_support = FALSE;
$customer_sales_tax_support = false;
if($tax_included) //TODO: Convert to ternary notation.
{
@@ -71,7 +71,7 @@ class Migration_Sales_Tax_Data extends Migration
{
// This computes tax for each line item and adds it to the tax type total
$tax_group = (float)$item['percent'] . '% ' . $item['name'];
$tax_basis = $this->get_item_total($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], TRUE);
$tax_basis = $this->get_item_total($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], true);
$item_tax_amount = $tax_included
? $this->get_item_tax($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], $item['percent'])
@@ -153,7 +153,7 @@ class Migration_Sales_Tax_Data extends Migration
}
}
public function get_item_total(string $quantity, string $price, string $discount_percentage, bool $include_discount = FALSE): string
public function get_item_total(string $quantity, string $price, string $discount_percentage, bool $include_discount = false): string
{
$total = bcmul($quantity, $price);
@@ -179,7 +179,7 @@ class Migration_Sales_Tax_Data extends Migration
{
$tax_included = $this->appconfig->get_value('tax_included', Migration_Sales_Tax_Data::YES) == Migration_Sales_Tax_Data::YES;
$price = $this->get_item_total($quantity, $price, $discount_percentage, TRUE);
$price = $this->get_item_total($quantity, $price, $discount_percentage, true);
if($tax_included)
{

View File

@@ -48,7 +48,7 @@ class Migration_TaxAmount extends Migration
foreach($unmigrated_invoices as $key => $unmigrated_invoice)
{
$this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id'], $tax_decimals, TRUE);
$this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id'], $tax_decimals, true);
}
$this->db->query('DROP TABLE ' . $this->db->prefixTable('sales_taxes_backup'));
}
@@ -152,7 +152,7 @@ class Migration_TaxAmount extends Migration
}
}
public function get_item_total(string $quantity, string $price, string $discount, bool $include_discount = FALSE): string
public function get_item_total(string $quantity, string $price, string $discount, bool $include_discount = false): string
{
$total = bcmul($quantity, $price);

View File

@@ -5,6 +5,7 @@ namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\ResultInterface;
use App\Models\Attribute;
use Config\OSPOS;
use DateTime;
class Migration_database_optimizations extends Migration
@@ -59,6 +60,7 @@ class Migration_database_optimizations extends Migration
$value = $attribute_value['attribute_decimal'];
break;
case DATE:
$config = config(OSPOS::class)->settings;
$attribute_date = DateTime::createFromFormat('Y-m-d', $attribute_value['attribute_date']);
$value = $attribute_date->format($config['dateformat']);
break;
@@ -67,7 +69,7 @@ class Migration_database_optimizations extends Migration
break;
}
$attribute->save_value($value, $attribute_link['definition_id'], $attribute_link['item_id'], FALSE, $attribute_link['definition_type']);
$attribute->save_value($value, $attribute_link['definition_id'], $attribute_link['item_id'], false, $attribute_link['definition_type']);
}
}
$this->db->transComplete();
@@ -76,10 +78,11 @@ class Migration_database_optimizations extends Migration
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.4.0_database_optimizations.sql');
error_log('Migrating database_optimizations completed');
}
/**
* Given the type of attribute, deletes any duplicates it finds in the attribute_values table and reassigns those
*/
private function migrate_duplicate_attribute_values($attribute_type)
private function migrate_duplicate_attribute_values($attribute_type): void
{
//Remove duplicate attribute values needed to make attribute_decimals and attribute_dates unique
$this->db->transStart();

View File

@@ -2,10 +2,10 @@
DROP TABLE `ospos_sessions`;
CREATE TABLE IF NOT EXISTS `ospos_sessions` (
`id` varchar(128) NOT null,
`ip_address` varchar(45) NOT null,
`timestamp` timestamp DEFAULT CURRENT_TIMESTAMP NOT null,
`data` blob NOT null,
`id` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
`data` blob NOT NULL,
KEY `ospos_sessions_timestamp` (`timestamp`)
);

View File

@@ -6,10 +6,10 @@
function create_pdf(string $html, string $filename = ''): string
{
// need to enable magic quotes for the
$dompdf = new Dompdf\Dompdf (['isRemoteEnabled' => TRUE, 'isPhpEnabled' => TRUE]);
$dompdf = new Dompdf\Dompdf (['isRemoteEnabled' => true, 'isPhpEnabled' => true]);
$dompdf->loadHtml(str_replace (['\n', '\r'], '', $html));
$dompdf->render();
if($filename != '')
{
$dompdf->stream($filename . '.pdf');

View File

@@ -42,23 +42,23 @@ function get_csv_file(string $file_name): array
//It must be done in a way that does not significantly negatively affect performance.
ini_set('auto_detect_line_endings', true);
$csv_rows = FALSE;
$csv_rows = false;
if(($csv_file = fopen($file_name,'r')) !== FALSE)
if(($csv_file = fopen($file_name,'r')) !== false)
{
helper('security');
$csv_rows = [];
//Skip Byte-Order Mark
if(bom_exists($csv_file) === TRUE)
if(bom_exists($csv_file))
{
fseek($csv_file, 3);
}
$headers = fgetcsv($csv_file);
while(($row = fgetcsv($csv_file)) !== FALSE)
while(($row = fgetcsv($csv_file)) !== false)
{
//Skip empty lines
if($row !== [null])
@@ -75,7 +75,7 @@ function get_csv_file(string $file_name): array
function bom_exists(&$file_handle): bool
{
$result = FALSE;
$result = false;
$candidate = fread($file_handle, 3);
rewind($file_handle);
@@ -84,8 +84,8 @@ function bom_exists(&$file_handle): bool
if (0 === strncmp($candidate, $bom, 3))
{
$result = TRUE;
$result = true;
}
return $result;
}
}

View File

@@ -20,7 +20,7 @@ function current_language_code(bool $load_system_language = false): string
$config = config(OSPOS::class)->settings;
// Returns the language code of the employee if set or system language code if not
if($employee->is_logged_in() && $load_system_language === false)
if($employee->is_logged_in() && !$load_system_language)
{
$employee_info = $employee->get_logged_in_employee_info();
@@ -35,7 +35,7 @@ function current_language_code(bool $load_system_language = false): string
return empty($language_code) ? DEFAULT_LANGUAGE_CODE : $language_code;
}
function current_language(bool $load_system_language = FALSE): string
function current_language(bool $load_system_language = false): string
{
$employee = model(Employee::class);
$config = config(OSPOS::class)->settings;
@@ -354,7 +354,7 @@ function to_tax_decimals($number): string
// It looks like it must be creating a String value on the fly because the form is referring to the index 0 when
// there IS no index[0] row in the table
// taxes that are NULL, '' or 0 don't need to be displayed
// taxes that are null, '' or 0 don't need to be displayed
// NOTE: do not remove this line otherwise the items edit form will show a tax with 0, and it will save it
if(empty($number))
{
@@ -369,7 +369,7 @@ function to_quantity_decimals(?float $number): string
return to_decimals($number, 'quantity_decimals');
}
function to_decimals(?float $number, string $decimals = NULL, int $type = NumberFormatter::DECIMAL): string
function to_decimals(?float $number, string $decimals = null, int $type = NumberFormatter::DECIMAL): string
{
// ignore empty strings and return
// NOTE: do not change it to empty otherwise tables will show a 0 with no decimal nor currency symbol
@@ -412,7 +412,7 @@ function parse_tax(string $number)
/**
* @param string $number
* @param int|NULL $decimals
* @param int|null $decimals
* @return false|float|int|mixed|string
*/
function parse_decimals(string $number, int $decimals = null)
@@ -435,7 +435,7 @@ function parse_decimals(string $number, int $decimals = null)
$config = config(OSPOS::class)->settings;
if($decimals === false)
if(!$decimals)
{
$decimals = $config['currency_decimals']; //TODO: $decimals is never used.
}

View File

@@ -33,7 +33,7 @@ function get_report_link(string $report_name, string $report_prefix = '', string
*/
function can_show_report($permission_id, array $restrict_views = []): bool
{
if (strpos($permission_id, 'reports_') === false)
if (!strpos($permission_id, 'reports_'))
{
return false;
}

View File

@@ -29,7 +29,7 @@ function check_encryption(): bool
@chmod($config_path, 0660);
@chmod($backup_path, 0660);
$config_file = file_get_contents($config_path);
$config_file = preg_replace("/(encryption\.key.*=.*)('.*')/", "$1'$key'", $config_file);
@@ -41,23 +41,23 @@ function check_encryption(): bool
}
$handle = @fopen($config_path, 'w+');
if(empty($handle))
{
log_message('error', "Unable to open $config_path for updating");
return false;
}
@chmod($config_path, 0660);
$write_failed = !fwrite($handle, $config_file);
fclose($handle);
if($write_failed)
{
log_message('error', "Unable to write to $config_path for updating.");
return false;
return false;
}
log_message('info', "File $config_path has been updated.");
log_message('info', "File $config_path has been updated.");
}
return true;
@@ -71,13 +71,13 @@ function abort_encryption_conversion()
$config_file = file_get_contents($backup_path);
$handle = @fopen($config_path, 'w+');
if(empty($handle))
{
log_message('error', "Unable to open $config_path to undo encryption conversion");
}
else
{
else
{
@chmod($config_path, 0660);
$write_failed = !fwrite($handle, $config_file);
fclose($handle);
@@ -87,7 +87,7 @@ function abort_encryption_conversion()
log_message('error', "Unable to write to $config_path to undo encryption conversion.");
return;
}
log_message('info', "File $config_path has been updated to undo encryption conversion");
log_message('info', "File $config_path has been updated to undo encryption conversion");
}
}
@@ -98,10 +98,10 @@ function remove_backup()
{
return;
}
if(unlink($backup_path) === false)
if(!unlink($backup_path))
{
log_message('error', "Unable to remove $backup_path.");
return;
}
log_message('info', "File $backup_path has been removed");
log_message('info', "File $backup_path has been removed");
}

View File

@@ -30,13 +30,13 @@ function transform_headers_readonly(array $array): string //TODO: $array needs t
/**
* Basic tabular headers function
*/
function transform_headers(array $array, bool $readonly = FALSE, bool $editable = TRUE): string //TODO: $array needs to be refactored to a new name. Perhaps $headers?
function transform_headers(array $array, bool $readonly = false, bool $editable = true): string //TODO: $array needs to be refactored to a new name. Perhaps $headers?
{
$result = [];
if(!$readonly)
{
$array = array_merge ([['checkbox' => 'select', 'sortable' => FALSE]], $array);
$array = array_merge ([['checkbox' => 'select', 'sortable' => false]], $array);
}
if($editable)
@@ -53,7 +53,7 @@ function transform_headers(array $array, bool $readonly = FALSE, bool $editable
'switchable' => $element['switchable'] ?? !preg_match('(^$|&nbsp)', current($element)),
'escape' => !preg_match("/(edit|phone_number|email|messages|item_pic|customer_name|note)/", key($element)) && !(isset($element['escape']) && !$element['escape']),
'sortable' => $element['sortable'] ?? current($element) != '',
'checkbox' => $element['checkbox'] ?? FALSE,
'checkbox' => $element['checkbox'] ?? false,
'class' => isset($element['checkbox']) || preg_match('(^$|&nbsp)', current($element)) ? 'print_hide' : '',
'sorter' => $element ['sorter'] ?? ''
];
@@ -81,10 +81,10 @@ function get_sales_manage_table_headers(): string
if($config['invoice_enable'])
{
$headers[] = ['invoice_number' => lang('Sales.invoice_number')];
$headers[] = ['invoice' => '&nbsp', 'sortable' => FALSE, 'escape' => FALSE];
$headers[] = ['invoice' => '&nbsp', 'sortable' => false, 'escape' => false];
}
$headers[] = ['receipt' => '&nbsp', 'sortable' => FALSE, 'escape' => FALSE];
$headers[] = ['receipt' => '&nbsp', 'sortable' => false, 'escape' => false];
return transform_headers($headers);
}
@@ -204,7 +204,7 @@ function get_people_manage_table_headers(): string
if($employee->has_grant('messages', $session->get('person_id')))
{
$headers[] = ['messages' => '', 'sortable' => FALSE];
$headers[] = ['messages' => '', 'sortable' => false];
}
return transform_headers($headers);
@@ -257,7 +257,7 @@ function get_customer_manage_table_headers(): string
['first_name' => lang('Common.first_name')],
['email' => lang('Common.email')],
['phone_number' => lang('Common.phone_number')],
['total' => lang('Common.total_spent'), 'sortable' => FALSE]
['total' => lang('Common.total_spent'), 'sortable' => false]
];
$employee = model(Employee::class);
@@ -265,7 +265,7 @@ function get_customer_manage_table_headers(): string
if($employee->has_grant('messages', $session->get('person_id')))
{
$headers[] = ['messages' => '', 'sortable' => FALSE];
$headers[] = ['messages' => '', 'sortable' => false];
}
return transform_headers($headers);
@@ -396,23 +396,23 @@ function get_items_manage_table_headers(): string
if($config['use_destination_based_tax'])
{
$headers[] = ['tax_percents' => lang('Items.tax_category'), 'sortable' => FALSE];
$headers[] = ['tax_percents' => lang('Items.tax_category'), 'sortable' => false];
}
else
{
$headers[] = ['tax_percents' => lang('Items.tax_percents'), 'sortable' => FALSE];
$headers[] = ['tax_percents' => lang('Items.tax_percents'), 'sortable' => false];
}
$headers[] = ['item_pic' => lang('Items.image'), 'sortable' => FALSE];
$headers[] = ['item_pic' => lang('Items.image'), 'sortable' => false];
foreach($definition_names as $definition_id => $definition_name)
{
$headers[] = [$definition_id => $definition_name, 'sortable' => FALSE];
$headers[] = [$definition_id => $definition_name, 'sortable' => false];
}
$headers[] = ['inventory' => '', 'escape' => FALSE];
$headers[] = ['stock' => '', 'escape' => FALSE];
$headers[] = ['inventory' => '', 'escape' => false];
$headers[] = ['stock' => '', 'escape' => false];
return transform_headers($headers);
}
@@ -429,7 +429,7 @@ function get_item_data_row(object $item): array
if($config['use_destination_based_tax'])
{
if($item->tax_category_id == NULL) //TODO: === ?
if($item->tax_category_id == null) //TODO: === ?
{
$tax_percents = '-';
}
@@ -454,7 +454,7 @@ function get_item_data_row(object $item): array
$controller = get_controller();
$image = NULL;
$image = null;
if($item->pic_filename != '') //TODO: !== ?
{
$ext = pathinfo($item->pic_filename, PATHINFO_EXTENSION);
@@ -572,8 +572,8 @@ function get_item_kits_manage_table_headers(): string
['item_kit_number' => lang('Item_kits.item_kit_number')],
['name' => lang('Item_kits.name')],
['description' => lang('Item_kits.description')],
['total_cost_price' => lang('Items.cost_price'), 'sortable' => FALSE],
['total_unit_price' => lang('Items.unit_price'), 'sortable' => FALSE]
['total_cost_price' => lang('Items.cost_price'), 'sortable' => false],
['total_unit_price' => lang('Items.unit_price'), 'sortable' => false]
];
return transform_headers($headers);

View File

@@ -224,9 +224,9 @@ class Barcode_lib
{
$array = []; //TODO: Naming of this variable should be changed. The variable should never be named the data type. $fonts would be a better name.
if(($handle = opendir($folder)) !== FALSE)
if(($handle = opendir($folder)) !== false)
{
while(($file = readdir($handle)) !== FALSE)
while(($file = readdir($handle)) !== false)
{
if(substr($file, -4, 4) === '.ttf')
{

View File

@@ -82,7 +82,7 @@ abstract class BarcodeBase
*/
public function validate($barcode)
{
return TRUE;
return true;
}
/**

View File

@@ -54,7 +54,7 @@ class Email_lib
* Email sending function
* Example of use: $response = sendEmail('john@doe.com', 'Hello', 'This is a message', $filename);
*/
public function sendEmail(string $to, string $subject, string $message, string $attachment = NULL): bool
public function sendEmail(string $to, string $subject, string $message, string $attachment = null): bool
{
$email = $this->email;

View File

@@ -16,14 +16,14 @@ class MY_Email extends Email
parent::__construct($config);
}
function sendMail(string $subject, string $body, string $to = NULL, string $reply_name = NULL, string $reply_mail = NULL, string $attachment = NULL): bool
function sendMail(string $subject, string $body, string $to = null, string $reply_name = null, string $reply_mail = null, string $attachment = null): bool
{
$this->setReplyTo($reply_mail, $reply_name);
$this->setFrom($this->default_sender_address, $this->default_sender_name, $this->default_bounce_address);
$this->setMailtype('html');
$this->setSubject($subject);
$this->setMessage($body);
if ($to == NULL) {
if ($to == null) {
$to = $this->default_email_address;
$this->setCc($this->default_cc_address);
}
@@ -33,4 +33,4 @@ class MY_Email extends Email
$this->setTo($to);
return $this->send();
}
}
}

View File

@@ -78,7 +78,7 @@ class MailchimpConnector
return $this->_request($httpVerb, $method, $args); //TODO: Hungarian notation
}
return FALSE;
return false;
}
/**
@@ -107,18 +107,18 @@ class MailchimpConnector
*/
private function _request(string $httpVerb, string $method, array $args = []) //TODO: Hungarian notation
{
$result = FALSE;
$result = false;
if(($ch = curl_init()) !== FALSE)
if(($ch = curl_init()) !== false)
{
curl_setopt($ch, CURLOPT_URL, $this->_build_request_url($method, $httpVerb, $args));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_USERPWD, "user:" . $this->_api_key);
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/3.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($args));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpVerb);
@@ -127,7 +127,7 @@ class MailchimpConnector
curl_close($ch);
}
return $result ? json_decode($result, TRUE) : FALSE;
return $result ? json_decode($result, true) : false;
}
}

View File

@@ -182,7 +182,7 @@ class Receiving_lib
$this->session->remove('recv_stock_destination');
}
//TODO: This array signature needs to be reworked. It's way too long. Perhaps an object needs to be passed rather than these?
public function add_item(int $item_id, int $quantity = 1, int $item_location = NULL, float $discount = 0, int $discount_type = 0, float $price = NULL, string $description = NULL, string $serialnumber = NULL, float $receiving_quantity = NULL, int $receiving_id = NULL, bool $include_deleted = FALSE): bool
public function add_item(int $item_id, int $quantity = 1, int $item_location = null, float $discount = 0, int $discount_type = 0, float $price = null, string $description = null, string $serialnumber = null, float $receiving_quantity = null, int $receiving_id = null, bool $include_deleted = false): bool
{
$config = config(OSPOS::class)->settings;
@@ -194,7 +194,7 @@ class Receiving_lib
if(!$item_id)
{
return FALSE;
return false;
}
}
@@ -207,7 +207,7 @@ class Receiving_lib
//item to the list. Since items can be deleted, we can't use a count. we use the highest key + 1.
$maxkey = 0; //Highest key so far
$itemalreadyinsale = FALSE; //We did not find the item yet.
$itemalreadyinsale = false; //We did not find the item yet.
$updatekey = 0; //Key to use to update(quantity)
foreach($items as $item)
@@ -224,7 +224,7 @@ class Receiving_lib
if($item['item_id'] == $item_id && $item['item_location'] == $item_location)
{
$itemalreadyinsale = TRUE;
$itemalreadyinsale = true;
$updatekey = $item['line'];
}
}
@@ -233,7 +233,7 @@ class Receiving_lib
$item_info = $this->item->get_info($item_id);
//array records are identified by $insertkey and item_id is just another field.
$price = $price != NULL ? $price : $item_info->cost_price;
$price = $price != null ? $price : $item_info->cost_price;
if($config['multi_pack_enabled'])
{
@@ -267,8 +267,8 @@ class Receiving_lib
'stock_name' => $this->stock_location->get_location_name($item_location),
'line' => $insertkey,
'name' => $item_info->name,
'description' => $description != NULL ? $description: $item_info->description,
'serialnumber' => $serialnumber != NULL ? $serialnumber: '',
'description' => $description != null ? $description: $item_info->description,
'serialnumber' => $serialnumber != null ? $serialnumber: '',
'attribute_values' => $attribute_links->attribute_values,
'attribute_dtvalues' => $attribute_links->attribute_dtvalues,
'allow_alt_description' => $item_info->allow_alt_description,
@@ -298,7 +298,7 @@ class Receiving_lib
$this->set_cart($items);
return TRUE;
return true;
}
public function edit_item($line, string $description, string $serialnumber, float $quantity, float $discount, int $discount_type, float $price, float $receiving_quantity): bool
@@ -323,7 +323,7 @@ class Receiving_lib
$this->set_cart($items);
}
return FALSE; //TODO: This function will always return false.
return false; //TODO: This function will always return false.
}
/**
@@ -356,7 +356,7 @@ class Receiving_lib
foreach($this->receiving->get_receiving_items($receiving_id)->getResult() as $row)
{
$this->add_item($row->item_id, -$row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, TRUE);
$this->add_item($row->item_id, -$row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, true);
}
$this->set_supplier($this->receiving->get_supplier($receiving_id)->person_id);
@@ -381,7 +381,7 @@ class Receiving_lib
foreach($this->receiving->get_receiving_items($receiving_id)->getResult() as $row)
{
$this->add_item($row->item_id, $row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, TRUE);
$this->add_item($row->item_id, $row->quantity_purchased, $row->item_location, $row->discount, $row->discount_type, $row->item_unit_price, $row->description, $row->serialnumber, $row->receiving_quantity, $receiving_id, true);
}
$this->set_supplier($this->receiving->get_supplier($receiving_id)->person_id);

View File

@@ -201,7 +201,7 @@ class Sale_lib
public function get_comment(): string
{
// avoid returning a NULL that results in a 0 in the comment if nothing is set/available
// avoid returning a null that results in a 0 in the comment if nothing is set/available
$comment = $this->session->get('sales_comment');
return empty($comment) ? '' : $comment;
@@ -237,7 +237,7 @@ class Sale_lib
return $this->session->get('sale_type');
}
public function set_invoice_number(int $invoice_number, bool $keep_custom = FALSE): void
public function set_invoice_number(int $invoice_number, bool $keep_custom = false): void
{
$current_invoice_number = $this->session->get('sales_invoice_number');
@@ -247,7 +247,7 @@ class Sale_lib
}
}
public function set_quote_number(string $quote_number, bool $keep_custom = FALSE): void
public function set_quote_number(string $quote_number, bool $keep_custom = false): void
{
$current_quote_number = $this->session->get('sales_quote_number');
@@ -257,7 +257,7 @@ class Sale_lib
}
}
public function set_work_order_number(string $work_order_number, bool $keep_custom = FALSE): void
public function set_work_order_number(string $work_order_number, bool $keep_custom = false): void
{
$current_work_order_number = $this->session->get('sales_work_order_number');
@@ -267,7 +267,7 @@ class Sale_lib
}
}
public function set_sale_type(int $sale_type, bool $keep_custom = FALSE): void
public function set_sale_type(int $sale_type, bool $keep_custom = false): void
{
$current_sale_type = $this->session->get('sale_type');
@@ -352,11 +352,11 @@ class Sale_lib
{//TODO: this needs to be converted to a switch statement
if($this->config['print_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also ===
{
return TRUE;
return true;
}
elseif($this->config['print_receipt_check_behaviour'] == 'never') //TODO: === ?
{
return FALSE;
return false;
}
else // remember last setting, session based though
{
@@ -379,11 +379,11 @@ class Sale_lib
{//TODO: this needs to be converted to a switch statement
if($this->config['email_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also ===
{
return TRUE;
return true;
}
elseif($this->config['email_receipt_check_behaviour'] == 'never') //TODO: === ?
{
return FALSE;
return false;
}
else // remember last setting, session based though
{
@@ -460,10 +460,10 @@ class Sale_lib
$payments[$payment_id]['payment_amount'] = $payment_amount;
$this->set_payments($payments);
return TRUE;
return true;
}
return FALSE;
return false;
}
/**
@@ -798,7 +798,7 @@ class Sale_lib
}
//TODO: this function needs to be reworked... way too many parameters. Also, optional parameters must go after mandatory parameters.
public function add_item(int &$item_id, int $item_location, string $quantity = '1', string &$discount = '0.0', int $discount_type = 0, int $price_mode = PRICE_MODE_STANDARD, int $kit_price_option = NULL, int $kit_print_option = NULL, string $price_override = NULL, string $description = NULL, string $serialnumber = NULL, int $sale_id = NULL, bool $include_deleted = FALSE, bool $print_option = NULL, bool $line = NULL): bool
public function add_item(int &$item_id, int $item_location, string $quantity = '1', string &$discount = '0.0', int $discount_type = 0, int $price_mode = PRICE_MODE_STANDARD, int $kit_price_option = null, int $kit_print_option = null, string $price_override = null, string $description = null, string $serialnumber = null, int $sale_id = null, bool $include_deleted = false, bool $print_option = null, bool $line = null): bool
{
$item_info = $this->item->get_info_by_id_or_number($item_id, $include_deleted);
@@ -806,7 +806,7 @@ class Sale_lib
if(empty($item_info))
{
$item_id = NEW_ENTRY;
return FALSE;
return false;
}
$applied_discount = $discount;
@@ -816,7 +816,7 @@ class Sale_lib
$price = $item_info->unit_price;
$cost_price = $item_info->cost_price;
if($price_override != NULL)
if($price_override != null)
{
$price = $price_override;
}
@@ -863,7 +863,7 @@ class Sale_lib
//item to the cart. Since items can be deleted, we can't use a count. we use the highest key + 1.
$maxkey = 0; //Highest key so far
$itemalreadyinsale = FALSE; //We did not find the item yet. //TODO: variable naming here does not match the convention
$itemalreadyinsale = false; //We did not find the item yet. //TODO: variable naming here does not match the convention
$insertkey = 0; //Key to use for new entry. //TODO: $insertkey is never used
$updatekey = 0; //Key to use to update(quantity)
@@ -879,7 +879,7 @@ class Sale_lib
if($item['item_id'] == $item_id && $item['item_location'] == $item_location) //TODO: === ?
{
$itemalreadyinsale = TRUE;
$itemalreadyinsale = true;
$updatekey = $item['line'];
if(!$item_info->is_serialized)
{
@@ -912,7 +912,7 @@ class Sale_lib
}
else
{ //TODO: Convert this to ternary notation
if($print_option != NULL) //TODO: === ?
if($print_option != null) //TODO: === ?
{
$print_option_selected = $print_option;
}
@@ -923,7 +923,7 @@ class Sale_lib
}
$total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type);
$discounted_total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type, TRUE);
$discounted_total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type, true);
if($this->config['multi_pack_enabled'])
{
@@ -945,8 +945,8 @@ class Sale_lib
'item_number' => $item_info->item_number,
'attribute_values' => $attribute_links->attribute_values,
'attribute_dtvalues' => $attribute_links->attribute_dtvalues,
'description' => $description != NULL ? $description : $item_info->description,
'serialnumber' => $serialnumber != NULL ? $serialnumber : '',
'description' => $description != null ? $description : $item_info->description,
'serialnumber' => $serialnumber != null ? $serialnumber : '',
'allow_alt_description' => $item_info->allow_alt_description,
'is_serialized' => $item_info->is_serialized,
'quantity' => $quantity,
@@ -978,7 +978,7 @@ class Sale_lib
$this->set_cart($items);
return TRUE;
return true;
}
public function out_of_stock(int $item_id, int $item_location): string
@@ -1044,16 +1044,16 @@ class Sale_lib
* @param string $discount
* @param string|null $discount_type
* @param string|null $price
* @param string|NULL $discounted_total
* @param string|null $discounted_total
* @return bool
*/
public function edit_item(string $line, string $description, string $serialnumber, string $quantity, string $discount, ?string $discount_type, ?string $price, ?string $discounted_total = NULL): bool
public function edit_item(string $line, string $description, string $serialnumber, string $quantity, string $discount, ?string $discount_type, ?string $price, ?string $discounted_total = null): bool
{
$items = $this->get_cart();
if(isset($items[$line]))
{
$line = &$items[$line];
if($discounted_total != NULL && $discounted_total != $line['discounted_total'])
if($discounted_total != null && $discounted_total != $line['discounted_total'])
{
// Note when entered the "discounted_total" is expected to be entered without a discount
$quantity = $this->get_quantity_sold($discounted_total, $price);
@@ -1070,11 +1070,11 @@ class Sale_lib
$line['price'] = $price;
$line['total'] = $this->get_item_total($quantity, $price, $discount, $line['discount_type']);
$line['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $line['discount_type'], TRUE);
$line['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $line['discount_type'], true);
$this->set_cart($items);
}
return FALSE; //TODO: This function will always return false.
return false; //TODO: This function will always return false.
}
/**
@@ -1108,7 +1108,7 @@ class Sale_lib
foreach($this->sale->get_sale_items_ordered($sale_id)->getResult() as $row)
{
$this->add_item($row->item_id, $row->item_location, -$row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, NULL, NULL, $row->item_unit_price, $row->description, $row->serialnumber, NULL, TRUE);
$this->add_item($row->item_id, $row->item_location, -$row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, null, null, $row->item_unit_price, $row->description, $row->serialnumber, null, true);
}
$this->set_customer($this->sale->get_customer($sale_id)->person_id);
@@ -1119,14 +1119,14 @@ class Sale_lib
//KIT #
$pieces = explode(' ', $external_item_kit_id);
$item_kit_id = (count($pieces) > 1) ? $pieces[1] : $external_item_kit_id;
$result = TRUE;
$result = true;
$applied_discount = $discount;
foreach($this->item_kit_items->get_info($item_kit_id) as $item_kit_item)
{
$result &= $this->add_item($item_kit_item['item_id'], $item_location, $item_kit_item['quantity'], $discount, $discount_type, PRICE_MODE_KIT, $kit_price_option, $kit_print_option);
if($stock_warning == NULL)
if($stock_warning == null)
{
$stock_warning = $this->out_of_stock($item_kit_item['item_id'], $item_location);
}
@@ -1142,7 +1142,7 @@ class Sale_lib
foreach($this->sale->get_sale_items_ordered($sale_id)->getResult() as $row)
{
$this->add_item($row->item_id, $row->item_location, $row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, NULL, NULL, $row->item_unit_price, $row->description, $row->serialnumber, $sale_id, TRUE, $row->print_option);
$this->add_item($row->item_id, $row->item_location, $row->quantity_purchased, $row->discount, $row->discount_type, PRICE_MODE_STANDARD, null, null, $row->item_unit_price, $row->description, $row->serialnumber, $sale_id, true, $row->print_option);
}
$this->session->set('cash_mode', CASH_MODE_FALSE);
@@ -1155,7 +1155,7 @@ class Sale_lib
{
if($row->payment_type != lang('Sales.cash') && $row->payment_type != lang('Sales.cash_adjustment'))
{
$cash_types_only = FALSE;
$cash_types_only = false;
}
}
@@ -1266,7 +1266,7 @@ class Sale_lib
{
$item['discount'] = $discount;
$item['total'] = $this->get_item_total($quantity, $price, $discount, $discount_type);
$item['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE);
$item['discounted_total'] = $this->get_item_total($quantity, $price, $discount, $discount_type, true);
}
}
@@ -1288,12 +1288,12 @@ class Sale_lib
return $discount;
}
public function get_subtotal(bool $include_discount = FALSE, bool $exclude_tax = FALSE): string
public function get_subtotal(bool $include_discount = false, bool $exclude_tax = false): string
{
return $this->calculate_subtotal($include_discount, $exclude_tax);
}
public function get_item_total_tax_exclusive(int $item_id, string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = FALSE): string
public function get_item_total_tax_exclusive(int $item_id, string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = false): string
{
$tax_info = $this->item_taxes->get_info($item_id);
$item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, $include_discount);
@@ -1323,7 +1323,7 @@ class Sale_lib
return $discounted_extended_amount;
}
public function get_item_total(string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = FALSE): string
public function get_item_total(string $quantity, string $price, string $discount, int $discount_type, bool $include_discount = false): string
{
$total = bcmul($quantity, $price);
if($include_discount)
@@ -1372,7 +1372,7 @@ class Sale_lib
public function get_item_tax(string $quantity, string $price, string $discount, int $discount_type, string $tax_percentage): string
{
$item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE);
$item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, true);
if($this->config['tax_included'])
{
@@ -1387,7 +1387,7 @@ class Sale_lib
return bcmul($item_total, $tax_fraction);
}
public function calculate_subtotal(bool $include_discount = FALSE, bool $exclude_tax = FALSE): string
public function calculate_subtotal(bool $include_discount = false, bool $exclude_tax = false): string
{
$subtotal = '0.0';
foreach($this->get_cart() as $item)
@@ -1410,9 +1410,9 @@ class Sale_lib
* @param bool $include_cash_rounding
* @return string
*/
public function get_total(bool $include_cash_rounding = TRUE): string
public function get_total(bool $include_cash_rounding = true): string
{
$total = $this->calculate_subtotal(TRUE);
$total = $this->calculate_subtotal(true);
$cash_mode = $this->session->get('cash_mode');

View File

@@ -35,14 +35,14 @@ class Sms_lib
$username = $config['msg_uid'];
$originator = $config['msg_src'];
$response = FALSE;
$response = false;
// if any of the parameters is empty return with a FALSE
// if any of the parameters is empty return with a false
if(empty($username) || empty($password) || empty($phone) || empty($message) || empty($originator)) //TODO: This if/else needs to be flipped. and shortened. No else needed in the code example below.
//$parameters = [$username, $password, $phone, $message, $originator];
//if(count(array_filter($parameters)) === 5)
//{
// $response = TRUE;
// $response = true;
// $message = rawurlencode($message);
//}
{
@@ -50,7 +50,7 @@ class Sms_lib
}
else
{
$response = TRUE;
$response = true;
//TODO: These comments should be moved to the documentation. As is, they tend to get out of date.
// make sure passed string is url encoded
$message = rawurlencode($message); //TODO: $message needs to be passed by reference if you want this line to actually do anything

View File

@@ -62,7 +62,7 @@ class Tax_lib
$decimals = tax_decimals();
// The tax basis should be returned to the currency scale
$tax_basis = $this->sale_lib->get_item_total($quantity, $price, $discount, $discount_type, TRUE);
$tax_basis = $this->sale_lib->get_item_total($quantity, $price, $discount, $discount_type, true);
return $this->get_tax_for_amount($tax_basis, $tax_percentage, $rounding_code, $decimals);
}
@@ -94,7 +94,7 @@ class Tax_lib
{
foreach($cart as $line => $item)
{
$taxed = FALSE;
$taxed = false;
if(!$this->config['use_destination_based_tax'])
{
@@ -116,7 +116,7 @@ class Tax_lib
foreach($tax_info as $tax)
{
// This computes tax for each line item and adds it to the tax type total
$tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], TRUE);
$tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], true);
$tax_amount = '0.0';
if($this->config['tax_included'])
@@ -135,7 +135,7 @@ class Tax_lib
$tax_group_sequence++;
$this->update_taxes($taxes, $tax_type, $tax['name'], $tax['percent'], $tax_basis, $tax_amount, $tax_group_sequence, Rounding_mode::HALF_UP, -1, $tax['name']); //TODO: Replace -1 with constant.
$tax_group_sequence += 1; //TODO: $tax_group_sequence++;
$taxed = TRUE;
$taxed = true;
}
$items_taxes_detail = [];
@@ -147,9 +147,9 @@ class Tax_lib
$items_taxes_detail['rounding_code'] = Rounding_mode::HALF_UP;
$items_taxes_detail['cascade_sequence'] = 0;
$items_taxes_detail['item_tax_amount'] = $tax_amount;
$items_taxes_detail['sales_tax_code_id'] = NULL;
$items_taxes_detail['jurisdiction_id'] = NULL;
$items_taxes_detail['tax_category_id'] = NULL;
$items_taxes_detail['sales_tax_code_id'] = null;
$items_taxes_detail['jurisdiction_id'] = null;
$items_taxes_detail['tax_category_id'] = null;
$item_taxes[] = $items_taxes_detail;
}
@@ -157,7 +157,7 @@ class Tax_lib
else
{
// Start of destination based tax calculations
if($item['tax_category_id'] == NULL) //TODO: === ?
if($item['tax_category_id'] == null) //TODO: === ?
{
$item['tax_category_id'] = $this->config['default_tax_category'];
}
@@ -186,7 +186,7 @@ class Tax_lib
public function get_included_tax(string $quantity, string $price, string $discount_percentage, int $discount_type, string $tax_percentage, $tax_decimal, $rounding_code): string //TODO: $tax_decimal and $rounding_code are in the signature but never used in the function.
{
$item_total = $this->sale_lib->get_item_total($quantity, $price, $discount_percentage, $discount_type, TRUE);
$item_total = $this->sale_lib->get_item_total($quantity, $price, $discount_percentage, $discount_type, true);
$tax_fraction = bcdiv(bcadd('100', $tax_percentage), '100');
$price_tax_excl = bcdiv($item_total, $tax_fraction);
return bcsub($item_total, $price_tax_excl);
@@ -195,7 +195,7 @@ class Tax_lib
/**
* Updates the sales_tax array which is later saved to the `sales_taxes` table and used for printing taxes on receipts and invoices
*/
public function update_taxes(array &$taxes, string $tax_type, string $tax_group, string $tax_rate, string $tax_basis, string $item_tax_amount, int $tax_group_sequence, int $rounding_code, int $sale_id, string $name = '', int $tax_code_id = NULL, int $jurisdiction_id = NULL, int $tax_category_id = NULL): void
public function update_taxes(array &$taxes, string $tax_type, string $tax_group, string $tax_rate, string $tax_basis, string $item_tax_amount, int $tax_group_sequence, int $rounding_code, int $sale_id, string $name = '', int $tax_code_id = null, int $jurisdiction_id = null, int $tax_category_id = null): void
{
$tax_group_index = $this->clean('X' . (float)$tax_rate . '% ' . $tax_group); //TODO: Not sure we should be casting to a float here. The clean() function takes a string, so it just gets converted back to a string and there's risk of inaccuracies in the value displayed.
@@ -328,7 +328,7 @@ class Tax_lib
*/
public function apply_destination_tax(array &$item, string $city, string $state, int $sales_tax_code_id, string $register_mode, int $sale_id, array &$taxes, array &$item_taxes, int $line): bool
{
$taxed = FALSE;
$taxed = false;
$tax_code_id = $this->get_applicable_tax_code($register_mode, $city, $state, $sales_tax_code_id);
@@ -340,7 +340,7 @@ class Tax_lib
$tax_definition = $this->tax->get_taxes($tax_code_id, $item['tax_category_id']);
// The tax basis should be returned to the currency scale
$tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], TRUE);
$tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], true);
$row = 0; //TODO: This variable is set but never used.
@@ -374,7 +374,7 @@ class Tax_lib
if($tax_amount != 0)
{
$taxed = TRUE;
$taxed = true;
$this->update_taxes($taxes, $tax_type, $tax['tax_group'], $tax_rate, $tax_basis, $tax_amount, $tax['tax_group_sequence'], $rounding_code, $sale_id, $tax['tax_group'], $tax_code_id, $tax['rate_jurisdiction_id'], $item['tax_category_id']);
}
@@ -407,11 +407,11 @@ class Tax_lib
}
else
{
if($sales_tax_code_id == NULL || $sales_tax_code_id == 0)
if($sales_tax_code_id == null || $sales_tax_code_id == 0)
{
$sales_tax_code_id = $this->tax_code->get_sales_tax_code($city, $state);
if($sales_tax_code_id == NULL || $sales_tax_code_id == 0)
if($sales_tax_code_id == null || $sales_tax_code_id == 0)
{
$sales_tax_code_id = $this->config['default_tax_code']; // overrides customer assigned code
}

View File

@@ -15,10 +15,10 @@ class Token_lib
/**
* Expands all the tokens found in a given text string and returns the results.
*/
public function render(string $tokened_text, array $tokens = [], $save = TRUE): string
public function render(string $tokened_text, array $tokens = [], $save = true): string
{
// Apply the transformation for the "%" tokens if any are used
if(strpos($tokened_text, '%') !== FALSE)
if(strpos($tokened_text, '%') !== false)
{
$tokened_text = strftime($tokened_text); //TODO: these need to be converted to IntlDateFormatter::format()
}
@@ -28,7 +28,7 @@ class Token_lib
if(empty($token_tree))
{
if(strpos($tokened_text, '%') !== FALSE)
if(strpos($tokened_text, '%') !== false)
{
return strftime($tokened_text);
}
@@ -87,7 +87,7 @@ class Token_lib
$quantity = (isset($parsed_results['W'])) ? (int) $parsed_results['W'] / 1000 : 1;
$item_id_or_number_or_item_kit_or_receipt = (isset($parsed_results['I'])) ?
$parsed_results['I'] : $item_id_or_number_or_item_kit_or_receipt;
$price = (isset($parsed_results['P'])) ? (double) $parsed_results['P'] : NULL;
$price = (isset($parsed_results['P'])) ? (double) $parsed_results['P'] : null;
}
}
else
@@ -130,7 +130,7 @@ class Token_lib
return $results;
}
public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, bool $save = TRUE): array //TODO: $tokens
public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, bool $save = true): array //TODO: $tokens
{
foreach($used_tokens as $token_code => $token_info)
{
@@ -154,7 +154,7 @@ class Token_lib
return $token_values;
}
private function resolve_token($token_code, array $tokens = [], $save = TRUE): string
private function resolve_token($token_code, array $tokens = [], $save = true): string
{
foreach(array_merge($tokens, Token::get_tokens()) as $token)
{

View File

@@ -80,7 +80,7 @@ class Appconfig extends Model
*/
public function batch_save(array $data): bool
{
$success = TRUE;
$success = true;
$this->db->transStart();

View File

@@ -49,7 +49,7 @@ class Attribute extends Model
/**
* Determines if a given definition_id is an attribute
*/
public function exists(int $definition_id, bool $deleted = FALSE): bool
public function exists(int $definition_id, bool $deleted = false): bool
{
$builder = $this->db->table('attribute_definitions');
$builder->where('definition_id', $definition_id);
@@ -116,7 +116,7 @@ class Attribute extends Model
return $query->getRow()->attribute_id;
}
return FALSE;
return false;
}
/*
@@ -256,16 +256,16 @@ class Attribute extends Model
/**
* Returns an array of attribute definition names and IDs
*
* @param boolean $groups If FALSE does not return GROUP type attributes in the array
* @param boolean $groups If false does not return GROUP type attributes in the array
* @return array Array containing definition IDs, attribute names and -1 index with the local language '[SELECT]' line.
*/
public function get_definition_names(bool $groups = TRUE): array
public function get_definition_names(bool $groups = true): array
{
$builder = $this->db->table('attribute_definitions');
$builder->where('deleted', 0);
$builder->orderBy('definition_name','ASC');
if($groups === FALSE)
if(!$groups)
{
$builder->whereNotIn('definition_type',GROUP);
}
@@ -324,11 +324,11 @@ class Attribute extends Model
private function check_data_validity(int $definition_id, string $from, string $to): bool
{
$success = FALSE;
$success = false;
if($from === TEXT)
{
$success = TRUE;
$success = true;
$builder = $this->db->table('attribute_values');
$builder->distinct()->select('attribute_value');
@@ -347,7 +347,7 @@ class Attribute extends Model
break;
}
if($success === FALSE)
if(!$success)
{
$affected_items = $this->get_items_by_value($attribute->attribute_value, $definition_id);
foreach($affected_items as $affected_item)
@@ -389,11 +389,11 @@ class Attribute extends Model
*/
private function convert_definition_data(int $definition_id, string $from_type, string $to_type): bool
{
$success = FALSE;
$success = false;
if($from_type === TEXT)
{
if(in_array($to_type, [DATE, DECIMAL], TRUE))
if(in_array($to_type, [DATE, DECIMAL], true))
{
if($this->check_data_validity($definition_id, $from_type, $to_type))
{
@@ -403,7 +403,7 @@ class Attribute extends Model
}
else if($to_type === DROPDOWN)
{
$success = TRUE;
$success = true;
}
else if($to_type === CHECKBOX) //TODO: duplicated code.
{
@@ -414,7 +414,7 @@ class Attribute extends Model
$query = 'UPDATE '. $this->db->prefixTable('attribute_links') .' links ';
$query .= 'JOIN '. $this->db->prefixTable('attribute_values') .' vals ';
$query .= 'ON vals.attribute_id = links.attribute_id ';
$query .= "SET links.attribute_id = IF((attribute_value IN('FALSE','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) ";
$query .= "SET links.attribute_id = IF((attribute_value IN('false','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) ";
$query .= 'WHERE definition_id = '. $this->db->escape($definition_id);
$success = $this->db->query($query);
@@ -423,7 +423,7 @@ class Attribute extends Model
}
else if($from_type === DROPDOWN)
{
if(in_array($to_type, [TEXT, CHECKBOX], TRUE)) //TODO: This if statement is possibly unnecessary... unless we have it there so that later we can do something with TEXT types also.
if(in_array($to_type, [TEXT, CHECKBOX], true)) //TODO: This if statement is possibly unnecessary... unless we have it there so that later we can do something with TEXT types also.
{
if($to_type === CHECKBOX) //TODO: Duplicated code.
{
@@ -435,7 +435,7 @@ class Attribute extends Model
$query = 'UPDATE '. $this->db->prefixTable('attribute_links') .' links ';
$query .= 'JOIN '. $this->db->prefixTable('attribute_values') .' vals ';
$query .= 'ON vals.attribute_id = links.attribute_id ';
$query .= "SET links.attribute_id = IF((attribute_value IN('FALSE','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) ";
$query .= "SET links.attribute_id = IF((attribute_value IN('false','0','') OR (attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) ";
$query .= 'WHERE definition_id = '. $this->db->escape($definition_id);
$success = $this->db->query($query);
@@ -445,7 +445,7 @@ class Attribute extends Model
}
else
{
$success = TRUE;
$success = true;
}
$this->delete_orphaned_links($definition_id);
@@ -458,12 +458,12 @@ class Attribute extends Model
$zero_attribute_id = $this->value_exists('0');
$one_attribute_id = $this->value_exists('1');
if($zero_attribute_id === false)
if(!$zero_attribute_id)
{
$zero_attribute_id = $this->save_value('0', $definition_id, false, false, CHECKBOX);
}
if($one_attribute_id === false)
if(!$one_attribute_id)
{
$one_attribute_id = $this->save_value('1', $definition_id, false, false, CHECKBOX);
$one_attribute_id = $this->save_value('1', $definition_id, false, false, CHECKBOX);
@@ -482,7 +482,7 @@ class Attribute extends Model
//Definition doesn't exist
if($definition_id === NO_DEFINITION_ID || !$this->exists($definition_id))
{
if($this->exists($definition_id,TRUE))
if($this->exists($definition_id,true))
{
$success = $this->undelete($definition_id);
}
@@ -515,9 +515,9 @@ class Attribute extends Model
if($from_definition_type !== $to_definition_type)
{
if($this->convert_definition_data($definition_id, $from_definition_type, $to_definition_type) === FALSE)
if(!$this->convert_definition_data($definition_id, $from_definition_type, $to_definition_type))
{
return FALSE;
return false;
}
}
}
@@ -581,7 +581,7 @@ class Attribute extends Model
return $this->db->transStatus();
}
public function delete_link(int $item_id, bool $definition_id = FALSE): bool
public function delete_link(int $item_id, bool $definition_id = false): bool
{
$delete_data = ['item_id' => $item_id];
@@ -685,7 +685,7 @@ class Attribute extends Model
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -764,7 +764,7 @@ class Attribute extends Model
//Update attribute_value
$attribute_id = $this->value_exists($attribute_value, $definition_type);
if($attribute_id === false)
if(!$attribute_id)
{
switch($definition_type) //TODO: Duplicated code
{
@@ -789,8 +789,8 @@ class Attribute extends Model
}
$data = [
'attribute_id' => empty($attribute_id) ? NULL : $attribute_id,
'item_id' => empty($item_id) ? NULL : $item_id,
'attribute_id' => empty($attribute_id) ? null : $attribute_id,
'item_id' => empty($item_id) ? null : $item_id,
'definition_id' => $definition_id
];
@@ -842,7 +842,7 @@ class Attribute extends Model
* Deletes an Attribute definition from the database and associated column in the items_import.csv
*
* @param int $definition_id Attribute definition ID to remove.
* @return boolean TRUE if successful and FALSE if there is a failure
* @return boolean true if successful and false if there is a failure
*/
public function delete_definition(int $definition_id): bool
{
@@ -864,7 +864,7 @@ class Attribute extends Model
* Deletes any attribute_links for a specific definition that do not have an item_id associated with them and are not DROPDOWN types
*
* @param int $definition_id
* @return boolean TRUE is returned if the delete was successful or FALSE if there were any failures
* @return boolean true is returned if the delete was successful or false if there were any failures
*/
public function delete_orphaned_links(int $definition_id): bool
{
@@ -894,7 +894,7 @@ class Attribute extends Model
/**
* Deletes any orphaned values that do not have associated links
*
* @return boolean TRUE is returned if the delete was successful or FALSE if there were any failures
* @return boolean true is returned if the delete was successful or false if there were any failures
*/
public function delete_orphaned_values(): bool
{
@@ -905,7 +905,7 @@ class Attribute extends Model
$this->db->transStart();
$builder = $this->db->table('attribute_values');
$builder->whereNotIn('attribute_id', $subquery, FALSE);
$builder->whereNotIn('attribute_id', $subquery, false);
$builder->delete();
$this->db->transComplete();
@@ -937,13 +937,13 @@ class Attribute extends Model
foreach($attributes as $attribute)
{
$new_attribute_id = $this->save_value($attribute['attribute_value'], $definition_id, FALSE, $attribute['attribute_id'], $definition_type);
$new_attribute_id = $this->save_value($attribute['attribute_value'], $definition_id, false, $attribute['attribute_id'], $definition_type);
if(!$this->save_link($attribute['item_id'], $definition_id, $new_attribute_id))
{
log_message('Error', 'Transaction failed');
$this->db->transRollback();
return FALSE;
return false;
}
}
$success = $this->delete_orphaned_links($definition_id);

View File

@@ -72,20 +72,20 @@ class Cashup extends Model
*/
public function get_found_rows(string $search, array $filters): int
{
return $this->search($search, $filters, 0, 0, 'cashup_id', 'asc', TRUE);
return $this->search($search, $filters, 0, 0, 'cashup_id', 'asc', true);
}
/**
* Searches cashups
*/
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'cashup_id', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'cashup_id', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'cashup_id';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$config = config(OSPOS::class)->settings;
$builder = $this->db->table('cash_up AS cash_up');
@@ -235,7 +235,7 @@ class Cashup extends Model
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -255,10 +255,10 @@ class Cashup extends Model
{
$cash_up_data['cashup_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder = $this->db->table('cash_up');

View File

@@ -129,7 +129,7 @@ class Customer extends Person
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -207,7 +207,7 @@ class Customer extends Person
// if the email is empty return like it is not existing
if(empty($email))
{
return FALSE;
return false;
}
$builder = $this->db->table('customers');
@@ -228,7 +228,7 @@ class Customer extends Person
*/
public function save_customer(array &$person_data, array &$customer_data, int $customer_id = NEW_ENTRY): bool
{
$success = FALSE;
$success = false;
$this->db->transStart();
@@ -266,7 +266,7 @@ class Customer extends Person
public function delete($customer_id = null, bool $purge = false): bool
{
$result = TRUE;
$result = true;
$config = config(OSPOS::class)->settings;
// if privacy enforcement is selected scramble customer data
@@ -279,7 +279,7 @@ class Customer extends Person
'last_name' => $customer_id,
'phone_number' => '',
'email' => '',
'gender' => NULL,
'gender' => null,
'address_1' => '',
'address_2' => '',
'city' => '',
@@ -293,15 +293,15 @@ class Customer extends Person
$builder->where('person_id', $customer_id);
$result &= $builder->update([
'consent' => 0,
'company_name' => NULL,
'account_number' => NULL,
'company_name' => null,
'account_number' => null,
'tax_id' => '',
'taxable' => 0,
'discount' => 0.00,
'discount_type' => 0,
'package_id' => NULL,
'points' => NULL,
'sales_tax_code_id' => NULL,
'package_id' => null,
'points' => null,
'sales_tax_code_id' => null,
'deleted' => 1
]);
}
@@ -420,21 +420,21 @@ class Customer extends Person
*/
public function get_found_rows(string $search): int
{
$result = $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
$result = $this->search($search, 0, 0, 'last_name', 'asc', true);
return $result;
}
/**
* Performs a search on customers
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'last_name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('customers AS customers');

View File

@@ -83,7 +83,7 @@ class Dinner_table extends Model
{
if(empty($dinner_table_id))
{
return FALSE;
return false;
}
else //TODO: No need for this else statement. Just put it's contents outside of the else since the if has a return in it.
{
@@ -125,7 +125,7 @@ class Dinner_table extends Model
$builder->where('dinner_table_id', $dinner_table_id);
return $builder->update(['status' => 1]);
}
else//TODO: THIS ELSE STATEMENT ISN'T NEEDED. JUST DO THE IF AND THEN RETURN TRUE AFTER IT.
else//TODO: THIS ELSE STATEMENT ISN'T NEEDED. JUST DO THE IF AND THEN RETURN true AFTER IT.
{
return true;
}

View File

@@ -126,7 +126,7 @@ class Employee extends Person
*/
public function save_employee(array &$person_data, array &$employee_data, array &$grants_data, int $employee_id = NEW_ENTRY): bool
{
$success = FALSE;
$success = false;
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->transStart();
@@ -182,12 +182,12 @@ class Employee extends Person
*/
public function delete($employee_id = null, bool $purge = false): bool
{
$success = FALSE;
$success = false;
//Don't let employees delete themselves
if($employee_id == $this->get_logged_in_employee_info()->person_id)
{
return FALSE;
return false;
}
//Run these queries as a transaction, we want to make sure we do all or nothing
@@ -213,12 +213,12 @@ class Employee extends Person
*/
public function delete_list(array $person_ids): bool
{
$success = FALSE;
$success = false;
//Don't let employees delete themselves
if(in_array($this->get_logged_in_employee_info()->person_id, $person_ids))
{
return FALSE;
return false;
}
//Run these queries as a transaction, we want to make sure we do all or nothing
@@ -244,7 +244,7 @@ class Employee extends Person
/**
* Get search suggestions to find employees
*/
public function get_search_suggestions(string $search, int $limit = 25, bool $unique = FALSE): array
public function get_search_suggestions(string $search, int $limit = 25, bool $unique = false): array
{
$suggestions = [];
@@ -330,20 +330,20 @@ class Employee extends Person
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
return $this->search($search, 0, 0, 'last_name', 'asc', true);
}
/**
* Performs a search on employees
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'last_name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'last_name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('employees AS employees');
@@ -405,11 +405,11 @@ class Employee extends Person
{
$this->session->set('person_id', $row->person_id);
return TRUE;
return true;
}
}
return FALSE;
return false;
}
/**
@@ -425,7 +425,7 @@ class Employee extends Person
*/
public function is_logged_in(): bool
{
return ($this->session->get('person_id') != FALSE);
return ($this->session->get('person_id') != false);
}
/**
@@ -438,7 +438,7 @@ class Employee extends Person
return $this->get_info($this->session->get('person_id'));
}
return FALSE;
return false;
}
/**
@@ -476,13 +476,13 @@ class Employee extends Person
public function has_grant(?string $permission_id, ?int $person_id): bool
{
//if no module_id is null, allow access
if($permission_id == NULL)
if($permission_id == null)
{
return TRUE;
return true;
}
if($person_id == NULL)
if($person_id == null)
{
return FALSE;
return false;
}
$builder = $this->db->table('grants');
@@ -504,7 +504,7 @@ class Employee extends Person
$row = $builder->get()->getRow();
// If no grants are assigned yet then set the default to 'home'
if($row == NULL)
if($row == null)
{
return 'home';
}
@@ -539,19 +539,19 @@ class Employee extends Person
if(password_verify($password, $row->password))
{
return TRUE;
return true;
}
}
return FALSE;
return false;
}
/**
* Change password for the employee
*/
public function change_password(array $employee_data, $employee_id = FALSE): bool
public function change_password(array $employee_data, $employee_id = false): bool
{
$success = FALSE;
$success = false;
if(ENVIRONMENT != 'testing')
{

View File

@@ -79,7 +79,7 @@ class Expense extends Model
*/
public function get_found_rows(string $search, array $filters): int
{
return $this->search($search, $filters, 0, 0, 'expense_id', 'asc', TRUE);
return $this->search($search, $filters, 0, 0, 'expense_id', 'asc', true);
}
/**
@@ -94,14 +94,14 @@ class Expense extends Model
* @param bool|null $count_only
* @return ResultInterface|false|string
*/
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'expense_id', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'expense_id', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'expense_id';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$config = config(OSPOS::class)->settings;
$builder = $this->db->table('expenses AS expenses');
@@ -240,9 +240,9 @@ class Expense extends Model
}
$empty_obj = $this->getEmptyObject('expenses');
$empty_obj->supplier_name = NULL;
$empty_obj->first_name = NULL;
$empty_obj->last_name = NULL;
$empty_obj->supplier_name = null;
$empty_obj->first_name = null;
$empty_obj->last_name = null;
return $empty_obj;
}
@@ -269,7 +269,7 @@ class Expense extends Model
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -289,10 +289,10 @@ class Expense extends Model
{
$expense_data['expense_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('expense_id', $expense_id);

View File

@@ -75,7 +75,7 @@ class Expense_category extends Model
/**
* Returns all the expense_categories
*/
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = FALSE): ResultInterface
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = false): ResultInterface
{
$builder = $this->db->table('expense_categories');
@@ -119,10 +119,10 @@ class Expense_category extends Model
{
$expense_category_data['expense_category_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('expense_category_id', $expense_category_id);
@@ -146,20 +146,20 @@ class Expense_category extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'category_name', 'asc', TRUE);
return $this->search($search, 0, 0, 'category_name', 'asc', true);
}
/**
* Perform a search on expense_category
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'category_name', ?string $order='asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'category_name', ?string $order='asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'category_name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('expense_categories AS expense_categories');

View File

@@ -104,7 +104,7 @@ class Giftcard extends Model
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -127,7 +127,7 @@ class Giftcard extends Model
return $query->getRow()->giftcard_id;
}
return FALSE;
return false;
}
/**
@@ -157,10 +157,10 @@ class Giftcard extends Model
$giftcard_data['giftcard_number'] = $this->db->insertID();
$giftcard_data['giftcard_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('giftcard_id', $giftcard_id);
@@ -247,27 +247,27 @@ class Giftcard extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'giftcard_number', 'asc', TRUE);
return $this->search($search, 0, 0, 'giftcard_number', 'asc', true);
}
/**
* Performs a search on giftcards
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'giftcard_number', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'giftcard_number', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'giftcard_number';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'giftcard_number';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('giftcards');

View File

@@ -27,14 +27,14 @@ class Inventory extends Model
'trans_location'
];
public function insert($inventory_data = NULL, bool $returnID = TRUE)
public function insert($inventory_data = null, bool $returnID = true)
{
$builder = $this->db->table('inventory');
return $builder->insert($inventory_data);
}
public function update($comment = NULL, $inventory_data = NULL): bool
public function update($comment = null, $inventory_data = null): bool
{
$builder = $this->db->table('inventory');
$builder->where('trans_comment', $comment);
@@ -48,7 +48,7 @@ class Inventory extends Model
* @param bool $location_id
* @return ResultInterface
*/
public function get_inventory_data_for_item(int $item_id, bool $location_id = FALSE): ResultInterface
public function get_inventory_data_for_item(int $item_id, bool $location_id = false): ResultInterface
{
$builder = $this->db->table('inventory');
$builder->where('trans_items', $item_id);
@@ -85,7 +85,7 @@ class Inventory extends Model
}
}
return TRUE;
return true;
}
public function get_inventory_sum(int $item_id): array

View File

@@ -47,12 +47,12 @@ class Item extends Model
/**
* Determines if a given item_id is an item
*/
public function exists(int $item_id, bool $ignore_deleted = FALSE, bool $deleted = FALSE): bool
public function exists(int $item_id, bool $ignore_deleted = false, bool $deleted = false): bool
{
$builder = $this->db->table('items');
$builder->where('item_id', $item_id);
if($ignore_deleted === FALSE)
if(!$ignore_deleted)
{
$builder->where('deleted', $deleted);
}
@@ -69,7 +69,7 @@ class Item extends Model
if($config['allow_duplicate_barcodes'])
{
return FALSE;
return false;
}
$builder = $this->db->table('items');
@@ -110,26 +110,26 @@ class Item extends Model
*/
public function get_found_rows(string $search, array $filters): int
{
return $this->search($search, $filters, 0, 0, 'items.name', 'asc', TRUE);
return $this->search($search, $filters, 0, 0, 'items.name', 'asc', true);
}
/**
* Perform a search on items
*/
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'items.name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'items.name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == NULL) $rows = 0;
if($limit_from == NULL) $limit_from = 0;
if($sort == NULL) $sort = 'items.name';
if($order == NULL) $order = 'asc';
if($count_only == NULL) $count_only = FALSE;
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'items.name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = false;
$config = config(OSPOS::class)->settings;
$builder = $this->db->table('items AS items'); //TODO: I'm not sure if it's needed to write items AS items... I think you can just get away with items
// get_found_rows case
if($count_only === TRUE) //TODO: replace this with `if($count_only)`
if($count_only)
{
$builder->select('COUNT(DISTINCT items.item_id) AS count');
}
@@ -229,7 +229,7 @@ class Item extends Model
if($filters['empty_upc'])
{
$builder->where('item_number', NULL);
$builder->where('item_number', null);
}
if($filters['low_inventory'])
{
@@ -346,7 +346,7 @@ class Item extends Model
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -356,7 +356,7 @@ class Item extends Model
/**
* Gets information about a particular item by item id or number
*/
public function get_info_by_id_or_number(int $item_id, bool $include_deleted = TRUE)
public function get_info_by_id_or_number(int $item_id, bool $include_deleted = true)
{
$builder = $this->db->table('items');
$builder->groupStart();
@@ -393,7 +393,7 @@ class Item extends Model
/**
* Get an item id given an item number
*/
public function get_item_id(string $item_number, bool $ignore_deleted = FALSE, bool $deleted = FALSE): bool
public function get_item_id(string $item_number, bool $ignore_deleted = false, bool $deleted = false): bool
{
$builder = $this->db->table('items');
$builder->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
@@ -411,7 +411,7 @@ class Item extends Model
return $query->getRow()->item_id;
}
return FALSE;
return false;
}
/**
@@ -449,7 +449,7 @@ class Item extends Model
{
$builder = $this->db->table('items');
if($item_id == NEW_ENTRY || !$this->exists($item_id, TRUE))
if($item_id == NEW_ENTRY || !$this->exists($item_id, true))
{
if($builder->insert($item_data))
{
@@ -461,10 +461,10 @@ class Item extends Model
$builder->update(['low_sell_item_id' => $item_data['item_id']]);
}
return TRUE;
return true;
}
return FALSE;
return false;
}
else
{
@@ -492,7 +492,7 @@ class Item extends Model
* Deletes one item
* @throws ReflectionException
*/
public function delete($item_id = NULL, bool $purge = false)
public function delete($item_id = null, bool $purge = false)
{
$this->db->transStart();
@@ -556,7 +556,7 @@ class Item extends Model
return $success;
}
function get_search_suggestion_format(string $seed = NULL): string
function get_search_suggestion_format(string $seed = null): string
{
$config = config(OSPOS::class)->settings;
$seed .= ',' . $config['suggestions_first_column'];
@@ -636,7 +636,7 @@ class Item extends Model
}
}
public function get_search_suggestions(string $search, array $filters = ['is_deleted' => FALSE, 'search_custom' => FALSE], bool $unique = FALSE, int $limit = 25): array
public function get_search_suggestions(string $search, array $filters = ['is_deleted' => false, 'search_custom' => false], bool $unique = false, int $limit = 25): array
{
$suggestions = [];
$non_kit = [ITEM, ITEM_AMOUNT_ENTRY];
@@ -686,7 +686,7 @@ class Item extends Model
$builder->select('company_name');
$builder->like('company_name', $search);
// restrict to non deleted companies only if is_deleted is FALSE
// restrict to non deleted companies only if is_deleted is false
$builder->where('deleted', $filters['is_deleted']);
$builder->distinct();
$builder->orderBy('company_name', 'asc');
@@ -714,7 +714,7 @@ class Item extends Model
}
//Search in attributes
if($filters['search_custom'] !== FALSE)
if($filters['search_custom'] !== false)
{
$builder = $this->db->table('attribute_links');
$builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id');
@@ -741,7 +741,7 @@ class Item extends Model
}
public function get_stock_search_suggestions(string $search, array $filters = ['is_deleted' => FALSE, 'search_custom' => FALSE], bool $unique = FALSE, int $limit = 25): array
public function get_stock_search_suggestions(string $search, array $filters = ['is_deleted' => false, 'search_custom' => false], bool $unique = false, int $limit = 25): array
{
$suggestions = [];
$non_kit = [ITEM, ITEM_AMOUNT_ENTRY];
@@ -794,7 +794,7 @@ class Item extends Model
$builder->select('company_name');
$builder->like('company_name', $search);
// restrict to non deleted companies only if is_deleted is FALSE
// restrict to non deleted companies only if is_deleted is false
$builder->where('deleted', $filters['is_deleted']);
$builder->distinct();
$builder->orderBy('company_name', 'asc');
@@ -823,7 +823,7 @@ class Item extends Model
}
//Search by custom fields
if($filters['search_custom'] !== FALSE) //TODO: duplicated code. We should refactor out a method... this can be replaced with `if($filters['search_custom']`... no need for the double negative
if($filters['search_custom'] !== false) //TODO: duplicated code. We should refactor out a method... this can be replaced with `if($filters['search_custom']`... no need for the double negative
{
$builder = $this->db->table('attribute_links');
$builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id');
@@ -849,7 +849,7 @@ class Item extends Model
return array_unique($suggestions, SORT_REGULAR);
}
public function get_kit_search_suggestions(string $search, array $filters = ['is_deleted' => FALSE, 'search_custom' => FALSE], bool $unique = FALSE, int $limit = 25): array
public function get_kit_search_suggestions(string $search, array $filters = ['is_deleted' => false, 'search_custom' => false], bool $unique = false, int $limit = 25): array
{
$suggestions = [];
$non_kit = [ITEM, ITEM_AMOUNT_ENTRY]; //TODO: This variable is never used.
@@ -899,7 +899,7 @@ class Item extends Model
$builder->select('company_name');
$builder->like('company_name', $search);
// restrict to non deleted companies only if is_deleted is FALSE
// restrict to non deleted companies only if is_deleted is false
$builder->where('deleted', $filters['is_deleted']);
$builder->distinct();
$builder->orderBy('company_name', 'asc');
@@ -927,7 +927,7 @@ class Item extends Model
}
//Search in attributes
if($filters['search_custom'] !== FALSE) //TODO: Duplicate code... same as above... no double negatives
if($filters['search_custom'] !== false) //TODO: Duplicate code... same as above... no double negatives
{
$builder = $this->db->table('attribute_links');
$builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id');
@@ -1032,9 +1032,9 @@ class Item extends Model
* caution: must be used before item_quantities gets updated, otherwise the average price is wrong!
*
*/
public function change_cost_price(int $item_id, float $items_received, float $new_price, float $old_price = NULL): bool
public function change_cost_price(int $item_id, float $items_received, float $new_price, float $old_price = null): bool
{
if($old_price === NULL)
if($old_price === null)
{
$item_info = $this->get_info($item_id);
$old_price = $item_info->cost_price;
@@ -1081,11 +1081,11 @@ class Item extends Model
* for a multipack environment then the item name should have the
* pack appended to it
*/
function get_item_name(string $as_name = NULL): string
function get_item_name(string $as_name = null): string
{
$config = config(OSPOS::class)->settings;
if($as_name == NULL) //TODO: Replace with ternary notation
if($as_name == null) //TODO: Replace with ternary notation
{
$as_name = '';
}

View File

@@ -57,7 +57,7 @@ class Item_kit extends Model
}
}
return FALSE;
return false;
}
/**
@@ -69,7 +69,7 @@ class Item_kit extends Model
if($config['allow_duplicate_barcodes'])
{
return FALSE;
return false;
}
$builder = $this->db->table('item_kits');
@@ -177,10 +177,10 @@ class Item_kit extends Model
{
$item_kit_data['item_kit_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('item_kit_id', $item_kit_id);
@@ -216,7 +216,7 @@ class Item_kit extends Model
$builder = $this->db->table('item_kits');
//KIT #
if(stripos($search, 'KIT ') !== FALSE)
if(stripos($search, 'KIT ') !== false)
{
$builder->like('item_kit_id', str_ireplace('KIT ', '', $search));
$builder->orderBy('item_kit_id', 'asc');
@@ -252,20 +252,20 @@ class Item_kit extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'name', 'asc', TRUE);
return $this->search($search, 0, 0, 'name', 'asc', true);
}
/**
* Perform a search on items
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('item_kits');
@@ -280,7 +280,7 @@ class Item_kit extends Model
$builder->orLike('item_kit_number', $search);
//KIT #
if(stripos($search, 'KIT ') !== FALSE)
if(stripos($search, 'KIT ') !== false)
{
$builder->orLike('item_kit_id', str_ireplace('KIT ', '', $search));
}

View File

@@ -53,13 +53,13 @@ class Item_kit_items extends Model
*/
public function save_value(array &$item_kit_items_data, int $item_kit_id): bool
{
$success = TRUE;
$success = true;
$this->db->transStart();
$this->delete($item_kit_id);
if($item_kit_items_data != NULL)
if($item_kit_items_data != null)
{
$builder = $this->db->table('item_kit_items');

View File

@@ -35,7 +35,7 @@ class Item_taxes extends Model
*/
public function save_value(array &$items_taxes_data, int $item_id): bool
{
$success = TRUE;
$success = true;
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->transStart();
@@ -62,7 +62,7 @@ class Item_taxes extends Model
*/
public function save_multiple(array &$items_taxes_data, string $item_ids): bool //TODO: investigate why this is sent as a : delimited string rather than an array.
{
$success = TRUE;
$success = true;
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->transStart();

View File

@@ -63,7 +63,7 @@ class Module extends Model
$builder->join('modules AS modules', 'modules.module_id = permissions.module_id'); //TODO: can the table parameter just be modules instead of modules AS modules?
// can't quote the parameters correctly when using different operators..
$builder->where('modules.module_id != ', 'permission_id', FALSE);
$builder->where('modules.module_id != ', 'permission_id', false);
return $builder->get();
}

View File

@@ -35,7 +35,7 @@ class Person extends Model
*
* @param integer $person_id identifier of the person to verify the existence
*
* @return boolean TRUE if the person exists, FALSE if not
* @return boolean true if the person exists, false if not
*/
public function exists(int $person_id): bool
{
@@ -119,7 +119,7 @@ class Person extends Model
}
else
{
$empty_obj->$field_name = NULL;
$empty_obj->$field_name = null;
}
}
@@ -146,7 +146,7 @@ class Person extends Model
*
* @param array $person_data array containing person information
* @param int $person_id identifier of the person to update the information
* @return boolean TRUE if the save was successful, FALSE if not
* @return boolean true if the save was successful, false if not
*/
public function save_value(array &$person_data, int $person_id = NEW_ENTRY): bool
{
@@ -158,10 +158,10 @@ class Person extends Model
{
$person_data['person_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('person_id', $person_id);
@@ -213,7 +213,7 @@ class Person extends Model
* Deletes one Person (dummy base function)
*
* @param integer $person_id person identifier
* @return boolean always TRUE
* @return boolean always true
*/
public function delete($person_id = null, bool $purge = false): bool
{
@@ -224,10 +224,10 @@ class Person extends Model
* Deletes a list of people (dummy base function)
*
* @param array $person_ids list of person identifiers
* @return boolean always TRUE
* @return boolean always true
*/
public function delete_list(array $person_ids): bool
{
return TRUE;
return true;
}
}

View File

@@ -61,7 +61,7 @@ class Receiving extends Model
}
}
return FALSE;
return false;
}
public function exists(int $receiving_id): bool
@@ -72,7 +72,7 @@ class Receiving extends Model
return ($builder->get()->getNumRows() == 1);
}
public function update($receiving_id = NULL, $receiving_data = NULL): bool
public function update($receiving_id = null, $receiving_data = null): bool
{
$builder = $this->db->table('receivings');
$builder->where('receiving_id', $receiving_id);
@@ -98,7 +98,7 @@ class Receiving extends Model
$receivings_data = [
'receiving_time' => date('Y-m-d H:i:s'),
'supplier_id' => $supplier->exists($supplier_id) ? $supplier_id : NULL,
'supplier_id' => $supplier->exists($supplier_id) ? $supplier_id : null,
'employee_id' => $employee_id,
'payment_type' => $payment_type,
'comment' => $comment,
@@ -171,21 +171,16 @@ class Receiving extends Model
$this->db->transComplete();
if($this->db->transStatus() === FALSE) //TODO: Probably better written as return $this->db->transStatus() ? $receiving_id : -1;
{
return -1;
}
return $receiving_id;
return $this->db->transStatus() ? $receiving_id : -1;
}
/**
* @throws ReflectionException
*/
public function delete_list(array $receiving_ids, int $employee_id, bool $update_inventory = TRUE): bool
public function delete_list(array $receiving_ids, int $employee_id, bool $update_inventory = true): bool
{
$success = TRUE;
$success = true;
// start a transaction to assure data integrity
$this->db->transStart();
@@ -206,7 +201,7 @@ class Receiving extends Model
/**
* @throws ReflectionException
*/
public function delete_value(int $receiving_id, int $employee_id, bool $update_inventory = TRUE): bool
public function delete_value(int $receiving_id, int $employee_id, bool $update_inventory = true): bool
{
// start a transaction to assure data integrity
$this->db->transStart();

View File

@@ -24,7 +24,7 @@ class Detailed_receivings extends Report
return [
'summary' => [
['id' => lang('Reports.receiving_id')],
['receiving_time' => lang('Reports.date'), 'sortable' => FALSE],
['receiving_time' => lang('Reports.date'), 'sortable' => false],
['quantity' => lang('Reports.quantity')],
['employee_name' => lang('Reports.received_by')],
['supplier_name' => lang('Reports.supplied_by')],
@@ -168,4 +168,4 @@ class Detailed_receivings extends Report
return $builder->get()->getRowArray();
}
}
}

View File

@@ -25,7 +25,7 @@ class Detailed_sales extends Report
'summary' => [
['id' => lang('Reports.sale_id')],
['type_code' => lang('Reports.code_type')],
['sale_time' => lang('Reports.date'), 'sortable' => FALSE],
['sale_time' => lang('Reports.date'), 'sortable' => false],
['quantity' => lang('Reports.quantity')],
['employee_name' => lang('Reports.sold_by')],
['customer_name' => lang('Reports.sold_to')],
@@ -34,7 +34,7 @@ class Detailed_sales extends Report
['total' => lang('Reports.total'), 'sorter' => 'number_sorter'],
['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'],
['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'],
['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE],
['payment_type' => lang('Reports.payment_type'), 'sortable' => false],
['comment' => lang('Reports.comments')]
],
'details' => [

View File

@@ -25,7 +25,7 @@ class Specific_customer extends Report
'summary' => [
['id' => lang('Reports.sale_id')],
['type_code' => lang('Reports.code_type')],
['sale_time' => lang('Reports.date'), 'sortable' => FALSE],
['sale_time' => lang('Reports.date'), 'sortable' => false],
['quantity' => lang('Reports.quantity')],
['employee_name' => lang('Reports.sold_by')],
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],
@@ -33,7 +33,7 @@ class Specific_customer extends Report
['total' => lang('Reports.total'), 'sorter' => 'number_sorter'],
['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'],
['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'],
['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE],
['payment_type' => lang('Reports.payment_type'), 'sortable' => false],
['comment' => lang('Reports.comments')]
],
'details' => [
@@ -210,4 +210,4 @@ class Specific_customer extends Report
return $builder->get()->getRowArray();
}
}
}

View File

@@ -25,7 +25,7 @@ class Specific_discount extends Report
'summary' => [
['id' => lang('Reports.sale_id')],
['type_code' => lang('Reports.code_type')],
['sale_time' => lang('Reports.date'), 'sortable' => FALSE],
['sale_time' => lang('Reports.date'), 'sortable' => false],
['quantity' => lang('Reports.quantity')],
['employee_name' => lang('Reports.sold_by')],
['customer_name' => lang('Reports.sold_to')],
@@ -34,7 +34,7 @@ class Specific_discount extends Report
['total' => lang('Reports.total'), 'sorter' => 'number_sorter'],
['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'],
['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'],
['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE],
['payment_type' => lang('Reports.payment_type'), 'sortable' => false],
['comment' => lang('Reports.comments')]
],
'details' => [
@@ -197,4 +197,4 @@ class Specific_discount extends Report
return $builder->get()->getRowArray();
}
}
}

View File

@@ -25,7 +25,7 @@ class Specific_employee extends Report
'summary' => [
['id' => lang('Reports.sale_id')],
['type_code' => lang('Reports.code_type')],
['sale_time' => lang('Reports.date'), 'sortable' => FALSE],
['sale_time' => lang('Reports.date'), 'sortable' => false],
['quantity' => lang('Reports.quantity')],
['customer_name' => lang('Reports.sold_to')],
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],
@@ -33,7 +33,7 @@ class Specific_employee extends Report
['total' => lang('Reports.total'), 'sorter' => 'number_sorter'],
['cost' => lang('Reports.cost'), 'sorter' => 'number_sorter'],
['profit' => lang('Reports.profit'), 'sorter' => 'number_sorter'],
['payment_type' => lang('Reports.payment_type'), 'sortable' => FALSE],
['payment_type' => lang('Reports.payment_type'), 'sortable' => false],
['comment' => lang('Reports.comments')]
],
'details' => [
@@ -192,4 +192,4 @@ class Specific_employee extends Report
return $builder->get()->getRowArray();
}
}
}

View File

@@ -24,7 +24,7 @@ class Specific_supplier extends Report
return [
['id' => lang('Reports.sale_id')],
['type_code' => lang('Reports.code_type')],
['sale_time' => lang('Reports.date'), 'sortable' => FALSE],
['sale_time' => lang('Reports.date'), 'sortable' => false],
['name' => lang('Reports.name')],
['category' => lang('Reports.category')],
['item_number' => lang('Reports.item_number')],
@@ -158,4 +158,4 @@ class Specific_supplier extends Report
return $builder->get()->getRowArray();
}
}
}

View File

@@ -97,7 +97,7 @@ class Summary_payments extends Summary_report
$gift_card_count = 0;
$gift_card_amount = 0;
foreach($payments as $key => $payment) {
if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== FALSE) {
if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== false) {
$gift_card_count += $payment['trans_sales'];
$gift_card_amount += $payment['trans_amount'];

View File

@@ -7,7 +7,7 @@ class Summary_sales extends Summary_report
protected function _get_data_columns(): array
{
return [
['sale_date' => lang('Reports.date'), 'sortable' => FALSE],
['sale_date' => lang('Reports.date'), 'sortable' => false],
['sales' => lang('Reports.sales'), 'sorter' => 'number_sorter'],
['quantity' => lang('Reports.quantity'), 'sorter' => 'number_sorter'],
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],
@@ -34,4 +34,4 @@ class Summary_sales extends Summary_report
$builder->groupBy('sale_date');
$builder->orderBy('sale_date');
}
}
}

View File

@@ -17,7 +17,7 @@ class Summary_taxes extends Summary_report
protected function _get_data_columns(): array //TODO: hungarian notation
{
return [
['tax_name' => lang('Reports.tax_name'), 'sortable' => FALSE],
['tax_name' => lang('Reports.tax_name'), 'sortable' => false],
['tax_percent' => lang('Reports.tax_percent'), 'sorter' => 'number_sorter'],
['report_count' => lang('Reports.sales'), 'sorter' => 'number_sorter'],
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],

View File

@@ -23,7 +23,7 @@ class Rewards extends Model //TODO: This class is named with plural while the ge
/**
* Inserts or updates a rewards
*/
public function save_value(array &$rewards_data, bool $rewards_id = FALSE): bool
public function save_value(array &$rewards_data, bool $rewards_id = false): bool
{
$builder = $this->db->table('sales_reward_points');
if(!$rewards_id || !$this->exists($rewards_id)) //TODO: looks like we are missing the exists function in this class
@@ -32,10 +32,10 @@ class Rewards extends Model //TODO: This class is named with plural while the ge
{
$rewards_data['id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('id', $rewards_id);

View File

@@ -45,8 +45,8 @@ class Sale extends Model
$this->create_temp_table (['sale_id' => $sale_id]);
$decimals = totals_decimals();
$sales_tax = 'IFNULL(SUM(sales_items_taxes.sales_tax), 0)';
$cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)';
$sales_tax = 'IFnull(SUM(sales_items_taxes.sales_tax), 0)';
$cash_adjustment = 'IFnull(SUM(payments.sale_cash_adjustment), 0)';
$sale_price = 'CASE WHEN sales_items.discount_type = ' . PERCENT
. " THEN sales_items.quantity_purchased * sales_items.item_unit_price - ROUND(sales_items.quantity_purchased * sales_items.item_unit_price * sales_items.discount / 100, $decimals) "
. 'ELSE sales_items.quantity_purchased * (sales_items.item_unit_price - sales_items.discount) END';
@@ -74,11 +74,11 @@ class Sale extends Model
MAX(customer_p.last_name) AS last_name,
MAX(customer_p.email) AS email,
MAX(customer_p.comments) AS comments,
MAX(IFNULL(payments.sale_cash_adjustment, 0)) AS cash_adjustment,
MAX(IFNULL(payments.sale_cash_refund, 0)) AS cash_refund,
MAX(IFnull(payments.sale_cash_adjustment, 0)) AS cash_adjustment,
MAX(IFnull(payments.sale_cash_refund, 0)) AS cash_refund,
' . "
$sale_total AS amount_due,
MAX(IFNULL(payments.sale_payment_amount, 0)) AS amount_tendered,
MAX(IFnull(payments.sale_payment_amount, 0)) AS amount_tendered,
(MAX(payments.sale_payment_amount)) - ($sale_total) AS change_due,
" . '
MAX(payments.payment_type) AS payment_type';
@@ -107,20 +107,20 @@ class Sale extends Model
*/
public function get_found_rows(string $search, array $filters): int
{
return $this->search($search, $filters, 0, 0, 'sales.sale_time', 'desc', TRUE);
return $this->search($search, $filters, 0, 0, 'sales.sale_time', 'desc', true);
}
/**
* Get the sales data for the takings (sales/manage) view
*/
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'sales.sale_time', ?string $order = 'desc', ?bool $count_only = FALSE)
public function search(string $search, array $filters, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'sales.sale_time', ?string $order = 'desc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'sales.sale_time';
if($order == null) $order = 'desc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$config = config(OSPOS::class)->settings;
@@ -161,10 +161,10 @@ class Sale extends Model
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
$tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)';
$sales_tax = 'IFNULL(SUM(sales_items_taxes.sales_tax), 0)';
$internal_tax = 'IFNULL(SUM(sales_items_taxes.internal_tax), 0)';
$cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)';
$tax = 'IFnull(SUM(sales_items_taxes.tax), 0)';
$sales_tax = 'IFnull(SUM(sales_items_taxes.sales_tax), 0)';
$internal_tax = 'IFnull(SUM(sales_items_taxes.internal_tax), 0)';
$cash_adjustment = 'IFnull(SUM(payments.sale_cash_adjustment), 0)';
$sale_subtotal = "ROUND(SUM($sale_price), $decimals) - $internal_tax";
$sale_total = "ROUND(SUM($sale_price), $decimals) + $sales_tax + $cash_adjustment";
@@ -533,12 +533,12 @@ class Sale extends Model
{
$receipt_sale_id = 'POS ' . $sale_info->getRow()->sale_id;
return TRUE;
return true;
}
}
}
return FALSE;
return false;
}
/**
@@ -555,7 +555,7 @@ class Sale extends Model
/**
* Update sale
*/
public function update($sale_id = NULL, $sale_data = NULL): bool
public function update($sale_id = null, $sale_data = null): bool
{
$builder = $this->db->table('sales');
$builder->where('sale_id', $sale_id);
@@ -651,7 +651,7 @@ class Sale extends Model
$sales_data = [
'sale_time' => date('Y-m-d H:i:s'),
'customer_id' => $customer->exists($customer_id) ? $customer_id : NULL,
'customer_id' => $customer->exists($customer_id) ? $customer_id : null,
'employee_id' => $employee_id,
'comment' => $comment,
'sale_status' => $sale_status,
@@ -800,12 +800,7 @@ class Sale extends Model
$this->db->transComplete();
if($this->db->transStatus() === FALSE)
{
return -1; //TODO: this should also be replaced with a FAIL or NO_PERSON constant or something similar instead of -1
}
return $sale_id;
return $this->db->transStatus() ? $sale_id : -1;
}
/**
@@ -886,13 +881,13 @@ class Sale extends Model
* Deletes list of sales
* @throws ReflectionException
*/
public function delete_list(array $sale_ids, int $employee_id, bool $update_inventory = TRUE): bool
public function delete_list(array $sale_ids, int $employee_id, bool $update_inventory = true): bool
{
$result = TRUE;
$result = true;
foreach($sale_ids as $sale_id)
{
$result &= $this->delete($sale_id, FALSE, $update_inventory, $employee_id);
$result &= $this->delete($sale_id, false, $update_inventory, $employee_id);
}
return $result;
@@ -901,14 +896,14 @@ class Sale extends Model
/**
* Restores list of sales
*/
public function restore_list(array $sale_ids, int $employee_id, bool $update_inventory = TRUE): bool //TODO: $employee_id and $update_inventory are never used in the function.
public function restore_list(array $sale_ids, int $employee_id, bool $update_inventory = true): bool //TODO: $employee_id and $update_inventory are never used in the function.
{
foreach($sale_ids as $sale_id)
{
$this->update_sale_status($sale_id, SUSPENDED);
}
return TRUE;
return true;
}
/**
@@ -917,7 +912,7 @@ class Sale extends Model
* However, if applicable the inventory still needs to be updated
* @throws ReflectionException
*/
public function delete($sale_id = NULL, bool $purge = FALSE, bool $update_inventory = TRUE, $employee_id = null): bool
public function delete($sale_id = null, bool $purge = false, bool $update_inventory = true, $employee_id = null): bool
{
// start a transaction to assure data integrity
$this->db->transStart();
@@ -1196,11 +1191,11 @@ class Sale extends Model
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
$tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)';
$sales_tax = 'IFNULL(SUM(sales_items_taxes.sales_tax), 0)';
$internal_tax = 'IFNULL(SUM(sales_items_taxes.internal_tax), 0)';
$tax = 'IFnull(SUM(sales_items_taxes.tax), 0)';
$sales_tax = 'IFnull(SUM(sales_items_taxes.sales_tax), 0)';
$internal_tax = 'IFnull(SUM(sales_items_taxes.internal_tax), 0)';
$cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)';
$cash_adjustment = 'IFnull(SUM(payments.sale_cash_adjustment), 0)';
if($config['tax_included'])
{
@@ -1323,7 +1318,7 @@ class Sale extends Model
/**
* Retrieves all sales that are in a suspended state
*/
public function get_all_suspended(int $customer_id = NULL): array
public function get_all_suspended(int $customer_id = null): array
{
if($customer_id == NEW_ENTRY)
{
@@ -1342,11 +1337,11 @@ class Sale extends Model
/**
* Gets the dinner table for the selected sale
*/
public function get_dinner_table(int $sale_id) //TODO: this is returning NULL or the table_id. We can keep it this way but multiple return types can't be declared until PHP 8.x
public function get_dinner_table(int $sale_id) //TODO: this is returning null or the table_id. We can keep it this way but multiple return types can't be declared until PHP 8.x
{
if($sale_id == NEW_ENTRY)
{
return NULL;
return null;
}
$builder = $this->db->table('sales');
@@ -1395,12 +1390,12 @@ class Sale extends Model
$row = $builder->get()->getRow();
if($row != NULL)
if($row != null)
{
return $row->quote_number;
}
return NULL;
return null;
}
/**
@@ -1413,12 +1408,12 @@ class Sale extends Model
$row = $builder->get()->getRow();
if($row != NULL) //TODO: === ?
if($row != null) //TODO: === ?
{
return $row->work_order_number;
}
return NULL;
return null;
}
/**
@@ -1431,12 +1426,12 @@ class Sale extends Model
$row = $builder->get()->getRow();
if($row != NULL) //TODO: === ?
if($row != null) //TODO: === ?
{
return $row->comment;
}
return NULL;
return null;
}
/**
@@ -1543,8 +1538,8 @@ class Sale extends Model
{
$points_percent = $customer_rewards->get_points_percent($package_id);
$points = $customer->get_info($customer_id)->points;
$points = ($points == NULL ? 0 : $points);
$points_percent = ($points_percent == NULL ? 0 : $points_percent);
$points = ($points == null ? 0 : $points);
$points_percent = ($points_percent == null ? 0 : $points_percent);
$total_amount_earned = ($total_amount * $points_percent / 100);
$points = $points + $total_amount_earned;

View File

@@ -218,7 +218,7 @@ class Stock_location extends Model
* @param bool $purge
* @return bool
*/
public function delete($location_id = null, bool $purge = FALSE): bool
public function delete($location_id = null, bool $purge = false): bool
{
$this->db->transStart();

View File

@@ -112,7 +112,7 @@ class Supplier extends Person
*/
public function save_supplier(array &$person_data, array &$supplier_data, int $supplier_id = NEW_ENTRY): bool
{
$success = FALSE;
$success = false;
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->transStart();
@@ -164,7 +164,7 @@ class Supplier extends Person
/**
* Get search suggestions to find suppliers
*/
public function get_search_suggestions(string $search, int $limit = 25, bool $unique = FALSE): array //TODO: Parent is looking for the 2nd parameter to be an int
public function get_search_suggestions(string $search, int $limit = 25, bool $unique = false): array //TODO: Parent is looking for the 2nd parameter to be an int
{
$suggestions = [];
@@ -257,7 +257,7 @@ class Supplier extends Person
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
return $this->search($search, 0, 0, 'last_name', 'asc', true);
}
/**

View File

@@ -90,15 +90,15 @@ class Tax extends Model
{
//Get empty base parent object
$tax_rate_obj = new stdClass();
$tax_rate_obj->tax_rate_id = NULL;
$tax_rate_obj->rate_tax_code_id = NULL;
$tax_rate_obj->tax_rate_id = null;
$tax_rate_obj->rate_tax_code_id = null;
$tax_rate_obj->tax_code = '';
$tax_rate_obj->tax_code_name = '';
$tax_rate_obj->rate_tax_category_id = NULL;
$tax_rate_obj->rate_tax_category_id = null;
$tax_rate_obj->tax_category = '';
$tax_rate_obj->tax_rate = 0.0;
$tax_rate_obj->tax_rounding_code = '0';
$tax_rate_obj->rate_jurisdiction_id = NULL;
$tax_rate_obj->rate_jurisdiction_id = null;
$tax_rate_obj->jurisdiction_name = '';
return $tax_rate_obj;
@@ -172,7 +172,7 @@ class Tax extends Model
{
$tax_rate_data['tax_rate_id'] = $this->db->insertID();
return TRUE;
return true;
}
}
else
@@ -181,11 +181,11 @@ class Tax extends Model
if($builder->update($tax_rate_data))
{
return TRUE;
return true;
}
}
return FALSE;
return false;
}
/**
@@ -214,20 +214,20 @@ class Tax extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE);
return $this->search($search, 0, 0, 'tax_code_name', 'asc', true);
}
/**
* Performs a search on tax_rates
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'tax_code_name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('tax_rates');

View File

@@ -75,7 +75,7 @@ class Tax_category extends Model
/**
* Returns all rows from the table
*///TODO: I think we should work toward having all these get_all functions with the same signature. It makes it easier to use them. This signature is different from the others.
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = TRUE): ResultInterface //TODO: $no_deleted needs a new name. $not_deleted is the correct grammar, but it's a bit confusing by naming the variable a negative. Probably better to name it is_deleted and flip the logic
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = true): ResultInterface //TODO: $no_deleted needs a new name. $not_deleted is the correct grammar, but it's a bit confusing by naming the variable a negative. Probably better to name it is_deleted and flip the logic
{
$builder = $this->db->table('tax_categories');
if($no_deleted)
@@ -119,10 +119,10 @@ class Tax_category extends Model
{
$tax_category_data['tax_category_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('tax_category_id', $tax_category_id);
@@ -202,20 +202,20 @@ class Tax_category extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'tax_category', 'asc', TRUE);
return $this->search($search, 0, 0, 'tax_category', 'asc', true);
}
/**
* Perform a search for a set of rows
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_category', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_category', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'tax_category';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('tax_categories AS tax_categories');

View File

@@ -122,9 +122,9 @@ class Tax_code extends Model
{
if($builder->insert($tax_code_data)) //TODO: this should be refactored to return $builder->insert($tax_code_data); in the same way that $builder->update() below is the return. Look for this in the other save functions as well.
{
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('tax_code', $tax_code_data['tax_code']);
@@ -197,20 +197,20 @@ class Tax_code extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE);
return $this->search($search, 0, 0, 'tax_code_name', 'asc', true);
}
/**
* Perform a search for a set of rows
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'tax_code_name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'tax_code_name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('tax_codes AS tax_codes');

View File

@@ -79,7 +79,7 @@ class Tax_jurisdiction extends Model
/**
* Returns all rows from the table
*/
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = TRUE): ResultInterface
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = true): ResultInterface
{
$builder = $this->db->table('tax_jurisdictions');
@@ -121,10 +121,10 @@ class Tax_jurisdiction extends Model
if($builder->insert($jurisdiction_data)) //TODO: Replace this with simply a return of the result of insert()... see update() below.
{
$jurisdiction_data['jurisdiction_id'] = $this->db->insertID();
return TRUE;
return true;
}
return FALSE;
return false;
}
$builder->where('jurisdiction_id', $jurisdiction_id);
@@ -207,20 +207,20 @@ class Tax_jurisdiction extends Model
*/
public function get_found_rows(string $search): int
{
return $this->search($search, 0, 0, 'jurisdiction_name', 'asc', TRUE);
return $this->search($search, 0, 0, 'jurisdiction_name', 'asc', true);
}
/**
* Perform a search for a set of rows
*/
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'jurisdiction_name', ?string $order = 'asc', ?bool $count_only = FALSE)
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'jurisdiction_name', ?string $order = 'asc', ?bool $count_only = false)
{
// Set default values
if($rows == null) $rows = 0;
if($limit_from == null) $limit_from = 0;
if($sort == null) $sort = 'jurisdiction_name';
if($order == null) $order = 'asc';
if($count_only == null) $count_only = FALSE;
if($count_only == null) $count_only = false;
$builder = $this->db->table('tax_jurisdictions AS tax_jurisdictions');

View File

@@ -27,7 +27,7 @@ class Token_invoice_sequence extends Token
/**
* @throws ReflectionException
*/
public function get_value(bool $save = TRUE): string
public function get_value(bool $save = true): string
{
return $this->appconfig->acquire_next_invoice_sequence($save);
}

View File

@@ -27,7 +27,7 @@ class Token_quote_sequence extends Token
/**
* @throws ReflectionException
*/
public function get_value(bool $save = TRUE): string
public function get_value(bool $save = true): string
{
return $this->appconfig->acquire_next_quote_sequence($save);
}

View File

@@ -26,7 +26,7 @@ class Token_work_order_sequence extends Token
/**
* @throws ReflectionException
*/
public function get_value(bool $save = TRUE): string
public function get_value(bool $save = true): string
{
return $this->appconfig->acquire_next_work_order_sequence($save);
}

View File

@@ -9,17 +9,17 @@
* @var array $definition_values
*/
?>
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="error_message_box" class="error_message_box"></ul>
<?php echo form_open("attributes/saveDefinition/$definition_id", ['id' => 'attribute_form', 'class' => 'form-horizontal'])?>
<?= form_open("attributes/saveDefinition/$definition_id", ['id' => 'attribute_form', 'class' => 'form-horizontal'])?>
<fieldset id="attribute_basic_info">
<div class="form-group form-group-sm">
<?php echo form_label(lang('Attributes.definition_name'), 'definition_name', ['class' => 'required control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_name'), 'definition_name', ['class' => 'required control-label col-xs-3']) ?>
<div class='col-xs-8'>
<?php echo form_input ([
<?= form_input ([
'name' => 'definition_name',
'id' => 'definition_name',
'class' => 'form-control input-sm',
@@ -30,16 +30,16 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Attributes.definition_type'), 'definition_type', ['class' => 'required control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_type'), 'definition_type', ['class' => 'required control-label col-xs-3']) ?>
<div class='col-xs-8'>
<?php echo form_dropdown('definition_type', DEFINITION_TYPES, array_search($definition_info->definition_type, DEFINITION_TYPES), 'id="definition_type" class="form-control"') ?>
<?= form_dropdown('definition_type', DEFINITION_TYPES, array_search($definition_info->definition_type, DEFINITION_TYPES), 'id="definition_type" class="form-control"') ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Attributes.definition_group'), 'definition_group', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_group'), 'definition_group', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<?php echo form_dropdown(
<?= form_dropdown(
'definition_group',
$definition_group,
$definition_info->definition_fk,
@@ -49,10 +49,10 @@
</div>
<div class="form-group form-group-sm hidden">
<?php echo form_label(lang('Attributes.definition_flags'), 'definition_flags', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_flags'), 'definition_flags', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<div class="input-group">
<?php echo form_multiselect(
<?= form_multiselect(
'definition_flags[]',
esc($definition_flags),
esc(array_keys($selected_definition_flags)),
@@ -70,10 +70,10 @@
</div>
<div class="form-group form-group-sm hidden">
<?php echo form_label(lang('Attributes.definition_unit'), 'definition_units', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_unit'), 'definition_units', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'name' => 'definition_unit',
'value' => $definition_info->definition_unit,
'class' => 'form-control input-sm',
@@ -84,10 +84,10 @@
</div>
<div class="form-group form-group-sm hidden">
<?php echo form_label(lang('Attributes.definition_values'), 'definition_value', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_values'), 'definition_value', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<div class="input-group">
<?php echo form_input (['name' => 'definition_value', 'class' => 'form-control input-sm', 'id' => 'definition_value']) ?>
<?= form_input (['name' => 'definition_value', 'class' => 'form-control input-sm', 'id' => 'definition_value']) ?>
<span id="add_attribute_value" class="input-group-addon input-sm btn btn-default">
<span class="glyphicon glyphicon-plus-sign"></span>
</span>
@@ -96,21 +96,21 @@
</div>
<div class="form-group form-group-sm hidden">
<?php echo form_label('&nbsp', 'definition_list_group', ['class' => 'control-label col-xs-3']) ?>
<?= form_label('&nbsp', 'definition_list_group', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<ul id="definition_list_group" class="list-group"></ul>
</div>
</div>
</fieldset>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
$(document).ready(function()
{
var values = [];
var definition_id = <?php echo esc($definition_id, 'js') ?>;
var definition_id = <?= esc($definition_id, 'js') ?>;
var is_new = definition_id == 0;
var disable_definition_types = function()
@@ -181,7 +181,7 @@ $(document).ready(function()
}
else
{
$.post('<?php echo esc("$controller_name/delete_attribute_value/") ?>', {definition_id: definition_id, attribute_value: value});
$.post('<?= esc("$controller_name/delete_attribute_value/") ?>', {definition_id: definition_id, attribute_value: value});
}
$(this).parents("li").remove();
};
@@ -210,7 +210,7 @@ $(document).ready(function()
}
else
{
$.post('<?php echo "attributes/saveAttributeValue/" ?>', {definition_id: definition_id, attribute_value: value});
$.post('<?= "attributes/saveAttributeValue/" ?>', {definition_id: definition_id, attribute_value: value});
}
}
@@ -228,14 +228,14 @@ $(document).ready(function()
}
});
var definition_values = <?php echo json_encode(array_values($definition_values)) ?>;
var definition_values = <?= json_encode(array_values($definition_values)) ?>;
$.each(definition_values, function(index, element) {
add_attribute_value(element);
});
$.validator.addMethod('valid_chars', function(value, element) {
return value.match(/(\||_)/g) == null;
}, "<?php echo lang('Attributes.attribute_value_invalid_chars') ?>");
}, "<?= lang('Attributes.attribute_value_invalid_chars') ?>");
$('form').bind('submit', function () {
$(this).find(':input').prop('disabled', false);
@@ -256,7 +256,7 @@ $(document).ready(function()
success: function(response)
{
dialog_support.hide();
table_support.handle_submit('<?php echo esc($controller_name) ?>', response);
table_support.handle_submit('<?= esc($controller_name) ?>', response);
},
dataType: 'json'
});
@@ -269,8 +269,8 @@ $(document).ready(function()
},
messages:
{
definition_name: "<?php echo lang('Attributes.definition_name_required') ?>",
definition_type: "<?php echo lang('Attributes.definition_type_required') ?>"
definition_name: "<?= lang('Attributes.definition_name_required') ?>",
definition_type: "<?= lang('Attributes.definition_type_required') ?>"
}
}, form_support.error));
});

View File

@@ -7,9 +7,9 @@
*/
?>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Attributes.definition_name'), 'definition_name_label', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Attributes.definition_name'), 'definition_name_label', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<?php echo form_dropdown('definition_name', $definition_names, -1, ['id' => 'definition_name', 'class' => 'form-control']) ?>
<?= form_dropdown('definition_name', $definition_names, -1, ['id' => 'definition_name', 'class' => 'form-control']) ?>
</div>
</div>
@@ -20,7 +20,7 @@ foreach($definition_values as $definition_id => $definition_value)
?>
<div class="form-group form-group-sm">
<?php echo form_label($definition_value['definition_name'], $definition_value['definition_name'], ['class' => 'control-label col-xs-3']) ?>
<?= form_label($definition_value['definition_name'], $definition_value['definition_name'], ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<div class="input-group">
<?php
@@ -84,7 +84,7 @@ foreach($definition_values as $definition_id => $definition_value)
<script type="text/javascript">
(function() {
<?php echo view('partial/datepicker_locale', ['config' => '{ minView: 2, format: "'.dateformat_bootstrap($config['dateformat'] . '"}')]) ?>
<?= view('partial/datepicker_locale', ['config' => '{ minView: 2, format: "'.dateformat_bootstrap($config['dateformat'] . '"}')]) ?>
var enable_delete = function() {
$('.remove_attribute_btn').click(function() {
@@ -99,7 +99,7 @@ foreach($definition_values as $definition_id => $definition_value)
$("input[name='attribute_ids[" + definition_id + "]']").val('');
}).autocomplete({
source: function(request, response) {
$.get('<?php echo 'attributes/suggestAttribute/' ?>' + this.element.data('definition-id') + '?term=' + request.term, function(data) {
$.get('<?= 'attributes/suggestAttribute/' ?>' + this.element.data('definition-id') + '?term=' + request.term, function(data) {
return response(data);
}, 'json');
},

View File

@@ -4,18 +4,19 @@
/**
* @var string $controller_name
* @var string $table_headers
* @var array $config
*/
?>
<script type="text/javascript">
$(document).ready(function()
{
<?php echo view('partial/bootstrap_tables_locale') ?>
<?= view('partial/bootstrap_tables_locale') ?>
table_support.init({
resource: '<?php echo esc($controller_name) ?>',
headers: <?php echo $table_headers ?>,
pageSize: <?php echo $config['lines_per_page'] ?>,
resource: '<?= esc($controller_name) ?>',
headers: <?= $table_headers ?>,
pageSize: <?= $config['lines_per_page'] ?>,
uniqueId: 'definition_id'
});
});
@@ -23,16 +24,16 @@
<div id="title_bar" class="btn-toolbar print_hide">
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc("$controller_name/view") ?>'
title='<?php echo lang("$controller_name.new") ?>'>
<span class="glyphicon glyphicon-star">&nbsp</span><?php echo lang("$controller_name.new") ?>
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?= lang('Common.submit') ?>' data-href='<?= esc("$controller_name/view") ?>'
title='<?= lang("$controller_name.new") ?>'>
<span class="glyphicon glyphicon-star">&nbsp</span><?= lang("$controller_name.new") ?>
</button>
</div>
<div id="toolbar">
<div class="pull-left form-inline" role="toolbar">
<button id="delete" class="btn btn-default btn-sm print_hide">
<span class="glyphicon glyphicon-trash">&nbsp</span><?php echo lang('Common.delete') ?>
<span class="glyphicon glyphicon-trash">&nbsp</span><?= lang('Common.delete') ?>
</button>
</div>
</div>
@@ -41,4 +42,4 @@
<table id="table"></table>
</div>
<?php echo view('partial/footer') ?>
<?= view('partial/footer') ?>

View File

@@ -7,17 +7,17 @@
*/
?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $this->request->getLocale() ?>">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?= $this->request->getLocale() ?>">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo lang('Items.generate_barcodes') ?></title>
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url() ?>css/barcode_font.css" />
<title><?= lang('Items.generate_barcodes') ?></title>
<link rel="stylesheet" rev="stylesheet" href="<?= base_url() ?>css/barcode_font.css" />
</head>
<body class=<?php echo "font_".$this->barcode_lib->get_font_name($barcode_config['barcode_font']) ?>
style="font-size:<?php echo $barcode_config['barcode_font_size'] ?>px">
<table cellspacing=<?php echo $barcode_config['barcode_page_cellspacing'] ?> width='<?php echo $barcode_config['barcode_page_width']."%" ?>' >
<body class=<?= "font_".$this->barcode_lib->get_font_name($barcode_config['barcode_font']) ?>
style="font-size:<?= $barcode_config['barcode_font_size'] ?>px">
<table cellspacing=<?= $barcode_config['barcode_page_cellspacing'] ?> width='<?= $barcode_config['barcode_page_width']."%" ?>' >
<tr>
<?php
$count = 0;

View File

@@ -3,25 +3,26 @@
* @var object $cash_ups_info
* @var array $employees
* @var string $controller_name
* @var array $config
*/
?>
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="error_message_box" class="error_message_box"></ul>
<?php echo form_open(esc('cashups/save/'.$cash_ups_info->cashup_id), ['id' => 'cashups_edit_form', 'class' => 'form-horizontal']) //TODO: String Interpolation ?>
<?= form_open(esc('cashups/save/'.$cash_ups_info->cashup_id), ['id' => 'cashups_edit_form', 'class' => 'form-horizontal']) //TODO: String Interpolation ?>
<fieldset id="item_basic_info">
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.info'), 'cash_ups_info', ['class' => 'control-label col-xs-3']) ?>
<?php echo form_label(!empty($cash_ups_info->cashup_id) ? lang('Cashups.id') . ' ' . $cash_ups_info->cashup_id : '', 'cashup_id', ['class' => 'control-label col-xs-8', 'style' => 'text-align:left']) ?>
<?= form_label(lang('Cashups.info'), 'cash_ups_info', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(!empty($cash_ups_info->cashup_id) ? lang('Cashups.id') . ' ' . $cash_ups_info->cashup_id : '', 'cashup_id', ['class' => 'control-label col-xs-8', 'style' => 'text-align:left']) ?>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.open_date'), 'open_date', ['class' => 'required control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.open_date'), 'open_date', ['class' => 'required control-label col-xs-3']) ?>
<div class='col-xs-6'>
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'open_date',
'id' => 'open_date',
'class' => 'form-control input-sm datepicker',
@@ -32,40 +33,40 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.open_employee'), 'open_employee', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.open_employee'), 'open_employee', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-6'>
<?php echo form_dropdown('open_employee_id', $employees, $cash_ups_info->open_employee_id, 'id="open_employee_id" class="form-control"') ?>
<?= form_dropdown('open_employee_id', $employees, $cash_ups_info->open_employee_id, 'id="open_employee_id" class="form-control"') ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.open_amount_cash'), 'open_amount_cash', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.open_amount_cash'), 'open_amount_cash', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'open_amount_cash',
'id' => 'open_amount_cash',
'class' => 'form-control input-sm',
'value' => to_currency_no_money($cash_ups_info->open_amount_cash)
]) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.transfer_amount_cash'), 'transfer_amount_cash', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.transfer_amount_cash'), 'transfer_amount_cash', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'transfer_amount_cash',
'id' => 'transfer_amount_cash',
'class' => 'form-control input-sm',
@@ -73,18 +74,18 @@
])
?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.close_date'), 'close_date', ['class' => 'required control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.close_date'), 'close_date', ['class' => 'required control-label col-xs-3']) ?>
<div class='col-xs-6'>
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'close_date',
'id' => 'close_date',
'class' => 'form-control input-sm datepicker',
@@ -95,36 +96,36 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.close_employee'), 'close_employee', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.close_employee'), 'close_employee', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-6'>
<?php echo form_dropdown('close_employee_id', $employees, $cash_ups_info->close_employee_id, 'id="close_employee_id" class="form-control"') ?>
<?= form_dropdown('close_employee_id', $employees, $cash_ups_info->close_employee_id, 'id="close_employee_id" class="form-control"') ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.closed_amount_cash'), 'closed_amount_cash', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.closed_amount_cash'), 'closed_amount_cash', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'closed_amount_cash',
'id' => 'closed_amount_cash',
'class' => 'form-control input-sm',
'value'=>to_currency_no_money($cash_ups_info->closed_amount_cash)]
) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.note'), 'note', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.note'), 'note', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-6'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'note',
'id' => 'note',
'value'=>0,
@@ -134,73 +135,73 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.closed_amount_due'), 'closed_amount_due', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.closed_amount_due'), 'closed_amount_due', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'closed_amount_due',
'id' => 'closed_amount_due',
'class' => 'form-control input-sm',
'value'=>to_currency_no_money($cash_ups_info->closed_amount_due)]
) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.closed_amount_card'), 'closed_amount_card', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.closed_amount_card'), 'closed_amount_card', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'closed_amount_card',
'id' => 'closed_amount_card',
'class' => 'form-control input-sm',
'value'=>to_currency_no_money($cash_ups_info->closed_amount_card)]
) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.closed_amount_check'), 'closed_amount_check', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.closed_amount_check'), 'closed_amount_check', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'closed_amount_check',
'id' => 'closed_amount_check',
'class' => 'form-control input-sm',
'value'=>to_currency_no_money($cash_ups_info->closed_amount_check)]
) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.closed_amount_total'), 'closed_amount_total', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.closed_amount_total'), 'closed_amount_total', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php echo form_input ([
<?= form_input ([
'name' => 'closed_amount_total',
'id' => 'closed_amount_total',
'readonly' => 'true',
@@ -209,16 +210,16 @@
]
) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<span class="input-group-addon input-sm"><b><?= esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.description'), 'description', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.description'), 'description', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-6'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'description',
'id' => 'description',
'class' => 'form-control input-sm',
@@ -233,9 +234,9 @@
{
?>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Cashups.is_deleted').':', 'deleted', ['class' => 'control-label col-xs-3']) ?>
<?= form_label(lang('Cashups.is_deleted').':', 'deleted', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-5'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'deleted',
'id' => 'deleted',
'value'=>1,
@@ -247,17 +248,17 @@
}
?>
</fieldset>
<?php echo form_close() ?>
<?= form_close() ?>
<script type='text/javascript'>
//validation and submit handling
$(document).ready(function()
{
<?php echo view('partial/datepicker_locale') ?>
<?= view('partial/datepicker_locale') ?>
$('#open_date').datetimepicker({
format: "<?php echo dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat']) ?>",
startDate: "<?php echo date($config['dateformat'] . ' ' . esc($config['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
format: "<?= dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat']) ?>",
startDate: "<?= date($config['dateformat'] . ' ' . esc($config['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
<?php
$t = $config['timeformat'];
$m = $t[strlen($t)-1];
@@ -279,12 +280,12 @@ $(document).ready(function()
todayBtn: true,
todayHighlight: true,
bootcssVer: 3,
language: '<?php echo current_language_code() ?>'
language: '<?= current_language_code() ?>'
});
$('#close_date').datetimepicker({
format: "<?php echo dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat']) ?>",
startDate: "<?php echo date($config['dateformat'] . ' ' . esc($config['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
format: "<?= dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat']) ?>",
startDate: "<?= date($config['dateformat'] . ' ' . esc($config['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
<?php
$t = $config['timeformat'];
$m = $t[strlen($t)-1];
@@ -306,11 +307,11 @@ $(document).ready(function()
todayBtn: true,
todayHighlight: true,
bootcssVer: 3,
language: '<?php echo current_language_code() ?>'
language: '<?= current_language_code() ?>'
});
$('#open_amount_cash, #transfer_amount_cash, #closed_amount_cash, #closed_amount_due, #closed_amount_card, #closed_amount_check').keyup(function() {
$.post("<?php echo esc("$controller_name/ajax_cashup_total") ?>", {
$.post("<?= esc("$controller_name/ajax_cashup_total") ?>", {
'open_amount_cash': $('#open_amount_cash').val(),
'transfer_amount_cash': $('#transfer_amount_cash').val(),
'closed_amount_due': $('#closed_amount_due').val(),
@@ -332,7 +333,7 @@ $(document).ready(function()
success: function(response)
{
dialog_support.hide();
table_support.handle_submit('<?php echo esc('cashups') ?>', response);
table_support.handle_submit('<?= esc('cashups') ?>', response);
},
dataType: 'json'
});
@@ -352,18 +353,18 @@ $(document).ready(function()
{
open_date:
{
required: '<?php echo lang('Cashups.date_required') ?>'
required: '<?= lang('Cashups.date_required') ?>'
},
close_date:
{
required: '<?php echo lang('Cashups.date_required') ?>'
required: '<?= lang('Cashups.date_required') ?>'
},
amount:
{
required: '<?php echo lang('Cashups.amount_required') ?>',
number: '<?php echo lang('Cashups.amount_number') ?>'
required: '<?= lang('Cashups.amount_required') ?>',
number: '<?= lang('Cashups.amount_number') ?>'
}
}
}, form_support.error));

View File

@@ -3,9 +3,10 @@
* @var string $controller_name
* @var string $table_headers
* @var array $filters
* @var array $config
*/
?>
<?php echo view('partial/header') ?>
<?= view('partial/header') ?>
<script type="text/javascript">
$(document).ready(function()
@@ -16,18 +17,18 @@ $(document).ready(function()
});
// load the preset datarange picker
<?php echo view('partial/daterangepicker') ?>
<?= view('partial/daterangepicker') ?>
$("#daterangepicker").on('apply.daterangepicker', function(ev, picker) {
table_support.refresh();
});
<?php echo view('partial/bootstrap_tables_locale') ?>
<?= view('partial/bootstrap_tables_locale') ?>
table_support.init({
resource: '<?php echo esc($controller_name) ?>',
headers: <?php echo $table_headers ?>,
pageSize: <?php echo $config['lines_per_page'] ?>,
resource: '<?= esc($controller_name) ?>',
headers: <?= $table_headers ?>,
pageSize: <?= $config['lines_per_page'] ?>,
uniqueId: 'cashup_id',
queryParams: function() {
return $.extend(arguments[0], {
@@ -40,26 +41,26 @@ $(document).ready(function()
});
</script>
<?php echo view('partial/print_receipt', ['print_after_sale'=>false, 'selected_printer' => 'takings_printer']) ?>
<?= view('partial/print_receipt', ['print_after_sale'=>false, 'selected_printer' => 'takings_printer']) ?>
<div id="title_bar" class="print_hide btn-toolbar">
<button onclick="javascript:printdoc()" class='btn btn-info btn-sm pull-right'>
<span class="glyphicon glyphicon-print">&nbsp;</span><?php echo lang('Common.print') ?>
<span class="glyphicon glyphicon-print">&nbsp;</span><?= lang('Common.print') ?>
</button>
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo "$controller_name/view" ?>'
title='<?php echo lang("$controller_name.new") ?>'>
<span class="glyphicon glyphicon-tags">&nbsp</span><?php echo lang(esc($controller_name) . '.new') //TODO: String Interpolation ?>
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?= lang('Common.submit') ?>' data-href='<?= "$controller_name/view" ?>'
title='<?= lang("$controller_name.new") ?>'>
<span class="glyphicon glyphicon-tags">&nbsp</span><?= lang(esc($controller_name) . '.new') //TODO: String Interpolation ?>
</button>
</div>
<div id="toolbar">
<div class="pull-left form-inline" role="toolbar">
<button id="delete" class="btn btn-default btn-sm print_hide">
<span class="glyphicon glyphicon-trash">&nbsp</span><?php echo lang('Common.delete') ?>
<span class="glyphicon glyphicon-trash">&nbsp</span><?= lang('Common.delete') ?>
</button>
<?php echo form_input (['name' => 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
<?php echo form_multiselect('filters[]', esc($filters), [''], [
<?= form_input (['name' => 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
<?= form_multiselect('filters[]', esc($filters), [''], [
'id' => 'filters',
'data-none-selected-text'=>lang('Common.none_selected_text'),
'class' => 'selectpicker show-menu-arrow',
@@ -74,4 +75,4 @@ $(document).ready(function()
<table id="table"></table>
</div>
<?php echo view('partial/footer') ?>
<?= view('partial/footer') ?>

View File

@@ -1,18 +1,20 @@
<?php
/**
* @var array $support_barcode
* @var array $config
* @var array $barcode_fonts
*/
?>
<?php echo form_open('config/saveBarcode/', ['id' => 'barcode_config_form', 'class' => 'form-horizontal']) ?>
<?= form_open('config/saveBarcode/', ['id' => 'barcode_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="barcode_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_type'), 'barcode_type', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.barcode_type'), 'barcode_type', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'barcode_type',
$support_barcode,
$config['barcode_type'],
@@ -22,9 +24,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_width'), 'barcode_width', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.barcode_width'), 'barcode_width', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'step' => '5',
'max' => '350',
'min' => '60',
@@ -38,9 +40,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_height'), 'barcode_height', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.barcode_height'), 'barcode_height', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => 10,
'max' => 120,
@@ -53,9 +55,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_font'), 'barcode_font', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.barcode_font'), 'barcode_font', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-sm-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'barcode_font',
$barcode_fonts,
$config['barcode_font'],
@@ -63,7 +65,7 @@
) ?>
</div>
<div class="col-sm-2">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '1',
'max' => '30',
@@ -76,9 +78,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.allow_duplicate_barcodes'), 'allow_duplicate_barcodes', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.allow_duplicate_barcodes'), 'allow_duplicate_barcodes', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'allow_duplicate_barcodes',
'id' => 'allow_duplicate_barcodes',
'value' => 'allow_duplicate_barcodes',
@@ -86,45 +88,45 @@
]) ?>
&nbsp
<label class="control-label">
<span class="glyphicon glyphicon-warning-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.barcode_tooltip') ?>"></span>
<span class="glyphicon glyphicon-warning-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.barcode_tooltip') ?>"></span>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_content'), 'barcode_content', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.barcode_content'), 'barcode_content', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-8'>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'barcode_content',
'value' => 'id',
'checked' => $config['barcode_content'] == 'id'
]) ?>
<?php echo lang('Config.barcode_id') ?>
<?= lang('Config.barcode_id') ?>
</label>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'barcode_content',
'value' => 'number',
'checked' => $config['barcode_content'] == 'number'
]) ?>
<?php echo lang('Config.barcode_number') ?>
<?= lang('Config.barcode_number') ?>
</label>
&nbsp
&nbsp
<label class="checkbox-inline">
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'barcode_generate_if_empty',
'value' => 'barcode_generate_if_empty',
'checked' => $config['barcode_generate_if_empty'] == 1
]) ?>
<?php echo lang('Config.barcode_generate_if_empty') ?>
<?= lang('Config.barcode_generate_if_empty') ?>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_formats'), 'barcode_formats', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.barcode_formats'), 'barcode_formats', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-4'>
<?php
$barcode_formats = json_decode($config['barcode_formats']);
@@ -139,12 +141,12 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_layout'), 'barcode_layout', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.barcode_layout'), 'barcode_layout', ['class' => 'control-label col-xs-2']) ?>
<div class="col-sm-10">
<div class="form-group form-group-sm row">
<label class="control-label col-sm-1"><?php echo lang('Config.barcode_first_row').' ' ?></label>
<label class="control-label col-sm-1"><?= lang('Config.barcode_first_row').' ' ?></label>
<div class='col-sm-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'barcode_first_row', [
'not_show' => lang('Config.none'),
'name' => lang('Items.name'),
@@ -156,9 +158,9 @@
$config['barcode_first_row'], ['class' => 'form-control input-sm']);
?>
</div>
<label class="control-label col-sm-1"><?php echo lang('Config.barcode_second_row').' ' ?></label>
<label class="control-label col-sm-1"><?= lang('Config.barcode_second_row').' ' ?></label>
<div class='col-sm-2'>
<?php echo form_dropdown('barcode_second_row', [
<?= form_dropdown('barcode_second_row', [
'not_show' => lang('Config.none'),
'name' => lang('Items.name'),
'category' => lang('Items.category'),
@@ -169,9 +171,9 @@
],
$config['barcode_second_row'], ['class' => 'form-control input-sm']) ?>
</div>
<label class="control-label col-sm-1"><?php echo lang('Config.barcode_third_row').' ' ?></label>
<label class="control-label col-sm-1"><?= lang('Config.barcode_third_row').' ' ?></label>
<div class='col-sm-2'>
<?php echo form_dropdown('barcode_third_row', [
<?= form_dropdown('barcode_third_row', [
'not_show' => lang('Config.none'),
'name' => lang('Items.name'),
'category' => lang('Items.category'),
@@ -187,9 +189,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_number_in_row'), 'barcode_num_in_row', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.barcode_number_in_row'), 'barcode_num_in_row', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'name' => 'barcode_num_in_row',
'id' => 'barcode_num_in_row',
'class' => 'form-control input-sm required',
@@ -199,10 +201,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_page_width'), 'barcode_page_width', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.barcode_page_width'), 'barcode_page_width', ['class' => 'control-label col-xs-2 required']) ?>
<div class="col-sm-2">
<div class='input-group'>
<?php echo form_input ([
<?= form_input ([
'name' => 'barcode_page_width',
'id' => 'barcode_page_width',
'class' => 'form-control input-sm required',
@@ -214,10 +216,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.barcode_page_cellspacing'), 'barcode_page_cellspacing', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.barcode_page_cellspacing'), 'barcode_page_cellspacing', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-sm-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'name' => 'barcode_page_cellspacing',
'id' => 'barcode_page_cellspacing',
'class' => 'form-control input-sm required',
@@ -228,14 +230,14 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_barcode',
'id' => 'submit_barcode',
'value' => lang('Common.submit'),
'class' => 'btn btn-primary btn-sm pull-right']) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
$(document).ready(function()
@@ -282,33 +284,33 @@ $(document).ready(function()
{
barcode_width:
{
required:"<?php echo lang('Config.default_barcode_width_required') ?>",
number:"<?php echo lang('Config.default_barcode_width_number') ?>"
required:"<?= lang('Config.default_barcode_width_required') ?>",
number:"<?= lang('Config.default_barcode_width_number') ?>"
},
barcode_height:
{
required:"<?php echo lang('Config.default_barcode_height_required') ?>",
number:"<?php echo lang('Config.default_barcode_height_number') ?>"
required:"<?= lang('Config.default_barcode_height_required') ?>",
number:"<?= lang('Config.default_barcode_height_number') ?>"
},
barcode_font_size:
{
required:"<?php echo lang('Config.default_barcode_font_size_required') ?>",
number:"<?php echo lang('Config.default_barcode_font_size_number') ?>"
required:"<?= lang('Config.default_barcode_font_size_required') ?>",
number:"<?= lang('Config.default_barcode_font_size_number') ?>"
},
barcode_num_in_row:
{
required:"<?php echo lang('Config.default_barcode_num_in_row_required') ?>",
number:"<?php echo lang('Config.default_barcode_num_in_row_number') ?>"
required:"<?= lang('Config.default_barcode_num_in_row_required') ?>",
number:"<?= lang('Config.default_barcode_num_in_row_number') ?>"
},
barcode_page_width:
{
required:"<?php echo lang('Config.default_barcode_page_width_required') ?>",
number:"<?php echo lang('Config.default_barcode_page_width_number') ?>"
required:"<?= lang('Config.default_barcode_page_width_required') ?>",
number:"<?= lang('Config.default_barcode_page_width_number') ?>"
},
barcode_page_cellspacing:
{
required:"<?php echo lang('Config.default_barcode_page_cellspacing_required') ?>",
number:"<?php echo lang('Config.default_barcode_page_cellspacing_number') ?>"
required:"<?= lang('Config.default_barcode_page_cellspacing_required') ?>",
number:"<?= lang('Config.default_barcode_page_cellspacing_number') ?>"
}
}
}));

View File

@@ -1,13 +1,18 @@
<?php echo form_open('config/saveEmail/', ['id' => 'email_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php
/**
* @var array $config
*/
?>
<?= form_open('config/saveEmail/', ['id' => 'email_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="email_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_protocol'), 'protocol', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_protocol'), 'protocol', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'protocol',
[
'mail' => 'mail',
@@ -21,9 +26,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_mailpath'), 'mailpath', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_mailpath'), 'mailpath', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-4">
<?php echo form_input ([
<?= form_input ([
'name' => 'mailpath',
'id' => 'mailpath',
'class' => 'form-control input-sm',
@@ -33,9 +38,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_smtp_host'), 'smtp_host', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_smtp_host'), 'smtp_host', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-2">
<?php echo form_input ([
<?= form_input ([
'name' => 'smtp_host',
'id' => 'smtp_host',
'class' => 'form-control input-sm',
@@ -45,9 +50,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_smtp_port'), 'smtp_port', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_smtp_port'), 'smtp_port', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-2">
<?php echo form_input ([
<?= form_input ([
'name' => 'smtp_port',
'id' => 'smtp_port',
'class' => 'form-control input-sm',
@@ -57,9 +62,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_smtp_crypto'), 'smtp_crypto', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_smtp_crypto'), 'smtp_crypto', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'smtp_crypto',
[
'' => 'None',
@@ -73,9 +78,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_smtp_timeout'), 'smtp_timeout', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_smtp_timeout'), 'smtp_timeout', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-2">
<?php echo form_input ([
<?= form_input ([
'name' => 'smtp_timeout',
'id' => 'smtp_timeout',
'class' => 'form-control input-sm',
@@ -85,11 +90,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_smtp_user'), 'smtp_user', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_smtp_user'), 'smtp_user', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-user"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'smtp_user',
'id' => 'smtp_user',
'class' => 'form-control input-sm',
@@ -100,11 +105,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_smtp_pass'), 'smtp_pass', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_smtp_pass'), 'smtp_pass', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-asterisk"></span></span>
<?php echo form_password ([
<?= form_password ([
'name' => 'smtp_pass',
'id' => 'smtp_pass',
'class' => 'form-control input-sm',
@@ -114,14 +119,14 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_email',
'id' => 'submit_email',
'value' => lang('Common.submit'),
'class' => 'btn btn-primary btn-sm pull-right']) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling

View File

@@ -5,20 +5,21 @@
* @var array $selected_image_allowed_types
* @var bool $show_office_group
* @var string $controller_name
* @var array $config
*/
?>
<?php echo form_open('config/saveGeneral/', ['id' => 'general_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?= form_open('config/saveGeneral/', ['id' => 'general_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="general_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.theme'), 'theme', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.theme'), 'theme', ['class' => 'control-label col-xs-2']) ?>
<div class='col-sm-10'>
<div class="form-group form-group-sm row">
<div class='col-sm-3'>
<?php echo form_dropdown(
<?= form_dropdown(
'theme',
$themes,
$config['theme'],
@@ -26,8 +27,8 @@
) ?>
</div>
<div class="col-sm-7">
<a href="<?php echo 'https://bootswatch.com/3/' . ('bootstrap' == ($config['theme']) ? 'default' : esc($config['theme'])) ?>" target="_blank" rel=”noopener”>
<span><?php echo lang('Config.theme_preview') . ' ' . ucfirst(esc($config['theme'])) . ' ' ?></span><span class="glyphicon glyphicon-new-window"></span>
<a href="<?= 'https://bootswatch.com/3/' . ('bootstrap' == ($config['theme']) ? 'default' : esc($config['theme'])) ?>" target="_blank" rel=”noopener”>
<span><?= lang('Config.theme_preview') . ' ' . ucfirst(esc($config['theme'])) . ' ' ?></span><span class="glyphicon glyphicon-new-window"></span>
</a>
</div>
</div>
@@ -35,9 +36,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.login_form'), 'login_form', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.login_form'), 'login_form', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'login_form',
[
'floating_labels' => lang('Config.floating_labels'),
@@ -50,10 +51,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.default_sales_discount'), 'default_sales_discount', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.default_sales_discount'), 'default_sales_discount', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'name' => 'default_sales_discount',
'id' => 'default_sales_discount',
'class' => 'form-control input-sm required',
@@ -63,7 +64,7 @@
'value' => $config['default_sales_discount']
]) ?>
<span class="input-group-btn">
<?php echo form_checkbox ([
<?= form_checkbox ([
'id' => 'default_sales_discount_type',
'name' => 'default_sales_discount_type',
'value' => 1,
@@ -80,10 +81,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.default_receivings_discount'), 'default_receivings_discount', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.default_receivings_discount'), 'default_receivings_discount', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'name' => 'default_receivings_discount',
'id' => 'default_receivings_discount',
'class' => 'form-control input-sm required',
@@ -93,7 +94,7 @@
'value' => $config['default_receivings_discount']
]) ?>
<span class="input-group-btn">
<?php echo form_checkbox ([
<?= form_checkbox ([
'id' => 'default_receivings_discount_type',
'name' => 'default_receivings_discount_type',
'value' => 1,
@@ -110,9 +111,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.enforce_privacy'), 'enforce_privacy', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.enforce_privacy'), 'enforce_privacy', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'enforce_privacy',
'id' => 'enforce_privacy',
'value' => 'enforce_privacy',
@@ -120,15 +121,15 @@
]) ?>
&nbsp
<label class="control-label">
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.enforce_privacy_tooltip') ?>"></span>
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.enforce_privacy_tooltip') ?>"></span>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receiving_calculate_average_price'), 'receiving_calculate_average_price', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receiving_calculate_average_price'), 'receiving_calculate_average_price', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receiving_calculate_average_price',
'id' => 'receiving_calculate_average_price',
'value' => 'receiving_calculate_average_price',
@@ -138,9 +139,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.lines_per_page'), 'lines_per_page', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.lines_per_page'), 'lines_per_page', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'name' => 'lines_per_page',
'id' => 'lines_per_page',
'class' => 'form-control input-sm required',
@@ -153,11 +154,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.notify_alignment'), 'notify_horizontal_position', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.notify_alignment'), 'notify_horizontal_position', ['class' => 'control-label col-xs-2']) ?>
<div class="col-sm-10">
<div class="form-group form-group-sm row">
<div class='col-sm-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'notify_vertical_position',
[
'top' => lang('Config.top'),
@@ -168,7 +169,7 @@
) ?>
</div>
<div class='col-sm-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'notify_horizontal_position',
[
'left' => lang('Config.left'),
@@ -184,13 +185,13 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.image_restrictions'), 'image_restrictions', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.image_restrictions'), 'image_restrictions', ['class' => 'control-label col-xs-2']) ?>
<div class="col-sm-10">
<div class="form-group form-group-sm row">
<div class='col-sm-2'>
<div class='input-group'>
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-resize-horizontal"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'image_max_width',
'id' => 'image_max_width',
'class' => 'form-control input-sm required',
@@ -207,7 +208,7 @@
<div class='col-sm-2'>
<div class='input-group'>
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-resize-vertical"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'image_max_height',
'id' => 'image_max_height',
'class' => 'form-control input-sm required',
@@ -224,7 +225,7 @@
<div class='col-sm-2'>
<div class='input-group'>
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-hdd"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'image_max_size',
'id' => 'image_max_size',
'class' => 'form-control input-sm required',
@@ -240,8 +241,8 @@
</div>
<div class='col-sm-4'>
<div class='input-group'>
<span class="input-group-addon input-sm"><?php echo lang('Config.image_allowed_file_types') ?></span>
<?php echo form_multiselect([
<span class="input-group-addon input-sm"><?= lang('Config.image_allowed_file_types') ?></span>
<?= form_multiselect([
'name' => 'image_allowed_types',
'options' => $image_allowed_types,
'selected' => $selected_image_allowed_types,
@@ -259,9 +260,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.gcaptcha_enable'), 'gcaptcha_enable', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.gcaptcha_enable'), 'gcaptcha_enable', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'gcaptcha_enable',
'id' => 'gcaptcha_enable',
'value' => 'gcaptcha_enable',
@@ -269,16 +270,16 @@
]) ?>
<label class="control-label">
<a href="https://www.google.com/recaptcha/admin" target="_blank">
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.gcaptcha_tooltip') ?>"></span>
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.gcaptcha_tooltip') ?>"></span>
</a>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.gcaptcha_site_key'), 'config_gcaptcha_site_key', ['class' => 'required control-label col-xs-2','id' => 'config_gcaptcha_site_key']) ?>
<?= form_label(lang('Config.gcaptcha_site_key'), 'config_gcaptcha_site_key', ['class' => 'required control-label col-xs-2','id' => 'config_gcaptcha_site_key']) ?>
<div class='col-xs-4'>
<?php echo form_input ([
<?= form_input ([
'name' => 'gcaptcha_site_key',
'id' => 'gcaptcha_site_key',
'class' => 'form-control input-sm required',
@@ -288,9 +289,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.gcaptcha_secret_key'), 'config_gcaptcha_secret_key', ['class' => 'required control-label col-xs-2','id' => 'config_gcaptcha_secret_key']) ?>
<?= form_label(lang('Config.gcaptcha_secret_key'), 'config_gcaptcha_secret_key', ['class' => 'required control-label col-xs-2','id' => 'config_gcaptcha_secret_key']) ?>
<div class='col-xs-4'>
<?php echo form_input ([
<?= form_input ([
'name' => 'gcaptcha_secret_key',
'id' => 'gcaptcha_secret_key',
'class' => 'form-control input-sm required',
@@ -300,13 +301,13 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.suggestions_layout'), 'suggestions_layout', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.suggestions_layout'), 'suggestions_layout', ['class' => 'control-label col-xs-2']) ?>
<div class="col-sm-10">
<div class="form-group form-group-sm row">
<div class='col-sm-3'>
<div class='input-group'>
<span class="input-group-addon input-sm"><?php echo lang('Config.suggestions_first_column') ?></span>
<?php echo form_dropdown(
<span class="input-group-addon input-sm"><?= lang('Config.suggestions_first_column') ?></span>
<?= form_dropdown(
'suggestions_first_column',
[
'name' => lang('Items.name'),
@@ -321,8 +322,8 @@
</div>
<div class='col-sm-3'>
<div class='input-group'>
<span class="input-group-addon input-sm"><?php echo lang('Config.suggestions_second_column') ?></span>
<?php echo form_dropdown(
<span class="input-group-addon input-sm"><?= lang('Config.suggestions_second_column') ?></span>
<?= form_dropdown(
'suggestions_second_column',
[
'' => lang('Config.none'),
@@ -338,8 +339,8 @@
</div>
<div class='col-sm-3'>
<div class='input-group'>
<span class="input-group-addon input-sm"><?php echo lang('Config.suggestions_third_column') ?></span>
<?php echo form_dropdown(
<span class="input-group-addon input-sm"><?= lang('Config.suggestions_third_column') ?></span>
<?= form_dropdown(
'suggestions_third_column',
[
'' => lang('Config.none'),
@@ -358,29 +359,29 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.giftcard_number'), 'giftcard_number', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.giftcard_number'), 'giftcard_number', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-8'>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'giftcard_number',
'value' => 'series',
'checked' => $config['giftcard_number'] == 'series']) ?>
<?php echo lang('Config.giftcard_series') ?>
<?= lang('Config.giftcard_series') ?>
</label>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'giftcard_number',
'value' => 'random',
'checked' => $config['giftcard_number'] == 'random']) ?>
<?php echo lang('Config.giftcard_random') ?>
<?= lang('Config.giftcard_random') ?>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.derive_sale_quantity'), 'derive_sale_quantity', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.derive_sale_quantity'), 'derive_sale_quantity', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'derive_sale_quantity',
'id' => 'derive_sale_quantity',
'value' => 'derive_sale_quantity',
@@ -388,15 +389,15 @@
]) ?>
&nbsp
<label class="control-label">
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.derive_sale_quantity_tooltip') ?>"></span>
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.derive_sale_quantity_tooltip') ?>"></span>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.show_office_group'), 'show_office_group', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.show_office_group'), 'show_office_group', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'show_office_group',
'id' => 'show_office_group',
'value' => 'show_office_group',
@@ -406,9 +407,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.multi_pack_enabled'), 'multi_pack_enabled', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.multi_pack_enabled'), 'multi_pack_enabled', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'multi_pack_enabled',
'id' => 'multi_pack_enabled',
'value' => 'multi_pack_enabled',
@@ -418,9 +419,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.include_hsn'), 'include_hsn', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.include_hsn'), 'include_hsn', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'include_hsn',
'id' => 'include_hsn',
'value' => 'include_hsn',
@@ -430,9 +431,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.category_dropdown'), 'category_dropdown', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.category_dropdown'), 'category_dropdown', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'category_dropdown',
'id' => 'category_dropdown',
'value' => 'category_dropdown',
@@ -441,14 +442,14 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_general',
'id' => 'submit_general',
'value' => lang('Common.submit'),
'class' => 'btn btn-primary btn-sm pull-right']) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
@@ -502,21 +503,21 @@ $(document).ready(function()
{
default_sales_discount:
{
required: "<?php echo lang('Config.default_sales_discount_required') ?>",
number: "<?php echo lang('Config.default_sales_discount_number') ?>"
required: "<?= lang('Config.default_sales_discount_required') ?>",
number: "<?= lang('Config.default_sales_discount_number') ?>"
},
lines_per_page:
{
required: "<?php echo lang('Config.lines_per_page_required') ?>",
number: "<?php echo lang('Config.lines_per_page_number') ?>"
required: "<?= lang('Config.lines_per_page_required') ?>",
number: "<?= lang('Config.lines_per_page_number') ?>"
},
gcaptcha_site_key:
{
required: "<?php echo lang('Config.gcaptcha_site_key_required') ?>"
required: "<?= lang('Config.gcaptcha_site_key_required') ?>"
},
gcaptcha_secret_key:
{
required: "<?php echo lang('Config.gcaptcha_secret_key_required') ?>"
required: "<?= lang('Config.gcaptcha_secret_key_required') ?>"
}
},

View File

@@ -5,18 +5,18 @@
* @var array $config
*/
?>
<?php echo form_open('config/saveInfo/', ['id' => 'info_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?= form_open('config/saveInfo/', ['id' => 'info_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="info_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.company'), 'company', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.company'), 'company', ['class' => 'control-label col-xs-2 required']) ?>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-home"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'company',
'id' => 'company',
'class' => 'form-control input-sm required',
@@ -27,31 +27,31 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.company_logo'), 'company_logo', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.company_logo'), 'company_logo', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-6'>
<div class="fileinput <?php echo $logo_exists ? 'fileinput-exists' : 'fileinput-new' ?>" data-provides="fileinput">
<div class="fileinput <?= $logo_exists ? 'fileinput-exists' : 'fileinput-new' ?>" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 200px; height: 200px;"></div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;">
<img data-src="holder.js/100%x100%" alt="<?php echo lang('Config.company_logo') ?>"
<img data-src="holder.js/100%x100%" alt="<?= lang('Config.company_logo') ?>"
src="<?php if($logo_exists) echo base_url('uploads/' . $config['company_logo']); else echo '' ?>"
style="max-height: 100%; max-width: 100%;">
</div>
<div>
<span class="btn btn-default btn-sm btn-file">
<span class="fileinput-new"><?php echo lang('Config.company_select_image') ?></span>
<span class="fileinput-exists"><?php echo lang('Config.company_change_image') ?></span>
<span class="fileinput-new"><?= lang('Config.company_select_image') ?></span>
<span class="fileinput-exists"><?= lang('Config.company_change_image') ?></span>
<input type="file" name="company_logo">
</span>
<a href="#" class="btn btn-default btn-sm fileinput-exists" data-dismiss="fileinput"><?php echo lang('Config.company_remove_image') ?></a>
<a href="#" class="btn btn-default btn-sm fileinput-exists" data-dismiss="fileinput"><?= lang('Config.company_remove_image') ?></a>
</div>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.address'), 'address', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.address'), 'address', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-6'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'address',
'id' => 'address',
'class' => 'form-control input-sm required',
@@ -61,11 +61,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.website'), 'website', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.website'), 'website', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-globe"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'website',
'id' => 'website',
'class' => 'form-control input-sm',
@@ -76,11 +76,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Common.email'), 'email', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Common.email'), 'email', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-envelope"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'email',
'id' => 'email',
'type' => 'email',
@@ -92,11 +92,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.phone'), 'phone', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.phone'), 'phone', ['class' => 'control-label col-xs-2 required']) ?>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-phone-alt"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'phone',
'id' => 'phone',
'class' => 'form-control input-sm required',
@@ -107,11 +107,11 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.fax'), 'fax', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.fax'), 'fax', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-phone-alt"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'fax',
'id' => 'fax',
'class' => 'form-control input-sm',
@@ -122,9 +122,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Common.return_policy'), 'return_policy', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Common.return_policy'), 'return_policy', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-6'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'return_policy',
'id' => 'return_policy',
'class' => 'form-control input-sm required',
@@ -133,14 +133,14 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_info',
'id' => 'submit_info',
'value' => lang('Common.submit'),
'class' => 'btn btn-primary btn-sm pull-right']) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
@@ -149,7 +149,7 @@ $(document).ready(function()
$("a.fileinput-exists").click(function() {
$.ajax({
type: 'POST',
url: '<?php echo "$controller_name/remove_logo"; ?>',
url: '<?= "$controller_name/remove_logo"; ?>',
dataType: 'json'
})
});
@@ -169,11 +169,11 @@ $(document).ready(function()
messages:
{
company: "<?php echo lang('Config.company_required') ?>",
address: "<?php echo lang('Config.address_required') ?>",
phone: "<?php echo lang('Config.phone_required') ?>",
email: "<?php echo lang('Common.email_invalid_format') ?>",
return_policy: "<?php echo lang('Config.return_policy_required') ?>"
company: "<?= lang('Config.company_required') ?>",
address: "<?= lang('Config.address_required') ?>",
phone: "<?= lang('Config.phone_required') ?>",
email: "<?= lang('Common.email_invalid_format') ?>",
return_policy: "<?= lang('Config.return_policy_required') ?>"
}
}));
});

View File

@@ -4,19 +4,19 @@
* @var string $controller_name
*/
?>
<?php echo form_open('config/saveMailchimp/', ['id' => 'mailchimp_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?= form_open('config/saveMailchimp/', ['id' => 'mailchimp_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="integrations_header"><?php echo lang('Config.mailchimp_configuration') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<div id="integrations_header"><?= lang('Config.mailchimp_configuration') ?></div>
<ul id="mailchimp_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.mailchimp_api_key'), 'mailchimp_api_key', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.mailchimp_api_key'), 'mailchimp_api_key', ['class' => 'control-label col-xs-2']) ?>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-cloud"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'mailchimp_api_key',
'id' => 'mailchimp_api_key',
'class' => 'form-control input-sm',
@@ -26,17 +26,17 @@
</div>
<div class="col-xs-1">
<label class="control-label">
<a href="http://eepurl.com/b9a05b" target="_blank"><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.mailchimp_tooltip') //TODO: Possibly need to change the URL here to HTTPS? ?>"></span></a>
<a href="http://eepurl.com/b9a05b" target="_blank"><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.mailchimp_tooltip') //TODO: Possibly need to change the URL here to HTTPS? ?>"></span></a>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.mailchimp_lists'), 'mailchimp_list_id', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.mailchimp_lists'), 'mailchimp_list_id', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-4'>
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-user"></span></span>
<?php echo form_dropdown(
<?= form_dropdown(
'mailchimp_list_id',
$mailchimp['lists'],
$mailchimp['list_id'],
@@ -46,7 +46,7 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_mailchimp',
'id' => 'submit_mailchimp',
'value' => lang('Common.submit'),
@@ -54,7 +54,7 @@
]) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling

View File

@@ -2,18 +2,19 @@
/**
* @var array $invoice_type_options
* @var array $line_sequence_options
* @var array $config
*/
?>
<?php echo form_open('config/saveInvoice/', ['id' => 'invoice_config_form', 'class' => 'form-horizontal']) ?>
<?= form_open('config/saveInvoice/', ['id' => 'invoice_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="invoice_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.invoice_enable'), 'invoice_enable', ['class' => 'control-label col-xs-2']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.invoice_enable'), 'invoice_enable', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'invoice_enable',
'value' => 'invoice_enable',
'id' => 'invoice_enable',
@@ -23,9 +24,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.invoice_type'), 'invoice_type', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.invoice_type'), 'invoice_type', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-3'>
<?php echo form_dropdown(
<?= form_dropdown(
'invoice_type',
$invoice_type_options,
$config['invoice_type'],
@@ -35,9 +36,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.recv_invoice_format'), 'recv_invoice_format', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.recv_invoice_format'), 'recv_invoice_format', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'name' => 'recv_invoice_format',
'id' => 'recv_invoice_format',
'class' => 'form-control input-sm',
@@ -46,10 +47,10 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.invoice_default_comments'), 'invoice_default_comments', ['class' => 'control-label col-xs-2']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.invoice_default_comments'), 'invoice_default_comments', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-5'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'invoice_default_comments',
'id' => 'invoice_default_comments',
'class' => 'form-control input-sm',
@@ -58,10 +59,10 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.invoice_email_message'), 'invoice_email_message', ['class' => 'control-label col-xs-2']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.invoice_email_message'), 'invoice_email_message', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-5'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'invoice_email_message',
'id' => 'invoice_email_message',
'class' => 'form-control input-sm',
@@ -71,9 +72,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.line_sequence'), 'line_sequence', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.line_sequence'), 'line_sequence', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'line_sequence',
$line_sequence_options,
$config['line_sequence'],
@@ -83,9 +84,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.sales_invoice_format'), 'sales_invoice_format', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.sales_invoice_format'), 'sales_invoice_format', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'name' => 'sales_invoice_format',
'id' => 'sales_invoice_format',
'class' => 'form-control input-sm',
@@ -95,9 +96,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.last_used_invoice_number'), 'last_used_invoice_number', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.last_used_invoice_number'), 'last_used_invoice_number', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'name' => 'last_used_invoice_number',
'id' => 'last_used_invoice_number',
@@ -108,9 +109,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.sales_quote_format'), 'sales_quote_format', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.sales_quote_format'), 'sales_quote_format', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'name' => 'sales_quote_format',
'id' => 'sales_quote_format',
'class' => 'form-control input-sm',
@@ -120,9 +121,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.last_used_quote_number'), 'last_used_quote_number', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.last_used_quote_number'), 'last_used_quote_number', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'name' => 'last_used_quote_number',
'id' => 'last_used_quote_number',
@@ -133,9 +134,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.quote_default_comments'), 'quote_default_comments', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.quote_default_comments'), 'quote_default_comments', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-5'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'quote_default_comments',
'id' => 'quote_default_comments',
'class' => 'form-control input-sm',
@@ -145,9 +146,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.work_order_enable'), 'work_order_enable', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.work_order_enable'), 'work_order_enable', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'work_order_enable',
'value' => 'work_order_enable',
'id' => 'work_order_enable',
@@ -157,9 +158,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.work_order_format'), 'work_order_format', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.work_order_format'), 'work_order_format', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'name' => 'work_order_format',
'id' => 'work_order_format',
'class' => 'form-control input-sm',
@@ -169,9 +170,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.last_used_work_order_number'), 'last_used_work_order_number', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.last_used_work_order_number'), 'last_used_work_order_number', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'name' => 'last_used_work_order_number',
'id' => 'last_used_work_order_number',
@@ -181,14 +182,14 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_invoice',
'id' => 'submit_invoice',
'value' => lang('Common.submit'),
'class' => 'btn btn-primary btn-sm pull-right']) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling

View File

@@ -3,7 +3,7 @@
* @var array $licenses
*/
?>
<?php echo form_open('', ['id' => 'license_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?= form_open('', ['id' => 'license_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset>
<?php
@@ -12,9 +12,9 @@
{
?>
<div class="form-group form-group-sm">
<?php echo form_label($license['title'], 'license', ['class' => 'control-label col-xs-3']) ?>
<?= form_label($license['title'], 'license', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-6'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'license',
'id' => 'license_' . $counter++, //TODO: String Interpolation
'class' => 'form-control',
@@ -28,4 +28,4 @@
?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>

View File

@@ -3,25 +3,26 @@
* @var string $currency_code
* @var array $rounding_options
* @var string $controller_name
* @var array $config
*/
?>
<?php echo form_open('config/saveLocale/', ['id' => 'locale_config_form', 'class' => 'form-horizontal']) ?>
<?= form_open('config/saveLocale/', ['id' => 'locale_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="locale_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.number_locale'), 'number_locale', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.number_locale'), 'number_locale', ['class' => 'control-label col-xs-2']) ?>
<div class='row'>
<div class='col-xs-1'>
<?php echo form_input([
<?= form_input([
'name' => 'number_locale',
'value' => $config['number_locale'],
'extra' => "class='form-control input-sm' id='number_locale'"
]) ?>
<?php echo form_hidden([
<?= form_hidden([
'name' => 'save_number_locale',
'value' => $config['number_locale']
]) ?>
@@ -29,10 +30,10 @@
<div class="col-xs-2">
<label class="control-label">
<a href="https://github.com/opensourcepos/opensourcepos/wiki/Localisation-support" target="_blank">
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.number_locale_tooltip') ?>"></span>
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.number_locale_tooltip') ?>"></span>
</a>
<span id="number_locale_example">
&nbsp&nbsp<?php echo to_currency(1234567890.12300) ?>
&nbsp&nbsp<?= to_currency(1234567890.12300) ?>
</span>
</label>
</div>
@@ -40,9 +41,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.thousands_separator'), 'thousands_separator', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.thousands_separator'), 'thousands_separator', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'thousands_separator',
'id' => 'thousands_separator',
'value' => 'thousands_separator',
@@ -52,9 +53,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.currency_symbol'), 'currency_symbol', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.currency_symbol'), 'currency_symbol', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_input ([
<?= form_input ([
'name' => 'currency_symbol',
'id' => 'currency_symbol',
'class' => 'form-control input-sm number_locale',
@@ -64,9 +65,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.currency_code'), 'currency_code', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.currency_code'), 'currency_code', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_input ([
<?= form_input ([
'name' => 'currency_code',
'id' => 'currency_code',
'class' => 'form-control input-sm number_locale',
@@ -74,11 +75,11 @@
]) ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.currency_decimals'), 'currency_decimals', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.currency_decimals'), 'currency_decimals', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'currency_decimals',
[
'0' => '0',
@@ -92,9 +93,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.tax_decimals'), 'tax_decimals', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.tax_decimals'), 'tax_decimals', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'tax_decimals',
[
'0' => '0',
@@ -110,9 +111,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.quantity_decimals'), 'quantity_decimals', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.quantity_decimals'), 'quantity_decimals', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'quantity_decimals',
[
'0' => '0',
@@ -127,9 +128,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.cash_decimals'), 'cash_decimals', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.cash_decimals'), 'cash_decimals', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'cash_decimals',
[
'-1' => '-1',
@@ -143,15 +144,15 @@
</div>
<div class='col-xs-1'>
<label class="control-label">
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.cash_decimals_tooltip') ?>"></span>
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.cash_decimals_tooltip') ?>"></span>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.cash_rounding'), 'cash_rounding_code', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.cash_rounding'), 'cash_rounding_code', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'cash_rounding_code',
$rounding_options,
$config['cash_rounding_code'],
@@ -161,9 +162,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.payment_options_order'), 'payment_options_order', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.payment_options_order'), 'payment_options_order', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-4'>
<?php echo form_dropdown(
<?= form_dropdown(
'payment_options_order',
[
'cashdebitcredit' => lang('Sales.cash') . ' / ' . lang('Sales.debit') . ' / ' . lang('Sales.credit'),
@@ -179,24 +180,24 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.country_codes'), 'country_codes', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.country_codes'), 'country_codes', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_input('country_codes', $config['country_codes'], ['class' => 'form-control input-sm']) ?>
<?= form_input('country_codes', $config['country_codes'], ['class' => 'form-control input-sm']) ?>
</div>
<div class="col-xs-1">
<label class="control-label">
<a href="http://wiki.openstreetmap.org/wiki/Nominatim/Country_Codes" target="_blank"><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo lang('Config.country_codes_tooltip'); //TODO: May need to change the URL at the beginning to HTTPS?>"></span></a>
<a href="http://wiki.openstreetmap.org/wiki/Nominatim/Country_Codes" target="_blank"><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?= lang('Config.country_codes_tooltip'); //TODO: May need to change the URL at the beginning to HTTPS?>"></span></a>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.language'), 'language', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.language'), 'language', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-4'>
<?php echo form_dropdown(
<?= form_dropdown(
'language',
get_languages(),
current_language_code(TRUE) . ':' . current_language(TRUE),
current_language_code(true) . ':' . current_language(true),
array('class' => 'form-control input-sm')
)
?>
@@ -204,9 +205,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.timezone'), 'timezone', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.timezone'), 'timezone', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-4'>
<?php echo form_dropdown(
<?= form_dropdown(
'timezone',
get_timezones(),
$config['timezone'] ? $config['timezone'] : date_default_timezone_get(),
@@ -216,9 +217,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.datetimeformat'), 'datetimeformat', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.datetimeformat'), 'datetimeformat', ['class' => 'control-label col-xs-2']) ?>
<div class='col-sm-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'dateformat',
get_dateformats(),
$config['dateformat'],
@@ -226,7 +227,7 @@
) ?>
</div>
<div class='col-sm-2'>
<?php echo form_dropdown('timeformat',
<?= form_dropdown('timeformat',
get_timeformats(),
$config['timeformat'], ['class' => 'form-control input-sm']
) ?>
@@ -234,9 +235,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.date_or_time_format'), 'date_or_time_format', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.date_or_time_format'), 'date_or_time_format', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'date_or_time_format',
'id' => 'date_or_time_format',
'value' => 'date_or_time_format',
@@ -246,9 +247,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.financial_year'), 'financial_year', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.financial_year'), 'financial_year', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'financial_year',
[
'1' => lang('Config.financial_year_jan'),
@@ -269,14 +270,14 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_locale',
'id' => 'submit_locale',
'value' => lang('Common.submit'),
'class' => 'btn btn-primary btn-sm pull-right']) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
@@ -334,8 +335,8 @@ $(document).ready(function()
messages:
{
number_locale: {
required: "<?php echo lang('Config.number_locale_required') ?>",
number_locale: "<?php echo lang('Config.number_locale_invalid') ?>"
required: "<?= lang('Config.number_locale_required') ?>",
number_locale: "<?= lang('Config.number_locale_invalid') ?>"
}
},

View File

@@ -1,4 +1,4 @@
<?php echo view('partial/header') ?>
<?= view('partial/header') ?>
<script type="text/javascript">
dialog_support.init("a.modal-dlg");
@@ -6,74 +6,74 @@
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active" role="presentation">
<a data-toggle="tab" href="#info_tab" title="<?php echo lang('Config.info_configuration') ?>"><?php echo lang('Config.info') ?></a>
<a data-toggle="tab" href="#info_tab" title="<?= lang('Config.info_configuration') ?>"><?= lang('Config.info') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#general_tab" title="<?php echo lang('Config.general_configuration') ?>"><?php echo lang('Config.general') ?></a>
<a data-toggle="tab" href="#general_tab" title="<?= lang('Config.general_configuration') ?>"><?= lang('Config.general') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#tax_tab" title="<?php echo lang('Config.tax_configuration') ?>"><?php echo lang('Config.tax') ?></a>
<a data-toggle="tab" href="#tax_tab" title="<?= lang('Config.tax_configuration') ?>"><?= lang('Config.tax') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#locale_tab" title="<?php echo lang('Config.locale_configuration') ?>"><?php echo lang('Config.locale') ?></a>
<a data-toggle="tab" href="#locale_tab" title="<?= lang('Config.locale_configuration') ?>"><?= lang('Config.locale') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#barcode_tab" title="<?php echo lang('Config.barcode_configuration') ?>"><?php echo lang('Config.barcode') ?></a>
<a data-toggle="tab" href="#barcode_tab" title="<?= lang('Config.barcode_configuration') ?>"><?= lang('Config.barcode') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#stock_tab" title="<?php echo lang('Config.location_configuration') ?>"><?php echo lang('Config.location') ?></a>
<a data-toggle="tab" href="#stock_tab" title="<?= lang('Config.location_configuration') ?>"><?= lang('Config.location') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#receipt_tab" title="<?php echo lang('Config.receipt_configuration') ?>"><?php echo lang('Config.receipt') ?></a>
<a data-toggle="tab" href="#receipt_tab" title="<?= lang('Config.receipt_configuration') ?>"><?= lang('Config.receipt') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#invoice_tab" title="<?php echo lang('Config.invoice_configuration') ?>"><?php echo lang('Config.invoice') ?></a>
<a data-toggle="tab" href="#invoice_tab" title="<?= lang('Config.invoice_configuration') ?>"><?= lang('Config.invoice') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#reward_tab" title="<?php echo lang('Config.reward_configuration') ?>"><?php echo lang('Config.reward') ?></a>
<a data-toggle="tab" href="#reward_tab" title="<?= lang('Config.reward_configuration') ?>"><?= lang('Config.reward') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#table_tab" title="<?php echo lang('Config.table_configuration') ?>"><?php echo lang('Config.table') ?></a>
<a data-toggle="tab" href="#table_tab" title="<?= lang('Config.table_configuration') ?>"><?= lang('Config.table') ?></a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#system_tab" title="<?php echo lang('Config.system_conf') ?>"><?php echo lang('Config.system_conf') ?></a>
<a data-toggle="tab" href="#system_tab" title="<?= lang('Config.system_conf') ?>"><?= lang('Config.system_conf') ?></a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="info_tab">
<?php echo view('configs/info_config') ?>
<?= view('configs/info_config') ?>
</div>
<div class="tab-pane" id="general_tab">
<?php echo view('configs/general_config') ?>
<?= view('configs/general_config') ?>
</div>
<div class="tab-pane" id="tax_tab">
<?php echo view('configs/tax_config') ?>
<?= view('configs/tax_config') ?>
</div>
<div class="tab-pane" id="locale_tab">
<?php echo view('configs/locale_config') ?>
<?= view('configs/locale_config') ?>
</div>
<div class="tab-pane" id="barcode_tab">
<?php echo view('configs/barcode_config') ?>
<?= view('configs/barcode_config') ?>
</div>
<div class="tab-pane" id="stock_tab">
<?php echo view('configs/stock_config') ?>
<?= view('configs/stock_config') ?>
</div>
<div class="tab-pane" id="receipt_tab">
<?php echo view('configs/receipt_config') ?>
<?= view('configs/receipt_config') ?>
</div>
<div class="tab-pane" id="invoice_tab">
<?php echo view('configs/invoice_config') ?>
<?= view('configs/invoice_config') ?>
</div>
<div class="tab-pane" id="reward_tab">
<?php echo view('configs/reward_config') ?>
<?= view('configs/reward_config') ?>
</div>
<div class="tab-pane" id="table_tab">
<?php echo view('configs/table_config') ?>
<?= view('configs/table_config') ?>
</div>
<div class="tab-pane" id="system_tab">
<?php echo view('configs/system_config') ?>
<?= view('configs/system_config') ?>
</div>
</div>
<?php echo view('partial/footer') ?>
<?= view('partial/footer') ?>

View File

@@ -1,15 +1,20 @@
<?php echo form_open('config/saveMessage/', ['id' => 'message_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php
/**
* @var array $config
*/
?>
<?= form_open('config/saveMessage/', ['id' => 'message_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="message_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.msg_uid'), 'msg_uid', ['class' => 'control-label col-xs-2 required']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.msg_uid'), 'msg_uid', ['class' => 'control-label col-xs-2 required']) ?>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-user"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'msg_uid',
'id' => 'msg_uid',
'class' => 'form-control input-sm required',
@@ -19,12 +24,12 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.msg_pwd'), 'msg_pwd', ['class' => 'control-label col-xs-2 required']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.msg_pwd'), 'msg_pwd', ['class' => 'control-label col-xs-2 required']) ?>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-lock"></span></span>
<?php echo form_password ([
<?= form_password ([
'name' => 'msg_pwd',
'id' => 'msg_pwd',
'class' => 'form-control input-sm required',
@@ -33,26 +38,26 @@
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.msg_src'), 'msg_src', ['class' => 'control-label col-xs-2 required']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.msg_src'), 'msg_src', ['class' => 'control-label col-xs-2 required']) ?>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-bullhorn"></span></span>
<?php echo form_input ([
<?= form_input ([
'name' => 'msg_src',
'id' => 'msg_src',
'class' => 'form-control input-sm required',
'value' => $config['msg_src'] == NULL ? $config['company'] : $config['msg_src']
'value' => $config['msg_src'] == null ? $config['company'] : $config['msg_src']
]) ?>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.msg_msg'), 'msg_msg', ['class' => 'control-label col-xs-2']) ?>
<div class="form-group form-group-sm">
<?= form_label(lang('Config.msg_msg'), 'msg_msg', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-4'>
<?php echo form_textarea ([
<?= form_textarea ([
'name' => 'msg_msg',
'id' => 'msg_msg',
'class' => 'form-control input-sm',
@@ -62,7 +67,7 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_message',
'id' => 'submit_message',
'value' => lang('Common.submit'),
@@ -70,7 +75,7 @@
]) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
@@ -80,18 +85,18 @@ $(document).ready(function()
errorLabelContainer: "#message_error_message_box",
rules:
rules:
{
msg_uid: "required",
msg_pwd: "required",
msg_src: "required"
},
messages:
messages:
{
msg_uid: "<?php echo lang('Config.msg_uid_required') ?>",
msg_pwd: "<?php echo lang('Config.msg_pwd_required') ?>",
msg_src: "<?php echo lang('Config.msg_src_required') ?>"
msg_uid: "<?= lang('Config.msg_uid_required') ?>",
msg_pwd: "<?= lang('Config.msg_pwd_required') ?>",
msg_src: "<?= lang('Config.msg_src_required') ?>"
}
}));
});

View File

@@ -1,13 +1,18 @@
<?php echo form_open('config/saveReceipt/', ['id' => 'receipt_config_form', 'class' => 'form-horizontal']) ?>
<?php
/**
* @var array $config
*/
?>
<?= form_open('config/saveReceipt/', ['id' => 'receipt_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
<ul id="receipt_error_message_box" class="error_message_box"></ul>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_template'), 'receipt_template', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_template'), 'receipt_template', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown(
<?= form_dropdown(
'receipt_template',
[
'receipt_default' => lang('Config.receipt_default'),
@@ -20,10 +25,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_font_size'), 'receipt_font_size', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.receipt_font_size'), 'receipt_font_size', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '0',
'max' => '20',
@@ -38,10 +43,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_delay_autoreturn'), 'print_delay_autoreturn', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.print_delay_autoreturn'), 'print_delay_autoreturn', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '0',
'max' => '30',
@@ -56,69 +61,69 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.email_receipt_check_behaviour'), 'email_receipt_check_behaviour', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.email_receipt_check_behaviour'), 'email_receipt_check_behaviour', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-8'>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'email_receipt_check_behaviour',
'value' => 'always',
'checked' => $config['email_receipt_check_behaviour'] == 'always'
]) ?>
<?php echo lang('Config.email_receipt_check_behaviour_always') ?>
<?= lang('Config.email_receipt_check_behaviour_always') ?>
</label>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'email_receipt_check_behaviour',
'value' => 'never',
'checked' => $config['email_receipt_check_behaviour'] == 'never'
]) ?>
<?php echo lang('Config.email_receipt_check_behaviour_never') ?>
<?= lang('Config.email_receipt_check_behaviour_never') ?>
</label>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'email_receipt_check_behaviour',
'value' => 'last',
'checked' => $config['email_receipt_check_behaviour'] == 'last'
]) ?>
<?php echo lang('Config.email_receipt_check_behaviour_last') ?>
<?= lang('Config.email_receipt_check_behaviour_last') ?>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_receipt_check_behaviour'), 'print_receipt_check_behaviour', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.print_receipt_check_behaviour'), 'print_receipt_check_behaviour', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-8'>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'print_receipt_check_behaviour',
'value' => 'always',
'checked' => $config['print_receipt_check_behaviour'] == 'always'
]) ?>
<?php echo lang('Config.print_receipt_check_behaviour_always') ?>
<?= lang('Config.print_receipt_check_behaviour_always') ?>
</label>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'print_receipt_check_behaviour',
'value' => 'never',
'checked' => $config['print_receipt_check_behaviour'] == 'never'
]) ?>
<?php echo lang('Config.print_receipt_check_behaviour_never') ?>
<?= lang('Config.print_receipt_check_behaviour_never') ?>
</label>
<label class="radio-inline">
<?php echo form_radio ([
<?= form_radio ([
'name' => 'print_receipt_check_behaviour',
'value' => 'last',
'checked' => $config['print_receipt_check_behaviour'] == 'last'
]) ?>
<?php echo lang('Config.print_receipt_check_behaviour_last') ?>
<?= lang('Config.print_receipt_check_behaviour_last') ?>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_show_company_name'), 'receipt_show_company_name', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_show_company_name'), 'receipt_show_company_name', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receipt_show_company_name',
'value' => 'receipt_show_company_name',
'id' => 'receipt_show_company_name',
@@ -128,9 +133,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_show_taxes'), 'receipt_show_taxes', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_show_taxes'), 'receipt_show_taxes', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receipt_show_taxes',
'value' => 'receipt_show_taxes',
'id' => 'receipt_show_taxes',
@@ -140,9 +145,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_show_tax_ind'), 'receipt_show_tax_ind', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_show_tax_ind'), 'receipt_show_tax_ind', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receipt_show_tax_ind',
'value' => 'receipt_show_tax_ind',
'id' => 'receipt_show_tax_ind',
@@ -152,9 +157,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_show_total_discount'), 'receipt_show_total_discount', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_show_total_discount'), 'receipt_show_total_discount', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receipt_show_total_discount',
'value' => 'receipt_show_total_discount',
'id' => 'receipt_show_total_discount',
@@ -164,9 +169,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_show_description'), 'receipt_show_description', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_show_description'), 'receipt_show_description', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receipt_show_description',
'value' => 'receipt_show_description',
'id' => 'receipt_show_description',
@@ -176,9 +181,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_show_serialnumber'), 'receipt_show_serialnumber', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_show_serialnumber'), 'receipt_show_serialnumber', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'receipt_show_serialnumber',
'value' => 'receipt_show_serialnumber',
'id' => 'receipt_show_serialnumber',
@@ -188,9 +193,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_silently'), 'print_silently', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.print_silently'), 'print_silently', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'print_silently',
'id' => 'print_silently',
'value' => 'print_silently',
@@ -200,9 +205,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_header'), 'print_header', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.print_header'), 'print_header', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'print_header',
'id' => 'print_header',
'value' => 'print_header',
@@ -212,9 +217,9 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_footer'), 'print_footer', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.print_footer'), 'print_footer', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-1'>
<?php echo form_checkbox ([
<?= form_checkbox ([
'name' => 'print_footer',
'id' => 'print_footer',
'value' => 'print_footer',
@@ -224,31 +229,31 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.receipt_printer'), 'config_receipt_printer', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.receipt_printer'), 'config_receipt_printer', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown('receipt_printer', array(), ' ', 'id="receipt_printer" class="form-control"') ?>
<?= form_dropdown('receipt_printer', array(), ' ', 'id="receipt_printer" class="form-control"') ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.invoice_printer'), 'config_invoice_printer', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.invoice_printer'), 'config_invoice_printer', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown('invoice_printer', [], ' ', 'id="invoice_printer" class="form-control"') ?>
<?= form_dropdown('invoice_printer', [], ' ', 'id="invoice_printer" class="form-control"') ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.takings_printer'), 'config_takings_printer', ['class' => 'control-label col-xs-2']) ?>
<?= form_label(lang('Config.takings_printer'), 'config_takings_printer', ['class' => 'control-label col-xs-2']) ?>
<div class='col-xs-2'>
<?php echo form_dropdown('takings_printer', [], ' ', 'id="takings_printer" class="form-control"') ?>
<?= form_dropdown('takings_printer', [], ' ', 'id="takings_printer" class="form-control"') ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_top_margin'), 'print_top_margin', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.print_top_margin'), 'print_top_margin', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '0',
'max' => '20',
@@ -263,10 +268,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_left_margin'), 'print_left_margin', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.print_left_margin'), 'print_left_margin', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '0',
'max' => '20',
@@ -281,10 +286,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_bottom_margin'), 'print_bottom_margin', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.print_bottom_margin'), 'print_bottom_margin', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '0',
'max' => '20',
@@ -299,10 +304,10 @@
</div>
<div class="form-group form-group-sm">
<?php echo form_label(lang('Config.print_right_margin'), 'print_right_margin', ['class' => 'control-label col-xs-2 required']) ?>
<?= form_label(lang('Config.print_right_margin'), 'print_right_margin', ['class' => 'control-label col-xs-2 required']) ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input ([
<?= form_input ([
'type' => 'number',
'min' => '0',
'max' => '20',
@@ -316,7 +321,7 @@
</div>
</div>
<?php echo form_submit ([
<?= form_submit ([
'name' => 'submit_receipt',
'id' => 'submit_receipt',
'value' => lang('Common.submit'),
@@ -324,7 +329,7 @@
]) ?>
</fieldset>
</div>
<?php echo form_close() ?>
<?= form_close() ?>
<script type="text/javascript">
//validation and submit handling
@@ -362,7 +367,7 @@ $(document).ready(function()
submitHandler: function(form) {
$(form).ajaxSubmit({
beforeSerialize: function(arr, $form, options) {
return ( dialog_confirmed || confirm('<?php echo lang('Config.jsprintsetup_required') ?>') );
return ( dialog_confirmed || confirm('<?= lang('Config.jsprintsetup_required') ?>') );
},
success: function(response) {
$.notify( { message: response.message }, { type: response.success ? 'success' : 'danger'} )
@@ -411,33 +416,33 @@ $(document).ready(function()
{
print_top_margin:
{
required:"<?php echo lang('Config.print_top_margin_required') ?>",
number:"<?php echo lang('Config.print_top_margin_number') ?>"
required:"<?= lang('Config.print_top_margin_required') ?>",
number:"<?= lang('Config.print_top_margin_number') ?>"
},
print_left_margin:
{
required:"<?php echo lang('Config.print_left_margin_required') ?>",
number:"<?php echo lang('Config.print_left_margin_number') ?>"
required:"<?= lang('Config.print_left_margin_required') ?>",
number:"<?= lang('Config.print_left_margin_number') ?>"
},
print_bottom_margin:
{
required:"<?php echo lang('Config.print_bottom_margin_required') ?>",
number:"<?php echo lang('Config.print_bottom_margin_number') ?>"
required:"<?= lang('Config.print_bottom_margin_required') ?>",
number:"<?= lang('Config.print_bottom_margin_number') ?>"
},
print_right_margin:
{
required:"<?php echo lang('Config.print_right_margin_required') ?>",
number:"<?php echo lang('Config.print_right_margin_number') ?>"
required:"<?= lang('Config.print_right_margin_required') ?>",
number:"<?= lang('Config.print_right_margin_number') ?>"
},
receipt_font_size:
{
required:"<?php echo lang('Config.receipt_font_size_required') ?>",
number:"<?php echo lang('Config.receipt_font_size_number') ?>"
required:"<?= lang('Config.receipt_font_size_required') ?>",
number:"<?= lang('Config.receipt_font_size_number') ?>"
},
print_delay_autoreturn:
{
required:"<?php echo lang('Config.print_delay_autoreturn_required') ?>",
number:"<?php echo lang('Config.print_delay_autoreturn_number') ?>"
required:"<?= lang('Config.print_delay_autoreturn_required') ?>",
number:"<?= lang('Config.print_delay_autoreturn_number') ?>"
}
}
}));

Some files were not shown because too many files have changed in this diff Show More