Skip to content
Snippets Groups Projects
Commit de159d56 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Missing transactions

parent 303c4597
No related branches found
No related tags found
No related merge requests found
...@@ -81,7 +81,10 @@ if ($action == 'order' && isset($_POST['valid'])) ...@@ -81,7 +81,10 @@ if ($action == 'order' && isset($_POST['valid']))
$linecount = GETPOST('linecount', 'int'); $linecount = GETPOST('linecount', 'int');
$box = 0; $box = 0;
unset($_POST['linecount']); unset($_POST['linecount']);
if ($linecount > 0) { if ($linecount > 0)
{
$db->begin();
$suppliers = array(); $suppliers = array();
for ($i = 0; $i < $linecount; $i++) for ($i = 0; $i < $linecount; $i++)
{ {
...@@ -154,13 +157,22 @@ if ($action == 'order' && isset($_POST['valid'])) ...@@ -154,13 +157,22 @@ if ($action == 'order' && isset($_POST['valid']))
} }
$i++; $i++;
} }
if (!$fail && $id) {
if (! $fail && $id)
{
$db->commit();
setEventMessage($langs->trans('OrderCreated'), 'mesgs'); setEventMessage($langs->trans('OrderCreated'), 'mesgs');
header('Location: replenishorders.php'); header('Location: replenishorders.php');
exit; exit;
} }
else
{
$db->rollback();
} }
if ($box == 0) { }
if ($box == 0)
{
setEventMessage($langs->trans('SelectProductWithNotNullQty'), 'warnings'); setEventMessage($langs->trans('SelectProductWithNotNullQty'), 'warnings');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment