From d9bcf68e395d6156645a7974b1a992aa6e6c00aa Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 14 Oct 2013 08:57:25 -0400
Subject: [PATCH] Added missing empty directories from svn import

---
 interface/web/client/client_edit.php |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 2becb95..ab33d9e 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -102,7 +102,7 @@
                 foreach($tpls as $item) {
                     $item = trim($item);
                     if(!$item) continue;
-                    $this->oldTemplatesAssigned[] = array('assigned_templated_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
+                    $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
                 }
                 unset($tpls);
             }
@@ -228,8 +228,10 @@
 		$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);
 		
-        $app->uses('client_templates');
-        $app->client_templates->update_client_templates($this->id, $this->_template_additional);
+        if(isset($this->dataRecord['template_master'])) {
+            $app->uses('client_templates');
+            $app->client_templates->update_client_templates($this->id, $this->_template_additional);
+        }
 
 		parent::onAfterInsert();
 	}
@@ -351,12 +353,12 @@
         }
         
         if(!isset($this->dataRecord['canceled'])) $this->dataRecord['canceled'] = 'n';
-        if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["canceled"]) && $this->dataRecord["canceled"] != $this->oldDataRecord['canceled']) {
+        if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["canceled"] != $this->oldDataRecord['canceled']) {
             if($this->dataRecord['canceled'] == 'y') {
-                $sql = "UPDATE sys_user SET active = 'n' WHERE client_id = " . $this->id;
+                $sql = "UPDATE sys_user SET active = '0' WHERE client_id = " . $this->id;
                 $app->db->query($sql);
             } elseif($this->dataRecord['canceled'] == 'n') {
-                $sql = "UPDATE sys_user SET active = 'y' WHERE client_id = " . $this->id;
+                $sql = "UPDATE sys_user SET active = '1' WHERE client_id = " . $this->id;
                 $app->db->query($sql);
             }
         }
@@ -379,8 +381,10 @@
 			$app->db->query($sql);
 		}
 		
-        $app->uses('client_templates');
-        $app->client_templates->update_client_templates($this->id, $this->_template_additional);
+        if(isset($this->dataRecord['template_master'])) {
+            $app->uses('client_templates');
+            $app->client_templates->update_client_templates($this->id, $this->_template_additional);
+        }
         
 		parent::onAfterUpdate();
 	}

--
Gitblit v1.9.1