mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2025-12-24 01:57:51 -05:00
Tack on the void return type onto the Employee:logout method.
This commit is contained in:
63
.env-example
Normal file
63
.env-example
Normal file
@@ -0,0 +1,63 @@
|
||||
#--------------------------------------------------------------------
|
||||
# ENVIRONMENT
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
CI_ENVIRONMENT = production
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# DATABASE
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
database.default.hostname = 'localhost'
|
||||
database.default.database = 'ospos'
|
||||
database.default.username = 'admin'
|
||||
database.default.password = 'pointofsale'
|
||||
database.default.DBDriver = 'MySQLi'
|
||||
database.default.DBPrefix = 'ospos_'
|
||||
|
||||
database.development.hostname = 'localhost'
|
||||
database.development.database = 'ospos'
|
||||
database.development.username = 'admin'
|
||||
database.development.password = 'pointofsale'
|
||||
database.development.DBDriver = 'MySQLi'
|
||||
database.development.DBPrefix = 'ospos_'
|
||||
|
||||
database.tests.hostname = 'localhost'
|
||||
database.tests.database = 'ospos'
|
||||
database.tests.username = 'admin'
|
||||
database.tests.password = 'pointofsale'
|
||||
database.tests.DBDriver = 'MySQLi'
|
||||
database.tests.DBPrefix = 'ospos_'
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# ENCRYPTION
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
encryption.key = ''
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# LOGGER
|
||||
# - 0 = Disables logging, Error logging TURNED OFF
|
||||
# - 1 = Emergency Messages - System is unusable
|
||||
# - 2 = Alert Messages - Action Must Be Taken Immediately
|
||||
# - 3 = Critical Messages - Application component unavailable, unexpected exception.
|
||||
# - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
|
||||
# - 5 = Warnings - Exceptional occurrences that are not errors.
|
||||
# - 6 = Notices - Normal but significant events.
|
||||
# - 7 = Info - Interesting events, like user logging in, etc.
|
||||
# - 8 = Debug - Detailed debug information.
|
||||
# - 9 = All Messages
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
logger.threshold = 0
|
||||
app.db_log_enabled = false
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# HONEYPOT
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
honeypot.hidden = true
|
||||
honeypot.label = 'Fill This Field'
|
||||
honeypot.name = 'honeypot'
|
||||
honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
|
||||
honeypot.container = '<div style="display:none">{template}</div>'
|
||||
@@ -72,10 +72,10 @@ module.exports = function(grunt) {
|
||||
},
|
||||
minjs: {
|
||||
options: {
|
||||
starttag: '<!-- minjs injector:css -->',
|
||||
starttag: '<!-- minjs injector:js -->',
|
||||
},
|
||||
files: {
|
||||
'app/Views/partial/header.php': [ospos_min_css]
|
||||
'app/Views/partial/header.php': [ospos_min_js]
|
||||
},
|
||||
},
|
||||
css_login: {
|
||||
@@ -126,7 +126,7 @@ module.exports = function(grunt) {
|
||||
concat: {
|
||||
js: {
|
||||
options: {
|
||||
separator: ';'
|
||||
separator: '\n'
|
||||
},
|
||||
files: {
|
||||
'tmp/opensourcepos.js': ['public/dist/jquery/jquery.js', 'tmp/opensourcepos_bower.js', 'public/js/*.js']
|
||||
|
||||
@@ -93,6 +93,10 @@ define('EVENT_PRIORITY_NORMAL', 100);
|
||||
*/
|
||||
define('EVENT_PRIORITY_HIGH', 10);
|
||||
|
||||
/**
|
||||
* Global Constants.
|
||||
*/
|
||||
const NEW_ENTRY = -1;
|
||||
|
||||
/**
|
||||
* Attribute Related Constants.
|
||||
|
||||
@@ -31,13 +31,13 @@ class Attributes extends Secure_Controller
|
||||
/**
|
||||
* Returns customer table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$attributes = $this->attribute->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->attribute->get_found_rows($search);
|
||||
@@ -55,7 +55,7 @@ class Attributes extends Secure_Controller
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function save_attribute_value(): void
|
||||
public function postSave_attribute_value(): void
|
||||
{
|
||||
$success = $this->attribute->save_value(
|
||||
$this->request->getPost('attribute_value', FILTER_SANITIZE_STRING),
|
||||
@@ -70,7 +70,7 @@ class Attributes extends Secure_Controller
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function delete_attribute_value(): void
|
||||
public function postDelete_attribute_value(): void
|
||||
{
|
||||
$success = $this->attribute->delete_value(
|
||||
$this->request->getPost('attribute_value', FILTER_SANITIZE_STRING),
|
||||
@@ -84,7 +84,7 @@ class Attributes extends Secure_Controller
|
||||
* @param int $definition_id
|
||||
* @return void
|
||||
*/
|
||||
public function save_definition(int $definition_id = NO_DEFINITION_ID): void
|
||||
public function postSave_definition(int $definition_id = NO_DEFINITION_ID): void
|
||||
{
|
||||
$definition_flags = 0;
|
||||
|
||||
@@ -144,7 +144,7 @@ class Attributes extends Secure_Controller
|
||||
echo json_encode([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Attributes.definition_error_adding_updating', ['definition_name' => $definition_name]),
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -155,12 +155,12 @@ class Attributes extends Secure_Controller
|
||||
*/
|
||||
public function suggest_attribute(int $definition_id): void
|
||||
{
|
||||
$suggestions = $this->attribute->get_suggestions($definition_id, $this->request->getGet('term', FILTER_SANITIZE_STRING));
|
||||
$suggestions = $this->attribute->get_suggestions($definition_id, $this->request->getVar('term', FILTER_SANITIZE_STRING));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$attribute_definition_info = $this->attribute->get_info($row_id);
|
||||
$attribute_definition_info->definition_flags = $this->get_attributes($attribute_definition_info->definition_flags);
|
||||
@@ -182,7 +182,7 @@ class Attributes extends Secure_Controller
|
||||
return $definition_flag_names;
|
||||
}
|
||||
|
||||
public function view(int $definition_id = NO_DEFINITION_ID): void
|
||||
public function getView(int $definition_id = NO_DEFINITION_ID): void
|
||||
{
|
||||
$info = $this->attribute->get_info($definition_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
@@ -204,12 +204,12 @@ class Attributes extends Secure_Controller
|
||||
echo view('attributes/form', $data);
|
||||
}
|
||||
|
||||
public function delete_value(int $attribute_id): bool //TODO: This function appears to never be used in the codebase. Is it needed?
|
||||
public function postDelete_value(int $attribute_id): bool //TODO: This function appears to never be used in the codebase. Is it needed?
|
||||
{
|
||||
return $this->attribute->delete_value($attribute_id, NO_DEFINITION_ID);
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$attributes_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
|
||||
@@ -35,21 +35,21 @@ class Cashups extends Secure_Controller
|
||||
echo view('cashups/manage', $data);
|
||||
}
|
||||
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
$filters = [
|
||||
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_STRING), //TODO: Is this the best way to filter dates
|
||||
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_STRING),
|
||||
'start_date' => $this->request->getVar('start_date', FILTER_SANITIZE_STRING), //TODO: Is this the best way to filter dates
|
||||
'end_date' => $this->request->getVar('end_date', FILTER_SANITIZE_STRING),
|
||||
'is_deleted' => FALSE
|
||||
];
|
||||
|
||||
// check if any filter is set in the multiselect dropdown
|
||||
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: $filledup doesn't follow variable naming patterns we are using.
|
||||
$filledup = array_fill_keys($this->request->getVar('filters', FILTER_SANITIZE_STRING), 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);
|
||||
@@ -62,7 +62,7 @@ class Cashups extends Secure_Controller
|
||||
echo json_encode(['total' => $total_rows, 'rows' => $data_rows]);
|
||||
}
|
||||
|
||||
public function view(int $cashup_id = -1): void //TODO: Need to replace -1 with a constant in constants.php
|
||||
public function getView(int $cashup_id = NEW_ENTRY): void
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@@ -178,7 +178,7 @@ class Cashups extends Secure_Controller
|
||||
echo view("cashups/form", $data);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$cash_ups_info = $this->cashup->get_info($row_id);
|
||||
$data_row = get_cash_up_data_row($cash_ups_info);
|
||||
@@ -186,7 +186,7 @@ class Cashups extends Secure_Controller
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function save(int $cashup_id = -1): void //TODO: Need to replace -1 with a constant in constants.php
|
||||
public function postSave(int $cashup_id = NEW_ENTRY): void
|
||||
{
|
||||
$open_date = $this->request->getPost('open_date', FILTER_SANITIZE_STRING);
|
||||
$open_date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $open_date);
|
||||
@@ -214,7 +214,7 @@ class Cashups extends Secure_Controller
|
||||
if($this->cashup->save_value($cash_up_data, $cashup_id))
|
||||
{
|
||||
//New cashup_id
|
||||
if($cashup_id == -1)//TODO: Need to replace -1 with a constant in constants.php
|
||||
if($cashup_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode(['success' => TRUE, 'message' => lang('Cashups.successful_adding'), 'id' => $cash_up_data['cashup_id']]);
|
||||
}
|
||||
@@ -225,11 +225,11 @@ class Cashups extends Secure_Controller
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(['success' => FALSE, 'message' => lang('Cashups.error_adding_updating'), 'id' => -1]);//TODO: Need to replace -1 with a constant in constants.php
|
||||
echo json_encode(['success' => FALSE, 'message' => lang('Cashups.error_adding_updating'), 'id' => NEW_ENTRY]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$cash_ups_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class Customers extends Persons
|
||||
{
|
||||
parent::__construct('customers');
|
||||
$this->mailchimp_lib = new Mailchimp_lib();
|
||||
|
||||
$this->customer_rewards = model('Customer_rewards');
|
||||
$this->customer = model('Customer');
|
||||
$this->tax_code = model('Tax_code');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
@@ -64,7 +64,7 @@ class Customers extends Persons
|
||||
/**
|
||||
* Gets one row for a customer manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$person = $this->customer->get_info($row_id);
|
||||
|
||||
@@ -91,7 +91,7 @@ class Customers extends Persons
|
||||
/*
|
||||
Returns customer table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch()
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
@@ -129,9 +129,9 @@ class Customers extends Persons
|
||||
/**
|
||||
* Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
public function suggest(): void
|
||||
public function getSuggest(): void
|
||||
{
|
||||
$suggestions = $this->customer->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), 25,TRUE);
|
||||
$suggestions = $this->customer->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), 25,TRUE);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -146,8 +146,11 @@ class Customers extends Persons
|
||||
/**
|
||||
* Loads the customer edit form
|
||||
*/
|
||||
public function view(int $customer_id = -1): void //TODO: replace -1 with a constant
|
||||
public function getView(int $customer_id = NEW_ENTRY): void
|
||||
{
|
||||
// Set default values
|
||||
if($customer_id == null) $customer_id = NEW_ENTRY;
|
||||
|
||||
$info = $this->customer->get_info($customer_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
{
|
||||
@@ -184,7 +187,7 @@ class Customers extends Persons
|
||||
$data['packages'] = $packages;
|
||||
$data['selected_package'] = $info->package_id;
|
||||
|
||||
if($$this->config['use_destination_based_tax']) //TODO: This can be shortened for ternary notation
|
||||
if($this->config['use_destination_based_tax']) //TODO: This can be shortened for ternary notation
|
||||
{
|
||||
$data['use_destination_based_tax'] = TRUE;
|
||||
}
|
||||
@@ -265,7 +268,7 @@ class Customers extends Persons
|
||||
/**
|
||||
* Inserts/updates a customer
|
||||
*/
|
||||
public function save(int $customer_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $customer_id = NEW_ENTRY): void
|
||||
{
|
||||
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_STRING);
|
||||
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_STRING);
|
||||
@@ -290,7 +293,7 @@ class Customers extends Persons
|
||||
'comments' => $this->request->getPost('comments', FILTER_SANITIZE_STRING)
|
||||
];
|
||||
|
||||
$date_formatter = date_create_from_format($$this->config['dateformat'] . ' ' . $$this->config['timeformat'], $this->request->getPost('date', FILTER_SANITIZE_STRING));
|
||||
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $this->request->getPost('date', FILTER_SANITIZE_STRING));
|
||||
|
||||
$customer_data = [
|
||||
'consent' => $this->request->getPost('consent') != NULL,
|
||||
@@ -309,17 +312,18 @@ class Customers extends Persons
|
||||
if($this->customer->save_customer($person_data, $customer_data, $customer_id))
|
||||
{
|
||||
// save customer to Mailchimp selected list //TODO: addOrUpdateMember should be refactored... potentially pass an array or object instead of 6 parameters.
|
||||
$mailchimp_status = $this->request->getPost('mailchimp_status', FILTER_SANITIZE_STRING);
|
||||
$this->mailchimp_lib->addOrUpdateMember(
|
||||
$this->_list_id,
|
||||
$email,
|
||||
$first_name,
|
||||
$last_name,
|
||||
$this->request->getPost('mailchimp_status', FILTER_SANITIZE_STRING),
|
||||
$mailchimp_status == null ? "" : $mailchimp_status,
|
||||
['vip' => $this->request->getPost('mailchimp_vip') != NULL]
|
||||
);
|
||||
|
||||
// New customer
|
||||
if($customer_id == -1)
|
||||
if($customer_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -341,7 +345,7 @@ class Customers extends Persons
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Customers.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -349,7 +353,7 @@ class Customers extends Persons
|
||||
/**
|
||||
* AJAX call to verify if an email address already exists
|
||||
*/
|
||||
public function ajax_check_email(): void
|
||||
public function postCheckEmail(): void
|
||||
{
|
||||
$exists = $this->customer->check_email_exists(strtolower($this->request->getPost('email')), $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT));
|
||||
|
||||
@@ -359,7 +363,7 @@ class Customers extends Persons
|
||||
/**
|
||||
* AJAX call to verify if an account number already exists
|
||||
*/
|
||||
public function ajax_check_account_number(): void
|
||||
public function postCheckAccountNumber(): void
|
||||
{
|
||||
$exists = $this->customer->check_account_number_exists($this->request->getPost('account_number'), $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT));
|
||||
|
||||
@@ -369,7 +373,7 @@ class Customers extends Persons
|
||||
/**
|
||||
* This deletes customers from the customers table
|
||||
*/
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$customers_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
$customers_info = $this->customer->get_multiple_info($customers_to_delete);
|
||||
@@ -408,9 +412,9 @@ class Customers extends Persons
|
||||
force_download($name, $data);
|
||||
}
|
||||
|
||||
public function csv_import(): void
|
||||
public function getCsvImport(): void
|
||||
{
|
||||
echo view('customers/form_csv_import', NULL);
|
||||
echo view('customers/form_csv_import');
|
||||
}
|
||||
|
||||
public function do_csv_import(): void
|
||||
|
||||
@@ -22,13 +22,13 @@ class Employees extends Persons
|
||||
/**
|
||||
* Returns employee table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$employees = $this->employee->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->employee->get_found_rows($search);
|
||||
@@ -47,14 +47,14 @@ class Employees extends Persons
|
||||
*/
|
||||
public function suggest(): void
|
||||
{
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), 25, TRUE);
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), 25, TRUE);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function suggest_search(): void
|
||||
{
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getPost('term', FILTER_SANITIZE_STRING));
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class Employees extends Persons
|
||||
/**
|
||||
* Loads the employee edit form
|
||||
*/
|
||||
public function view(int $employee_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function getView(int $employee_id = NEW_ENTRY): void
|
||||
{
|
||||
$person_info = $this->employee->get_info($employee_id);
|
||||
foreach(get_object_vars($person_info) as $property => $value)
|
||||
@@ -98,7 +98,7 @@ class Employees extends Persons
|
||||
/**
|
||||
* Inserts/updates an employee
|
||||
*/
|
||||
public function save(int $employee_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $employee_id = NEW_ENTRY): void
|
||||
{
|
||||
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_STRING); //TODO: duplicated code
|
||||
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_STRING);
|
||||
@@ -162,7 +162,7 @@ class Employees extends Persons
|
||||
if($this->employee->save_employee($person_data, $employee_data, $grants_array, $employee_id))
|
||||
{
|
||||
// New employee
|
||||
if($employee_id == -1)
|
||||
if($employee_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -184,7 +184,7 @@ class Employees extends Persons
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Employees.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class Employees extends Persons
|
||||
/**
|
||||
* This deletes employees from the employees table
|
||||
*/
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$employees_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
@@ -215,7 +215,7 @@ class Employees extends Persons
|
||||
*/
|
||||
public function check_username($employee_id): void
|
||||
{
|
||||
$exists = $this->employee->username_exists($employee_id, $this->request->getGet('username', FILTER_SANITIZE_STRING));
|
||||
$exists = $this->employee->username_exists($employee_id, $this->request->getVar('username', FILTER_SANITIZE_STRING));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,16 +36,16 @@ class Expenses extends Secure_Controller
|
||||
echo view('expenses/manage', $data);
|
||||
}
|
||||
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
$filters = [
|
||||
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_STRING),
|
||||
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_STRING),
|
||||
'start_date' => $this->request->getVar('start_date', FILTER_SANITIZE_STRING),
|
||||
'end_date' => $this->request->getVar('end_date', FILTER_SANITIZE_STRING),
|
||||
'only_cash' => FALSE,
|
||||
'only_due' => FALSE,
|
||||
'only_check' => FALSE,
|
||||
@@ -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_STRING), TRUE); //TODO: variable naming does not match standard
|
||||
$filledup = array_fill_keys($this->request->getVar('filters', FILTER_SANITIZE_STRING), 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);
|
||||
@@ -76,7 +76,7 @@ class Expenses extends Secure_Controller
|
||||
echo json_encode (['total' => $total_rows, 'rows' => $data_rows, 'payment_summary' => $payment_summary]);
|
||||
}
|
||||
|
||||
public function view(int $expense_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function getView(int $expense_id = NEW_ENTRY): void
|
||||
{
|
||||
$data = []; //TODO: Duplicated code
|
||||
|
||||
@@ -125,7 +125,7 @@ class Expenses extends Secure_Controller
|
||||
echo view("expenses/form", $data);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id)
|
||||
public function getRow(int $row_id): vpid
|
||||
{
|
||||
$expense_info = $this->expense->get_info($row_id);
|
||||
$data_row = get_expenses_data_row($expense_info);
|
||||
@@ -133,7 +133,7 @@ class Expenses extends Secure_Controller
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function save(int $expense_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $expense_id = NEW_ENTRY): void
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING);
|
||||
@@ -156,7 +156,7 @@ class Expenses extends Secure_Controller
|
||||
if($this->expense->save_value($expense_data, $expense_id))
|
||||
{
|
||||
//New Expense
|
||||
if($expense_id == -1)
|
||||
if($expense_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode (['success' => TRUE, 'message' => lang('Expenses.successful_adding'), 'id' => $expense_data['expense_id']]);
|
||||
}
|
||||
@@ -167,7 +167,7 @@ class Expenses extends Secure_Controller
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Expenses.error_adding_updating'), 'id' => -1]); //TODO: Need to replace -1 with a constant
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Expenses.error_adding_updating'), 'id' => NEW_ENTRY]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class Expenses extends Secure_Controller
|
||||
echo json_encode (['success' => $parsed_value !== FALSE]);
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$expenses_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
|
||||
/*
|
||||
Returns expense_category_manage table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$expense_categories = $this->expense_category->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->expense_category->get_found_rows($search);
|
||||
@@ -46,21 +46,21 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
|
||||
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$data_row = get_expense_category_data_row($this->expense_category->get_info($row_id));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view(int $expense_category_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function getView(int $expense_category_id = NEW_ENTRY): void
|
||||
{
|
||||
$data['category_info'] = $this->expense_category->get_info($expense_category_id);
|
||||
|
||||
echo view("expenses_categories/form", $data);
|
||||
}
|
||||
|
||||
public function save(int $expense_category_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $expense_category_id = NEW_ENTRY): void
|
||||
{
|
||||
$expense_category_data = [
|
||||
'category_name' => $this->request->getPost('category_name', FILTER_SANITIZE_STRING),
|
||||
@@ -70,7 +70,7 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
|
||||
if($this->expense_category->save_value($expense_category_data, $expense_category_id)) //TODO: Reflection exception
|
||||
{
|
||||
// New expense_category
|
||||
if($expense_category_id == -1) //TODO: Replace -1 with a constant.
|
||||
if($expense_category_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -88,16 +88,16 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{//TODO: need to replace -1 for a constant
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Expenses_categories.error_adding_updating') . ' ' . $expense_category_data['category_name'],
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$expense_category_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ class Giftcards extends Secure_Controller
|
||||
/*
|
||||
Returns Giftcards table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$giftcards = $this->giftcard->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->giftcard->get_found_rows($search);
|
||||
@@ -50,9 +50,9 @@ class Giftcards extends Secure_Controller
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
|
||||
public function suggest(): void
|
||||
public function getSuggest(): void
|
||||
{
|
||||
$suggestions = $this->giftcard->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), TRUE);
|
||||
$suggestions = $this->giftcard->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), TRUE);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -64,14 +64,14 @@ class Giftcards extends Secure_Controller
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$data_row = get_giftcard_data_row($this->giftcard->get_info($row_id));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view(int $giftcard_id = -1): void //TODO: Need to replace -1 with a constant
|
||||
public function getView(int $giftcard_id = NEW_ENTRY): void
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$giftcard_info = $this->giftcard->get_info($giftcard_id);
|
||||
@@ -84,7 +84,8 @@ class Giftcards extends Secure_Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$max_giftnumber = isset($this->giftcard->get_max_number()->giftcard_number) ? $this->Giftcard->get_max_number()->giftcard_number : 0; //TODO: variable does not follow naming standard.
|
||||
$max_number_obj = $this->giftcard->get_max_number();
|
||||
$max_giftnumber = isset($max_number_obj) ? $this->giftcard->get_max_number()->giftcard_number : 0; //TODO: variable does not follow naming standard.
|
||||
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : $max_giftnumber + 1;
|
||||
}
|
||||
$data['giftcard_id'] = $giftcard_id;
|
||||
@@ -93,11 +94,11 @@ class Giftcards extends Secure_Controller
|
||||
echo view("giftcards/form", $data);
|
||||
}
|
||||
|
||||
public function save(int $giftcard_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $giftcard_id = NEW_ENTRY): void
|
||||
{
|
||||
$giftcard_number = $this->request->getPost('giftcard_number', FILTER_SANITIZE_STRING);
|
||||
|
||||
if($giftcard_id == -1 && trim($giftcard_number) == '')
|
||||
if($giftcard_id == NEW_ENTRY && trim($giftcard_number) == '')
|
||||
{
|
||||
$giftcard_number = $this->giftcard->generate_unique_giftcard_name($this->request->getPost('giftcard_amount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
}
|
||||
@@ -112,7 +113,7 @@ class Giftcards extends Secure_Controller
|
||||
if($this->giftcard->save_value($giftcard_data, $giftcard_id))
|
||||
{
|
||||
//New giftcard
|
||||
if($giftcard_id == -1) //TODO: Constant needed
|
||||
if($giftcard_id == NEW_ENTRY) //TODO: Constant needed
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -134,7 +135,7 @@ class Giftcards extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Giftcards.error_adding_updating') . ' ' . $giftcard_data['giftcard_number'],
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -144,13 +145,13 @@ class Giftcards extends Secure_Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajax_check_number_giftcard(): void
|
||||
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)]);
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$giftcards_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
class Home extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
@@ -15,7 +17,7 @@ class Home extends Secure_Controller
|
||||
echo view('home/home');
|
||||
}
|
||||
|
||||
public function getLogout(): \CodeIgniter\HTTP\RedirectResponse
|
||||
public function getLogout(): RedirectResponse
|
||||
{
|
||||
$this->employee->logout();
|
||||
return redirect()->to('login');
|
||||
|
||||
@@ -74,13 +74,13 @@ class Item_kits extends Secure_Controller
|
||||
/**
|
||||
* Returns Item_kit table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$item_kits = $this->item_kit->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->item_kit->get_found_rows($search);
|
||||
@@ -103,7 +103,7 @@ class Item_kits extends Secure_Controller
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
// calculate the total cost and retail price of the Kit, so it can be added to the table refresh
|
||||
$item_kit = $this->_add_totals_to_item_kit($this->item_kit->get_info($row_id));
|
||||
@@ -111,11 +111,11 @@ class Item_kits extends Secure_Controller
|
||||
echo json_encode(get_item_kit_data_row($item_kit));
|
||||
}
|
||||
|
||||
public function view(int $item_kit_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function getView(int $item_kit_id = NEW_ENTRY): void
|
||||
{
|
||||
$info = $this->item_kit->get_info($item_kit_id);
|
||||
|
||||
if($item_kit_id == -1) //TODO: Replace -1 with a constant
|
||||
if($item_kit_id == NEW_ENTRY)
|
||||
{
|
||||
$info->price_option = '0';
|
||||
$info->print_option = PRINT_ALL;
|
||||
@@ -150,7 +150,7 @@ class Item_kits extends Secure_Controller
|
||||
echo view("item_kits/form", $data);
|
||||
}
|
||||
|
||||
public function save(int $item_kit_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $item_kit_id = NEW_ENTRY): void
|
||||
{
|
||||
$item_kit_data = [
|
||||
'name' => $this->request->getPost('name', FILTER_SANITIZE_STRING),
|
||||
@@ -167,7 +167,7 @@ class Item_kits extends Secure_Controller
|
||||
{
|
||||
$new_item = FALSE;
|
||||
//New item kit
|
||||
if($item_kit_id == -1) //TODO: Replace -1 with a constant
|
||||
if($item_kit_id == NEW_ENTRY)
|
||||
{
|
||||
$item_kit_id = $item_kit_data['item_kit_id'];
|
||||
$new_item = TRUE;
|
||||
@@ -213,12 +213,12 @@ class Item_kits extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Item_kits.error_adding_updating') . ' ' . $item_kit_data['name'],
|
||||
'id' => -1 //TODO: Replace -1 with a constant
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$item_kits_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ class Items extends Secure_Controller
|
||||
{
|
||||
parent::__construct('items');
|
||||
|
||||
$this->session = Services::session();
|
||||
|
||||
$this->image = Services::image();
|
||||
|
||||
$this->barcode_lib = new Barcode_lib();
|
||||
@@ -85,21 +87,21 @@ class Items extends Secure_Controller
|
||||
/*
|
||||
* Returns Items table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$this->item_lib->set_item_location($this->request->getGet('stock_location', FILTER_SANITIZE_NUMBER_INT));
|
||||
$this->item_lib->set_item_location($this->request->getVar('stock_location', FILTER_SANITIZE_NUMBER_INT));
|
||||
|
||||
$definition_names = $this->attribute->get_definitions_by_flags(Attribute::SHOW_IN_ITEMS);
|
||||
|
||||
$filters = [
|
||||
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_STRING),
|
||||
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_STRING),
|
||||
'start_date' => $this->request->getVar('start_date', FILTER_SANITIZE_STRING),
|
||||
'end_date' => $this->request->getVar('end_date', FILTER_SANITIZE_STRING),
|
||||
'stock_location_id' => $this->item_lib->get_item_location(),
|
||||
'empty_upc' => FALSE,
|
||||
'low_inventory' => FALSE,
|
||||
@@ -112,7 +114,7 @@ class Items extends Secure_Controller
|
||||
];
|
||||
|
||||
//Check if any filter is set in the multiselect dropdown
|
||||
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: filled up does not meet naming standards
|
||||
$filledup = array_fill_keys($this->request->getVar('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: filled up does not meet naming standards
|
||||
$filters = array_merge($filters, $filledup);
|
||||
$items = $this->item->search($search, $filters, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->item->get_found_rows($search, $filters);
|
||||
@@ -209,7 +211,7 @@ class Items extends Secure_Controller
|
||||
/**
|
||||
* Gives search suggestions based on what is being searched for. Called from the view.
|
||||
*/
|
||||
public function suggest_category(): void
|
||||
public function getSuggestCategory(): void
|
||||
{
|
||||
$suggestions = $this->item->get_category_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING));
|
||||
|
||||
@@ -219,14 +221,14 @@ class Items extends Secure_Controller
|
||||
/**
|
||||
* Gives search suggestions based on what is being searched for. Called from the view.
|
||||
*/
|
||||
public function suggest_location(): void
|
||||
public function getSuggestLocation(): void
|
||||
{
|
||||
$suggestions = $this->item->get_location_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row(string $item_ids): void //TODO: It's possible an array would be better.
|
||||
public function getRow(string $item_ids): void //TODO: It's possible an array would be better.
|
||||
{
|
||||
$item_infos = $this->item->get_multiple_info(explode(':', $item_ids), $this->item_lib->get_item_location());
|
||||
|
||||
@@ -240,9 +242,12 @@ class Items extends Secure_Controller
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
public function view(int $item_id = NEW_ITEM): void //TODO: Super long function. Perhaps we need to refactor out some methods.
|
||||
public function getView(int $item_id = NEW_ENTRY): void //TODO: Super long function. Perhaps we need to refactor out some methods.
|
||||
{
|
||||
if($item_id === NEW_ITEM)
|
||||
// Set default values
|
||||
if($item_id == null) $item_id = NEW_ENTRY;
|
||||
|
||||
if($item_id === NEW_ENTRY)
|
||||
{
|
||||
$data = [];
|
||||
}
|
||||
@@ -263,14 +268,9 @@ class Items extends Secure_Controller
|
||||
|
||||
$item_info = $this->item->get_info($item_id);
|
||||
|
||||
foreach(get_object_vars($item_info) as $property => $value)
|
||||
{
|
||||
$item_info->$property = $value;
|
||||
}
|
||||
|
||||
if($data['allow_temp_item'] === 1)
|
||||
{
|
||||
if($item_id !== NEW_ITEM)
|
||||
if($item_id !== NEW_ENTRY)
|
||||
{
|
||||
if($item_info->item_type != ITEM_TEMP)
|
||||
{
|
||||
@@ -300,7 +300,7 @@ class Items extends Secure_Controller
|
||||
$data['selected_category'] = $item_info->category;
|
||||
}
|
||||
|
||||
if($item_id === NEW_ITEM)
|
||||
if($item_id === NEW_ENTRY)
|
||||
{
|
||||
$data['default_tax_1_rate'] = $this->config['default_tax_1_rate'];
|
||||
$data['default_tax_2_rate'] = $this->config['default_tax_2_rate'];
|
||||
@@ -327,6 +327,7 @@ class Items extends Secure_Controller
|
||||
&& !($this->config['derive_sale_quantity'] === '1')
|
||||
);
|
||||
|
||||
|
||||
$data['item_info'] = $item_info;
|
||||
|
||||
$suppliers = ['' => lang('Items.none')];
|
||||
@@ -377,7 +378,7 @@ class Items extends Secure_Controller
|
||||
$data['tax_category'] = '';
|
||||
}
|
||||
|
||||
$data['logo_exists'] = $item_info->pic_filename !== '';
|
||||
$data['logo_exists'] = $item_info->pic_filename !== null;
|
||||
$file_extension = pathinfo($item_info->pic_filename, PATHINFO_EXTENSION);
|
||||
|
||||
if(empty($file_extension))
|
||||
@@ -395,14 +396,14 @@ class Items extends Secure_Controller
|
||||
foreach($stock_locations as $location)
|
||||
{
|
||||
$quantity = $this->item_quantity->get_item_quantity($item_id, $location['location_id'])->quantity;
|
||||
$quantity = ($item_id === NEW_ITEM) ? 0 : $quantity;
|
||||
$quantity = ($item_id === NEW_ENTRY) ? 0 : $quantity;
|
||||
$location_array[$location['location_id']] = ['location_name' => $location['location_name'], 'quantity' => $quantity];
|
||||
$data['stock_locations'] = $location_array;
|
||||
}
|
||||
|
||||
$data['selected_low_sell_item_id'] = $item_info->low_sell_item_id;
|
||||
|
||||
if($item_id !== NEW_ITEM && $item_info->item_id !== $item_info->low_sell_item_id)
|
||||
if($item_id !== NEW_ENTRY && $item_info->item_id !== $item_info->low_sell_item_id)
|
||||
{
|
||||
$low_sell_item_info = $this->item->get_info($item_info->low_sell_item_id);
|
||||
$data['selected_low_sell_item'] = implode(NAME_SEPARATOR, [$low_sell_item_info->name, $low_sell_item_info->pack_name]);
|
||||
@@ -415,7 +416,7 @@ class Items extends Secure_Controller
|
||||
echo view('items/form', $data);
|
||||
}
|
||||
|
||||
public function inventory(int $item_id = NEW_ITEM): void
|
||||
public function inventory(int $item_id = NEW_ENTRY): void
|
||||
{
|
||||
$item_info = $this->item->get_info($item_id); //TODO: Duplicate code
|
||||
|
||||
@@ -439,7 +440,7 @@ class Items extends Secure_Controller
|
||||
echo view('items/form_inventory', $data);
|
||||
}
|
||||
|
||||
public function count_details(int $item_id = NEW_ITEM): void
|
||||
public function getCountDetails(int $item_id = NEW_ENTRY): void
|
||||
{
|
||||
$item_info = $this->item->get_info($item_id); //TODO: Duplicate code
|
||||
|
||||
@@ -487,7 +488,7 @@ class Items extends Secure_Controller
|
||||
echo view('barcodes/barcode_sheet', $data);
|
||||
}
|
||||
|
||||
public function attributes(int $item_id = NEW_ITEM): void
|
||||
public function getAttributes(int $item_id = NEW_ENTRY): void
|
||||
{
|
||||
$data['item_id'] = $item_id;
|
||||
$definition_ids = json_decode($this->request->getPost('definition_ids', FILTER_SANITIZE_STRING), TRUE);
|
||||
@@ -549,10 +550,14 @@ class Items extends Secure_Controller
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function save(int $item_id = NEW_ITEM): void
|
||||
public function postSave(int $item_id = NEW_ENTRY): void
|
||||
{
|
||||
$upload_success = $this->upload_image();
|
||||
$upload_file = $this->request->hasFile('image') ? $this->request->getFile('image') : null; //TODO: https://codeigniter4.github.io/userguide/incoming/incomingrequest.html#uploaded-files
|
||||
|
||||
// TODO the hasFile is not defined, so commenting this out and saving it for last.
|
||||
// $upload_file = $this->request->hasFile('image') ? $this->request->getFile('image') : null; //TODO: https://codeigniter4.github.io/userguide/incoming/incomingrequest.html#uploaded-files
|
||||
$upload_file = null;
|
||||
|
||||
$receiving_quantity = parse_quantity($this->request->getPost('receiving_quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
$item_type = $this->request->getPost('item_type') === NULL ? ITEM : $this->request->getPost('item_type', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -603,10 +608,17 @@ class Items extends Secure_Controller
|
||||
$item_data['tax_category_id'] = empty($this->request->getPost('tax_category_id')) ? NULL : $this->request->getPost('tax_category_id', FILTER_SANITIZE_NUMBER_INT);
|
||||
}
|
||||
|
||||
$original_name = $upload_file->getFilename();
|
||||
if(!empty($original_name))
|
||||
if ($upload_file != NULL)
|
||||
{
|
||||
$item_data['pic_filename'] = $original_name;
|
||||
$original_name = $upload_file->getFilename();
|
||||
if(!empty($original_name))
|
||||
{
|
||||
$item_data['pic_filename'] = $original_name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$item_data['pic_filename'] = NULL;
|
||||
}
|
||||
|
||||
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
|
||||
@@ -616,7 +628,7 @@ class Items extends Secure_Controller
|
||||
$success = TRUE;
|
||||
$new_item = FALSE;
|
||||
|
||||
if($item_id === NEW_ITEM)
|
||||
if($item_id === NEW_ENTRY)
|
||||
{
|
||||
$item_id = $item_data['item_id'];
|
||||
$new_item = TRUE;
|
||||
@@ -717,7 +729,7 @@ class Items extends Secure_Controller
|
||||
{
|
||||
$message = lang('Items.error_adding_updating') . ' ' . $item_data['name'];
|
||||
|
||||
echo json_encode (['success' => FALSE, 'message' => $message, 'id' => NEW_ITEM]);
|
||||
echo json_encode (['success' => FALSE, 'message' => $message, 'id' => NEW_ENTRY]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,7 +774,12 @@ class Items extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
public function check_item_number(): void
|
||||
/**
|
||||
* Ajax call to check to see if the item number, a.k.a. barcode, is already used by another item
|
||||
* If it exists then that is an error condition so return TRUE for "error found"
|
||||
* @return string
|
||||
*/
|
||||
public function postCheckItemNumber(): void
|
||||
{
|
||||
$exists = $this->item->item_number_exists($this->request->getPost('item_number', FILTER_SANITIZE_STRING), $this->request->getPost('item_id', FILTER_SANITIZE_NUMBER_INT));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
@@ -773,7 +790,7 @@ class Items extends Secure_Controller
|
||||
*/
|
||||
public function check_kit_exists(): void //TODO: This function appears to be never called in the code. Need to confirm.
|
||||
{
|
||||
if($this->request->getPost('item_number', FILTER_SANITIZE_STRING) === NEW_ITEM)
|
||||
if($this->request->getPost('item_number', FILTER_SANITIZE_STRING) === NEW_ENTRY)
|
||||
{
|
||||
$exists = $this->item_kit->item_kit_exists_for_name($this->request->getPost('name', FILTER_SANITIZE_STRING)); //TODO: item_kit_exists_for_name doesn't exist in Item_kit. I looked at the blame and it appears to have never existed.
|
||||
}
|
||||
@@ -784,7 +801,7 @@ class Items extends Secure_Controller
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
|
||||
public function remove_logo($item_id): void
|
||||
public function getRemoveLogo($item_id): void
|
||||
{
|
||||
$item_data = ['pic_filename' => NULL];
|
||||
$result = $this->item->save_value($item_data, $item_id);
|
||||
@@ -795,7 +812,7 @@ class Items extends Secure_Controller
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function save_inventory($item_id = NEW_ITEM): void
|
||||
public function save_inventory($item_id = NEW_ENTRY): void
|
||||
{
|
||||
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
|
||||
$cur_item_info = $this->item->get_info($item_id);
|
||||
@@ -829,7 +846,7 @@ class Items extends Secure_Controller
|
||||
{
|
||||
$message = lang('Items.error_adding_updating') . " $cur_item_info->name";
|
||||
|
||||
echo json_encode (['success' => FALSE, 'message' => $message, 'id' => NEW_ITEM]);
|
||||
echo json_encode (['success' => FALSE, 'message' => $message, 'id' => NEW_ENTRY]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,7 +901,7 @@ class Items extends Secure_Controller
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$items_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -909,9 +926,9 @@ class Items extends Secure_Controller
|
||||
force_download($name, $data, TRUE);
|
||||
}
|
||||
|
||||
public function csv_import(): void
|
||||
public function getCsvImport(): void
|
||||
{
|
||||
echo view('items/form_csv_import', NULL);
|
||||
echo view('items/form_csv_import');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -936,7 +953,7 @@ class Items extends Secure_Controller
|
||||
$allowed_stock_locations = $this->stock_location->get_allowed_locations();
|
||||
$attribute_definition_names = $this->attribute->get_definition_names();
|
||||
|
||||
unset($attribute_definition_names[-1]); //Removes the common_none_selected_text from the array
|
||||
unset($attribute_definition_names[NEW_ENTRY]); //Removes the common_none_selected_text from the array
|
||||
|
||||
$attribute_data = [];
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class Messages extends Secure_Controller
|
||||
echo view('messages/sms');
|
||||
}
|
||||
|
||||
public function view(int $person_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function getView(int $person_id = NEW_ENTRY): void
|
||||
{
|
||||
$info = $this->person->get_info($person_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
@@ -65,7 +65,7 @@ class Messages extends Secure_Controller
|
||||
* @param int $person_id
|
||||
* @return void
|
||||
*/
|
||||
public function send_form(int $person_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function send_form(int $person_id = NEW_ENTRY): void
|
||||
{
|
||||
$phone = $this->request->getPost('phone', FILTER_SANITIZE_STRING);
|
||||
$message = $this->request->getPost('message', FILTER_SANITIZE_STRING);
|
||||
@@ -77,7 +77,7 @@ class Messages extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
'message' => lang('Messages.successfully_sent') . ' ' . esc($phone),
|
||||
'person_id' => $person_id //TODO: Replace -1 with a constant
|
||||
'person_id' => $person_id
|
||||
]);
|
||||
}
|
||||
else
|
||||
@@ -85,7 +85,7 @@ class Messages extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone),
|
||||
'person_id' => -1 //TODO: Replace -1 with a constant
|
||||
'person_id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ abstract class Persons extends Secure_Controller
|
||||
/**
|
||||
* Gets one row for a person manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$data_row = get_person_data_row($this->person->get_info($row_id));
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ class Receivings extends Secure_Controller
|
||||
* Called in the view.
|
||||
* @return void
|
||||
*/
|
||||
public function item_search(): void
|
||||
public function getItemSearch(): void
|
||||
{
|
||||
$suggestions = $this->item->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
|
||||
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING)));
|
||||
$suggestions = $this->item->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
|
||||
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING)));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -65,10 +65,10 @@ class Receivings extends Secure_Controller
|
||||
* Called in the view.
|
||||
* @return void
|
||||
*/
|
||||
public function stock_item_search(): void
|
||||
public function getStockItemSearch(): void
|
||||
{
|
||||
$suggestions = $this->item->get_stock_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
|
||||
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING)));
|
||||
$suggestions = $this->item->get_stock_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
|
||||
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING)));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class Receivings extends Secure_Controller
|
||||
* @param $item_id
|
||||
* @return void
|
||||
*/
|
||||
public function edit_item($item_id): void
|
||||
public function postEditItem($item_id): void
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@@ -223,7 +223,7 @@ class Receivings extends Secure_Controller
|
||||
* @param $item_number
|
||||
* @return void
|
||||
*/
|
||||
public function delete_item($item_number): void
|
||||
public function getDeleteItem($item_number): void
|
||||
{
|
||||
$this->receiving_lib->delete_item($item_number);
|
||||
|
||||
@@ -233,7 +233,7 @@ class Receivings extends Secure_Controller
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function delete(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
|
||||
|
||||
@@ -43,11 +43,13 @@ use ReflectionException;
|
||||
*/
|
||||
class Sales extends Secure_Controller
|
||||
{
|
||||
protected $helpers = ['form', 'file'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('sales');
|
||||
|
||||
helper('file');
|
||||
// helper('file');
|
||||
|
||||
$this->session = session();
|
||||
$this->barcode_lib = new Barcode_lib();
|
||||
@@ -59,6 +61,8 @@ class Sales extends Secure_Controller
|
||||
|
||||
$this->customer = model('Customer');
|
||||
$this->sale = model('Sale');
|
||||
$this->item = model('Item');
|
||||
$this->item_kit = model('Item_kit');
|
||||
$this->stock_location = model('Stock_location');
|
||||
}
|
||||
|
||||
@@ -91,7 +95,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$sale_info = $this->sale->get_info($row_id)->getRow();
|
||||
$data_row = get_sale_data_row($sale_info);
|
||||
@@ -99,29 +103,29 @@ class Sales extends Secure_Controller
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$filters = [
|
||||
'sale_type' => 'all',
|
||||
'location_id' => 'all',
|
||||
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_STRING),
|
||||
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_STRING),
|
||||
'start_date' => $this->request->getVar('start_date', FILTER_SANITIZE_STRING),
|
||||
'end_date' => $this->request->getVar('end_date', FILTER_SANITIZE_STRING),
|
||||
'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),
|
||||
'only_invoices' => $this->config['invoice_enable'] && $this->request->getVar('only_invoices', FILTER_SANITIZE_NUMBER_INT),
|
||||
'is_valid_receipt' => $this->sale->is_valid_receipt($search)
|
||||
];
|
||||
|
||||
// check if any filter is set in the multiselect dropdown
|
||||
$filledup = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: Variable does not meet naming conventions
|
||||
$filledup = array_fill_keys($this->request->getVar('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: Variable does not meet naming conventions
|
||||
$filters = array_merge($filters, $filledup);
|
||||
|
||||
$sales = $this->sale->search($search, $filters, $limit, $offset, $sort, $order);
|
||||
@@ -147,7 +151,7 @@ class Sales extends Secure_Controller
|
||||
* Called in the view.
|
||||
* @return void
|
||||
*/
|
||||
public function item_search(): void
|
||||
public function getItemSearch(): void
|
||||
{
|
||||
$suggestions = [];
|
||||
$receipt = $search = $this->request->getGet('term') != '' ? $this->request->getGet('term', FILTER_SANITIZE_STRING) : NULL;
|
||||
@@ -322,7 +326,7 @@ class Sales extends Secure_Controller
|
||||
* Multiple Payments. Called in the view.
|
||||
* @return void
|
||||
*/
|
||||
public function add_payment(): void
|
||||
public function postAddPayment(): void
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@@ -331,14 +335,16 @@ class Sales extends Secure_Controller
|
||||
//TODO: See the code block below. This too needs to be ternary notation.
|
||||
if($payment_type !== lang('Sales.giftcard'))
|
||||
{
|
||||
$this->validator->setRule('amount_tendered', 'lang:sales_amount_tendered', 'trim|required|numeric');
|
||||
$rules = ['amount_tendered' => 'trim|required|decimal',];
|
||||
$messages = ['amount_tendered' => lang('Sales.must_enter_numeric')];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validator->setRule('amount_tendered', 'lang:sales_amount_tendered', 'trim|required');
|
||||
$rules = ['amount_tendered' => 'trim|required',];
|
||||
$messages = ['amount_tendered' => lang('Sales.must_enter_numeric_giftcard')];
|
||||
}
|
||||
|
||||
if(!$this->validate([]))
|
||||
if(!$this->validate($rules, $messages))
|
||||
{//TODO: the code below should be refactored to the following ternary notation since it's much more readable and concise:
|
||||
//$data['error'] = $payment_type === lang('Sales.giftcard')
|
||||
// ? $data['error'] = lang('Sales.must_enter_numeric_giftcard')
|
||||
@@ -439,7 +445,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
$this->_reload($data); //TODO: Hungarian notation
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,7 +453,7 @@ class Sales extends Secure_Controller
|
||||
* @param string $payment_id
|
||||
* @return void
|
||||
*/
|
||||
public function delete_payment(string $payment_id): void
|
||||
public function postDelete_payment(string $payment_id): void
|
||||
{
|
||||
$this->sale_lib->delete_payment($payment_id);
|
||||
|
||||
@@ -463,7 +469,7 @@ class Sales extends Secure_Controller
|
||||
|
||||
// check if any discount is assigned to the selected customer
|
||||
$customer_id = $this->sale_lib->get_customer();
|
||||
if($customer_id != -1) //TODO: Replace -1 with a constant
|
||||
if($customer_id != NEW_ENTRY)
|
||||
{
|
||||
// load the customer discount if any
|
||||
$customer_discount = $this->customer->get_info($customer_id)->discount;
|
||||
@@ -554,38 +560,43 @@ class Sales extends Secure_Controller
|
||||
* @param string $line
|
||||
* @return void
|
||||
*/
|
||||
public function edit_item(string $line): void
|
||||
public function postEditItem(string $line): void
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$this->validator->setRule('price', 'lang:sales_price', 'required|numeric');
|
||||
$this->validator->setRule('quantity', 'lang:sales_quantity', 'required|numeric');
|
||||
$this->validator->setRule('discount', 'lang:sales_discount', 'required|numeric');
|
||||
$rules = [
|
||||
'price' => 'trim|required|numeric',
|
||||
'quantity' => 'trim|required|numeric',
|
||||
'discount' => 'trim|required|numeric',
|
||||
];
|
||||
|
||||
$description = $this->request->getPost('description', FILTER_SANITIZE_STRING);
|
||||
$serialnumber = $this->request->getPost('serialnumber', FILTER_SANITIZE_STRING);
|
||||
$price = parse_decimals($this->request->getPost('price', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
$quantity = parse_quantity($this->request->getPost('quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
$discount_type = $this->request->getPost('discount_type', FILTER_SANITIZE_STRING);
|
||||
$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;
|
||||
|
||||
if(!$this->validate([]))
|
||||
if($this->validate($rules))
|
||||
{
|
||||
|
||||
$description = $this->request->getPost('description', FILTER_SANITIZE_STRING);
|
||||
$serialnumber = $this->request->getPost('serialnumber', FILTER_SANITIZE_STRING);
|
||||
$price = parse_decimals($this->request->getPost('price', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
$quantity = parse_quantity($this->request->getPost('quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
$discount_type = $this->request->getPost('discount_type', FILTER_SANITIZE_STRING);
|
||||
$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;
|
||||
|
||||
|
||||
$this->sale_lib->edit_item($line, $description, $serialnumber, $quantity, $discount, $discount_type, $price, $discounted_total);
|
||||
|
||||
$this->sale_lib->empty_payments();
|
||||
|
||||
$data['warning'] = $this->sale_lib->out_of_stock($this->sale_lib->get_item_id($line), $item_location);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error'] = lang('Sales.error_editing_item');
|
||||
}
|
||||
|
||||
$data['warning'] = $this->sale_lib->out_of_stock($this->sale_lib->get_item_id($line), $item_location);
|
||||
|
||||
$this->_reload($data); //TODO: Hungarian notation
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -594,7 +605,7 @@ class Sales extends Secure_Controller
|
||||
* @return void
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function delete_item(int $item_id): void
|
||||
public function getDeleteItem(int $item_id): void
|
||||
{
|
||||
$this->sale_lib->delete_item($item_id);
|
||||
|
||||
@@ -607,7 +618,7 @@ class Sales extends Secure_Controller
|
||||
* Called in the view.
|
||||
* @return void
|
||||
*/
|
||||
public function remove_customer(): void
|
||||
public function getRemoveCustomer(): void
|
||||
{
|
||||
$this->sale_lib->clear_giftcard_remainder();
|
||||
$this->sale_lib->clear_rewards_remainder();
|
||||
@@ -740,7 +751,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
if($sale_id == -1 && $this->sale->check_invoice_number_exists($invoice_number)) //TODO: Replace -1 with constant
|
||||
if($sale_id == NEW_ENTRY && $this->sale->check_invoice_number_exists($invoice_number))
|
||||
{
|
||||
$data['error'] = lang('Sales.invoice_number_duplicate', ['invoice_number' => $invoice_number]);
|
||||
$this->_reload($data);
|
||||
@@ -761,7 +772,7 @@ class Sales extends Secure_Controller
|
||||
// Resort and filter cart lines for printing
|
||||
$data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']);
|
||||
|
||||
if($data['sale_id_num'] == -1)
|
||||
if($data['sale_id_num'] == NEW_ENTRY)
|
||||
{
|
||||
$data['error_message'] = lang('Sales.transaction_failed');
|
||||
}
|
||||
@@ -791,7 +802,7 @@ class Sales extends Secure_Controller
|
||||
$work_order_number = $this->token_lib->render($work_order_format);
|
||||
}
|
||||
|
||||
if($sale_id == -1 && $this->sale->check_work_order_number_exists($work_order_number))
|
||||
if($sale_id == NEW_ENTRY && $this->sale->check_work_order_number_exists($work_order_number))
|
||||
{
|
||||
$data['error'] = lang('Sales.work_order_number_duplicate');
|
||||
$this->_reload($data);
|
||||
@@ -826,7 +837,7 @@ class Sales extends Secure_Controller
|
||||
$quote_number = $this->token_lib->render($quote_format);
|
||||
}
|
||||
|
||||
if($sale_id == -1 && $this->sale->check_quote_number_exists($quote_number))
|
||||
if($sale_id == NEW_ENTRY && $this->sale->check_quote_number_exists($quote_number))
|
||||
{
|
||||
$data['error'] = lang('Sales.quote_number_duplicate');
|
||||
$this->_reload($data);
|
||||
@@ -867,7 +878,7 @@ class Sales extends Secure_Controller
|
||||
|
||||
$data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']);
|
||||
|
||||
if($data['sale_id_num'] == -1) //TODO: Replace -1 with a constant
|
||||
if($data['sale_id_num'] == NEW_ENTRY)
|
||||
{
|
||||
$data['error_message'] = lang('Sales.transaction_failed');
|
||||
}
|
||||
@@ -963,7 +974,7 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$customer_info = '';
|
||||
|
||||
if($customer_id != -1)
|
||||
if($customer_id != NEW_ENTRY)
|
||||
{
|
||||
$customer_info = $this->customer->get_info($customer_id);
|
||||
$data['customer_id'] = $customer_id;
|
||||
@@ -1144,8 +1155,8 @@ class Sales extends Secure_Controller
|
||||
|
||||
if($sale_id == '')
|
||||
{
|
||||
$sale_id = -1;
|
||||
$this->session->set('sale_id', -1); //TODO: replace -1 with a constant
|
||||
$sale_id = NEW_ENTRY;
|
||||
$this->session->set('sale_id', NEW_ENTRY);
|
||||
}
|
||||
$cash_rounding = $this->sale_lib->reset_cash_rounding();
|
||||
|
||||
@@ -1334,7 +1345,7 @@ class Sales extends Secure_Controller
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function delete(int $sale_id = -1, bool $update_inventory = TRUE): void //TODO: Replace -1 with a constant
|
||||
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);
|
||||
@@ -1345,7 +1356,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_ids = $sale_id == -1 ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$sale_id]; //TODO: Replace -1 with a constant
|
||||
$sale_ids = $sale_id == NEW_ENTRY ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$sale_id];
|
||||
|
||||
if($this->sale->delete_list($sale_ids, $employee_id, $update_inventory))
|
||||
{
|
||||
@@ -1362,7 +1373,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function restore(int $sale_id = -1, bool $update_inventory = TRUE): void //TODO: Replace -1 with a constant
|
||||
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);
|
||||
@@ -1373,7 +1384,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_ids = $sale_id == -1 ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$sale_id]; //TODO: Replace -1 with a constant
|
||||
$sale_ids = $sale_id == NEW_ENTRY ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$sale_id];
|
||||
|
||||
if($this->sale->restore_list($sale_ids, $employee_id, $update_inventory))
|
||||
{
|
||||
@@ -1396,7 +1407,7 @@ class Sales extends Secure_Controller
|
||||
* @param int $sale_id
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function save(int $sale_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function save(int $sale_id = NEW_ENTRY): void
|
||||
{
|
||||
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING);
|
||||
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
|
||||
@@ -1455,7 +1466,7 @@ class Sales extends Secure_Controller
|
||||
];
|
||||
}
|
||||
|
||||
$payment_id = -1; //TODO: Replace -1 with a constant
|
||||
$payment_id = NEW_ENTRY;
|
||||
$payment_amount = $this->request->getPost('payment_amount_new', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
|
||||
$payment_type = $this->request->getPost('payment_type_new', FILTER_SANITIZE_STRING);
|
||||
|
||||
@@ -1508,7 +1519,7 @@ class Sales extends Secure_Controller
|
||||
public function cancel(): void
|
||||
{
|
||||
$sale_id = $this->sale_lib->get_sale_id();
|
||||
if($sale_id != -1 && $sale_id != '') //TODO: Replace -1 with a constant
|
||||
if($sale_id != NEW_ENTRY && $sale_id != '')
|
||||
{
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
|
||||
@@ -1525,7 +1536,7 @@ class Sales extends Secure_Controller
|
||||
else
|
||||
{
|
||||
$this->sale->delete($sale_id);
|
||||
$this->session->set('sale_id', -1); //TODO: Replace -1 with a constant
|
||||
$this->session->set('sale_id', NEW_ENTRY);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1702,7 +1713,7 @@ class Sales extends Secure_Controller
|
||||
$this->sale_lib->set_cart($cart);
|
||||
}
|
||||
|
||||
public function search_cart_for_item_id(int $id, array $array) //TODO: The second parameter should not be named array perhaps int $needle_item_id, array $shopping_cart
|
||||
public function getSearch_cart_for_item_id(int $id, array $array) //TODO: The second parameter should not be named array perhaps int $needle_item_id, array $shopping_cart
|
||||
{
|
||||
foreach($array as $key => $val) //TODO: key and val are not reflective of the contents of the array and should be replaced with descriptive variable names. Perhaps $cart_haystack => $item_details
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ class Secure_Controller extends BaseController
|
||||
$this->employee = model('Employee');
|
||||
$this->module = model('Module');
|
||||
$config = config('OSPOS')->settings;
|
||||
$validation = \Config\Services::validation();
|
||||
|
||||
if(!$this->employee->is_logged_in())
|
||||
{
|
||||
@@ -67,11 +68,11 @@ class Secure_Controller extends BaseController
|
||||
view('viewData', $global_view_data);
|
||||
}
|
||||
|
||||
public function check_numeric()
|
||||
public function getCheckNumeric()
|
||||
{
|
||||
$result = TRUE;
|
||||
|
||||
foreach($this->request->getGet(NULL, FILTER_SANITIZE_STRING) as $str)
|
||||
foreach($this->request->getVar(NULL, FILTER_SANITIZE_STRING) as $str)
|
||||
{
|
||||
$result &= parse_decimals($str);
|
||||
}
|
||||
@@ -81,9 +82,9 @@ class Secure_Controller extends BaseController
|
||||
|
||||
// this is the basic set of methods most OSPOS Controllers will implement
|
||||
public function getIndex() { return FALSE; }
|
||||
public function search() { return FALSE; }
|
||||
public function getSearch() { return FALSE; }
|
||||
public function suggest_search() { return FALSE; }
|
||||
public function view(int $data_item_id = -1) { return FALSE; }
|
||||
public function save(int $data_item_id = -1) { return FALSE; }
|
||||
public function delete() { return FALSE; }
|
||||
public function getView(int $data_item_id = -1) { return FALSE; }
|
||||
public function postSave(int $data_item_id = -1) { return FALSE; }
|
||||
public function postDelete() { return FALSE; }
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class Suppliers extends Persons
|
||||
* @param $row_id
|
||||
* @return void
|
||||
*/
|
||||
public function get_row($row_id): void
|
||||
public function getRow($row_id): void
|
||||
{
|
||||
$data_row = get_supplier_data_row($this->supplier->get_info($row_id));
|
||||
$data_row['category'] = $this->supplier->get_category_name($data_row['category']);
|
||||
@@ -44,13 +44,13 @@ class Suppliers extends Persons
|
||||
* Returns Supplier table data rows. This will be called with AJAX.
|
||||
* @return void
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$suppliers = $this->supplier->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->supplier->get_found_rows($search);
|
||||
@@ -72,7 +72,7 @@ class Suppliers extends Persons
|
||||
*/
|
||||
public function suggest(): void
|
||||
{
|
||||
$suggestions = $this->supplier->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), TRUE);
|
||||
$suggestions = $this->supplier->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), TRUE);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class Suppliers extends Persons
|
||||
/*
|
||||
Loads the supplier edit form
|
||||
*/
|
||||
public function view(int $supplier_id = -1): void //TODO: Replace -1 with constant
|
||||
public function getView(int $supplier_id = NEW_ENTRY): void
|
||||
{
|
||||
$info = $this->supplier->get_info($supplier_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
@@ -103,7 +103,7 @@ class Suppliers extends Persons
|
||||
/*
|
||||
Inserts/updates a supplier
|
||||
*/
|
||||
public function save(int $supplier_id = -1): void //TODO: Replace -1 with constant
|
||||
public function postSave(int $supplier_id = NEW_ENTRY): void
|
||||
{
|
||||
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_STRING); //TODO: Duplicate code
|
||||
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_STRING);
|
||||
@@ -139,7 +139,7 @@ class Suppliers extends Persons
|
||||
if($this->supplier->save_supplier($person_data, $supplier_data, $supplier_id))
|
||||
{
|
||||
//New supplier
|
||||
if($supplier_id == -1) //TODO: Replace -1 with a constant
|
||||
if($supplier_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -160,7 +160,7 @@ class Suppliers extends Persons
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Suppliers.error_adding_updating') . ' ' . $supplier_data['company_name'],
|
||||
'id' => -1 //TODO: Replace -1 with a constant
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class Suppliers extends Persons
|
||||
/*
|
||||
This deletes suppliers from the suppliers table
|
||||
*/
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$suppliers_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ class Tax_categories extends Secure_Controller
|
||||
/*
|
||||
* Returns tax_category table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$tax_categories = $this->tax_category->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->tax_category->get_found_rows($search);
|
||||
@@ -46,14 +46,14 @@ class Tax_categories extends Secure_Controller
|
||||
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
|
||||
}
|
||||
|
||||
public function get_row($row_id): void
|
||||
public function getRow($row_id): void
|
||||
{
|
||||
$data_row = get_tax_categories_data_row($this->tax_category->get_info($row_id));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view(int $tax_category_id = -1): void //TODO: Need to replace -1 with constant
|
||||
public function getView(int $tax_category_id = NEW_ENTRY): void
|
||||
{
|
||||
$data['tax_category_info'] = $this->tax_category->get_info($tax_category_id);
|
||||
|
||||
@@ -61,7 +61,7 @@ class Tax_categories extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
public function save(int $tax_category_id = -1): void //TODO: Need to replace -1 with constant
|
||||
public function postSave(int $tax_category_id = NEW_ENTRY): void
|
||||
{
|
||||
$tax_category_data = [
|
||||
'tax_category' => $this->request->getPost('tax_category', FILTER_SANITIZE_STRING),
|
||||
@@ -72,7 +72,7 @@ class Tax_categories extends Secure_Controller
|
||||
if($this->tax_category->save_value($tax_category_data, $tax_category_id))
|
||||
{
|
||||
// New tax_category_id
|
||||
if($tax_category_id == -1) //TODO: Need to replace -1 with constant
|
||||
if($tax_category_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -94,12 +94,12 @@ class Tax_categories extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Tax_categories.error_adding_updating') . ' ' . $tax_category_data['tax_category'],
|
||||
'id' => -1 //TODO: Need to replace -1 with constant
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$tax_categories_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -115,4 +115,4 @@ class Tax_categories extends Secure_Controller
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Tax_categories.cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ class Tax_codes extends Secure_Controller
|
||||
/*
|
||||
* Returns tax_category table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$tax_codes = $this->tax_code->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->tax_code->get_found_rows($search);
|
||||
@@ -54,14 +54,14 @@ class Tax_codes extends Secure_Controller
|
||||
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$data_row = get_tax_code_data_row($this->tax_code->get_info($row_id));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view(int $tax_code_id = -1): void //TODO: Need to replace -1 with constant
|
||||
public function getView(int $tax_code_id = NEW_ENTRY): void
|
||||
{
|
||||
$data['tax_code_info'] = $this->tax_code->get_info($tax_code_id);
|
||||
|
||||
@@ -69,7 +69,7 @@ class Tax_codes extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
public function save(int $tax_code_id = -1): void //TODO: Need to replace -1 with constant
|
||||
public function postSave(int $tax_code_id = NEW_ENTRY): void
|
||||
{
|
||||
$tax_code_data = [
|
||||
'tax_code' => $this->request->getPost('tax_code', FILTER_SANITIZE_STRING),
|
||||
@@ -80,7 +80,7 @@ class Tax_codes extends Secure_Controller
|
||||
|
||||
if($this->tax_code->save($tax_code_data))
|
||||
{
|
||||
if($tax_code_id == -1) //TODO: Need to replace -1 with constant
|
||||
if($tax_code_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -102,12 +102,12 @@ class Tax_codes extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Tax_codes.error_adding_updating') . ' ' . $tax_code_data['tax_code_id'],
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$tax_codes_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -123,4 +123,4 @@ class Tax_codes extends Secure_Controller
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Tax_codes.cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ class Tax_jurisdictions extends Secure_Controller
|
||||
/*
|
||||
* Returns tax_category table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$tax_jurisdictions = $this->tax_jurisdiction->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->tax_jurisdiction->get_found_rows($search);
|
||||
@@ -49,14 +49,14 @@ class Tax_jurisdictions extends Secure_Controller
|
||||
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
|
||||
}
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$data_row = get_tax_jurisdictions_data_row($this->tax_jurisdiction->get_info($row_id));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view(int $tax_jurisdiction_id = -1): void //TODO: Replace -1 with constant
|
||||
public function getView(int $tax_jurisdiction_id = NEW_ENTRY): void
|
||||
{
|
||||
$data['tax_jurisdiction_info'] = $this->tax_jurisdiction->get_info($tax_jurisdiction_id);
|
||||
|
||||
@@ -64,7 +64,7 @@ class Tax_jurisdictions extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
public function save(int $jurisdiction_id = -1): void //TODO: Replace -1 with constant
|
||||
public function postSave(int $jurisdiction_id = NEW_ENTRY): void
|
||||
{
|
||||
$tax_jurisdiction_data = [
|
||||
'jurisdiction_name' => $this->request->getPost('jurisdiction_name', FILTER_SANITIZE_STRING),
|
||||
@@ -73,7 +73,7 @@ class Tax_jurisdictions extends Secure_Controller
|
||||
|
||||
if($this->tax_jurisdiction->save_value($tax_jurisdiction_data))
|
||||
{
|
||||
if($jurisdiction_id == -1) //TODO: Replace -1 with constant
|
||||
if($jurisdiction_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -95,12 +95,12 @@ class Tax_jurisdictions extends Secure_Controller
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Tax_jurisdictions.error_adding_updating') . ' ' . $tax_jurisdiction_data['jurisdiction_name'],
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$tax_jurisdictions_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -116,4 +116,4 @@ class Tax_jurisdictions extends Secure_Controller
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Tax_jurisdictions.cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,13 +77,13 @@ class Taxes extends Secure_Controller
|
||||
/*
|
||||
Returns tax_codes table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$tax_rates = $this->tax->search($search, $limit, $offset, $sort, $order);
|
||||
|
||||
@@ -119,14 +119,14 @@ class Taxes extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
public function get_row(int $row_id): void
|
||||
public function getRow(int $row_id): void
|
||||
{
|
||||
$data_row = get_tax_rates_data_row($this->tax->get_info($row_id));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view_tax_codes(int $tax_code = -1): void //TODO: Replace -1 with constant
|
||||
public function getView_tax_codes(int $tax_code = NEW_ENTRY): void
|
||||
{
|
||||
$tax_code_info = $this->tax->get_info($tax_code);
|
||||
|
||||
@@ -147,7 +147,7 @@ class Taxes extends Secure_Controller
|
||||
$data['rounding_options'] = rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if($tax_code == -1) //TODO: Replace -1 with constant
|
||||
if($tax_code == NEW_ENTRY)
|
||||
{//TODO: Duplicated code
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
@@ -194,7 +194,7 @@ class Taxes extends Secure_Controller
|
||||
}
|
||||
|
||||
|
||||
public function view(int $tax_rate_id = -1): void //TODO: Replace -1 with constant
|
||||
public function getView(int $tax_rate_id = NEW_ENTRY): void
|
||||
{
|
||||
$tax_rate_info = $this->tax->get_info($tax_rate_id);
|
||||
|
||||
@@ -205,7 +205,7 @@ class Taxes extends Secure_Controller
|
||||
$data['tax_category_options'] = $this->tax_lib->get_tax_category_options();
|
||||
$data['tax_jurisdiction_options'] = $this->tax_lib->get_tax_jurisdiction_options();
|
||||
|
||||
if($tax_rate_id == -1) //TODO: Replace -1 with constant
|
||||
if($tax_rate_id == NEW_ENTRY)
|
||||
{
|
||||
$data['rate_tax_code_id'] = $this->config['default_tax_code'];
|
||||
$data['rate_tax_category_id'] = $this->config['default_tax_category'];
|
||||
@@ -226,7 +226,7 @@ class Taxes extends Secure_Controller
|
||||
echo view('taxes/tax_rates_form', $data);
|
||||
}
|
||||
|
||||
public function view_tax_categories(int $tax_code = -1): void //TODO: Replace -1 with constant //TODO: This appears to be called no where in the code.
|
||||
public function getView_tax_categories(int $tax_code = NEW_ENTRY): void //TODO: This appears to be called no where in the code.
|
||||
{
|
||||
$tax_code_info = $this->tax->get_info($tax_code); //TODO: Duplicated Code
|
||||
|
||||
@@ -247,7 +247,7 @@ class Taxes extends Secure_Controller
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
if($tax_code == -1) //TODO: Replace -1 with constant
|
||||
if($tax_code == NEW_ENTRY)
|
||||
{
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
@@ -293,7 +293,7 @@ class Taxes extends Secure_Controller
|
||||
echo view('taxes/tax_category_form', $data);
|
||||
}
|
||||
|
||||
public function view_tax_jurisdictions(int $tax_code = -1): void //TODO: Replace -1 with constant //TODO: This appears to be called no where in the code.
|
||||
public function getView_tax_jurisdictions(int $tax_code = NEW_ENTRY): void //TODO: This appears to be called no where in the code.
|
||||
{
|
||||
$tax_code_info = $this->tax->get_info($tax_code); //TODO: Duplicated code
|
||||
|
||||
@@ -314,7 +314,7 @@ class Taxes extends Secure_Controller
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
if($tax_code == -1) //TODO: Replace -1 with constant
|
||||
if($tax_code == NEW_ENTRY)
|
||||
{
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
@@ -365,7 +365,7 @@ class Taxes extends Secure_Controller
|
||||
return rounding_mode::get_html_rounding_options();
|
||||
}
|
||||
|
||||
public function save(int $tax_rate_id = -1): void //TODO: Replace -1 with constant
|
||||
public function postSave(int $tax_rate_id = NEW_ENTRY): void
|
||||
{
|
||||
$tax_category_id = $this->request->getPost('rate_tax_category_id', FILTER_SANITIZE_NUMBER_INT);
|
||||
$tax_rate = parse_tax($this->request->getPost('tax_rate', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
|
||||
@@ -385,7 +385,7 @@ class Taxes extends Secure_Controller
|
||||
|
||||
if($this->tax->save_value($tax_rate_data, $tax_rate_id))
|
||||
{
|
||||
if($tax_rate_id == -1) //TODO: Replace -1 with constant
|
||||
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')]);
|
||||
}
|
||||
@@ -400,7 +400,7 @@ class Taxes extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$tax_codes_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -417,7 +417,7 @@ class Taxes extends Secure_Controller
|
||||
* Called in the view.
|
||||
* @return void
|
||||
*/
|
||||
public function suggest_tax_codes(): void
|
||||
public function getSuggestTaxCodes(): void
|
||||
{
|
||||
$suggestions = $this->tax_code->get_tax_codes_search_suggestions($this->request->getPostGet('term', FILTER_SANITIZE_STRING));
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
|
||||
('payment_options_order', 'cashdebitcredit'),
|
||||
('protocol', 'mail'),
|
||||
('mailpath', '/usr/sbin/sendmail'),
|
||||
('smtp_host', ''),
|
||||
('smtp_user', ''),
|
||||
('smtp_pass', ''),
|
||||
('smtp_port', '465'),
|
||||
('smtp_timeout', '5'),
|
||||
('smtp_crypto', 'ssl'),
|
||||
|
||||
@@ -322,17 +322,17 @@ function to_datetime(int $datetime = DEFAULT_DATETIME): string
|
||||
return date($config['dateformat'] . ' ' . $config['timeformat'], $datetime);
|
||||
}
|
||||
|
||||
function to_currency(float $number): string
|
||||
function to_currency(?float $number): string
|
||||
{
|
||||
return to_decimals($number, 'currency_decimals', NumberFormatter::CURRENCY);
|
||||
}
|
||||
|
||||
function to_currency_no_money(float $number): string
|
||||
function to_currency_no_money(?float $number): string
|
||||
{
|
||||
return to_decimals($number, 'currency_decimals');
|
||||
}
|
||||
|
||||
function to_currency_tax(float $number): string
|
||||
function to_currency_tax(?float $number): string
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
@@ -346,8 +346,13 @@ function to_currency_tax(float $number): string
|
||||
}
|
||||
}
|
||||
|
||||
function to_tax_decimals(float $number): string
|
||||
function to_tax_decimals($number): string
|
||||
{
|
||||
// TODO: When the tax array is empty the value passed in is an empty string, For now I "untyped" it to get past
|
||||
// the issue because I don't understand why an empty string is being passed in when I know the array is empty.
|
||||
// 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
|
||||
// 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))
|
||||
@@ -358,18 +363,18 @@ function to_tax_decimals(float $number): string
|
||||
return to_decimals($number, 'tax_decimals');
|
||||
}
|
||||
|
||||
function to_quantity_decimals(float $number): string
|
||||
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
|
||||
if(!isset($number))
|
||||
{
|
||||
return $number;
|
||||
return "";
|
||||
}
|
||||
|
||||
$config = config('OSPOS')->settings;
|
||||
@@ -386,7 +391,11 @@ function to_decimals(float $number, string $decimals = NULL, int $type = NumberF
|
||||
return $fmt->format($number);
|
||||
}
|
||||
|
||||
function parse_quantity(string $number): float
|
||||
/**
|
||||
* @param string $number
|
||||
* @return false|float|int|mixed|string
|
||||
*/
|
||||
function parse_quantity(string $number)
|
||||
{
|
||||
return parse_decimals($number, quantity_decimals());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function show_report(string $report_prefix, string $report_name, string $lang_ke
|
||||
if(!empty($report_label) && $report_label != $lang_key . ' (TBD)') //TODO: String Interpolation. Also !==
|
||||
{//TODO: Is there a better way to do this? breaking the php like this makes it more difficult to read.
|
||||
?>
|
||||
<a class="list-group-item" href="<?= site_url("reports/$report_prefix" . preg_replace('/reports_(.*)/', '$1', $report_name)) ?>"><?= $report_label; ?></a>
|
||||
<a class="list-group-item" href="<?= "reports/$report_prefix" . preg_replace('/reports_(.*)/', '$1', $report_name) ?>"><?= $report_label; ?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ function get_sales_manage_table_headers(): string
|
||||
function get_sale_data_row(object $sale): array
|
||||
{
|
||||
$uri = current_url(true);
|
||||
$controller_name = $uri->getSegment(1);
|
||||
$controller = $uri->getSegment(1);
|
||||
|
||||
$row = [
|
||||
'sale_id' => $sale->sale_id,
|
||||
@@ -114,25 +114,25 @@ function get_sale_data_row(object $sale): array
|
||||
$row['invoice'] = empty($sale->invoice_number)
|
||||
? ''
|
||||
: anchor(
|
||||
$controller_name."/invoice/$sale->sale_id",
|
||||
"$controller/invoice/$sale->sale_id",
|
||||
'<span class="glyphicon glyphicon-list-alt"></span>',
|
||||
['title'=>lang('Sales.show_invoice')]
|
||||
);
|
||||
}
|
||||
|
||||
$row['receipt'] = anchor(
|
||||
$controller_name."/receipt/$sale->sale_id",
|
||||
"$controller/receipt/$sale->sale_id",
|
||||
'<span class="glyphicon glyphicon-usd"></span>',
|
||||
['title' => lang('Sales.show_receipt')]
|
||||
);
|
||||
$row['edit'] = anchor(
|
||||
$controller_name."/edit/$sale->sale_id",
|
||||
"$controller/edit/$sale->sale_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg print_hide',
|
||||
'data-btn-delete' => lang('Common.delete'),
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title' => lang($controller_name . '.update')
|
||||
'title' => lang("$controller.update")
|
||||
]
|
||||
);
|
||||
|
||||
@@ -217,8 +217,7 @@ function get_people_manage_table_headers(): string
|
||||
*/
|
||||
function get_person_data_row(object $person): array
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'people.person_id' => $person->person_id,
|
||||
@@ -238,12 +237,12 @@ function get_person_data_row(object $person): array
|
||||
]
|
||||
),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$person->person_id", //TODO: String interpolation
|
||||
"$controller/view/$person->person_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title'=>lang($controller . '.update') //TODO: String interpolation
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -282,8 +281,7 @@ function get_customer_manage_table_headers(): string
|
||||
*/
|
||||
function get_customer_data_row(object $person, object $stats): array
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'people.person_id' => $person->person_id,
|
||||
@@ -295,7 +293,7 @@ function get_customer_data_row(object $person, object $stats): array
|
||||
'messages' => empty($person->phone_number)
|
||||
? ''
|
||||
: anchor(
|
||||
"Messages/view/$person->person_id", //TODO: String interpolation
|
||||
"Messages/view/$person->person_id",
|
||||
'<span class="glyphicon glyphicon-phone"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
@@ -304,12 +302,12 @@ function get_customer_data_row(object $person, object $stats): array
|
||||
]
|
||||
),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$person->person_id", //TODO: String interpolation
|
||||
"$controller/view/$person->person_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -350,8 +348,7 @@ function get_suppliers_manage_table_headers(): string
|
||||
*/
|
||||
function get_supplier_data_row(object $supplier): array
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'people.person_id' => $supplier->person_id,
|
||||
@@ -374,12 +371,12 @@ function get_supplier_data_row(object $supplier): array
|
||||
]
|
||||
),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$supplier->person_id", //TODO: String interpolation
|
||||
"$controller/view/$supplier->person_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class'=>"modal-dlg",
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -469,8 +466,7 @@ function get_item_data_row(object $item): array
|
||||
$tax_percents = !$tax_percents ? '-' : $tax_percents;
|
||||
}
|
||||
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
$image = NULL;
|
||||
if($item->pic_filename != '') //TODO: !== ?
|
||||
@@ -515,29 +511,29 @@ function get_item_data_row(object $item): array
|
||||
|
||||
$icons = [
|
||||
'inventory' => anchor(
|
||||
$controller_name."/inventory/$item->item_id", //TODO: String interpolation
|
||||
"$controller/inventory/$item->item_id",
|
||||
'<span class="glyphicon glyphicon-pushpin"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title' => lang($controller_name . '.count') //TODO: String interpolation
|
||||
'title' => lang("$controller.count")
|
||||
]
|
||||
),
|
||||
'stock' => anchor(
|
||||
$controller_name."/count_details/$item->item_id", //TODO: String interpolation
|
||||
"$controller/countDetails/$item->item_id",
|
||||
'<span class="glyphicon glyphicon-list-alt"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'title' => lang($controller_name . '.details_count') //TODO: String interpolation
|
||||
'title' => lang("$controller.details_count")
|
||||
]
|
||||
),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$item->item_id", //TODO: String interpolation
|
||||
"$controller/view/$item->item_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title' => lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title' => lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -566,9 +562,7 @@ function get_giftcards_manage_table_headers(): string
|
||||
*/
|
||||
function get_giftcard_data_row(object $giftcard): array
|
||||
{
|
||||
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'giftcard_id' => $giftcard->giftcard_id,
|
||||
@@ -577,12 +571,12 @@ function get_giftcard_data_row(object $giftcard): array
|
||||
'giftcard_number' => $giftcard->giftcard_number,
|
||||
'value' => to_currency($giftcard->value),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$giftcard->giftcard_id", //TODO: String interpolation
|
||||
"$controller/view/$giftcard->giftcard_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -610,9 +604,7 @@ function get_item_kits_manage_table_headers(): string
|
||||
*/
|
||||
function get_item_kit_data_row(object $item_kit): array
|
||||
{
|
||||
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'item_kit_id' => $item_kit->item_kit_id,
|
||||
@@ -622,12 +614,12 @@ function get_item_kit_data_row(object $item_kit): array
|
||||
'total_cost_price' => to_currency($item_kit->total_cost_price),
|
||||
'total_unit_price' => to_currency($item_kit->total_unit_price),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$item_kit->item_kit_id", //TODO: String interpolation
|
||||
"$controller/view/$item_kit->item_kit_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -691,8 +683,7 @@ function get_attribute_definition_data_row(object $attribute): array
|
||||
{
|
||||
|
||||
$attribute = model('Attribute');
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
if(count($attribute->definition_flags) == 0) //TODO: === ?
|
||||
{
|
||||
@@ -714,12 +705,12 @@ function get_attribute_definition_data_row(object $attribute): array
|
||||
'definition_group' => $attribute->definition_group,
|
||||
'definition_flags' => $definition_flags,
|
||||
'edit' => anchor(
|
||||
"$controller_name/view/$attribute->definition_id",
|
||||
"$controller/view/$attribute->definition_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update')
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -744,20 +735,19 @@ function get_expense_category_manage_table_headers(): string
|
||||
*/
|
||||
function get_expense_category_data_row(object $expense_category): array
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'expense_category_id' => $expense_category->expense_category_id,
|
||||
'category_name' => $expense_category->category_name,
|
||||
'category_description' => $expense_category->category_description,
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$expense_category->expense_category_id", //TODO: String interpolation
|
||||
"$controller/view/$expense_category->expense_category_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update') //TODO: String interpolation
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -790,8 +780,7 @@ function get_expenses_manage_table_headers(): string
|
||||
*/
|
||||
function get_expenses_data_row(object $expense): array
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'expense_id' => $expense->expense_id,
|
||||
@@ -805,12 +794,12 @@ function get_expenses_data_row(object $expense): array
|
||||
'description' => $expense->description,
|
||||
'created_by' => $expense->first_name.' '. $expense->last_name,
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$expense->expense_id",
|
||||
"$controller/view/$expense->expense_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update')
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
@@ -887,8 +876,7 @@ function get_cashups_manage_table_headers(): string
|
||||
*/
|
||||
function get_cash_up_data_row(object $cash_up): array
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller = get_controller();
|
||||
|
||||
return [
|
||||
'cashup_id' => $cash_up->cashup_id,
|
||||
@@ -905,13 +893,25 @@ function get_cash_up_data_row(object $cash_up): array
|
||||
'closed_amount_check' => to_currency($cash_up->closed_amount_check),
|
||||
'closed_amount_total' => to_currency($cash_up->closed_amount_total),
|
||||
'edit' => anchor(
|
||||
$controller_name."/view/$cash_up->cashup_id",
|
||||
"$controller/view/$cash_up->cashup_id",
|
||||
'<span class="glyphicon glyphicon-edit"></span>',
|
||||
[
|
||||
'class' => 'modal-dlg',
|
||||
'data-btn-submit' => lang('Common.submit'),
|
||||
'title'=>lang($controller_name . '.update')
|
||||
'title'=>lang("$controller.update")
|
||||
]
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the right-most part of the controller name
|
||||
* @return string
|
||||
*/
|
||||
function get_controller(): string
|
||||
{
|
||||
$router = service('router');
|
||||
$controller_name = strtolower($router->controllerName());
|
||||
$controller_name_parts = explode('\\', $controller_name);
|
||||
return end($controller_name_parts);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class Item_lib
|
||||
return $this->session->get('item_location');
|
||||
}
|
||||
|
||||
public function set_item_location(string $location): void
|
||||
public function set_item_location(?string $location): void
|
||||
{
|
||||
$this->session->set('item_location',$location);
|
||||
}
|
||||
@@ -42,4 +42,4 @@ class Item_lib
|
||||
{
|
||||
$this->session->remove('item_location');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ class Sale_lib
|
||||
* @param string $payment_amount
|
||||
* @param int $cash_adjustment
|
||||
*/
|
||||
public function add_payment(int $payment_id, string $payment_amount, int $cash_adjustment = CASH_ADJUSTMENT_FALSE): void
|
||||
public function add_payment(string $payment_id, string $payment_amount, int $cash_adjustment = CASH_ADJUSTMENT_FALSE): void
|
||||
{
|
||||
$payments = $this->get_payments();
|
||||
if(isset($payments[$payment_id]))
|
||||
@@ -807,7 +807,7 @@ class Sale_lib
|
||||
//make sure item exists
|
||||
if(empty($item_info))
|
||||
{
|
||||
$item_id = -1; //TODO: Replace -1 with constant
|
||||
$item_id = NEW_ENTRY;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -968,6 +968,7 @@ class Sale_lib
|
||||
'tax_category_id' => $item_info->tax_category_id
|
||||
]
|
||||
];
|
||||
|
||||
//add to existing array
|
||||
$items += $item;
|
||||
}
|
||||
@@ -1052,7 +1053,7 @@ class Sale_lib
|
||||
* @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]))
|
||||
|
||||
@@ -72,7 +72,7 @@ class Token_lib
|
||||
return $token_tree;
|
||||
}
|
||||
|
||||
public function parse_barcode(string &$quantity, string &$price, string &$item_id_or_number_or_item_kit_or_receipt): void
|
||||
public function parse_barcode(?string &$quantity, ?string &$price, ?string &$item_id_or_number_or_item_kit_or_receipt): void
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$barcode_formats = json_decode($config['barcode_formats']);
|
||||
|
||||
@@ -150,8 +150,14 @@ class Attribute extends Model
|
||||
/*
|
||||
Performs a search on attribute definitions
|
||||
*/
|
||||
public function search(string $search, int $rows = 0, int $limit_from = 0, string $sort = 'definition.definition_name', string $order = 'asc'): ResultInterface
|
||||
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'definition.definition_name', ?string $order = 'asc'): ResultInterface
|
||||
{
|
||||
// Set default values
|
||||
if($rows == null) $rows = 0;
|
||||
if($limit_from == null) $limit_from = 0;
|
||||
if($sort == null) $sort = 'definition.definition_name';
|
||||
if($order == null) $order = 'asc';
|
||||
|
||||
$builder = $this->db->table('attribute_definitions AS definition');
|
||||
$builder->select('parent_definition.definition_name AS definition_group, definition.*');
|
||||
$builder->join('attribute_definitions AS parent_definition', 'parent_definition.definition_id = definition.definition_fk', 'left');
|
||||
@@ -187,7 +193,7 @@ class Attribute extends Model
|
||||
return $this->to_array($results, 'definition_id');
|
||||
}
|
||||
|
||||
public function get_values_by_definitions(array $definition_ids): array
|
||||
public function get_values_by_definitions(?array $definition_ids): array
|
||||
{
|
||||
if(count($definition_ids ? : []))
|
||||
{
|
||||
@@ -569,18 +575,21 @@ class Attribute extends Model
|
||||
return $builder->delete($delete_data);
|
||||
}
|
||||
|
||||
public function get_link_value(int $item_id, int $definition_id): object
|
||||
public function get_link_value(int $item_id, ?int $definition_id): ?object
|
||||
{
|
||||
$builder = $this->db->table('attribute_links');
|
||||
$builder->where('item_id', $item_id);
|
||||
$builder->where('sale_id', null);
|
||||
$builder->where('receiving_id', null);
|
||||
$builder->where('definition_id', $definition_id);
|
||||
if($definition_id != NULL)
|
||||
{
|
||||
$builder->where('definition_id', $definition_id);
|
||||
}
|
||||
|
||||
return $builder->get('attribute_links')->getRowObject();
|
||||
}
|
||||
|
||||
public function get_link_values(int $item_id, string $sale_receiving_fk, int $id, int $definition_flags): ResultInterface
|
||||
public function get_link_values(int $item_id, string $sale_receiving_fk, ?int $id, ?int $definition_flags): ResultInterface
|
||||
{
|
||||
$format = $this->db->escape(dateformat_mysql());
|
||||
|
||||
@@ -603,7 +612,10 @@ class Attribute extends Model
|
||||
$builder->where('receiving_id', null);
|
||||
}
|
||||
|
||||
$builder->where('definition_flags & ', $definition_flags);
|
||||
if(!empty($id))
|
||||
{
|
||||
$builder->where('definition_flags & ', $definition_flags);
|
||||
}
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class Cashup extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'cashup_id', 'asc', TRUE);
|
||||
}
|
||||
@@ -79,8 +79,15 @@ class Cashup extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$config = config('OSPOS')->settings;
|
||||
$builder = $this->db->table('cash_up AS cash_up');
|
||||
|
||||
@@ -208,9 +215,9 @@ class Cashup extends Model
|
||||
/**
|
||||
* Inserts or updates a cashup
|
||||
*/
|
||||
public function save_value(array &$cash_up_data, $cashup_id = FALSE): bool
|
||||
public function save_value(array &$cash_up_data, $cashup_id = NEW_ENTRY): bool
|
||||
{
|
||||
if(!$cashup_id == -1 || !$this->exists($cashup_id)) //TODO: Replace -1 with constant
|
||||
if(!$cashup_id == NEW_ENTRY || !$this->exists($cashup_id))
|
||||
{
|
||||
$builder = $this->db->table('cash_up');
|
||||
if($builder->insert($cash_up_data))
|
||||
|
||||
@@ -38,7 +38,6 @@ class Customer extends Person
|
||||
$builder = $this->db->table('customers');
|
||||
$builder->join('people', 'people.person_id = customers.person_id');
|
||||
$builder->where('customers.person_id', $person_id);
|
||||
|
||||
return ($builder->get()->getNumRows() == 1);
|
||||
}
|
||||
|
||||
@@ -103,20 +102,40 @@ class Customer extends Person
|
||||
}
|
||||
else
|
||||
{
|
||||
//Get empty base parent object, as $customer_id is NOT a customer
|
||||
$person_obj = parent::get_info(-1); //TODO: NEED TO CREATE A GLOBAL CONSTANT FOR NO_PERSON IN CONFIG/CONSTANTS.PHP AND CALL IT HERE FOR CLARITY.
|
||||
|
||||
//Get all the fields from customer table
|
||||
//append those fields to base parent object, we have a complete empty object
|
||||
foreach($this->db->getFieldNames('customers') as $field)
|
||||
{
|
||||
$person_obj->$field = '';
|
||||
}
|
||||
|
||||
return $person_obj;
|
||||
return $this->getEmptyObject('customers');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an empty object based on database definitions
|
||||
* @param string $table_name
|
||||
* @return object
|
||||
*/
|
||||
private function getEmptyObject(string $table_name): object
|
||||
{
|
||||
// Return an empty base parent object, as $item_id is NOT an item
|
||||
$empty_obj = parent::get_info(NEW_ENTRY);
|
||||
|
||||
// Iterate through field definitions to determine how the fields should be initialized
|
||||
|
||||
foreach($this->db->getFieldData($table_name) as $field) {
|
||||
|
||||
$field_name = $field->name;
|
||||
|
||||
if(in_array($field->type, array('int', 'tinyint', 'decimal')))
|
||||
{
|
||||
$empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$empty_obj->$field_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return $empty_obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets stats about a particular customer
|
||||
*/
|
||||
@@ -206,7 +225,7 @@ class Customer extends Person
|
||||
/**
|
||||
* Inserts or updates a customer
|
||||
*/
|
||||
public function save_customer(array &$person_data, array &$customer_data, bool $customer_id = FALSE): bool
|
||||
public function save_customer(array &$person_data, array &$customer_data, int $customer_id = NEW_ENTRY): bool
|
||||
{
|
||||
$success = FALSE;
|
||||
|
||||
@@ -215,7 +234,7 @@ class Customer extends Person
|
||||
if(parent::save_value($person_data, $customer_id))
|
||||
{
|
||||
$builder = $this->db->table('customers');
|
||||
if(!$customer_id || !$this->exists($customer_id))
|
||||
if($customer_id == NEW_ENTRY || !$customer_id || !$this->exists($customer_id))
|
||||
{
|
||||
$customer_data['person_id'] = $person_data['person_id'];
|
||||
$success = $builder->insert($customer_data);
|
||||
@@ -398,16 +417,24 @@ class Customer extends Person
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $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;
|
||||
|
||||
$builder = $this->db->table('customers AS customers');
|
||||
|
||||
// get_found_rows case
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Database\ResultInterface;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\Session\Session;
|
||||
|
||||
/**
|
||||
@@ -96,13 +95,13 @@ class Employee extends Person
|
||||
}
|
||||
|
||||
//Get empty base parent object, as $employee_id is NOT an employee
|
||||
$person_obj = parent::get_info(-1); //TODO: Replace -1 with a constant
|
||||
$person_obj = parent::get_info(NEW_ITEM);
|
||||
|
||||
//Get all the fields from employee table
|
||||
//append those fields to base parent object, we have a complete empty object
|
||||
foreach($this->db->getFieldNames('employees') as $field)
|
||||
{
|
||||
$person_obj->$field = '';
|
||||
$person_obj->$field = null;
|
||||
}
|
||||
|
||||
return $person_obj;
|
||||
@@ -124,7 +123,7 @@ class Employee extends Person
|
||||
/**
|
||||
* Inserts or updates an employee
|
||||
*/
|
||||
public function save_employee(array &$person_data, array &$employee_data, array &$grants_data, bool $employee_id = FALSE): bool
|
||||
public function save_employee(array &$person_data, array &$employee_data, array &$grants_data, int $employee_id = NEW_ENTRY): bool
|
||||
{
|
||||
$success = FALSE;
|
||||
|
||||
@@ -134,7 +133,7 @@ class Employee extends Person
|
||||
if(ENVIRONMENT != 'testing' && parent::save_value($person_data, $employee_id))
|
||||
{
|
||||
$builder = $this->db->table('employees');
|
||||
if(!$employee_id || !$this->exists($employee_id))
|
||||
if($employee_id == NEW_ENTRY || !$this->exists($employee_id))
|
||||
{
|
||||
$employee_data['person_id'] = $employee_id = $person_data['person_id'];
|
||||
$success = $builder->insert($employee_data);
|
||||
@@ -328,7 +327,7 @@ class Employee extends Person
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
}
|
||||
@@ -336,8 +335,15 @@ class Employee extends Person
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('employees AS employees');
|
||||
|
||||
// get_found_rows case
|
||||
@@ -408,7 +414,7 @@ class Employee extends Person
|
||||
/**
|
||||
* Logs out a user by destroying all session data and redirect to log in
|
||||
*/
|
||||
public function logout()
|
||||
public function logout(): void
|
||||
{
|
||||
session()->destroy();
|
||||
}
|
||||
@@ -466,13 +472,17 @@ class Employee extends Person
|
||||
/**
|
||||
* Determines whether the employee specified employee has access the specific module.
|
||||
*/
|
||||
public function has_grant(string $permission_id, int $person_id): bool
|
||||
public function has_grant(?string $permission_id, ?int $person_id): bool
|
||||
{
|
||||
//if no module_id is null, allow access
|
||||
if($permission_id == NULL)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if($person_id == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$builder = $this->db->table('grants');
|
||||
$query = $builder->getWhere(['person_id' => $person_id, 'permission_id' => $permission_id], 1);
|
||||
|
||||
@@ -79,7 +79,7 @@ class Expense extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'expense_id', 'asc', TRUE);
|
||||
}
|
||||
@@ -87,8 +87,15 @@ class Expense extends Model
|
||||
/**
|
||||
* Searches expenses
|
||||
*/
|
||||
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): ResultInterface
|
||||
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;
|
||||
|
||||
$config = config('OSPOS')->settings;
|
||||
$builder = $this->db->table('expenses AS expenses');
|
||||
|
||||
@@ -220,35 +227,56 @@ class Expense extends Model
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
if($query->getNumRows() == 1) //TODO: ===
|
||||
if ($query->getNumRows() == 1) //TODO: ===
|
||||
{
|
||||
return $query->getRow();
|
||||
}
|
||||
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.
|
||||
{
|
||||
//Get empty base parent object
|
||||
$expenses_obj = new stdClass();
|
||||
|
||||
//Get all the fields from expenses table
|
||||
foreach($this->db->getFieldNames('expenses') as $field)
|
||||
$empty_obj = $this->getEmptyObject('expenses');
|
||||
$empty_obj->supplier_name = NULL;
|
||||
$empty_obj->first_name = NULL;
|
||||
$empty_obj->last_name = NULL;
|
||||
|
||||
return $empty_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an empty object based on database definitions
|
||||
* @param string $table_name
|
||||
* @return object
|
||||
*/
|
||||
private function getEmptyObject(string $table_name): object
|
||||
{
|
||||
// Return an empty base parent object, as $item_id is NOT an item
|
||||
$empty_obj = new stdClass();
|
||||
|
||||
// Iterate through field definitions to determine how the fields should be initialized
|
||||
|
||||
foreach($this->db->getFieldData($table_name) as $field) {
|
||||
|
||||
$field_name = $field->name;
|
||||
|
||||
if(in_array($field->type, array('int', 'tinyint', 'decimal')))
|
||||
{
|
||||
$expenses_obj->$field = '';
|
||||
$empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$empty_obj->$field_name = NULL;
|
||||
}
|
||||
|
||||
$expenses_obj->supplier_name = '';
|
||||
|
||||
return $expenses_obj;
|
||||
}
|
||||
|
||||
return $empty_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts or updates an expense
|
||||
*/
|
||||
public function save_value(array &$expense_data, bool $expense_id = FALSE): bool
|
||||
public function save_value(array &$expense_data, int $expense_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('expenses');
|
||||
|
||||
if(!$expense_id || !$this->exists($expense_id))
|
||||
if($expense_id == NEW_ENTRY || !$this->exists($expense_id))
|
||||
{
|
||||
if($builder->insert($expense_data))
|
||||
{
|
||||
|
||||
@@ -109,11 +109,11 @@ class Expense_category extends Model
|
||||
/**
|
||||
* Inserts or updates an expense_category
|
||||
*/
|
||||
public function save_value(array &$expense_category_data, bool $expense_category_id = FALSE): bool
|
||||
public function save_value(array &$expense_category_data, int $expense_category_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('expense_categories');
|
||||
|
||||
if(!$expense_category_id || !$this->exists($expense_category_id))
|
||||
if($expense_category_id == NEW_ENTRY || !$this->exists($expense_category_id))
|
||||
{
|
||||
if($builder->insert($expense_category_data))
|
||||
{
|
||||
@@ -144,7 +144,7 @@ class Expense_category extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'category_name', 'asc', TRUE);
|
||||
}
|
||||
@@ -152,8 +152,15 @@ class Expense_category extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('expense_categories AS expense_categories');
|
||||
|
||||
// get_found_rows case
|
||||
|
||||
@@ -36,13 +36,13 @@ class Giftcard extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets max gift card number //TODO: This isn't entirely accurate. It returns the object and the results then pulls the giftcard_number.
|
||||
* Gets max gift card number //TODO: This isn't entirely accurate. It returns the object and the results then pulls the giftcard_number
|
||||
*/
|
||||
public function get_max_number(): object
|
||||
public function get_max_number(): ?object
|
||||
{
|
||||
$builder = $this->db->table('giftcards');
|
||||
$builder->select('CAST(giftcard_number AS UNSIGNED) AS giftcard_number');
|
||||
$builder->where('giftcard_number REGEXP', "'^[0-9]+$'", FALSE);
|
||||
$builder->where('giftcard_number REGEXP \'^[0-9]+$\' = 0');
|
||||
$builder->orderBy("giftcard_number","desc");
|
||||
$builder->limit(1);
|
||||
|
||||
@@ -78,19 +78,39 @@ class Giftcard extends Model
|
||||
}
|
||||
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.
|
||||
{
|
||||
//Get empty base parent object, as $giftcard_id is NOT a giftcard
|
||||
$giftcard_obj = new stdClass();
|
||||
|
||||
//Get all the fields from giftcards table
|
||||
foreach($this->db->getFieldNames('giftcards') as $field)
|
||||
{
|
||||
$giftcard_obj->$field = '';
|
||||
}
|
||||
|
||||
return $giftcard_obj;
|
||||
return $this->getEmptyObject('giftcards');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an empty object based on database definitions
|
||||
* @param string $table_name
|
||||
* @return object
|
||||
*/
|
||||
private function getEmptyObject(string $table_name): object
|
||||
{
|
||||
// Return an empty base parent object, as $item_id is NOT an item
|
||||
$empty_obj = new stdClass();
|
||||
|
||||
// Iterate through field definitions to determine how the fields should be initialized
|
||||
|
||||
foreach($this->db->getFieldData($table_name) as $field) {
|
||||
|
||||
$field_name = $field->name;
|
||||
|
||||
if(in_array($field->type, array('int', 'tinyint', 'decimal')))
|
||||
{
|
||||
$empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$empty_obj->$field_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return $empty_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a giftcard id given a giftcard number
|
||||
*/
|
||||
@@ -126,11 +146,11 @@ class Giftcard extends Model
|
||||
/**
|
||||
* Inserts or updates a giftcard
|
||||
*/
|
||||
public function save_value(array &$giftcard_data, $giftcard_id = FALSE): bool
|
||||
public function save_value(array &$giftcard_data, int $giftcard_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('giftcards');
|
||||
|
||||
if(!$giftcard_id || !$this->exists($giftcard_id))
|
||||
if($giftcard_id == NEW_ENTRY || !$this->exists($giftcard_id))
|
||||
{
|
||||
if($builder->insert($giftcard_data))
|
||||
{
|
||||
@@ -225,7 +245,7 @@ class Giftcard extends Model
|
||||
/**
|
||||
* Gets gift cards
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'giftcard_number', 'asc', TRUE);
|
||||
}
|
||||
@@ -233,14 +253,28 @@ class Giftcard extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
$builder = $this->db->table('giftcards');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only) //TODO: replace this with `if($count_only)`
|
||||
{
|
||||
$builder->select('COUNT(giftcards.giftcard_id) as count');
|
||||
$builder->select('COUNT(giftcard_id) as count');
|
||||
}
|
||||
|
||||
$builder->join('people AS person', 'giftcards.person_id = person.person_id', 'left');
|
||||
@@ -254,7 +288,7 @@ class Giftcard extends Model
|
||||
$builder->where('giftcards.deleted', 0);
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only) //TODO: replace this with `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
|
||||
@@ -42,27 +42,21 @@ class Item extends Model
|
||||
'hsn_code'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Determines if a given item_id is an item
|
||||
*/
|
||||
public function exists(int $item_id, bool $ignore_deleted = FALSE, bool $deleted = FALSE): bool
|
||||
{
|
||||
// check if $item_id is a number and not a string starting with 0
|
||||
// because cases like 00012345 will be seen as a number where it is a barcode
|
||||
if(ctype_digit($item_id) && substr($item_id, 0, 1) !== '0')
|
||||
$builder = $this->db->table('items');
|
||||
$builder->where('item_id', $item_id);
|
||||
|
||||
if($ignore_deleted === FALSE)
|
||||
{
|
||||
$builder = $this->db->table('items');
|
||||
$builder->where('item_id', $item_id);
|
||||
|
||||
if($ignore_deleted === FALSE)
|
||||
{
|
||||
$builder->where('deleted', $deleted);
|
||||
}
|
||||
|
||||
return ($builder->get()->getNumRows() === 1);
|
||||
$builder->where('deleted', $deleted);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return ($builder->get()->getNumRows() === 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,15 +73,16 @@ class Item extends Model
|
||||
|
||||
$builder = $this->db->table('items');
|
||||
$builder->where('item_number', $item_number);
|
||||
$builder->where('deleted !=', 1);
|
||||
$builder->where('item_id !=', intval($item_id));
|
||||
|
||||
// check if $item_id is a number and not a string starting with 0
|
||||
// because cases like 00012345 will be seen as a number where it is a barcode
|
||||
// // check if $item_id is a number and not a string starting with 0
|
||||
// // because cases like 00012345 will be seen as a number where it is a barcode
|
||||
if(ctype_digit($item_id) && substr($item_id, 0, 1) != '0') //TODO: !==
|
||||
{
|
||||
$builder->where('item_id !=', intval($item_id));
|
||||
}
|
||||
|
||||
return ($builder->get()->getNumRows() >= 1);
|
||||
return ($builder->get()->getNumRows()) >= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +107,7 @@ class Item extends Model
|
||||
/**
|
||||
* Get number of rows
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'items.name', 'asc', TRUE);
|
||||
}
|
||||
@@ -120,8 +115,15 @@ class Item extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$config = config('OSPOS')->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
|
||||
|
||||
@@ -273,11 +275,11 @@ class Item extends Model
|
||||
/**
|
||||
* Returns all the items
|
||||
*/
|
||||
public function get_all(int $stock_location_id = -1, int $rows = 0, int $limit_from = 0): ResultInterface //TODO: Replace -1 with a constant
|
||||
public function get_all(int $stock_location_id = NEW_ENTRY, int $rows = 0, int $limit_from = 0): ResultInterface
|
||||
{
|
||||
$builder = $this->db->table('items');
|
||||
|
||||
if($stock_location_id > -1) //TODO: Replace -1 with a constant
|
||||
if($stock_location_id > -1)
|
||||
{
|
||||
$builder->join('item_quantities', 'item_quantities.item_id = items.item_id');
|
||||
$builder->where('location_id', $stock_location_id);
|
||||
@@ -318,16 +320,36 @@ class Item extends Model
|
||||
return $query->getRow();
|
||||
}
|
||||
|
||||
//Get empty base parent object, as $item_id is NOT an item
|
||||
$item_obj = new stdClass();
|
||||
return $this->getEmptyObject('items');
|
||||
}
|
||||
|
||||
//Get all the fields from items table
|
||||
foreach($this->db->getFieldNames('items') as $field)
|
||||
{
|
||||
$item_obj->$field = '';
|
||||
/**
|
||||
* Initializes an empty object based on database definitions
|
||||
* @param string $table_name
|
||||
* @return object
|
||||
*/
|
||||
private function getEmptyObject(string $table_name): object
|
||||
{
|
||||
// Return an empty base parent object, as $item_id is NOT an item
|
||||
$empty_obj = new stdClass();
|
||||
|
||||
// Iterate through field definitions to determine how the fields should be initialized
|
||||
|
||||
foreach($this->db->getFieldData($table_name) as $field) {
|
||||
|
||||
$field_name = $field->name;
|
||||
|
||||
if(in_array($field->type, array('int', 'tinyint', 'decimal')))
|
||||
{
|
||||
$empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$empty_obj->$field_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return $item_obj;
|
||||
return $empty_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +363,7 @@ class Item extends Model
|
||||
|
||||
// check if $item_id is a number and not a string starting with 0
|
||||
// because cases like 00012345 will be seen as a number where it is a barcode
|
||||
if(ctype_digit($item_id) && substr($item_id, 0, 1) != '0')
|
||||
if(ctype_digit(strval($item_id)) && substr($item_id, 0, 1) != '0')
|
||||
{
|
||||
$builder->orWhere('items.item_id', $item_id);
|
||||
}
|
||||
@@ -422,16 +444,16 @@ class Item extends Model
|
||||
/**
|
||||
* Inserts or updates an item
|
||||
*/
|
||||
public function save_value(array &$item_data, bool $item_id = FALSE): bool //TODO: need to bring this in line with parent or change the name
|
||||
public function save_value(array &$item_data, int $item_id = NEW_ENTRY): bool //TODO: need to bring this in line with parent or change the name
|
||||
{
|
||||
$builder = $this->db->table('items');
|
||||
|
||||
if(!$item_id || !$this->exists($item_id, TRUE))
|
||||
if($item_id == NEW_ENTRY || !$this->exists($item_id, TRUE))
|
||||
{
|
||||
if($builder->insert($item_data))
|
||||
{
|
||||
$item_data['item_id'] = $this->db->insertID();
|
||||
if($item_data['low_sell_item_id'] == -1) //TODO: Replace -1 with a constant... === ?
|
||||
if($item_data['low_sell_item_id'] == NEW_ENTRY)
|
||||
{
|
||||
$builder = $this->db->table('items');
|
||||
$builder->where('item_id', $item_data['item_id']);
|
||||
@@ -469,7 +491,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();
|
||||
|
||||
|
||||
@@ -167,10 +167,10 @@ class Item_kit extends Model
|
||||
/**
|
||||
* Inserts or updates an item kit
|
||||
*/
|
||||
public function save_value(array &$item_kit_data, bool $item_kit_id = FALSE): bool
|
||||
public function save_value(array &$item_kit_data, int $item_kit_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('item_kits');
|
||||
if(!$item_kit_id || !$this->exists($item_kit_id))
|
||||
if($item_kit_id == NEW_ENTRY || !$this->exists($item_kit_id))
|
||||
{
|
||||
if($builder->insert($item_kit_data))
|
||||
{
|
||||
@@ -249,7 +249,7 @@ class Item_kit extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'name', 'asc', TRUE);
|
||||
}
|
||||
@@ -257,14 +257,21 @@ class Item_kit extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
public function search(string $search, ?int $rows = 0, ?int $limit_from = 0, ?string $sort = 'name', ?string $order = 'asc', ?bool $count_only = FALSE)
|
||||
{
|
||||
$builder = $this->db->table('item_kits AS item_kits'); //TODO: Can we just say 'item_kits' here?
|
||||
// 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;
|
||||
|
||||
$builder = $this->db->table('item_kits');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(item_kits.item_kit_id) as count');
|
||||
$builder->select('COUNT(item_kit_id) as count');
|
||||
}
|
||||
|
||||
$builder->like('name', $search);
|
||||
|
||||
@@ -92,18 +92,40 @@ class Person extends Model
|
||||
}
|
||||
else
|
||||
{
|
||||
//create object with empty properties.
|
||||
$person_obj = new stdClass();
|
||||
|
||||
foreach($this->db->getFieldNames('people') as $field)
|
||||
{
|
||||
$person_obj->$field = '';
|
||||
}
|
||||
|
||||
return $person_obj;
|
||||
return $this->getEmptyObject('people');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes an empty object based on database definitions
|
||||
* @param string $table_name
|
||||
* @return object
|
||||
*/
|
||||
private function getEmptyObject(string $table_name): object
|
||||
{
|
||||
// Return an empty base parent object, as $item_id is NOT an item
|
||||
$empty_obj = new stdClass();
|
||||
|
||||
// Iterate through field definitions to determine how the fields should be initialized
|
||||
|
||||
foreach($this->db->getFieldData($table_name) as $field) {
|
||||
|
||||
$field_name = $field->name;
|
||||
|
||||
if(in_array($field->type, array('int', 'tinyint', 'decimal')))
|
||||
{
|
||||
$empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$empty_obj->$field_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return $empty_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about people as an array of rows
|
||||
*
|
||||
@@ -126,11 +148,11 @@ class Person extends Model
|
||||
* @param bool $person_id identifier of the person to update the information
|
||||
* @return boolean TRUE if the save was successful, FALSE if not
|
||||
*/
|
||||
public function save_value(array &$person_data, bool $person_id = FALSE): bool
|
||||
public function save_value(array &$person_data, int $person_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('people');
|
||||
|
||||
if(!$person_id || !$this->exists($person_id))
|
||||
if($person_id == NEW_ENTRY || !$this->exists($person_id))
|
||||
{
|
||||
if($builder->insert($person_data))
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ class Receiving extends Model
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function save_value(array $items, int $supplier_id, int $employee_id, string $comment, string $reference, string $payment_type, bool $receiving_id = FALSE): int //TODO: $receiving_id gets overwritten before it's evaluated. It doesn't make sense to pass this here.
|
||||
public function save_value(array $items, int $supplier_id, int $employee_id, string $comment, string $reference, string $payment_type, int $receiving_id = NEW_ENTRY): int //TODO: $receiving_id gets overwritten before it's evaluated. It doesn't make sense to pass this here.
|
||||
{
|
||||
$attribute = model(Attribute::class);
|
||||
$inventory = model('Inventory');
|
||||
|
||||
@@ -118,7 +118,7 @@ class Sale extends Model
|
||||
/**
|
||||
* Get number of rows for the takings (sales/manage) view
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'sales.sale_time', 'desc', TRUE);
|
||||
}
|
||||
@@ -126,8 +126,15 @@ class Sale extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// Pick up only non-suspended records
|
||||
@@ -585,7 +592,7 @@ class Sale extends Model
|
||||
$cash_adjustment = $payment['cash_adjustment'];
|
||||
$employee_id = $payment['employee_id'];
|
||||
|
||||
if($payment_id == -1 && $payment_amount != 0)
|
||||
if($payment_id == NEW_ENTRY && $payment_amount != 0)
|
||||
{
|
||||
// Add a new payment transaction
|
||||
$sales_payments_data = [
|
||||
@@ -598,7 +605,7 @@ class Sale extends Model
|
||||
];
|
||||
$success = $builder->insert($sales_payments_data);
|
||||
}
|
||||
elseif($payment_id != -1)
|
||||
elseif($payment_id != NEW_ENTRY)
|
||||
{
|
||||
if($payment_amount != 0)
|
||||
{
|
||||
@@ -644,7 +651,7 @@ class Sale extends Model
|
||||
$item = model(Item::class);
|
||||
$item_quantity = model(Item_quantity::class);
|
||||
|
||||
if($sale_id != -1)
|
||||
if($sale_id != NEW_ENTRY)
|
||||
{
|
||||
$this->clear_suspended_sale_detail($sale_id);
|
||||
}
|
||||
@@ -674,7 +681,7 @@ class Sale extends Model
|
||||
|
||||
$builder = $this->db->table('sales');
|
||||
|
||||
if($sale_id == -1) //TODO: I think we have a constant for this and the -1 needs to be replaced with the constant in constants.php... something like NEW_SALE
|
||||
if($sale_id == NEW_ENTRY)
|
||||
{
|
||||
$builder->insert($sales_data);
|
||||
$sale_id = $this->db->insertID();
|
||||
@@ -788,7 +795,7 @@ class Sale extends Model
|
||||
$attribute->copy_attribute_links($item_data['item_id'], 'sale_id', $sale_id);
|
||||
}
|
||||
|
||||
if($customer_id == -1 || $customer->taxable) //TODO: Need a NEW_CUSTOMER constant in constants.php instead of -1
|
||||
if($customer_id == NEW_ENTRY || $customer->taxable)
|
||||
{
|
||||
$this->save_sales_tax($sale_id, $sales_taxes[0]);
|
||||
$this->save_sales_items_taxes($sale_id, $sales_taxes[1]);
|
||||
@@ -1334,7 +1341,7 @@ class Sale extends Model
|
||||
*/
|
||||
public function get_all_suspended(int $customer_id = NULL): array
|
||||
{
|
||||
if($customer_id == -1) //TODO: This should be converted to a global constant and stored in constants.php
|
||||
if($customer_id == NEW_ENTRY)
|
||||
{
|
||||
$query = $this->db->query("SELECT sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' THEN quote_number WHEN sale_type = '".SALE_TYPE_WORK_ORDER."' THEN work_order_number else sale_id end as doc_id, sale_id as suspended_sale_id, sale_status, sale_time, dinner_table_id, customer_id, employee_id, comment FROM "
|
||||
. $this->db->prefixTable('sales') . ' where sale_status = ' . SUSPENDED);
|
||||
@@ -1353,7 +1360,7 @@ class Sale extends Model
|
||||
*/
|
||||
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 == -1)
|
||||
if($sale_id == NEW_ENTRY)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class Stock_location extends Model
|
||||
|
||||
$this->session = session();
|
||||
}
|
||||
public function exists(int $location_id = -1): bool //TODO: Replace -1 with a constant
|
||||
public function exists(int $location_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('stock_locations');
|
||||
$builder->where('location_id', $location_id);
|
||||
|
||||
@@ -81,7 +81,7 @@ class Supplier extends Person
|
||||
else
|
||||
{
|
||||
//Get empty base parent object, as $supplier_id is NOT a supplier
|
||||
$person_obj = parent::get_info(-1); //TODO: need to replace with a constant instead of -1
|
||||
$person_obj = parent::get_info(NEW_ENTRY);
|
||||
|
||||
//Get all the fields from supplier table
|
||||
//append those fields to base parent object, we have a complete empty object
|
||||
@@ -110,7 +110,7 @@ class Supplier extends Person
|
||||
/**
|
||||
* Inserts or updates a suppliers
|
||||
*/
|
||||
public function save_supplier(array &$person_data, array &$supplier_data, bool $supplier_id = FALSE): bool
|
||||
public function save_supplier(array &$person_data, array &$supplier_data, int $supplier_id = NEW_ENTRY): bool
|
||||
{
|
||||
$success = FALSE;
|
||||
|
||||
@@ -120,7 +120,7 @@ class Supplier extends Person
|
||||
if(parent::save_value($person_data,$supplier_id))
|
||||
{
|
||||
$builder = $this->db->table('suppliers');
|
||||
if(!$supplier_id || !$this->exists($supplier_id))
|
||||
if($supplier_id == NEW_ENTRY || !$this->exists($supplier_id))
|
||||
{
|
||||
$supplier_data['person_id'] = $person_data['person_id'];
|
||||
$success = $builder->insert($supplier_data);
|
||||
@@ -255,7 +255,7 @@ class Supplier extends Person
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
}
|
||||
@@ -263,8 +263,15 @@ class Supplier extends Person
|
||||
/**
|
||||
* Perform a search on suppliers
|
||||
*/
|
||||
public function search(string $search, int $rows = 0, int $limit_from = 0, string $sort = 'last_name', string $order = 'asc', bool $count_only = FALSE): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('suppliers AS suppliers');
|
||||
|
||||
//get_found_rows case
|
||||
|
||||
@@ -163,10 +163,10 @@ class Tax extends Model
|
||||
/**
|
||||
Inserts or updates a tax_rates entry
|
||||
*/
|
||||
public function save_value(array &$tax_rate_data, int $tax_rate_id = -1): bool //TODO: the default value for $tax_rate_id should be made a constant and replaced here.
|
||||
public function save_value(array &$tax_rate_data, int $tax_rate_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('tax_rates');
|
||||
if(!$this->exists($tax_rate_id))
|
||||
if($tax_rate_id == NEW_ENTRY || !$this->exists($tax_rate_id))
|
||||
{
|
||||
if($builder->insert($tax_rate_data))
|
||||
{
|
||||
@@ -212,7 +212,7 @@ class Tax extends Model
|
||||
/**
|
||||
* Gets tax_codes
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE);
|
||||
}
|
||||
@@ -220,8 +220,15 @@ class Tax extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('tax_rates');
|
||||
|
||||
// get_found_rows case
|
||||
|
||||
@@ -109,11 +109,11 @@ class Tax_category extends Model
|
||||
/**
|
||||
* Inserts or updates a row
|
||||
*/
|
||||
public function save_value(array &$tax_category_data, bool $tax_category_id = FALSE): bool
|
||||
public function save_value(array &$tax_category_data, int $tax_category_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('tax_categories');
|
||||
|
||||
if(!$tax_category_id || !$this->exists($tax_category_id))
|
||||
if($tax_category_id == NEW_ENTRY || !$this->exists($tax_category_id))
|
||||
{
|
||||
if($builder->insert($tax_category_data))
|
||||
{
|
||||
@@ -150,7 +150,7 @@ class Tax_category extends Model
|
||||
|
||||
$this->save_value($tax_category_data, $value['tax_category_id']);
|
||||
|
||||
if($value['tax_category_id'] == -1) //TODO: -1 should be converted into a constant for code readability. Perhaps NO_TAX_CATEGORY?
|
||||
if($value['tax_category_id'] == NEW_ENTRY)
|
||||
{
|
||||
$not_to_delete[] = $tax_category_data['tax_category_id'];
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class Tax_category extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'tax_category', 'asc', TRUE);
|
||||
}
|
||||
@@ -208,8 +208,15 @@ class Tax_category extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('tax_categories AS tax_categories');
|
||||
|
||||
// get_found_rows case
|
||||
@@ -263,7 +270,7 @@ class Tax_category extends Model
|
||||
{
|
||||
return [
|
||||
'0' => [
|
||||
'tax_category_id' => -1, //TODO: This should probably be a Constant instead of -1
|
||||
'tax_category_id' => NEW_ENTRY,
|
||||
'tax_category' => '',
|
||||
'tax_group_sequence' => '',
|
||||
'deleted' => ''
|
||||
|
||||
@@ -48,15 +48,18 @@ class Tax_code extends Model
|
||||
/**
|
||||
* Gets information about the particular record
|
||||
*/
|
||||
public function get_info(int $tax_code_id): object
|
||||
public function get_info(?int $tax_code_id): object
|
||||
{
|
||||
$builder = $this->db->table('tax_codes');
|
||||
if($tax_code_id != null)
|
||||
{
|
||||
$builder = $this->db->table('tax_codes');
|
||||
|
||||
$builder->where('tax_code_id', $tax_code_id);
|
||||
$builder->where('deleted', 0);
|
||||
$query = $builder->get();
|
||||
$builder->where('tax_code_id', $tax_code_id);
|
||||
$builder->where('deleted', 0);
|
||||
$query = $builder->get();
|
||||
}
|
||||
|
||||
if($query->getNumRows() == 1) //TODO: ===
|
||||
if($tax_code_id != null && $query->getNumRows() === 1)
|
||||
{
|
||||
return $query->getRow();
|
||||
}
|
||||
@@ -68,7 +71,7 @@ class Tax_code extends Model
|
||||
//Get all the fields from the table
|
||||
foreach($this->db->getFieldNames('tax_codes') as $field)
|
||||
{
|
||||
$tax_code_obj->$field = '';
|
||||
$tax_code_obj->$field = null;
|
||||
}
|
||||
return $tax_code_obj;
|
||||
}
|
||||
@@ -191,7 +194,7 @@ class Tax_code extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE);
|
||||
}
|
||||
@@ -199,8 +202,15 @@ class Tax_code extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('tax_codes AS tax_codes');
|
||||
|
||||
// get_found_rows case
|
||||
@@ -303,7 +313,7 @@ class Tax_code extends Model
|
||||
{
|
||||
return [
|
||||
'0' => [
|
||||
'tax_code_id' => -1,
|
||||
'tax_code_id' => NEW_ENTRY,
|
||||
'tax_code' => '',
|
||||
'tax_code_name' => '',
|
||||
'city' => '',
|
||||
|
||||
@@ -113,10 +113,10 @@ class Tax_jurisdiction extends Model
|
||||
/**
|
||||
* Inserts or updates a row
|
||||
*/
|
||||
public function save_value(array &$jurisdiction_data, bool $jurisdiction_id = FALSE): bool
|
||||
public function save_value(array &$jurisdiction_data, int $jurisdiction_id = NEW_ENTRY): bool
|
||||
{
|
||||
$builder = $this->db->table('tax_jurisdictions');
|
||||
if(!$jurisdiction_id || !$this->exists($jurisdiction_id))
|
||||
if($jurisdiction_id == NEW_ENTRY || !$this->exists($jurisdiction_id))
|
||||
{
|
||||
if($builder->insert($jurisdiction_data)) //TODO: Replace this with simply a return of the result of insert()... see update() below.
|
||||
{
|
||||
@@ -155,7 +155,7 @@ class Tax_jurisdiction extends Model
|
||||
|
||||
$this->save_value($tax_jurisdiction_data, $value['jurisdiction_id']);
|
||||
|
||||
if($value['jurisdiction_id'] == -1) //TODO: replace -1 with a constant. Also === ?. Also replace this with ternary notation.
|
||||
if($value['jurisdiction_id'] == NEW_ENTRY)
|
||||
{
|
||||
$not_to_delete[] = $tax_jurisdiction_data['jurisdiction_id'];
|
||||
}
|
||||
@@ -205,7 +205,7 @@ class Tax_jurisdiction extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'jurisdiction_name', 'asc', TRUE);
|
||||
}
|
||||
@@ -213,8 +213,15 @@ class Tax_jurisdiction extends Model
|
||||
/**
|
||||
* 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): ResultInterface
|
||||
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;
|
||||
|
||||
$builder = $this->db->table('tax_jurisdictions AS tax_jurisdictions');
|
||||
|
||||
// get_found_rows case
|
||||
@@ -249,7 +256,7 @@ class Tax_jurisdiction extends Model
|
||||
{
|
||||
return [
|
||||
'0' => [
|
||||
'jurisdiction_id' => -1, //TODO: Replace -1 with a constant
|
||||
'jurisdiction_id' => NEW_ENTRY,
|
||||
'jurisdiction_name' => '',
|
||||
'tax_group' => '',
|
||||
'tax_type' => '1',
|
||||
|
||||
@@ -34,7 +34,7 @@ class Token_customer extends Token
|
||||
{
|
||||
//substitute customer info
|
||||
$customer_id = $this->sale_lib->get_customer();
|
||||
if($customer_id != -1 && empty($this->customer_info)) //TODO: Replace -1 with a Constant
|
||||
if($customer_id != NEW_ITEM && empty($this->customer_info))
|
||||
{
|
||||
$customer = model(Customer::class);
|
||||
$customer_info = $customer->get_info($customer_id);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<ul id="error_message_box" class="error_message_box"></ul>
|
||||
|
||||
<?php echo form_open('attributes/save_definition/' . esc($definition_id, 'attr'), ['id' => 'attribute_form', 'class' => 'form-horizontal']) //TODO: String Interpolation?>
|
||||
<?php echo form_open('attributes/save_definition/' . esc($definition_id), ['id' => 'attribute_form', 'class' => 'form-horizontal']) //TODO: String Interpolation?>
|
||||
<fieldset id="attribute_basic_info">
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
@@ -23,7 +23,7 @@
|
||||
'name' => 'definition_name',
|
||||
'id' => 'definition_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value'=>esc($definition_info->definition_name, 'attr')
|
||||
'value'=>esc($definition_info->definition_name)
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
@@ -41,8 +41,8 @@
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown(
|
||||
'definition_group',
|
||||
esc($definition_group, 'attr'),
|
||||
esc($definition_info->definition_fk, 'attr'),
|
||||
esc($definition_group),
|
||||
esc($definition_info->definition_fk),
|
||||
'id="definition_group" class="form-control" ' . (empty($definition_group) ? 'disabled="disabled"' : '')
|
||||
) ?>
|
||||
</div>
|
||||
@@ -54,8 +54,8 @@
|
||||
<div class="input-group">
|
||||
<?php echo form_multiselect(
|
||||
'definition_flags[]',
|
||||
esc($definition_flags, 'attr'),
|
||||
esc(array_keys($selected_definition_flags), 'attr'),
|
||||
esc($definition_flags),
|
||||
esc(array_keys($selected_definition_flags)),
|
||||
[
|
||||
'id' => 'definition_flags',
|
||||
'class' => 'selectpicker show-menu-arrow',
|
||||
@@ -75,7 +75,7 @@
|
||||
<div class="input-group">
|
||||
<?php echo form_input ([
|
||||
'name' => 'definition_unit',
|
||||
'value' => esc($definition_info->definition_unit, 'attr'),
|
||||
'value' => esc($definition_info->definition_unit),
|
||||
'class' => 'form-control input-sm',
|
||||
'id' => 'definition_unit'
|
||||
]) ?>
|
||||
@@ -181,7 +181,7 @@ $(document).ready(function()
|
||||
}
|
||||
else
|
||||
{
|
||||
$.post('<?php echo esc(site_url("$controller_name/delete_attribute_value/"), 'url') ?>', {definition_id: definition_id, attribute_value: value});
|
||||
$.post('<?php echo 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 site_url("attributes/save_attribute_value/") ?>', {definition_id: definition_id, attribute_value: value});
|
||||
$.post('<?php echo "attributes/save_attribute_value/" ?>', {definition_id: definition_id, attribute_value: value});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit('<?php echo esc(site_url($controller_name), 'url') ?>', response);
|
||||
table_support.handle_submit('<?php echo esc($controller_name) ?>', response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
@@ -274,4 +274,4 @@ $(document).ready(function()
|
||||
}
|
||||
}, form_support.error));
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo 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', esc($definition_names, 'attr'), -1, ['id' => 'definition_name', 'class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('definition_name', esc($definition_names), -1, ['id' => 'definition_name', 'class' => 'form-control']) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -19,18 +19,18 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
?>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(esc($definition_value['definition_name']), esc($definition_value['definition_name'], 'attr'), ['class' => 'control-label col-xs-3']) ?>
|
||||
<?php echo form_label(esc($definition_value['definition_name']), esc($definition_value['definition_name']), ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<div class="input-group">
|
||||
<?php
|
||||
echo form_hidden(esc("attribute_ids[$definition_id]", 'attr'), esc($definition_value['attribute_id'], 'attr'));
|
||||
echo form_hidden(esc("attribute_ids[$definition_id]"), esc($definition_value['attribute_id']));
|
||||
$attribute_value = $definition_value['attribute_value'];
|
||||
|
||||
if ($definition_value['definition_type'] == DATE)
|
||||
{
|
||||
$value = (empty($attribute_value) || empty($attribute_value->attribute_date)) ? NOW : strtotime($attribute_value->attribute_date);
|
||||
echo form_input ([
|
||||
'name' => esc("attribute_links[$definition_id]", 'attr'),
|
||||
'name' => esc("attribute_links[$definition_id]"),
|
||||
'value' => to_date($value),
|
||||
'class' => 'form-control input-sm datetime',
|
||||
'data-definition-id' => $definition_id,
|
||||
@@ -40,17 +40,17 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
else if ($definition_value['definition_type'] == DROPDOWN) //TODO: === ?
|
||||
{
|
||||
$selected_value = $definition_value['selected_value'];
|
||||
echo form_dropdown(esc("attribute_links[$definition_id]", 'attr'), esc($definition_value['values'], 'attr'), esc($selected_value, 'attr'), "class='form-control' data-definition-id='$definition_id'");
|
||||
echo form_dropdown(esc("attribute_links[$definition_id]"), esc($definition_value['values']), esc($selected_value), "class='form-control' data-definition-id='$definition_id'");
|
||||
}
|
||||
else if ($definition_value['definition_type'] == TEXT) //TODO: === ?
|
||||
{
|
||||
$value = (empty($attribute_value) || empty($attribute_value->attribute_value)) ? $definition_value['selected_value'] : $attribute_value->attribute_value;
|
||||
echo form_input(esc("attribute_links[$definition_id]"), esc($value, 'attr'), "class='form-control valid_chars' data-definition-id='$definition_id'");
|
||||
echo form_input(esc("attribute_links[$definition_id]"), esc($value), "class='form-control valid_chars' data-definition-id='$definition_id'");
|
||||
}
|
||||
else if ($definition_value['definition_type'] == DECIMAL) //TODO: === ?
|
||||
{
|
||||
$value = (empty($attribute_value) || empty($attribute_value->attribute_decimal)) ? $definition_value['selected_value'] : $attribute_value->attribute_decimal;
|
||||
echo form_input(esc("attribute_links[$definition_id]"), esc($value, 'attr'), "class='form-control valid_chars' data-definition-id='$definition_id'");
|
||||
echo form_input(esc("attribute_links[$definition_id]"), esc($value), "class='form-control valid_chars' data-definition-id='$definition_id'");
|
||||
}
|
||||
else if ($definition_value['definition_type'] == CHECKBOX) //TODO: === ?
|
||||
{
|
||||
@@ -59,13 +59,13 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
//Sends 0 if the box is unchecked instead of not sending anything.
|
||||
echo form_input ([
|
||||
'type' => 'hidden',
|
||||
'name' => esc("attribute_links[$definition_id]", 'attr'),
|
||||
'name' => esc("attribute_links[$definition_id]"),
|
||||
'id' => "attribute_links[$definition_id]",
|
||||
'value' => 0,
|
||||
'data-definition-id' => $definition_id
|
||||
]);
|
||||
echo form_checkbox ([
|
||||
'name' => esc("attribute_links[$definition_id]", 'attr'),
|
||||
'name' => esc("attribute_links[$definition_id]"),
|
||||
'id' => "attribute_links[$definition_id]",
|
||||
'value' => 1,
|
||||
'checked' => ($value ? 1 : 0),
|
||||
@@ -100,7 +100,7 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
$("input[name='attribute_ids[" + definition_id + "]']").val('');
|
||||
}).autocomplete({
|
||||
source: function(request, response) {
|
||||
$.get('<?php echo site_url('attributes/suggest_attribute/') ?>' + this.element.data('definition-id') + '?term=' + request.term, function(data) {
|
||||
$.get('<?php echo 'attributes/suggest_attribute/' ?>' + this.element.data('definition-id') + '?term=' + request.term, function(data) {
|
||||
return response(data);
|
||||
}, 'json');
|
||||
},
|
||||
@@ -125,7 +125,7 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
var definition_id = $("#definition_name option:selected").val();
|
||||
var attribute_values = definition_values();
|
||||
attribute_values[definition_id] = '';
|
||||
$('#attributes').load('<?php echo esc(site_url("items/attributes/$item_id"), 'url') ?>', {
|
||||
$('#attributes').load('<?php echo esc("items/attributes/$item_id") ?>', {
|
||||
'definition_ids': JSON.stringify(attribute_values)
|
||||
}, enable_delete);
|
||||
};
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers, 'js') ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'definition_id'
|
||||
});
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<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(site_url($controller_name."/view"), 'url') ?>'
|
||||
<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"> </span><?php echo lang($controller_name . '.new') ?>
|
||||
</button>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<ul id="error_message_box" class="error_message_box"></ul>
|
||||
|
||||
<?php echo form_open(esc('cashups/save/'.$cash_ups_info->cashup_id, 'attr'), ['id' => 'cashups_edit_form', 'class' => 'form-horizontal']) //TODO: String Interpolation ?>
|
||||
<?php echo 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']) ?>
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo 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', esc($employees, 'attr'), $cash_ups_info->open_employee_id, 'id="open_employee_id" class="form-control"') ?>
|
||||
<?php echo form_dropdown('open_employee_id', esc($employees), $cash_ups_info->open_employee_id, 'id="open_employee_id" class="form-control"') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo 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', esc($employees, 'attr'), $cash_ups_info->close_employee_id, 'id="close_employee_id" class="form-control"') ?>
|
||||
<?php echo form_dropdown('close_employee_id', esc($employees), $cash_ups_info->close_employee_id, 'id="close_employee_id" class="form-control"') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -310,7 +310,7 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
$('#open_amount_cash, #transfer_amount_cash, #closed_amount_cash, #closed_amount_due, #closed_amount_card, #closed_amount_check').keyup(function() {
|
||||
$.post("<?php echo esc(site_url("$controller_name/ajax_cashup_total"), 'url') ?>", {
|
||||
$.post("<?php echo 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 +332,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit('<?php echo esc(site_url('cashups'), 'url') ?>', response);
|
||||
table_support.handle_submit('<?php echo esc('cashups') ?>', response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -25,8 +25,8 @@ $(document).ready(function()
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers, 'js') ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'cashup_id',
|
||||
queryParams: function() {
|
||||
@@ -46,8 +46,8 @@ $(document).ready(function()
|
||||
<button onclick="javascript:printdoc()" class='btn btn-info btn-sm pull-right'>
|
||||
<span class="glyphicon glyphicon-print"> </span><?php echo 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 site_url($controller_name."/view") //TODO: String Interpolation ?>'
|
||||
title='<?php echo lang(esc($controller_name, 'attr') . '.new') //TODO: String Interpolation?>'>
|
||||
<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"> </span><?php echo lang(esc($controller_name) . '.new') //TODO: String Interpolation ?>
|
||||
</button>
|
||||
</div>
|
||||
@@ -59,7 +59,7 @@ $(document).ready(function()
|
||||
</button>
|
||||
|
||||
<?php echo form_input (['name' => 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
|
||||
<?php echo form_multiselect('filters[]', esc($filters, 'attr'), [''], [
|
||||
<?php echo form_multiselect('filters[]', esc($filters), [''], [
|
||||
'id' => 'filters',
|
||||
'data-none-selected-text'=>lang('Common.none_selected_text'),
|
||||
'class' => 'selectpicker show-menu-arrow',
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.barcode_type'), 'barcode_type', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('barcode_type', esc($support_barcode, 'attr'), esc($config['barcode_type'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('barcode_type', esc($support_barcode), esc($config['barcode_type']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
<div class='col-sm-2'>
|
||||
<?php echo form_dropdown(
|
||||
'barcode_font',
|
||||
esc($this->barcode_lib->listfonts('fonts'), 'attr'),
|
||||
esc($config['barcode_font'], 'attr'),
|
||||
esc($this->barcode_lib->listfonts('fonts')),
|
||||
esc($config['barcode_font']),
|
||||
['class' => 'form-control input-sm required']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -125,7 +125,7 @@
|
||||
echo form_dropdown ([
|
||||
'name' => 'barcode_formats[]',
|
||||
'id' => 'barcode_formats',
|
||||
'options' => !empty($barcode_formats) ? esc(array_combine($barcode_formats, $barcode_formats), 'attr') : [],
|
||||
'options' => !empty($barcode_formats) ? esc(array_combine($barcode_formats, $barcode_formats)) : [],
|
||||
'multiple' => 'multiple',
|
||||
'data-role' => 'tagsinput']) ?>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'sendmail' => 'sendmail',
|
||||
'smtp' => 'smtp'
|
||||
],
|
||||
esc($config['protocol'], 'attr'),
|
||||
esc($config['protocol']),
|
||||
['class' => 'form-control input-sm', 'id' => 'protocol'])
|
||||
?>
|
||||
</div>
|
||||
@@ -26,7 +26,7 @@
|
||||
'name' => 'mailpath',
|
||||
'id' => 'mailpath',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['mailpath'], 'attr')
|
||||
'value' => esc($config['mailpath'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@
|
||||
'name' => 'smtp_host',
|
||||
'id' => 'smtp_host',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['smtp_host'], 'attr')
|
||||
'value' => esc($config['smtp_host'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
'tls' => 'TLS',
|
||||
'ssl' => 'SSL'
|
||||
],
|
||||
esc($config['smtp_crypto'], 'attr'),
|
||||
esc($config['smtp_crypto']),
|
||||
['class' => 'form-control input-sm', 'id' => 'smtp_crypto'])
|
||||
?>
|
||||
</div>
|
||||
@@ -90,7 +90,7 @@
|
||||
'name' => 'smtp_user',
|
||||
'id' => 'smtp_user',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['smtp_user'], 'attr')
|
||||
'value' => esc($config['smtp_user'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,7 +105,7 @@
|
||||
'name' => 'smtp_pass',
|
||||
'id' => 'smtp_pass',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['smtp_pass'], 'attr')
|
||||
'value' => esc($config['smtp_pass'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class='col-sm-10'>
|
||||
<div class="form-group form-group-sm row">
|
||||
<div class='col-sm-3'>
|
||||
<?php echo form_dropdown('theme', $themes, esc($config['theme'], 'attr'), ['class' => 'form-control input-sm', 'id' => 'theme-change']) ?>
|
||||
<?php echo form_dropdown('theme', $themes, esc($config['theme']), ['class' => 'form-control input-sm', 'id' => 'theme-change']) ?>
|
||||
</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”>
|
||||
@@ -38,7 +38,7 @@
|
||||
'floating_labels' => lang('Config.floating_labels'),
|
||||
'input_groups' => lang('Config.input_groups')
|
||||
],
|
||||
esc($config['login_form'], 'attr'),
|
||||
esc($config['login_form']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -65,7 +65,7 @@
|
||||
'data-toggle' => 'toggle',
|
||||
'data-size' => 'normal',
|
||||
'data-onstyle' => 'success',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol'], 'attr').'</b>',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol']).'</b>',
|
||||
'data-off' => '<b>%</b>',
|
||||
'checked' => $config['default_sales_discount_type']
|
||||
]) ?>
|
||||
@@ -95,7 +95,7 @@
|
||||
'data-toggle' => 'toggle',
|
||||
'data-size' => 'normal',
|
||||
'data-onstyle' => 'success',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol'], 'attr') . '</b>',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol']) . '</b>',
|
||||
'data-off' => '<b>%</b>',
|
||||
'checked' => $config['default_receivings_discount_type']
|
||||
]) ?>
|
||||
@@ -158,7 +158,7 @@
|
||||
'top' => lang('Config.top'),
|
||||
'bottom' => lang('Config.bottom')
|
||||
],
|
||||
esc($config['notify_vertical_position'], 'attr'),
|
||||
esc($config['notify_vertical_position']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -170,7 +170,7 @@
|
||||
'center' => lang('Config.center'),
|
||||
'right' => lang('Config.right')
|
||||
],
|
||||
esc($config['notify_horizontal_position'], 'attr'),
|
||||
esc($config['notify_horizontal_position']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -274,7 +274,7 @@
|
||||
'name' => 'gcaptcha_site_key',
|
||||
'id' => 'gcaptcha_site_key',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc($config['gcaptcha_site_key'], 'attr')
|
||||
'value' => esc($config['gcaptcha_site_key'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -286,7 +286,7 @@
|
||||
'name' => 'gcaptcha_secret_key',
|
||||
'id' => 'gcaptcha_secret_key',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc($config['gcaptcha_secret_key'], 'attr')
|
||||
'value' => esc($config['gcaptcha_secret_key'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -306,7 +306,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'cost_price' => lang('Items.cost_price')
|
||||
],
|
||||
esc($config['suggestions_first_column'], 'attr'),
|
||||
esc($config['suggestions_first_column']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -323,7 +323,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'cost_price' => lang('Items.cost_price')
|
||||
],
|
||||
esc($config['suggestions_second_column'], 'attr'),
|
||||
esc($config['suggestions_second_column']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -340,7 +340,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'cost_price' => lang('Items.cost_price')
|
||||
],
|
||||
esc($config['suggestions_third_column'], 'attr'),
|
||||
esc($config['suggestions_third_column']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -473,12 +473,12 @@ $(document).ready(function()
|
||||
lines_per_page:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
default_sales_discount:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
gcaptcha_site_key:
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
'name' => 'address',
|
||||
'id' => 'address',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=> $config['address'], 'attr'
|
||||
'value'=> $config['address']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -149,7 +149,7 @@ $(document).ready(function()
|
||||
$("a.fileinput-exists").click(function() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url("$controller_name/remove_logo"); ?>',
|
||||
url: '<?php echo "$controller_name/remove_logo"; ?>',
|
||||
dataType: 'json'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
'name' => 'mailchimp_api_key',
|
||||
'id' => 'mailchimp_api_key',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp['api_key'], 'attr')
|
||||
'value' => esc($mailchimp['api_key'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -38,8 +38,8 @@
|
||||
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-user"></span></span>
|
||||
<?php echo form_dropdown(
|
||||
'mailchimp_list_id',
|
||||
esc($mailchimp['lists'], 'attr'),
|
||||
esc($mailchimp['list_id'], 'attr'),
|
||||
esc($mailchimp['lists']),
|
||||
esc($mailchimp['list_id']),
|
||||
['id' => 'mailchimp_list_id', 'class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -61,7 +61,7 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#mailchimp_api_key').change(function() {
|
||||
$.post("<?php echo esc(site_url($controller_name . '/ajax_check_mailchimp_api_key'), 'url') ?>", {
|
||||
$.post("<?php echo esc("$controller_name/ajax_check_mailchimp_api_key"), ?>", {
|
||||
'mailchimp_api_key': $('#mailchimp_api_key').val()
|
||||
},
|
||||
function(response) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.invoice_type'), 'invoice_type', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-3'>
|
||||
<?php echo form_dropdown('invoice_type', esc($invoice_type_options, 'attr'), esc($config['invoice_type'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('invoice_type', esc($invoice_type_options), esc($config['invoice_type']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
'name' => 'recv_invoice_format',
|
||||
'id' => 'recv_invoice_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['recv_invoice_format'], 'attr')
|
||||
'value' => esc($config['recv_invoice_format'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,7 +48,7 @@
|
||||
'name' => 'invoice_default_comments',
|
||||
'id' => 'invoice_default_comments',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['invoice_default_comments'], 'attr')
|
||||
'value' => esc($config['invoice_default_comments'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
'name' => 'invoice_email_message',
|
||||
'id' => 'invoice_email_message',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['invoice_email_message'], 'attr')
|
||||
'value' => esc($config['invoice_email_message'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,7 +68,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.line_sequence'), 'line_sequence', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('line_sequence', esc($line_sequence_options, 'attr'), esc($config['line_sequence'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('line_sequence', esc($line_sequence_options), esc($config['line_sequence']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
'name' => 'sales_invoice_format',
|
||||
'id' => 'sales_invoice_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['sales_invoice_format'], 'attr')
|
||||
'value' => esc($config['sales_invoice_format'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,7 +104,7 @@
|
||||
'name' => 'sales_quote_format',
|
||||
'id' => 'sales_quote_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['sales_quote_format'], 'attr')
|
||||
'value' => esc($config['sales_quote_format'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -129,7 +129,7 @@
|
||||
'name' => 'quote_default_comments',
|
||||
'id' => 'quote_default_comments',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['quote_default_comments'], 'attr')
|
||||
'value' => esc($config['quote_default_comments'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -153,7 +153,7 @@
|
||||
'name' => 'work_order_format',
|
||||
'id' => 'work_order_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['work_order_format'], 'attr')
|
||||
'value' => esc($config['work_order_format'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
{
|
||||
?>
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(esc($license['title'], 'attr'), 'license', ['class' => 'control-label col-xs-3']) ?>
|
||||
<?php echo form_label(esc($license['title']), 'license', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_textarea ([
|
||||
'name' => 'license',
|
||||
'id' => 'license_' . $counter++, //TODO: String Interpolation
|
||||
'class' => 'form-control',
|
||||
'readonly' => '',
|
||||
'value' => esc($license['text'], 'attr')
|
||||
'value' => esc($license['text'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<?php echo 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('number_locale', esc($config['number_locale'], 'attr'), ['class' => 'form-control input-sm', 'id' => 'number_locale']) ?>
|
||||
<?php echo form_hidden('save_number_locale', esc($config['number_locale'], 'attr')) ?>
|
||||
<?php echo form_input('number_locale', esc($config['number_locale']), ['class' => 'form-control input-sm', 'id' => 'number_locale']) ?>
|
||||
<?php echo form_hidden('save_number_locale', esc($config['number_locale'])) ?>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<label class="control-label">
|
||||
@@ -51,7 +51,7 @@
|
||||
'name' => 'currency_symbol',
|
||||
'id' => 'currency_symbol',
|
||||
'class' => 'form-control input-sm number_locale',
|
||||
'value' => esc($config['currency_symbol'], 'attr')
|
||||
'value' => esc($config['currency_symbol'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
'name' => 'currency_code',
|
||||
'id' => 'currency_code',
|
||||
'class' => 'form-control input-sm number_locale',
|
||||
'value' => esc($currency_code, 'attr')
|
||||
'value' => esc($currency_code)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,7 +144,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.cash_rounding'), 'cash_rounding_code', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('cash_rounding_code', esc($rounding_options, 'attr'), $config['cash_rounding_code'], ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('cash_rounding_code', esc($rounding_options), $config['cash_rounding_code'], ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
'creditdebitcash' => lang('Sales.credit') . ' / ' . lang('Sales.debit') . ' / ' . lang('Sales.cash'),
|
||||
'creditcashdebit' => lang('Sales.credit') . ' / ' . lang('Sales.cash') . ' / ' . lang('Sales.debit')
|
||||
],
|
||||
esc($config['payment_options_order'], 'attr'),
|
||||
esc($config['payment_options_order']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -169,7 +169,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo 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', esc($config['country_codes'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_input('country_codes', esc($config['country_codes']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<label class="control-label">
|
||||
@@ -197,7 +197,7 @@
|
||||
<?php echo form_dropdown(
|
||||
'timezone',
|
||||
get_timezones(),
|
||||
$config['timezone'] ? esc($config['timezone'], 'attr') : date_default_timezone_get(), ['class' => 'form-control input-sm']) ?>
|
||||
$config['timezone'] ? esc($config['timezone']) : date_default_timezone_get(), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
<?php echo form_dropdown(
|
||||
'dateformat',
|
||||
get_dateformats(),
|
||||
esc($config['dateformat'], 'attr'),
|
||||
esc($config['dateformat']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'name' => 'msg_uid',
|
||||
'id' => 'msg_uid',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc($config['msg_uid'], 'attr')
|
||||
'value' => esc($config['msg_uid'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,7 +28,7 @@
|
||||
'name' => 'msg_pwd',
|
||||
'id' => 'msg_pwd',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc($config['msg_pwd'], 'attr')
|
||||
'value' => esc($config['msg_pwd'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@
|
||||
'name' => 'msg_src',
|
||||
'id' => 'msg_src',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => $config['msg_src'] == NULL ? esc($config['company'], 'attr') : esc($config['msg_src'], 'attr')
|
||||
'value' => $config['msg_src'] == NULL ? esc($config['company']) : esc($config['msg_src'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
'receipt_default' => lang('Config.receipt_default'),
|
||||
'receipt_short' => lang('Config.receipt_short')
|
||||
],
|
||||
esc($config['receipt_template'], 'attr'),
|
||||
esc($config['receipt_template']),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
|
||||
@@ -122,7 +122,7 @@ $(document).ready(function()
|
||||
},
|
||||
success: function(response) {
|
||||
$.notify({ message: response.message }, { type: response.success ? 'success' : 'danger'});
|
||||
$("#customer_rewards").load('<?php echo site_url("config/ajax_customer_rewards") ?>', init_add_remove_tables);
|
||||
$("#customer_rewards").load('<?php echo "config/ajax_customer_rewards" ?>', init_add_remove_tables);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ $(document).ready(function()
|
||||
$(form).ajaxSubmit({
|
||||
success: function(response) {
|
||||
$.notify({ message: response.message }, { type: response.success ? 'success' : 'danger'});
|
||||
$("#stock_locations").load('<?php echo site_url("config/ajax_stock_locations") ?>', init_add_remove_locations);
|
||||
$("#stock_locations").load('<?php echo "config/ajax_stock_locations" ?>', init_add_remove_locations);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ $(document).ready(function()
|
||||
},
|
||||
success: function(response) {
|
||||
$.notify({ message: response.message }, { type: response.success ? 'success' : 'danger'});
|
||||
$("#dinner_tables").load('<?php echo esc(site_url("config/ajax_dinner_tables"), 'url') ?>', init_add_remove_tables);
|
||||
$("#dinner_tables").load('<?php echo esc("config/ajax_dinner_tables") ?>', init_add_remove_tables);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
'name' => 'tax_id',
|
||||
'id' => 'tax_id',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['tax_id'], 'attr')
|
||||
'value' => esc($config['tax_id'])
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@
|
||||
'name' => 'default_tax_1_name',
|
||||
'id' => 'default_tax_1_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $config['default_tax_1_name'] !== FALSE ? esc($config['default_tax_1_name'], 'attr') : lang('Items.sales_tax_1')]) ?>
|
||||
'value' => $config['default_tax_1_name'] !== FALSE ? esc($config['default_tax_1_name']) : lang('Items.sales_tax_1')]) ?>
|
||||
</div>
|
||||
<div class="col-xs-1 input-group">
|
||||
<?php echo form_input ([
|
||||
@@ -63,7 +63,7 @@
|
||||
'name' => 'default_tax_2_name',
|
||||
'id' => 'default_tax_2_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $config['default_tax_2_name'] !== FALSE ? esc($config['default_tax_2_name'], 'attr') : lang('Items.sales_tax_2')
|
||||
'value' => $config['default_tax_2_name'] !== FALSE ? esc($config['default_tax_2_name']) : lang('Items.sales_tax_2')
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-xs-1 input-group">
|
||||
@@ -92,21 +92,21 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.default_tax_code'), 'default_tax_code', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_tax_code', esc($tax_code_options, 'attr'), esc($config['default_tax_code'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('default_tax_code', esc($tax_code_options), esc($config['default_tax_code']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.default_tax_category'), 'default_tax_category', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_tax_category', esc($tax_category_options, 'attr'), esc($config['default_tax_category'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('default_tax_category', esc($tax_category_options), esc($config['default_tax_category']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.default_tax_jurisdiction'), 'default_tax_jurisdiction', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_tax_jurisdiction', esc($tax_jurisdiction_options, 'attr'), esc($config['default_tax_jurisdiction'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('default_tax_jurisdiction', esc($tax_jurisdiction_options), esc($config['default_tax_jurisdiction']), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -159,11 +159,11 @@ $(document).ready(function()
|
||||
{
|
||||
default_tax_1_rate:
|
||||
{
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
default_tax2_rate:
|
||||
{
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Customers.consent'), 'consent', ['class' => 'required control-label col-xs-3']) ?>
|
||||
<div class='col-xs-1'>
|
||||
<?php echo form_checkbox('consent', '1', $person_info->consent == '' ? !$config['enforce_privacy'] : (boolean)$person_info->consent) ?>
|
||||
<?php echo form_checkbox('consent', 1, $person_info->consent == '' ? !$config['enforce_privacy'] : (boolean)$person_info->consent) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
'name' => 'company_name',
|
||||
'id' => 'company_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->company_name, 'attr')
|
||||
'value' => esc($person_info->company_name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -112,7 +112,7 @@
|
||||
'name' => 'account_number',
|
||||
'id' => 'account_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->account_number, 'attr')
|
||||
'value' => esc($person_info->account_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -124,7 +124,7 @@
|
||||
'name' => 'tax_id',
|
||||
'id' => 'tax_id',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->tax_id, 'attr')
|
||||
'value' => esc($person_info->tax_id)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,7 +133,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Customers.rewards_package'), 'rewards', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('package_id', esc($packages, 'attr'), $selected_package, ['class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('package_id', esc($packages), $selected_package, ['class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Customers.taxable'), 'taxable', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-1'>
|
||||
<?php echo form_checkbox('taxable', '1', $person_info->taxable == '' || $person_info->taxable) ?>
|
||||
<?php echo form_checkbox('taxable', 1, $person_info->taxable == 1) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
'id' => 'sales_tax_code_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'size' => '50',
|
||||
'value' => esc($sales_tax_code_label, 'attr')
|
||||
'value' => esc($sales_tax_code_label)
|
||||
]) ?>
|
||||
<?php echo form_hidden('sales_tax_code_id', $person_info->sales_tax_code_id) ?>
|
||||
</div>
|
||||
@@ -204,7 +204,7 @@
|
||||
'name' => 'employee',
|
||||
'id' => 'employee',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($employee, 'attr'),
|
||||
'value' => esc($employee),
|
||||
'readonly' => 'true'
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -356,7 +356,7 @@
|
||||
'cleaned' => 'cleaned',
|
||||
'pending' => 'pending'
|
||||
],
|
||||
esc($mailchimp_info['status'], 'attr'),
|
||||
esc($mailchimp_info['status']),
|
||||
['id' => 'mailchimp_status', 'class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -364,7 +364,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Customers.mailchimp_vip'), 'mailchimp_vip', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-1'>
|
||||
<?php echo form_checkbox('mailchimp_vip', '1', !($mailchimp_info['vip'] == '') && $mailchimp_info['vip']) ?>
|
||||
<?php echo form_checkbox('mailchimp_vip', 1, $mailchimp_info['vip'] == 1) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -374,7 +374,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_member_rating',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_info['member_rating'], 'attr'),
|
||||
'value' => esc($mailchimp_info['member_rating']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -386,7 +386,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_activity_total',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_activity['total'], 'attr'),
|
||||
'value' => esc($mailchimp_activity['total']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -398,7 +398,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_activity_lastopen',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_activity['lastopen'], 'attr'),
|
||||
'value' => esc($mailchimp_activity['lastopen']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -410,7 +410,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_activity_open',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_activity['open'], 'attr'),
|
||||
'value' => esc($mailchimp_activity['open']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -422,7 +422,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_activity_click',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_activity['click'], 'attr'),
|
||||
'value' => esc($mailchimp_activity['click']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -434,7 +434,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_activity_unopen',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_activity['unopen'], 'attr'),
|
||||
'value' => esc($mailchimp_activity['unopen']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -446,7 +446,7 @@
|
||||
<?php echo form_input ([
|
||||
'name' => 'mailchimp_email_client',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($mailchimp_info['email_client'], 'attr'),
|
||||
'value' => esc($mailchimp_info['email_client']),
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
</div>
|
||||
@@ -476,7 +476,7 @@ $(document).ready(function()
|
||||
};
|
||||
|
||||
$('#sales_tax_code_name').autocomplete({
|
||||
source: "<?php echo esc(site_url('taxes/suggest_tax_codes'), 'url') ?>",
|
||||
source: "<?php echo esc('taxes/suggestTaxCodes') ?>",
|
||||
minChars: 0,
|
||||
delay: 15,
|
||||
cacheLength: 1,
|
||||
@@ -491,7 +491,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
@@ -508,7 +508,7 @@ $(document).ready(function()
|
||||
{
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo esc(site_url("$controller_name/ajax_check_email"), 'url') ?>",
|
||||
url: "<?php echo esc("$controller_name/checkEmail") ?>",
|
||||
type: 'POST',
|
||||
data: {
|
||||
'person_id': "<?php echo $person_info->person_id ?>"
|
||||
@@ -520,7 +520,7 @@ $(document).ready(function()
|
||||
{
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo esc(site_url("$controller_name/ajax_check_account_number"), 'url') ?>",
|
||||
url: "<?php echo esc("$controller_name/checkAccountNumber") ?>",
|
||||
type: 'POST',
|
||||
data: {
|
||||
'person_id': "<?php echo $person_info->person_id ?>"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<fieldset id="item_basic_info">
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="col-xs-12">
|
||||
<a href="<?php echo esc(site_url('customers/csv'), 'url') ?>"><?php echo lang('Common.download_import_template') ?></a>
|
||||
<a href="<?php echo esc('customers/csv') ?>"><?php echo lang('Common.download_import_template') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit('<?php echo esc(site_url('customers'), 'url') ?>', response);
|
||||
table_support.handle_submit('<?php echo esc('customers') ?>', response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
'name' => 'username',
|
||||
'id' => 'username',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->username, 'attr')
|
||||
'value' => esc($person_info->username)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
<?php $password_label_attributes = $person_info->person_id == "" ? ['class' => 'required'] : []; ?>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Employees.password'), 'password', esc(array_merge($password_label_attributes, ['class' => 'control-label col-xs-3']), 'attr'))?>
|
||||
<?php echo form_label(lang('Employees.password'), 'password', esc(array_merge($password_label_attributes, ['class' => 'control-label col-xs-3'])))?>
|
||||
<div class='col-xs-8'>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-lock"></span></span>
|
||||
@@ -65,7 +65,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Employees.repeat_password'), 'repeat_password', esc(array_merge($password_label_attributes, ['class' => 'control-label col-xs-3']), 'attr')) ?>
|
||||
<?php echo form_label(lang('Employees.repeat_password'), 'repeat_password', esc(array_merge($password_label_attributes, ['class' => 'control-label col-xs-3']))) ?>
|
||||
<div class='col-xs-8'>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-lock"></span></span>
|
||||
@@ -97,8 +97,8 @@
|
||||
|
||||
echo form_dropdown(
|
||||
'language',
|
||||
esc($languages, 'attr'),
|
||||
esc("$language_code:$language", 'attr'),
|
||||
esc($languages),
|
||||
esc("$language_code:$language"),
|
||||
['class' => 'form-control input-sm']
|
||||
);
|
||||
?>
|
||||
@@ -209,7 +209,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
@@ -226,7 +226,7 @@ $(document).ready(function()
|
||||
|
||||
required: true,
|
||||
minlength: 5,
|
||||
remote: '<?php echo esc(site_url("$controller_name/check_username/$employee_id"), 'url') ?>'
|
||||
remote: '<?php echo esc("$controller_name/check_username/$employee_id") ?>'
|
||||
},
|
||||
password:
|
||||
{
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
— <?= esc($row['class'] . $row['type'] . $row['function']) ?>
|
||||
<?php if (! empty($row['args'])) : ?>
|
||||
<?php $args_id = $error_id . 'args' . $index ?>
|
||||
( <a href="#" onclick="return toggle('<?= esc($args_id, 'attr') ?>');">arguments</a> )
|
||||
<div class="args" id="<?= esc($args_id, 'attr') ?>">
|
||||
( <a href="#" onclick="return toggle('<?= esc($args_id) ?>');">arguments</a> )
|
||||
<div class="args" id="<?= esc($args_id) ?>">
|
||||
<table cellspacing="0">
|
||||
|
||||
<?php
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
'name' => 'supplier_tax_code',
|
||||
'id' => 'supplier_tax_code',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($expenses_info->supplier_tax_code, 'attr')
|
||||
'value' => esc($expenses_info->supplier_tax_code)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -111,21 +111,21 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Expenses.payment'), 'payment_type', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_dropdown('payment_type', esc($payment_options, 'attr'), esc($expenses_info->payment_type, 'attr'), ['class' => 'form-control', 'id' => 'payment_type']) ?>
|
||||
<?php echo form_dropdown('payment_type', esc($payment_options), esc($expenses_info->payment_type), ['class' => 'form-control', 'id' => 'payment_type']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Expenses_categories.name'), 'category', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_dropdown('expense_category_id', esc($expense_categories, 'attr'), $expenses_info->expense_category_id, ['class' => 'form-control', 'id' => 'category']) ?>
|
||||
<?php echo form_dropdown('expense_category_id', esc($expense_categories), $expenses_info->expense_category_id, ['class' => 'form-control', 'id' => 'category']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Expenses.employee'), 'employee', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_dropdown('employee_id', esc($employees, 'attr'), $expenses_info->employee_id, 'id="employee_id" class="form-control"') ?>
|
||||
<?php echo form_dropdown('employee_id', esc($employees), $expenses_info->employee_id, 'id="employee_id" class="form-control"') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
'name' => 'description',
|
||||
'id' => 'description',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($expenses_info->description, 'attr')
|
||||
'value' => esc($expenses_info->description)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -170,7 +170,7 @@ $(document).ready(function()
|
||||
|
||||
var amount_validator = function(field) {
|
||||
return {
|
||||
url: "<?php echo esc(site_url("$controller_name/ajax_check_amount"), 'url') ?>",
|
||||
url: "<?php echo esc("$controller_name/ajax_check_amount") ?>",
|
||||
type: 'POST',
|
||||
dataFilter: function(data) {
|
||||
var response = JSON.parse(data);
|
||||
@@ -226,7 +226,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -25,8 +25,8 @@ $(document).ready(function()
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'expense_id',
|
||||
onLoadSuccess: function(response) {
|
||||
@@ -53,7 +53,7 @@ $(document).ready(function()
|
||||
<button onclick="javascript:printdoc()" class='btn btn-info btn-sm pull-right'>
|
||||
<span class="glyphicon glyphicon-print"> </span><?php echo 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 esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<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-tags"> </span><?php echo lang($controller_name . '.new') ?>
|
||||
</button>
|
||||
@@ -66,7 +66,7 @@ $(document).ready(function()
|
||||
</button>
|
||||
|
||||
<?php echo form_input (['name' => 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
|
||||
<?php echo form_multiselect('filters[]', esc($filters, 'attr'), [''], ['id' => 'filters', 'data-none-selected-text' => lang('Common.none_selected_text'), 'class' => 'selectpicker show-menu-arrow', 'data-selected-text-format' => 'count > 1', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
<?php echo form_multiselect('filters[]', esc($filters), [''], ['id' => 'filters', 'data-none-selected-text' => lang('Common.none_selected_text'), 'class' => 'selectpicker show-menu-arrow', 'data-selected-text-format' => 'count > 1', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
'name' => 'category_name',
|
||||
'id' => 'category_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($category_info->category_name, 'attr')
|
||||
'value' => esc($category_info->category_name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,7 +29,7 @@
|
||||
'name' => 'category_description',
|
||||
'id' => 'category_description',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($category_info->category_description, 'attr')
|
||||
'value' => esc($category_info->category_description)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,7 +47,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -12,8 +12,8 @@ $(document).ready(function()
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'expense_category_id',
|
||||
|
||||
@@ -28,7 +28,7 @@ $(document).ready(function()
|
||||
</script>
|
||||
|
||||
<div id="title_bar" class="btn-toolbar">
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<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-list"> </span><?php echo lang($controller_name . '.new') ?>
|
||||
</button>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
'name' => 'person_name',
|
||||
'id' => 'person_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($selected_person_name, 'attr')
|
||||
'value' => esc($selected_person_name)
|
||||
]) ?>
|
||||
<?php echo form_hidden('person_id', $selected_person_id) ?>
|
||||
</div>
|
||||
@@ -41,7 +41,7 @@
|
||||
'name' => 'giftcard_number',
|
||||
'id' => 'giftcard_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($giftcard_number, 'attr')
|
||||
'value' => esc($giftcard_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,7 +83,7 @@ $(document).ready(function()
|
||||
};
|
||||
|
||||
$('#person_name').autocomplete({
|
||||
source: "<?php echo esc(site_url('customers/suggest'), 'url') ?>",
|
||||
source: "<?php echo esc("customers/suggest") ?>",
|
||||
minChars: 0,
|
||||
delay: 15,
|
||||
cacheLength: 1,
|
||||
@@ -98,11 +98,11 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", {message: errorThrown});
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", {message: errorThrown});
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
@@ -129,7 +129,7 @@ $(document).ready(function()
|
||||
required: true,
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo esc(site_url("$controller_name/ajax_check_number_giftcard"), 'url') ?>",
|
||||
url: "<?php echo esc("$controller_name/checkNumberGiftcard") ?>",
|
||||
type: 'POST',
|
||||
data: {
|
||||
'amount': $('#giftcard_amount').val()
|
||||
|
||||
@@ -10,8 +10,8 @@ $(document).ready(function()
|
||||
{
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'giftcard_id'
|
||||
});
|
||||
@@ -19,7 +19,7 @@ $(document).ready(function()
|
||||
</script>
|
||||
|
||||
<div id="title_bar" class="btn-toolbar">
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<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-heart"> </span><?php echo lang($controller_name . '.new') ?>
|
||||
</button>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
'name' => 'username',
|
||||
'id' => 'username',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->username, 'attr'),
|
||||
'value' => esc($person_info->username),
|
||||
'readonly' => 'true'
|
||||
]) ?>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
'name' => 'item_kit_number',
|
||||
'id' => 'item_kit_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_kit_info->item_kit_number, 'attr')
|
||||
'value' => esc($item_kit_info->item_kit_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,7 +35,7 @@
|
||||
'name' => 'name',
|
||||
'id' => 'name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_kit_info->name, 'attr')
|
||||
'value' => esc($item_kit_info->name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,7 +49,7 @@
|
||||
'id' => 'item_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'size' => '50',
|
||||
'value' => esc($selected_kit_item, 'attr')
|
||||
'value' => esc($selected_kit_item)
|
||||
]) ?>
|
||||
<?php echo form_hidden('kit_item_id', $selected_kit_item_id) ?>
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
'name' => 'description',
|
||||
'id' => 'description',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_kit_info->description, 'attr')
|
||||
'value' => esc($item_kit_info->description)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -215,7 +215,7 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#item').autocomplete({
|
||||
source: "<?php echo site_url('items/suggest') ?>",
|
||||
source: '<?php echo "items/suggest" ?>',
|
||||
minChars: 0,
|
||||
autoFocus: false,
|
||||
delay: 10,
|
||||
@@ -253,7 +253,7 @@ $(document).ready(function()
|
||||
|
||||
|
||||
$('#item_name').autocomplete({
|
||||
source: "<?php echo site_url('items/suggest_kits') ?>",
|
||||
source: "<?php echo 'items/suggest_kits' ?>",
|
||||
minChars: 0,
|
||||
delay: 15,
|
||||
cacheLength: 1,
|
||||
@@ -268,7 +268,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
@@ -285,7 +285,7 @@ $(document).ready(function()
|
||||
required: false,
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo esc(site_url("$controller_name/check_item_number"), 'url') ?>",
|
||||
url: '<?php echo esc("$controller_name/checkItemNumber") ?>',
|
||||
type: 'POST',
|
||||
data:
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ $(document).ready(function()
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'item_kit_id'
|
||||
});
|
||||
@@ -30,7 +30,7 @@ $(document).ready(function()
|
||||
</script>
|
||||
|
||||
<div id="title_bar" class="btn-toolbar">
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<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-tags"> </span><?php echo lang($controller_name . '.new') ?>
|
||||
</button>
|
||||
@@ -42,7 +42,7 @@ $(document).ready(function()
|
||||
<span class="glyphicon glyphicon-trash"> </span><?php echo lang('Common.delete') ?>
|
||||
</button>
|
||||
|
||||
<button id="generate_barcodes" class="btn btn-default btn-sm" data-href='<?php echo esc(site_url("$controller_name/generate_barcodes"), 'url') ?>'>
|
||||
<button id="generate_barcodes" class="btn btn-default btn-sm" data-href='<?php echo esc("$controller_name/generate_barcodes") ?>'>
|
||||
<span class="glyphicon glyphicon-barcode"> </span><?php echo lang('Items.generate_barcodes') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
'name' => 'item_number',
|
||||
'id' => 'item_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_info->item_number, 'attr')
|
||||
'value' => esc($item_info->item_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
'name' => 'name',
|
||||
'id' => 'name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_info->name, 'attr')
|
||||
'value' => esc($item_info->name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,7 +64,7 @@
|
||||
<?php
|
||||
if($config['category_dropdown'])
|
||||
{
|
||||
echo form_dropdown('category', esc($categories, 'attr'), $selected_category, ['class' => 'form-control']);
|
||||
echo form_dropdown('category', esc($categories), $selected_category, ['class' => 'form-control']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -72,7 +72,7 @@
|
||||
'name' => 'category',
|
||||
'id' => 'category',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_info->category, 'attr')
|
||||
'value' => esc($item_info->category)
|
||||
]);
|
||||
}
|
||||
?>
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<div id="attributes">
|
||||
<script type="text/javascript">
|
||||
$('#attributes').load('<?php echo site_url("items/attributes/$item_info->item_id") ?>');
|
||||
$('#attributes').load('<?php echo "items/attributes/$item_info->item_id" ?>');
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Items.supplier'), 'supplier', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('supplier_id', esc($suppliers, 'attr'), $selected_supplier, ['class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('supplier_id', esc($suppliers), $selected_supplier, ['class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
'name' => 'tax_names[]',
|
||||
'id' => 'tax_name_1',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => isset($item_tax_info[0]['name']) ? esc($item_tax_info[0]['name'], 'attr') : esc($config['default_tax_1_name'], 'attr')
|
||||
'value' => isset($item_tax_info[0]['name']) ? esc($item_tax_info[0]['name']) : esc($config['default_tax_1_name'])
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
@@ -263,7 +263,7 @@
|
||||
'name' => 'tax_names[]',
|
||||
'id' => 'tax_name_2',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => isset($item_tax_info[1]['name']) ? esc($item_tax_info[1]['name'], 'attr') : esc($config['default_tax_2_name'], 'attr')
|
||||
'value' => isset($item_tax_info[1]['name']) ? esc($item_tax_info[1]['name']) : esc($config['default_tax_2_name'])
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
@@ -292,7 +292,7 @@
|
||||
'id' => 'tax_category',
|
||||
'class' => 'form-control input-sm',
|
||||
'size' => '50',
|
||||
'value' => esc($tax_category, 'attr')
|
||||
'value' => esc($tax_category)
|
||||
]) ?><?php echo form_hidden('tax_category_id', $tax_category_id) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -308,7 +308,7 @@
|
||||
'name' => 'hsn_code',
|
||||
'id' => 'hsn_code',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($hsn_code, 'attr')
|
||||
'value' => esc($hsn_code)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -368,7 +368,7 @@
|
||||
'name' => 'description',
|
||||
'id' => 'description',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_info->description, 'attr')
|
||||
'value' => esc($item_info->description)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -402,7 +402,7 @@
|
||||
'name' => 'allow_alt_description',
|
||||
'id' => 'allow_alt_description',
|
||||
'value' => 1,
|
||||
'checked' => ($item_info->allow_alt_description) ? 1 : 0
|
||||
'checked' => ($item_info->allow_alt_description == 1) ? TRUE : FALSE
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -414,7 +414,7 @@
|
||||
'name' => 'is_serialized',
|
||||
'id' => 'is_serialized',
|
||||
'value' => 1,
|
||||
'checked' => ($item_info->is_serialized) ? 1 : 0
|
||||
'checked' => ($item_info->is_serialized == 1) ? TRUE : FALSE
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -441,7 +441,7 @@
|
||||
'name' => 'pack_name',
|
||||
'id' => 'pack_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item_info->pack_name, 'attr')
|
||||
'value' => esc($item_info->pack_name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -453,7 +453,7 @@
|
||||
'name' => 'low_sell_item_name',
|
||||
'id' => 'low_sell_item_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($selected_low_sell_item, 'attr')
|
||||
'value' => esc($selected_low_sell_item)
|
||||
]) ?><?php echo form_hidden('low_sell_item_id', $selected_low_sell_item_id) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -469,7 +469,7 @@
|
||||
'name' => 'is_deleted',
|
||||
'id' => 'is_deleted',
|
||||
'value'=>1,
|
||||
'checked' => ($item_info->deleted) ? 1 : 0
|
||||
'checked' => ($item_info->deleted == 1) ? TRUE : FALSE
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -501,7 +501,7 @@ $(document).ready(function()
|
||||
};
|
||||
|
||||
$('#tax_category').autocomplete({
|
||||
source: "<?php echo site_url('taxes/suggest_tax_categories') ?>",
|
||||
source: "<?php echo 'taxes/suggestTaxCategories' ?>",
|
||||
minChars: 0,
|
||||
delay: 15,
|
||||
cacheLength: 1,
|
||||
@@ -517,7 +517,7 @@ $(document).ready(function()
|
||||
};
|
||||
|
||||
$('#low_sell_item_name').autocomplete({
|
||||
source: "<?php echo site_url('items/suggest_low_sell') ?>",
|
||||
source: "<?php echo 'items/suggestLowSell' ?>",
|
||||
minChars: 0,
|
||||
delay: 15,
|
||||
cacheLength: 1,
|
||||
@@ -527,7 +527,7 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
$('#category').autocomplete({
|
||||
source: "<?php echo site_url('items/suggest_category') ?>",
|
||||
source: "<?php echo 'items/suggestCategory' ?>",
|
||||
delay: 10,
|
||||
appendTo: '.modal-content'
|
||||
});
|
||||
@@ -535,7 +535,7 @@ $(document).ready(function()
|
||||
$('a.fileinput-exists').click(function() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<?php echo esc(site_url("$controller_name/remove_logo/$item_info->item_id"), 'url') ?>',
|
||||
url: '<?php echo "$controller_name/removeLogo/$item_info->item_id" ?>',
|
||||
dataType: 'json'
|
||||
})
|
||||
});
|
||||
@@ -553,7 +553,7 @@ $(document).ready(function()
|
||||
if(stay_open)
|
||||
{
|
||||
// set action of item_form to url without item id, so a new one can be created
|
||||
$('#item_form').attr('action', "<?php echo site_url('items/save/') ?>");
|
||||
$('#item_form').attr('action', "<?php echo 'items/save/' ?>");
|
||||
// use a whitelist of fields to minimize unintended side effects
|
||||
$(':text, :password, :file, #description, #item_form').not('.quantity, #reorder_level, #tax_name_1, #receiving_quantity, ' +
|
||||
'#tax_percent_name_1, #category, #reference_number, #name, #cost_price, #unit_price, #taxed_cost_price, #taxed_unit_price, #definition_name, [name^="attribute_links"]').val('');
|
||||
@@ -564,7 +564,7 @@ $(document).ready(function()
|
||||
{
|
||||
dialog_support.hide();
|
||||
}
|
||||
table_support.handle_submit('<?php echo site_url('items') ?>', response, stay_open);
|
||||
table_support.handle_submit('<?php echo 'items' ?>', response, stay_open);
|
||||
init_validation();
|
||||
},
|
||||
dataType: 'json'
|
||||
@@ -582,26 +582,23 @@ $(document).ready(function()
|
||||
required: false,
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo esc(site_url("$controller_name/check_item_number"), 'url') ?>",
|
||||
url: "<?php echo esc("$controller_name/checkItemNumber") ?>",
|
||||
type: 'POST',
|
||||
data: {
|
||||
'item_id' : "<?php echo $item_info->item_id ?>",
|
||||
'item_number' : function()
|
||||
{
|
||||
return $('#item_number').val();
|
||||
},
|
||||
'item_id' : "<?php echo $item_info->item_id ?>"
|
||||
// item_number should be passed into the function by default
|
||||
}
|
||||
}
|
||||
},
|
||||
cost_price:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
unit_price:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
<?php
|
||||
foreach($stock_locations as $key=>$location_detail)
|
||||
@@ -610,7 +607,7 @@ $(document).ready(function()
|
||||
<?php echo 'quantity_' . $key ?>:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
<?php
|
||||
}
|
||||
@@ -618,17 +615,17 @@ $(document).ready(function()
|
||||
receiving_quantity:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
reorder_level:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
},
|
||||
tax_percent:
|
||||
{
|
||||
required: true,
|
||||
remote: "<?php echo esc(site_url("$controller_name/check_numeric"), 'url') ?>"
|
||||
required: false,
|
||||
remote: "<?php echo esc("$controller_name/checkNumeric") ?>"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -671,7 +668,6 @@ $(document).ready(function()
|
||||
},
|
||||
tax_percent:
|
||||
{
|
||||
required: "<?php echo lang('Items.tax_percent_required') ?>",
|
||||
number: "<?php echo lang('Items.tax_percent_number') ?>"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Items.supplier'), 'supplier', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('supplier_id', esc($suppliers, 'attr'), '', ['class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('supplier_id', esc($suppliers), '', ['class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
'name' => 'tax_names[]',
|
||||
'id' => 'tax_name_1',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['default_tax_1_name'], 'attr')
|
||||
'value' => esc($config['default_tax_1_name'])
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
@@ -112,7 +112,7 @@
|
||||
'name' => 'tax_names[]',
|
||||
'id' => 'tax_name_2',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($config['default_tax_2_name'], 'attr')
|
||||
'value' => esc($config['default_tax_2_name'])
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
@@ -153,14 +153,14 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Items.allow_alt_description'), 'allow_alt_description', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('allow_alt_description', esc($allow_alt_description_choices, 'attr'), '', ['class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('allow_alt_description', esc($allow_alt_description_choices), '', ['class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Items.is_serialized'), 'is_serialized', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('is_serialized', esc($serialization_choices, 'attr'), '', ['class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('is_serialized', esc($serialization_choices), '', ['class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -171,7 +171,7 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#category').autocomplete({
|
||||
source: "<?php echo site_url('items/suggest_category') ?>",
|
||||
source: "<?php echo 'items/suggest_category' ?>",
|
||||
appendTo: '.modal-content',
|
||||
delay: 10
|
||||
});
|
||||
@@ -195,7 +195,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ use App\Models\Employee;
|
||||
'id' => 'item_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'disabled' => '',
|
||||
'value' => esc($item_info->item_number, 'attr')
|
||||
'value' => esc($item_info->item_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -34,7 +34,7 @@ use App\Models\Employee;
|
||||
'id' => 'name',
|
||||
'class' => 'form-control input-sm',
|
||||
'disabled' => '',
|
||||
'value' => esc($item_info->name, 'attr')
|
||||
'value' => esc($item_info->name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,7 +49,7 @@ use App\Models\Employee;
|
||||
'id' => 'category',
|
||||
'class' => 'form-control input-sm',
|
||||
'disabled' => '',
|
||||
'value' => esc($item_info->category, 'attr')
|
||||
'value' => esc($item_info->category)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,7 +58,7 @@ use App\Models\Employee;
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Items.stock_location'), 'stock_location', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('stock_location', esc($stock_locations, 'attr'), current($stock_locations), ['onchange' => 'display_stock(this.value);', 'class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('stock_location', esc($stock_locations), current($stock_locations), ['onchange' => 'display_stock(this.value);', 'class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<fieldset id="item_basic_info">
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="col-xs-12">
|
||||
<a href="<?php echo site_url('items/generate_csv_file') ?>"><?php echo lang('Common.download_import_template') ?></a>
|
||||
<a href="<?php echo 'items/generate_csv_file' ?>"><?php echo lang('Common.download_import_template') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ $(document).ready(function()
|
||||
success:function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit('<?php echo site_url('items') ?>', response);
|
||||
table_support.handle_submit('<?php echo 'items' ?>', response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
'id' => 'item_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'disabled' => '',
|
||||
'value' => esc($item_info->item_number, 'attr')
|
||||
'value' => esc($item_info->item_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@
|
||||
'id' => 'name',
|
||||
'class' => 'form-control input-sm',
|
||||
'disabled' => '',
|
||||
'value' => esc($item_info->name, 'attr')
|
||||
'value' => esc($item_info->name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
'id' => 'category',
|
||||
'class' => 'form-control input-sm',
|
||||
'disabled' => '',
|
||||
'value' => esc($item_info->category, 'attr')
|
||||
'value' => esc($item_info->category)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Items.stock_location'), 'stock_location', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('stock_location', esc($stock_locations, 'attr'), current($stock_locations), ['onchange' => 'fill_quantity(this.value)', 'class' => 'form-control']) ?>
|
||||
<?php echo form_dropdown('stock_location', esc($stock_locations), current($stock_locations), ['onchange' => 'fill_quantity(this.value)', 'class' => 'form-control']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -111,7 +111,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -50,8 +50,8 @@ $(document).ready(function()
|
||||
|
||||
table_support.init({
|
||||
employee_id: <?php echo $employee->get_logged_in_employee_info()->person_id ?>,
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers, 'js') ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'items.item_id',
|
||||
queryParams: function() {
|
||||
@@ -73,12 +73,12 @@ $(document).ready(function()
|
||||
</script>
|
||||
|
||||
<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(site_url("$controller_name/csv_import"), 'url') ?>'
|
||||
<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/csvImport" ?>'
|
||||
title='<?php echo lang('Items.import_items_csv') ?>'>
|
||||
<span class="glyphicon glyphicon-import"> </span><?php echo lang('Common.import_csv') ?>
|
||||
</button>
|
||||
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-new='<?php echo lang('Common.new') ?>' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-new='<?php echo lang('Common.new') ?>' 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-tag"> </span><?php echo lang("$controller_name.new") ?>
|
||||
</button>
|
||||
@@ -89,17 +89,17 @@ $(document).ready(function()
|
||||
<button id="delete" class="btn btn-default btn-sm print_hide">
|
||||
<span class="glyphicon glyphicon-trash"> </span><?php echo lang('Common.delete') ?>
|
||||
</button>
|
||||
<button id="bulk_edit" class="btn btn-default btn-sm modal-dlg print_hide" data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/bulk_edit"), 'url') ?>'
|
||||
<button id="bulk_edit" class="btn btn-default btn-sm modal-dlg print_hide" data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo "$controller_name/bulk_edit" ?>'
|
||||
title='<?php echo lang('Items.edit_multiple_items') ?>'>
|
||||
<span class="glyphicon glyphicon-edit"> </span><?php echo lang('Items.bulk_edit') ?>
|
||||
</button>
|
||||
<button id="generate_barcodes" class="btn btn-default btn-sm print_hide" data-href='<?php echo esc(site_url("$controller_name/generate_barcodes"), 'url') ?>' title='<?php echo lang('Items.generate_barcodes') ?>'>
|
||||
<button id="generate_barcodes" class="btn btn-default btn-sm print_hide" data-href='<?php echo "$controller_name/generate_barcodes" ?>' title='<?php echo lang('Items.generate_barcodes') ?>'>
|
||||
<span class="glyphicon glyphicon-barcode"> </span><?php echo lang('Items.generate_barcodes') ?>
|
||||
</button>
|
||||
<?php echo form_input (['name' => 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
|
||||
<?php echo form_multiselect(
|
||||
'filters[]',
|
||||
esc($filters, 'attr'),
|
||||
esc($filters),
|
||||
[''],
|
||||
[
|
||||
'id' => 'filters',
|
||||
@@ -114,7 +114,7 @@ $(document).ready(function()
|
||||
{
|
||||
echo form_dropdown(
|
||||
'stock_location',
|
||||
esc($stock_locations, 'attr'),
|
||||
esc($stock_locations),
|
||||
$stock_location,
|
||||
[
|
||||
'id' => 'stock_location',
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
|
||||
<ul id="error_message_box" class="error_message_box"></ul>
|
||||
|
||||
<?php echo form_open(esc("messages/send_form/$person_info->person_id", 'attr'), ['id' => 'send_sms_form', 'class' => 'form-horizontal']) ?>
|
||||
<?php echo form_open(esc("messages/send_form/$person_info->person_id"), ['id' => 'send_sms_form', 'class' => 'form-horizontal']) ?>
|
||||
<fieldset>
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Messages.first_name'), 'first_name_label', ['for' => 'first_name', 'class' => 'control-label col-xs-2']) ?>
|
||||
<div class="col-xs-10">
|
||||
<?php echo form_input (['class' => 'form-control input-sm', 'type' => 'text', 'name' => 'first_name', 'value' => esc($person_info->first_name, 'attr'), 'readonly' => 'true']) ?>
|
||||
<?php echo form_input (['class' => 'form-control input-sm', 'type' => 'text', 'name' => 'first_name', 'value' => esc($person_info->first_name), 'readonly' => 'true']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Messages.last_name'), 'last_name_label', ['for' => 'last_name', 'class' => 'control-label col-xs-2']) ?>
|
||||
<div class="col-xs-10">
|
||||
<?php echo form_input (['class' => 'form-control input-sm', 'type' => 'text', 'name' => 'last_name', 'value' => esc($person_info->last_name, 'attr'), 'readonly' => 'true']) ?>
|
||||
<?php echo form_input (['class' => 'form-control input-sm', 'type' => 'text', 'name' => 'last_name', 'value' => esc($person_info->last_name), 'readonly' => 'true']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
@@ -27,14 +27,14 @@
|
||||
<div class="col-xs-10">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-phone-alt"></span></span>
|
||||
<?php echo form_input (['class' => 'form-control input-sm required', 'type' => 'text', 'name' => 'phone', 'value' => esc($person_info->phone_number, 'attr')]) ?>
|
||||
<?php echo form_input (['class' => 'form-control input-sm required', 'type' => 'text', 'name' => 'phone', 'value' => esc($person_info->phone_number)]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Messages.message'), 'message_label', ['for' => 'message', 'class' => 'control-label col-xs-2 required']) ?>
|
||||
<div class="col-xs-10">
|
||||
<?php echo form_textarea (['class' => 'form-control input-sm required', 'name' => 'message', 'id' => 'message', 'value' => esc($config['msg_msg'], 'attr')]) ?>
|
||||
<?php echo form_textarea (['class' => 'form-control input-sm required', 'name' => 'message', 'id' => 'message', 'value' => esc($config['msg_msg'])]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -50,7 +50,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php $this->lang->load('calendar'); $this->lang->load('date'); ?>
|
||||
<?php $config = config('OSPOS')->settings; ?>
|
||||
|
||||
var pickerconfig = function(config) {
|
||||
return $.extend({
|
||||
@@ -25,7 +25,7 @@ var pickerconfig = function(config) {
|
||||
todayHighlight: true,
|
||||
bootcssVer: 3,
|
||||
language: "<?php echo current_language_code() ?>"
|
||||
}, <?php echo $config ?? '{}' ?>);
|
||||
}, <?php '{}' ?>);
|
||||
};
|
||||
|
||||
$.fn.datetimepicker.dates['<?php echo $config['language'] ?>'] = {
|
||||
|
||||
@@ -18,10 +18,10 @@ foreach($dinner_tables as $table_key => $table)
|
||||
|
||||
<div class='col-xs-2'>
|
||||
<?php $form_data = [
|
||||
'name' => esc("dinner_table_$dinner_table_id", 'attr'),
|
||||
'id' => esc("dinner_table_$dinner_table_id", 'attr'),
|
||||
'name' => esc("dinner_table_$dinner_table_id"),
|
||||
'id' => esc("dinner_table_$dinner_table_id"),
|
||||
'class' => 'dinner_table valid_chars form-control input-sm required',
|
||||
'value' => esc($dinner_table_name, 'attr')
|
||||
'value' => esc($dinner_table_name)
|
||||
];
|
||||
$table['deleted'] && $form_data['disabled'] = 'disabled';
|
||||
echo form_input($form_data);
|
||||
|
||||
@@ -19,7 +19,7 @@ $request = Services::request();
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?php echo base_url() ?>favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo 'dist/bootswatch/' . (empty($config['theme']) ? 'flatly' : esc($config['theme'])) . '/bootstrap.min.css' ?>"/>
|
||||
|
||||
<?php if (get_cookie('debug') == 'true' || $request->getGet('debug') == 'true') : ?>
|
||||
<?php if (ENVIRONMENT == 'development' || get_cookie('debug') == 'true' || $request->getGet('debug') == 'true') : ?>
|
||||
<!-- bower:css -->
|
||||
<!-- endbower -->
|
||||
<!-- injector:css -->
|
||||
@@ -39,7 +39,7 @@ $request = Services::request();
|
||||
<?php if ($config['theme'] != 'flatly' && file_exists($_SERVER['DOCUMENT_ROOT'] . '/public/css/' . esc($config['theme']) . '.css')) { ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo 'css/' . esc($config['theme']) . '.css' ?>"/>
|
||||
<?php } ?>
|
||||
<!-- minjs injector:css -->
|
||||
<!-- minjs injector:js -->
|
||||
<!-- endinjector -->
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -62,8 +62,8 @@ $request = Services::request();
|
||||
</div>
|
||||
|
||||
<div class="navbar-right" style="margin:0">
|
||||
<?= anchor(esc("home/change_password/$user_info->person_id", 'url'), esc("$user_info->first_name $user_info->last_name", 'attr'), ['class' => 'modal-dlg', 'data-btn-submit' => lang('Common.submit'), 'title' => lang('Employees.change_password')]) ?>
|
||||
<?= ' | ' . ($request->getGet('debug') == 'true' ? session('session_sha1') . ' | ' : '') ?>
|
||||
<?= anchor(esc("home/change_password/$user_info->person_id", 'url'), esc("$user_info->first_name $user_info->last_name"), ['class' => 'modal-dlg', 'data-btn-submit' => lang('Common.submit'), 'title' => lang('Employees.change_password')]) ?>
|
||||
<?= ' | ' . ((ENVIRONMENT == 'development' || $request->getGet('debugdebug') == 'true') ? session('session_sha1') . ' | ' : '') ?>
|
||||
<?= anchor('home/logout', lang('Login.logout')) ?>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ foreach($stock_locations as $location => $location_data)
|
||||
'name' => "stock_location[$location_id]",
|
||||
'id' => "stock_location[$location_id]",
|
||||
'class' => 'stock_location valid_chars form-control input-sm required',
|
||||
'value' => esc($location_name, 'attr')
|
||||
'value' => esc($location_name)
|
||||
];
|
||||
$location_data['deleted'] && $form_data['disabled'] = 'disabled';
|
||||
echo form_input($form_data);
|
||||
|
||||
@@ -21,7 +21,7 @@ foreach($tax_categories as $key => $category)
|
||||
'id' => "tax_category_$i",
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder' => lang('Taxes.tax_category_name'),
|
||||
'value' => esc($tax_category, 'attr')
|
||||
'value' => esc($tax_category)
|
||||
];
|
||||
echo form_input($form_data);
|
||||
?>
|
||||
@@ -31,7 +31,7 @@ foreach($tax_categories as $key => $category)
|
||||
'name' => 'tax_group_sequence[]',
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder' => lang('Taxes.sequence'),
|
||||
'value' => esc($tax_group_sequence, 'attr')
|
||||
'value' => esc($tax_group_sequence)
|
||||
];
|
||||
echo form_input($form_data);
|
||||
?>
|
||||
|
||||
@@ -23,7 +23,7 @@ foreach($tax_codes as $tax_code => $tax_code_data)
|
||||
'id' => "tax_code_$i",
|
||||
'class' => 'valid_chars text-uppercase form-control input-sm',
|
||||
'placeholder' => lang('Taxes.code'),
|
||||
'value' => esc($tax_code, 'attr')
|
||||
'value' => esc($tax_code)
|
||||
];
|
||||
echo form_input($form_data)
|
||||
?>
|
||||
@@ -33,7 +33,7 @@ foreach($tax_codes as $tax_code => $tax_code_data)
|
||||
'name' => 'tax_code_name[]',
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder'=>lang('Taxes.name'),
|
||||
'value' => esc($tax_code_name, 'attr')
|
||||
'value' => esc($tax_code_name)
|
||||
];
|
||||
echo form_input($form_data)
|
||||
?>
|
||||
@@ -43,7 +43,7 @@ foreach($tax_codes as $tax_code => $tax_code_data)
|
||||
'name' => 'city[]',
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder'=>lang('Taxes.city'),
|
||||
'value' => esc($city, 'attr')
|
||||
'value' => esc($city)
|
||||
];
|
||||
echo form_input($form_data)
|
||||
?>
|
||||
@@ -53,7 +53,7 @@ foreach($tax_codes as $tax_code => $tax_code_data)
|
||||
'name' => 'state[]',
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder'=>lang('Taxes.state'),
|
||||
'value' => esc($state, 'attr')
|
||||
'value' => esc($state)
|
||||
];
|
||||
echo form_input($form_data)
|
||||
?>
|
||||
|
||||
@@ -26,7 +26,7 @@ foreach($tax_jurisdictions as $tax_jurisdiction => $jurisdiction)
|
||||
'id' => "jurisdiction_name_$i",
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder' => lang('Taxes.jurisdiction_name'),
|
||||
'value' => esc($jurisdiction_name, 'attr')
|
||||
'value' => esc($jurisdiction_name)
|
||||
];
|
||||
echo form_input($form_data);
|
||||
?>
|
||||
@@ -37,7 +37,7 @@ foreach($tax_jurisdictions as $tax_jurisdiction => $jurisdiction)
|
||||
'name' => 'tax_group[]',
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder' => lang('Taxes.tax_group'),
|
||||
'value' => esc($tax_group, 'attr')
|
||||
'value' => esc($tax_group)
|
||||
];
|
||||
echo form_input($form_data);
|
||||
?>
|
||||
@@ -52,7 +52,7 @@ foreach($tax_jurisdictions as $tax_jurisdiction => $jurisdiction)
|
||||
'name' => 'reporting_authority[]',
|
||||
'class' => 'valid_chars form-control input-sm',
|
||||
'placeholder' => lang('Taxes.reporting_authority'),
|
||||
'value' => esc($reporting_authority, 'attr')
|
||||
'value' => esc($reporting_authority)
|
||||
];
|
||||
echo form_input($form_data)
|
||||
?>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
'name' => 'first_name',
|
||||
'id' => 'first_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->first_name, 'attr')
|
||||
'value' => esc($person_info->first_name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,7 +22,7 @@
|
||||
'name' => 'last_name',
|
||||
'id' => 'last_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->last_name, 'attr')
|
||||
'value' => esc($person_info->last_name)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,7 +61,7 @@
|
||||
'name' => 'email',
|
||||
'id' => 'email',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->email, 'attr')
|
||||
'value' => esc($person_info->email)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,7 +76,7 @@
|
||||
'name' => 'phone_number',
|
||||
'id' => 'phone_number',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->phone_number, 'attr')
|
||||
'value' => esc($person_info->phone_number)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,7 +89,7 @@
|
||||
'name' => 'address_1',
|
||||
'id' => 'address_1',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->address_1, 'attr')
|
||||
'value' => esc($person_info->address_1)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,7 +101,7 @@
|
||||
'name' => 'address_2',
|
||||
'id' => 'address_2',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->address_2, 'attr')
|
||||
'value' => esc($person_info->address_2)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -113,7 +113,7 @@
|
||||
'name' => 'city',
|
||||
'id' => 'city',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->city, 'attr')
|
||||
'value' => esc($person_info->city)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,7 +125,7 @@
|
||||
'name' => 'state',
|
||||
'id' => 'state',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->state, 'attr')
|
||||
'value' => esc($person_info->state)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -137,7 +137,7 @@
|
||||
'name' => 'zip',
|
||||
'id' => 'postcode',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->zip, 'attr')
|
||||
'value' => esc($person_info->zip)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -149,7 +149,7 @@
|
||||
'name' => 'country',
|
||||
'id' => 'country',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->country, 'attr')
|
||||
'value' => esc($person_info->country)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,7 +161,7 @@
|
||||
'name' => 'comments',
|
||||
'id' => 'comments',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($person_info->comments, 'attr')
|
||||
'value' => esc($person_info->comments)
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,8 +12,8 @@ $(document).ready(function()
|
||||
<?php echo view('partial/bootstrap_tables_locale') ?>
|
||||
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers, 'js') ?>,
|
||||
resource: '<?php echo esc($controller_name) ?>',
|
||||
headers: <?php echo $table_headers ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'people.person_id',
|
||||
enableActions: function()
|
||||
@@ -39,14 +39,14 @@ $(document).ready(function()
|
||||
if ($controller_name == 'customers') //TODO: === ?
|
||||
{
|
||||
?>
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/csv_import"), 'url') ?>'
|
||||
<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/csvImport" ?>'
|
||||
title='<?php echo lang('Customers.import_items_csv') ?>'>
|
||||
<span class="glyphicon glyphicon-import"> </span><?php echo lang('Common.import_csv') ?>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<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-user"> </span><?php echo lang("$controller_name.new") ?>
|
||||
</button>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Receivings.supplier'), 'supplier', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_input (['name' => 'supplier_name', 'value' => esc($selected_supplier_name, 'attr'), 'id' => 'supplier_name', 'class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_input (['name' => 'supplier_name', 'value' => esc($selected_supplier_name), 'id' => 'supplier_name', 'class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_hidden('supplier_id', $selected_supplier_id) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,21 +42,21 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Receivings.reference'), 'reference', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_input (['name' => 'reference', 'value' => esc($receiving_info['reference'], 'attr'), 'id' => 'reference', 'class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_input (['name' => 'reference', 'value' => esc($receiving_info['reference']), 'id' => 'reference', 'class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Receivings.employee'), 'employee', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_dropdown('employee_id', esc($employees, 'attr'), $receiving_info['employee_id'], 'id="employee_id" class="form-control"') ?>
|
||||
<?php echo form_dropdown('employee_id', esc($employees), $receiving_info['employee_id'], 'id="employee_id" class="form-control"') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Receivings.comments'), 'comment', ['class' => 'control-label col-xs-3']) ?>
|
||||
<div class='col-xs-8'>
|
||||
<?php echo form_textarea (['name' => 'comment','value' => esc($receiving_info['comment'], 'attr'), 'id' => 'comment', 'class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_textarea (['name' => 'comment','value' => esc($receiving_info['comment']), 'id' => 'comment', 'class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -76,7 +76,7 @@ $(document).ready(function()
|
||||
};
|
||||
|
||||
$('#supplier_name').autocomplete({
|
||||
source: "<?php echo site_url('suppliers/suggest') ?>",
|
||||
source: "<?php echo 'suppliers/suggest' ?>",
|
||||
minChars: 0,
|
||||
delay: 15,
|
||||
cacheLength: 1,
|
||||
@@ -88,7 +88,7 @@ $(document).ready(function()
|
||||
$('button#delete').click(function()
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.do_delete("<?php echo esc(site_url($controller_name), 'url') ?>", <?php echo $receiving_info['receiving_id'] ?>);
|
||||
table_support.do_delete("<?php echo esc($controller_name) ?>", <?php echo $receiving_info['receiving_id'] ?>);
|
||||
});
|
||||
|
||||
$('#receivings_edit_form').validate($.extend({
|
||||
@@ -97,7 +97,7 @@ $(document).ready(function()
|
||||
success: function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
|
||||
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
</div>
|
||||
|
||||
<div id='barcode'>
|
||||
<img alt='<?php echo esc($barcode, 'attr') ?>' src='data:image/png;base64,<?php echo esc($barcode, 'attr') ?>' /><br>
|
||||
<img alt='<?php echo esc($barcode) ?>' src='data:image/png;base64,<?php echo esc($barcode) ?>' /><br>
|
||||
<?php echo $receiving_id ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,14 +39,14 @@ if (isset($success))
|
||||
|
||||
<!-- Top register controls -->
|
||||
|
||||
<?= form_open(esc("$controller_name/change_mode", 'attr'), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
|
||||
<?= form_open(esc("$controller_name/change_mode"), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
|
||||
<div class="panel-body form-group">
|
||||
<ul>
|
||||
<li class="pull-left first_li">
|
||||
<label class="control-label"><?php echo lang('Receivings.mode') ?></label>
|
||||
</li>
|
||||
<li class="pull-left">
|
||||
<?php echo form_dropdown('mode', esc($modes, 'attr'), esc($mode, 'attr'), ['onchange'=>"$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
<?php echo form_dropdown('mode', esc($modes), esc($mode), ['onchange'=>"$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
@@ -57,7 +57,7 @@ if (isset($success))
|
||||
<label class="control-label"><?php echo lang('Receivings.stock_source') ?></label>
|
||||
</li>
|
||||
<li class="pull-left">
|
||||
<?php echo form_dropdown('stock_source', esc($stock_locations, 'attr'), $stock_source, ['onchange'=>"$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
<?php echo form_dropdown('stock_source', esc($stock_locations), $stock_source, ['onchange'=>"$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
@@ -68,7 +68,7 @@ if (isset($success))
|
||||
<label class="control-label"><?php echo lang('Receivings.stock_destination') ?></label>
|
||||
</li>
|
||||
<li class="pull-left">
|
||||
<?php echo form_dropdown('stock_destination', esc($stock_locations, 'attr'), esc($stock_destination, 'attr'), ['onchange'=>"$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
<?php echo form_dropdown('stock_destination', esc($stock_locations), esc($stock_destination), ['onchange'=>"$('#mode_form').submit();", 'class' => 'selectpicker show-menu-arrow', 'data-style' => 'btn-default btn-sm', 'data-width' => 'fit']) ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -106,7 +106,7 @@ if (isset($success))
|
||||
<button id='new_item_button' class='btn btn-info btn-sm pull-right modal-dlg'
|
||||
data-btn-submit='<?php echo lang('Common.submit') ?>'
|
||||
data-btn-new='<?php echo lang('Common.new') ?>'
|
||||
data-href='<?php echo site_url("items/view") ?>'
|
||||
data-href='<?php echo "items/view" ?>'
|
||||
title='<?php echo lang('Sales.new_item') ?>'>
|
||||
<span class="glyphicon glyphicon-tag"> </span><?php echo lang('Sales.new_item') ?>
|
||||
</button>
|
||||
@@ -149,9 +149,9 @@ if (isset($success))
|
||||
foreach(array_reverse($cart, TRUE) as $line => $item)
|
||||
{
|
||||
?>
|
||||
<?php echo form_open(esc("$controller_name/edit_item/$line", 'attr'), ['class' => 'form-horizontal', 'id' => "cart_$line"]) ?>
|
||||
<?php echo form_open(esc("$controller_name/editItem/$line"), ['class' => 'form-horizontal', 'id' => "cart_$line"]) ?>
|
||||
<tr>
|
||||
<td><?php echo anchor(esc("$controller_name/delete_item/$line", 'url'), '<span class="glyphicon glyphicon-trash"></span>') ?></td>
|
||||
<td><?php echo anchor(esc("$controller_name/deleteItem/$line", 'url'), '<span class="glyphicon glyphicon-trash"></span>') ?></td>
|
||||
<td><?php echo esc($item['item_number']) ?></td>
|
||||
<td style="align:center;">
|
||||
<?php echo esc($item['name'] . ' '. implode(' ', [$item['attribute_values'], $item['attribute_dtvalues']])) ?><br /> <?php echo '[' . to_quantity_decimals($item['in_stock']) . ' in ' . $item['stock_name'] . ']' ?>
|
||||
@@ -184,7 +184,7 @@ if (isset($success))
|
||||
<td><?php echo form_input (['name' => 'quantity', 'class' => 'form-control input-sm', 'value' => to_quantity_decimals($item['quantity']),'onClick' => 'this.select();']) ?></td>
|
||||
<td><?php echo form_dropdown(
|
||||
'receiving_quantity',
|
||||
esc($item['receiving_quantity_choices'], 'attr'),
|
||||
esc($item['receiving_quantity_choices']),
|
||||
$item['receiving_quantity'],
|
||||
['class' => 'form-control input-sm']
|
||||
) ?></td>
|
||||
@@ -204,9 +204,9 @@ if (isset($success))
|
||||
'data-toggle' => "toggle",
|
||||
'data-size' => 'small',
|
||||
'data-onstyle' => 'success',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol'], 'attr') .'</b>',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol']) .'</b>',
|
||||
'data-off' => '<b>%</b>',
|
||||
'data-line' => esc($line, 'attr'),
|
||||
'data-line' => esc($line),
|
||||
'checked' => $item['discount_type']
|
||||
]) ?>
|
||||
</span>
|
||||
@@ -242,7 +242,7 @@ if (isset($success))
|
||||
echo form_input ([
|
||||
'name' => 'description',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($item['description'], 'attr')
|
||||
'value' => esc($item['description'])
|
||||
]);
|
||||
}
|
||||
else
|
||||
@@ -250,7 +250,7 @@ if (isset($success))
|
||||
if ($item['description'] != '') //TODO: !==?
|
||||
{
|
||||
echo $item['description'];
|
||||
echo form_hidden('description', esc($item['description'], 'attr'));
|
||||
echo form_hidden('description', esc($item['description']));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -332,7 +332,7 @@ if (isset($success))
|
||||
else
|
||||
{
|
||||
?>
|
||||
<?php echo form_open(esc("$controller_name/select_supplier", 'attr'), ['id' => 'select_supplier_form', 'class' => 'form-horizontal']) ?>
|
||||
<?php echo form_open(esc("$controller_name/select_supplier"), ['id' => 'select_supplier_form', 'class' => 'form-horizontal']) ?>
|
||||
<div class="form-group" id="select_customer">
|
||||
<label id="supplier_label" for="supplier" class="control-label" style="margin-bottom: 1em; margin-top: -1em;"><?php echo lang('Receivings.select_supplier') ?></label>
|
||||
<?php echo form_input ([
|
||||
@@ -342,7 +342,7 @@ if (isset($success))
|
||||
'value' => lang('Receivings.start_typing_supplier_name')
|
||||
]) ?>
|
||||
|
||||
<button id='new_supplier_button' class='btn btn-info btn-sm modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo site_url("suppliers/view") ?>'
|
||||
<button id='new_supplier_button' class='btn btn-info btn-sm modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo "suppliers/view" ?>'
|
||||
title='<?php echo lang('Receivings.new_supplier') ?>'>
|
||||
<span class="glyphicon glyphicon-user"> </span><?php echo lang('Receivings.new_supplier') ?>
|
||||
</button>
|
||||
@@ -383,7 +383,7 @@ if (isset($success))
|
||||
if($mode == 'requisition')
|
||||
{
|
||||
?>
|
||||
<?php echo form_open(esc("$controller_name/requisition_complete", 'attr'), ['id' => 'finish_receiving_form', 'class' => 'form-horizontal']) ?>
|
||||
<?php echo form_open(esc("$controller_name/requisition_complete"), ['id' => 'finish_receiving_form', 'class' => 'form-horizontal']) ?>
|
||||
<div class="form-group form-group-sm">
|
||||
<label id="comment_label" for="comment"><?php echo lang('Common.comments') ?></label>
|
||||
<?php echo form_textarea ([
|
||||
@@ -411,7 +411,7 @@ if (isset($success))
|
||||
'name' => 'comment',
|
||||
'id' => 'comment',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($comment, 'attr'),
|
||||
'value' => esc($comment),
|
||||
'rows' => '4'
|
||||
]) ?>
|
||||
<div id="payment_details" >
|
||||
@@ -439,7 +439,7 @@ if (isset($success))
|
||||
'name' => 'recv_reference',
|
||||
'id' => 'recv_reference',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc($reference, 'attr'),
|
||||
'value' => esc($reference),
|
||||
'size' => 5
|
||||
]) ?>
|
||||
</td>
|
||||
@@ -452,7 +452,7 @@ if (isset($success))
|
||||
<td>
|
||||
<?php echo form_dropdown(
|
||||
'payment_type',
|
||||
esc($payment_options, 'attr'),
|
||||
esc($payment_options),
|
||||
[],
|
||||
[
|
||||
'id' => 'payment_types',
|
||||
@@ -496,7 +496,7 @@ $(document).ready(function()
|
||||
{
|
||||
$("#item").autocomplete(
|
||||
{
|
||||
source: '<?php echo esc(site_url("$controller_name/stock_item_search"), 'url') ?>',
|
||||
source: '<?php echo esc("$controller_name/stock_item_search") ?>',
|
||||
minChars:0,
|
||||
delay:10,
|
||||
autoFocus: false,
|
||||
@@ -523,17 +523,17 @@ $(document).ready(function()
|
||||
|
||||
$('#comment').keyup(function()
|
||||
{
|
||||
$.post('<?php echo esc(site_url("$controller_name/set_comment"), 'url') ?>', {comment: $('#comment').val()});
|
||||
$.post('<?php echo esc("$controller_name/set_comment") ?>', {comment: $('#comment').val()});
|
||||
});
|
||||
|
||||
$('#recv_reference').keyup(function()
|
||||
{
|
||||
$.post('<?php echo esc(site_url("$controller_name/set_reference"), 'url') ?>', {recv_reference: $('#recv_reference').val()});
|
||||
$.post('<?php echo esc("$controller_name/set_reference") ?>', {recv_reference: $('#recv_reference').val()});
|
||||
});
|
||||
|
||||
$("#recv_print_after_sale").change(function()
|
||||
{
|
||||
$.post('<?php echo esc(site_url("$controller_name/set_print_after_sale"), 'url') ?>', {recv_print_after_sale: $(this).is(":checked")});
|
||||
$.post('<?php echo esc("$controller_name/set_print_after_sale") ?>', {recv_print_after_sale: $(this).is(":checked")});
|
||||
});
|
||||
|
||||
$('#item,#supplier').click(function()
|
||||
@@ -543,7 +543,7 @@ $(document).ready(function()
|
||||
|
||||
$("#supplier").autocomplete(
|
||||
{
|
||||
source: '<?php echo site_url("suppliers/suggest") ?>',
|
||||
source: '<?php echo "suppliers/suggest" ?>',
|
||||
minChars:0,
|
||||
delay:10,
|
||||
select: function (a, ui) {
|
||||
@@ -568,7 +568,7 @@ $(document).ready(function()
|
||||
{
|
||||
if (confirm('<?php echo lang('Receivings.confirm_cancel_receiving') ?>'))
|
||||
{
|
||||
$('#finish_receiving_form').attr('action', '<?php echo esc(site_url("$controller_name/cancel_receiving"), 'url') ?>');
|
||||
$('#finish_receiving_form').attr('action', '<?php echo esc("$controller_name/cancel_receiving") ?>');
|
||||
$('#finish_receiving_form').submit();
|
||||
}
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user