diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index e89555a5d50..c0465a61658 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -150,10 +150,10 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) $db->begin(); $pos = 0; - foreach ($_POST as $key => $value) + foreach ($_POST as $key => $value) { // without batch module enabled - if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) + if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos ++; @@ -184,7 +184,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } } // with batch module enabled - if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) + if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos ++; @@ -260,6 +260,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } } + /* * View */ @@ -284,13 +285,13 @@ if ($id > 0 || ! empty($ref)) { $head = ordersupplier_prepare_head($object); $title = $langs->trans("SupplierOrder"); - dol_fiche_head($head, 'dispatch', $title, 0, 'order'); + dol_fiche_head($head, 'dispatch', $title, -1, 'order'); + - // Supplier order card $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
'; // Ref supplier $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); @@ -331,14 +332,14 @@ if ($id > 0 || ! empty($ref)) { } } $morehtmlref.='
'; - - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + print '
'; print '
'; - + print ''; // Date @@ -362,7 +363,7 @@ if ($id > 0 || ! empty($ref)) { print "
"; print '
'; - + // if ($mesg) print $mesg; print '
'; @@ -382,7 +383,7 @@ if ($id > 0 || ! empty($ref)) { print '
'; print ''; print ''; - + print '
'; print ''; @@ -434,6 +435,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; + print ''; print ''; print "\n"; @@ -443,7 +445,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; - print ''; + print ''; print "\n"; } } @@ -456,7 +458,7 @@ if ($id > 0 || ! empty($ref)) { while ( $i < $num ) { $objp = $db->fetch_object($resql); - // On n'affiche pas les produits personnalises + // On n'affiche pas les produits libres if (! $objp->fk_product > 0) { $nbfreeproduct++; } else { @@ -511,7 +513,11 @@ if ($id > 0 || ! empty($ref)) { if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { $type = 'batch'; - print ''; // Dispatch column + print ''; // Qty to dispatch + print ''; // Dispatch column print ''; // Warehouse column print ''; @@ -519,7 +525,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; // Qty ordered + qty already dispatached } else { $type = 'dispatch'; - print ''; // Dispatch column - print ''; + print ''; // Qty to dispatch + print ''; // Dispatch column + print ''; // Warehouse column print ''; print ''; print ''; } - // Dispatch + + // Qty to dispatch print ''; + + print ''; // Warehouse print '
' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("Warehouse") . '
' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '  
' . img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"') . ''; + print ''; + //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + print '
'; print ''; print ''; - + print ''; if (! empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) // Not tested ! { @@ -536,7 +542,7 @@ if ($id > 0 || ! empty($ref)) { print ''; - print ''; + print ''; print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); @@ -549,15 +555,19 @@ if ($id > 0 || ! empty($ref)) { print ' ' . img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"') . ''; + print ''; + //print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + print '
'; print ''; print ''; - + print ''; if (! empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) // Not tested ! { @@ -567,23 +577,38 @@ if ($id > 0 || ! empty($ref)) { { print ''; } - + // hidden fields for js function print ''; print ''; print ''; print ''; + print ''; + if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { + $type = 'batch'; + //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + } + else + { + $type = 'dispatch'; + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + } + print ''; if (count($listwarehouses) > 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 1, 0, $objp->fk_product); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1); } elseif (count($listwarehouses) == 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 0, 0, $objp->fk_product); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1); } else { $langs->load("errors"); print $langs->trans("ErrorNoWarehouseDefined"); @@ -604,10 +629,10 @@ if ($id > 0 || ! empty($ref)) { print ''; print "
\n"; - if ($nbproduct) + if ($nbproduct) { $checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5])); - + print '
'; print $langs->trans("Comment") . ' : '; print '
'; print ' '.$checkboxlabel; - + print '
0 || ! empty($ref)) { if (! $nbproduct) { if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) print '
'.$langs->trans("NoPredefinedProductToDispatch").'
'; // No predefined line at all - else + else print '
'.$langs->trans("NoMorePredefinedProductToDispatch").'
'; // No predefined line that remain to be dispatched. } @@ -637,7 +662,7 @@ if ($id > 0 || ! empty($ref)) { dol_fiche_end(); - + // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.label as entrepot,"; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 68976e9b7c7..700ce7a770a 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -100,7 +100,7 @@ if ($object->id > 0) $head = ordersupplier_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans('SupplierOrder'), 0, 'order'); + dol_fiche_head($head, 'documents', $langs->trans('SupplierOrder'), -1, 'order'); // Construit liste des fichiers @@ -114,7 +114,7 @@ if ($object->id > 0) // Supplier order card $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
'; // Ref supplier $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); @@ -155,13 +155,13 @@ if ($object->id > 0) } } $morehtmlref.='
'; - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; print '
'; - + print ''; print ''; print ''; @@ -170,8 +170,8 @@ if ($object->id > 0) print "\n"; dol_fiche_end(); - - + + $modulepart = 'commande_fournisseur'; $permission = $user->rights->fournisseur->commande->creer; $permtoedit = $user->rights->fournisseur->commande->creer; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 50b310a55e5..bbc688264b8 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -100,7 +100,7 @@ $now=dol_now(); $head = ordersupplier_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("SupplierOrder"), 0, 'order'); +dol_fiche_head($head, 'info', $langs->trans("SupplierOrder"), -1, 'order'); // Supplier order card @@ -197,7 +197,7 @@ if (!empty($object->id)) $param='&id='.$object->id; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - + print load_fiche_titre($langs->trans("ActionsOnOrder"),'',''); // List of actions on element diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index a3334baa5d9..45e4bd80e3a 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -75,19 +75,19 @@ if ($id > 0 || ! empty($ref)) if ($result >= 0) { $object->fetch_thirdparty(); - + $author = new User($db); $author->fetch($object->user_author_id); $head = ordersupplier_prepare_head($object); $title=$langs->trans("SupplierOrder"); - dol_fiche_head($head, 'note', $title, 0, 'order'); + dol_fiche_head($head, 'note', $title, -1, 'order'); // Supplier order card - + $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
'; // Ref supplier $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); @@ -128,19 +128,19 @@ if ($id > 0 || ! empty($ref)) } } $morehtmlref.='
'; - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; print '
'; - - + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
'; - + dol_fiche_end(); } else diff --git a/htdocs/fourn/js/lib_dispatch.js b/htdocs/fourn/js/lib_dispatch.js index c58a4e1fe9d..84f74c30c54 100644 --- a/htdocs/fourn/js/lib_dispatch.js +++ b/htdocs/fourn/js/lib_dispatch.js @@ -26,16 +26,20 @@ * * @param index int index of produt line. 0 = first product line * @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) +function addDispatchLine(index, type, mode) { + mode = mode || 'qtymissing' + + console.log("Split line type="+type+" index="+index+" mode="+mode); var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch qtyOrdered = parseFloat($("#qty_ordered_"+(nbrTrs - 1)+"_"+index).val()), qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()), qtyDispatched; - if (type === 'batch') + if (mode === 'lessone') { qtyDispatched = parseFloat($("#qty_dispatched_"+(nbrTrs - 1)+"_"+index).val()) + 1; } @@ -63,15 +67,22 @@ function addDispatchLine(index,type) /* Suffix of lines are: _ trs.length _ index */ $("#qty_"+nbrTrs+"_"+index).focus(); $("#qty_dispatched_"+(nbrTrs)+"_"+index).val(qtyDispatched); - if (type === 'batch') + + //hide all buttons then show only the last one + $("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide(); + $("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show(); + + if (mode === 'lessone') { $("#qty_"+(nbrTrs)+"_"+index).val(qty-1); $("#qty_"+(nbrTrs-1)+"_"+index).val(1); } else { - $("#qty_"+nbrTrs+"_"+index).val(qtyOrdered - qtyDispatched); - } + } + + //set focus on lot of new line (if it exists) + $("#lot_number_"+(nbrTrs)+"_"+index).focus(); } } \ No newline at end of file diff --git a/htdocs/product/admin/product_lot_extrafields.php b/htdocs/product/admin/product_lot_extrafields.php index 28b4ee7db1d..fb1cdfcb704 100644 --- a/htdocs/product/admin/product_lot_extrafields.php +++ b/htdocs/product/admin/product_lot_extrafields.php @@ -75,7 +75,7 @@ print load_fiche_titre($title,$linkback,'title_setup'); $head = product_lot_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $textobject, 0, 'stock'); +dol_fiche_head($head, 'attributes', $textobject, -1, 'stock'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'