summaryrefslogtreecommitdiffstats
path: root/lib/kolab_client_task.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-11-06 05:49:27 -0500
committerAleksander Machniak <machniak@kolabsys.com>2014-11-06 05:49:27 -0500
commit02549fda15a1ba7ebfbacb7b128cab8b528c4f88 (patch)
treed63db229f337bcd35d0e5b58c7b3f51ad506645e /lib/kolab_client_task.php
parente561788b5c9bc243e332c09d86506489deeee796 (diff)
downloadwebadmin-02549fda15a1ba7ebfbacb7b128cab8b528c4f88.tar.gz
Fix re-generating read-only fields on object type change (#2980)kolab-webadmin-3.2.3
Diffstat (limited to 'lib/kolab_client_task.php')
-rw-r--r--lib/kolab_client_task.php49
1 files changed, 31 insertions, 18 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index da0acf5..b784856 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1070,25 +1070,11 @@ class kolab_client_task
$extra_fields[$idx] = true;
- // build auto_attribs and event_fields lists
- $is_data = 0;
+ // build event_fields list
if (!empty($field['data'])) {
- foreach ($field['data'] as $fd) {
- $event_fields[$fd][] = $idx;
- if (isset($data[$fd])) {
- $is_data++;
- }
- }
- if (count($field['data']) == $is_data) {
- $auto_attribs[] = $idx;
- }
- }
- else {
- //console("\$field['data'] is empty for \$auto_fields[\$idx] (idx: $idx)");
- $auto_attribs[] = $idx;
- // Unset the $auto_field array key to prevent the form field from
- // becoming disabled/readonly
- unset($auto_fields[$idx]);
+ foreach ($field['data'] as $fd) {
+ $event_fields[$fd][] = $idx;
+ }
}
}
@@ -1112,6 +1098,33 @@ class kolab_client_task
}
}
+ // Re-parse auto_fields again, to get attributes for auto-generation
+ // Need to do this after form_fields have been initialized (#2980)
+ foreach ($auto_fields as $idx => $field) {
+ // build auto_attribs and event_fields lists
+ if (!empty($field['data'])) {
+ $is_data = 0;
+ foreach ($field['data'] as $fd) {
+ if (!isset($data[$fd]) && isset($fields[$fd]['value'])) {
+ $data[$fd] = $fields[$fd]['value'];
+ }
+ if (isset($data[$fd])) {
+ $is_data++;
+ }
+ }
+
+ if (count($field['data']) == $is_data) {
+ $auto_attribs[] = $idx;
+ }
+ }
+ else {
+ $auto_attribs[] = $idx;
+ // Unset the $auto_fields array key to prevent the form field from
+ // becoming disabled/readonly
+ unset($auto_fields[$idx]);
+ }
+ }
+
// Get the rights on the entry and attribute level
$data['effective_rights'] = $this->effective_rights($name, $data['id']);
$attribute_rights = (array) $data['effective_rights']['attribute'];