';
@@ -1885,9 +1898,9 @@ elseif (! empty($object->id))
}
$i++;
}
-
+*/
// Form to add new line
- if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action != 'edit_line')
+ if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action != 'editline')
{
// Add free products/services form
global $forceall, $senderissupplier, $dateSelector;
@@ -2235,7 +2248,7 @@ elseif (! empty($object->id))
// modified by hook
if (empty($reshook))
{
- if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete')
+ if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete')
{
print '';
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 540c7dfe035..df6ab1e73d2 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -57,6 +57,8 @@ $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int'));
$action = GETPOST("action");
$confirm = GETPOST("confirm");
$ref = GETPOST('ref','alpha');
+$cancel = GETPOST('cancel','alpha');
+$lineid = GETPOST('lineid', 'int');
//PDF
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
@@ -90,6 +92,8 @@ $permissionnote=$user->rights->fournisseur->facture->creer; // Used by the inclu
* Actions
*/
+if ($cancel) $action='';
+
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -503,12 +507,11 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
}
// Edit line
-elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer)
+elseif ($action == 'updateline' && $user->rights->fournisseur->facture->creer)
{
- // TODO Missing transaction
- if (GETPOST('etat') == '1' && ! GETPOST('cancel')) // si on valide la modification
- {
- $object->fetch($id);
+ $db->begin();
+
+ $object->fetch($id);
$object->fetch_thirdparty();
if ($_POST['puht'])
@@ -547,12 +550,13 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer)
if ($result >= 0)
{
unset($_POST['label']);
+ $db->commit();
}
else
{
+ $db->rollback();
setEventMessage($object->error,'errors');
}
- }
}
elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
@@ -1954,11 +1958,10 @@ else
$cols = 4;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
- print '