From 36bab70bfdb507a1c9b5c6362573a6a01589fed0 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Sat, 5 Dec 2020 00:18:43 +0100 Subject: [PATCH] Fix default register mode (#3016) --- application/controllers/Config.php | 1 - application/libraries/Sale_lib.php | 17 +++++------------ application/views/configs/invoice_config.php | 9 +-------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 74837bbc4..a42ca8cf5 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -817,7 +817,6 @@ class Config extends Secure_Controller { $batch_save_data = array ( 'invoice_enable' => $this->input->post('invoice_enable') != NULL, - 'default_register_mode' => $this->input->post('default_register_mode'), 'sales_invoice_format' => $this->input->post('sales_invoice_format'), 'sales_quote_format' => $this->input->post('sales_quote_format'), 'recv_invoice_format' => $this->input->post('recv_invoice_format'), diff --git a/application/libraries/Sale_lib.php b/application/libraries/Sale_lib.php index 5530113be..ebf372350 100644 --- a/application/libraries/Sale_lib.php +++ b/application/libraries/Sale_lib.php @@ -591,18 +591,10 @@ class Sale_lib public function get_mode() { - if(!$this->CI->session->userdata('sales_mode')) - { - if($this->CI->config->item('invoice_enable') == '1') - { - $this->set_mode($this->CI->config->item('default_register_mode')); - } - else - { - $this->set_mode('sale'); - } - } - + if(!$this->CI->session->userdata('sales_mode')) + { + $this->set_mode('sale'); + } return $this->CI->session->userdata('sales_mode'); } @@ -1037,6 +1029,7 @@ class Sale_lib public function clear_all() { $this->CI->session->set_userdata('sale_id', -1); + $this->clear_mode(); $this->clear_table(); $this->empty_cart(); $this->clear_comment(); diff --git a/application/views/configs/invoice_config.php b/application/views/configs/invoice_config.php index 9ec52a2d2..844b582fb 100644 --- a/application/views/configs/invoice_config.php +++ b/application/views/configs/invoice_config.php @@ -22,13 +22,6 @@ -
- lang->line('config_register_mode_default'), 'default_register_mode', array('class' => 'control-label col-xs-2')); ?> -
- config->item('default_register_mode'), array('class' => 'form-control input-sm')); ?> -
-
-
lang->line('config_recv_invoice_format'), 'recv_invoice_format', array('class' => 'control-label col-xs-2')); ?>
@@ -176,7 +169,7 @@ $(document).ready(function() var enable_disable_invoice_enable = (function() { var invoice_enabled = $("#invoice_enable").is(":checked"); var work_order_enabled = $("#work_order_enable").is(":checked"); - $("#sales_invoice_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message, select[name='default_register_mode'], select[name='invoice_type'], #sales_quote_format, select[name='line_sequence'], #last_used_invoice_number, #last_used_quote_number, #quote_default_comments, #work_order_enable, #work_order_format, #last_used_work_order_number").prop("disabled", !invoice_enabled); + $("#sales_invoice_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message, select[name='invoice_type'], #sales_quote_format, select[name='line_sequence'], #last_used_invoice_number, #last_used_quote_number, #quote_default_comments, #work_order_enable, #work_order_format, #last_used_work_order_number").prop("disabled", !invoice_enabled); if(invoice_enabled) { $("#work_order_format, #last_used_work_order_number").prop("disabled", !work_order_enabled); } else {