FIX Bug: Delivery order and date are not displayed #4372
Link between shipment and delivery receipt was lost. Status for receipt must not use same label than shipments.
This commit is contained in:
parent
2c24094d60
commit
71b264dd86
@ -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))
|
||||
{
|
||||
|
||||
@ -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 '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -37,7 +37,7 @@ print load_fiche_titre($langs->trans('RelatedShippings'), '', '');
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("DateDeliveryPlanned"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans(""); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@ -53,10 +53,10 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_creation,'day'); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_delivery,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->expedition->lire) {
|
||||
/*if ($user->rights->expedition->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
}*/ ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
@ -64,15 +64,17 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
}
|
||||
|
||||
?>
|
||||
<!--
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->expedition->lire) {
|
||||
/*if ($user->rights->expedition->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
}*/ ?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
-->
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
@ -17,6 +17,9 @@ DeleteDeliveryReceiptConfirm=Are you sure you want to delete delivery receipt <b
|
||||
DeliveryMethod=Delivery method
|
||||
TrackingNumber=Tracking number
|
||||
DeliveryNotValidated=Delivery not validated
|
||||
StatusDeliveryCanceled=Canceled
|
||||
StatusDeliveryDraft=Draft
|
||||
StatusDeliveryValidated=Received
|
||||
# merou PDF model
|
||||
NameAndSignature=Name and Signature :
|
||||
ToAndDate=To___________________________________ on ____/_____/__________
|
||||
|
||||
@ -82,7 +82,7 @@ OrdersOpened=Orders to process
|
||||
NoOpenedOrders=No open orders
|
||||
NoOtherOpenedOrders=No other open orders
|
||||
NoDraftOrders=No draft orders
|
||||
NoOrder=No Order
|
||||
NoOrder=No order
|
||||
NoSupplierOrder=No supplier order
|
||||
OtherOrders=Other orders
|
||||
LastOrders=Last %s customer orders
|
||||
|
||||
@ -297,7 +297,7 @@ $formfile = new FormFile($db);
|
||||
* Mode creation
|
||||
*
|
||||
*********************************************************************/
|
||||
if ($action == 'create')
|
||||
if ($action == 'create') // Seems to no be used
|
||||
{
|
||||
|
||||
print load_fiche_titre($langs->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 '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update_extras_line">';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
|
||||
|
||||
dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending');
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression
|
||||
*
|
||||
@ -565,13 +574,6 @@ else
|
||||
* Livraison
|
||||
*/
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update_extras_line">';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Shipment
|
||||
@ -590,7 +592,9 @@ else
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">'.$object->ref.'</td></tr>';
|
||||
print '<td colspan="3">';
|
||||
print $object->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Client
|
||||
print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
|
||||
@ -818,15 +822,13 @@ else
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
if($object->statut == 0) // only if draft
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
//if ($object->statut == 0) // only if draft
|
||||
// print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
@ -899,6 +901,7 @@ else
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
// List of existing shipment and delivery receipts
|
||||
if ($expedition->origin_id)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user