FIX Error management during bank account creation

This commit is contained in:
Laurent Destailleur 2017-02-27 11:16:46 +01:00
parent 0f8a8869cb
commit 024cecec29

View File

@ -60,9 +60,11 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($account->table_element);
/*
* Actions
*/
if ($_POST["action"] == 'add')
{
$error=0;
@ -129,6 +131,8 @@ if ($_POST["action"] == 'add')
if (! $error)
{
$db->begin();
$id = $account->create($user);
if ($id > 0)
{
@ -137,8 +141,13 @@ if ($_POST["action"] == 'add')
$account->setCategories($categories);
$_GET["id"]=$id; // Force chargement page en mode visu
$action='';
$db->commit();
}
else {
$db->rollback();
setEventMessages($account->error, $account->errors, 'errors');
$action='create'; // Force chargement page en mode creation
}