FIX Missing transaction

This commit is contained in:
Laurent Destailleur 2019-08-18 18:56:21 +02:00
parent 2ddf7c1d1f
commit 8cf0671804

View File

@ -236,8 +236,13 @@ if ($action == 'update')
$error++; $error++;
} }
$db->begin();
if (! $error)
{
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
}
if (! $error) if (! $error)
{ {
@ -252,10 +257,20 @@ if ($action == 'update')
} }
else else
{ {
$error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action='edit'; // Force chargement page edition $action='edit'; // Force chargement page edition
} }
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer) if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)