For #3730, some progress made on configuration maintenance. More remains to be done.

This commit is contained in:
Steve Ireland
2023-04-04 21:59:54 -04:00
parent fbd4e37734
commit b5f67ae4b2
16 changed files with 42 additions and 40 deletions

View File

@@ -56,7 +56,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->appconfig = model('Appconfig');
$this->attribute = model('Attribute');
$this->customer_rewards = model('Customer_rewards');
$this->dinner_table = model('Dinner_table');
@@ -253,6 +253,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['barcode_fonts'] = $this->barcode_lib->listfonts('fonts');
$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();
@@ -263,6 +264,7 @@ class Config extends Secure_Controller
$data['tax_jurisdiction_options'] = $this->tax_lib->get_tax_jurisdiction_options();
$data['show_office_group'] = $this->module->get_show_office_group();
$data['currency_code'] = $this->config['currency_code'];
$data['db_version'] = mysqli_get_server_info(db_connect()->mysqli);
// load all the license statements, they are already XSS cleaned in the private function
$data['licenses'] = $this->_licenses();
@@ -317,7 +319,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_info(): void
public function postSaveInfo(): void
{
$upload_data = $this->upload_logo();
$upload_success = !empty($upload_data['error']);
@@ -388,7 +390,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_general(): void
public function postSaveGeneral(): void
{
$batch_save_data = [
'theme' => $this->request->getPost('theme', FILTER_SANITIZE_STRING),
@@ -482,7 +484,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_locale(): void
public function postSaveLocale(): void
{
$exploded = explode(":", $this->request->getPost('language', FILTER_SANITIZE_STRING));
$batch_save_data = [
@@ -514,7 +516,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_email(): void
public function postSaveEmail(): void
{
$password = '';
@@ -542,7 +544,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_message(): void
public function postSaveMessage(): void
{
$password = '';
@@ -608,7 +610,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_mailchimp(): void
public function postSaveMailchimp(): void
{
$api_key = '';
$list_id = '';
@@ -665,7 +667,7 @@ class Config extends Secure_Controller
$this->receiving_lib->clear_all();
}
public function save_locations(): void
public function postSaveLocations(): void
{
$this->db->transStart();
@@ -709,7 +711,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_tables(): void
public function postSaveTables(): void
{
$this->db->transStart();
@@ -758,7 +760,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_tax(): void
public function postSaveTax(): void
{
$this->db->transStart();
@@ -789,7 +791,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_rewards(): void
public function postSaveRewards(): void
{
$this->db->transStart();
@@ -848,7 +850,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_barcode(): void
public function postSaveBarcode(): void
{
$batch_save_data = [
'barcode_type' => $this->request->getPost('barcode_type', FILTER_SANITIZE_STRING),
@@ -876,7 +878,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_receipt(): void
public function postSaveReceipt(): void
{
$batch_save_data = [
'receipt_template' => $this->request->getPost('receipt_template', FILTER_SANITIZE_STRING),
@@ -907,7 +909,7 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function save_invoice(): void
public function postSaveInvoice(): void
{
$batch_save_data = [
'invoice_enable' => $this->request->getPost('invoice_enable') != NULL,

View File

@@ -3,7 +3,7 @@
* @var array $support_barcode
*/
?>
<?php echo form_open('config/save_barcode/', ['id' => 'barcode_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveBarcode/', ['id' => 'barcode_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
@@ -52,7 +52,7 @@
<div class='col-sm-2'>
<?php echo form_dropdown(
'barcode_font',
esc($this->barcode_lib->listfonts('fonts')),
esc($barcode_fonts),
esc($config['barcode_font']),
['class' => 'form-control input-sm required']
) ?>
@@ -93,7 +93,7 @@
<?php echo form_radio ([
'name' => 'barcode_content',
'value' => 'id',
'checked' => $config['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['barcode_content'] === 'number']) ?>
'checked' => @$config['barcode_content'] === 'number']) ?>
<?php echo lang('Config.barcode_number') ?>
</label>
&nbsp

View File

@@ -1,4 +1,4 @@
<?php echo form_open('config/save_email/', ['id' => 'email_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveEmail/', ['id' => 'email_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
@@ -38,7 +38,7 @@
'name' => 'smtp_host',
'id' => 'smtp_host',
'class' => 'form-control input-sm',
'value' => esc($config['smtp_host'])
'value' => esc(@$config['smtp_host'])
]) ?>
</div>
</div>
@@ -90,7 +90,7 @@
'name' => 'smtp_user',
'id' => 'smtp_user',
'class' => 'form-control input-sm',
'value' => esc($config['smtp_user'])
'value' => esc(@$config['smtp_user'])
]) ?>
</div>
</div>
@@ -105,7 +105,7 @@
'name' => 'smtp_pass',
'id' => 'smtp_pass',
'class' => 'form-control input-sm',
'value' => esc($config['smtp_pass'])
'value' => esc(@$config['smtp_pass'])
]) ?>
</div>
</div>

View File

@@ -7,7 +7,7 @@
* @var string $controller_name
*/
?>
<?php echo form_open('config/save_general/', ['id' => 'general_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveGeneral/', ['id' => 'general_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
@@ -38,9 +38,9 @@
'floating_labels' => lang('Config.floating_labels'),
'input_groups' => lang('Config.input_groups')
],
esc($config['login_form']),
esc(@$config['login_form']),
['class' => 'form-control input-sm']
) ?>
) ?>s
</div>
</div>
@@ -127,7 +127,7 @@
'name' => 'receiving_calculate_average_price',
'id' => 'receiving_calculate_average_price',
'value' => 'receiving_calculate_average_price',
'checked' => $config['receiving_calculate_average_price']
'checked' => @$config['receiving_calculate_average_price']
]) ?>
</div>
</div>
@@ -428,7 +428,7 @@
'name' => 'category_dropdown',
'id' => 'category_dropdown',
'value' => 'category_dropdown',
'checked' => $config['category_dropdown']
'checked' => @$config['category_dropdown']
]) ?>
</div>
</div>

View File

@@ -5,7 +5,7 @@
* @var array $config
*/
?>
<?php echo form_open('config/save_info/', ['id' => 'info_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveInfo/', ['id' => 'info_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -4,7 +4,7 @@
* @var string $controller_name
*/
?>
<?php echo form_open('config/save_mailchimp/', ['id' => 'mailchimp_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveMailchimp/', ['id' => 'mailchimp_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>
@@ -61,7 +61,7 @@
$(document).ready(function()
{
$('#mailchimp_api_key').change(function() {
$.post("<?php echo esc("$controller_name/ajax_check_mailchimp_api_key"), ?>", {
$.post("<?php echo esc("$controller_name/ajax_check_mailchimp_api_key") ?>", {
'mailchimp_api_key': $('#mailchimp_api_key').val()
},
function(response) {

View File

@@ -4,7 +4,7 @@
* @var array $line_sequence_options
*/
?>
<?php echo form_open('config/save_invoice/', ['id' => 'invoice_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveInvoice/', ['id' => 'invoice_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -6,7 +6,7 @@
*/
?>
<?php echo form_open('config/save_locale/', ['id' => 'locale_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveLocale/', ['id' => 'locale_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -1,4 +1,4 @@
<?php echo form_open('config/save_message/', ['id' => 'message_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveMessage/', ['id' => 'message_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -1,4 +1,4 @@
<?php echo form_open('config/save_receipt/', ['id' => 'receipt_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveReceipt/', ['id' => 'receipt_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -3,7 +3,7 @@
* @var array $customer_rewards
*/
?>
<?php echo form_open('config/save_rewards/', ['id' => 'reward_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveRewards/', ['id' => 'reward_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -3,7 +3,7 @@
* @var array $stock_locations
*/
?>
<?php echo form_open('config/save_locations/', ['id' => 'location_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveLocations/', ['id' => 'location_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -47,7 +47,7 @@
?><br>
.Server Software: <?php echo esc($_SERVER['SERVER_SOFTWARE']) ?><br>
.PHP Version: <?php echo PHP_VERSION ?><br>
.DB Version: <?php echo esc(mysqli_get_server_info($this->db->conn_id)) ?><br>
.DB Version: <?php echo esc($db_version) ?><br>
.Server Port: <?php echo esc($_SERVER['SERVER_PORT']) ?><br>
.OS: <?php echo php_uname('s') .' '. php_uname('r') ?><br><br>
File Permissions:<br>

View File

@@ -3,7 +3,7 @@
* @var array $dinner_tables
*/
?>
<?php echo form_open('config/save_tables/', ['id' => 'table_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveTables/', ['id' => 'table_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -6,7 +6,7 @@
* @var string $controller_name
*/
?>
<?php echo form_open('config/save_tax/', ['id' => 'tax_config_form', 'class' => 'form-horizontal']) ?>
<?php echo form_open('config/saveTax/', ['id' => 'tax_config_form', 'class' => 'form-horizontal']) ?>
<div id="config_wrapper">
<fieldset id="config_info">
<div id="required_fields_message"><?php echo lang('Common.fields_required_message') ?></div>

View File

@@ -224,7 +224,7 @@
]) ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo esc($config['currency_symbol']) ?></b></span>
<?php endif; ?>
<?php endif; ?>`
</div>
</div>
</div>