mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-16 12:26:23 -04:00
Formatting
- Convert indents to tabs - Remove unnecessary else statement - Correct PHPDoc formatting
This commit is contained in:
@@ -18,7 +18,7 @@ before_install:
|
||||
script:
|
||||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
- docker run --rm -v $(pwd):/app opensourcepos/composer composer install
|
||||
- version=$(grep application_version application/config/config.php | sed "s/.*=\s'\(.*\)';/\1/g")
|
||||
- version=$(grep application_version app/Config/App.php | sed "s/.*=\s'\(.*\)';/\1/g")
|
||||
- echo "$version-$branch-$rev"
|
||||
- npm version "$version-$branch-$rev" --force || true
|
||||
- docker run --rm -it -v $(pwd):/app -w /app opensourcepos/node-grunt-bower
|
||||
|
||||
@@ -523,7 +523,7 @@ class App extends BaseConfig
|
||||
parent::__construct();
|
||||
$this->https_on = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_ENV['FORCE_HTTPS']) && $_ENV['FORCE_HTTPS'] == 'true');
|
||||
$this->baseURL = $this->https_on ? 'https' : 'http';
|
||||
$this->baseURL .= '://' . ((isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : 'localhost');
|
||||
$this->baseURL .= '://' . ((isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : 'localhost') . '/';
|
||||
$this->baseURL .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,5 +202,8 @@ class Autoload extends AutoloadConfig
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $helpers = [];
|
||||
public $helpers = [
|
||||
'form',
|
||||
'cookie'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class Cache extends BaseConfig
|
||||
* hard-coded, but may be useful to projects and modules. This will replace
|
||||
* the hard-coded value in a future release.
|
||||
*/
|
||||
public int $ttl = 60;
|
||||
public int $ttl = 300;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@@ -57,7 +57,15 @@ class Encryption extends BaseConfig
|
||||
*/
|
||||
public string $digest = 'SHA512';
|
||||
|
||||
/**
|
||||
/**
|
||||
* The cipher to use.
|
||||
* This setting is only used by OpenSSLHandler.
|
||||
*
|
||||
* Set to aes-128-cbc for CI3 Encryption compatibility.
|
||||
*/
|
||||
public string $cipher = 'aes-256-ctr';
|
||||
|
||||
/**
|
||||
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
|
||||
* This setting is only used by OpenSSLHandler.
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Cache\CacheInterface;
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
/**
|
||||
@@ -11,5 +12,43 @@ use CodeIgniter\Config\BaseConfig;
|
||||
*/
|
||||
class OSPOS extends BaseConfig
|
||||
{
|
||||
public $settings = [];
|
||||
}
|
||||
public array $settings;
|
||||
|
||||
public string $commit_sha1 = 'dev'; //TODO: Travis scripts need to be updated to replace this with the commit hash on build
|
||||
|
||||
private CacheInterface $cache;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->cache = Services::cache();
|
||||
$this->set_settings();
|
||||
}
|
||||
|
||||
public function set_settings(): void
|
||||
{
|
||||
helper('locale');
|
||||
|
||||
$cache = $this->cache->get('settings');
|
||||
|
||||
if($cache)
|
||||
{
|
||||
$this->settings = decode_array($cache);
|
||||
}
|
||||
else
|
||||
{
|
||||
$appconfig = model('Appconfig');
|
||||
foreach($appconfig->get_all()->getResult() as $app_config)
|
||||
{
|
||||
$this->settings[$app_config->key] = $app_config->value;
|
||||
}
|
||||
$this->cache->save('settings', encode_array($this->settings));
|
||||
}
|
||||
}
|
||||
|
||||
public function update_settings(): void
|
||||
{
|
||||
$this->cache->delete('settings');
|
||||
$this->set_settings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class Session extends BaseConfig
|
||||
* when auto-regenerating the session ID. When set to FALSE, the data
|
||||
* will be later deleted by the garbage collector.
|
||||
*/
|
||||
public bool $regenerateDestroy = false;
|
||||
public bool $regenerateDestroy = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,7 @@ class OSPOSRules
|
||||
{
|
||||
$this->employee = model('Employee');
|
||||
$this->request = Services::request();
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
//Installation Check
|
||||
if(!$this->installation_check())
|
||||
@@ -42,9 +43,10 @@ class OSPOSRules
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//GCaptcha Check
|
||||
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', config('OSPOS')->settings)
|
||||
? config('OSPOS')->settings['gcaptcha_enable']
|
||||
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', $config)
|
||||
? $config['gcaptcha_enable']
|
||||
: false;
|
||||
|
||||
if($gcaptcha_enabled)
|
||||
@@ -73,7 +75,7 @@ class OSPOSRules
|
||||
if(!empty($response))
|
||||
{
|
||||
$check = [
|
||||
'secret' => config('OSPOS')->settings['gcaptcha_secret_key'],
|
||||
'secret' => $config['gcaptcha_secret_key'],
|
||||
'response' => $response,
|
||||
'remoteip' => $this->request->getIPAddress()
|
||||
];
|
||||
|
||||
@@ -23,6 +23,7 @@ class Attributes extends Secure_Controller
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_attribute_definition_manage_table_headers();
|
||||
|
||||
echo view('attributes/manage', $data);
|
||||
@@ -223,4 +224,4 @@ class Attributes extends Secure_Controller
|
||||
echo json_encode(['success' => FALSE, 'message' => lang('Attributes.definition_cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ namespace App\Controllers;
|
||||
use App\Models\Cashup;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Reports\Summary_payments;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
/**
|
||||
* @property cashup cashup
|
||||
* @property expense expense
|
||||
* @property summary_payments summary_payments
|
||||
* @property array $config
|
||||
*/
|
||||
class Cashups extends Secure_Controller
|
||||
{
|
||||
@@ -20,6 +22,7 @@ class Cashups extends Secure_Controller
|
||||
$this->cashup = model('Cashup');
|
||||
$this->expense = model('Expense');
|
||||
$this->summary_payments = model('Reports/Summary_payments');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
public function getIndex(): void
|
||||
@@ -102,7 +105,7 @@ class Cashups extends Secure_Controller
|
||||
$cash_ups_info->closed_amount_cash = $cash_ups_info->open_amount_cash + $cash_ups_info->transfer_amount_cash;
|
||||
|
||||
// if it's date mode only and not date & time truncate the open and end date to date only
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($this->config['date_or_time_format']))
|
||||
{
|
||||
// search for all the payments given the time range
|
||||
$inputs = [
|
||||
@@ -186,10 +189,10 @@ class Cashups extends Secure_Controller
|
||||
public function save(int $cashup_id = -1): void //TODO: Need to replace -1 with a constant in constants.php
|
||||
{
|
||||
$open_date = $this->request->getPost('open_date', FILTER_SANITIZE_STRING);
|
||||
$open_date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $open_date);
|
||||
$open_date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $open_date);
|
||||
|
||||
$close_date = $this->request->getPost('close_date', FILTER_SANITIZE_NUMBER_INT);
|
||||
$close_date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $close_date);
|
||||
$close_date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $close_date);
|
||||
|
||||
$cash_up_data = [
|
||||
'open_date' => $open_date_formatter->format('Y-m-d H:i:s'),
|
||||
@@ -264,4 +267,4 @@ class Cashups extends Secure_Controller
|
||||
{
|
||||
return ($closed_amount_cash - $open_amount_cash - $transfer_amount_cash + $closed_amount_due + $closed_amount_card + $closed_amount_check);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Libraries\Mailchimp_lib;
|
||||
use App\Libraries\Receiving_lib;
|
||||
use App\Libraries\Sale_lib;
|
||||
use App\Libraries\Tax_lib;
|
||||
use App\Libraries\Ci3encrypt;
|
||||
|
||||
use App\Models\Appconfig;
|
||||
use App\Models\Attribute;
|
||||
@@ -17,9 +18,10 @@ use App\Models\Enums\Rounding_mode;
|
||||
use App\Models\Stock_location;
|
||||
use App\Models\Tax;
|
||||
|
||||
use CodeIgniter\Encryption\Encryption;
|
||||
use CodeIgniter\Encryption\EncrypterInterface;
|
||||
use CodeIgniter\Files\File;
|
||||
use Config\Encryption;
|
||||
use Config\Services;
|
||||
use DirectoryIterator;
|
||||
use NumberFormatter;
|
||||
use ReflectionException;
|
||||
@@ -40,6 +42,7 @@ use ReflectionException;
|
||||
* @property rounding_mode rounding_mode
|
||||
* @property stock_location stock_location
|
||||
* @property tax tax
|
||||
* @property array config
|
||||
*/
|
||||
class Config extends Secure_Controller
|
||||
{
|
||||
@@ -51,7 +54,7 @@ class Config extends Secure_Controller
|
||||
$this->sale_lib = new Sale_lib();
|
||||
$this->receiving_lib = new receiving_lib();
|
||||
$this->tax_lib = new Tax_lib();
|
||||
|
||||
|
||||
$this->attribute = model('Attribute');
|
||||
$this->customer_rewards = model('Customer_rewards');
|
||||
$this->dinner_table = model('Dinner_table');
|
||||
@@ -59,9 +62,7 @@ class Config extends Secure_Controller
|
||||
$this->rounding_mode = model('Rounding_mode');
|
||||
$this->stock_location = model('Stock_location');
|
||||
$this->tax = model('Tax');
|
||||
|
||||
$this->encryption = new Encryption();
|
||||
$this->encrypter = $this->encryption->initialize();
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -74,7 +75,7 @@ class Config extends Secure_Controller
|
||||
$composer = FALSE;
|
||||
$license = [];
|
||||
|
||||
$license[$i]['title'] = 'Open Source Point Of Sale ' . config('OSPOSConfig')->application_version;
|
||||
$license[$i]['title'] = 'Open Source Point Of Sale ' . config('App')->application_version;
|
||||
|
||||
if(file_exists('license/LICENSE'))
|
||||
{
|
||||
@@ -250,7 +251,7 @@ class Config extends Secure_Controller
|
||||
$data['dinner_tables'] = $this->dinner_table->get_all()->getResultArray();
|
||||
$data['customer_rewards'] = $this->customer_rewards->get_all()->getResultArray();
|
||||
$data['support_barcode'] = $this->barcode_lib->get_list_barcodes();
|
||||
$data['logo_exists'] = config('OSPOS')->settings['company_logo'] != '';
|
||||
$data['logo_exists'] = $this->config['company_logo'] != '';
|
||||
$data['line_sequence_options'] = $this->sale_lib->get_line_sequence_options();
|
||||
$data['register_mode_options'] = $this->sale_lib->get_register_mode_options();
|
||||
$data['invoice_type_options'] = $this->sale_lib->get_invoice_type_options();
|
||||
@@ -259,7 +260,7 @@ class Config 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();
|
||||
$data['show_office_group'] = $this->module->get_show_office_group();
|
||||
$data['currency_code'] = config('OSPOS')->settings['currency_code'];
|
||||
$data['currency_code'] = $this->config['currency_code'];
|
||||
|
||||
// load all the license statements, they are already XSS cleaned in the private function
|
||||
$data['licenses'] = $this->_licenses();
|
||||
@@ -271,15 +272,17 @@ class Config extends Secure_Controller
|
||||
$image_allowed_types = ['jpg','jpeg','gif','svg','webp','bmp','png','tif','tiff'];
|
||||
$data['image_allowed_types'] = array_combine($image_allowed_types,$image_allowed_types);
|
||||
|
||||
$data['selected_image_allowed_types'] = explode('|', config('OSPOS')->settings['image_allowed_types']);
|
||||
$data['selected_image_allowed_types'] = explode('|', $this->config['image_allowed_types']);
|
||||
|
||||
//Load Integrations Related fields
|
||||
$data['mailchimp'] = [];
|
||||
|
||||
if($this->_check_encryption()) //TODO: Hungarian notation
|
||||
{
|
||||
$data['mailchimp']['api_key'] = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_api_key']);
|
||||
$data['mailchimp']['list_id'] = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
|
||||
$encrypter = Services::encrypter();
|
||||
|
||||
$data['mailchimp']['api_key'] = $encrypter->decrypt($this->config['mailchimp_api_key'] ?? '');
|
||||
$data['mailchimp']['list_id'] = $encrypter->decrypt($this->config['mailchimp_list_id'] ?? '');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -287,7 +290,6 @@ class Config extends Secure_Controller
|
||||
$data['mailchimp']['list_id'] = '';
|
||||
}
|
||||
|
||||
// load mailchimp lists associated to the given api key, already XSS cleaned in the private function
|
||||
$data['mailchimp']['lists'] = $this->_mailchimp();
|
||||
|
||||
echo view('configs/manage', $data);
|
||||
@@ -911,7 +913,7 @@ class Config extends Secure_Controller
|
||||
// switches immediately back to the register the mode reflects the change
|
||||
if($success == TRUE)
|
||||
{
|
||||
if(config('OSPOS')->settings['invoice_enable'])
|
||||
if($this->config['invoice_enable'])
|
||||
{
|
||||
$this->sale_lib->set_mode($batch_save_data['default_register_mode']);
|
||||
}
|
||||
@@ -939,13 +941,13 @@ class Config extends Secure_Controller
|
||||
*/
|
||||
private function _check_encryption(): bool //TODO: Hungarian notation
|
||||
{
|
||||
$encryption_key = config('OSPOS')->settings['encryption_key'];
|
||||
$encryption_key = config('Encryption')->key;
|
||||
|
||||
// check if the encryption_key config item is the default one
|
||||
if($encryption_key == '' || $encryption_key == 'YOUR KEY')
|
||||
{
|
||||
// Config path
|
||||
$config_path = APPPATH . 'config/config.php';
|
||||
$config_path = APPPATH . 'Config/config.php'; //TODO: This is now in APPPATH . 'Config\Encryption.php' but it shouldn't be pulled from here. It should be pulled from '\.env'
|
||||
|
||||
// Open the file
|
||||
$config = file_get_contents($config_path);
|
||||
@@ -953,11 +955,8 @@ class Config extends Secure_Controller
|
||||
// $key will be assigned a 32-byte (256-bit) hex-encoded random key
|
||||
$key = bin2hex($this->encryption->createKey());
|
||||
|
||||
// set the encryption key in the config item
|
||||
$this->appconfig->save(['encryption_key' => $key]);
|
||||
|
||||
// replace the empty placeholder with a real randomly generated encryption key
|
||||
$config = preg_replace("/(.*encryption_key.*)('');/", "$1'$key';", $config);
|
||||
$config = preg_replace("/(.*encryption_key.*)('');/", "$1'$key';", $config); //TODO: This needs to be modified also so that it replaces encryption.key = '' with encryption.key = '[NEW KEY]'
|
||||
|
||||
$result = FALSE;
|
||||
|
||||
@@ -984,4 +983,4 @@ class Config extends Secure_Controller
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Models\Tax_code;
|
||||
|
||||
use CodeIgniter\Encryption\Encryption;
|
||||
use CodeIgniter\Encryption\EncrypterInterface;
|
||||
use Config\Services;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ use stdClass;
|
||||
*
|
||||
* @property encryption encryption
|
||||
* @property encrypterinterface encrypter
|
||||
* @property array config
|
||||
*
|
||||
*/
|
||||
class Customers extends Persons
|
||||
@@ -32,16 +34,16 @@ class Customers extends Persons
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('customers');
|
||||
|
||||
helper('tabular');
|
||||
$this->mailchimp_lib = new Mailchimp_lib();
|
||||
|
||||
$this->customer = model('Customer');
|
||||
$this->tax_code = model('Tax_code');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
|
||||
$this->encryption = new Encryption();
|
||||
$this->encrypter = $this->encryption->initialize();
|
||||
$encrypter = Services::encrypter();
|
||||
|
||||
$this->_list_id = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
|
||||
$this->_list_id = $encrypter->decrypt($this->config['mailchimp_list_id']);
|
||||
}
|
||||
|
||||
public function getIndex(): void
|
||||
@@ -174,7 +176,7 @@ class Customers extends Persons
|
||||
$data['packages'] = $packages;
|
||||
$data['selected_package'] = $info->package_id;
|
||||
|
||||
if(config('OSPOS')->settings['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;
|
||||
}
|
||||
@@ -280,7 +282,7 @@ class Customers extends Persons
|
||||
'comments' => $this->request->getPost('comments', FILTER_SANITIZE_STRING)
|
||||
];
|
||||
|
||||
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['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,
|
||||
@@ -500,4 +502,4 @@ class Customers extends Persons
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class Expenses extends Secure_Controller
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_expenses_manage_table_headers();
|
||||
|
||||
// filters that will be loaded in the multiselect dropdown
|
||||
@@ -135,9 +136,10 @@ class Expenses extends Secure_Controller
|
||||
|
||||
public function save(int $expense_id = -1): void //TODO: Replace -1 with a constant
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING);
|
||||
|
||||
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate);
|
||||
$date_formatter = date_create_from_format($config['dateformat'] . ' ' . $config['timeformat'], $newdate);
|
||||
|
||||
$expense_data = [
|
||||
'date' => $date_formatter->format('Y-m-d H:i:s'),
|
||||
@@ -190,4 +192,4 @@ class Expenses extends Secure_Controller
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Expenses.cannot_be_deleted'), 'ids' => $expenses_to_delete]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
$data['table_headers'] = get_expense_category_manage_table_headers();
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_expense_category_manage_table_headers();
|
||||
|
||||
echo view('expenses_categories/manage', $data);
|
||||
}
|
||||
@@ -113,4 +114,4 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Expenses_categories.cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class Giftcards extends Secure_Controller
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_giftcards_manage_table_headers();
|
||||
|
||||
echo view('giftcards/manage', $data);
|
||||
@@ -73,11 +74,12 @@ class Giftcards extends Secure_Controller
|
||||
|
||||
public function view(int $giftcard_id = -1): void //TODO: Need to replace -1 with a constant
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$giftcard_info = $this->giftcard->get_info($giftcard_id);
|
||||
|
||||
$data['selected_person_name'] = ($giftcard_id > 0 && isset($giftcard_info->person_id)) ? $giftcard_info->first_name . ' ' . $giftcard_info->last_name : '';
|
||||
$data['selected_person_id'] = $giftcard_info->person_id;
|
||||
if(config('OSPOS')->settings['giftcard_number'] == 'random')
|
||||
if($config['giftcard_number'] == 'random')
|
||||
{
|
||||
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : '';
|
||||
}
|
||||
@@ -165,4 +167,4 @@ class Giftcards extends Secure_Controller
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Giftcards.cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,22 +6,23 @@ class Home extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(NULL, NULL, 'home');
|
||||
parent::__construct('home', NULL, 'home');
|
||||
}
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
$logged_in = $this->employee->is_logged_in();
|
||||
echo view('home/home');
|
||||
}
|
||||
|
||||
public function logout(): void
|
||||
public function getLogout(): void
|
||||
{
|
||||
$this->employee->logout();
|
||||
}
|
||||
|
||||
/*
|
||||
Load "change employee password" form
|
||||
*/
|
||||
/**
|
||||
* Load "change employee password" form
|
||||
*/
|
||||
public function change_password(int $employee_id = -1): void //TODO: Replace -1 with a constant
|
||||
{
|
||||
$person_info = $this->employee->get_info($employee_id);
|
||||
@@ -34,9 +35,9 @@ class Home extends Secure_Controller
|
||||
echo view('home/form_change_password', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Change employee password
|
||||
*/
|
||||
/**
|
||||
* Change employee password
|
||||
*/
|
||||
public function save(int $employee_id = -1): void //TODO: Replace -1 with a constant
|
||||
{
|
||||
if($this->request->getPost('current_password') != '' && $employee_id != -1)
|
||||
@@ -84,4 +85,4 @@ class Home extends Secure_Controller
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ class Item_kits extends Secure_Controller
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_item_kits_manage_table_headers();
|
||||
|
||||
echo view('item_kits/manage', $data);
|
||||
@@ -276,4 +277,4 @@ class Item_kits extends Secure_Controller
|
||||
// display barcodes
|
||||
echo view("barcodes/barcode_sheet", $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ require_once('Secure_Controller.php');
|
||||
* @property stock_location stock_location
|
||||
* @property supplier supplier
|
||||
* @property tax_category tax_category
|
||||
* @property array config
|
||||
*/
|
||||
class Items extends Secure_Controller
|
||||
{
|
||||
@@ -56,10 +57,12 @@ class Items extends Secure_Controller
|
||||
$this->stock_location = model('Stock_location');
|
||||
$this->supplier = model('Supplier');
|
||||
$this->tax_category = model('Tax_category');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$this->session->set('allow_temp_items', 0);
|
||||
|
||||
$data['table_headers'] = get_items_manage_table_headers();
|
||||
@@ -150,14 +153,14 @@ class Items extends Secure_Controller
|
||||
|
||||
if(sizeof($images) < 2 && !file_exists($thumb_path))
|
||||
{
|
||||
$config['image_library'] = 'gd2';
|
||||
$config['source_image'] = $image_path;
|
||||
$config['maintain_ratio'] = TRUE;
|
||||
$config['create_thumb'] = TRUE;
|
||||
$config['width'] = 52;
|
||||
$config['height'] = 32;
|
||||
$gd2_config['image_library'] = 'gd2';
|
||||
$gd2_config['source_image'] = $image_path;
|
||||
$gd2_config['maintain_ratio'] = TRUE;
|
||||
$gd2_config['create_thumb'] = TRUE;
|
||||
$gd2_config['width'] = 52;
|
||||
$gd2_config['height'] = 32;
|
||||
|
||||
$this->image->initialize($config);
|
||||
$this->image->initialize($gd2_config);
|
||||
$this->image->resize();
|
||||
|
||||
$thumb_path = $this->image->full_dst_path;
|
||||
@@ -284,9 +287,9 @@ class Items extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
$use_destination_based_tax = (boolean)config('OSPOS')->settings['use_destination_based_tax'];
|
||||
$data['include_hsn'] = config('OSPOS')->settings['include_hsn'] === '1';
|
||||
$data['category_dropdown'] = config('OSPOS')->settings['category_dropdown'];
|
||||
$use_destination_based_tax = (boolean)$this->config['use_destination_based_tax'];
|
||||
$data['include_hsn'] = $this->config['include_hsn'] === '1';
|
||||
$data['category_dropdown'] = $this->config['category_dropdown'];
|
||||
|
||||
if($data['category_dropdown'] === '1')
|
||||
{
|
||||
@@ -300,8 +303,8 @@ class Items extends Secure_Controller
|
||||
|
||||
if($item_id === NEW_ITEM)
|
||||
{
|
||||
$data['default_tax_1_rate'] = config('OSPOS')->settings['default_tax_1_rate'];
|
||||
$data['default_tax_2_rate'] = config('OSPOS')->settings['default_tax_2_rate'];
|
||||
$data['default_tax_1_rate'] = $this->config['default_tax_1_rate'];
|
||||
$data['default_tax_2_rate'] = $this->config['default_tax_2_rate'];
|
||||
|
||||
$item_info->receiving_quantity = 1;
|
||||
$item_info->reorder_level = 1;
|
||||
@@ -314,7 +317,7 @@ class Items extends Secure_Controller
|
||||
|
||||
if($use_destination_based_tax)
|
||||
{
|
||||
$item_info->tax_category_id = config('OSPOS')->settings['default_tax_category'];
|
||||
$item_info->tax_category_id = $this->config['default_tax_category'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +325,7 @@ class Items extends Secure_Controller
|
||||
$data['item_kit_disabled']
|
||||
&& $item_info->item_type == ITEM_KIT
|
||||
&& !$data['allow_temp_item']
|
||||
&& !(config('OSPOS')->settings['derive_sale_quantity'] === '1')
|
||||
&& !($this->config['derive_sale_quantity'] === '1')
|
||||
);
|
||||
|
||||
$data['item_info'] = $item_info;
|
||||
@@ -471,7 +474,7 @@ class Items extends Secure_Controller
|
||||
|
||||
foreach($result as &$item)
|
||||
{
|
||||
if(empty($item['item_number']) && config('OSPOS')->settings['barcode_generate_if_empty'])
|
||||
if(empty($item['item_number']) && $this->config['barcode_generate_if_empty'])
|
||||
{
|
||||
$barcode_instance = Barcode_lib::barcode_instance($item, $config);
|
||||
$item['item_number'] = $barcode_instance->getData();
|
||||
@@ -620,7 +623,7 @@ class Items extends Secure_Controller
|
||||
$new_item = TRUE;
|
||||
}
|
||||
|
||||
$use_destination_based_tax = (bool)config('OSPOS')->settings['use_destination_based_tax'];
|
||||
$use_destination_based_tax = (bool)$this->config['use_destination_based_tax'];
|
||||
|
||||
if(!$use_destination_based_tax)
|
||||
{
|
||||
@@ -733,9 +736,9 @@ class Items extends Secure_Controller
|
||||
'rules' => [
|
||||
'uploaded[items_image]',
|
||||
'is_image[items_image]',
|
||||
'max_size[items_image,' . config('OSPOS')->settings['image_max_size'] . ']',
|
||||
'max_dims[items_image,' . config('OSPOS')->settings['image_max_width'] . ',' . config('OSPOS')->settings['image_max_height'] . ']',
|
||||
'ext_in[items_image,' . config('OSPOS')->settings['image_allowed_types'] . ']'
|
||||
'max_size[items_image,' . $this->config['image_max_size'] . ']',
|
||||
'max_dims[items_image,' . $this->config['image_max_width'] . ',' . $this->config['image_max_height'] . ']',
|
||||
'ext_in[items_image,' . $this->config['image_allowed_types'] . ']'
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -1311,4 +1314,4 @@ class Items extends Secure_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,18 +11,16 @@ use Config\Services;
|
||||
*/
|
||||
class Login extends BaseController
|
||||
{
|
||||
protected $helpers = ['form'];
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->employee = model('Employee');
|
||||
if(!$this->employee->is_logged_in())
|
||||
{
|
||||
$migration = new MY_Migration(config('Migrations'));
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
//The gcaptcha_enable key was not added to app settings until 3.1.1. Without this check we get an error on new instances.
|
||||
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', config('OSPOS')->settings)
|
||||
? config('OSPOS')->settings['gcaptcha_enable']
|
||||
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', $config)
|
||||
? $config['gcaptcha_enable']
|
||||
: false;
|
||||
|
||||
$migration->migrate_to_ci4();
|
||||
@@ -31,7 +29,8 @@ class Login extends BaseController
|
||||
'has_errors' => false,
|
||||
'is_latest' => $migration->is_latest(),
|
||||
'latest_version' => $migration->get_latest_migration(),
|
||||
'gcaptcha_enabled' => $gcaptcha_enabled
|
||||
'gcaptcha_enabled' => $gcaptcha_enabled,
|
||||
'config' => $config
|
||||
];
|
||||
|
||||
if(strtolower($this->request->getMethod()) !== 'post')
|
||||
@@ -55,8 +54,10 @@ class Login extends BaseController
|
||||
set_time_limit(3600);
|
||||
|
||||
$migration->setNamespace('App')->latest();
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->to('home');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ abstract class Persons extends Secure_Controller
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_people_manage_table_headers();
|
||||
|
||||
echo view('people/manage', $data);
|
||||
@@ -57,4 +58,4 @@ abstract class Persons extends Secure_Controller
|
||||
{
|
||||
return str_name_case($string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ use ReflectionException;
|
||||
* @property receiving receiving
|
||||
* @property stock_location stock_location
|
||||
* @property supplier supplier
|
||||
* @property array config
|
||||
*/
|
||||
class Receivings extends Secure_Controller
|
||||
{
|
||||
@@ -40,6 +41,7 @@ class Receivings extends Secure_Controller
|
||||
$this->receiving = model('Receiving');
|
||||
$this->stock_location = model('Stock_location');
|
||||
$this->supplier = model('Supplier');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
public function getIndex(): void
|
||||
@@ -135,8 +137,8 @@ class Receivings extends Secure_Controller
|
||||
$this->token_lib->parse_barcode($quantity, $price, $item_id_or_number_or_item_kit_or_receipt);
|
||||
$quantity = ($mode == 'receive' || $mode == 'requisition') ? $quantity : -$quantity;
|
||||
$item_location = $this->receiving_lib->get_stock_source();
|
||||
$discount = config('OSPOS')->settings['default_receivings_discount'];
|
||||
$discount_type = config('OSPOS')->settings['default_receivings_discount_type'];
|
||||
$discount = $this->config['default_receivings_discount'];
|
||||
$discount_type = $this->config['default_receivings_discount_type'];
|
||||
|
||||
if($mode == 'return' && $this->receiving->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
|
||||
{
|
||||
@@ -445,7 +447,7 @@ class Receivings extends Secure_Controller
|
||||
{
|
||||
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING); //TODO: newdate does not follow naming conventions
|
||||
|
||||
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate);
|
||||
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $newdate);
|
||||
$receiving_time = $date_formatter->format('Y-m-d H:i:s');
|
||||
|
||||
$receiving_data = [
|
||||
@@ -485,4 +487,4 @@ class Receivings extends Secure_Controller
|
||||
|
||||
$this->_reload(); //TODO: Hungarian Notation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use App\Models\Reports\Summary_sales;
|
||||
use App\Models\Reports\Summary_sales_taxes;
|
||||
use App\Models\Reports\Summary_suppliers;
|
||||
use App\Models\Reports\Summary_taxes;
|
||||
use CodeIgniter\HTTP\Uri;
|
||||
use Config\Services;
|
||||
|
||||
/**
|
||||
* @property attribute attribute
|
||||
@@ -51,17 +51,18 @@ use CodeIgniter\HTTP\Uri;
|
||||
* @property summary_sales_taxes summary_sales_taxes
|
||||
* @property summary_suppliers summary_suppliers
|
||||
* @property summary_taxes summary_taxes
|
||||
* @property URI uri
|
||||
* @property array config
|
||||
*/
|
||||
class Reports extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('reports');
|
||||
|
||||
$this->uri->setURI(uri_string());
|
||||
$method_name = $this->uri->getSegment(2);
|
||||
$request = Services::request();
|
||||
$method_name = $request->getUri()->getSegment(2);
|
||||
$exploder = explode('_', $method_name);
|
||||
$this->config = config('OSPOS')->settings;
|
||||
$this->stock_location = model('Stock_location');
|
||||
|
||||
if(sizeof($exploder) > 1)
|
||||
{
|
||||
@@ -1577,10 +1578,10 @@ class Reports extends Secure_Controller
|
||||
$sale_type_options = [];
|
||||
$sale_type_options['complete'] = lang('Reports.complete');
|
||||
$sale_type_options['sales'] = lang('Reports.completed_sales');
|
||||
if(config('OSPOS')->settings['invoice_enable'])
|
||||
if($this->config['invoice_enable'])
|
||||
{
|
||||
$sale_type_options['quotes'] = lang('Reports.quotes');
|
||||
if(config('OSPOS')->settings['work_order_enable'])
|
||||
if($this->config['work_order_enable'])
|
||||
{
|
||||
$sale_type_options['work_orders'] = lang('Reports.work_orders');
|
||||
}
|
||||
@@ -1912,15 +1913,15 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$subtitle = '';
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($this->config['date_or_time_format']))
|
||||
{
|
||||
$subtitle .= date(config('OSPOS')->settings['dateformat'], strtotime($inputs['start_date'])) . ' - ' . date(config('OSPOS')->settings['dateformat'], strtotime($inputs['end_date']));
|
||||
$subtitle .= date($this->config['dateformat'], strtotime($inputs['start_date'])) . ' - ' . date($this->config['dateformat'], strtotime($inputs['end_date']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$subtitle .= date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], strtotime(rawurldecode($inputs['end_date'])));
|
||||
$subtitle .= date($this->config['dateformat'] . ' ' . $this->config['timeformat'], strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date($this->config['dateformat'] . ' ' . $this->config['timeformat'], strtotime(rawurldecode($inputs['end_date'])));
|
||||
}
|
||||
|
||||
return $subtitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ use ReflectionException;
|
||||
* @property item_kit item_kit
|
||||
* @property sale sale
|
||||
* @property stock_location stock_location
|
||||
* @property array config
|
||||
*/
|
||||
class Sales extends Secure_Controller
|
||||
{
|
||||
@@ -53,6 +54,7 @@ class Sales extends Secure_Controller
|
||||
$this->sale_lib = new Sale_lib();
|
||||
$this->tax_lib = new Tax_lib();
|
||||
$this->token_lib = new Token_lib();
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
public function getIndex(): void
|
||||
@@ -109,7 +111,7 @@ class Sales extends Secure_Controller
|
||||
'only_due' => FALSE,
|
||||
'only_check' => FALSE,
|
||||
'only_creditcard' => FALSE,
|
||||
'only_invoices' => config('OSPOS')->settings['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT),
|
||||
'only_invoices' => $this->config['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT),
|
||||
'is_valid_receipt' => $this->sale->is_valid_receipt($search)
|
||||
];
|
||||
|
||||
@@ -210,7 +212,7 @@ class Sales extends Secure_Controller
|
||||
$this->sale_lib->set_sale_type(SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
if(config('OSPOS')->settings['dinner_table_enable'])
|
||||
if($this->config['dinner_table_enable'])
|
||||
{
|
||||
$occupied_dinner_table = $this->request->getPost('dinner_table', FILTER_SANITIZE_NUMBER_INT);
|
||||
$released_dinner_table = $this->sale_lib->get_dinner_table();
|
||||
@@ -451,8 +453,8 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$discount = config('OSPOS')->settings['default_sales_discount'];
|
||||
$discount_type = config('OSPOS')->settings['default_sales_discount_type'];
|
||||
$discount = $this->config['default_sales_discount'];
|
||||
$discount_type = $this->config['default_sales_discount_type'];
|
||||
|
||||
// check if any discount is assigned to the selected customer
|
||||
$customer_id = $this->sale_lib->get_customer();
|
||||
@@ -625,7 +627,7 @@ class Sales extends Secure_Controller
|
||||
|
||||
$data['cart'] = $this->sale_lib->get_cart();
|
||||
|
||||
$data['include_hsn'] = (bool)config('OSPOS')->settings['include_hsn'];
|
||||
$data['include_hsn'] = (bool)$this->config['include_hsn'];
|
||||
$__time = time();
|
||||
$data['transaction_time'] = to_datetime($__time);
|
||||
$data['transaction_date'] = to_date($__time);
|
||||
@@ -635,16 +637,16 @@ class Sales extends Secure_Controller
|
||||
$employee_info = $this->employee->get_info($employee_id);
|
||||
$data['employee'] = $employee_info->first_name . ' ' . mb_substr($employee_info->last_name, 0, 1);
|
||||
|
||||
$data['company_info'] = implode("\n", [config('OSPOS')->settings['address'], config('OSPOS')->settings['phone']]);
|
||||
$data['company_info'] = implode("\n", [$this->config['address'], $this->config['phone']]);
|
||||
|
||||
if(config('OSPOS')->settings['account_number'])
|
||||
if($this->config['account_number'])
|
||||
{
|
||||
$data['company_info'] .= "\n" . lang('Sales.account_number') . ": " . config('OSPOS')->settings['account_number'];
|
||||
$data['company_info'] .= "\n" . lang('Sales.account_number') . ": " . $this->config['account_number'];
|
||||
}
|
||||
|
||||
if(config('OSPOS')->settings['tax_id'] != '')
|
||||
if($this->config['tax_id'] != '')
|
||||
{
|
||||
$data['company_info'] .= "\n" . lang('Sales.tax_id') . ": " . config('OSPOS')->settings['tax_id'];
|
||||
$data['company_info'] .= "\n" . lang('Sales.tax_id') . ": " . $this->config['tax_id'];
|
||||
}
|
||||
|
||||
$data['invoice_number_enabled'] = $this->sale_lib->is_invoice_mode();
|
||||
@@ -723,7 +725,7 @@ class Sales extends Secure_Controller
|
||||
|
||||
if($this->sale_lib->is_invoice_mode())
|
||||
{
|
||||
$invoice_format = config('OSPOS')->settings['sales_invoice_format'];
|
||||
$invoice_format = $this->config['sales_invoice_format'];
|
||||
|
||||
// generate final invoice number (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way
|
||||
if(!empty($invoice_format) && $invoice_number == NULL)
|
||||
@@ -745,7 +747,7 @@ class Sales extends Secure_Controller
|
||||
$sale_type = SALE_TYPE_INVOICE;
|
||||
|
||||
// The PHP file name is the same as the invoice_type key
|
||||
$invoice_view = config('OSPOS')->settings['invoice_type'];
|
||||
$invoice_view = $this->config['invoice_type'];
|
||||
|
||||
// Save the data to the sales table
|
||||
$data['sale_id_num'] = $this->sale->save_value($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $tax_details);
|
||||
@@ -780,7 +782,7 @@ class Sales extends Secure_Controller
|
||||
if($work_order_number == NULL)
|
||||
{
|
||||
// generate work order number
|
||||
$work_order_format = config('OSPOS')->settings['work_order_format'];
|
||||
$work_order_format = $this->config['work_order_format'];
|
||||
$work_order_number = $this->token_lib->render($work_order_format);
|
||||
}
|
||||
|
||||
@@ -815,7 +817,7 @@ class Sales extends Secure_Controller
|
||||
if($quote_number == NULL)
|
||||
{
|
||||
// generate quote number
|
||||
$quote_format = config('OSPOS')->settings['sales_quote_format'];
|
||||
$quote_format = $this->config['sales_quote_format'];
|
||||
$quote_number = $this->token_lib->render($quote_format);
|
||||
}
|
||||
|
||||
@@ -892,14 +894,14 @@ class Sales extends Secure_Controller
|
||||
$number = $sale_data[$type."_number"];
|
||||
$subject = lang('Sales.' . $type) . ' ' . $number;
|
||||
|
||||
$text = config('OSPOS')->settings['invoice_email_message'];
|
||||
$text = $this->config['invoice_email_message'];
|
||||
$tokens = [
|
||||
new Token_invoice_sequence($sale_data['invoice_number']),
|
||||
new Token_invoice_count('POS ' . $sale_data['sale_id']),
|
||||
new Token_customer((object)$sale_data)
|
||||
];
|
||||
$text = $this->token_lib->render($text, $tokens);
|
||||
$sale_data['mimetype'] = mime_content_type(WRITEPATH . 'uploads/' . config('OSPOS')->settings['company_logo']);
|
||||
$sale_data['mimetype'] = mime_content_type(WRITEPATH . 'uploads/' . $this->config['company_logo']);
|
||||
|
||||
// generate email attachment: invoice in pdf format
|
||||
$view = Services::renderer();
|
||||
@@ -1045,7 +1047,7 @@ class Sales extends Secure_Controller
|
||||
$data['transaction_date'] = to_date(strtotime($sale_info['sale_time']));
|
||||
$data['show_stock_locations'] = $this->stock_location->show_locations('sales');
|
||||
|
||||
$data['include_hsn'] = (bool)config('OSPOS')->settings['include_hsn'];
|
||||
$data['include_hsn'] = (bool)$this->config['include_hsn'];
|
||||
|
||||
// Returns 'subtotal', 'total', 'cash_total', 'payment_total', 'amount_due', 'cash_amount_due', 'payments_cover_total'
|
||||
$totals = $this->sale_lib->get_totals($tax_details[0]);
|
||||
@@ -1084,15 +1086,15 @@ class Sales extends Secure_Controller
|
||||
$data['quote_number'] = $sale_info['quote_number'];
|
||||
$data['sale_status'] = $sale_info['sale_status'];
|
||||
|
||||
$data['company_info'] = implode('\n', [config('OSPOS')->settings['address'], config('OSPOS')->settings['phone']]); //TODO: Duplicated code.
|
||||
$data['company_info'] = implode('\n', [$this->config['address'], $this->config['phone']]); //TODO: Duplicated code.
|
||||
|
||||
if(config('OSPOS')->settings['account_number'])
|
||||
if($this->config['account_number'])
|
||||
{
|
||||
$data['company_info'] .= '\n' . lang('Sales.account_number') . ": " . config('OSPOS')->settings['account_number'];
|
||||
$data['company_info'] .= '\n' . lang('Sales.account_number') . ": " . $this->config['account_number'];
|
||||
}
|
||||
if(config('OSPOS')->settings['tax_id'] != '')
|
||||
if($this->config['tax_id'] != '')
|
||||
{
|
||||
$data['company_info'] .= '\n' . lang('Sales.tax_id') . ": " . config('OSPOS')->settings['tax_id'];
|
||||
$data['company_info'] .= '\n' . lang('Sales.tax_id') . ": " . $this->config['tax_id'];
|
||||
}
|
||||
|
||||
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['sale_id']);
|
||||
@@ -1125,7 +1127,7 @@ class Sales extends Secure_Controller
|
||||
$data['customer_required'] = lang('Sales.customer_optional');
|
||||
}
|
||||
|
||||
$invoice_type = config('OSPOS')->settings['invoice_type'];
|
||||
$invoice_type = $this->config['invoice_type'];
|
||||
$data['invoice_view'] = $invoice_type;
|
||||
|
||||
return $data;
|
||||
@@ -1197,7 +1199,7 @@ class Sales extends Secure_Controller
|
||||
$data['comment'] = $this->sale_lib->get_comment();
|
||||
$data['email_receipt'] = $this->sale_lib->is_email_receipt();
|
||||
|
||||
if($customer_info && config('OSPOS')->settings['customer_reward_enable'])
|
||||
if($customer_info && $this->config['customer_reward_enable'])
|
||||
{
|
||||
$data['payment_options'] = $this->sale->get_payment_options(TRUE, TRUE);
|
||||
}
|
||||
@@ -1210,7 +1212,7 @@ class Sales extends Secure_Controller
|
||||
$data['change_price'] = $this->employee->has_grant('sales_change_price', $this->employee->get_logged_in_employee_info()->person_id);
|
||||
|
||||
$temp_invoice_number = $this->sale_lib->get_invoice_number();
|
||||
$invoice_format = config('OSPOS')->settings['sales_invoice_format'];
|
||||
$invoice_format = $this->config['sales_invoice_format'];
|
||||
|
||||
if ($temp_invoice_number == NULL || $temp_invoice_number == '')
|
||||
{
|
||||
@@ -1394,7 +1396,7 @@ class Sales extends Secure_Controller
|
||||
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING);
|
||||
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
|
||||
|
||||
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate);
|
||||
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $newdate);
|
||||
$sale_time = $date_formatter->format('Y-m-d H:i:s');
|
||||
|
||||
$sale_data = [
|
||||
@@ -1471,7 +1473,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
$payments[] = [
|
||||
$sale_data['payments'] = [
|
||||
'payment_id' => $payment_id,
|
||||
'payment_type' => $payment_type,
|
||||
'payment_amount' => $payment_amount,
|
||||
@@ -1482,7 +1484,7 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
|
||||
$this->inventory->update('POS '.$sale_id, ['trans_date' => $sale_time]); //TODO: Reflection Exception
|
||||
if($this->sale->update($sale_id, $sale_data, $payments))
|
||||
if($this->sale->update($sale_id, $sale_data))
|
||||
{
|
||||
echo json_encode (['success' => TRUE, 'message' => lang('Sales.successfully_updated'), 'id' => $sale_id]);
|
||||
}
|
||||
@@ -1505,7 +1507,7 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
|
||||
if(config('OSPOS')->settings['dinner_table_enable'])
|
||||
if($this->config['dinner_table_enable'])
|
||||
{
|
||||
$dinner_table = $this->sale_lib->get_dinner_table();
|
||||
$this->dinner_table->release($dinner_table);
|
||||
@@ -1707,4 +1709,4 @@ class Sales extends Secure_Controller
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,19 @@ use CodeIgniter\Session\Session;
|
||||
*
|
||||
* @property employee employee
|
||||
* @property module module
|
||||
*
|
||||
* @property array global_view_data
|
||||
* @property session session
|
||||
*
|
||||
*/
|
||||
class Secure_Controller extends BaseController
|
||||
{
|
||||
public function __construct(string $module_id = NULL, string $submodule_id = NULL, string $menu_group = NULL)
|
||||
public array $global_view_data;
|
||||
|
||||
public function __construct(string $module_id = '', string $submodule_id = NULL, string $menu_group = NULL)
|
||||
{
|
||||
$this->employee = model('Employee');
|
||||
$this->module = model('Module');
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(!$this->employee->is_logged_in())
|
||||
{
|
||||
@@ -36,7 +39,7 @@ class Secure_Controller extends BaseController
|
||||
redirect("no_access/$module_id/$submodule_id");
|
||||
}
|
||||
|
||||
// load up global data visible to all the loaded views
|
||||
// load up global global_view_data visible to all the loaded views
|
||||
$this->session = session();
|
||||
if($menu_group == NULL)
|
||||
{
|
||||
@@ -47,24 +50,21 @@ class Secure_Controller extends BaseController
|
||||
$this->session->set('menu_group', $menu_group);
|
||||
}
|
||||
|
||||
if($menu_group == 'home') //TODO: Convert to ternary notation
|
||||
{
|
||||
$allowed_modules = $this->module->get_allowed_home_modules($logged_in_employee_info->person_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allowed_modules = $this->module->get_allowed_office_modules($logged_in_employee_info->person_id);
|
||||
}
|
||||
$allowed_modules = $menu_group == 'home'
|
||||
? $this->module->get_allowed_home_modules($logged_in_employee_info->person_id)
|
||||
: $this->module->get_allowed_office_modules($logged_in_employee_info->person_id);
|
||||
|
||||
foreach($allowed_modules->getResult() as $module)
|
||||
{
|
||||
$data['allowed_modules'][] = $module;
|
||||
$global_view_data['allowed_modules'][] = $module;
|
||||
}
|
||||
|
||||
$data['user_info'] = $logged_in_employee_info;
|
||||
$data['controller_name'] = $module_id;
|
||||
|
||||
echo view('viewData', $data);
|
||||
$global_view_data += [
|
||||
'user_info' => $logged_in_employee_info,
|
||||
'controller_name' => $module_id,
|
||||
'config' => $config
|
||||
];
|
||||
view('viewData', $global_view_data);
|
||||
}
|
||||
|
||||
public function check_numeric()
|
||||
@@ -86,4 +86,4 @@ class Secure_Controller extends BaseController
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class Suppliers extends Persons
|
||||
|
||||
public function getIndex(): void
|
||||
{
|
||||
helper('tabular');
|
||||
$data['table_headers'] = get_suppliers_manage_table_headers();
|
||||
|
||||
echo view('people/manage', $data);
|
||||
@@ -183,4 +184,4 @@ class Suppliers extends Persons
|
||||
echo json_encode (['success' => FALSE, 'message' => lang('Suppliers.cannot_be_deleted')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class Taxes extends Secure_Controller
|
||||
$this->tax_jurisdiction = model('Tax_jurisdiction');
|
||||
|
||||
$this->tax_lib = new Tax_lib();
|
||||
$this->config = config('OSPOS')->settings;
|
||||
|
||||
helper('tax_helper');
|
||||
}
|
||||
@@ -58,7 +59,7 @@ class Taxes extends Secure_Controller
|
||||
$data['tax_categories_table_headers'] = get_tax_categories_table_headers();
|
||||
$data['tax_types'] = $this->tax_lib->get_tax_types();
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($this->config['tax_included'])
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
@@ -134,7 +135,7 @@ class Taxes extends Secure_Controller
|
||||
|
||||
$tax_rate_info = $this->tax->get_rate_info($tax_code, $default_tax_category_id);
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($this->config['tax_included'])
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
@@ -206,9 +207,9 @@ class Taxes extends Secure_Controller
|
||||
|
||||
if($tax_rate_id == -1) //TODO: Replace -1 with constant
|
||||
{
|
||||
$data['rate_tax_code_id'] = config('OSPOS')->settings['default_tax_code'];
|
||||
$data['rate_tax_category_id'] = config('OSPOS')->settings['default_tax_category'];
|
||||
$data['rate_jurisdiction_id'] = config('OSPOS')->settings['default_tax_jurisdiction'];
|
||||
$data['rate_tax_code_id'] = $this->config['default_tax_code'];
|
||||
$data['rate_tax_category_id'] = $this->config['default_tax_category'];
|
||||
$data['rate_jurisdiction_id'] = $this->config['default_tax_jurisdiction'];
|
||||
$data['tax_rounding_code'] = rounding_mode::HALF_UP;
|
||||
$data['tax_rate'] = '0.0000';
|
||||
}
|
||||
@@ -237,7 +238,7 @@ class Taxes extends Secure_Controller
|
||||
$data['rounding_options'] = rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($this->config['tax_included'])
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
@@ -304,7 +305,7 @@ class Taxes extends Secure_Controller
|
||||
$data['rounding_options'] = rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($this->config['tax_included'])
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
@@ -557,7 +558,7 @@ class Taxes extends Secure_Controller
|
||||
{
|
||||
$tax_jurisdictions = $this->tax_jurisdiction->get_all()->getResultArray();
|
||||
|
||||
if(config('OSPOS')->settings['tax_included']) //TODO: ternary notation
|
||||
if($this->config['tax_included']) //TODO: ternary notation
|
||||
{
|
||||
$default_tax_type = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
@@ -574,4 +575,4 @@ class Taxes extends Secure_Controller
|
||||
'default_tax_type' => $default_tax_type
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Migration_database_optimizations extends Migration
|
||||
break;
|
||||
case DATE:
|
||||
$attribute_date = DateTime::createFromFormat('Y-m-d', $attribute_value['attribute_date']);
|
||||
$value = $attribute_date->format(config('OSPOS')->settings['dateformat']);
|
||||
$value = $attribute_date->format($config['dateformat']);
|
||||
break;
|
||||
default:
|
||||
$value = $attribute_value['attribute_value'];
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
-- creating new column of TIMESTAMP type
|
||||
ALTER TABLE `ospos_sessions`
|
||||
ADD COLUMN `temp_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP();
|
||||
|
||||
-- Use FROM_UNIXTIME() to convert from the INT timestamp to a proper datetime type
|
||||
-- assigning value from old INT column to it, in hope that it will be recognized as timestamp
|
||||
UPDATE `ospos_sessions` SET `temp_timestamp` = FROM_UNIXTIME(`timestamp`);
|
||||
DROP TABLE `ospos_sessions`;
|
||||
|
||||
-- dropping the old INT column
|
||||
ALTER TABLE `ospos_sessions` DROP COLUMN `timestamp`;
|
||||
CREATE TABLE IF NOT EXISTS `ospos_sessions` (
|
||||
`id` varchar(128) NOT null,
|
||||
`ip_address` varchar(45) NOT null,
|
||||
`timestamp` timestamp DEFAULT CURRENT_TIMESTAMP NOT null,
|
||||
`data` blob NOT null,
|
||||
KEY `ospos_sessions_timestamp` (`timestamp`)
|
||||
);
|
||||
|
||||
-- changing the name of the column
|
||||
ALTER TABLE `ospos_sessions` CHANGE `temp_timestamp` `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP();
|
||||
ALTER TABLE ospos_sessions ADD PRIMARY KEY (id, ip_address);
|
||||
|
||||
@@ -82,7 +82,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
|
||||
('theme', 'flatly'),
|
||||
('statistics', '1'),
|
||||
('language', 'english'),
|
||||
('language_code', 'en');
|
||||
('language_code', 'en-US');
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -16,48 +16,41 @@ use Config\Services;
|
||||
*/
|
||||
class Load_config
|
||||
{
|
||||
/**
|
||||
* Loads configuration from database into App CI config and then applies those settings
|
||||
*/
|
||||
public function load_config()
|
||||
{
|
||||
//Migrations
|
||||
$migration_config = config('Migrations');
|
||||
$migration = new MY_Migration($migration_config);
|
||||
/**
|
||||
* Loads configuration from database into App CI config and then applies those settings
|
||||
*/
|
||||
public function load_config()
|
||||
{
|
||||
//Migrations
|
||||
$migration_config = config('Migrations');
|
||||
$migration = new MY_Migration($migration_config);
|
||||
|
||||
$this->session = session();
|
||||
$this->session = session();
|
||||
|
||||
//Database Configuration
|
||||
$config = config('OSPOS');
|
||||
$appconfig = model(Appconfig::class);
|
||||
//Database Configuration
|
||||
$config = config('OSPOS');
|
||||
|
||||
if (!$migration->is_latest())
|
||||
{
|
||||
$this->session->destroy();
|
||||
}
|
||||
{
|
||||
$this->session->destroy();
|
||||
}
|
||||
|
||||
$config->settings['application_version'] = $migration->get_current_version();
|
||||
foreach($appconfig->get_all()->getResult() as $app_config)
|
||||
{
|
||||
$config->settings[$app_config->key] = $app_config->value;
|
||||
}
|
||||
|
||||
//Language
|
||||
//Language
|
||||
helper('locale');
|
||||
$language_exists = file_exists('../app/Language/' . current_language_code());
|
||||
$language_exists = file_exists('../app/Language/' . current_language_code());
|
||||
|
||||
if(current_language_code() == null || current_language() == null || !$language_exists) //TODO: current_language() is undefined
|
||||
{
|
||||
$config->language = 'english';
|
||||
$config->language_code = 'en-US';
|
||||
}
|
||||
if(current_language_code() == null || current_language() == null || !$language_exists) //TODO: current_language() is undefined
|
||||
{
|
||||
$config->language = 'english';
|
||||
$config->language_code = 'en-US';
|
||||
}
|
||||
|
||||
$language = Services::language();
|
||||
$language->setLocale($config->settings['language_code']);
|
||||
$language = Services::language();
|
||||
$language->setLocale($config->settings['language_code']);
|
||||
|
||||
//Time Zone
|
||||
date_default_timezone_set($config->timezone ?? 'America/New_York');
|
||||
//Time Zone
|
||||
date_default_timezone_set($config->timezone ?? 'America/New_York');
|
||||
|
||||
bcscale(max(2, totals_decimals() + tax_decimals()));
|
||||
}
|
||||
bcscale(max(2, totals_decimals() + tax_decimals()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,13 @@ define('DEFAULT_DATETIME', mktime(0, 0, 0, 1, 1, 2010));
|
||||
/**
|
||||
* Currency locale helper
|
||||
*/
|
||||
function current_language_code(bool $load_system_language = FALSE): string
|
||||
function current_language_code(bool $load_system_language = false): string
|
||||
{
|
||||
$employee = model(Employee::class);
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// Returns the language code of the employee if set or system language code if not
|
||||
if($employee->is_logged_in() && $load_system_language != TRUE) //TODO: !==
|
||||
if($employee->is_logged_in() && $load_system_language === false)
|
||||
{
|
||||
$employee_info = $employee->get_logged_in_employee_info();
|
||||
|
||||
@@ -28,7 +29,7 @@ function current_language_code(bool $load_system_language = FALSE): string
|
||||
}
|
||||
}
|
||||
|
||||
$language_code = config('OSPOS')->settings['language_code'];
|
||||
$language_code = $config['language_code'];
|
||||
|
||||
return empty($language_code) ? DEFAULT_LANGUAGE_CODE : $language_code;
|
||||
}
|
||||
@@ -36,9 +37,10 @@ function current_language_code(bool $load_system_language = FALSE): string
|
||||
function current_language(bool $load_system_language = FALSE): string
|
||||
{
|
||||
$employee = model(Employee::class);
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// Returns the language of the employee if set or system language if not
|
||||
if($employee->is_logged_in() && $load_system_language != TRUE) //TODO: !==
|
||||
if($employee->is_logged_in() && !$load_system_language)
|
||||
{
|
||||
$employee_info = $employee->get_logged_in_employee_info();
|
||||
|
||||
@@ -48,7 +50,7 @@ function current_language(bool $load_system_language = FALSE): string
|
||||
}
|
||||
}
|
||||
|
||||
$language = config('OSPOS')->settings['language'];
|
||||
$language = $config['language'];
|
||||
|
||||
return empty($language) ? DEFAULT_LANGUAGE : $language;
|
||||
}
|
||||
@@ -101,26 +103,6 @@ function get_languages(): array
|
||||
];
|
||||
}
|
||||
|
||||
function load_language(array $lang_array, bool $load_system_language = FALSE): void //TODO: this is not called anywhere in the code.
|
||||
{
|
||||
$lang = get_instance()->lang;
|
||||
|
||||
if($load_system_language)
|
||||
{
|
||||
foreach($lang_array as $language_file)
|
||||
{
|
||||
$lang->load($language_file, current_language_code(TRUE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($lang_array as $language_file)
|
||||
{
|
||||
$lang->load($language_file, current_language_code());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_timezones(): array
|
||||
{
|
||||
return [
|
||||
@@ -249,33 +231,34 @@ function get_timeformats(): array
|
||||
function get_payment_options(): array
|
||||
{
|
||||
$payments = [];
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
//TODO: This needs to be switched to a switch statement
|
||||
if(config('OSPOS')->settings['payment_options_order'] == 'debitcreditcash') //TODO: ===
|
||||
if($config['payment_options_order'] == 'debitcreditcash') //TODO: ===
|
||||
{
|
||||
$payments[lang('Sales.debit')] = lang('Sales.debit');
|
||||
$payments[lang('Sales.credit')] = lang('Sales.credit');
|
||||
$payments[lang('Sales.cash')] = lang('Sales.cash');
|
||||
}
|
||||
elseif(config('OSPOS')->settings['payment_options_order'] == 'debitcashcredit') //TODO: ===
|
||||
elseif($config['payment_options_order'] == 'debitcashcredit') //TODO: ===
|
||||
{
|
||||
$payments[lang('Sales.debit')] = lang('Sales.debit');
|
||||
$payments[lang('Sales.cash')] = lang('Sales.cash');
|
||||
$payments[lang('Sales.credit')] = lang('Sales.credit');
|
||||
}
|
||||
elseif(config('OSPOS')->settings['payment_options_order'] == 'creditdebitcash') //TODO: ===
|
||||
elseif($config['payment_options_order'] == 'creditdebitcash') //TODO: ===
|
||||
{
|
||||
$payments[lang('Sales.credit')] = lang('Sales.credit');
|
||||
$payments[lang('Sales.debit')] = lang('Sales.debit');
|
||||
$payments[lang('Sales.cash')] = lang('Sales.cash');
|
||||
}
|
||||
elseif(config('OSPOS')->settings['payment_options_order'] == 'creditcashdebit') //TODO: ===
|
||||
elseif($config['payment_options_order'] == 'creditcashdebit') //TODO: ===
|
||||
{
|
||||
$payments[lang('Sales.credit')] = lang('Sales.credit');
|
||||
$payments[lang('Sales.cash')] = lang('Sales.cash');
|
||||
$payments[lang('Sales.debit')] = lang('Sales.debit');
|
||||
}
|
||||
else // default: if(config('OSPOS')->settings['payment_options_order == 'cashdebitcredit')
|
||||
else // default: if($config['payment_options_order == 'cashdebitcredit')
|
||||
{
|
||||
$payments[lang('Sales.cash')] = lang('Sales.cash');
|
||||
$payments[lang('Sales.debit')] = lang('Sales.debit');
|
||||
@@ -286,7 +269,7 @@ function get_payment_options(): array
|
||||
$payments[lang('Sales.check')] = lang('Sales.check');
|
||||
|
||||
// If India (list of country codes include India) then include Unified Payment Interface
|
||||
if (stripos(config('OSPOS')->settings['country_codes'], 'IN') !== false)
|
||||
if (stripos($config['country_codes'], 'IN') !== false)
|
||||
{
|
||||
$payments[lang('Sales.upi')] = lang('Sales.upi');
|
||||
}
|
||||
@@ -296,40 +279,47 @@ function get_payment_options(): array
|
||||
|
||||
function currency_side(): bool
|
||||
{
|
||||
$fmt = new NumberFormatter(config('OSPOS')->settings['number_locale'], NumberFormatter::CURRENCY);
|
||||
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, config('OSPOS')->settings['currency_symbol']);
|
||||
$config = config('OSPOS')->settings;
|
||||
$fmt = new NumberFormatter($config['number_locale'], NumberFormatter::CURRENCY);
|
||||
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $config['currency_symbol']);
|
||||
|
||||
return !preg_match('/^¤/', $fmt->getPattern());
|
||||
}
|
||||
|
||||
function quantity_decimals(): int
|
||||
{
|
||||
return config('OSPOS')->settings['quantity_decimals'] ? config('OSPOS')->settings['quantity_decimals'] : 0;
|
||||
$config = config('OSPOS')->settings;
|
||||
return $config['quantity_decimals'] ? $config['quantity_decimals'] : 0;
|
||||
}
|
||||
|
||||
function totals_decimals(): int
|
||||
{
|
||||
return config('OSPOS')->settings['currency_decimals'] ? (int)config('OSPOS')->settings['currency_decimals'] : 0;
|
||||
$config = config('OSPOS')->settings;
|
||||
return $config['currency_decimals'] ? (int)$config['currency_decimals'] : 0;
|
||||
}
|
||||
|
||||
function cash_decimals(): int
|
||||
{
|
||||
return config('OSPOS')->settings['cash_decimals'] ? config('OSPOS')->settings['cash_decimals'] : 0;
|
||||
$config = config('OSPOS')->settings;
|
||||
return $config['cash_decimals'] ? $config['cash_decimals'] : 0;
|
||||
}
|
||||
|
||||
function tax_decimals(): int
|
||||
{
|
||||
return config('OSPOS')->settings['tax_decimals'] ? config('OSPOS')->settings['tax_decimals'] : 0;
|
||||
$config = config('OSPOS')->settings;
|
||||
return $config['tax_decimals'] ? $config['tax_decimals'] : 0;
|
||||
}
|
||||
|
||||
function to_date(int $date = DEFAULT_DATE): string
|
||||
{
|
||||
return date(config('OSPOS')->settings['dateformat, $date']);
|
||||
$config = config('OSPOS')->settings;
|
||||
return date($config['dateformat, $date']);
|
||||
}
|
||||
|
||||
function to_datetime(int $datetime = DEFAULT_DATETIME): string
|
||||
{
|
||||
return date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $datetime);
|
||||
$config = config('OSPOS')->settings;
|
||||
return date($config['dateformat'] . ' ' . $config['timeformat'], $datetime);
|
||||
}
|
||||
|
||||
function to_currency(float $number): string
|
||||
@@ -344,7 +334,9 @@ function to_currency_no_money(float $number): string
|
||||
|
||||
function to_currency_tax(float $number): string
|
||||
{
|
||||
if(config('OSPOS')->settings['tax_included']) //TODO: ternary notation
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if($config['tax_included']) //TODO: ternary notation
|
||||
{
|
||||
return to_decimals($number, 'tax_decimals', NumberFormatter::CURRENCY);
|
||||
}
|
||||
@@ -380,15 +372,16 @@ function to_decimals(float $number, string $decimals = NULL, int $type = NumberF
|
||||
return $number;
|
||||
}
|
||||
|
||||
$fmt = new NumberFormatter(config('OSPOS')->settings['number_locale'], $type);
|
||||
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : config('OSPOS')->settings['$decimals']);
|
||||
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : config('OSPOS')->settings['$decimals']);
|
||||
$config = config('OSPOS')->settings;
|
||||
$fmt = new NumberFormatter($config['number_locale'], $type);
|
||||
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : $config[$decimals]);
|
||||
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : $config[$decimals]);
|
||||
|
||||
if(empty(config('OSPOS')->settings['thousands_separator']))
|
||||
if(empty($config['thousands_separator']))
|
||||
{
|
||||
$fmt->setAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
|
||||
}
|
||||
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, config('OSPOS')->settings['currency_symbol']);
|
||||
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $config['currency_symbol']);
|
||||
|
||||
return $fmt->format($number);
|
||||
}
|
||||
@@ -430,14 +423,16 @@ function parse_decimals(string $number, int $decimals = NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if($decimals === NULL)
|
||||
{
|
||||
$decimals = config('OSPOS')->settings['currency_decimals']; //TODO: $decimals is never used.
|
||||
$decimals = $config['currency_decimals']; //TODO: $decimals is never used.
|
||||
}
|
||||
|
||||
$fmt = new NumberFormatter(config('OSPOS')->settings['number_locale'], NumberFormatter::DECIMAL);
|
||||
$fmt = new NumberFormatter($config['number_locale'], NumberFormatter::DECIMAL);
|
||||
|
||||
if(empty(config('OSPOS')->settings['thousands_separator']))
|
||||
if(empty($config['thousands_separator']))
|
||||
{
|
||||
$fmt->setAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
|
||||
}
|
||||
@@ -502,7 +497,8 @@ function dateformat_momentjs(string $php_format): string
|
||||
|
||||
function dateformat_mysql(): string
|
||||
{
|
||||
$php_format = config('OSPOS')->settings['dateformat'];
|
||||
$config = config('OSPOS')->settings;
|
||||
$php_format = $config['dateformat'];
|
||||
|
||||
$SYMBOLS_MATCHING = [
|
||||
// Day
|
||||
@@ -586,10 +582,25 @@ function dateformat_bootstrap(string $php_format): string
|
||||
|
||||
function valid_date(string $date): bool //TODO: need a better name for $date. Perhaps $candidate. Also the function name would be better as is_valid_date()
|
||||
{
|
||||
return (DateTime::createFromFormat(config('OSPOS')->settings['dateformat'], $date));
|
||||
$config = config('OSPOS')->settings;
|
||||
return (DateTime::createFromFormat($config['dateformat'], $date));
|
||||
}
|
||||
|
||||
function valid_decimal(string $decimal): bool //TODO: need a better name for $decimal. Perhaps $candidate. Also the function name would be better as is_valid_decimal()
|
||||
{
|
||||
return (preg_match('/^(\d*\.)?\d+$/', $decimal) === 1);
|
||||
}
|
||||
}
|
||||
|
||||
function encode_array(array $data): array
|
||||
{
|
||||
array_walk($data, function(&$value, &$key) { $value = rawurlencode($value);});
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function decode_array(array $data): array
|
||||
{
|
||||
array_walk($data, function(&$value, &$key) { $value = rawurldecode($value);});
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -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="<?php echo site_url('reports/' . $report_prefix . preg_replace('/reports_(.*)/', '$1', $report_name)) ?>"><?php echo $report_label; ?></a>
|
||||
<a class="list-group-item" href="<?= site_url("reports/$report_prefix" . preg_replace('/reports_(.*)/', '$1', $report_name)) ?>"><?= $report_label; ?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,9 @@ function get_sales_manage_table_headers(): string
|
||||
['change_due' => lang('Sales.change_due')],
|
||||
['payment_type' => lang('Sales.payment_type')]
|
||||
];
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(config('OSPOS')->settings['invoice_enable'])
|
||||
if($config['invoice_enable'])
|
||||
{
|
||||
$headers[] = ['invoice_number' => lang('Sales.invoice_number')];
|
||||
$headers[] = ['invoice' => ' ', 'sortable' => FALSE, 'escape' => FALSE];
|
||||
@@ -105,7 +106,9 @@ function get_sale_data_row(object $sale): array
|
||||
'payment_type' => $sale->payment_type
|
||||
];
|
||||
|
||||
if(config('OSPOS')->settings['invoice_enable'])
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if($config['invoice_enable'])
|
||||
{
|
||||
$row['invoice_number'] = $sale->invoice_number;
|
||||
$row['invoice'] = empty($sale->invoice_number)
|
||||
@@ -390,7 +393,7 @@ function get_supplier_data_row(object $supplier): array
|
||||
function get_items_manage_table_headers(): string
|
||||
{
|
||||
$attribute = model(Attribute::class);
|
||||
|
||||
$config = config('OSPOS')->settings;
|
||||
$definition_names = $attribute->get_definitions_by_flags($attribute::SHOW_IN_ITEMS); //TODO: this should be made into a constant in constants.php
|
||||
|
||||
$headers = [
|
||||
@@ -404,7 +407,7 @@ function get_items_manage_table_headers(): string
|
||||
['quantity' => lang('Items.quantity')]
|
||||
];
|
||||
|
||||
if(config('OSPOS')->settings['use_destination_based_tax'])
|
||||
if($config['use_destination_based_tax'])
|
||||
{
|
||||
$headers[] = ['tax_percents' => lang('Items.tax_category'), 'sortable' => FALSE];
|
||||
}
|
||||
@@ -439,8 +442,9 @@ function get_item_data_row(object $item): array
|
||||
$attribute = model(Attribute::class);
|
||||
$item_taxes = model(Item_taxes::class);
|
||||
$tax_category = model(Tax_category::class);
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(config('OSPOS')->settings['use_destination_based_tax'])
|
||||
if($config['use_destination_based_tax'])
|
||||
{
|
||||
if($item->tax_category_id == NULL) //TODO: === ?
|
||||
{
|
||||
@@ -489,7 +493,7 @@ function get_item_data_row(object $item): array
|
||||
}
|
||||
}
|
||||
|
||||
if(config('OSPOS')->settings['multi_pack_enabled'])
|
||||
if($config['multi_pack_enabled'])
|
||||
{
|
||||
$item->name .= NAME_SEPARATOR . $item->pack_name;
|
||||
}
|
||||
|
||||
@@ -27,21 +27,23 @@ class Barcode_lib
|
||||
|
||||
public function get_barcode_config(): array
|
||||
{
|
||||
$data['company'] = config('OSPOS')->settings['company'];
|
||||
$data['barcode_content'] = config('OSPOS')->settings['barcode_content'];
|
||||
$data['barcode_type'] = config('OSPOS')->settings['barcode_type'];
|
||||
$data['barcode_font'] = config('OSPOS')->settings['barcode_font'];
|
||||
$data['barcode_font_size'] = config('OSPOS')->settings['barcode_font_size'];
|
||||
$data['barcode_height'] = config('OSPOS')->settings['barcode_height'];
|
||||
$data['barcode_width'] = config('OSPOS')->settings['barcode_width'];
|
||||
$data['barcode_first_row'] = config('OSPOS')->settings['barcode_first_row'];
|
||||
$data['barcode_second_row'] = config('OSPOS')->settings['barcode_second_row'];
|
||||
$data['barcode_third_row'] = config('OSPOS')->settings['barcode_third_row'];
|
||||
$data['barcode_num_in_row'] = config('OSPOS')->settings['barcode_num_in_row'];
|
||||
$data['barcode_page_width'] = config('OSPOS')->settings['barcode_page_width'];
|
||||
$data['barcode_page_cellspacing'] = config('OSPOS')->settings['barcode_page_cellspacing'];
|
||||
$data['barcode_generate_if_empty'] = config('OSPOS')->settings['barcode_generate_if_empty'];
|
||||
$data['barcode_formats'] = config('OSPOS')->settings['barcode_formats'];
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$data['company'] = $config['company'];
|
||||
$data['barcode_content'] = $config['barcode_content'];
|
||||
$data['barcode_type'] = $config['barcode_type'];
|
||||
$data['barcode_font'] = $config['barcode_font'];
|
||||
$data['barcode_font_size'] = $config['barcode_font_size'];
|
||||
$data['barcode_height'] = $config['barcode_height'];
|
||||
$data['barcode_width'] = $config['barcode_width'];
|
||||
$data['barcode_first_row'] = $config['barcode_first_row'];
|
||||
$data['barcode_second_row'] = $config['barcode_second_row'];
|
||||
$data['barcode_third_row'] = $config['barcode_third_row'];
|
||||
$data['barcode_num_in_row'] = $config['barcode_num_in_row'];
|
||||
$data['barcode_page_width'] = $config['barcode_page_width'];
|
||||
$data['barcode_page_cellspacing'] = $config['barcode_page_cellspacing'];
|
||||
$data['barcode_generate_if_empty'] = $config['barcode_generate_if_empty'];
|
||||
$data['barcode_formats'] = $config['barcode_formats'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -246,4 +248,4 @@ class Barcode_lib
|
||||
{
|
||||
return substr($font_file_name, 0, -4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace app\Libraries;
|
||||
use CodeIgniter\Email\Email;
|
||||
use CodeIgniter\Encryption\Encryption;
|
||||
use CodeIgniter\Encryption\EncrypterInterface;
|
||||
use Config\Services;
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,6 +16,7 @@ use CodeIgniter\Encryption\EncrypterInterface;
|
||||
* @property email email
|
||||
* @property encryption encryption
|
||||
* @property encrypterinterface encrypter
|
||||
* @property array config
|
||||
*/
|
||||
|
||||
class Email_lib
|
||||
@@ -22,25 +24,25 @@ class Email_lib
|
||||
public function __construct()
|
||||
{
|
||||
$this->email = new Email();
|
||||
$this->encryption = new Encryption();
|
||||
$this->encrypter = $this->encryption->initialize();
|
||||
|
||||
|
||||
$config = [
|
||||
$this->config = config('OSPOS')->settings;
|
||||
$encrypter = Services::encrypter();
|
||||
|
||||
|
||||
$email_config = [
|
||||
'mailtype' => 'html',
|
||||
'useragent' => 'OSPOS',
|
||||
'validate' => TRUE,
|
||||
'protocol' => config('OSPOS')->settings['protocol'],
|
||||
'mailpath' => config('OSPOS')->settings['mailpath'],
|
||||
'smtp_host' => config('OSPOS')->settings['smtp_host'],
|
||||
'smtp_user' => config('OSPOS')->settings['smtp_user'],
|
||||
'smtp_pass' => $this->encrypter->decrypt(config('OSPOS')->settings['smtp_pass']),
|
||||
'smtp_port' => config('OSPOS')->settings['smtp_port'],
|
||||
'smtp_timeout' => config('OSPOS')->settings['smtp_timeout'],
|
||||
'smtp_crypto' => config('OSPOS')->settings['smtp_crypto']
|
||||
'protocol' => $this->config['protocol'],
|
||||
'mailpath' => $this->config['mailpath'],
|
||||
'smtp_host' => $this->config['smtp_host'],
|
||||
'smtp_user' => $this->config['smtp_user'],
|
||||
'smtp_pass' => $encrypter->decrypt($this->config['smtp_pass']),
|
||||
'smtp_port' => $this->config['smtp_port'],
|
||||
'smtp_timeout' => $this->config['smtp_timeout'],
|
||||
'smtp_crypto' => $this->config['smtp_crypto']
|
||||
];
|
||||
|
||||
$this->email->initialize($config);
|
||||
$this->email->initialize($email_config);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +53,7 @@ class Email_lib
|
||||
{
|
||||
$email = $this->email;
|
||||
|
||||
$email->setFrom(config('OSPOS')->settings['email'], config('OSPOS')->settings['company']);
|
||||
$email->setFrom($this->config['email'], $this->config['company']);
|
||||
$email->setTo($to);
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($message);
|
||||
@@ -70,4 +72,4 @@ class Email_lib
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,12 @@ class MY_Migration extends MigrationRunner
|
||||
*
|
||||
* @return string The version number of the last successfully run database migration.
|
||||
*/
|
||||
public function get_current_version(): int
|
||||
public static function get_current_version(): int
|
||||
{
|
||||
if($this->db->tableExists('migrations'))
|
||||
$db = Database::connect();
|
||||
if($db->tableExists('migrations'))
|
||||
{
|
||||
$builder = $this->db->table('migrations');
|
||||
$builder = $db->table('migrations');
|
||||
$builder->select('version')->orderBy('version', 'DESC')->limit(1);
|
||||
return $builder->get()->getRow()->version;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace app\Libraries;
|
||||
|
||||
use CodeIgniter\Encryption\EncrypterInterface;
|
||||
use CodeIgniter\Encryption\Encryption;
|
||||
use Config\Services;
|
||||
|
||||
/**
|
||||
* MailChimp API v3 REST client Connector
|
||||
@@ -14,7 +14,6 @@ use CodeIgniter\Encryption\Encryption;
|
||||
* - Rajitha Bandara: https://github.com/rajitha-bandara/ci-mailchimp-v3-rest-client
|
||||
* - Stefan Ashwell: https://github.com/stef686/codeigniter-mailchimp-api-v3
|
||||
*
|
||||
* @property encryption encryption
|
||||
* @property encrypterinterface encrypter
|
||||
*/
|
||||
class MailchimpConnector
|
||||
@@ -38,16 +37,13 @@ class MailchimpConnector
|
||||
*/
|
||||
public function __construct(string $api_key = '')
|
||||
{
|
||||
$this->encryption = new Encryption();
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(empty($api_key))
|
||||
{
|
||||
$this->_api_key = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_api_key']); //TODO: Hungarian notation
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_api_key = $api_key; //TODO: Hungarian notation
|
||||
}
|
||||
$encrypter = Services::encrypter();
|
||||
|
||||
$this->_api_key = empty($api_key)
|
||||
? $encrypter->decrypt($config['mailchimp_api_key']) //TODO: Hungarian notation
|
||||
: $api_key; //TODO: Hungarian notation
|
||||
|
||||
if(!empty($this->_api_key)) //TODO: Hungarian notation
|
||||
{
|
||||
@@ -335,4 +331,4 @@ class Mailchimp_lib //TODO: IMO We need to stick to the one class per file princ
|
||||
|
||||
return $this->_connector->call("/lists/$list_id/members/" . md5(strtolower($email)), 'PUT', $parameters); //TODO: Hungarian notation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class Receiving_lib
|
||||
$this->session->remove('recv_comment');
|
||||
}
|
||||
|
||||
public function get_reference(): string
|
||||
public function get_reference(): ?string
|
||||
{
|
||||
return $this->session->get('recv_reference');
|
||||
}
|
||||
@@ -185,6 +185,8 @@ class Receiving_lib
|
||||
//TODO: This array signature needs to be reworked. It's way too long. Perhaps an object needs to be passed rather than these?
|
||||
public function add_item(int $item_id, int $quantity = 1, int $item_location = NULL, float $discount = 0, int $discount_type = 0, float $price = NULL, string $description = NULL, string $serialnumber = NULL, float $receiving_quantity = NULL, int $receiving_id = NULL, bool $include_deleted = FALSE): bool
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
//make sure item exists in database.
|
||||
if(!$this->item->exists($item_id, $include_deleted))
|
||||
{
|
||||
@@ -234,7 +236,7 @@ class Receiving_lib
|
||||
//array records are identified by $insertkey and item_id is just another field.
|
||||
$price = $price != NULL ? $price : $item_info->cost_price;
|
||||
|
||||
if(config('OSPOS')->settings['multi_pack_enabled'])
|
||||
if($config['multi_pack_enabled'])
|
||||
{
|
||||
$item_info->name .= NAME_SEPARATOR . $item_info->pack_name;
|
||||
}
|
||||
@@ -423,4 +425,4 @@ class Receiving_lib
|
||||
|
||||
return $total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Models\Sale;
|
||||
use CodeIgniter\Session\Session;
|
||||
use App\Models\Stock_location;
|
||||
use ReflectionException;
|
||||
use App\Libraries\Tax_lib;
|
||||
|
||||
/**
|
||||
* Sale library
|
||||
@@ -30,15 +31,14 @@ use ReflectionException;
|
||||
* @property rounding_mode rounding_mode
|
||||
* @property sale sale
|
||||
* @property stock_location stock_location
|
||||
*
|
||||
* @property tax_lib tax_lib
|
||||
* @property Tax_lib tax_lib
|
||||
* @property session session
|
||||
* @property array config
|
||||
*/
|
||||
class Sale_lib
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->tax_lib = new Tax_lib();
|
||||
$this->session = Session();
|
||||
|
||||
$this->attribute = model('Attribute');
|
||||
@@ -51,6 +51,7 @@ class Sale_lib
|
||||
$this->rounding_mode = model('enums/Rounding_mode');
|
||||
$this->sale = model('Sale');
|
||||
$this->stock_location = model('Stock_location');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
public function get_line_sequence_options(): array
|
||||
@@ -66,7 +67,7 @@ class Sale_lib
|
||||
{
|
||||
$register_modes = [];
|
||||
|
||||
if(!config('OSPOS')->settings['invoice_enable'])
|
||||
if(!$this->config['invoice_enable'])
|
||||
{
|
||||
$register_modes['sale'] = lang('Sales.sale');
|
||||
}
|
||||
@@ -75,7 +76,7 @@ class Sale_lib
|
||||
$register_modes['sale'] = lang('Sales.receipt');
|
||||
$register_modes['sale_quote'] = lang('Sales.quote');
|
||||
|
||||
if(config('OSPOS')->settings['work_order_enable'])
|
||||
if($this->config['work_order_enable'])
|
||||
{
|
||||
$register_modes['sale_work_order'] = lang('Sales.work_order');
|
||||
}
|
||||
@@ -131,7 +132,7 @@ class Sale_lib
|
||||
|
||||
//TODO: This set of if/elseif/else needs to be converted to a switch statement
|
||||
// Entry sequence (this will render kits in the expected sequence)
|
||||
if(config('OSPOS')->settings['line_sequence'] == '0')
|
||||
if($this->config['line_sequence'] == '0')
|
||||
{
|
||||
$sort = [];
|
||||
foreach($filtered_cart as $k => $v)
|
||||
@@ -141,7 +142,7 @@ class Sale_lib
|
||||
array_multisort($sort['line'], SORT_ASC, $filtered_cart);
|
||||
}
|
||||
// Group by Stock Type (nonstock first - type 1, stock next - type 0)
|
||||
elseif(config('OSPOS')->settings['line_sequence'] == '1') //TODO: Need to change these to constants
|
||||
elseif($this->config['line_sequence'] == '1') //TODO: Need to change these to constants
|
||||
{
|
||||
$sort = [];
|
||||
foreach($filtered_cart as $k => $v)
|
||||
@@ -153,7 +154,7 @@ class Sale_lib
|
||||
array_multisort($sort['stock_type'], SORT_DESC, $sort['description'], SORT_ASC, $sort['name'], SORT_ASC, $filtered_cart);
|
||||
}
|
||||
// Group by Item Category
|
||||
elseif(config('OSPOS')->settings['line_sequence'] == '2') //TODO: Need to change these to constants
|
||||
elseif($this->config['line_sequence'] == '2') //TODO: Need to change these to constants
|
||||
{
|
||||
$sort = [];
|
||||
foreach($filtered_cart as $k => $v)
|
||||
@@ -311,7 +312,7 @@ class Sale_lib
|
||||
|
||||
public function is_invoice_mode(): bool
|
||||
{
|
||||
return ($this->session->get('sales_mode') == 'sale_invoice' && config('OSPOS')->settings['invoice_enable']);
|
||||
return ($this->session->get('sales_mode') == 'sale_invoice' && $this->config['invoice_enable']);
|
||||
}
|
||||
|
||||
public function is_sale_by_receipt_mode(): bool //TODO: This function is not called anywhere in the code.
|
||||
@@ -352,11 +353,11 @@ class Sale_lib
|
||||
|
||||
public function is_print_after_sale(): bool
|
||||
{//TODO: this needs to be converted to a switch statement
|
||||
if(config('OSPOS')->settings['print_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also ===
|
||||
if($this->config['print_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also ===
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif(config('OSPOS')->settings['print_receipt_check_behaviour'] == 'never') //TODO: === ?
|
||||
elseif($this->config['print_receipt_check_behaviour'] == 'never') //TODO: === ?
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -379,11 +380,11 @@ class Sale_lib
|
||||
|
||||
public function is_email_receipt(): bool
|
||||
{//TODO: this needs to be converted to a switch statement
|
||||
if(config('OSPOS')->settings['email_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also ===
|
||||
if($this->config['email_receipt_check_behaviour'] == 'always') //TODO: 'behaviour' is the british spelling, but the rest of the code is in American English. Not a big deal, but noticed. Also ===
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif(config('OSPOS')->settings['email_receipt_check_behaviour'] == 'never') //TODO: === ?
|
||||
elseif($this->config['email_receipt_check_behaviour'] == 'never') //TODO: === ?
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -720,7 +721,7 @@ class Sale_lib
|
||||
{
|
||||
if(!$this->session->get('dinner_table'))
|
||||
{
|
||||
if(config('OSPOS')->settings['dinner_table_enable'])
|
||||
if($this->config['dinner_table_enable'])
|
||||
{
|
||||
$this->set_dinner_table(1); //TODO: Replace 1 with constant
|
||||
}
|
||||
@@ -927,7 +928,7 @@ class Sale_lib
|
||||
$total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type);
|
||||
$discounted_total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type, TRUE);
|
||||
|
||||
if(config('OSPOS')->settings['multi_pack_enabled'])
|
||||
if($this->config['multi_pack_enabled'])
|
||||
{
|
||||
$item_info->name .= NAME_SEPARATOR . $item_info->pack_name;
|
||||
}
|
||||
@@ -1231,7 +1232,7 @@ class Sale_lib
|
||||
*/
|
||||
public function reset_cash_rounding(): int
|
||||
{
|
||||
$cash_rounding_code = config('OSPOS')->settings['cash_rounding_code'];
|
||||
$cash_rounding_code = $this->config['cash_rounding_code'];
|
||||
|
||||
if(cash_decimals() < totals_decimals() || $cash_rounding_code == Rounding_mode::HALF_FIVE) //TODO: convert to ternary notation.
|
||||
{
|
||||
@@ -1379,7 +1380,7 @@ class Sale_lib
|
||||
{
|
||||
$item_total = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE);
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($this->config['tax_included'])
|
||||
{
|
||||
$tax_fraction = bcdiv(bcadd('100', $tax_percentage), '100');
|
||||
$price_tax_excl = bcdiv($item_total, $tax_fraction);
|
||||
@@ -1397,7 +1398,7 @@ class Sale_lib
|
||||
$subtotal = '0.0';
|
||||
foreach($this->get_cart() as $item)
|
||||
{
|
||||
if($exclude_tax && config('OSPOS')->settings['tax_included'])
|
||||
if($exclude_tax && $this->config['tax_included'])
|
||||
{
|
||||
$subtotal = bcadd($subtotal, $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount'], $item['discount_type'], $include_discount));
|
||||
}
|
||||
@@ -1421,9 +1422,11 @@ class Sale_lib
|
||||
|
||||
$cash_mode = $this->session->get('cash_mode');
|
||||
|
||||
if(!config('OSPOS')->settings['tax_included'])
|
||||
if(!$this->config['tax_included'])
|
||||
{
|
||||
$cart = $this->get_cart();
|
||||
$this->tax_lib = new \app\Libraries\Tax_lib();
|
||||
|
||||
foreach($this->tax_lib->get_taxes($cart)[0] as $tax)
|
||||
{
|
||||
$total = bcadd($total, $tax['sale_tax_amount']);
|
||||
@@ -1446,8 +1449,8 @@ class Sale_lib
|
||||
public function check_for_cash_rounding(string $total): string
|
||||
{
|
||||
$cash_decimals = cash_decimals();
|
||||
$cash_rounding_code = config('OSPOS')->settings['cash_rounding_code'];
|
||||
$cash_rounding_code = $this->config['cash_rounding_code'];
|
||||
|
||||
return Rounding_mode::round_number($cash_rounding_code, (float)$total, $cash_decimals);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace app\Libraries;
|
||||
|
||||
use CodeIgniter\Encryption\Encryption;
|
||||
use CodeIgniter\Encryption\EncrypterInterface;
|
||||
use Config\Services;
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,21 +19,18 @@ use CodeIgniter\Encryption\EncrypterInterface;
|
||||
|
||||
class Sms_lib
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->encryption = new Encryption(); //TODO: Is this the correct way to load the encryption service now?
|
||||
$this->encrypter = $this->encryption->initialize();
|
||||
}
|
||||
|
||||
/*
|
||||
* SMS sending function
|
||||
* Example of use: $response = sendSMS('4477777777', 'My test message');
|
||||
*/
|
||||
public function sendSMS(int $phone, string $message): bool
|
||||
{
|
||||
$username = config('OSPOS')->settings['msg_uid'];
|
||||
$password = $this->encrypter->decrypt(config('OSPOS')->settings['msg_pwd']);
|
||||
$originator = config('OSPOS')->settings['msg_src'];
|
||||
$config = config('OSPOS')->settings;
|
||||
$encrypter = Services::encrypter();
|
||||
|
||||
$username = $config['msg_uid'];
|
||||
$password = $encrypter->decrypt($config['msg_pwd']);
|
||||
$originator = $config['msg_src'];
|
||||
|
||||
$response = FALSE;
|
||||
|
||||
@@ -78,4 +76,4 @@ class Sms_lib
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ use App\Libraries\Sale_lib;
|
||||
* @property tax_category tax_category
|
||||
* @property tax_code tax_code
|
||||
* @property tax_jurisdiction tax_jurisdiction
|
||||
* @property array config
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -46,6 +47,7 @@ class Tax_lib
|
||||
$this->tax_category = model('Tax_category');
|
||||
$this->tax_code = model('Tax_code');
|
||||
$this->tax_jurisdiction = model('Tax_jurisdiction');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
}
|
||||
|
||||
public function get_tax_types(): array
|
||||
@@ -98,7 +100,7 @@ class Tax_lib
|
||||
{
|
||||
$taxed = FALSE;
|
||||
|
||||
if(!config('OSPOS')->settings['use_destination_based_tax'])
|
||||
if(!$this->config['use_destination_based_tax'])
|
||||
{
|
||||
// Start of current Base System tax calculations
|
||||
|
||||
@@ -121,7 +123,7 @@ class Tax_lib
|
||||
$tax_basis = $this->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], TRUE);
|
||||
$tax_amount = '0.0';
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($this->config['tax_included'])
|
||||
{
|
||||
$tax_type = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
$tax_amount = $this->get_included_tax($item['quantity'], $item['price'], $item['discount'], $item['discount_type'], $tax['percent'], $tax_decimals, Rounding_mode::HALF_UP);
|
||||
@@ -161,7 +163,7 @@ class Tax_lib
|
||||
// Start of destination based tax calculations
|
||||
if($item['tax_category_id'] == NULL) //TODO: === ?
|
||||
{
|
||||
$item['tax_category_id'] = config('OSPOS')->settings['default_tax_category'];
|
||||
$item['tax_category_id'] = $this->config['default_tax_category'];
|
||||
}
|
||||
|
||||
$taxed = $this->apply_destination_tax($item, $customer_info->city, $customer_info->state, $customer_info->sales_tax_code_id, $register_mode, 0, $taxes, $item_taxes, $item['line']);
|
||||
@@ -274,7 +276,7 @@ class Tax_lib
|
||||
}
|
||||
|
||||
// If tax included then round decimal to tax decimals, otherwise round it to currency_decimals
|
||||
if(config('OSPOS')->settings['tax_included']) //TODO: Convert to ternary notation
|
||||
if($this->config['tax_included']) //TODO: Convert to ternary notation
|
||||
{
|
||||
$decimals = tax_decimals();
|
||||
}
|
||||
@@ -405,7 +407,7 @@ class Tax_lib
|
||||
{
|
||||
if($register_mode == 'sale')
|
||||
{
|
||||
$sales_tax_code_id = config('OSPOS')->settings['default_tax_code']; // overrides customer assigned code
|
||||
$sales_tax_code_id = $this->config['default_tax_code']; // overrides customer assigned code
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -415,7 +417,7 @@ class Tax_lib
|
||||
|
||||
if($sales_tax_code_id == NULL || $sales_tax_code_id == 0)
|
||||
{
|
||||
$sales_tax_code_id = config('OSPOS')->settings['default_tax_code']; // overrides customer assigned code
|
||||
$sales_tax_code_id = $this->config['default_tax_code']; // overrides customer assigned code
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,8 @@ class Token_lib
|
||||
|
||||
public function parse_barcode(string &$quantity, string &$price, string &$item_id_or_number_or_item_kit_or_receipt): void
|
||||
{
|
||||
$barcode_formats = json_decode(config('OSPOS')->settings['barcode_formats']);
|
||||
$config = config('OSPOS')->settings;
|
||||
$barcode_formats = json_decode($config['barcode_formats']);
|
||||
$barcode_tokens = Token::get_barcode_tokens();
|
||||
|
||||
if(!empty($barcode_formats))
|
||||
@@ -164,4 +165,4 @@ class Token_lib
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,19 @@ use ReflectionException;
|
||||
/**
|
||||
* Appconfig class
|
||||
*
|
||||
* @property mixed config
|
||||
*
|
||||
*/
|
||||
class Appconfig extends Model
|
||||
{
|
||||
protected $table = 'app_config';
|
||||
protected $primaryKey = 'key';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'key',
|
||||
'value'
|
||||
];
|
||||
|
||||
public function exists(string $key): bool
|
||||
{
|
||||
$builder = $this->db->table('app_config');
|
||||
@@ -32,7 +41,7 @@ class Appconfig extends Model
|
||||
public function get_value(string $key, string $default = ''): string
|
||||
{
|
||||
$builder = $this->db->table('app_config');
|
||||
$query = $builder->getWhere(['key' => $key], 1, 1);
|
||||
$query = $builder->getWhere(['key' => $key], 1);
|
||||
|
||||
if($query->getNumRows() == 1) //TODO: ===
|
||||
{
|
||||
@@ -43,21 +52,19 @@ class Appconfig extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the parent save() from BaseModel but additionally updates the cached array value.
|
||||
* @param $data
|
||||
* Calls the parent save() from BaseModel and updates the cached reference.
|
||||
* @param array|object $data
|
||||
* @return bool
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function save($data): bool
|
||||
public function save($data): bool //TODO: This is puking: Allowed fields must be specified for model: "App\Models\Appconfig"
|
||||
{
|
||||
$this->config = config('OSPOS');
|
||||
$success = parent::save($data);
|
||||
|
||||
$key = array_keys($data)[0];
|
||||
$config = config('OSPOS');
|
||||
|
||||
if($success)
|
||||
{
|
||||
$this->config[$key] = $data[$key];
|
||||
$config->update_settings(); //TODO: We need to investigate whether there is a possibility of stale data. It updates the cache in this function, but when save() returns any instances of $config->settings[] may not be updated yet.
|
||||
}
|
||||
|
||||
return $success;
|
||||
@@ -102,7 +109,8 @@ class Appconfig extends Model
|
||||
*/
|
||||
public function acquire_next_invoice_sequence(bool $save = true): string
|
||||
{
|
||||
$last_used = (int)config('OSPOS')->settings['last_used_invoice_number'] + 1;
|
||||
$config = config('OSPOS')->settings;
|
||||
$last_used = (int)$config['last_used_invoice_number'] + 1;
|
||||
|
||||
if($save)
|
||||
{
|
||||
@@ -117,7 +125,8 @@ class Appconfig extends Model
|
||||
*/
|
||||
public function acquire_next_quote_sequence(bool $save = true): string
|
||||
{
|
||||
$last_used = (int)config('OSPOS')->settings['last_used_quote_number'] + 1;
|
||||
$config = config('OSPOS')->settings;
|
||||
$last_used = (int)$config['last_used_quote_number'] + 1;
|
||||
|
||||
if($save)
|
||||
{
|
||||
@@ -132,7 +141,8 @@ class Appconfig extends Model
|
||||
*/
|
||||
public function acquire_next_work_order_sequence(bool $save = true): string
|
||||
{
|
||||
$last_used = (int)config('OSPOS')->settings['last_used_work_order_number'] + 1;
|
||||
$config = config('OSPOS')->settings;
|
||||
$last_used = (int)$config['last_used_work_order_number'] + 1;
|
||||
|
||||
if($save)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,26 @@ use ReflectionClass;
|
||||
*/
|
||||
class Attribute extends Model
|
||||
{
|
||||
protected $table = 'attribute_definitions';
|
||||
protected $primaryKey = 'definition_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [ //TODO: This model may not be well designed... The model accesses three different tables (attribute_definitions, attribute_links, attribute_values). Should that be more than one model? According to CodeIgniter, these are meant to model a single table https://codeigniter.com/user_guide/models/model.html#models
|
||||
'definition_name',
|
||||
'definition_type',
|
||||
'definition_unit',
|
||||
'definition_flags',
|
||||
'deleted',
|
||||
'attribute_id',
|
||||
'definition_id',
|
||||
'item_id',
|
||||
'sale_id',
|
||||
'receiving_id',
|
||||
'attribute_value',
|
||||
'attribute_date',
|
||||
'attribute_decimal'
|
||||
];
|
||||
|
||||
const SHOW_IN_ITEMS = 1; //TODO: These need to be moved to constants.php
|
||||
const SHOW_IN_SALES = 2;
|
||||
const SHOW_IN_RECEIVINGS = 4;
|
||||
@@ -67,11 +87,12 @@ class Attribute extends Model
|
||||
*/
|
||||
public function value_exists($attribute_value, string $definition_type = TEXT): bool
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
switch($definition_type)
|
||||
{
|
||||
case DATE:
|
||||
$data_type = 'date';
|
||||
$attribute_date_value = DateTime::createFromFormat(config('OSPOS')->settings['dateformat'], $attribute_value);
|
||||
$attribute_date_value = DateTime::createFromFormat($config['dateformat'], $attribute_value);
|
||||
$attribute_value = $attribute_date_value->format('Y-m-d');
|
||||
break;
|
||||
case DECIMAL:
|
||||
@@ -207,7 +228,7 @@ class Attribute extends Model
|
||||
public function get_definitions_by_flags(int $definition_flags): array
|
||||
{
|
||||
$builder = $this->db->table('attribute_definitions');
|
||||
$builder->where('definition_flags &', $definition_flags);
|
||||
$builder->where('definition_flags', $definition_flags);
|
||||
$builder->where('deleted', 0);
|
||||
$builder->where('definition_type <>', GROUP);
|
||||
$builder->orderBy('definition_id');
|
||||
@@ -490,12 +511,12 @@ class Attribute extends Model
|
||||
return $success;
|
||||
}
|
||||
|
||||
public function get_definition_by_name(string $definition_name, $definition_type = FALSE): array
|
||||
public function get_definition_by_name(string $definition_name, $definition_type = false): array
|
||||
{
|
||||
$builder = $this->db->table('attribute_definitions');
|
||||
$builder->where('definition_name', $definition_name);
|
||||
|
||||
if($definition_type != FALSE)
|
||||
if($definition_type)
|
||||
{
|
||||
$builder->where('definition_type', $definition_type);
|
||||
}
|
||||
@@ -648,7 +669,8 @@ class Attribute extends Model
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$locale_date_format = config('OSPOS')->settings['dateformat'];
|
||||
$config = config('OSPOS')->settings;
|
||||
$locale_date_format = $config['dateformat'];
|
||||
|
||||
//New Attribute
|
||||
if(empty($attribute_id) || empty($item_id))
|
||||
@@ -825,7 +847,7 @@ class Attribute extends Model
|
||||
{
|
||||
$new_attribute_id = $this->save_value($attribute['attribute_value'], $definition_id, FALSE, $attribute['attribute_id'], $definition_type);
|
||||
|
||||
if($this->save_link($attribute['item_id'], $definition_id, $new_attribute_id) == FALSE)
|
||||
if(!$this->save_link($attribute['item_id'], $definition_id, $new_attribute_id))
|
||||
{
|
||||
log_message('Error', 'Transaction failed');
|
||||
$this->db->transRollback();
|
||||
|
||||
@@ -14,6 +14,27 @@ use stdClass;
|
||||
|
||||
class Cashup extends Model
|
||||
{
|
||||
protected $table = 'cash_up';
|
||||
protected $primaryKey = 'cashup_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'open_date',
|
||||
'close_date',
|
||||
'open_cash_amount',
|
||||
'transfer_cash_amount',
|
||||
'note',
|
||||
'closed_amount_cash',
|
||||
'closed_amount_card',
|
||||
'closed_amount_check',
|
||||
'closed_amount_total',
|
||||
'description',
|
||||
'open_employee_id',
|
||||
'close_employee_id',
|
||||
'deleted',
|
||||
'closed_amount_due'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given Cashup_id is a Cashup
|
||||
*/
|
||||
@@ -60,10 +81,11 @@ class Cashup extends Model
|
||||
*/
|
||||
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
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$builder = $this->db->table('cash_up AS cash_up');
|
||||
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(cash_up.cashup_id) as count');
|
||||
}
|
||||
@@ -105,7 +127,7 @@ class Cashup extends Model
|
||||
|
||||
$builder->where('cash_up.deleted', $filters['is_deleted']);
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: convert this to ternary notation.
|
||||
if(empty($config['date_or_time_format'])) //TODO: convert this to ternary notation.
|
||||
{
|
||||
$builder->where('DATE_FORMAT(cash_up.open_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
@@ -117,7 +139,7 @@ class Cashup extends Model
|
||||
$builder->groupBy('cashup_id');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRowArray()['count'];
|
||||
}
|
||||
@@ -221,4 +243,4 @@ class Cashup extends Model
|
||||
|
||||
return $success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,27 @@ use CodeIgniter\Database\ResultInterface;
|
||||
*/
|
||||
class Customer extends Person
|
||||
{
|
||||
protected $table = 'customers';
|
||||
protected $primaryKey = 'person_id';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'account_number',
|
||||
'taxable',
|
||||
'tax_id',
|
||||
'sales_tax_code_id',
|
||||
'deleted',
|
||||
'discount',
|
||||
'discount_type',
|
||||
'company_name',
|
||||
'package_id',
|
||||
'points',
|
||||
'date',
|
||||
'employee_id',
|
||||
'consent'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Determines if a given person_id is a customer
|
||||
*/
|
||||
@@ -226,9 +247,10 @@ class Customer extends Person
|
||||
public function delete($customer_id = null, bool $purge = false): bool
|
||||
{
|
||||
$result = TRUE;
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// if privacy enforcement is selected scramble customer data
|
||||
if(config('OSPOS')->settings['enforce_privacy'])
|
||||
if($config['enforce_privacy'])
|
||||
{
|
||||
$builder = $this->db->table('people');
|
||||
$builder->where('person_id', $customer_id);
|
||||
@@ -407,7 +429,7 @@ class Customer extends Person
|
||||
$builder->where('deleted', 0);
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -421,4 +443,4 @@ class Customer extends Person
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,16 @@ use CodeIgniter\Model;
|
||||
*/
|
||||
class Customer_rewards extends Model
|
||||
{
|
||||
protected $table = 'customer_packages';
|
||||
protected $primaryKey = 'package_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'package_name',
|
||||
'points_percent',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
public function exists(int $package_id): bool
|
||||
{
|
||||
$builder = $this->db->table('customers_packages');
|
||||
|
||||
@@ -10,6 +10,16 @@ use CodeIgniter\Model;
|
||||
*/
|
||||
class Dinner_table extends Model
|
||||
{
|
||||
protected $table = 'dinner_tables';
|
||||
protected $primaryKey = 'dinner_table_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'name',
|
||||
'status',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
public function exists(int $dinner_table_id): bool
|
||||
{
|
||||
$builder = $this->db->table('dinner_tables');
|
||||
@@ -145,4 +155,4 @@ class Dinner_table extends Model
|
||||
{
|
||||
return $this->release($release_dinner_table_id) && $this->occupy($occupy_dinner_table_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Database\ResultInterface;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\Session\Session;
|
||||
|
||||
/**
|
||||
@@ -13,6 +14,19 @@ use CodeIgniter\Session\Session;
|
||||
*/
|
||||
class Employee extends Person
|
||||
{
|
||||
protected $table = 'Employees';
|
||||
protected $primaryKey = 'person_id';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'username',
|
||||
'password',
|
||||
'deleted',
|
||||
'hashversion',
|
||||
'language',
|
||||
'language_code'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -80,20 +94,18 @@ class Employee extends Person
|
||||
{
|
||||
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, as $employee_id is NOT an employee
|
||||
$person_obj = parent::get_info(-1); //TODO: Replace -1 with a constant
|
||||
|
||||
//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)
|
||||
{
|
||||
//Get empty base parent object, as $employee_id is NOT an employee
|
||||
$person_obj = parent::get_info(-1); //TODO: Replace -1 with a constant
|
||||
|
||||
//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 = '';
|
||||
}
|
||||
|
||||
return $person_obj;
|
||||
$person_obj->$field = '';
|
||||
}
|
||||
|
||||
return $person_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +256,7 @@ class Employee extends Person
|
||||
$builder->orLike('CONCAT(first_name, " ", last_name)', $search);
|
||||
$builder->groupEnd();
|
||||
|
||||
if($unique == FALSE)
|
||||
if(!$unique)
|
||||
{
|
||||
$builder->where('deleted', 0);
|
||||
}
|
||||
@@ -396,11 +408,11 @@ class Employee extends Person
|
||||
/**
|
||||
* Logs out a user by destroying all session data and redirect to log in
|
||||
*/
|
||||
public function logout(): void
|
||||
public function logout(): RedirectResponse
|
||||
{
|
||||
$this->session->destroy();
|
||||
session()->destroy();
|
||||
|
||||
redirect()->to('login');
|
||||
return redirect()->to('login');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,4 +559,4 @@ class Employee extends Person
|
||||
|
||||
return $success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class Rounding_mode
|
||||
}
|
||||
|
||||
public static function round_number(int $rounding_mode, float $amount, int $decimals): string
|
||||
{//TODO: this needs to be be replaced with a switch statement
|
||||
{//TODO: this needs to be replaced with a switch statement
|
||||
if($rounding_mode == Rounding_mode::ROUND_UP)
|
||||
{
|
||||
$fig = pow(10, $decimals);
|
||||
|
||||
@@ -14,6 +14,23 @@ use stdClass;
|
||||
*/
|
||||
class Expense extends Model
|
||||
{
|
||||
protected $table = 'expenses';
|
||||
protected $primaryKey = 'expense_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'date',
|
||||
'amount',
|
||||
'payment_type',
|
||||
'expense_category_id',
|
||||
'description',
|
||||
'employee_id',
|
||||
'deleted',
|
||||
'supplier_tax_code',
|
||||
'tax_amount',
|
||||
'supplier_id'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given Expense_id is an Expense
|
||||
*/
|
||||
@@ -72,10 +89,11 @@ class Expense extends Model
|
||||
*/
|
||||
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
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$builder = $this->db->table('expenses AS expenses');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only) //TODO: replace this with `if($count_only)`
|
||||
{
|
||||
$builder->select('COUNT(DISTINCT expenses.expense_id) as count');
|
||||
}
|
||||
@@ -113,11 +131,11 @@ class Expense extends Model
|
||||
$builder->where('expenses.deleted', $filters['is_deleted']);
|
||||
|
||||
/* //TODO: Below needs to be replaced with Ternary notation
|
||||
empty(config('OSPOS')->settings['date_or_time_format)
|
||||
empty($config['date_or_time_format)
|
||||
? $builder->where('DATE_FORMAT(expenses.date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']))
|
||||
: $builder->where('expenses.date BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date'])));
|
||||
*/
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$builder->where('DATE_FORMAT(expenses.date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
@@ -126,17 +144,17 @@ class Expense extends Model
|
||||
$builder->where('expenses.date BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date'])));
|
||||
}
|
||||
|
||||
if($filters['only_debit'] != FALSE) //TODO: Avoid the double negative on these... just replace it with `if($filters['only_debit'])`... same with below.
|
||||
if($filters['only_debit'])
|
||||
{
|
||||
$builder->like('expenses.payment_type', lang('Expenses.debit'));
|
||||
}
|
||||
|
||||
if($filters['only_credit'] != FALSE)
|
||||
if($filters['only_credit'])
|
||||
{
|
||||
$builder->like('expenses.payment_type', lang('Expenses.credit'));
|
||||
}
|
||||
|
||||
if($filters['only_cash'] != FALSE)
|
||||
if($filters['only_cash'])
|
||||
{
|
||||
$builder->groupStart();
|
||||
$builder->like('expenses.payment_type', lang('Expenses.cash'));
|
||||
@@ -144,17 +162,17 @@ class Expense extends Model
|
||||
$builder->groupEnd();
|
||||
}
|
||||
|
||||
if($filters['only_due'] != FALSE)
|
||||
if($filters['only_due'])
|
||||
{
|
||||
$builder->like('expenses.payment_type', lang('Expenses.due'));
|
||||
}
|
||||
|
||||
if($filters['only_check'] != FALSE)
|
||||
if($filters['only_check'])
|
||||
{
|
||||
$builder->like('expenses.payment_type', lang('Expenses.check'));
|
||||
}
|
||||
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only) //TODO: replace this with `if($count_only)`
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -269,12 +287,14 @@ class Expense extends Model
|
||||
*/
|
||||
public function get_payments_summary(string $search, array $filters): array //TODO: $search is passed but never used in the function
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// get payment summary
|
||||
$builder = $this->db->table('expenses');
|
||||
$builder->select('payment_type, COUNT(amount) AS count, SUM(amount) AS amount');
|
||||
$builder->where('deleted', $filters['is_deleted']);
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$builder->where('DATE_FORMAT(date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
@@ -283,27 +303,27 @@ class Expense extends Model
|
||||
$builder->where('date BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date'])));
|
||||
}
|
||||
|
||||
if($filters['only_cash'] != FALSE) //TODO: Avoid the double negative on these... just replace it with `if($filters['only_cash'])`... same with below.
|
||||
if($filters['only_cash'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Expenses.cash'));
|
||||
}
|
||||
|
||||
if($filters['only_due'] != FALSE)
|
||||
if($filters['only_due'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Expenses.due'));
|
||||
}
|
||||
|
||||
if($filters['only_check'] != FALSE)
|
||||
if($filters['only_check'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Expenses.check'));
|
||||
}
|
||||
|
||||
if($filters['only_credit'] != FALSE)
|
||||
if($filters['only_credit'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Expenses.credit'));
|
||||
}
|
||||
|
||||
if($filters['only_debit'] != FALSE)
|
||||
if($filters['only_debit'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Expenses.debit'));
|
||||
}
|
||||
@@ -331,4 +351,4 @@ class Expense extends Model
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,16 @@ use stdClass;
|
||||
*/
|
||||
class Expense_category extends Model
|
||||
{
|
||||
protected $table = 'expense_categories';
|
||||
protected $primaryKey = 'expense_category_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'category_name',
|
||||
'category_description',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given Expense_id is an Expense category
|
||||
*/
|
||||
@@ -69,7 +79,7 @@ class Expense_category extends Model
|
||||
{
|
||||
$builder = $this->db->table('expense_categories');
|
||||
|
||||
if($no_deleted == TRUE)
|
||||
if($no_deleted)
|
||||
{
|
||||
$builder->where('deleted', 0);
|
||||
}
|
||||
@@ -173,4 +183,4 @@ class Expense_category extends Model
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,18 @@ use stdClass;
|
||||
*/
|
||||
class Giftcard extends Model
|
||||
{
|
||||
protected $table = 'giftcards';
|
||||
protected $primaryKey = 'giftcard_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'giftcard_number',
|
||||
'value',
|
||||
'deleted',
|
||||
'person_id',
|
||||
'record_time'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given giftcard_id is a giftcard
|
||||
*/
|
||||
@@ -226,7 +238,7 @@ class Giftcard extends Model
|
||||
$builder = $this->db->table('giftcards');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only) //TODO: replace this with `if($count_only)`
|
||||
{
|
||||
$builder->select('COUNT(giftcards.giftcard_id) as count');
|
||||
}
|
||||
@@ -242,7 +254,7 @@ class Giftcard extends Model
|
||||
$builder->where('giftcards.deleted', 0);
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only) //TODO: replace this with `if($count_only)`
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -329,4 +341,4 @@ class Giftcard extends Model
|
||||
|
||||
return $builder->get()->getRow()->person_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,27 @@ use ReflectionException;
|
||||
*/
|
||||
class Inventory extends Model
|
||||
{
|
||||
public function insert(array $inventory_data = NULL, bool $returnID = TRUE): bool //TODO: $returnID does not match variable naming conventions. It's also never used in the function
|
||||
protected $table = 'inventory';
|
||||
protected $primaryKey = 'trans_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'trans_items',
|
||||
'trans_user',
|
||||
'trans_date',
|
||||
'trans_comment',
|
||||
'trans_inventory',
|
||||
'trans_location'
|
||||
];
|
||||
|
||||
public function insert($inventory_data = NULL, bool $returnID = TRUE)
|
||||
{
|
||||
$builder = $this->db->table('inventory');
|
||||
|
||||
return $builder->insert($inventory_data);
|
||||
}
|
||||
|
||||
public function update(string $comment = NULL, array $inventory_data = NULL): bool //TODO: this function either needs a name change or to be brought in line with the parent function declaration.
|
||||
public function update($comment = NULL, $inventory_data = NULL): bool
|
||||
{
|
||||
$builder = $this->db->table('inventory');
|
||||
$builder->where('trans_comment', $comment);
|
||||
@@ -40,7 +53,7 @@ class Inventory extends Model
|
||||
$builder = $this->db->table('inventory');
|
||||
$builder->where('trans_items', $item_id);
|
||||
|
||||
if($location_id != FALSE)
|
||||
if($location_id)
|
||||
{
|
||||
$builder->where('trans_location', $location_id);
|
||||
}
|
||||
@@ -84,4 +97,4 @@ class Inventory extends Model
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,33 @@ use stdClass;
|
||||
*/
|
||||
class Item extends Model
|
||||
{
|
||||
protected $table = 'items';
|
||||
protected $primaryKey = 'item_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'name',
|
||||
'category',
|
||||
'supplier_id',
|
||||
'item_number',
|
||||
'description',
|
||||
'cost_price',
|
||||
'unit_price',
|
||||
'reorder_level',
|
||||
'allow_alt_description',
|
||||
'is_serialized',
|
||||
'deleted',
|
||||
'stock_type',
|
||||
'item_type',
|
||||
'tax_category_id',
|
||||
'receiving_quantity',
|
||||
'pic_filename',
|
||||
'qty_per_pack',
|
||||
'pack_name',
|
||||
'low_sell_item_id',
|
||||
'hsn_code'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given item_id is an item
|
||||
*/
|
||||
@@ -43,7 +70,9 @@ class Item extends Model
|
||||
*/
|
||||
public function item_number_exists(string $item_number, string $item_id = ''): bool
|
||||
{
|
||||
if(config('OSPOS')->settings['allow_duplicate_barcodes'])
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if($config['allow_duplicate_barcodes'])
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -93,6 +122,7 @@ class Item extends Model
|
||||
*/
|
||||
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
|
||||
{
|
||||
$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
|
||||
|
||||
// get_found_rows case
|
||||
@@ -150,7 +180,7 @@ class Item extends Model
|
||||
$builder->where('location_id', $filters['stock_location_id']);
|
||||
}
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: This needs to be replaced with Ternary notation
|
||||
if(empty($config['date_or_time_format'])) //TODO: This needs to be replaced with Ternary notation
|
||||
{
|
||||
$builder->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
@@ -194,23 +224,23 @@ class Item extends Model
|
||||
|
||||
$builder->where('items.deleted', $filters['is_deleted']);
|
||||
|
||||
if($filters['empty_upc'] != FALSE) //TODO: Avoid the double negative on these... just replace it with `if($filters['empty_upc'])`... same with below.
|
||||
if($filters['empty_upc'])
|
||||
{
|
||||
$builder->where('item_number', NULL);
|
||||
}
|
||||
if($filters['low_inventory'] != FALSE)
|
||||
if($filters['low_inventory'])
|
||||
{
|
||||
$builder->where('quantity <=', 'reorder_level');
|
||||
}
|
||||
if($filters['is_serialized'] != FALSE)
|
||||
if($filters['is_serialized'])
|
||||
{
|
||||
$builder->where('is_serialized', 1);
|
||||
}
|
||||
if($filters['no_description'] != FALSE)
|
||||
if($filters['no_description'])
|
||||
{
|
||||
$builder->where('items.description', '');
|
||||
}
|
||||
if($filters['temporary'] != FALSE)
|
||||
if($filters['temporary'])
|
||||
{
|
||||
$builder->where('items.item_type', ITEM_TEMP);
|
||||
}
|
||||
@@ -346,7 +376,7 @@ class Item extends Model
|
||||
$builder->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
|
||||
$builder->where('item_number', $item_number);
|
||||
|
||||
if($ignore_deleted == FALSE) //TODO: ===
|
||||
if(!$ignore_deleted)
|
||||
{
|
||||
$builder->where('items.deleted', $deleted);
|
||||
}
|
||||
@@ -439,7 +469,7 @@ class Item extends Model
|
||||
* Deletes one item
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function delete(int $item_id = null, bool $purge = false): bool //TODO: need to figure out what to do with these override functions that don't match our signature.
|
||||
public function delete($item_id = null, bool $purge = false)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
@@ -505,16 +535,17 @@ class Item extends Model
|
||||
|
||||
function get_search_suggestion_format(string $seed = NULL): string
|
||||
{
|
||||
$seed .= ',' . config('OSPOS')->settings['suggestions_first_column'];
|
||||
$config = config('OSPOS')->settings;
|
||||
$seed .= ',' . $config['suggestions_first_column'];
|
||||
|
||||
if(config('OSPOS')->settings['suggestions_second_column'] !== '')
|
||||
if($config['suggestions_second_column'] !== '')
|
||||
{
|
||||
$seed .= ',' . config('OSPOS')->settings['suggestions_second_column'];
|
||||
$seed .= ',' . $config['suggestions_second_column'];
|
||||
}
|
||||
|
||||
if(config('OSPOS')->settings['suggestions_third_column'] !== '')
|
||||
if($config['suggestions_third_column'] !== '')
|
||||
{
|
||||
$seed .= ',' . config('OSPOS')->settings['suggestions_third_column'];
|
||||
$seed .= ',' . $config['suggestions_third_column'];
|
||||
}
|
||||
|
||||
return $seed;
|
||||
@@ -522,13 +553,14 @@ class Item extends Model
|
||||
|
||||
function get_search_suggestion_label($result_row): string
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$label = '';
|
||||
$label1 = config('OSPOS')->settings['suggestions_first_column'];
|
||||
$label2 = config('OSPOS')->settings['suggestions_second_column'];
|
||||
$label3 = config('OSPOS')->settings['suggestions_third_column'];
|
||||
$label1 = $config['suggestions_first_column'];
|
||||
$label2 = $config['suggestions_second_column'];
|
||||
$label3 = $config['suggestions_third_column'];
|
||||
|
||||
// If multi_pack enabled then if "name" is part of the search suggestions then append pack
|
||||
if(config('OSPOS')->settings['multi_pack_enabled'])
|
||||
if($config['multi_pack_enabled'])
|
||||
{
|
||||
$this->append_label($label, $label1, $result_row);
|
||||
$this->append_label($label, $label2, $result_row);
|
||||
@@ -1028,6 +1060,8 @@ class Item extends Model
|
||||
*/
|
||||
function get_item_name(string $as_name = NULL): string
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if($as_name == NULL) //TODO: Replace with ternary notation
|
||||
{
|
||||
$as_name = '';
|
||||
@@ -1037,7 +1071,7 @@ class Item extends Model
|
||||
$as_name = ' AS ' . $as_name;
|
||||
}
|
||||
|
||||
if(config('OSPOS')->settings['multi_pack_enabled']) //TODO: Replace with ternary notation
|
||||
if($config['multi_pack_enabled']) //TODO: Replace with ternary notation
|
||||
{
|
||||
$item_name = "concat(items.name,'" . NAME_SEPARATOR . '\', items.pack_name)' . $as_name;
|
||||
}
|
||||
@@ -1048,4 +1082,4 @@ class Item extends Model
|
||||
|
||||
return $item_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,20 @@ use stdClass;
|
||||
*/
|
||||
class Item_kit extends Model
|
||||
{
|
||||
protected $table = 'item_kits';
|
||||
protected $primaryKey = 'item_kit_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'item_kit_number',
|
||||
'name',
|
||||
'description',
|
||||
'item_id',
|
||||
'kit_discount',
|
||||
'kit_discount_type',
|
||||
'price_option'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given item_id is an item kit
|
||||
*/
|
||||
@@ -50,7 +64,9 @@ class Item_kit extends Model
|
||||
*/
|
||||
public function item_number_exists(string $item_kit_number, string $item_kit_id = ''): bool
|
||||
{
|
||||
if(config('OSPOS')->settings['allow_duplicate_barcodes'])
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if($config['allow_duplicate_barcodes'])
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -174,7 +190,7 @@ class Item_kit extends Model
|
||||
/**
|
||||
* Deletes one item kit
|
||||
*/
|
||||
public function delete(int $item_kit_id = null, bool $purge = false): bool
|
||||
public function delete($item_kit_id = null, bool $purge = false)
|
||||
{
|
||||
$builder = $this->db->table('item_kits');
|
||||
|
||||
@@ -246,7 +262,7 @@ class Item_kit extends Model
|
||||
$builder = $this->db->table('item_kits AS item_kits'); //TODO: Can we just say 'item_kits' here?
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(item_kits.item_kit_id) as count');
|
||||
}
|
||||
@@ -262,7 +278,7 @@ class Item_kit extends Model
|
||||
}
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -276,4 +292,4 @@ class Item_kit extends Model
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,14 @@ use CodeIgniter\Model;
|
||||
*/
|
||||
class Item_kit_items extends Model
|
||||
{
|
||||
protected $table = 'item_kit_items';
|
||||
protected $primaryKey = 'item_kit_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'kit_sequence'
|
||||
];
|
||||
|
||||
/**
|
||||
* Gets item kit items for a particular item kit
|
||||
*/
|
||||
@@ -72,10 +80,10 @@ class Item_kit_items extends Model
|
||||
/**
|
||||
* Deletes item kit items given an item kit
|
||||
*/
|
||||
public function delete(int $item_kit_id = null, bool $purge = false): bool
|
||||
public function delete($item_kit_id = null, bool $purge = false)
|
||||
{
|
||||
$builder = $this->db->table('item_kit_items');
|
||||
|
||||
return $builder->delete(['item_kit_id' => $item_kit_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,14 @@ use stdClass;
|
||||
*/
|
||||
class Item_quantity extends Model
|
||||
{
|
||||
protected $table = 'item_quantities';
|
||||
protected $primaryKey = 'item_id';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'quantity'
|
||||
];
|
||||
|
||||
public function exists(int $item_id, int $location_id): bool
|
||||
{
|
||||
$builder = $this->db->table('item_quantities');
|
||||
@@ -41,7 +49,7 @@ class Item_quantity extends Model
|
||||
$builder->where('location_id', $location_id);
|
||||
$result = $builder->get()->getRow();
|
||||
|
||||
if(empty($result) == TRUE)
|
||||
if(empty($result))
|
||||
{
|
||||
//Get empty base parent object, as $item_id is NOT an item
|
||||
$result = new stdClass();
|
||||
@@ -93,4 +101,4 @@ class Item_quantity extends Model
|
||||
|
||||
return $builder->update(['quantity' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,15 @@ use CodeIgniter\Model;
|
||||
*/
|
||||
class Item_taxes extends Model
|
||||
{
|
||||
protected $table = 'item_taxes';
|
||||
protected $primaryKey = 'item_id';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'name',
|
||||
'percent'
|
||||
];
|
||||
|
||||
/**
|
||||
* Gets tax info for a particular item
|
||||
*/
|
||||
@@ -81,10 +90,10 @@ class Item_taxes extends Model
|
||||
/**
|
||||
* Deletes taxes given an item
|
||||
*/
|
||||
public function delete(int $item_id = null, bool $purge = false): bool
|
||||
public function delete($item_id = null, bool $purge = false)
|
||||
{
|
||||
$builder = $this->db->table('items_taxes');
|
||||
|
||||
return $builder->delete(['item_id' => $item_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,16 @@ use CodeIgniter\Model;
|
||||
*/
|
||||
class Module extends Model
|
||||
{
|
||||
protected $table = 'modules';
|
||||
protected $primaryKey = 'module_id';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'name_lang_key',
|
||||
'desc_lang_key',
|
||||
'sort'
|
||||
];
|
||||
|
||||
public function get_module_name(string $module_id): string
|
||||
{
|
||||
$builder = $this->db->table('modules');
|
||||
@@ -128,4 +138,4 @@ class Module extends Model
|
||||
|
||||
return $builder->get()->getRow()->sort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,25 @@ use stdClass;
|
||||
*/
|
||||
class Person extends Model
|
||||
{
|
||||
protected $table = 'people';
|
||||
protected $primaryKey = 'person_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'phone_number',
|
||||
'email',
|
||||
'address_1',
|
||||
'address_2',
|
||||
'city',
|
||||
'state',
|
||||
'zip',
|
||||
'country',
|
||||
'comments',
|
||||
'gender'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines whether the given person exists in the people database table
|
||||
*
|
||||
@@ -176,7 +195,7 @@ class Person extends Model
|
||||
*/
|
||||
public function delete($person_id = null, bool $purge = false): bool
|
||||
{
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,4 +208,4 @@ class Person extends Model
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,20 @@ use ReflectionException;
|
||||
*/
|
||||
class Receiving extends Model
|
||||
{
|
||||
protected $table = 'receivings';
|
||||
protected $primaryKey = 'receiving_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'receiving_time',
|
||||
'supplier_id',
|
||||
'employee_id',
|
||||
'comment',
|
||||
'receiving_id',
|
||||
'payment_type',
|
||||
'reference'
|
||||
];
|
||||
|
||||
public function get_info(int $receiving_id): ResultInterface
|
||||
{
|
||||
$builder = $this->db->table('receivings');
|
||||
@@ -63,7 +77,7 @@ class Receiving extends Model
|
||||
return ($builder->get()->getNumRows() == 1);
|
||||
}
|
||||
|
||||
public function update(int $receiving_id = NULL, array $receiving_data = NULL): bool
|
||||
public function update($receiving_id = NULL, $receiving_data = NULL): bool
|
||||
{
|
||||
$builder = $this->db->table('receivings');
|
||||
$builder->where('receiving_id', $receiving_id);
|
||||
@@ -107,6 +121,7 @@ class Receiving extends Model
|
||||
|
||||
foreach($items as $line => $item_data)
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$cur_item_info = $item->get_info($item['item_id']);
|
||||
|
||||
$receivings_items_data = [
|
||||
@@ -129,7 +144,7 @@ class Receiving extends Model
|
||||
$items_received = $item_data['receiving_quantity'] != 0 ? $item_data['quantity'] * $item_data['receiving_quantity'] : $item_data['quantity'];
|
||||
|
||||
// update cost price, if changed AND is set in config as wanted
|
||||
if($cur_item_info->cost_price != $item_data['price'] && config('OSPOS')->settings['receiving_calculate_average_price'])
|
||||
if($cur_item_info->cost_price != $item_data['price'] && $config['receiving_calculate_average_price'])
|
||||
{
|
||||
$item->change_cost_price($item_data['item_id'], $items_received, $item_data['price'], $cur_item_info->cost_price);
|
||||
}
|
||||
@@ -238,7 +253,7 @@ class Receiving extends Model
|
||||
|
||||
// execute transaction
|
||||
$this->db->transComplete();
|
||||
|
||||
|
||||
return $this->db->transStatus();
|
||||
}
|
||||
|
||||
@@ -249,7 +264,7 @@ class Receiving extends Model
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
|
||||
|
||||
public function get_supplier(int $receiving_id): object
|
||||
{
|
||||
$builder = $this->db->table('receivings');
|
||||
@@ -275,9 +290,11 @@ class Receiving extends Model
|
||||
*/
|
||||
public function create_temp_table(array $inputs): void
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(empty($inputs['receiving_id']))
|
||||
{
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$where = 'WHERE DATE(receiving_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
|
||||
}
|
||||
@@ -331,4 +348,4 @@ class Receiving extends Model
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,12 @@ class Summary_discounts extends Summary_report
|
||||
|
||||
public function getData(array $inputs): array
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$builder = $this->db->table('sales_items AS sales_items');
|
||||
|
||||
if($inputs['discount_type'] == FIXED) //TODO: if there are only two options for this if/else statement then it needs to be refactored to use ternary operators. Also ===?
|
||||
{
|
||||
$builder->select('SUM(sales_items.discount) AS total, MAX(CONCAT("' . config('OSPOS')->settings['currency_symbol'] . '",sales_items.discount)) AS discount, count(*) AS count');
|
||||
$builder->select('SUM(sales_items.discount) AS total, MAX(CONCAT("' . $config['currency_symbol'] . '",sales_items.discount)) AS discount, count(*) AS count');
|
||||
$builder->where('discount_type', FIXED);
|
||||
}
|
||||
elseif($inputs['discount_type'] == PERCENT) //TODO: === ?
|
||||
@@ -38,4 +39,4 @@ class Summary_discounts extends Summary_report
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,14 @@ class Summary_expenses_categories extends Summary_report
|
||||
|
||||
public function getData(array $inputs): array
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$builder = $this->db->table('expenses AS expenses');
|
||||
$builder->select('expense_categories.category_name AS category_name, COUNT(expenses.expense_id) AS count, SUM(expenses.amount) AS total_amount, SUM(expenses.tax_amount) AS total_tax_amount');
|
||||
$builder->join('expense_categories AS expense_categories', 'expense_categories.expense_category_id = expenses.expense_category_id', 'LEFT');
|
||||
|
||||
//TODO: convert this to ternary notation
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code
|
||||
if(empty($config['date_or_time_format'])) //TODO: Duplicated code
|
||||
{
|
||||
$builder->where('DATE(expenses.date) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']));
|
||||
}
|
||||
@@ -40,10 +42,12 @@ class Summary_expenses_categories extends Summary_report
|
||||
|
||||
public function getSummaryData(array $inputs): array
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$builder = $this->db->table('expenses AS expenses');
|
||||
$builder->select('SUM(expenses.amount) AS expenses_total_amount, SUM(expenses.tax_amount) AS expenses_total_tax_amount');
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code
|
||||
if(empty($config['date_or_time_format'])) //TODO: Duplicated code
|
||||
{
|
||||
$builder->where('DATE(expenses.date) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']));
|
||||
}
|
||||
@@ -56,4 +60,4 @@ class Summary_expenses_categories extends Summary_report
|
||||
|
||||
return $builder->get()->getRowArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class Summary_payments extends Summary_report
|
||||
public function getData(array $inputs): array
|
||||
{
|
||||
$cash_payment = lang('Sales.cash'); //TODO: This is never used. Should it be?
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$separator[] = [
|
||||
'trans_group' => '<HR>',
|
||||
@@ -34,7 +35,7 @@ class Summary_payments extends Summary_report
|
||||
$where = ''; //TODO: Duplicated code
|
||||
|
||||
//TODO: this needs to be converted to ternary notation
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) {
|
||||
if(empty($config['date_or_time_format'])) {
|
||||
$where .= 'DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
|
||||
} else {
|
||||
$where .= 'sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date']));
|
||||
@@ -170,4 +171,4 @@ class Summary_payments extends Summary_report
|
||||
)'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,10 @@ abstract class Summary_report extends Report
|
||||
*/
|
||||
private function __common_select(array $inputs, &$builder): void //TODO: Hungarian notation
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$where = ''; //TODO: Duplicated code
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$where .= 'DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
|
||||
}
|
||||
@@ -32,7 +33,7 @@ abstract class Summary_report extends Report
|
||||
$cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)';
|
||||
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($config['tax_included'])
|
||||
{
|
||||
$sale_total = "ROUND(SUM($sale_price), $decimals) + $cash_adjustment";
|
||||
$sale_subtotal = "$sale_total - $sales_tax";
|
||||
@@ -100,8 +101,10 @@ abstract class Summary_report extends Report
|
||||
|
||||
private function __common_where(array $inputs, &$builder): void
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
//TODO: Probably going to need to rework these since you can't reference $builder without it's instantiation.
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code
|
||||
if(empty($config['date_or_time_format'])) //TODO: Duplicated code
|
||||
{
|
||||
$builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']));
|
||||
}
|
||||
@@ -193,4 +196,4 @@ abstract class Summary_report extends Report
|
||||
|
||||
return $builder->get()->getRowArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@ class Summary_sales_taxes extends Summary_report
|
||||
|
||||
protected function _where(array $inputs, object &$builder): void //TODO: hungarian notation
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$builder->where('sales.sale_status', COMPLETED);
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Duplicated code
|
||||
if(empty($config['date_or_time_format'])) //TODO: Duplicated code
|
||||
{
|
||||
$builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']));
|
||||
}
|
||||
@@ -31,9 +33,11 @@ class Summary_sales_taxes extends Summary_report
|
||||
|
||||
public function getData(array $inputs): array
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$where = 'WHERE sale_status = ' . COMPLETED . ' ';
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$where .= 'AND DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date'])
|
||||
. ' AND ' . $this->db->escape($inputs['end_date']);
|
||||
@@ -55,4 +59,4 @@ class Summary_sales_taxes extends Summary_report
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class Summary_taxes extends Summary_report
|
||||
protected function _get_data_columns(): array //TODO: hungarian notation
|
||||
{
|
||||
return [
|
||||
['tax_name' => $this->lang->line('Reports.tax_name'), 'sortable' => FALSE],
|
||||
['tax_name' => lang('Reports.tax_name'), 'sortable' => FALSE],
|
||||
['tax_percent' => lang('Reports.tax_percent'), 'sorter' => 'number_sorter'],
|
||||
['report_count' => lang('Reports.sales'), 'sorter' => 'number_sorter'],
|
||||
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],
|
||||
@@ -18,9 +18,11 @@ class Summary_taxes extends Summary_report
|
||||
|
||||
protected function _where(array $inputs, &$builder): void //TODO: hungarian notation
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$builder->where('sales.sale_status', COMPLETED);
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']));
|
||||
}
|
||||
@@ -32,9 +34,11 @@ class Summary_taxes extends Summary_report
|
||||
|
||||
public function getData(array $inputs): array
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
$where = 'WHERE sale_status = ' . COMPLETED . ' '; //TODO: Duplicated code
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: Ternary notation
|
||||
if(empty($config['date_or_time_format'])) //TODO: Ternary notation
|
||||
{
|
||||
$where .= 'AND DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
|
||||
}
|
||||
@@ -44,7 +48,7 @@ class Summary_taxes extends Summary_report
|
||||
}
|
||||
$decimals = totals_decimals();
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($config['tax_included'])
|
||||
{
|
||||
$sale_total = '(CASE WHEN sales_items.discount_type = ' . PERCENT
|
||||
. " THEN sales_items.quantity_purchased * sales_items.item_unit_price - ROUND(sales_items.quantity_purchased * sales_items.item_unit_price * sales_items.discount / 100, $decimals)"
|
||||
|
||||
@@ -10,6 +10,16 @@ use CodeIgniter\Model;
|
||||
|
||||
class Rewards extends Model //TODO: This class is named with plural while the general practice is to name models singular
|
||||
{
|
||||
protected $table = 'sales_reward_points';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'sale_id',
|
||||
'earned',
|
||||
'used'
|
||||
];
|
||||
|
||||
/**
|
||||
* Inserts or updates a rewards
|
||||
*/
|
||||
@@ -32,4 +42,4 @@ class Rewards extends Model //TODO: This class is named with plural while the ge
|
||||
|
||||
return $builder->update($rewards_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,28 @@ use ReflectionException;
|
||||
*/
|
||||
class Sale extends Model
|
||||
{
|
||||
protected $table = 'sales';
|
||||
protected $primaryKey = 'sale_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'sale_time',
|
||||
'customer_id',
|
||||
'employee_id',
|
||||
'comment',
|
||||
'quote_number',
|
||||
'sale_status',
|
||||
'invoice_number',
|
||||
'dinner_table_id',
|
||||
'work_order_number',
|
||||
'sale_type'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->sale_lib = new Sale_lib();
|
||||
// $this->sale_lib = new Sale_lib(); //TODO: This is causing an infinite loop because the sale lib is invoking the sale model and the model invokes the sale_lib
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,6 +54,7 @@ class Sale extends Model
|
||||
*/
|
||||
public function get_info(int $sale_id): ResultInterface
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$this->create_temp_table (['sale_id' => $sale_id]);
|
||||
|
||||
$decimals = totals_decimals();
|
||||
@@ -46,7 +64,7 @@ class Sale extends Model
|
||||
. " THEN sales_items.quantity_purchased * sales_items.item_unit_price - ROUND(sales_items.quantity_purchased * sales_items.item_unit_price * sales_items.discount / 100, $decimals) "
|
||||
. 'ELSE sales_items.quantity_purchased * (sales_items.item_unit_price - sales_items.discount) END';
|
||||
|
||||
if(config('OSPOS')->settings['tax_included']) //TODO: This needs to be replaced with Ternary notation
|
||||
if($config['tax_included']) //TODO: This needs to be replaced with Ternary notation
|
||||
{
|
||||
$sale_total = "ROUND(SUM($sale_price), $decimals) + $cash_adjustment";
|
||||
}
|
||||
@@ -110,10 +128,12 @@ class Sale extends Model
|
||||
*/
|
||||
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
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// Pick up only non-suspended records
|
||||
$where = 'sales.sale_status = 0 AND ';
|
||||
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format']))
|
||||
if(empty($config['date_or_time_format']))
|
||||
{
|
||||
$where .= 'DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']);
|
||||
}
|
||||
@@ -178,7 +198,7 @@ class Sale extends Model
|
||||
$builder = $this->db->table('sales_items AS sales_items');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(DISTINCT sales.sale_id) AS count');
|
||||
}
|
||||
@@ -219,7 +239,7 @@ class Sale extends Model
|
||||
|
||||
if(!empty($search)) //TODO: this is duplicated code. We should think about refactoring out a method
|
||||
{
|
||||
if($filters['is_valid_receipt'] != FALSE)
|
||||
if($filters['is_valid_receipt'])
|
||||
{
|
||||
$pieces = explode(' ', $search);
|
||||
$builder->where('sales.sale_id', $pieces[1]);
|
||||
@@ -245,12 +265,12 @@ class Sale extends Model
|
||||
}
|
||||
|
||||
//TODO: Avoid double negatives. This can be changed to `if($filters['only_invoices'])`... also below
|
||||
if($filters['only_invoices'] != FALSE)
|
||||
if($filters['only_invoices'])
|
||||
{
|
||||
$builder->where('sales.invoice_number IS NOT NULL');
|
||||
}
|
||||
|
||||
if($filters['only_cash'] != FALSE)
|
||||
if($filters['only_cash'])
|
||||
{
|
||||
$builder->groupStart();
|
||||
$builder->like('payments.payment_type', lang('Sales.cash'));
|
||||
@@ -258,23 +278,23 @@ class Sale extends Model
|
||||
$builder->groupEnd();
|
||||
}
|
||||
|
||||
if($filters['only_creditcard'] != FALSE)
|
||||
if($filters['only_creditcard'])
|
||||
{
|
||||
$builder->like('payments.payment_type', lang('Sales.credit'));
|
||||
}
|
||||
|
||||
if($filters['only_due'] != FALSE)
|
||||
if($filters['only_due'])
|
||||
{
|
||||
$builder->like('payments.payment_type', lang('Sales.due'));
|
||||
}
|
||||
|
||||
if($filters['only_check'] != FALSE)
|
||||
if($filters['only_check'])
|
||||
{
|
||||
$builder->like('payments.payment_type', lang('Sales.check'));
|
||||
}
|
||||
|
||||
//get_found_rows
|
||||
if($count_only == TRUE) //TODO: replace this with `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -297,6 +317,8 @@ class Sale extends Model
|
||||
*/
|
||||
public function get_payments_summary(string $search, array $filters): array
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// get payment summary
|
||||
$builder = $this->db->table('sales AS sales');
|
||||
$builder->select('payment_type, COUNT(payment_amount) AS count, SUM(payment_amount - cash_refund) AS payment_amount');
|
||||
@@ -305,7 +327,7 @@ class Sale extends Model
|
||||
$builder->join('customers AS customer', 'sales.customer_id = customer.person_id', 'LEFT');
|
||||
|
||||
//TODO: This needs to be replaced with Ternary notation
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: duplicated code. We should think about refactoring out a method.
|
||||
if(empty($config['date_or_time_format'])) //TODO: duplicated code. We should think about refactoring out a method.
|
||||
{
|
||||
$builder->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
@@ -316,7 +338,7 @@ class Sale extends Model
|
||||
|
||||
if(!empty($search)) //TODO: duplicated code. We should think about refactoring out a method.
|
||||
{
|
||||
if($filters['is_valid_receipt'] != FALSE)//TODO: Avoid double negatives
|
||||
if($filters['is_valid_receipt'])
|
||||
{
|
||||
$pieces = explode(' ',$search);
|
||||
$builder->where('sales.sale_id', $pieces[1]);
|
||||
@@ -351,27 +373,27 @@ class Sale extends Model
|
||||
}
|
||||
|
||||
//TODO: Avoid the double negatives
|
||||
if($filters['only_invoices'] != FALSE)
|
||||
if($filters['only_invoices'])
|
||||
{
|
||||
$builder->where('invoice_number IS NOT NULL');
|
||||
}
|
||||
|
||||
if($filters['only_cash'] != FALSE)
|
||||
if($filters['only_cash'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Sales.cash'));
|
||||
}
|
||||
|
||||
if($filters['only_due'] != FALSE)
|
||||
if($filters['only_due'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Sales.due'));
|
||||
}
|
||||
|
||||
if($filters['only_check'] != FALSE)
|
||||
if($filters['only_check'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Sales.check'));
|
||||
}
|
||||
|
||||
if($filters['only_creditcard'] != FALSE)
|
||||
if($filters['only_creditcard'])
|
||||
{
|
||||
$builder->like('payment_type', lang('Sales.credit'));
|
||||
}
|
||||
@@ -386,7 +408,7 @@ class Sale extends Model
|
||||
|
||||
foreach($payments as $key => $payment)
|
||||
{
|
||||
if(strstr($payment['payment_type'], lang('Sales.giftcard')) != FALSE)
|
||||
if(strstr($payment['payment_type'], lang('Sales.giftcard')))
|
||||
{
|
||||
$gift_card_count += $payment['count'];
|
||||
$gift_card_amount += $payment['payment_amount'];
|
||||
@@ -498,6 +520,8 @@ class Sale extends Model
|
||||
*/
|
||||
public function is_valid_receipt(string &$receipt_sale_id): bool //TODO: like the others, maybe this should be an array rather than a delimited string... either that or the parameter name needs to be changed. $receipt_sale_id implies that it's an int.
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(!empty($receipt_sale_id))
|
||||
{
|
||||
//POS #
|
||||
@@ -507,7 +531,7 @@ class Sale extends Model
|
||||
{
|
||||
return $this->exists($pieces[1]);
|
||||
}
|
||||
elseif(config('OSPOS')->settings['invoice_enable'])
|
||||
elseif($config['invoice_enable'])
|
||||
{
|
||||
$sale_info = $this->get_sale_by_invoice_number($receipt_sale_id);
|
||||
|
||||
@@ -537,14 +561,14 @@ class Sale extends Model
|
||||
/**
|
||||
* Update sale
|
||||
*/
|
||||
public function update($sale_id = NULL, array $sale_data = NULL, array $payments = NULL): bool
|
||||
public function update($sale_id = NULL, $sale_data = NULL): bool
|
||||
{
|
||||
$builder = $this->db->table('sales');
|
||||
$builder->where('sale_id', $sale_id);
|
||||
$success = $builder->update($sale_data);
|
||||
|
||||
//touch payment only if update sale is successful and there is a payments object otherwise the result would be to delete all the payments associated to the sale
|
||||
if($success && !empty($payments))
|
||||
if($success && !empty($sale_data['payments']))
|
||||
{
|
||||
//Run these queries as a transaction, we want to make sure we do all or nothing
|
||||
$this->db->transStart();
|
||||
@@ -552,7 +576,7 @@ class Sale extends Model
|
||||
$builder = $this->db->table('sales_payments');
|
||||
|
||||
// add new payments
|
||||
foreach($payments as $payment)
|
||||
foreach($sale_data['payments'] as $payment)
|
||||
{
|
||||
$payment_id = $payment['payment_id'];
|
||||
$payment_type = $payment['payment_type'];
|
||||
@@ -612,6 +636,7 @@ class Sale extends Model
|
||||
public function save_value(int $sale_id, string &$sale_status, array &$items, int $customer_id, int $employee_id, string $comment, string $invoice_number,
|
||||
string $work_order_number, string $quote_number, int $sale_type, array $payments, int $dinner_table_id, array &$sales_taxes): int //TODO: this method returns the sale_id but the override is expecting it to return a bool. The signature needs to be reworked. Generally when there are more than 3 maybe 4 parameters, there's a good chance that an object needs to be passed rather than so many params.
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$attribute = model(Attribute::class);
|
||||
$customer = model(Customer::class);
|
||||
$giftcard = model(Giftcard::class);
|
||||
@@ -769,7 +794,7 @@ class Sale extends Model
|
||||
$this->save_sales_items_taxes($sale_id, $sales_taxes[1]);
|
||||
}
|
||||
|
||||
if(config('OSPOS')->settings['dinner_table_enable'])
|
||||
if($config['dinner_table_enable'])
|
||||
{
|
||||
$dinner_table = model(Dinner_table::class);
|
||||
if($sale_status == COMPLETED) //TODO: === ?
|
||||
@@ -966,7 +991,9 @@ class Sale extends Model
|
||||
*/
|
||||
public function get_sale_items_ordered(int $sale_id): ResultInterface
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
$item = model(Item::class);
|
||||
|
||||
$builder = $this->db->table('sales_items AS sales_items');
|
||||
$builder->select('
|
||||
sales_items.sale_id,
|
||||
@@ -989,12 +1016,12 @@ class Sale extends Model
|
||||
$builder->where('sales_items.sale_id', $sale_id);
|
||||
|
||||
// Entry sequence (this will render kits in the expected sequence)
|
||||
if(config('OSPOS')->settings['line_sequence'] == '0') //TODO: Replace these with constants and this should be converted to a switch.
|
||||
if($config['line_sequence'] == '0') //TODO: Replace these with constants and this should be converted to a switch.
|
||||
{
|
||||
$builder->orderBy('line', 'asc');
|
||||
}
|
||||
// Group by Stock Type (nonstock first - type 1, stock next - type 0)
|
||||
elseif(config('OSPOS')->settings['line_sequence'] == '1')
|
||||
elseif($config['line_sequence'] == '1')
|
||||
{
|
||||
$builder->orderBy('stock_type', 'desc');
|
||||
$builder->orderBy('sales_items.description', 'asc');
|
||||
@@ -1002,7 +1029,7 @@ class Sale extends Model
|
||||
$builder->orderBy('items.qty_per_pack', 'asc');
|
||||
}
|
||||
// Group by Item Category
|
||||
elseif(config('OSPOS')->settings['line_sequence'] == '2')
|
||||
elseif($config['line_sequence'] == '2')
|
||||
{
|
||||
$builder->orderBy('category', 'asc');
|
||||
$builder->orderBy('sales_items.description', 'asc');
|
||||
@@ -1032,16 +1059,16 @@ class Sale extends Model
|
||||
/**
|
||||
* Gets sale payment options
|
||||
*/
|
||||
public function get_payment_options(bool $giftcard = TRUE, bool $reward_points = FALSE): array
|
||||
public function get_payment_options(bool $giftcard = true, bool $reward_points = true): array
|
||||
{
|
||||
$payments = get_payment_options();
|
||||
|
||||
if($giftcard == TRUE)
|
||||
if($giftcard)
|
||||
{
|
||||
$payments[lang('Sales.giftcard')] = lang('Sales.giftcard');
|
||||
}
|
||||
|
||||
if($reward_points == TRUE)
|
||||
if($reward_points)
|
||||
{
|
||||
$payments[lang('Sales.rewards')] = lang('Sales.rewards');
|
||||
}
|
||||
@@ -1104,7 +1131,7 @@ class Sale extends Model
|
||||
{
|
||||
$builder = $this->db->table('sales');
|
||||
$builder->where('invoice_number', $invoice_number);
|
||||
|
||||
|
||||
if(!empty($sale_id))
|
||||
{
|
||||
$builder->where('sale_id !=', $sale_id);
|
||||
@@ -1152,9 +1179,11 @@ class Sale extends Model
|
||||
*/
|
||||
public function create_temp_table(array $inputs): void
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(empty($inputs['sale_id']))
|
||||
{
|
||||
if(empty(config('OSPOS')->settings['date_or_time_format'])) //TODO: This needs to be replaced with Ternary notation
|
||||
if(empty($config['date_or_time_format'])) //TODO: This needs to be replaced with Ternary notation
|
||||
{
|
||||
$where = 'DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
|
||||
}
|
||||
@@ -1182,7 +1211,7 @@ class Sale extends Model
|
||||
|
||||
$cash_adjustment = 'IFNULL(SUM(payments.sale_cash_adjustment), 0)';
|
||||
|
||||
if(config('OSPOS')->settings['tax_included'])
|
||||
if($config['tax_included'])
|
||||
{
|
||||
$sale_total = "ROUND(SUM($sale_price), $decimals) + $cash_adjustment";
|
||||
$sale_subtotal = "$sale_total - $internal_tax";
|
||||
@@ -1211,7 +1240,7 @@ class Sale extends Model
|
||||
WHERE ' . $where . '
|
||||
GROUP BY sale_id, item_id, line
|
||||
)';
|
||||
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
// create a temporary table to contain all the payment types and amount
|
||||
@@ -1229,7 +1258,7 @@ class Sale extends Model
|
||||
WHERE ' . $where . '
|
||||
GROUP BY payments.sale_id
|
||||
)';
|
||||
|
||||
|
||||
$this->db->query($sql);
|
||||
$item = model(Item::class);
|
||||
$sql = 'CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->prefixTable('sales_items_temp') .
|
||||
@@ -1296,7 +1325,7 @@ class Sale extends Model
|
||||
WHERE ' . $where . '
|
||||
GROUP BY sale_id, item_id, line
|
||||
)';
|
||||
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
@@ -1360,7 +1389,7 @@ class Sale extends Model
|
||||
public function update_sale_status(int $sale_id, int $sale_status): void
|
||||
{
|
||||
$builder = $this->db->table('sales');
|
||||
|
||||
|
||||
$builder->where('sale_id', $sale_id);
|
||||
$builder->update(['sale_status' => $sale_status]);
|
||||
}
|
||||
@@ -1439,8 +1468,9 @@ class Sale extends Model
|
||||
{
|
||||
//Run these queries as a transaction, we want to make sure we do all or nothing
|
||||
$this->db->transStart();
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(config('OSPOS')->settings['dinner_table_enable'])
|
||||
if($config['dinner_table_enable'])
|
||||
{
|
||||
$dinner_table = model(Dinner_table::class);
|
||||
$dinner_table_id = $this->get_dinner_table($sale_id);
|
||||
@@ -1461,8 +1491,9 @@ class Sale extends Model
|
||||
public function clear_suspended_sale_detail(int $sale_id): bool
|
||||
{
|
||||
$this->db->transStart();
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(config('OSPOS')->settings['dinner_table_enable'])
|
||||
if($config['dinner_table_enable'])
|
||||
{
|
||||
$dinner_table = model(Dinner_table::class);
|
||||
$dinner_table_id = $this->get_dinner_table($sale_id);
|
||||
@@ -1507,7 +1538,9 @@ class Sale extends Model
|
||||
*/
|
||||
private function save_customer_rewards(int $customer_id, int $sale_id, float $total_amount, float $total_amount_used): void
|
||||
{
|
||||
if(!empty($customer_id) && config('OSPOS')->settings['customer_reward_enable'])
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
if(!empty($customer_id) && $config['customer_reward_enable'])
|
||||
{
|
||||
$customer = model(Customer::class);
|
||||
$customer_rewards = model(Customer_rewards::class);
|
||||
|
||||
@@ -16,6 +16,15 @@ use CodeIgniter\Session\Session;
|
||||
*/
|
||||
class Stock_location extends Model
|
||||
{
|
||||
protected $table = 'stock_locations';
|
||||
protected $primaryKey = 'location_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'location_name',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -207,7 +216,7 @@ class Stock_location extends Model
|
||||
* @param bool $purge
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(int $location_id = null, bool $purge = FALSE): bool
|
||||
public function delete($location_id = null, bool $purge = FALSE): bool
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
@@ -222,4 +231,4 @@ class Stock_location extends Model
|
||||
|
||||
return $this->db->transStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,28 @@ use CodeIgniter\Database\ResultInterface;
|
||||
*/
|
||||
class Supplier extends Person
|
||||
{
|
||||
protected $table = 'suppliers';
|
||||
protected $primaryKey = 'person_id';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'company_name',
|
||||
'account_number',
|
||||
'tax_id',
|
||||
'deleted',
|
||||
'agency_name',
|
||||
'category'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given person_id is a customer
|
||||
*/
|
||||
public function exists(int $person_id): bool
|
||||
{
|
||||
$builder = $this->db->table('suppliers');
|
||||
$builder = $this->db->table('suppliers');
|
||||
$builder->join('people', 'people.person_id = suppliers.person_id');
|
||||
$builder->where('suppliers.person_id', $person_id);
|
||||
|
||||
|
||||
return ($builder->get()->getNumRows() == 1); //TODO: ===
|
||||
}
|
||||
|
||||
@@ -31,7 +44,7 @@ class Supplier extends Person
|
||||
|
||||
return $builder->countAllResults();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all the suppliers
|
||||
*/
|
||||
@@ -50,17 +63,17 @@ class Supplier extends Person
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets information about a particular supplier
|
||||
*/
|
||||
public function get_info(int $person_id): object
|
||||
{
|
||||
$builder = $this->db->table('suppliers');
|
||||
$builder = $this->db->table('suppliers');
|
||||
$builder->join('people', 'people.person_id = suppliers.person_id');
|
||||
$builder->where('suppliers.person_id', $person_id);
|
||||
$query = $builder->get();
|
||||
|
||||
|
||||
if($query->getNumRows() == 1) //TODO: ===
|
||||
{
|
||||
return $query->getRow();
|
||||
@@ -69,18 +82,18 @@ class Supplier extends Person
|
||||
{
|
||||
//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
|
||||
|
||||
//Get all the fields from supplier table
|
||||
|
||||
//Get all the fields from supplier table
|
||||
//append those fields to base parent object, we have a complete empty object
|
||||
foreach($this->db->getFieldNames('suppliers') as $field)
|
||||
{
|
||||
$person_obj->$field = '';
|
||||
}
|
||||
|
||||
|
||||
return $person_obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets information about multiple suppliers
|
||||
*/
|
||||
@@ -93,7 +106,7 @@ class Supplier extends Person
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts or updates a suppliers
|
||||
*/
|
||||
@@ -103,7 +116,7 @@ class Supplier extends Person
|
||||
|
||||
//Run these queries as a transaction, we want to make sure we do all or nothing
|
||||
$this->db->transStart();
|
||||
|
||||
|
||||
if(parent::save_value($person_data,$supplier_id))
|
||||
{
|
||||
$builder = $this->db->table('suppliers');
|
||||
@@ -118,25 +131,25 @@ class Supplier extends Person
|
||||
$success = $builder->update($supplier_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
|
||||
$success &= $this->db->transStatus();
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes one supplier
|
||||
*/
|
||||
public function delete(int $supplier_id = null, bool $purge = false): bool
|
||||
public function delete($supplier_id = null, bool $purge = false): bool
|
||||
{
|
||||
$builder = $this->db->table('suppliers');
|
||||
$builder->where('person_id', $supplier_id);
|
||||
|
||||
return $builder->update(['deleted' => 1]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a list of suppliers
|
||||
*/
|
||||
@@ -147,7 +160,7 @@ class Supplier extends Person
|
||||
|
||||
return $builder->update(['deleted' => 1]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get search suggestions to find suppliers
|
||||
*/
|
||||
@@ -183,7 +196,7 @@ class Supplier extends Person
|
||||
$builder->join('people', 'suppliers.person_id = people.person_id');
|
||||
$builder->groupStart();
|
||||
$builder->like('first_name', $search);
|
||||
$builder->orLike('last_name', $search);
|
||||
$builder->orLike('last_name', $search);
|
||||
$builder->orLike('CONCAT(first_name, " ", last_name)', $search);
|
||||
$builder->groupEnd();
|
||||
$builder->where('deleted', 0);
|
||||
@@ -246,7 +259,7 @@ class Supplier extends Person
|
||||
{
|
||||
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform a search on suppliers
|
||||
*/
|
||||
@@ -255,7 +268,7 @@ class Supplier extends Person
|
||||
$builder = $this->db->table('suppliers AS suppliers');
|
||||
|
||||
//get_found_rows case
|
||||
if($count_only == TRUE) //TODO: This needs to be replaced with `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(suppliers.person_id) as count');
|
||||
}
|
||||
@@ -272,8 +285,8 @@ class Supplier extends Person
|
||||
$builder->orLike('CONCAT(first_name, " ", last_name)', $search); //TODO: According to PHPStorm, this line down to the return is repeated in Customer.php and Employee.php... perhaps refactoring a method in a library could be helpful?
|
||||
$builder->groupEnd();
|
||||
$builder->where('deleted', 0);
|
||||
|
||||
if($count_only == TRUE) //TODO: This needs to be replaced with `if($count_only)`
|
||||
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -308,4 +321,4 @@ class Supplier extends Person
|
||||
{
|
||||
return lang("Suppliers.$supplier_type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,18 @@ use stdClass;
|
||||
*/
|
||||
class Tax extends Model
|
||||
{
|
||||
protected $table = 'tax_rates';
|
||||
protected $primaryKey = 'tax_rate_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'rate_tax_code_id',
|
||||
'rate_tax_category_id',
|
||||
'rate_jurisdiction_id',
|
||||
'tax_rate',
|
||||
'tax_rounding_code'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if a given row is on file
|
||||
*/
|
||||
@@ -179,7 +191,7 @@ class Tax extends Model
|
||||
/**
|
||||
* Deletes a single tax rate entry
|
||||
*/
|
||||
public function delete(int $tax_rate_id = null, bool $purge = false): bool
|
||||
public function delete($tax_rate_id = null, bool $purge = false)
|
||||
{
|
||||
$builder = $this->db->table('tax_rates');
|
||||
|
||||
@@ -213,7 +225,7 @@ class Tax extends Model
|
||||
$builder = $this->db->table('tax_rates');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(tax_rate_id) as count');
|
||||
} else
|
||||
@@ -241,7 +253,7 @@ class Tax extends Model
|
||||
}
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -292,4 +304,4 @@ class Tax extends Model
|
||||
|
||||
return $builder->get()->getRow()->tax_category_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,16 @@ use stdClass;
|
||||
|
||||
class Tax_category extends Model
|
||||
{
|
||||
protected $table = 'tax_categories';
|
||||
protected $primaryKey = 'tax_category_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'tax_category',
|
||||
'tax_group_sequence',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if it exists in the table
|
||||
*/
|
||||
@@ -68,7 +78,7 @@ class Tax_category extends Model
|
||||
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = TRUE): ResultInterface //TODO: $no_deleted needs a new name. $not_deleted is the correct grammar, but it's a bit confusing by naming the variable a negative. Probably better to name it is_deleted and flip the logic
|
||||
{
|
||||
$builder = $this->db->table('tax_categories');
|
||||
if($no_deleted == TRUE)
|
||||
if($no_deleted)
|
||||
{
|
||||
$builder->where('deleted', 0);
|
||||
}
|
||||
@@ -203,7 +213,7 @@ class Tax_category extends Model
|
||||
$builder = $this->db->table('tax_categories AS tax_categories');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: This should probably be === since $count_only is a bool
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(tax_categories.tax_category_id) as count');
|
||||
}
|
||||
@@ -212,7 +222,7 @@ class Tax_category extends Model
|
||||
$builder->where('deleted', 0);
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: This should probably be === since $count_only is a bool
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -260,4 +270,4 @@ class Tax_category extends Model
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,18 @@ use stdClass;
|
||||
*/
|
||||
class Tax_code extends Model
|
||||
{
|
||||
protected $table = 'tax_codes';
|
||||
protected $primaryKey = 'tax_code_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'tax_code',
|
||||
'tax_code_name',
|
||||
'city',
|
||||
'state',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if it exists in the table
|
||||
*/
|
||||
@@ -65,10 +77,10 @@ class Tax_code extends Model
|
||||
/**
|
||||
* Returns all rows from the table
|
||||
*/
|
||||
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = TRUE): ResultInterface //TODO: $no_deleted should be something like $is_deleted and flip the logic.
|
||||
public function get_all(int $rows = 0, int $limit_from = 0, bool $no_deleted = true): ResultInterface //TODO: $no_deleted should be something like $is_deleted and flip the logic.
|
||||
{
|
||||
$builder = $this->db->table('tax_codes');
|
||||
if($no_deleted == TRUE)
|
||||
if($no_deleted)
|
||||
{
|
||||
$builder->where('deleted', 0);
|
||||
}
|
||||
@@ -157,7 +169,7 @@ class Tax_code extends Model
|
||||
/**
|
||||
* Deletes a specific tax code
|
||||
*/
|
||||
public function delete(string $tax_code = null, bool $purge = false): bool
|
||||
public function delete($tax_code = null, bool $purge = false)
|
||||
{
|
||||
$builder = $this->db->table('tax_codes');
|
||||
$builder->where('tax_code', $tax_code);
|
||||
@@ -192,7 +204,7 @@ class Tax_code extends Model
|
||||
$builder = $this->db->table('tax_codes AS tax_codes');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(tax_codes.tax_code) as count');
|
||||
}
|
||||
@@ -204,7 +216,7 @@ class Tax_code extends Model
|
||||
$builder->where('deleted', 0);
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -224,6 +236,8 @@ class Tax_code extends Model
|
||||
*/
|
||||
public function get_sales_tax_code(string $city = '', string $state = '')
|
||||
{
|
||||
$config = config('OSPOS')->settings;
|
||||
|
||||
// if tax code using both city and state cannot be found then try again using just the state
|
||||
// if the state tax code cannot be found then try again using blanks for both
|
||||
$builder = $this->db->table('tax_codes');
|
||||
@@ -252,7 +266,7 @@ class Tax_code extends Model
|
||||
}
|
||||
else
|
||||
{
|
||||
return config('OSPOS')->settings['default_tax_code'];
|
||||
return $config['default_tax_code'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,4 +312,4 @@ class Tax_code extends Model
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,20 @@ use stdClass;
|
||||
|
||||
class Tax_jurisdiction extends Model
|
||||
{
|
||||
protected $table = 'tax_jurisdictions';
|
||||
protected $primaryKey = 'cashup_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $allowedFields = [
|
||||
'jurisdiction_name',
|
||||
'tax_group',
|
||||
'tax_type',
|
||||
'reporting_authority',
|
||||
'tax_group_sequence',
|
||||
'cascade_sequence',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines if it exists in the table
|
||||
*/
|
||||
@@ -69,7 +83,7 @@ class Tax_jurisdiction extends Model
|
||||
{
|
||||
$builder = $this->db->table('tax_jurisdictions');
|
||||
|
||||
if($no_deleted == TRUE)
|
||||
if($no_deleted)
|
||||
{
|
||||
$builder->where('deleted', 0);
|
||||
}
|
||||
@@ -169,7 +183,7 @@ class Tax_jurisdiction extends Model
|
||||
/**
|
||||
* Soft deletes a specific tax jurisdiction
|
||||
*/
|
||||
public function delete(int $jurisdiction_id = null, bool $purge = false): bool
|
||||
public function delete($jurisdiction_id = null, bool $purge = false)
|
||||
{
|
||||
$builder = $this->db->table('tax_jurisdictions');
|
||||
$builder->where('jurisdiction_id', $jurisdiction_id);
|
||||
@@ -204,7 +218,7 @@ class Tax_jurisdiction extends Model
|
||||
$builder = $this->db->table('tax_jurisdictions AS tax_jurisdictions');
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: Replace this with just count_only: `if($count_only)`
|
||||
if($count_only)
|
||||
{
|
||||
$builder->select('COUNT(tax_jurisdictions.jurisdiction_id) as count');
|
||||
}
|
||||
@@ -216,7 +230,7 @@ class Tax_jurisdiction extends Model
|
||||
$builder->where('deleted', 0);
|
||||
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE) //TODO: ===
|
||||
if($count_only)
|
||||
{
|
||||
return $builder->get()->getRow()->count;
|
||||
}
|
||||
@@ -246,4 +260,4 @@ class Tax_jurisdiction extends Model
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use CodeIgniter\Model;
|
||||
*/
|
||||
abstract class Token Extends Model
|
||||
{
|
||||
protected $value = '';
|
||||
protected string $value = '';
|
||||
|
||||
public function __construct(string $value = '')
|
||||
{
|
||||
@@ -60,4 +60,4 @@ abstract class Token Extends Model
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use App\Models\Customer;
|
||||
*/
|
||||
class Token_customer extends Token
|
||||
{
|
||||
private $customer_info;
|
||||
private string $customer_info;
|
||||
|
||||
public function __construct(string $customer_info = '')
|
||||
{
|
||||
@@ -47,4 +47,4 @@ class Token_customer extends Token
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
<?php echo view('partial/datepicker_locale', ['config' => '{ minView: 2, format: "'.dateformat_bootstrap(config('OSPOS')->settings['dateformat'] . '"}')]) ?>
|
||||
<?php echo view('partial/datepicker_locale', ['config' => '{ minView: 2, format: "'.dateformat_bootstrap($config['dateformat'] . '"}')]) ?>
|
||||
|
||||
var enable_delete = function() {
|
||||
$('.remove_attribute_btn').click(function() {
|
||||
@@ -134,4 +134,4 @@ foreach($definition_values as $definition_id => $definition_value)
|
||||
refresh();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers, 'js') ?>,
|
||||
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'definition_id'
|
||||
});
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'open_amount_cash',
|
||||
@@ -52,7 +52,7 @@
|
||||
'value' => to_currency_no_money($cash_ups_info->open_amount_cash)
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'transfer_amount_cash',
|
||||
@@ -73,7 +73,7 @@
|
||||
])
|
||||
?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -106,7 +106,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'closed_amount_cash',
|
||||
@@ -115,7 +115,7 @@
|
||||
'value'=>to_currency_no_money($cash_ups_info->closed_amount_cash)]
|
||||
) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'closed_amount_due',
|
||||
@@ -147,7 +147,7 @@
|
||||
'value'=>to_currency_no_money($cash_ups_info->closed_amount_due)]
|
||||
) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +158,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'closed_amount_card',
|
||||
@@ -167,7 +167,7 @@
|
||||
'value'=>to_currency_no_money($cash_ups_info->closed_amount_card)]
|
||||
) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -178,7 +178,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'closed_amount_check',
|
||||
@@ -187,7 +187,7 @@
|
||||
'value'=>to_currency_no_money($cash_ups_info->closed_amount_check)]
|
||||
) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -198,7 +198,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'closed_amount_total',
|
||||
@@ -209,7 +209,7 @@
|
||||
]
|
||||
) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -256,12 +256,12 @@ $(document).ready(function()
|
||||
<?php echo view('partial/datepicker_locale') ?>
|
||||
|
||||
$('#open_date').datetimepicker({
|
||||
format: "<?php echo dateformat_bootstrap(config('OSPOS')->settings['dateformat']) . ' ' . dateformat_bootstrap(config('OSPOS')->settings['timeformat']) ?>",
|
||||
startDate: "<?php echo date(config('OSPOS')->settings['dateformat'] . ' ' . esc(config('OSPOS')->settings['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
|
||||
format: "<?php echo dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat']) ?>",
|
||||
startDate: "<?php echo date($config['dateformat'] . ' ' . esc($config['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
|
||||
<?php
|
||||
$t = config('OSPOS')->settings['timeformat'];
|
||||
$t = $config['timeformat'];
|
||||
$m = $t[strlen($t)-1];
|
||||
if( strpos(config('OSPOS')->settings['timeformat'], 'a') !== false || strpos(config('OSPOS')->settings['timeformat'], 'A') !== false )
|
||||
if( strpos($config['timeformat'], 'a') !== false || strpos($config['timeformat'], 'A') !== false )
|
||||
{
|
||||
?>
|
||||
showMeridian: true,
|
||||
@@ -283,12 +283,12 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
$('#close_date').datetimepicker({
|
||||
format: "<?php echo dateformat_bootstrap(config('OSPOS')->settings['dateformat']) . ' ' . dateformat_bootstrap(config('OSPOS')->settings['timeformat']) ?>",
|
||||
startDate: "<?php echo date(config('OSPOS')->settings['dateformat'] . ' ' . esc(config('OSPOS')->settings['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
|
||||
format: "<?php echo dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat']) ?>",
|
||||
startDate: "<?php echo date($config['dateformat'] . ' ' . esc($config['timeformat'], 'js'), mktime(0, 0, 0, 1, 1, 2010)) ?>",
|
||||
<?php
|
||||
$t = config('OSPOS')->settings['timeformat'];
|
||||
$t = $config['timeformat'];
|
||||
$m = $t[strlen($t)-1];
|
||||
if( strpos(config('OSPOS')->settings['timeformat'], 'a') !== false || strpos(config('OSPOS')->settings['timeformat'], 'A') !== false )
|
||||
if( strpos($config['timeformat'], 'a') !== false || strpos($config['timeformat'], 'A') !== false )
|
||||
{
|
||||
?>
|
||||
showMeridian: true,
|
||||
|
||||
@@ -27,7 +27,7 @@ $(document).ready(function()
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers, 'js') ?>,
|
||||
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'cashup_id',
|
||||
queryParams: function() {
|
||||
return $.extend(arguments[0], {
|
||||
|
||||
@@ -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('OSPOS')->settings['barcode_type'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('barcode_type', esc($support_barcode, 'attr'), esc($config['barcode_type'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
'name' => 'barcode_width',
|
||||
'id' => 'barcode_width',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['barcode_width']
|
||||
'value' => $config['barcode_width']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,7 +42,7 @@
|
||||
'name' => 'barcode_height',
|
||||
'id' => 'barcode_height',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=>config('OSPOS')->settings['barcode_height']
|
||||
'value'=>$config['barcode_height']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,7 +53,7 @@
|
||||
<?php echo form_dropdown(
|
||||
'barcode_font',
|
||||
esc($this->barcode_lib->listfonts('fonts'), 'attr'),
|
||||
esc(config('OSPOS')->settings['barcode_font'], 'attr'),
|
||||
esc($config['barcode_font'], 'attr'),
|
||||
['class' => 'form-control input-sm required']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -65,7 +65,7 @@
|
||||
'name' => 'barcode_font_size',
|
||||
'id' => 'barcode_font_size',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['barcode_font_size']
|
||||
'value' => $config['barcode_font_size']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,7 +77,7 @@
|
||||
'name' => 'allow_duplicate_barcodes',
|
||||
'id' => 'allow_duplicate_barcodes',
|
||||
'value' => 'allow_duplicate_barcodes',
|
||||
'checked' => config('OSPOS')->settings['allow_duplicate_barcodes']
|
||||
'checked' => $config['allow_duplicate_barcodes']
|
||||
]) ?>
|
||||
 
|
||||
<label class="control-label">
|
||||
@@ -93,7 +93,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'barcode_content',
|
||||
'value' => 'id',
|
||||
'checked' => config('OSPOS')->settings['barcode_content' === 'id']
|
||||
'checked' => $config['barcode_content' === 'id']
|
||||
]) ?>
|
||||
<?php echo lang('Config.barcode_id') ?>
|
||||
</label>
|
||||
@@ -101,7 +101,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'barcode_content',
|
||||
'value' => 'number',
|
||||
'checked' => config('OSPOS')->settings['barcode_content'] === 'number']) ?>
|
||||
'checked' => $config['barcode_content'] === 'number']) ?>
|
||||
<?php echo lang('Config.barcode_number') ?>
|
||||
</label>
|
||||
 
|
||||
@@ -110,7 +110,7 @@
|
||||
<?php echo form_checkbox ([
|
||||
'name' => 'barcode_generate_if_empty',
|
||||
'value' => 'barcode_generate_if_empty',
|
||||
'checked' => config('OSPOS')->settings['barcode_generate_if_empty']
|
||||
'checked' => $config['barcode_generate_if_empty']
|
||||
]) ?>
|
||||
<?php echo lang('Config.barcode_generate_if_empty') ?>
|
||||
</label>
|
||||
@@ -121,7 +121,7 @@
|
||||
<?php echo form_label(lang('Config.barcode_formats'), 'barcode_formats', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-4'>
|
||||
<?php
|
||||
$barcode_formats = json_decode(config('OSPOS')->settings['barcode_formats']);
|
||||
$barcode_formats = json_decode($config['barcode_formats']);
|
||||
echo form_dropdown ([
|
||||
'name' => 'barcode_formats[]',
|
||||
'id' => 'barcode_formats',
|
||||
@@ -146,7 +146,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'company_name' => lang('Suppliers.company_name')
|
||||
],
|
||||
config('OSPOS')->settings['barcode_first_row'], ['class' => 'form-control input-sm']);
|
||||
$config['barcode_first_row'], ['class' => 'form-control input-sm']);
|
||||
?>
|
||||
</div>
|
||||
<label class="control-label col-sm-1"><?php echo lang('Config.barcode_second_row').' ' ?></label>
|
||||
@@ -160,7 +160,7 @@
|
||||
'item_code' => lang('Items.item_number'),
|
||||
'company_name' => lang('Suppliers.company_name')
|
||||
],
|
||||
config('OSPOS')->settings['barcode_second_row'], ['class' => 'form-control input-sm']) ?>
|
||||
$config['barcode_second_row'], ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
<label class="control-label col-sm-1"><?php echo lang('Config.barcode_third_row').' ' ?></label>
|
||||
<div class='col-sm-2'>
|
||||
@@ -173,7 +173,7 @@
|
||||
'item_code' => lang('Items.item_number'),
|
||||
'company_name' => lang('Suppliers.company_name')
|
||||
],
|
||||
config('OSPOS')->settings['barcode_third_row'], ['class' => 'form-control input-sm']) ?>
|
||||
$config['barcode_third_row'], ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -186,7 +186,7 @@
|
||||
'name' => 'barcode_num_in_row',
|
||||
'id' => 'barcode_num_in_row',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['barcode_num_in_row']
|
||||
'value' => $config['barcode_num_in_row']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -199,7 +199,7 @@
|
||||
'name' => 'barcode_page_width',
|
||||
'id' => 'barcode_page_width',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['barcode_page_width']
|
||||
'value' => $config['barcode_page_width']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
@@ -214,7 +214,7 @@
|
||||
'name' => 'barcode_page_cellspacing',
|
||||
'id' => 'barcode_page_cellspacing',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['barcode_page_cellspacing']
|
||||
'value' => $config['barcode_page_cellspacing']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'sendmail' => 'sendmail',
|
||||
'smtp' => 'smtp'
|
||||
],
|
||||
esc(config('OSPOS')->settings['protocol'], 'attr'),
|
||||
esc($config['protocol'], 'attr'),
|
||||
['class' => 'form-control input-sm', 'id' => 'protocol'])
|
||||
?>
|
||||
</div>
|
||||
@@ -26,7 +26,7 @@
|
||||
'name' => 'mailpath',
|
||||
'id' => 'mailpath',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['mailpath'], 'attr')
|
||||
'value' => esc($config['mailpath'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@
|
||||
'name' => 'smtp_host',
|
||||
'id' => 'smtp_host',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['smtp_host'], 'attr')
|
||||
'value' => esc($config['smtp_host'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@
|
||||
'name' => 'smtp_port',
|
||||
'id' => 'smtp_port',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => config('OSPOS')->settings['smtp_port']
|
||||
'value' => $config['smtp_port']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
'tls' => 'TLS',
|
||||
'ssl' => 'SSL'
|
||||
],
|
||||
esc(config('OSPOS')->settings['smtp_crypto'], 'attr'),
|
||||
esc($config['smtp_crypto'], 'attr'),
|
||||
['class' => 'form-control input-sm', 'id' => 'smtp_crypto'])
|
||||
?>
|
||||
</div>
|
||||
@@ -76,7 +76,7 @@
|
||||
'name' => 'smtp_timeout',
|
||||
'id' => 'smtp_timeout',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => config('OSPOS')->settings['smtp_timeout']
|
||||
'value' => $config['smtp_timeout']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,7 +90,7 @@
|
||||
'name' => 'smtp_user',
|
||||
'id' => 'smtp_user',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['smtp_user'], 'attr')
|
||||
'value' => esc($config['smtp_user'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,7 +105,7 @@
|
||||
'name' => 'smtp_pass',
|
||||
'id' => 'smtp_pass',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['smtp_pass'], 'attr')
|
||||
'value' => esc($config['smtp_pass'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
<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('OSPOS')->settings['theme'], 'attr'), ['class' => 'form-control input-sm', 'id' => 'theme-change']) ?>
|
||||
<?php echo form_dropdown('theme', $themes, esc($config['theme'], 'attr'), ['class' => 'form-control input-sm', 'id' => 'theme-change']) ?>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<a href="<?php echo 'https://bootswatch.com/3/' . ('bootstrap' == (config('OSPOS')->settings['theme']) ? 'default' : esc(config('OSPOS')->settings['theme'])) ?>" target="_blank" rel=”noopener”>
|
||||
<span><?php echo lang('Config.theme_preview') . ' ' . ucfirst(esc(config('OSPOS')->settings['theme'])) . ' ' ?></span><span class="glyphicon glyphicon-new-window"></span>
|
||||
<a href="<?php echo 'https://bootswatch.com/3/' . ('bootstrap' == ($config['theme']) ? 'default' : esc($config['theme'])) ?>" target="_blank" rel=”noopener”>
|
||||
<span><?php echo lang('Config.theme_preview') . ' ' . ucfirst(esc($config['theme'])) . ' ' ?></span><span class="glyphicon glyphicon-new-window"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@
|
||||
'floating_labels' => lang('Config.floating_labels'),
|
||||
'input_groups' => lang('Config.input_groups')
|
||||
],
|
||||
esc(config('OSPOS')->settings['login_form'], 'attr'),
|
||||
esc($config['login_form'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -55,7 +55,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'value' => config('OSPOS')->settings['default_sales_discount']
|
||||
'value' => $config['default_sales_discount']
|
||||
]) ?>
|
||||
<span class="input-group-btn">
|
||||
<?php echo form_checkbox ([
|
||||
@@ -65,9 +65,9 @@
|
||||
'data-toggle' => 'toggle',
|
||||
'data-size' => 'normal',
|
||||
'data-onstyle' => 'success',
|
||||
'data-on' => '<b>' . esc(config('OSPOS')->settings['currency_symbol'], 'attr').'</b>',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol'], 'attr').'</b>',
|
||||
'data-off' => '<b>%</b>',
|
||||
'checked' => config('OSPOS')->settings['default_sales_discount_type']
|
||||
'checked' => $config['default_sales_discount_type']
|
||||
]) ?>
|
||||
</span>
|
||||
</div>
|
||||
@@ -85,7 +85,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'value' => config('OSPOS')->settings['default_receivings_discount']
|
||||
'value' => $config['default_receivings_discount']
|
||||
]) ?>
|
||||
<span class="input-group-btn">
|
||||
<?php echo form_checkbox ([
|
||||
@@ -95,9 +95,9 @@
|
||||
'data-toggle' => 'toggle',
|
||||
'data-size' => 'normal',
|
||||
'data-onstyle' => 'success',
|
||||
'data-on' => '<b>' . esc(config('OSPOS')->settings['currency_symbol'], 'attr') . '</b>',
|
||||
'data-on' => '<b>' . esc($config['currency_symbol'], 'attr') . '</b>',
|
||||
'data-off' => '<b>%</b>',
|
||||
'checked' => config('OSPOS')->settings['default_receivings_discount_type']
|
||||
'checked' => $config['default_receivings_discount_type']
|
||||
]) ?>
|
||||
</span>
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@
|
||||
'name' => 'enforce_privacy',
|
||||
'id' => 'enforce_privacy',
|
||||
'value' => 'enforce_privacy',
|
||||
'checked' => config('OSPOS')->settings['enforce_privacy']
|
||||
'checked' => $config['enforce_privacy']
|
||||
]) ?>
|
||||
 
|
||||
<label class="control-label">
|
||||
@@ -127,7 +127,7 @@
|
||||
'name' => 'receiving_calculate_average_price',
|
||||
'id' => 'receiving_calculate_average_price',
|
||||
'value' => 'receiving_calculate_average_price',
|
||||
'checked' => config('OSPOS')->settings['receiving_calculate_average_price']
|
||||
'checked' => $config['receiving_calculate_average_price']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,7 +142,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 10,
|
||||
'max' => 1000,
|
||||
'value' => config('OSPOS')->settings['lines_per_page']
|
||||
'value' => $config['lines_per_page']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +158,7 @@
|
||||
'top' => lang('Config.top'),
|
||||
'bottom' => lang('Config.bottom')
|
||||
],
|
||||
esc(config('OSPOS')->settings['notify_vertical_position'], 'attr'),
|
||||
esc($config['notify_vertical_position'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -170,7 +170,7 @@
|
||||
'center' => lang('Config.center'),
|
||||
'right' => lang('Config.right')
|
||||
],
|
||||
esc(config('OSPOS')->settings['notify_horizontal_position'], 'attr'),
|
||||
esc($config['notify_horizontal_position'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -192,7 +192,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 128,
|
||||
'max' => 3840,
|
||||
'value' => config('OSPOS')->settings['image_max_width'],
|
||||
'value' => $config['image_max_width'],
|
||||
'data-toggle' => 'tooltip',
|
||||
'data-placement' => 'top',
|
||||
'title' => lang('Config.image_max_width_tooltip')
|
||||
@@ -209,7 +209,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 128,
|
||||
'max' => 3840,
|
||||
'value' => config('OSPOS')->settings['image_max_height'],
|
||||
'value' => $config['image_max_height'],
|
||||
'data-toggle' => 'tooltip',
|
||||
'data-placement' => 'top',
|
||||
'title' => lang('Config.image_max_height_tooltip')
|
||||
@@ -226,7 +226,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 128,
|
||||
'max' => 2048,
|
||||
'value' => config('OSPOS')->settings['image_max_size'],
|
||||
'value' => $config['image_max_size'],
|
||||
'data-toggle' => 'tooltip',
|
||||
'data-placement' => 'top',
|
||||
'title' => lang('Config.image_max_size_tooltip')
|
||||
@@ -257,7 +257,7 @@
|
||||
'name' => 'gcaptcha_enable',
|
||||
'id' => 'gcaptcha_enable',
|
||||
'value' => 'gcaptcha_enable',
|
||||
'checked' => config('OSPOS')->settings['gcaptcha_enable']
|
||||
'checked' => $config['gcaptcha_enable']
|
||||
]) ?>
|
||||
<label class="control-label">
|
||||
<a href="https://www.google.com/recaptcha/admin" target="_blank">
|
||||
@@ -274,7 +274,7 @@
|
||||
'name' => 'gcaptcha_site_key',
|
||||
'id' => 'gcaptcha_site_key',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc(config('OSPOS')->settings['gcaptcha_site_key'], 'attr')
|
||||
'value' => esc($config['gcaptcha_site_key'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -286,7 +286,7 @@
|
||||
'name' => 'gcaptcha_secret_key',
|
||||
'id' => 'gcaptcha_secret_key',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc(config('OSPOS')->settings['gcaptcha_secret_key'], 'attr')
|
||||
'value' => esc($config['gcaptcha_secret_key'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -306,7 +306,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'cost_price' => lang('Items.cost_price')
|
||||
],
|
||||
esc(config('OSPOS')->settings['suggestions_first_column'], 'attr'),
|
||||
esc($config['suggestions_first_column'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -323,7 +323,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'cost_price' => lang('Items.cost_price')
|
||||
],
|
||||
esc(config('OSPOS')->settings['suggestions_second_column'], 'attr'),
|
||||
esc($config['suggestions_second_column'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -340,7 +340,7 @@
|
||||
'unit_price' => lang('Items.unit_price'),
|
||||
'cost_price' => lang('Items.cost_price')
|
||||
],
|
||||
esc(config('OSPOS')->settings['suggestions_third_column'], 'attr'),
|
||||
esc($config['suggestions_third_column'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -356,14 +356,14 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'giftcard_number',
|
||||
'value' => 'series',
|
||||
'checked' => config('OSPOS')->settings['giftcard_number'] == 'series']) ?>
|
||||
'checked' => $config['giftcard_number'] == 'series']) ?>
|
||||
<?php echo lang('Config.giftcard_series') ?>
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<?php echo form_radio ([
|
||||
'name' => 'giftcard_number',
|
||||
'value' => 'random',
|
||||
'checked' => config('OSPOS')->settings['giftcard_number'] == 'random']) ?>
|
||||
'checked' => $config['giftcard_number'] == 'random']) ?>
|
||||
<?php echo lang('Config.giftcard_random') ?>
|
||||
</label>
|
||||
</div>
|
||||
@@ -376,7 +376,7 @@
|
||||
'name' => 'derive_sale_quantity',
|
||||
'id' => 'derive_sale_quantity',
|
||||
'value' => 'derive_sale_quantity',
|
||||
'checked' => config('OSPOS')->settings['derive_sale_quantity']
|
||||
'checked' => $config['derive_sale_quantity']
|
||||
]) ?>
|
||||
 
|
||||
<label class="control-label">
|
||||
@@ -404,7 +404,7 @@
|
||||
'name' => 'multi_pack_enabled',
|
||||
'id' => 'multi_pack_enabled',
|
||||
'value' => 'multi_pack_enabled',
|
||||
'checked' => config('OSPOS')->settings['multi_pack_enabled']
|
||||
'checked' => $config['multi_pack_enabled']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -416,7 +416,7 @@
|
||||
'name' => 'include_hsn',
|
||||
'id' => 'include_hsn',
|
||||
'value' => 'include_hsn',
|
||||
'checked' => config('OSPOS')->settings['include_hsn']
|
||||
'checked' => $config['include_hsn']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -428,7 +428,7 @@
|
||||
'name' => 'category_dropdown',
|
||||
'id' => 'category_dropdown',
|
||||
'value' => 'category_dropdown',
|
||||
'checked' => config('OSPOS')->settings['category_dropdown']
|
||||
'checked' => $config['category_dropdown']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
'name' => 'company',
|
||||
'id' => 'company',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc(config('OSPOS')->settings['company'], 'attr')
|
||||
'value' => esc($config['company'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="fileinput-new thumbnail" style="width: 200px; height: 200px;"></div>
|
||||
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;">
|
||||
<img data-src="holder.js/100%x100%" alt="<?php echo lang('Config.company_logo') ?>"
|
||||
src="<?php if($logo_exists) echo esc(base_url('uploads/' . config('OSPOS')->settings['company_logo']), 'url'); else echo '' ?>"
|
||||
src="<?php if($logo_exists) echo esc(base_url('uploads/' . $config['company_logo']), 'url'); else echo '' ?>"
|
||||
style="max-height: 100%; max-width: 100%;">
|
||||
</div>
|
||||
<div>
|
||||
@@ -54,7 +54,7 @@
|
||||
'name' => 'address',
|
||||
'id' => 'address',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=> esc(config('OSPOS')->settings['address'], 'attr')
|
||||
'value'=> esc($config['address'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,7 +68,7 @@
|
||||
'name' => 'website',
|
||||
'id' => 'website',
|
||||
'class' => 'form-control input-sm',
|
||||
'value'=> esc(config('OSPOS')->settings['website'], 'url')
|
||||
'value'=> esc($config['website'], 'url')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -84,7 +84,7 @@
|
||||
'id' => 'email',
|
||||
'type' => 'email',
|
||||
'class' => 'form-control input-sm',
|
||||
'value'=> esc(config('OSPOS')->settings['email'], 'attr')
|
||||
'value'=> esc($config['email'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -99,7 +99,7 @@
|
||||
'name' => 'phone',
|
||||
'id' => 'phone',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=> esc(config('OSPOS')->settings['phone'], 'attr')
|
||||
'value'=> esc($config['phone'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,7 +114,7 @@
|
||||
'name' => 'fax',
|
||||
'id' => 'fax',
|
||||
'class' => 'form-control input-sm',
|
||||
'value'=> esc(config('OSPOS')->settings['fax'], 'attr')
|
||||
'value'=> esc($config['fax'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -127,7 +127,7 @@
|
||||
'name' => 'return_policy',
|
||||
'id' => 'return_policy',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc(config('OSPOS')->settings['return_policy'], 'attr')
|
||||
'value' => esc($config['return_policy'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
'name' => 'invoice_enable',
|
||||
'value' => 'invoice_enable',
|
||||
'id' => 'invoice_enable',
|
||||
'checked' => config('OSPOS')->settings['invoice_enable']
|
||||
'checked' => $config['invoice_enable']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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('OSPOS')->settings['invoice_type'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('invoice_type', esc($invoice_type_options, 'attr'), esc($config['invoice_type'], 'attr'), ['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('OSPOS')->settings['recv_invoice_format'], 'attr')
|
||||
'value' => esc($config['recv_invoice_format'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,7 +48,7 @@
|
||||
'name' => 'invoice_default_comments',
|
||||
'id' => 'invoice_default_comments',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['invoice_default_comments'], 'attr')
|
||||
'value' => esc($config['invoice_default_comments'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
'name' => 'invoice_email_message',
|
||||
'id' => 'invoice_email_message',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['invoice_email_message'], 'attr')
|
||||
'value' => esc($config['invoice_email_message'], 'attr')
|
||||
]) ?>
|
||||
</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('OSPOS')->settings['line_sequence'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('line_sequence', esc($line_sequence_options, 'attr'), esc($config['line_sequence'], 'attr'), ['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('OSPOS')->settings['sales_invoice_format'], 'attr')
|
||||
'value' => esc($config['sales_invoice_format'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,7 +92,7 @@
|
||||
'name' => 'last_used_invoice_number',
|
||||
'id' => 'last_used_invoice_number',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['last_used_invoice_number']
|
||||
'value' => $config['last_used_invoice_number']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,7 +104,7 @@
|
||||
'name' => 'sales_quote_format',
|
||||
'id' => 'sales_quote_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['sales_quote_format'], 'attr')
|
||||
'value' => esc($config['sales_quote_format'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -117,7 +117,7 @@
|
||||
'name' => 'last_used_quote_number',
|
||||
'id' => 'last_used_quote_number',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=>config('OSPOS')->settings['last_used_quote_number']
|
||||
'value'=>$config['last_used_quote_number']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -129,7 +129,7 @@
|
||||
'name' => 'quote_default_comments',
|
||||
'id' => 'quote_default_comments',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['quote_default_comments'], 'attr')
|
||||
'value' => esc($config['quote_default_comments'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,7 +141,7 @@
|
||||
'name' => 'work_order_enable',
|
||||
'value' => 'work_order_enable',
|
||||
'id' => 'work_order_enable',
|
||||
'checked' => config('OSPOS')->settings['work_order_enable']
|
||||
'checked' => $config['work_order_enable']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -153,7 +153,7 @@
|
||||
'name' => 'work_order_format',
|
||||
'id' => 'work_order_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['work_order_format'], 'attr')
|
||||
'value' => esc($config['work_order_format'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -166,7 +166,7 @@
|
||||
'name' => 'last_used_work_order_number',
|
||||
'id' => 'last_used_work_order_number',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['last_used_work_order_number']
|
||||
'value' => $config['last_used_work_order_number']
|
||||
]) ?>
|
||||
</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('OSPOS')->settings['number_locale'], 'attr'), ['class' => 'form-control input-sm', 'id' => 'number_locale']) ?>
|
||||
<?php echo form_hidden('save_number_locale', esc(config('OSPOS')->settings['number_locale'], 'attr')) ?>
|
||||
<?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')) ?>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<label class="control-label">
|
||||
@@ -39,7 +39,7 @@
|
||||
'name' => 'thousands_separator',
|
||||
'id' => 'thousands_separator',
|
||||
'value' => 'thousands_separator',
|
||||
'checked' => config('OSPOS')->settings['thousands_separator']
|
||||
'checked' => $config['thousands_separator']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
'name' => 'currency_symbol',
|
||||
'id' => 'currency_symbol',
|
||||
'class' => 'form-control input-sm number_locale',
|
||||
'value' => esc(config('OSPOS')->settings['currency_symbol'], 'attr')
|
||||
'value' => esc($config['currency_symbol'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@
|
||||
'1' => '1',
|
||||
'2' => '2'
|
||||
],
|
||||
config('OSPOS')->settings['currency_decimals'],
|
||||
$config['currency_decimals'],
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -96,7 +96,7 @@
|
||||
'3' => '3',
|
||||
'4' => '4'
|
||||
],
|
||||
config('OSPOS')->settings['tax_decimals'],
|
||||
$config['tax_decimals'],
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -113,7 +113,7 @@
|
||||
'2' => '2',
|
||||
'3' => '3'
|
||||
],
|
||||
config('OSPOS')->settings['quantity_decimals'],
|
||||
$config['quantity_decimals'],
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -130,7 +130,7 @@
|
||||
'1' => '1',
|
||||
'2' => '2'
|
||||
],
|
||||
config('OSPOS')->settings['cash_decimals'],
|
||||
$config['cash_decimals'],
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</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('OSPOS')->settings['cash_rounding_code'], ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('cash_rounding_code', esc($rounding_options, 'attr'), $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('OSPOS')->settings['payment_options_order'], 'attr'),
|
||||
esc($config['payment_options_order'], 'attr'),
|
||||
['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('OSPOS')->settings['country_codes'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_input('country_codes', esc($config['country_codes'], 'attr'), ['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('OSPOS')->settings['timezone'] ? esc(config('OSPOS')->settings['timezone'], 'attr') : date_default_timezone_get(), ['class' => 'form-control input-sm']) ?>
|
||||
$config['timezone'] ? esc($config['timezone'], 'attr') : date_default_timezone_get(), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -207,14 +207,14 @@
|
||||
<?php echo form_dropdown(
|
||||
'dateformat',
|
||||
get_dateformats(),
|
||||
esc(config('OSPOS')->settings['dateformat'], 'attr'),
|
||||
esc($config['dateformat'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
<div class='col-sm-2'>
|
||||
<?php echo form_dropdown('timeformat',
|
||||
get_timeformats(),
|
||||
config('OSPOS')->settings['timeformat'], ['class' => 'form-control input-sm']
|
||||
$config['timeformat'], ['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -226,7 +226,7 @@
|
||||
'name' => 'date_or_time_format',
|
||||
'id' => 'date_or_time_format',
|
||||
'value' => 'date_or_time_format',
|
||||
'checked' => config('OSPOS')->settings['date_or_time_format']
|
||||
'checked' => $config['date_or_time_format']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -250,7 +250,7 @@
|
||||
'11' => lang('Config.financial_year_nov'),
|
||||
'12' => lang('Config.financial_year_dec')
|
||||
],
|
||||
config('OSPOS')->settings['financial_year'], ['class' => 'form-control input-sm']
|
||||
$config['financial_year'], ['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'name' => 'msg_uid',
|
||||
'id' => 'msg_uid',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc(config('OSPOS')->settings['msg_uid'], 'attr')
|
||||
'value' => esc($config['msg_uid'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,7 +28,7 @@
|
||||
'name' => 'msg_pwd',
|
||||
'id' => 'msg_pwd',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => esc(config('OSPOS')->settings['msg_pwd'], 'attr')
|
||||
'value' => esc($config['msg_pwd'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@
|
||||
'name' => 'msg_src',
|
||||
'id' => 'msg_src',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['msg_src'] == NULL ? esc(config('OSPOS')->settings['company'], 'attr') : esc(config('OSPOS')->settings['msg_src'], 'attr')
|
||||
'value' => $config['msg_src'] == NULL ? esc($config['company'], 'attr') : esc($config['msg_src'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,7 +56,7 @@
|
||||
'name' => 'msg_msg',
|
||||
'id' => 'msg_msg',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => config('OSPOS')->settings['msg_msg'],
|
||||
'value' => $config['msg_msg'],
|
||||
'placeholder' => lang('Config.msg_msg_placeholder')
|
||||
]) ?>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
'receipt_default' => lang('Config.receipt_default'),
|
||||
'receipt_short' => lang('Config.receipt_short')
|
||||
],
|
||||
esc(config('OSPOS')->settings['receipt_template'], 'attr'),
|
||||
esc($config['receipt_template'], 'attr'),
|
||||
['class' => 'form-control input-sm']
|
||||
) ?>
|
||||
</div>
|
||||
@@ -29,7 +29,7 @@
|
||||
'name' => 'receipt_font_size',
|
||||
'id' => 'receipt_font_size',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['receipt_font_size']
|
||||
'value' => $config['receipt_font_size']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -47,7 +47,7 @@
|
||||
'name' => 'print_delay_autoreturn',
|
||||
'id' => 'print_delay_autoreturn',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['print_delay_autoreturn']
|
||||
'value' => $config['print_delay_autoreturn']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">s</span>
|
||||
</div>
|
||||
@@ -61,7 +61,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'email_receipt_check_behaviour',
|
||||
'value' => 'always',
|
||||
'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'always'
|
||||
'checked' => $config['email_receipt_check_behaviour'] == 'always'
|
||||
]) ?>
|
||||
<?php echo lang('Config.email_receipt_check_behaviour_always') ?>
|
||||
</label>
|
||||
@@ -69,7 +69,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'email_receipt_check_behaviour',
|
||||
'value' => 'never',
|
||||
'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'never'
|
||||
'checked' => $config['email_receipt_check_behaviour'] == 'never'
|
||||
]) ?>
|
||||
<?php echo lang('Config.email_receipt_check_behaviour_never') ?>
|
||||
</label>
|
||||
@@ -77,7 +77,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'email_receipt_check_behaviour',
|
||||
'value' => 'last',
|
||||
'checked' => config('OSPOS')->settings['email_receipt_check_behaviour'] == 'last'
|
||||
'checked' => $config['email_receipt_check_behaviour'] == 'last'
|
||||
]) ?>
|
||||
<?php echo lang('Config.email_receipt_check_behaviour_last') ?>
|
||||
</label>
|
||||
@@ -91,7 +91,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'print_receipt_check_behaviour',
|
||||
'value' => 'always',
|
||||
'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'always'
|
||||
'checked' => $config['print_receipt_check_behaviour'] == 'always'
|
||||
]) ?>
|
||||
<?php echo lang('Config.print_receipt_check_behaviour_always') ?>
|
||||
</label>
|
||||
@@ -99,7 +99,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'print_receipt_check_behaviour',
|
||||
'value' => 'never',
|
||||
'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'never'
|
||||
'checked' => $config['print_receipt_check_behaviour'] == 'never'
|
||||
]) ?>
|
||||
<?php echo lang('Config.print_receipt_check_behaviour_never') ?>
|
||||
</label>
|
||||
@@ -107,7 +107,7 @@
|
||||
<?php echo form_radio ([
|
||||
'name' => 'print_receipt_check_behaviour',
|
||||
'value' => 'last',
|
||||
'checked' => config('OSPOS')->settings['print_receipt_check_behaviour'] == 'last'
|
||||
'checked' => $config['print_receipt_check_behaviour'] == 'last'
|
||||
]) ?>
|
||||
<?php echo lang('Config.print_receipt_check_behaviour_last') ?>
|
||||
</label>
|
||||
@@ -121,7 +121,7 @@
|
||||
'name' => 'receipt_show_company_name',
|
||||
'value' => 'receipt_show_company_name',
|
||||
'id' => 'receipt_show_company_name',
|
||||
'checked' => config('OSPOS')->settings['receipt_show_company_name']
|
||||
'checked' => $config['receipt_show_company_name']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,7 +133,7 @@
|
||||
'name' => 'receipt_show_taxes',
|
||||
'value' => 'receipt_show_taxes',
|
||||
'id' => 'receipt_show_taxes',
|
||||
'checked' => config('OSPOS')->settings['receipt_show_taxes']
|
||||
'checked' => $config['receipt_show_taxes']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -145,7 +145,7 @@
|
||||
'name' => 'receipt_show_tax_ind',
|
||||
'value' => 'receipt_show_tax_ind',
|
||||
'id' => 'receipt_show_tax_ind',
|
||||
'checked' => config('OSPOS')->settings['receipt_show_tax_ind']
|
||||
'checked' => $config['receipt_show_tax_ind']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -157,7 +157,7 @@
|
||||
'name' => 'receipt_show_total_discount',
|
||||
'value' => 'receipt_show_total_discount',
|
||||
'id' => 'receipt_show_total_discount',
|
||||
'checked' => config('OSPOS')->settings['receipt_show_total_discount']
|
||||
'checked' => $config['receipt_show_total_discount']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -169,7 +169,7 @@
|
||||
'name' => 'receipt_show_description',
|
||||
'value' => 'receipt_show_description',
|
||||
'id' => 'receipt_show_description',
|
||||
'checked' => config('OSPOS')->settings['receipt_show_description']
|
||||
'checked' => $config['receipt_show_description']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -181,7 +181,7 @@
|
||||
'name' => 'receipt_show_serialnumber',
|
||||
'value' => 'receipt_show_serialnumber',
|
||||
'id' => 'receipt_show_serialnumber',
|
||||
'checked' => config('OSPOS')->settings['receipt_show_serialnumber']
|
||||
'checked' => $config['receipt_show_serialnumber']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -193,7 +193,7 @@
|
||||
'name' => 'print_silently',
|
||||
'id' => 'print_silently',
|
||||
'value' => 'print_silently',
|
||||
'checked' => config('OSPOS')->settings['print_silently']
|
||||
'checked' => $config['print_silently']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -205,7 +205,7 @@
|
||||
'name' => 'print_header',
|
||||
'id' => 'print_header',
|
||||
'value' => 'print_header',
|
||||
'checked' => config('OSPOS')->settings['print_header']
|
||||
'checked' => $config['print_header']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -217,7 +217,7 @@
|
||||
'name' => 'print_footer',
|
||||
'id' => 'print_footer',
|
||||
'value' => 'print_footer',
|
||||
'checked' => config('OSPOS')->settings['print_footer']
|
||||
'checked' => $config['print_footer']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -254,7 +254,7 @@
|
||||
'name' => 'print_top_margin',
|
||||
'id' => 'print_top_margin',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['print_top_margin']
|
||||
'value' => $config['print_top_margin']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -272,7 +272,7 @@
|
||||
'name' => 'print_left_margin',
|
||||
'id' => 'print_left_margin',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['print_left_margin']
|
||||
'value' => $config['print_left_margin']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -290,7 +290,7 @@
|
||||
'name' => 'print_bottom_margin',
|
||||
'id' => 'print_bottom_margin',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['print_bottom_margin']
|
||||
'value' => $config['print_bottom_margin']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -308,7 +308,7 @@
|
||||
'name' => 'print_right_margin',
|
||||
'id' => 'print_right_margin',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value' => config('OSPOS')->settings['print_right_margin']
|
||||
'value' => $config['print_right_margin']
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
'name' => 'customer_reward_enable',
|
||||
'value' => 'customer_reward_enable',
|
||||
'id' => 'customer_reward_enable',
|
||||
'checked' => config('OSPOS')->settings['customer_reward_enable']
|
||||
'checked' => $config['customer_reward_enable']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="col-sm-8" id="issuetemplate" style="text-align: left;"><br>
|
||||
<?php echo lang('Config.ospos_info') . ':' ?>
|
||||
<?php echo esc(config('OSPOS')->settings['application_version']) ?> - <?php echo esc(substr(config('OSPOS')->settings['commit_sha1'], 0, 6)) ?><br>
|
||||
<?php echo esc(config('App')->application_version) ?> - <?php echo esc(substr(config('OSPOS')->commit_sha1, 0, 6)) ?><br>
|
||||
Language Code: <?php echo current_language_code() ?><br><br>
|
||||
<div id="TimeError"></div>
|
||||
Extensions & Modules:<br>
|
||||
@@ -53,9 +53,9 @@
|
||||
.OS: <?php echo php_uname('s') .' '. php_uname('r') ?><br><br>
|
||||
File Permissions:<br>
|
||||
» [writeable/logs:]
|
||||
<?php $logs = '../writeable/logs/';
|
||||
$uploads = '../writeable/uploads/';
|
||||
$images = '../writeable/uploads/item_pics/';
|
||||
<?php $logs = '../writable/logs/';
|
||||
$uploads = '../writable/uploads/';
|
||||
$images = '../writable/uploads/item_pics/';
|
||||
$import = '../import_items.csv';
|
||||
$importcustomers = '../import_customers.csv'; //TODO: This variable does not follow naming conventions for the project.
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
?>
|
||||
<br>
|
||||
<div id="timezone" style="font-weight:600;"></div><br><br>
|
||||
<div id="ostimezone" style="display:none;" ><?php echo esc(config('OSPOS')->settings['timezone']) ?></div><br>
|
||||
<div id="ostimezone" style="display:none;" ><?php echo esc($config['timezone']) ?></div><br>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
@@ -205,6 +205,6 @@
|
||||
});
|
||||
|
||||
if($('#timezone').html() !== $('#ostimezone').html())
|
||||
document.getElementById("TimeError").innerHTML = '<span style="color: red;"><?php echo lang('Config.timezone_error') ?></span><br><br><?php echo lang('Config.user_timezone') ?><div id="timezoneE" style="font-weight:600;"></div><br><?php echo lang('Config.os_timezone') ?><div id="ostimezoneE" style="font-weight:600;"><?php echo esc(config('OSPOS')->settings['timezone']) ?></div><br>';
|
||||
document.getElementById("TimeError").innerHTML = '<span style="color: red;"><?php echo lang('Config.timezone_error') ?></span><br><br><?php echo lang('Config.user_timezone') ?><div id="timezoneE" style="font-weight:600;"></div><br><?php echo lang('Config.os_timezone') ?><div id="ostimezoneE" style="font-weight:600;"><?php echo esc($config['timezone']) ?></div><br>';
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
'name' => 'dinner_table_enable',
|
||||
'value' => 'dinner_table_enable',
|
||||
'id' => 'dinner_table_enable',
|
||||
'checked' => config('OSPOS')->settings['dinner_table_enable']
|
||||
'checked' => $config['dinner_table_enable']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
'name' => 'tax_id',
|
||||
'id' => 'tax_id',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => esc(config('OSPOS')->settings['tax_id'], 'attr')
|
||||
'value' => esc($config['tax_id'], 'attr')
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,7 +31,7 @@
|
||||
'name' => 'tax_included',
|
||||
'id' => 'tax_included',
|
||||
'value' => 'tax_included',
|
||||
'checked' => config('OSPOS')->settings['tax_included']
|
||||
'checked' => $config['tax_included']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,14 +43,14 @@
|
||||
'name' => 'default_tax_1_name',
|
||||
'id' => 'default_tax_1_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => config('OSPOS')->settings['default_tax_1_name'] !== FALSE ? esc(config('OSPOS')->settings['default_tax_1_name'], 'attr') : lang('Items.sales_tax_1')]) ?>
|
||||
'value' => $config['default_tax_1_name'] !== FALSE ? esc($config['default_tax_1_name'], 'attr') : lang('Items.sales_tax_1')]) ?>
|
||||
</div>
|
||||
<div class="col-xs-1 input-group">
|
||||
<?php echo form_input ([
|
||||
'name' => 'default_tax_1_rate',
|
||||
'id' => 'default_tax_1_rate',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => to_tax_decimals(config('OSPOS')->settings['default_tax_1_rate'])
|
||||
'value' => to_tax_decimals($config['default_tax_1_rate'])
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
'name' => 'default_tax_2_name',
|
||||
'id' => 'default_tax_2_name',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => config('OSPOS')->settings['default_tax_2_name'] !== FALSE ? esc(config('OSPOS')->settings['default_tax_2_name'], 'attr') : lang('Items.sales_tax_2')
|
||||
'value' => $config['default_tax_2_name'] !== FALSE ? esc($config['default_tax_2_name'], 'attr') : lang('Items.sales_tax_2')
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-xs-1 input-group">
|
||||
@@ -71,7 +71,7 @@
|
||||
'name' => 'default_tax_2_rate',
|
||||
'id' => 'default_tax_2_rate',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => to_tax_decimals(config('OSPOS')->settings['default_tax_2_rate'])
|
||||
'value' => to_tax_decimals($config['default_tax_2_rate'])
|
||||
]) ?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
@@ -84,7 +84,7 @@
|
||||
'name' => 'use_destination_based_tax',
|
||||
'id' => 'use_destination_based_tax',
|
||||
'value' => 'use_destination_based_tax',
|
||||
'checked' => config('OSPOS')->settings['use_destination_based_tax']
|
||||
'checked' => $config['use_destination_based_tax']
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,21 +92,21 @@
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.default_tax_code'), 'default_tax_code', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_tax_code', esc($tax_code_options, 'attr'), esc(config('OSPOS')->settings['default_tax_code'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('default_tax_code', esc($tax_code_options, 'attr'), esc($config['default_tax_code'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.default_tax_category'), 'default_tax_category', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_tax_category', esc($tax_category_options, 'attr'), esc(config('OSPOS')->settings['default_tax_category'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('default_tax_category', esc($tax_category_options, 'attr'), esc($config['default_tax_category'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label(lang('Config.default_tax_jurisdiction'), 'default_tax_jurisdiction', ['class' => 'control-label col-xs-2']) ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_tax_jurisdiction', esc($tax_jurisdiction_options, 'attr'), esc(config('OSPOS')->settings['default_tax_jurisdiction'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
<?php echo form_dropdown('default_tax_jurisdiction', esc($tax_jurisdiction_options, 'attr'), esc($config['default_tax_jurisdiction'], 'attr'), ['class' => 'form-control input-sm']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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('OSPOS')->settings['enforce_privacy'] : (boolean)$person_info->consent) ?>
|
||||
<?php echo form_checkbox('consent', '1', $person_info->consent == '' ? !$config['enforce_privacy'] : (boolean)$person_info->consent) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(config('OSPOS')->settings['customer_reward_enable'] == TRUE): ?>
|
||||
<?php if($config['customer_reward_enable'] == TRUE): ?>
|
||||
<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'>
|
||||
@@ -225,7 +225,7 @@
|
||||
<div class="col-xs-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'total',
|
||||
@@ -235,7 +235,7 @@
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,7 +246,7 @@
|
||||
<div class="col-xs-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'max',
|
||||
@@ -256,7 +256,7 @@
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -267,7 +267,7 @@
|
||||
<div class="col-xs-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'min',
|
||||
@@ -277,7 +277,7 @@
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -288,7 +288,7 @@
|
||||
<div class="col-xs-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'average',
|
||||
@@ -298,7 +298,7 @@
|
||||
'disabled' => ''
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<div class='col-xs-6'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'amount',
|
||||
@@ -82,7 +82,7 @@
|
||||
'value' => to_currency_no_money($expenses_info->amount)
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,7 +93,7 @@
|
||||
<div class='col-xs-6'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'tax_amount',
|
||||
@@ -102,7 +102,7 @@
|
||||
'value' => to_currency_no_money($expenses_info->tax_amount)
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></b></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ $(document).ready(function()
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'expense_id',
|
||||
onLoadSuccess: function(response) {
|
||||
if($("#table tbody tr").length > 1) {
|
||||
|
||||
@@ -14,7 +14,7 @@ $(document).ready(function()
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'expense_category_id',
|
||||
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<?php
|
||||
$class = '';
|
||||
if(config('OSPOS')->settings['giftcard_number'] == 'series')
|
||||
if($config['giftcard_number'] == 'series')
|
||||
{
|
||||
$class = ' required';
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class='col-xs-4'>
|
||||
<div class="input-group input-group-sm">
|
||||
<?php if (!currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></span>
|
||||
<span class="input-group-addon input-sm"><?php echo esc($config['currency_symbol']) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php echo form_input ([
|
||||
'name' => 'giftcard_amount',
|
||||
@@ -60,7 +60,7 @@
|
||||
'value'=>to_currency_no_money($giftcard_value)
|
||||
]) ?>
|
||||
<?php if (currency_side()): ?>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc(config('OSPOS')->settings['currency_symbol']) ?></span>
|
||||
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -113,7 +113,7 @@ $(document).ready(function()
|
||||
rules:
|
||||
{
|
||||
<?php
|
||||
if(config('OSPOS')->settings['giftcard_number'] == 'series')
|
||||
if($config['giftcard_number'] == 'series')
|
||||
{
|
||||
?>
|
||||
giftcard_number:
|
||||
@@ -146,7 +146,7 @@ $(document).ready(function()
|
||||
messages:
|
||||
{
|
||||
<?php
|
||||
if(config('OSPOS')->settings['giftcard_number'] == 'series')
|
||||
if($config['giftcard_number'] == 'series')
|
||||
{
|
||||
?>
|
||||
giftcard_number:
|
||||
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function()
|
||||
table_support.init({
|
||||
resource: '<?php echo esc(site_url($controller_name), 'url') ?>',
|
||||
headers: <?php echo esc($table_headers) ?>,
|
||||
pageSize: <?php echo config('OSPOS')->settings['lines_per_page'] ?>,
|
||||
pageSize: <?php echo $config['lines_per_page'] ?>,
|
||||
uniqueId: 'giftcard_id'
|
||||
});
|
||||
});
|
||||
@@ -37,4 +37,4 @@ $(document).ready(function()
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
|
||||
<?php echo view('partial/footer') ?>
|
||||
<?php echo view('partial/footer') ?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user