diff options
author | Timotheus Pokorra (Tbits.net) <tp@tbits.net> | 2013-06-25 14:58:51 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-06-25 14:58:51 +0100 |
commit | 1ee1a17592e8cf53c5c1c6674bfd57d041f9e18e (patch) | |
tree | 04d40c946e934da1f1bce6948cbf7b0f19862a9d /lib/api/kolab_api_service_user.php | |
parent | d181a4079f8c6a3ad998b4f05372683e2b1edd5e (diff) | |
download | webadmin-1ee1a17592e8cf53c5c1c6674bfd57d041f9e18e.tar.gz |
In Kolab 3, the mail quota is displayed in KB.
A quota of 2 GB becomes 2*1024*1024 = 2097152
This is quite difficult to read and to calculate as well.
The attached patch finds the closest unit that works without cutting something off (only use the next unit if modulo is 0).
The admin is presented a select box for KB, MB and GB.
The value is displayed either in KB, MB or GB.
When saving, the value is replaced again with the KB value, depending on the selected unit.
See: https://issues.kolab.org/show_bug.cgi?id=1966
Diffstat (limited to 'lib/api/kolab_api_service_user.php')
-rw-r--r-- | lib/api/kolab_api_service_user.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php index 9e4cdde..96ef4f7 100644 --- a/lib/api/kolab_api_service_user.php +++ b/lib/api/kolab_api_service_user.php @@ -125,6 +125,13 @@ class kolab_api_service_user extends kolab_api_service { //console("\$postdata to user_edit()", $postdata); + if ($postdata['mailquota-unit'] == 'gb') { + $postdata['mailquota'] *= 1024*1024; + } + if ($postdata['mailquota-unit'] == 'mb') { + $postdata['mailquota'] *= 1024; + } + $user_attributes = $this->parse_input_attributes('user', $postdata); $user = $postdata['id']; |