From 7101c2445d87f9bd25a12d99decd266b69a59f85 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 8 May 2021 12:42:58 +0200 Subject: [PATCH] Fix dispatch, only edit received lines on draft reception. No stock movement on reception. --- htdocs/fourn/commande/dispatch.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index b183092972e..4c279dd7c97 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -410,7 +410,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fourn $error++; } else { // If module stock is enabled and the stock increase is done on purchase order dispatching - if ($entrepot > 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { + if ($entrepot > 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) && empty($supplierorderdispatch->fk_reception)) { $mouv = new MouvementStock($db); if ($product > 0) { $mouv->origin = &$object; @@ -1287,19 +1287,22 @@ if ($id > 0 || !empty($ref)) { } print ''; } - if ($action != 'editline' || $lineid != $objp->dispatchlineid) { - print ''; - print 'dispatchlineid.'#line_'.$objp->dispatchlineid.'">'; - print img_edit(); - print ''; - print ''; + if (empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) { // only allow edit on draft reception + print ''; + print 'dispatchlineid.'#line_'.$objp->dispatchlineid.'">'; + print img_edit(); + print ''; + print ''; - print ''; - print 'dispatchlineid.'#dispatch_received_products">'; - print img_delete(); - print ''; - print ''; + print ''; + print 'dispatchlineid.'#dispatch_received_products">'; + print img_delete(); + print ''; + print ''; + } else { + print ''; + } } else { print ''; print '';