Merge pull request #16039 from ATM-Consulting/fix/12.0_ticket_extrafields_of_type_date_are_not_saved

FIX 12.0 - ticket extrafields of type 'date' are not saved
This commit is contained in:
Laurent Destailleur 2021-01-21 18:27:36 +01:00 committed by GitHub
commit 0e684abceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -560,17 +560,21 @@ if (empty($reshook)) {
// Action to update one extrafield
if ($action == "update_extras" && !empty($permissiontoadd)) {
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
$attributekey = GETPOST('attribute', 'alpha');
$attributekeylong = 'options_' . $attributekey;
$object->array_options['options_' . $attributekey] = GETPOST($attributekeylong, ' alpha');
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
if ($result > 0) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
} else {
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
if ($ret < 0) $error++;
if (!$error)
{
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
if ($result < 0) { $error++; }
}
if ($error) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit_extras';
} else {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
}
}