From 3d96c53b303cfd720a44ad6f825eb94f7c4a3ca3 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 20 Nov 2013 13:07:50 -0500
Subject: [PATCH] - Function to increment the customer number automatically - Added fields to client, reseller and website to show when a record was added and by which user

---
 interface/web/client/reseller_edit.php |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index 6c67aee..20273b7 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -139,6 +139,25 @@
 		}
 
 		$app->tpl->setVar('template_additional_list', $text);
+		
+		//* Set the 'customer no' default value
+		if($this->id == 0) {
+			//* get the system config
+			$app->uses('getconf');
+			$system_config = $app->getconf->get_global_config();
+			if($system_config['misc']['customer_no_template'] != '') {
+				
+				//* Set customer no default
+				$customer_no = $app->functions->intval($system_config['misc']['customer_no_start']+$system_config['misc']['customer_no_counter']);
+				$customer_no_string = str_replace('[CUSTOMER_NO]',$customer_no,$system_config['misc']['customer_no_template']);
+				$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);
+			}
+		}
 
 		parent::onShowEnd();
 

--
Gitblit v1.9.1