Merge pull request #20457 from marc-dll/13.0_FIX_contact_single_extrafields_edit

FIX: contact card: single extrafield update failed
This commit is contained in:
Laurent Destailleur 2022-03-24 19:45:19 +01:00 committed by GitHub
commit 44ec8dd2b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -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';

View File

@ -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]))