Skip to content

Commit a3014ea

Browse files
committed
Fixed: FS#933 - Resseler's services problem with client number.
Additionally fixed a bug in web quota calculation.
1 parent bd06baf commit a3014ea

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

interface/web/dns/dns_soa_edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ function onShowEnd() {
9393
// Fill the client select field
9494
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
9595
$clients = $app->db->queryAllRecords($sql);
96-
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
96+
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
97+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
9798
$tmp_data_record = $app->tform->getDataRecord($this->id);
9899
if(is_array($clients)) {
99100
foreach( $clients as $client) {

interface/web/dns/dns_wizard.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
// load the list of clients
106106
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
107107
$clients = $app->db->queryAllRecords($sql);
108-
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
108+
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
109+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
109110
if(is_array($clients)) {
110111
foreach( $clients as $client) {
111112
$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';

interface/web/mail/mail_domain_edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ function onShowEnd() {
103103
// Fill the client select field
104104
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
105105
$clients = $app->db->queryAllRecords($sql);
106-
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
106+
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
107+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
107108
$tmp_data_record = $app->tform->getDataRecord($this->id);
108109
if(is_array($clients)) {
109110
foreach( $clients as $client) {

interface/web/mail/mail_user_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function onSubmit() {
150150

151151
// Check the quota and adjust
152152
if(isset($_POST["quota"]) && $client["limit_mailquota"] >= 0) {
153-
$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
153+
$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
154154
$mailquota = $tmp["mailquota"] / 1024 / 1024;
155155
$new_mailbox_quota = intval($this->dataRecord["quota"]);
156156
if(($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) || ($new_mailbox_quota == 0 && $client["limit_mailquota"] != -1)) {

interface/web/sites/database_edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ function onShowEnd() {
9595
// Fill the client select field
9696
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
9797
$clients = $app->db->queryAllRecords($sql);
98-
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
98+
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
99+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
99100
$tmp_data_record = $app->tform->getDataRecord($this->id);
100101
if(is_array($clients)) {
101102
foreach( $clients as $client) {

interface/web/sites/lib/lang/en_web_domain.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $wb["apache_directives_txt"] = 'Apache directives';
3838
$wb["domain_error_empty"] = 'Domain is empty.';
3939
$wb["domain_error_unique"] = 'There is already a website or sub / aliasdomain with this domain name.';
4040
$wb["domain_error_regex"] = 'Domain name invalid.';
41-
$wb["hd_quota_error_empty"] = 'Harddisk quota is empty.';
41+
$wb["hd_quota_error_empty"] = 'Harddisk quota is 0 or empty.';
4242
$wb["traffic_quota_error_empty"] = 'Traffic quota is empty.';
4343
$wb['error_ssl_state_empty'] = 'SSL State is empty.';
4444
$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';

interface/web/sites/web_domain_edit.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ function onShowEnd() {
113113
// Fill the client select field
114114
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
115115
$records = $app->db->queryAllRecords($sql);
116-
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
116+
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
117+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
117118
$tmp_data_record = $app->tform->getDataRecord($this->id);
118119
if(is_array($records)) {
119120
foreach( $records as $rec) {
@@ -220,12 +221,13 @@ function onSubmit() {
220221

221222
//* Check the website quota
222223
if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0) {
223-
$tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
224-
$webquota = $tmp["webquota"] / 1024 / 1024;
224+
$tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
225+
$webquota = $tmp["webquota"];
225226
$new_web_quota = intval($this->dataRecord["hd_quota"]);
226227
if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota == -1 && $client["limit_web_quota"] != -1)) {
227228
$max_free_quota = floor($client["limit_web_quota"] - $webquota);
228-
$app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota."<br>";
229+
if($max_free_quota < 0) $max_free_quota = 0;
230+
$app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB<br>";
229231
// Set the quota field to the max free space
230232
$this->dataRecord["hd_quota"] = $max_free_quota;
231233
}

0 commit comments

Comments
 (0)