summaryrefslogtreecommitdiffstats
path: root/lib/kolab_client_task.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-08-26 05:09:40 -0400
committerAleksander Machniak <machniak@kolabsys.com>2014-08-26 05:09:40 -0400
commita21a3ede4bfc20c2b1d14d5aa6656df1c3fd46aa (patch)
treeea8bfab5c6da0de02df88e0775a6a2faad453f4d /lib/kolab_client_task.php
parent7fd434797e24e256bfec7645048767ef9c4d3afe (diff)
downloadwebadmin-a21a3ede4bfc20c2b1d14d5aa6656df1c3fd46aa.tar.gz
Make possible to define default object type (#2587)
Diffstat (limited to 'lib/kolab_client_task.php')
-rw-r--r--lib/kolab_client_task.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index ba653b8..afa4a96 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1021,7 +1021,15 @@ class kolab_client_task
$type = $data['type_id'];
}
else {
- $data['type_id'] = $type = key($types);
+ // find default object type
+ foreach ($types as $type_id => $type) {
+ if ($type['is_default']) {
+ $default = $type_id;
+ break;
+ }
+ }
+
+ $data['type_id'] = $type = isset($default) ? $default : key($types);
}
if ($type) {
@@ -1336,7 +1344,7 @@ class kolab_client_task
$assoc_fields[$idx] = !empty($data[$idx]) ? $data[$idx] : array();
}
- if ($field['type'] == kolab_form::INPUT_CHECKBOX) {
+ if ($field['type'] == kolab_form::INPUT_CHECKBOX && !isset($field['checked'])) {
$field['checked'] = $field['value'] == 'TRUE';
}
/*