Fix: When on delivery receipt, ref of shipment was not visible. Also

some tabs were missing.
Fix: After deletion of delivery receipt, we must go back to shipment of
delivery receipt.
This commit is contained in:
Laurent Destailleur 2014-05-06 13:15:37 +02:00
parent c9ebe7729f
commit 948e0bf753
2 changed files with 28 additions and 12 deletions

View File

@ -110,16 +110,15 @@ function delivery_prepare_head($object)
$head[$h][2] = 'delivery';
$h++;
/* We are on id of delivery, no shipment
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->origin_id;
$head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact';
$h++;
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->origin_id;
$head[$h][1] = $langs->trans("Notes");
$head[$h][2] = 'note';
$h++;*/
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line

View File

@ -46,6 +46,7 @@ $langs->load('orders');
$action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
$backtourl=GETPOST('backtourl');
// Security check
$id = GETPOST('id', 'int');
@ -149,7 +150,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio
if ($result > 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
if (! empty($backtourl)) header("Location: ".$backtourl);
else header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
exit;
}
else
@ -464,11 +466,13 @@ else
$result = $delivery->fetch($id);
$delivery->fetch_thirdparty();
// Origin of a 'livraison' (delivery) is ALWAYS 'expedition' (shipment).
// However, origin of shipment in future may differs (commande, proposal, ...)
$expedition=new Expedition($db);
$result = $expedition->fetch($delivery->origin_id);
$typeobject = $expedition->origin;
if ($delivery->origin_id)
$typeobject = $expedition->origin; // example: commande
if ($delivery->origin_id > 0)
{
$delivery->fetch_origin();
}
@ -487,14 +491,13 @@ else
*/
if ($action == 'delete')
{
$expedition_id = $_GET["expid"];
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1);
$expedition_id = GETPOST("expid");
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id.'&backtourl='.urlencode($backtourl),$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1);
}
/*
* Confirmation de la validation
*
*/
if ($action == 'valid')
{
@ -508,6 +511,20 @@ else
*/
print '<table class="border" width="100%">';
// Shipment
if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0)
{
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("RefSending").'</td>';
print '<td colspan="3">';
// Nav is hidden because on a delivery receipt of a shipment, if we go on next shipment, we may find no tab (a shipment may not have delivery receipt yet)
//print $form->showrefnav($expedition, 'refshipment', $linkback, 1, 'ref', 'ref');
print $form->showrefnav($expedition, 'refshipment', $linkback, 0, 'ref', 'ref');
print '</td></tr>';
}
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$delivery->ref.'</td></tr>';
@ -721,7 +738,7 @@ else
{
if ($conf->expedition_bon->enabled)
{
print '<a class="butActionDelete" href="fiche.php?id='.$delivery->id.'&amp;expid='.$delivery->expedition_id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
print '<a class="butActionDelete" href="fiche.php?id='.$delivery->id.'&amp;expid='.$delivery->origin_id.'&amp;action=delete&amp;backtourl='.urlencode(DOL_URL_ROOT.'/expedition/fiche.php?id='.$delivery->origin_id).'">'.$langs->trans("Delete").'</a>';
}
else
{