From 7cf3e98090a3e9f0a9cc960d07c5f259adab6a19 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 08:39:08 -0500
Subject: [PATCH] Merge remote-tracking branch 'origin/stable-3.0.5'

---
 interface/web/sites/web_vhost_subdomain_edit.php |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index a2c9da0..27a4d39 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -440,9 +440,16 @@
             if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
             if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
             if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+			
+			// only generate quota and traffic warnings if value has changed
+			if($this->id > 0) {
+				$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+			} else {
+				$old_web_values = $_POST;
+			}
 
 			//* Check the traffic quota of the client
-			if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0) {
+			if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
 				$tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
 				$trafficquota = $tmp["trafficquota"];
 				$new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
@@ -462,7 +469,7 @@
 				$reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
 
 				//* Check the traffic quota of the client
-				if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0) {
+				if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) {
 					$tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
 					$trafficquota = $tmp["trafficquota"];
 					$new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);

--
Gitblit v1.9.1