Fix: If shipment is closed before delivery element is generated, there

was no way to generate it again (dead lock situation).
This commit is contained in:
Laurent Destailleur 2012-11-03 21:14:23 +01:00
parent 4c60740623
commit 7e1a74cef1
3 changed files with 15 additions and 13 deletions

View File

@ -613,7 +613,7 @@ class Expedition extends CommonObject
if ($conf->livraison_bon->enabled) if ($conf->livraison_bon->enabled)
{ {
if ($this->statut == 1) if ($this->statut == 1 || $this->statut == 2)
{ {
// Expedition validee // Expedition validee
include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';

View File

@ -1331,11 +1331,19 @@ else
{ {
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
{ {
// TODO until the module is autonomous
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->origin.'&amp;originid='.$object->origin_id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>'; }
} }
// 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 '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("DeliveryOrder").'</a>';
}
// Close
if (! empty($conf->facture->enabled) && $object->statut > 0)
{
if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed) if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed)
{ {
$label="Close"; $label="Close";
@ -1345,11 +1353,6 @@ else
} }
} }
if ($conf->livraison_bon->enabled && $object->statut == 1 && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("DeliveryOrder").'</a>';
}
if ($user->rights->expedition->supprimer) if ($user->rights->expedition->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';

View File

@ -295,7 +295,6 @@ if ($action == 'create')
/* /*
* Lignes de commandes * Lignes de commandes
*
*/ */
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
@ -311,9 +310,9 @@ if ($action == 'create')
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans("Description").'</td>'; print '<td width="54%">'.$langs->trans("Description").'</td>';
print '<td align="center">Quan. commandee</td>'; print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
print '<td align="center">Quan. livree</td>'; print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
print '<td align="center">Quan. a livrer</td>'; print '<td align="center">'.$langs->trans("QtyToShip").'</td>';
if (! empty($conf->stock->enabled)) if (! empty($conf->stock->enabled))
{ {
print '<td width="12%" align="center">'.$langs->trans("Stock").'</td>'; print '<td width="12%" align="center">'.$langs->trans("Stock").'</td>';