'; // Warehouse column
diff --git a/htdocs/fourn/js/lib_dispatch.js.php b/htdocs/fourn/js/lib_dispatch.js.php
index f1b70fa0ceb..e99c32f02d9 100644
--- a/htdocs/fourn/js/lib_dispatch.js.php
+++ b/htdocs/fourn/js/lib_dispatch.js.php
@@ -62,20 +62,26 @@ if (empty($dolibarr_nocache)) {
* Adds new table row for dispatching to multiple stock locations or multiple lot/serial
*
* @param index int index of product line. 0 = first product line
- * @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch)
+ * @param type string type of dispatch ('batch' = batch dispatch, 'dispatch' = non batch dispatch)
* @param mode string 'qtymissing' will create new line with qty missing, 'lessone' will keep 1 in old line and the rest in new one
*/
function addDispatchLine(index, type, mode) {
mode = mode || 'qtymissing'
+ console.log("fourn/js/lib_dispatch.js.php addDispatchLine Split line type="+type+" index="+index+" mode="+mode);
+
var $row0 = $("tr[name='"+type+'_0_'+index+"']");
var $dpopt = $row0.find('.hasDatepicker').first().datepicker('option', 'all'); // get current datepicker options to apply the same to the cloned datepickers
var $row = $row0.clone(true); // clone first batch line to jQuery object
- var nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length; // position of line for batch
+ var nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length; // count nb of tr line with attribute name that starts with 'batch_' or 'dispatch_', and end with _index
var qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()); // Qty ordered is same for all rows
- var qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val());
- console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode+" qtyOrdered="+qtyOrdered+" qty="+qty);
+ var qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val());
+ if (isNaN(qty)) {
+ qty = '';
+ }
+
+ console.log("fourn/js/lib_dispatch.js.php addDispatchLine Split line nbrTrs="+nbrTrs+" qtyOrdered="+qtyOrdered+" qty="+qty);
var qtyDispatched;
@@ -90,7 +96,7 @@ function addDispatchLine(index, type, mode) {
mode = 'lessone';
}
}
- console.log("qtyDispatched=" + qtyDispatched + " qtyOrdered=" + qtyOrdered);
+ console.log("qtyDispatched=" + qtyDispatched + " qtyOrdered=" + qtyOrdered+ " qty=" + qty);
if (qty <= 1) {
window.alert("Remain quantity to dispatch is too low to be split");
@@ -187,7 +193,6 @@ function addDispatchLine(index, type, mode) {
*
* element requires arbitrary data qty (value before change), type (type of dispatch) and index (index of product line)
*/
-
function onChangeDispatchLineQty(element) {
var type = $(element).data('type'),
qty = parseFloat($(element).data('expected')),
@@ -208,7 +213,8 @@ function onChangeDispatchLineQty(element) {
if ((qtyChanged) <= (qtyOrdered - (qtyDispatched + qtyDispatching))) {
$("#qty_dispatched_0_" + index).val(qtyDispatched + qtyChanged);
} else {
- $(element).val($(element).data('expected'));
+ /*console.log("eee");
+ $(element).val($(element).data('expected'));*/
}
$(element).data('expected', $(element).val());
}
diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang
index cd4c860e82f..9301067b43e 100644
--- a/htdocs/langs/en_US/receptions.lang
+++ b/htdocs/langs/en_US/receptions.lang
@@ -52,6 +52,6 @@ ReceptionExist=A reception exists
ReceptionBackToDraftInDolibarr=Reception %s back to draft
ReceptionClassifyClosedInDolibarr=Reception %s classified Closed
ReceptionUnClassifyCloseddInDolibarr=Reception %s re-open
-ResetQtyToDispatch=Reset all quantities to dispatch
+RestoreWithCurrentQtySaved=Fill quantities with lastest saved values
ReceptionUpdated=Reception sucessfully updated
-DispatchCard=Dispatch card
\ No newline at end of file
+DispatchCard=Reception distribution
\ No newline at end of file
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 89f59239e7c..00b2a544d6e 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -415,7 +415,6 @@ if (empty($reshook)) {
-
/*
* View
*/
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 4280dabfc9d..52a831a950b 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -735,7 +735,9 @@ if (empty($reshook)) {
* View
*/
-llxHeader('', $langs->trans('Reception'), 'Reception');
+$title = $object->ref.' - '.$langs->trans('Reception');
+
+llxHeader('', $title, 'Reception');
$form = new Form($db);
$formfile = new FormFile($db);
diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php
index 4457a5b1303..b6806e2e805 100644
--- a/htdocs/reception/dispatch.php
+++ b/htdocs/reception/dispatch.php
@@ -297,7 +297,7 @@ $formproduct = new FormProduct($db);
$warehouse_static = new Entrepot($db);
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
-$title = $object->ref." - ".$langs->trans('OrderDispatch');
+$title = $object->ref." - ".$langs->trans('DispatchCard');
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
$morejs = array('/fourn/js/lib_dispatch.js.php');
@@ -427,8 +427,9 @@ if ($id > 0 || !empty($ref)) {
print '';
print '';
print '
';
if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
@@ -586,6 +585,7 @@ if ($id > 0 || !empty($ref)) {
$conf->cache['product'] = array();
+ // Loop on each source order line (may be more or less than current number of lines in llx_commande_fournisseurdet)
while ($i < $num) {
$objp = $db->fetch_object($resql);
@@ -611,7 +611,7 @@ if ($id > 0 || !empty($ref)) {
print ''."\n";
// hidden fields for js function
print '';
- print '';
+ print '';
print '