diff --git a/ChangeLog b/ChangeLog index 6cd8025ebe9..634a9081d56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -180,7 +180,8 @@ NEW: Widgets: Add widget of open opportunities NEW: Use an ajax component to swith prospection status on thidparty list NEW: Comment on survey is possible only after vote. NEW: Add partial payment reason "withholding tax" - +NEW: A new tab for reception and shipment + For developers or integrators: ------------------------------ diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 9b08075da17..c7bbda918f3 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -25,9 +25,9 @@ */ /** - * \file htdocs/fourn/expedition/dispatch.php + * \file htdocs/expedition/dispatch.php * \ingroup expedition - * \brief Page to dispatch expediting + * \brief Page to dispatch shipments */ // Load Dolibarr environment @@ -96,7 +96,7 @@ if ($id > 0 || !empty($ref)) { } // $id is id of a purchase order. -$result = restrictedArea($user, 'expedition', $object->id, ''); +$result = restrictedArea($user, 'expedition', $object, ''); if (!isModEnabled('stock')) { accessforbidden(); @@ -150,7 +150,7 @@ if ($action == 'updatelines' && $usercancreate) { $lot = ''; $dDLUO = ''; $dDLC = ''; - if ($modebatch == "batch") { //TODO: Make imposible to input non existing batchcode + if ($modebatch == "batch") { //TODO: Make impossible to input non existing batchcode $lot = GETPOST('lot_number_'.$reg[1].'_'.$reg[2]); $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'year', 'int')); $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'year', 'int')); @@ -313,7 +313,7 @@ $form = new Form($db); $formproduct = new FormProduct($db); $warehouse_static = new Entrepot($db); -$title = $langs->trans('Shipment'); +$title = $object->ref." - ".$langs->trans('ShipmentDistribution'); $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen'; $morejs = array('/expedition/js/lib_dispatch.js.php'); @@ -440,7 +440,6 @@ if ($id > 0 || !empty($ref)) { print ''; - if ($action != 'editdate_livraison') { print ''; } @@ -460,8 +459,9 @@ if ($id > 0 || !empty($ref)) { print '
'; print $langs->trans('DateDeliveryPlanned'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print '
'; - print ''.img_picto("", 'eraser', 'class="pictofixedwidth"').$langs->trans("ResetQtyToDispatch").''; - print ''.img_picto("", 'eraser', 'class="pictofixedwidth"').$langs->trans("Reset").''; + print ''.img_picto("", 'autofill', 'class="pictofixedwidth"').$langs->trans("RestoreWithCurrentQtySaved").''; + // Link to clear qty + print ''.img_picto("", 'eraser', 'class="pictofixedwidth"').$langs->trans("ClearQtys").''; print '
'; print '
'; @@ -477,16 +477,14 @@ if ($id > 0 || !empty($ref)) { print '
'; - print ''; print ''; print ''; - print '
'; print ''; - // Set $products_dispatched with qty dispatched for each product id + // Get list of lines from the shipments $products_dispatched with qty dispatched for each product id $products_dispatched = array(); $sql = "SELECT ed.fk_origin_line as rowid, sum(ed.qty) as qty"; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; @@ -501,14 +499,14 @@ if ($id > 0 || !empty($ref)) { if ($num) { while ($i < $num) { $objd = $db->fetch_object($resql); - $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); + $products_dispatched[$objd->rowid] = price2num($objd->qty, 'MS'); $i++; } } $db->free($resql); } //$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,"; - $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref_ext AS sref, l.qty as qty,"; + $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, '' AS sref, l.qty as qty,"; $sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse"; // Enable hooks to alter the SQL query (SELECT) $parameters = array(); @@ -529,7 +527,6 @@ if ($id > 0 || !empty($ref)) { if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $sql .= " AND l.product_type = 0"; } - // Enable hooks to alter the SQL query (WHERE) $parameters = array(); $reshook = $hookmanager->executeHooks( @@ -640,7 +637,7 @@ if ($id > 0 || !empty($ref)) { print ''."\n"; // hidden fields for js function print ''; - print ''; + print ''; print ''; if (empty($conf->cache['product'][$objp->fk_product])) { @@ -673,7 +670,7 @@ if ($id > 0 || !empty($ref)) { print $linktoprod; print ""; print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; @@ -687,6 +684,7 @@ if ($id > 0 || !empty($ref)) { print $linktoprod; print ""; } + // Define unit price for PMP calculation $up_ht_disc = $objp->subprice; if (!empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { @@ -724,6 +722,7 @@ if ($id > 0 || !empty($ref)) { while ($j < $numd) { $suffix = "_".$j."_".$i; $objd = $db->fetch_object($resultsql); + if (isModEnabled('productbatch') && !empty($objd->batch)) { $type = 'batch'; @@ -754,12 +753,15 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; + + print ''; print ''; + print ''; print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; } @@ -863,6 +866,7 @@ if ($id > 0 || !empty($ref)) { } $suffix = "_".$j."_".$i; } + if ($j == 0) { if (isModEnabled('productbatch') && !empty($objp->tobatch)) { $type = 'batch'; @@ -894,10 +898,13 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; + + print ''; + print ''; print ''; print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; } // Qty to dispatch print ''; print ''; + // Warehouse print ''; print ''; print '
'; - print $langs->trans("ProductDoesNotUseBatchSerial"); + print ''.$langs->trans("ProductDoesNotUseBatchSerial").''; print ''; print ''; - print ''; + //print ''; print ''; @@ -807,6 +809,7 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; @@ -945,12 +952,15 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; + + print ''; + print ''; print ''; print ''.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').''; - print ''; + print ''; print ''; if (isModEnabled('productbatch') && $objp->tobatch > 0) { @@ -962,6 +972,7 @@ if ($id > 0 || !empty($ref)) { } print ''; if (count($listwarehouses) > 1) { @@ -1065,6 +1076,7 @@ if ($id > 0 || !empty($ref)) { var fk_default_warehouse = $("option:selected", this).val(); $("select[name^=entrepot_]").val(fk_default_warehouse).change(); }); + $("#autoreset").click(function() { $(".autoresettr").each(function(){ id = $(this).attr("name"); @@ -1087,6 +1099,7 @@ if ($id > 0 || !empty($ref)) { }); return false; }); + $("#resetalltoexpected").click(function(){ $(".qtydispatchinput").each(function(){ console.log("We reset to expected "+$(this).attr("id")+" qty to dispatch"); @@ -1094,6 +1107,7 @@ if ($id > 0 || !empty($ref)) { }); return false; }); + $(".resetline").click(function(){ id = $(this).attr("id"); id = id.split("reset_"); diff --git a/htdocs/expedition/js/lib_dispatch.js.php b/htdocs/expedition/js/lib_dispatch.js.php index d7c8bf2d74b..b5b0f5e0f90 100644 --- a/htdocs/expedition/js/lib_dispatch.js.php +++ b/htdocs/expedition/js/lib_dispatch.js.php @@ -17,7 +17,7 @@ // or see https://www.gnu.org/ /** - * \file htdocs/fourn/js/lib_dispatch.js.php + * \file htdocs/expedition/js/lib_dispatch.js.php * \brief File that include javascript functions used for dispatching qty/stock/lot */ @@ -98,7 +98,7 @@ function addDispatchLine(index, type, mode) { } console.log("qtyDispatched=" + qtyDispatched + " qtyOrdered=" + qtyOrdered+ " qty=" + qty); - if (qtyOrdered - qtyDispatched < 1) { + if (qty <= 1) { window.alert("Remain quantity to dispatch is too low to be split"); } else { oldlineqty = qtyDispatched; @@ -180,7 +180,7 @@ function addDispatchLine(index, type, mode) { $("#lot_number_" + (nbrTrs) + "_" + index).val("") $("#idline_" + (nbrTrs) + "_" + index).val("-1") $("#qty_" + (nbrTrs) + "_" + index).data('expected', "0"); - $("input[type='hidden']#lot_number_" + (nbrTrs) + "_" + index).remove(); + //$("input[type='hidden']#lot_number_" + (nbrTrs) + "_" + index).remove(); $("#lot_number_" + (nbrTrs) + "_" + index).removeAttr("disabled"); } } diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index e6d825edfcb..70c2f43c998 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -113,8 +113,8 @@ if (!isModEnabled('stock')) { accessforbidden(); } -$usercancreate = $user->rights->reception->creer; -$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php +$usercancreate = $user->hasRight('reception', 'creer'); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php /* @@ -426,6 +426,7 @@ if ($id > 0 || !empty($ref)) { print '
'; + print '
'; print ''.img_picto("", 'autofill', 'class="pictofixedwidth"').$langs->trans("RestoreWithCurrentQtySaved").''; // Link to clear qty @@ -445,12 +446,10 @@ if ($id > 0 || !empty($ref)) { print ''; - print ''; print ''; print ''; - print '
'; print ''; @@ -727,7 +726,7 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; - print ''; + print ''; if (!empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) { // Not tested ! print $langs->trans("BuyingPrice").': '; } else { @@ -971,7 +970,7 @@ if ($id > 0 || !empty($ref)) { // Qty to dispatch print ''; print '
'; print ''.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').''; - print ''; + print ''; print ''; if (isModEnabled('productbatch') && $objp->tobatch > 0) {