FIX: contact card: single extrafield update failed
This commit is contained in:
parent
6167d8a02c
commit
1c43617d93
@ -479,6 +479,29 @@ if (empty($reshook))
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Update extrafields
|
||||
if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) {
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->insertExtraFields('CONTACT_MODIFY');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'CONTACT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
|
||||
@ -150,6 +150,9 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
|
||||
if ($object->element == 'productlot') $permok = $user->rights->stock->creer;
|
||||
if ($object->element == 'facturerec') $permok = $user->rights->facture->creer;
|
||||
if ($object->element == 'mo') $permok = $user->rights->mrp->write;
|
||||
if ($object->element == 'contact') {
|
||||
$permok = $user->rights->societe->contact->creer;
|
||||
}
|
||||
|
||||
$isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0));
|
||||
if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra]))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user