diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 50e3b1e97be..8cfd5f202d5 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -50,9 +50,12 @@ function shipping_prepare_head($object) { // delivery link $object->fetchObjectLinked($object->id,$object->element); - if (! empty($object->linkedObjectsIds['delivery'][0])) // If there is a delivery + if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery { - $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->linkedObjectsIds['delivery'][0]; + // Take first one element of array + $tmp = reset($object->linkedObjectsIds['delivery']); + + $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$tmp; $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -302,7 +305,8 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $expedition->id=$objp->sendingid; $expedition->fetchObjectLinked($expedition->id,$expedition->element); //var_dump($expedition->linkedObjects); - $receiving=(! empty($expedition->linkedObjects['delivery'][0])?$expedition->linkedObjects['delivery'][0]:''); + $receiving=''; + if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link if (! empty($receiving)) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3136e5a79b7..e565d015a93 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -338,7 +338,7 @@ if (empty($reshook)) $result = $object->create_delivery($user); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/livraison/card.php?id='.$result); + header("Location: ".DOL_URL_ROOT.'/livraison/card.php?action=create_delivery&id='.$result); exit; } else @@ -529,7 +529,7 @@ if ($action == 'create2') $action=''; $id=''; $ref=''; } -// Mode creation +// Mode creation. TODO This part seems to not be used at all. Receipt record is created by the action "create_delivery" not from a form. if ($action == 'create') { $expe = new Expedition($db); @@ -1583,7 +1583,8 @@ else if ($id || $ref) } // 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['delivery'][0])) + //var_dump($object->linkedObjectsIds['delivery']); + if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0) { print ''.$langs->trans("CreateDeliveryOrder").''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 30607201e73..9ad2108519a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -789,9 +789,9 @@ class Expedition extends CommonObject /** - * Cree un bon de livraison a partir de l'expedition + * Create a delivery receipt from a shipment * - * @param User $user Utilisateur + * @param User $user User * @return int <0 if KO, >=0 if OK */ function create_delivery($user) diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 8b7066adc09..f18ed1ea80f 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -37,7 +37,7 @@ print load_fiche_titre($langs->trans('RelatedShippings'), '', ''); trans("Ref"); ?> trans("Date"); ?> trans("DateDeliveryPlanned"); ?> - trans("AmountHTShort"); ?> + trans(""); ?> trans("Status"); ?> @@ -53,10 +53,10 @@ foreach($linkedObjectBlock as $key => $objectlink) date_creation,'day'); ?> date_delivery,'day'); ?> rights->expedition->lire) { + /*if ($user->rights->expedition->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); - } ?> + }*/ ?> getLibStatut(3); ?> ">transnoentitiesnoconv("RemoveLink")); ?> @@ -64,15 +64,17 @@ foreach($linkedObjectBlock as $key => $objectlink) } ?> + + diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index 4eb1c792b65..eab3826a2c7 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -17,6 +17,9 @@ DeleteDeliveryReceiptConfirm=Are you sure you want to delete delivery receipt trans("CreateADeliveryOrder")); @@ -538,8 +538,17 @@ else $soc->fetch($object->socid); $head=delivery_prepare_head($object); - dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); + /* * Confirmation de la suppression * @@ -565,13 +574,6 @@ else * Livraison */ - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; // Shipment @@ -590,7 +592,9 @@ else // Ref print ''; - print ''; + print ''; // Client print ''; @@ -818,15 +822,13 @@ else print "
'.$langs->trans("Ref").''.$object->ref.'
'; + print $object->ref; + print '
'.$langs->trans("Customer").'
\n"; - if($object->statut == 0) // only if draft - print '
'; - + dol_fiche_end(); + + //if ($object->statut == 0) // only if draft + // print '
'; + print '
'; - - - - print "\n\n"; - + /* * Boutons actions @@ -899,6 +901,7 @@ else print ''; + // List of existing shipment and delivery receipts if ($expedition->origin_id) { print '
'; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index faac4766337..14a83aca2f7 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -65,9 +65,9 @@ class Livraison extends CommonObject $this->products = array(); // List of short language codes for status - $this->statuts[-1] = 'StatusSendingCanceled'; - $this->statuts[0] = 'StatusSendingDraft'; - $this->statuts[1] = 'StatusSendingValidated'; + $this->statuts[-1] = 'StatusDeliveryCanceled'; + $this->statuts[0] = 'StatusDeliveryDraft'; + $this->statuts[1] = 'StatusDeliveryValidated'; } /** @@ -801,9 +801,9 @@ class Livraison extends CommonObject if ($mode==0) { - if ($statut==-1) return $langs->trans('StatusSendingCanceled'); - if ($statut==0) return $langs->trans('StatusSendingDraft'); - if ($statut==1) return $langs->trans('StatusSendingValidated'); + if ($statut==-1) return $langs->trans('StatusDeliveryCanceled'); + if ($statut==0) return $langs->trans('StatusDeliveryDraft'); + if ($statut==1) return $langs->trans('StatusDeliveryValidated'); } if ($mode==1) { @@ -813,9 +813,9 @@ class Livraison extends CommonObject } if ($mode == 4) { - if ($statut==-1) return img_picto($langs->trans('StatusSendingCanceled'),'statut5').' '.$langs->trans('StatusSendingCanceled'); - if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft'); - if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated'); + if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'),'statut5').' '.$langs->trans('StatusDeliveryCanceled'); + if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'),'statut0').' '.$langs->trans('StatusDeliveryDraft'); + if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'),'statut4').' '.$langs->trans('StatusDeliveryValidated'); } }