mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* Addressbook: custom fields of accounts enabled via own-account-acl were not editable
This commit is contained in:
parent
ea0663d531
commit
af157c3218
@ -925,6 +925,11 @@ class addressbook_bo extends addressbook_so
|
||||
}
|
||||
if (isset($contact['org_name'])) $contact['n_fileas'] = $this->fileas($contact, null, false);
|
||||
|
||||
// Get old record for tracking changes
|
||||
if (!isset($old) && $isUpdate)
|
||||
{
|
||||
$old = $this->read($contact['id']);
|
||||
}
|
||||
$to_write = $contact;
|
||||
// (non-admin) user editing his own account, make sure he does not change fields he is not allowed to (eg. via SyncML or xmlrpc)
|
||||
if (!$ignore_acl && !$contact['owner'] && !$this->is_admin($contact))
|
||||
@ -933,16 +938,19 @@ class addressbook_bo extends addressbook_so
|
||||
{
|
||||
if (!in_array($field,$this->own_account_acl) && !in_array($field,array('id','owner','account_id','modified','modifier')))
|
||||
{
|
||||
unset($to_write[$field]); // user is now allowed to change that
|
||||
// user is not allowed to change that
|
||||
if ($old)
|
||||
{
|
||||
$to_write[$field] = $old[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($to_write[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get old record for tracking changes
|
||||
if (!isset($old) && $isUpdate)
|
||||
{
|
||||
$old = $this->read($contact['id']);
|
||||
}
|
||||
// IF THE OLD ENTRY IS A ACCOUNT, dont allow to change the owner/location
|
||||
// maybe we need that for id and account_id as well.
|
||||
if (is_array($old) && (!isset($old['owner']) || empty($old['owner'])))
|
||||
|
@ -150,9 +150,9 @@ class addressbook_tracking extends bo_tracking
|
||||
foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code)
|
||||
{
|
||||
// Only codes involved, but old text name is automatically added when loaded
|
||||
if($old[$code] && $data[$code])
|
||||
if($old[$code] && $data[$code] && ($key = array_search($name, $changed_fields)) !== false)
|
||||
{
|
||||
unset($changed_fields[array_search($name, $changed_fields)]);
|
||||
unset($changed_fields[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -347,8 +347,7 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
|
||||
$form_name = self::GLOBAL_ID;
|
||||
}
|
||||
|
||||
if (!$this->is_readonly($cname, $form_name))
|
||||
{
|
||||
$all_readonly = $this->is_readonly($cname, $form_name);
|
||||
$value_in = self::get_array($content, $form_name);
|
||||
// if we have no id / use self::GLOBAL_ID, we have to set $value_in in global namespace for regular widgets validation to find
|
||||
if (!$this->id) $content = array_merge($content, $value_in);
|
||||
@ -367,7 +366,9 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
|
||||
}
|
||||
|
||||
// check if single field is set readonly, used in apps as it was only way to make cfs readonly in old eT
|
||||
if ($this->is_readonly($form_name != self::GLOBAL_ID ? $form_name : $cname, $field))
|
||||
// single fields set to false in $readonly overwrite a global __ALL__
|
||||
$cf_readonly = $this->is_readonly($form_name != self::GLOBAL_ID ? $form_name : $cname, $field);
|
||||
if ($cf_readonly || $all_readonly && $cf_readonly !== false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -399,4 +400,3 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,8 +200,7 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput
|
||||
'id': id,
|
||||
'statustext': field.help,
|
||||
'needed': field.needed,
|
||||
'readonly': this.options.readonly ||
|
||||
this.getArrayMgr("readonlys").isReadOnly(id),
|
||||
'readonly': this.getArrayMgr("readonlys").isReadOnly(id, null, this.options.readonly),
|
||||
'value': this.options.value[this.prefix+field_name]
|
||||
};
|
||||
// Can't have a required readonly, it will warn & be removed later, so avoid the warning
|
||||
|
Loading…
Reference in New Issue
Block a user