diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index b3c0ac5db8fc183297be9ec186f9c516020b2b90..402b0db4c15d51cad91516e6913109387ed36c1e 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -189,9 +189,11 @@ class page_action extends tform_actions { $app->tpl->setVar('customer_no',$customer_no_string); //* save new counter value + /* $system_config['misc']['customer_no_counter']++; $system_config_str = $app->ini_parser->get_ini_string($system_config); $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + */ } } else { //* Logged in user must be a reseller @@ -206,8 +208,10 @@ class page_action extends tform_actions { $app->tpl->setVar('customer_no',$customer_no_string); //* save new counter value + /* $customer_no_counter = $app->functions->intval($reseller['customer_no_counter']+1); $app->db->query("UPDATE client SET customer_no_counter = $customer_no_counter WHERE client_id = ".$app->functions->intval($reseller['client_id'])); + */ } } } @@ -272,6 +276,33 @@ class page_action extends tform_actions { $app->uses('client_templates'); $app->client_templates->update_client_templates($this->id, $this->_template_additional); } + + if($this->dataRecord['customer_no'] == $this->dataRecord['customer_no_org']) { + if($app->auth->is_admin()) { + //* Logged in User is admin + //* get the system config + $app->uses('getconf'); + $system_config = $app->getconf->get_global_config(); + if($system_config['misc']['customer_no_template'] != '') { + + //* save new counter value + $system_config['misc']['customer_no_counter']++; + $system_config_str = $app->ini_parser->get_ini_string($system_config); + $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + } + } else { + //* Logged in user must be a reseller + //* get the record of the reseller + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $reseller = $app->db->queryOneRecord("SELECT client.client_id, client.customer_no_template, client.customer_no_counter, client.customer_no_start FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id); + + if($reseller['customer_no_template'] != '') { + //* save new counter value + $customer_no_counter = $app->functions->intval($reseller['customer_no_counter']+1); + $app->db->query("UPDATE client SET customer_no_counter = $customer_no_counter WHERE client_id = ".$app->functions->intval($reseller['client_id'])); + } + } + } parent::onAfterInsert(); } diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php index f9828569a6d257bc2b6fb48112261af623058b9f..4f0a1db5b24bfb08d75213894fa6a89d54bca52f 100644 --- a/interface/web/client/reseller_edit.php +++ b/interface/web/client/reseller_edit.php @@ -153,9 +153,11 @@ class page_action extends tform_actions { $app->tpl->setVar('customer_no',$customer_no_string); //* save new counter value + /* $system_config['misc']['customer_no_counter']++; $system_config_str = $app->ini_parser->get_ini_string($system_config); $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + */ } } @@ -210,6 +212,20 @@ class page_action extends tform_actions { $sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id; $app->db->query($sql); + + if($this->dataRecord['customer_no'] == $this->dataRecord['customer_no_org']) { + //* get the system config + $app->uses('getconf'); + $system_config = $app->getconf->get_global_config(); + if($system_config['misc']['customer_no_template'] != '') { + + //* save new counter value + $system_config['misc']['customer_no_counter']++; + $system_config_str = $app->ini_parser->get_ini_string($system_config); + $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($system_config_str)."'", 'sysini_id', 1); + + } + } parent::onAfterInsert(); } diff --git a/interface/web/client/templates/client_edit_address.htm b/interface/web/client/templates/client_edit_address.htm index 839282072e05e8503b853ca9ce4c4c50e5446614..6149a42d71ab1d7cea4f1e47571e5ee6ff7994de 100644 --- a/interface/web/client/templates/client_edit_address.htm +++ b/interface/web/client/templates/client_edit_address.htm @@ -22,6 +22,7 @@ <div class="ctrlHolder"> <label for="customer_no">{tmpl_var name='customer_no_txt'}</label> <input name="customer_no" id="customer_no" value="{tmpl_var name='customer_no'}" size="30" maxlength="255" type="text" class="textInput" /> + <input name="customer_no_org" id="customer_no_org" value="{tmpl_var name='customer_no'}" type="hidden" /> </div> <div class="ctrlHolder"> <label for="username">{tmpl_var name='username_txt'}*</label> diff --git a/interface/web/client/templates/reseller_edit_address.htm b/interface/web/client/templates/reseller_edit_address.htm index 86acccd822926a0dc6ce331a49f4cd9d1701565e..5495d0adc78f1b5ee47044460107853b192efc07 100644 --- a/interface/web/client/templates/reseller_edit_address.htm +++ b/interface/web/client/templates/reseller_edit_address.htm @@ -22,6 +22,7 @@ <div class="ctrlHolder"> <label for="customer_no">{tmpl_var name='customer_no_txt'}</label> <input name="customer_no" id="customer_no" value="{tmpl_var name='customer_no'}" size="30" maxlength="255" type="text" class="textInput" /> + <input name="customer_no_org" id="customer_no_org" value="{tmpl_var name='customer_no'}" type="hidden" /> </div> <div class="ctrlHolder"> <label for="username">{tmpl_var name='username_txt'}*</label>