From 948e0bf75397b0d2e60e53a18d29d33ebfcc43f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 May 2014 13:15:37 +0200 Subject: [PATCH] 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. --- htdocs/core/lib/sendings.lib.php | 7 +++---- htdocs/livraison/fiche.php | 33 ++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 06a89fbff80..0c63db8161f 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -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 diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 9fdb13ffe40..425b5ab20f0 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -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 ''; + // Shipment + if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0) + { + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + print ''; + } + // Ref print ''; print ''; @@ -721,7 +738,7 @@ else { if ($conf->expedition_bon->enabled) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else {
'.$langs->trans("RefSending").''; + // 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 '
'.$langs->trans("Ref").''.$delivery->ref.'