NEW hook on dispatch order fourn

This commit is contained in:
atm-quentin 2018-08-29 14:12:17 +02:00
parent 32ef9695a7
commit 76cb9f60c7

View File

@ -62,6 +62,10 @@ if (empty($conf->stock->enabled)) {
accessforbidden();
}
$hookmanager->initHooks(array('dispatch'));
// Recuperation de l'id de projet
$projectid = 0;
if ($_GET["projectid"])
@ -502,9 +506,12 @@ if ($id > 0 || ! empty($ref)) {
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
if (!empty($conf->productbatch->enabled))
{
print '<td class="dispatch_batch_number_title">'.$langs->trans("batch_number").'</td>';
print '<td class="dispatch_dluo_title">'.$langs->trans("EatByDate").'</td>';
print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>';
}
print '<td align="right">' . $langs->trans("QtyOrdered") . '</td>';
print '<td align="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
print '<td align="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
@ -512,15 +519,9 @@ if ($id > 0 || ! empty($ref)) {
print '<td align="right">' . $langs->trans("Warehouse") . '</td>';
print "</tr>\n";
if (! empty($conf->productbatch->enabled)) {
print '<tr class="liste_titre">';
print '<td></td>';
print '<td>' . $langs->trans("batch_number") . '</td>';
print '<td>' . $langs->trans("EatByDate") . '</td>';
print '<td>' . $langs->trans("SellByDate") . '</td>';
print '<td colspan="5">&nbsp;</td>';
print "</tr>\n";
}
}
$nbfreeproduct = 0; // Nb of lins of free products/services
@ -559,16 +560,21 @@ if ($id > 0 || ! empty($ref)) {
if (! empty($conf->productbatch->enabled)) {
if ($objp->tobatch) {
print '<td colspan="4">';
print '<td>';
print $linktoprod;
print "</td>";
print '<td class="dispatch_batch_number"></td>';
print '<td class="dispatch_dluo"></td>';
print '<td class="dispatch_dlc"></td>';
} else {
print '<td>';
print $linktoprod;
print "</td>";
print '<td colspan="3">';
print '<td class="dispatch_batch_number">';
print $langs->trans("ProductDoesNotUseBatchSerial");
print '</td>';
print '<td class="dispatch_dluo"></td>';
print '<td class="dispatch_dlc"></td>';
}
} else {
print '<td colspan="4">';
@ -614,7 +620,7 @@ if ($id > 0 || ! empty($ref)) {
print '</td>';
print '<td>';
print '<td >';
print '<input type="text" class="inputlotnumber" id="lot_number' . $suffix . '" name="lot_number' . $suffix . '" size="40" value="' . GETPOST('lot_number' . $suffix) . '">';
print '</td>';
print '<td>';
@ -627,6 +633,7 @@ if ($id > 0 || ! empty($ref)) {
print '</td>';
print '<td colspan="2">&nbsp</td>'; // Qty ordered + qty already dispatached
} else {
$type = 'dispatch';
print '<td align="right">';
print '</td>'; // Qty to dispatch
@ -701,21 +708,27 @@ if ($id > 0 || ! empty($ref)) {
if ($nbproduct)
{
$checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5]));
$checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5]));
print '<br><div class="center">';
print $langs->trans("Comment") . ' : ';
print '<input type="text" class="minwidth400" maxlength="128" name="comment" value="';
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
// print ' / '.$object->ref_supplier; // Not yet available
print '" class="flat"><br>';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
{
print $langs->trans("Comment").' : ';
print '<input type="text" class="minwidth400" maxlength="128" name="comment" value="';
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
// print ' / '.$object->ref_supplier; // Not yet available
print '" class="flat"><br>';
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
print '<br><input type="submit" class="button" value="' . $langs->trans("DispatchVerb") . '"';
if (count($listwarehouses) <= 0)
print ' disabled';
print '>';
print '<br><input type="submit" class="button" value="'.$langs->trans("DispatchVerb").'"';
if (count($listwarehouses) <= 0)
print ' disabled';
print '>';
}
print '</div>';
}
@ -755,14 +768,14 @@ if ($id > 0 || ! empty($ref)) {
print load_fiche_titre($langs->trans("ReceivingForSameOrder"));
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
print '<table id="dispatch_received_products" class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Product") . '</td>';
if (! empty($conf->productbatch->enabled)) {
print '<td>' . $langs->trans("batch_number") . '</td>';
print '<td>' . $langs->trans("EatByDate") . '</td>';
print '<td>' . $langs->trans("SellByDate") . '</td>';
print '<td class="dispatch_batch_number_title">' . $langs->trans("batch_number") . '</td>';
print '<td class="dispatch_dluo_title">' . $langs->trans("EatByDate") . '</td>';
print '<td class="dispatch_dlc_title">' . $langs->trans("SellByDate") . '</td>';
}
print '<td align="right">' . $langs->trans("QtyDispatched") . '</td>';
print '<td></td>';
@ -784,9 +797,9 @@ if ($id > 0 || ! empty($ref)) {
print "</td>\n";
if (! empty($conf->productbatch->enabled)) {
print '<td>' . $objp->batch . '</td>';
print '<td>' . dol_print_date($db->jdate($objp->eatby), 'day') . '</td>';
print '<td>' . dol_print_date($db->jdate($objp->sellby), 'day') . '</td>';
print '<td class="dispatch_batch_number">' . $objp->batch . '</td>';
print '<td class="dispatch_dluo">' . dol_print_date($db->jdate($objp->eatby), 'day') . '</td>';
print '<td class="dispatch_dlc">' . dol_print_date($db->jdate($objp->sellby), 'day') . '</td>';
}
// Qty