add more tests for Email-ApiCommands
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -103,24 +103,6 @@ abstract class ApiParameter
|
||||
return $param_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* update value of parameter
|
||||
*
|
||||
* @param string $param
|
||||
* @param mixed $value
|
||||
*
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
protected function updateParam($param, $value = null)
|
||||
{
|
||||
if (isset($this->cmd_params[$param])) {
|
||||
$this->cmd_params[$param] = $value;
|
||||
return true;
|
||||
}
|
||||
throw new Exception("Unable to update parameter '" . $param . "' as it does not exist", 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* return list of all parameters
|
||||
*
|
||||
|
||||
@@ -317,15 +317,20 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
||||
}
|
||||
}
|
||||
|
||||
if ($quota != $result['quota']) {
|
||||
if ($customer['email_quota'] != '-1' && ($quota == 0 || ($quota + $customer['email_quota_used'] - $result['quota']) > $customer['email_quota'])) {
|
||||
standard_error('allocatetoomuchquota', $quota, true);
|
||||
if (Settings::Get('system.mail_quota_enabled') == 1) {
|
||||
if ($quota != $result['quota']) {
|
||||
if ($customer['email_quota'] != '-1' && ($quota == 0 || ($quota + $customer['email_quota_used'] - $result['quota']) > $customer['email_quota'])) {
|
||||
standard_error('allocatetoomuchquota', $quota, true);
|
||||
}
|
||||
if (! empty($upd_query)) {
|
||||
$upd_query .= ", ";
|
||||
}
|
||||
$upd_query .= "`quota` = :quota";
|
||||
$upd_params['quota'] = $quota;
|
||||
}
|
||||
if (! empty($upd_query)) {
|
||||
$upd_query .= ", ";
|
||||
}
|
||||
$upd_query .= "`quota` = :quota";
|
||||
$upd_params['quota'] = $quota;
|
||||
} else {
|
||||
// disable
|
||||
$quota = 0;
|
||||
}
|
||||
|
||||
// build update query
|
||||
@@ -416,6 +421,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
||||
"id" => $id
|
||||
);
|
||||
Database::pexecute($stmt, $params, true, true);
|
||||
$result['popaccountid'] = 0;
|
||||
|
||||
if (Settings::Get('system.mail_quota_enabled') == '1' && $customer['email_quota'] != '-1') {
|
||||
$quota = (int) $result['quota'];
|
||||
|
||||
Reference in New Issue
Block a user