Merge pull request #16948 from hregis/fix_return_edit_mode_if_update_error

FIX missing return edit if update error
This commit is contained in:
Laurent Destailleur 2021-03-25 01:04:03 +01:00 committed by GitHub
commit c5d9c1481a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -303,7 +303,9 @@ if (empty($reshook)) {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
// Check if we need to also synchronize user information // Check if we need to also synchronize user information
$nosyncuser = 0; $nosyncuser = 0;
@ -317,6 +319,7 @@ if (empty($reshook)) {
if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing
} }
if (!$error) {
$result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
if ($result >= 0 && !count($object->errors)) { if ($result >= 0 && !count($object->errors)) {
@ -377,6 +380,9 @@ if (empty($reshook)) {
} else { } else {
$action = 'edit'; $action = 'edit';
} }
} else {
$action = 'edit';
}
} }
if ($action == 'add' && $user->rights->adherent->creer) { if ($action == 'add' && $user->rights->adherent->creer) {