From c56175b5781ee8a20bebe3015bcbe8ea68b9c8b7 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Aug 2014 05:04:37 -0400
Subject: [PATCH] Merge branch 'convert_to_reseller' into 'master'

---
 interface/web/client/client_edit.php |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index ecfa30f..5c47fe5 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -96,6 +96,10 @@
 		//* Resellers shall not be able to create another reseller
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			$this->dataRecord['limit_client'] = 0;
+		} else {
+			if($this->dataRecord["reseller"]) {
+				$this->dataRecord["limit_client"] = 1; // allow 1 client, template limits will be applied later, if we set -1 it would override template limits
+			}
 		}
 
 		if($this->id != 0) {
@@ -223,7 +227,7 @@
 		
 		if($app->auth->is_admin()) {
 			// Fill the client select field
-			$sql = "SELECT client.client_id, sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 AND client.limit_client > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
+			$sql = "SELECT client.client_id, sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 AND client.limit_client != 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = "<option value='0'>- ".$app->tform->lng('none_txt')." -</option>";
 			//$tmp_data_record = $app->tform->getDataRecord($this->id);

--
Gitblit v1.9.1