Skip to content

Commit 3ba072a

Browse files
committed
Add condition for new form, and unlimited quota
1 parent 3ce8e22 commit 3ba072a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

interface/web/mail/mail_user_edit.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,16 @@ function onShowEnd() {
143143
$global_config = $app->getconf->get_global_config();
144144
$app->tpl->setVar('show_delete_on_forms', $global_config['misc']['show_delete_on_forms']);
145145

146-
# Fetch current disk usage.
147-
$app->uses('quota_lib');
148-
$clientid = $app->db->queryOneRecord('SELECT `client_id` FROM `sys_group` WHERE `groupid` = ?', $this->dataRecord['sys_groupid']);
149-
$monitor_data = $app->quota_lib->get_mailquota_data($clientid, FALSE, $this->dataRecord['email']);
150-
$app->tpl->setVar("used_percentage", round($monitor_data['used'] * 100 / $this->dataRecord['quota']));
151-
$app->tpl->setVar('used', $app->functions->formatBytes($monitor_data['used'], 0));
152-
146+
if($this->id > 0) {
147+
# Fetch current disk usage.
148+
$app->uses('quota_lib');
149+
$clientid = $app->db->queryOneRecord('SELECT `client_id` FROM `sys_group` WHERE `groupid` = ?', $this->dataRecord['sys_groupid']);
150+
$monitor_data = $app->quota_lib->get_mailquota_data($clientid, FALSE, $this->dataRecord['email']);
151+
if ($this->dataRecord['quota'] != 0) {
152+
$app->tpl->setVar("used_percentage", round($monitor_data['used'] * 100 / $this->dataRecord['quota']));
153+
}
154+
$app->tpl->setVar('used', $app->functions->formatBytes($monitor_data['used'], 0));
155+
}
153156
parent::onShowEnd();
154157
}
155158

0 commit comments

Comments
 (0)