summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-05-07 12:17:13 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-05-07 12:17:13 (GMT)
commitd4d304ef770b81277ab4f9060f1599c017b9ddd2 (patch)
tree62b33e6b9f66bedc02022fc1838b60f62cfa1f7c
parentf4a07c96a1de7348441a4ca092f7a5dd5366870f (diff)
downloadkolab-wap-d4d304ef770b81277ab4f9060f1599c017b9ddd2.tar.gz
Pre-fill quota field with default_quota from kolab.conf (#2580)
-rw-r--r--lib/kolab_client_task.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 8efa66d..a90cb13 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1271,7 +1271,9 @@ class kolab_client_task
$req_fields = array();
$writeable = 0;
- $auto_fields = $this->output->get_env('auto_fields');
+ $auto_fields = $this->output->get_env('auto_fields');
+ $conf_aliases = array('mailquota' => 'quota');
+ $domain = $this->domain ?: $_SESSION['user']['domain'];
// Parse elements and add them to the form object
foreach ($sections as $section_idx => $section) {
@@ -1313,11 +1315,19 @@ class kolab_client_task
$field['value'] = $value;
}
- else if ($add_mode && !isset($field['value']) && isset($field['default'])) {
- $field['value'] = $field['default'];
- $default_values[$idx] = $field['default'];
+ else if ($add_mode && !isset($field['value'])) {
+ // read default from config, e.g. default_quota
+ if (!isset($field['default'])) {
+ $conf_name = 'default_' . ($conf_aliases[$idx] ?: $idx);
+ $field['default'] = $this->config->get($domain, $conf_name);
+ }
+
+ if (isset($field['default'])) {
+ $field['value'] = $field['default'];
+ $default_values[$idx] = $field['default'];
- unset($field['default']);
+ unset($field['default']);
+ }
}
// @TODO: We assume here that all autocompletion lists are associative