From 7e1a74cef1bee35e5df5b4b0927711b5f0a02c50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Nov 2012 21:14:23 +0100 Subject: [PATCH] Fix: If shipment is closed before delivery element is generated, there was no way to generate it again (dead lock situation). --- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/fiche.php | 19 +++++++++++-------- htdocs/livraison/fiche.php | 7 +++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 00dde07cb10..1aeede8b5ba 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -613,7 +613,7 @@ class Expedition extends CommonObject if ($conf->livraison_bon->enabled) { - if ($this->statut == 1) + if ($this->statut == 1 || $this->statut == 2) { // Expedition validee include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index ed6c44ef8a0..363ec801e3a 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1331,12 +1331,20 @@ else { if ($user->rights->facture->creer) { - // TODO until the module is autonomous print ''.$langs->trans("CreateBill").''; - //print ''.$langs->trans("CreateBill").''; } + } - if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed) + // This is just to generate a delivery receipt + if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds)) + { + print ''.$langs->trans("DeliveryOrder").''; + } + + // Close + if (! empty($conf->facture->enabled) && $object->statut > 0) + { + if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed) { $label="Close"; // Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders @@ -1345,11 +1353,6 @@ else } } - if ($conf->livraison_bon->enabled && $object->statut == 1 && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds)) - { - print ''.$langs->trans("DeliveryOrder").''; - } - if ($user->rights->expedition->supprimer) { print ''.$langs->trans("Delete").''; diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 98ca4ce2f0e..d0a4807e33d 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -295,7 +295,6 @@ if ($action == 'create') /* * Lignes de commandes - * */ print '
'; @@ -311,9 +310,9 @@ if ($action == 'create') { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->stock->enabled)) { print '';
'.$langs->trans("Description").'Quan. commandeeQuan. livreeQuan. a livrer'.$langs->trans("QtyOrdered").''.$langs->trans("QtyReceived").''.$langs->trans("QtyToShip").''.$langs->trans("Stock").'