From 0fa20fe42e448e6915ba7499708ac3f4d59fa20b Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 4 Dec 2019 20:52:09 +0100 Subject: [PATCH 01/14] Draft an info tab for the client page #5372 --- interface/web/client/client_edit.php | 24 +++++++++++++++++++ interface/web/client/form/client.tform.php | 7 ++++++ .../web/dashboard/dashlets/databasequota.php | 9 +++++-- .../web/dashboard/dashlets/mailquota.php | 10 ++++++-- interface/web/dashboard/dashlets/quota.php | 10 ++++++-- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index bbc7849f1f..c5fc6be610 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -73,6 +73,30 @@ class page_action extends tform_actions { parent::onShowNew(); } + function onShowEdit() { + global $app, $conf; + chdir('../dashboard'); + + $dashlet_list = array(); + $dashlets = array('databasequota.php', 'limits.php', 'mailquota.php', 'quota.php'); + $current_client_id = $this->id; + + foreach ($dashlets as $file) { + if ($file != '.' && $file != '..' && !is_dir(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file)) { + $dashlet_name = substr($file, 0, -4); + $dashlet_class = 'dashlet_'.$dashlet_name; + include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file; + $dashlet_list[$dashlet_name] = new $dashlet_class; + $dashlets_html .= $dashlet_list[$dashlet_name]->show($current_client_id); + } + } + $app->tpl->setVar('dashlets', $dashlets_html); + + chdir('../client'); + + parent::onShowEdit(); + } + function onSubmit() { global $app, $conf; diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index 5b45ffb972..57d7ae1833 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -46,6 +46,7 @@ $form["db_table"] = "client"; $form["db_table_idx"] = "client_id"; $form["db_history"] = "yes"; $form["tab_default"] = "address"; +$form["tab_default"] = "info"; $form["list_default"] = "client_list.php"; $form["auth"] = 'yes'; @@ -80,6 +81,12 @@ while ($file = @readdir($handle)) { } } +$form["tabs"]['info'] = array ( + 'title' => "Info", + 'width' => 100, + 'template' => "templates/client_edit_info.htm", + 'fields' => array () +); $form["tabs"]['address'] = array ( 'title' => "Address", 'width' => 100, diff --git a/interface/web/dashboard/dashlets/databasequota.php b/interface/web/dashboard/dashlets/databasequota.php index 6439cdee12..541539c8c7 100644 --- a/interface/web/dashboard/dashlets/databasequota.php +++ b/interface/web/dashboard/dashlets/databasequota.php @@ -2,7 +2,7 @@ class dashlet_databasequota { - function show() { + function show($limit_to_client_id = 0) { global $app; //* Loading Template @@ -15,8 +15,13 @@ class dashlet_databasequota { $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_databasequota.lng'; if(is_file($lng_file)) include $lng_file; $tpl->setVar($wb); + if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') { + $client_id = $_SESSION['s']['user']['client_id']; + } else { + $client_id = $limit_to_client_id; + } - $databases = $app->quota_lib->get_databasequota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null); + $databases = $app->quota_lib->get_databasequota_data($client_id); //print_r($databases); $has_databasequota = false; diff --git a/interface/web/dashboard/dashlets/mailquota.php b/interface/web/dashboard/dashlets/mailquota.php index 4629d6a463..15a26178d1 100644 --- a/interface/web/dashboard/dashlets/mailquota.php +++ b/interface/web/dashboard/dashlets/mailquota.php @@ -2,7 +2,7 @@ class dashlet_mailquota { - function show() { + function show($limit_to_client_id = 0) { global $app; //* Loading Template @@ -16,7 +16,13 @@ class dashlet_mailquota { if(is_file($lng_file)) include $lng_file; $tpl->setVar($wb); - $emails = $app->quota_lib->get_mailquota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null); + if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') { + $client_id = $_SESSION['s']['user']['client_id']; + } else { + $client_id = $limit_to_client_id; + } + + $emails = $app->quota_lib->get_mailquota_data($client_id); //print_r($emails); $has_mailquota = false; diff --git a/interface/web/dashboard/dashlets/quota.php b/interface/web/dashboard/dashlets/quota.php index 6ff975b623..e67935d7cd 100644 --- a/interface/web/dashboard/dashlets/quota.php +++ b/interface/web/dashboard/dashlets/quota.php @@ -2,7 +2,7 @@ class dashlet_quota { - function show() { + function show($limit_to_client_id = 0) { global $app; //* Loading Template @@ -16,7 +16,13 @@ class dashlet_quota { if(is_file($lng_file)) include $lng_file; $tpl->setVar($wb); - $sites = $app->quota_lib->get_quota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null); + if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') { + $client_id = $_SESSION['s']['user']['client_id']; + } else { + $client_id = $limit_to_client_id; + } + + $sites = $app->quota_lib->get_quota_data($client_id); //print_r($sites); $has_quota = false; -- GitLab From 51ae28346b5cde079211cb7513d7dc2c7b421c26 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 4 Dec 2019 20:57:46 +0100 Subject: [PATCH 02/14] Add draft template for #5372 --- .../web/client/templates/client_edit_info.htm | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 interface/web/client/templates/client_edit_info.htm diff --git a/interface/web/client/templates/client_edit_info.htm b/interface/web/client/templates/client_edit_info.htm new file mode 100644 index 0000000000..3a1a07c057 --- /dev/null +++ b/interface/web/client/templates/client_edit_info.htm @@ -0,0 +1,30 @@ + + +

+ + Client info +
+
+
+
-- GitLab From 169a4800b139038072d65159a2cb4a31ace78420 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 20 Dec 2019 15:10:45 +0100 Subject: [PATCH 03/14] Prepare the limits table to be show for an admin or reseller but with client data, #5372 --- interface/lib/classes/tform_base.inc.php | 20 +++++++++++++----- interface/web/dashboard/dashlets/limits.php | 23 ++++++++++++++------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php index e6174d2da7..15219c5110 100644 --- a/interface/lib/classes/tform_base.inc.php +++ b/interface/lib/classes/tform_base.inc.php @@ -1548,17 +1548,27 @@ class tform_base { return true; } - function getAuthSQL($perm, $table = '') { - if($_SESSION["s"]["user"]["typ"] == 'admin' || $_SESSION['s']['user']['mailuser_id'] > 0) { + function getAuthSQL($perm, $table = '', $userid = NULL, $groups = NULL) { + if(($_SESSION["s"]["user"]["typ"] == 'admin' || $_SESSION['s']['user']['mailuser_id'] > 0 ) && $userid == NULL && $groups == NULL) { return '1'; } else { if ($table != ''){ $table = ' ' . $table . '.'; } - $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0; $sql = '('; - $sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR "; - $sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR "; + if ($userid === NULL) { + $userid = $_SESSION["s"]["user"]["userid"]; + } + if ($userid > 0) { + $sql .= "(" . $table . "sys_userid = ".$userid." AND " . $table . "sys_perm_user like '%$perm%') OR "; + } + + if ($groups === NULL) { + $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0; + } + if ($groups > 0) { + $sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR "; + } $sql .= $table . "sys_perm_other like '%$perm%'"; $sql .= ')'; diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php index 62cd2db358..a85d877e8b 100644 --- a/interface/web/dashboard/dashlets/limits.php +++ b/interface/web/dashboard/dashlets/limits.php @@ -2,7 +2,7 @@ class dashlet_limits { - function show() { + function show($limit_to_client_id = 0) { global $app, $conf; $limits = array(); @@ -148,6 +148,12 @@ class dashlet_limits { $client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); } + if ($limit_to_client_id == 0 || !$app->auth->is_admin()) { + $client_id = $_SESSION['s']['user']['client_id']; + } else { + $client_id = $limit_to_client_id; + } + $rows = array(); foreach($limits as $limit) { $field = $limit['field']; @@ -159,10 +165,10 @@ class dashlet_limits { if($value != 0 || $value == $wb['unlimited_txt']) { $value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value; if($limit['q_type']!=''){ - $usage = $this->_get_assigned_quota($limit) . " MB"; + $usage = $this->_get_assigned_quota($limit, $client_id) . " MB"; $value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value . " MB"; } - else $usage = $this->_get_limit_usage($limit); + else $usage = $this->_get_limit_usage($limit, $client_id); $percentage = ($value == '-1' || $value == 0 ? 0 : round(100 * $usage / $value)); $rows[] = array('field' => $field, 'field_txt' => $wb[$field.'_txt'], @@ -181,23 +187,26 @@ class dashlet_limits { } - function _get_limit_usage($limit) { + function _get_limit_usage($limit, $limit_to_client_id) { global $app; $sql = "SELECT count(sys_userid) as number FROM ?? WHERE "; if($limit['db_where'] != '') $sql .= $limit['db_where']." AND "; - $sql .= $app->tform->getAuthSQL('r'); + $sql .= $app->tform->getAuthSQL('r', '', $limit_to_client_id); + // TEST to show reseller data. + //$sql .= $app->tform->getAuthSQL('r', '', 0, '3,28,39'); + //echo $sql; $rec = $app->db->queryOneRecord($sql, $limit['db_table']); return $rec['number']; } - function _get_assigned_quota($limit) { + function _get_assigned_quota($limit, $limit_to_client_id) { global $app; $sql = "SELECT sum(??) as number FROM ?? WHERE "; if($limit['db_where'] != '') $sql .= $limit['db_where']." AND "; - $sql .= $app->tform->getAuthSQL('r'); + $sql .= $app->tform->getAuthSQL('r', '', $limit_to_client_id); $rec = $app->db->queryOneRecord($sql, $limit['q_type'], $limit['db_table']); if($limit['db_table']=='mail_user') $quotaMB = $rec['number'] / 1048576; // Mail quota is in bytes, must be converted to MB else $quotaMB = $rec['number']; -- GitLab From bd9153a263dced8f4e2dc9ff02fd68a0b92a953d Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 1 Jan 2021 22:11:57 +0100 Subject: [PATCH 04/14] Add id field to client into tab, #5372 This solved 'You dont have the permission to view this record or this record does not exist!' when switchign tabs. --- interface/web/client/templates/client_edit_info.htm | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/web/client/templates/client_edit_info.htm b/interface/web/client/templates/client_edit_info.htm index 3a1a07c057..e1b2215b08 100644 --- a/interface/web/client/templates/client_edit_info.htm +++ b/interface/web/client/templates/client_edit_info.htm @@ -1,3 +1,4 @@ + - - -- GitLab From 1531f70684e2cc79a3bc9a39c0c9bf3b7ffe4884 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 23 Oct 2022 21:33:28 +0200 Subject: [PATCH 06/14] remove duplicate tab_default --- interface/web/client/form/client.tform.php | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index e49103d0b7..702e87e0bf 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -45,7 +45,6 @@ $form["action"] = "client_edit.php"; $form["db_table"] = "client"; $form["db_table_idx"] = "client_id"; $form["db_history"] = "yes"; -$form["tab_default"] = "address"; $form["tab_default"] = "info"; $form["list_default"] = "client_list.php"; $form["auth"] = 'yes'; -- GitLab From 321f7cc950e2e8087228a5795082603347849960 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Mon, 24 Oct 2022 22:15:08 +0200 Subject: [PATCH 07/14] Fix client_id selection --- interface/web/client/client_edit.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index 05f99850a7..9108f57fe2 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -94,8 +94,7 @@ class page_action extends tform_actions { chdir('../client'); - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $tmp = $app->db->queryOneRecord("SELECT company_name, contact_firstname, contact_name, email FROM client WHERE sys_groupid = ?", $client_group_id); + $tmp = $app->db->queryOneRecord("SELECT company_name, contact_firstname, contact_name, email FROM client WHERE sys_groupid = ?", $current_client_id); $app->tpl->setVar('company_name', $tmp['company_name']); $app->tpl->setVar('contact_name', $tmp['contact_name']); $app->tpl->setVar('email', $tmp['email']); -- GitLab From 1187bc2b61aa9ece01da561030e8c81df69317cf Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Mon, 24 Oct 2022 22:22:26 +0200 Subject: [PATCH 08/14] Make names in the Website Harddisk Quota dashlet a link to the edit form --- interface/web/dashboard/dashlets/templates/quota.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/dashboard/dashlets/templates/quota.htm b/interface/web/dashboard/dashlets/templates/quota.htm index fe006c2087..6014467e80 100644 --- a/interface/web/dashboard/dashlets/templates/quota.htm +++ b/interface/web/dashboard/dashlets/templates/quota.htm @@ -12,7 +12,7 @@ - {tmpl_var name='domain'} + {tmpl_var name='domain'} {tmpl_var name='used'} {tmpl_var name='soft'} {tmpl_var name='hard'} -- GitLab From f8ad820076dfa82367680ff50179439e23b8ae62 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Mon, 24 Oct 2022 22:25:44 +0200 Subject: [PATCH 09/14] Make names in the Database Quota dashlet a link to the edit form --- interface/web/dashboard/dashlets/templates/databasequota.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/dashboard/dashlets/templates/databasequota.htm b/interface/web/dashboard/dashlets/templates/databasequota.htm index 082dd1f8c0..e4c1d493bb 100644 --- a/interface/web/dashboard/dashlets/templates/databasequota.htm +++ b/interface/web/dashboard/dashlets/templates/databasequota.htm @@ -11,7 +11,7 @@ - {tmpl_var name='database_name'} + {tmpl_var name='database_name'} {tmpl_var name='used'} {tmpl_var name='database_quota'} {tmpl_if name="quota_raw" op="!=" value="0"} -- GitLab From 55485d16e754c10233a5064b7fdf0d7f575a601b Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 28 Oct 2022 20:43:49 +0200 Subject: [PATCH 10/14] Fix client selection --- interface/web/client/client_edit.php | 2 +- interface/web/dashboard/dashlets/limits.php | 24 ++++++--------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index 9108f57fe2..b1c96e0679 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -94,7 +94,7 @@ class page_action extends tform_actions { chdir('../client'); - $tmp = $app->db->queryOneRecord("SELECT company_name, contact_firstname, contact_name, email FROM client WHERE sys_groupid = ?", $current_client_id); + $tmp = $app->db->queryOneRecord("SELECT company_name, contact_firstname, contact_name, email FROM client WHERE client_id = ?", $current_client_id); $app->tpl->setVar('company_name', $tmp['company_name']); $app->tpl->setVar('contact_name', $tmp['contact_name']); $app->tpl->setVar('email', $tmp['email']); diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php index 114e96b7b6..d68015dd11 100644 --- a/interface/web/dashboard/dashlets/limits.php +++ b/interface/web/dashboard/dashlets/limits.php @@ -147,32 +147,20 @@ class dashlet_limits } $tpl->setVar($wb); - if ($app->auth->is_admin()) { - $user_is_admin = true; - } else { - $user_is_admin = false; - } - $tpl->setVar('is_admin', $user_is_admin); - - if ($user_is_admin == false) { - $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); - } - - if ($limit_to_client_id == 0 || !$app->auth->is_admin()) { + if ($limit_to_client_id == 0) { $client_id = $_SESSION['s']['user']['client_id']; } else { $client_id = $limit_to_client_id; } + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); + $client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", $client_id); + + $rows = array(); foreach ($limits as $limit) { $field = $limit['field']; - if ($user_is_admin) { - $value = $wb['unlimited_txt']; - } else { - $value = $client[$field]; - } + $value = $client[$field]; if ($value != 0 || $value == $wb['unlimited_txt']) { $value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value; if (isset($limit['q_type']) && $limit['q_type'] != '') { -- GitLab From f68f9f06c4f2c427ee10c68b32eedf8d8f61f110 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 27 Nov 2022 22:26:12 +0100 Subject: [PATCH 11/14] Fix dashlets for admin. --- interface/web/dashboard/dashlets/databasequota.php | 4 ++-- interface/web/dashboard/dashlets/limits.php | 8 ++++++++ interface/web/dashboard/dashlets/mailquota.php | 4 ++-- interface/web/dashboard/dashlets/quota.php | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/interface/web/dashboard/dashlets/databasequota.php b/interface/web/dashboard/dashlets/databasequota.php index ca8a70dd31..641dfd7784 100644 --- a/interface/web/dashboard/dashlets/databasequota.php +++ b/interface/web/dashboard/dashlets/databasequota.php @@ -2,7 +2,7 @@ class dashlet_databasequota { - function show($limit_to_client_id = 0) { + function show($limit_to_client_id = null) { global $app; //* Loading Template @@ -23,7 +23,7 @@ class dashlet_databasequota { $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_databasequota.lng'; if(is_file($lng_file)) include $lng_file; $tpl->setVar($wb); - if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') { + if ($_SESSION["s"]["user"]["typ"] != 'admin') { $client_id = $_SESSION['s']['user']['client_id']; } else { $client_id = $limit_to_client_id; diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php index d68015dd11..79ac2126c8 100644 --- a/interface/web/dashboard/dashlets/limits.php +++ b/interface/web/dashboard/dashlets/limits.php @@ -149,8 +149,10 @@ class dashlet_limits if ($limit_to_client_id == 0) { $client_id = $_SESSION['s']['user']['client_id']; + $user_is_admin = true; } else { $client_id = $limit_to_client_id; + $user_is_admin = false; } $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); @@ -161,6 +163,12 @@ class dashlet_limits foreach ($limits as $limit) { $field = $limit['field']; $value = $client[$field]; + if ($user_is_admin) { + $value = $wb['unlimited_txt']; + } else { + $value = $client[$field]; + } + if ($value != 0 || $value == $wb['unlimited_txt']) { $value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value; if (isset($limit['q_type']) && $limit['q_type'] != '') { diff --git a/interface/web/dashboard/dashlets/mailquota.php b/interface/web/dashboard/dashlets/mailquota.php index 784e6b1c87..b310cc1dcb 100644 --- a/interface/web/dashboard/dashlets/mailquota.php +++ b/interface/web/dashboard/dashlets/mailquota.php @@ -2,7 +2,7 @@ class dashlet_mailquota { - function show($limit_to_client_id = 0) { + function show($limit_to_client_id = null) { global $app; //* Loading Template @@ -16,7 +16,7 @@ class dashlet_mailquota { if(is_file($lng_file)) include $lng_file; $tpl->setVar($wb); - if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') { + if ($_SESSION["s"]["user"]["typ"] != 'admin') { $client_id = $_SESSION['s']['user']['client_id']; } else { $client_id = $limit_to_client_id; diff --git a/interface/web/dashboard/dashlets/quota.php b/interface/web/dashboard/dashlets/quota.php index 6380e18d87..3225bd304f 100644 --- a/interface/web/dashboard/dashlets/quota.php +++ b/interface/web/dashboard/dashlets/quota.php @@ -2,7 +2,7 @@ class dashlet_quota { - function show($limit_to_client_id = 0) { + function show($limit_to_client_id = null) { global $app; //* Loading Template @@ -24,7 +24,7 @@ class dashlet_quota { if(is_file($lng_file)) include $lng_file; $tpl->setVar($wb); - if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') { + if ($_SESSION["s"]["user"]["typ"] != 'admin') { $client_id = $_SESSION['s']['user']['client_id']; } else { $client_id = $limit_to_client_id; -- GitLab From 512c58e1e6b7c96c83a1f75e18a7f834be6550a9 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 27 Nov 2022 22:36:55 +0100 Subject: [PATCH 12/14] Unlimited quota is stored as -1, not zero, #6417 --- interface/lib/classes/quota_lib.inc.php | 2 +- interface/web/dashboard/dashlets/templates/databasequota.htm | 2 +- interface/web/dashboard/dashlets/templates/mailquota.htm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index b02cdea994..063d128b66 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -326,7 +326,7 @@ class quota_lib { if($used_ratio >= 0.8) $databases[$i]['display_colour'] = '#fd934f'; if($used_ratio >= 1) $databases[$i]['display_colour'] = '#cc0000'; - if($databases[$i]['database_quota'] == 0){ + if($databases[$i]['database_quota'] == -1) { $databases[$i]['database_quota'] = $app->lng('unlimited_txt'); } else { $databases[$i]['database_quota'] = $databases[$i]['database_quota'] . ' MB'; diff --git a/interface/web/dashboard/dashlets/templates/databasequota.htm b/interface/web/dashboard/dashlets/templates/databasequota.htm index e4c1d493bb..e6fe773f15 100644 --- a/interface/web/dashboard/dashlets/templates/databasequota.htm +++ b/interface/web/dashboard/dashlets/templates/databasequota.htm @@ -14,7 +14,7 @@ {tmpl_var name='database_name'} {tmpl_var name='used'} {tmpl_var name='database_quota'} - {tmpl_if name="quota_raw" op="!=" value="0"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='database_quota'} diff --git a/interface/web/dashboard/dashlets/templates/mailquota.htm b/interface/web/dashboard/dashlets/templates/mailquota.htm index 9013c7ac3b..81a82f5349 100644 --- a/interface/web/dashboard/dashlets/templates/mailquota.htm +++ b/interface/web/dashboard/dashlets/templates/mailquota.htm @@ -16,7 +16,7 @@ {tmpl_var name='name'} {tmpl_var name='used'} {tmpl_var name='quota'} - {tmpl_if name="quota_raw" op="!=" value="0"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='quota'} -- GitLab From 00b142be01e94aa66867965b17e0957616b8d81a Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 27 Nov 2022 22:51:13 +0100 Subject: [PATCH 13/14] tabs --- interface/lib/classes/quota_lib.inc.php | 2 +- interface/web/dashboard/dashlets/templates/databasequota.htm | 2 +- interface/web/dashboard/dashlets/templates/mailquota.htm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index 063d128b66..7c5b388536 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -326,7 +326,7 @@ class quota_lib { if($used_ratio >= 0.8) $databases[$i]['display_colour'] = '#fd934f'; if($used_ratio >= 1) $databases[$i]['display_colour'] = '#cc0000'; - if($databases[$i]['database_quota'] == -1) { + if($databases[$i]['database_quota'] == -1) { $databases[$i]['database_quota'] = $app->lng('unlimited_txt'); } else { $databases[$i]['database_quota'] = $databases[$i]['database_quota'] . ' MB'; diff --git a/interface/web/dashboard/dashlets/templates/databasequota.htm b/interface/web/dashboard/dashlets/templates/databasequota.htm index e6fe773f15..a2ecc2e47d 100644 --- a/interface/web/dashboard/dashlets/templates/databasequota.htm +++ b/interface/web/dashboard/dashlets/templates/databasequota.htm @@ -14,7 +14,7 @@ {tmpl_var name='database_name'} {tmpl_var name='used'} {tmpl_var name='database_quota'} - {tmpl_if name="quota_raw" op="!=" value="-1"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='database_quota'} diff --git a/interface/web/dashboard/dashlets/templates/mailquota.htm b/interface/web/dashboard/dashlets/templates/mailquota.htm index 81a82f5349..08834fa5ab 100644 --- a/interface/web/dashboard/dashlets/templates/mailquota.htm +++ b/interface/web/dashboard/dashlets/templates/mailquota.htm @@ -16,7 +16,7 @@ {tmpl_var name='name'} {tmpl_var name='used'} {tmpl_var name='quota'} - {tmpl_if name="quota_raw" op="!=" value="-1"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='quota'} -- GitLab From ba4c321b79869531a3d347d66dca62d93a3baa8d Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Thu, 20 Apr 2023 22:50:26 +0200 Subject: [PATCH 14/14] Hide the info tab when creating a new client. --- interface/web/client/client_edit.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index b1c96e0679..1e53bb1fed 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -70,6 +70,10 @@ class page_action extends tform_actions { } } + // Hide the info tab when creating a new client. + unset($app->tform->formDef["tabs"]['info']); + $app->tform->formDef["tab_default"] = "address"; + parent::onShowNew(); } -- GitLab