34require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
43if (isModEnabled(
'project')) {
44 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48$langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'receptions'));
50if (isModEnabled(
'productbatch')) {
51 $langs->load(
'productbatch');
58$action =
GETPOST(
'action',
'aZ09');
59$fk_default_warehouse =
GETPOSTINT(
'fk_default_warehouse');
60$cancel =
GETPOST(
'cancel',
'alpha');
61$confirm =
GETPOST(
'confirm',
'alpha');
67 $socid = $user->socid;
70$hookmanager->initHooks(array(
'expeditiondispatch'));
74if (GETPOSTISSET(
"projectid")) {
82if ($id > 0 || !empty($ref)) {
83 $result =
$object->fetch($id, $ref);
87 $result =
$object->fetch_thirdparty();
102if (!isModEnabled(
'stock')) {
106$usercancreate = $user->hasRight(
'expedition',
'creer');
107$permissiontoadd = $usercancreate;
114$parameters = array();
115$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
121if ($action ==
'updatelines' && $usercancreate) {
130 foreach ($_POST as $key => $value) {
133 if (preg_match(
'/^product_.*([0-9]+)_([0-9]+)$/i', $key, $reg)) {
135 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
136 $modebatch =
"barcode";
137 } elseif (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
138 $modebatch =
"batch";
142 if ($modebatch ==
"barcode") {
143 $prod =
"product_".$reg[1].
'_'.$reg[2];
145 $prod =
'product_batch_'.$reg[1].
'_'.$reg[2];
147 $qty =
"qty_".$reg[1].
'_'.$reg[2];
148 $ent =
"entrepot_".$reg[1].
'_'.$reg[2];
149 $fk_commandedet =
"fk_commandedet_".$reg[1].
'_'.$reg[2];
150 $idline =
GETPOST(
"idline_".$reg[1].
'_'.$reg[2]);
157 if ($modebatch ==
"batch") {
158 $lot =
GETPOST(
'lot_number_'.$reg[1].
'_'.$reg[2]);
167 if (($modebatch ==
"batch" && $newqty >= 0) || ($modebatch ==
"barcode" && $newqty != 0)) {
169 if (!($warehouse_id > 0)) {
170 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
171 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline);
172 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
175 if (!$error && $modebatch ==
"batch") {
176 $sql =
"SELECT pb.rowid ";
177 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_batch as pb";
178 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"product_stock as ps";
179 $sql .=
" ON ps.rowid = pb.fk_product_stock";
180 $sql .=
" WHERE pb.batch = '".$db->escape($lot).
"'";
181 $sql .=
" AND ps.fk_product = ".((int) $prod_id) ;
182 $sql .=
" AND ps.fk_entrepot = ".((int) $warehouse_id) ;
184 $resql = $db->query($sql);
186 $num = $db->num_rows($resql);
188 dol_syslog(
'No dispatch for line '.$key.
' as too many combination warehouse, product, batch code was found ('.$num.
').');
189 setEventMessages($langs->trans(
'ErrorTooManyCombinationBatchcode', $numline, $num),
null,
'errors');
191 } elseif ($num < 1) {
193 $tmpwarehouse->fetch($warehouse_id);
195 $tmpprod->fetch($prod_id);
196 dol_syslog(
'No dispatch for line '.$key.
' as no combination warehouse, product, batch code was found.');
197 setEventMessages($langs->trans(
'ErrorNoCombinationBatchcode', $numline, $tmpwarehouse->ref, $tmpprod->ref, $lot),
null,
'errors');
210 $result = $expeditiondispatch->fetch($idline);
212 setEventMessages($expeditiondispatch->error, $expeditiondispatch->errors,
'errors');
215 $qtystart = $expeditiondispatch->qty;
216 $expeditiondispatch->qty = $newqty;
217 $expeditiondispatch->entrepot_id =
GETPOSTINT($ent);
220 $result = $expeditiondispatch->update($user);
222 $result = $expeditiondispatch->delete($user);
225 setEventMessages($expeditiondispatch->error, $expeditiondispatch->errors,
'errors');
229 if (!$error && $modebatch ==
"batch") {
231 $suffixkeyfordate = preg_replace(
'/^product_batch/',
'', $key);
232 $sellby =
dol_mktime(0, 0, 0,
GETPOST(
'dlc'.$suffixkeyfordate.
'month'),
GETPOST(
'dlc'.$suffixkeyfordate.
'day'),
GETPOST(
'dlc'.$suffixkeyfordate.
'year'),
'');
233 $eatby =
dol_mktime(0, 0, 0,
GETPOST(
'dluo'.$suffixkeyfordate.
'month'),
GETPOST(
'dluo'.$suffixkeyfordate.
'day'),
GETPOST(
'dluo'.$suffixkeyfordate.
'year'));
235 $sqlsearchdet =
"SELECT rowid FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element;
236 $sqlsearchdet .=
" WHERE fk_expeditiondet = ".((int) $idline);
237 $sqlsearchdet .=
" AND batch = '".$db->escape($lot).
"'";
238 $resqlsearchdet = $db->query($sqlsearchdet);
240 if ($resqlsearchdet) {
241 $objsearchdet = $db->fetch_object($resqlsearchdet);
247 $sql =
"UPDATE ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element.
" SET";
248 $sql .=
" eatby = ".($eatby ?
"'".$db->idate($eatby).
"'" :
"null");
249 $sql .=
" , sellby = ".($sellby ?
"'".$db->idate($sellby).
"'" :
"null");
250 $sql .=
" , qty = ".((float) $newqty);
251 $sql .=
" , fk_warehouse = ".((int) $warehouse_id);
252 $sql .=
" WHERE rowid = ".((int) $objsearchdet->rowid);
254 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element.
" (";
255 $sql .=
"fk_expeditiondet, eatby, sellby, batch, qty, fk_origin_stock, fk_warehouse)";
256 $sql .=
" VALUES (".((int) $idline).
", ".($eatby ?
"'".$db->idate($eatby).
"'" :
"null").
", ".($sellby ?
"'".$db->idate($sellby).
"'" :
"null").
", ";
257 $sql .=
" '".$db->escape($lot).
"', ".((float) $newqty).
", 0, ".((int) $warehouse_id).
")";
260 $sql =
" DELETE FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element;
261 $sql .=
" WHERE fk_expeditiondet = ".((int) $idline);
262 $sql .=
" AND batch = '".$db->escape($lot).
"'";
265 $resql = $db->query($sql);
273 $expeditiondispatch->fk_expedition =
$object->id;
274 $expeditiondispatch->entrepot_id =
GETPOSTINT($ent);
275 $expeditiondispatch->fk_elementdet =
GETPOSTINT($fk_commandedet);
276 $expeditiondispatch->qty = $newqty;
279 $idline = $expeditiondispatch->insert($user);
281 setEventMessages($expeditiondispatch->error, $expeditiondispatch->errors,
'errors');
285 if ($modebatch ==
"batch" && !$error) {
286 $expeditionlinebatch->sellby = $dDLUO;
287 $expeditionlinebatch->eatby = $dDLC;
288 $expeditionlinebatch->batch = $lot;
289 $expeditionlinebatch->qty = $newqty;
290 $expeditionlinebatch->fk_origin_stock = 0;
291 $expeditionlinebatch->fk_warehouse =
GETPOSTINT($ent);
293 $result = $expeditionlinebatch->create($idline);
295 setEventMessages($expeditionlinebatch->error, $expeditionlinebatch->errors,
'errors');
352 header(
"Location: ".DOL_URL_ROOT.
'/expedition/dispatch.php?id='.
$object->id);
355} elseif ($action ==
'setdate_livraison' && $usercancreate) {
359 $result =
$object->setDeliveryDate($user, $datedelivery);
372$form =
new Form($db);
374$warehouse_static =
new Entrepot($db);
376$title =
$object->ref.
" - ".$langs->trans(
'ShipmentDistribution');
377$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
378$morejs = array(
'/expedition/js/lib_dispatch.js.php');
380llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs);
386 $num_prod = count($lines);
398 $author =
new User($db);
399 $author->fetch(
$object->user_author_id);
409 if ($action ==
'ask_deleteline') {
410 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
414 $parameters = array(
'lineid' => $lineid);
416 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
417 if (empty($reshook)) {
418 $formconfirm .= $hookmanager->resPrint;
419 } elseif ($reshook > 0) {
420 $formconfirm = $hookmanager->resPrint;
426 if ($typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
428 $objectsrc->fetch(
$object->origin_object->id);
430 if ($typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
431 $objectsrc =
new Propal($db);
432 $objectsrc->fetch(
$object->origin_object->id);
436 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
437 $morehtmlref =
'<div class="refidno">';
440 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer, $object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
441 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_customer',
$object->ref_customer, $object, $user->hasRight(
'expedition',
'creer'),
'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ?
':' .
getDolGlobalString(
'THIRDPARTY_REF_INPUT_SIZE') :
''),
'', null, null,
'', 1);
444 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
446 if (isModEnabled(
'project')) {
447 $langs->load(
"projects");
448 $morehtmlref .=
'<br>';
450 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
451 if ($action !=
'classify' && $permissiontoadd) {
452 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
454 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ?
$object->socid : -1),
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
456 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
458 $proj->fetch($objectsrc->fk_project);
459 $morehtmlref .= $proj->getNomUrl(1);
461 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
466 $morehtmlref .=
'</div>';
468 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
471 print
'<div class="fichecenter">';
472 print
'<div class="underbanner clearboth"></div>';
474 print
'<table class="border tableforfield centpercent">';
477 if ($typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
479 print $langs->trans(
"RefOrder").
'</td>';
480 print
'<td colspan="3">';
481 print $objectsrc->getNomUrl(1,
'commande');
485 if ($typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
487 print $langs->trans(
"RefProposal").
'</td>';
488 print
'<td colspan="3">';
489 print $objectsrc->getNomUrl(1,
'expedition');
495 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
496 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
500 print
'<tr><td height="10">';
501 print
'<table class="nobordernopadding" width="100%"><tr><td>';
502 print $langs->trans(
'DateDeliveryPlanned');
504 if ($action !=
'editdate_livraison') {
505 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_livraison&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetDeliveryDate'), 1).
'</a></td>';
507 print
'</tr></table>';
508 print
'</td><td colspan="2">';
509 if ($action ==
'editdate_livraison') {
510 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
511 print
'<input type="hidden" name="token" value="'.newToken().
'">';
512 print
'<input type="hidden" name="action" value="setdate_livraison">';
513 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
514 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
520 print
'</tr></table>';
522 print
'<br><center>';
523 if (isModEnabled(
'barcode') || isModEnabled(
'productbatch')) {
524 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=updatebyscaning&token='.
currentToken().
'" class="marginrightonly paddingright marginleftonly paddingleft">'.
img_picto(
'',
'barcode',
'class="paddingrightonly"').$langs->trans(
"UpdateByScaning").
'</a>';
526 print
'<a href="#" id="resetalltoexpected" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto(
"",
'autofill',
'class="pictofixedwidth"').$langs->trans(
"RestoreWithCurrentQtySaved").
'</a></td>';
528 print
'<a href="#" id="autoreset" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto(
"",
'eraser',
'class="pictofixedwidth"').$langs->trans(
"ClearQtys").
'</a></td>';
535 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
537 $formproduct->loadWarehouses();
539 $listwarehouses = $entrepot->list_array(1);
542 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
544 print
'<input type="hidden" name="token" value="'.newToken().
'">';
545 print
'<input type="hidden" name="action" value="updatelines">';
546 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
548 print
'<div class="div-table-responsive-no-min">';
549 print
'<table class="noborder centpercent">';
552 $products_dispatched = array();
553 $sql =
"SELECT ed.fk_elementdet as rowid, sum(ed.qty) as qty";
554 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
555 $sql .=
" WHERE ed.fk_expedition = ".((int)
$object->id);
556 $sql .=
" GROUP BY ed.fk_elementdet";
558 $resql = $db->query($sql);
560 $num = $db->num_rows($resql);
565 $objd = $db->fetch_object($resql);
566 $products_dispatched[$objd->rowid] =
price2num($objd->qty,
'MS');
574 $sql =
"SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, '' AS sref, l.qty as qty,";
575 $sql .=
" p.ref, p.label, p.tobatch, p.fk_default_warehouse, p.barcode";
577 $parameters = array();
578 $reshook = $hookmanager->executeHooks(
579 'printFieldListSelect',
587 $sql .= $hookmanager->resPrint;
589 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commandedet as l";
590 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON l.fk_product=p.rowid";
591 $sql .=
" WHERE l.fk_commande = ".((int) $objectsrc->id);
593 $sql .=
" AND l.product_type = 0";
596 $parameters = array();
597 $reshook = $hookmanager->executeHooks(
598 'printFieldListWhere',
606 $sql .= $hookmanager->resPrint;
609 $sql .=
" ORDER BY l.rang, p.ref, p.label";
611 $resql = $db->query($sql);
613 $num = $db->num_rows($resql);
618 print
'<tr class="liste_titre">';
620 print
'<td>'.$langs->trans(
"Description").
'</td>';
621 if (isModEnabled(
'productbatch')) {
622 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
624 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
627 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
634 print
'<td class="right">'.$langs->trans(
"QtyOrdered").
'</td>';
636 print
'<td class="right">'.$langs->trans(
"QtyToShip");
638 print
'<td class="right">'.$langs->trans(
"QtyDispatchedShort").
'</td>';
640 print
'<td class="right">'.$langs->trans(
"Details");
641 print
'<td width="32"></td>';
644 if (!isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
645 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
646 print
'<td class="right">'.$langs->trans(
"ReductionShort").
' (%)</td>';
647 print
'<td class="right">'.$langs->trans(
"UpdatePrice").
'</td>';
651 print
'<td align="right">'.$langs->trans(
"Warehouse");
654 if (count($listwarehouses) > 1) {
655 print
'<br><span class="opacitymedium">'.$langs->trans(
"ForceTo").
'</span> '.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
656 } elseif (count($listwarehouses) == 1) {
657 print
'<br><span class="opacitymedium">'.$langs->trans(
"ForceTo").
'</span> '.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
663 $parameters = array();
664 $reshook = $hookmanager->executeHooks(
665 'printFieldListTitle',
673 print $hookmanager->resPrint;
682 $conf->cache[
'product'] = array();
686 $objp = $db->fetch_object($resql);
689 if (!$objp->fk_product > 0) {
692 $alreadydispatched = isset($products_dispatched[$objp->rowid]) ? $products_dispatched[$objp->rowid] : 0;
693 $remaintodispatch =
price2num($objp->qty, 5);
694 if ($remaintodispatch < 0 && !
getDolGlobalString(
'SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN')) {
695 $remaintodispatch = 0;
698 if ($remaintodispatch || !
getDolGlobalString(
'SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
707 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
709 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$objp->qty.
'">';
710 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" data-dispatched="'.((float) $alreadydispatched).
'" value="'.(float) $alreadydispatched.
'">';
711 print
'<tr class="oddeven">';
713 if (empty($conf->cache[
'product'][$objp->fk_product])) {
714 $tmpproduct =
new Product($db);
715 $tmpproduct->fetch($objp->fk_product);
716 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
718 $tmpproduct = $conf->cache[
'product'][$objp->fk_product];
721 $linktoprod = $tmpproduct->getNomUrl(1);
722 $linktoprod .=
' - '.$objp->label.
"\n";
724 if (isModEnabled(
'productbatch')) {
725 if ($objp->tobatch) {
727 print
'<td id="product_'.$i.
'" data-idproduct="'.$objp->fk_product.
'" data-barcode="'.$objp->barcode.
'">';
730 print
'<td class="dispatch_batch_number"></td>';
732 print
'<td class="dispatch_dlc"></td>';
735 print
'<td class="dispatch_dluo"></td>';
739 print
'<td id="product_'.$i.
'" data-idproduct="'.$objp->fk_product.
'" data-barcode="'.$objp->barcode.
'">';
742 print
'<td class="dispatch_batch_number">';
743 print
'<span class="opacitymedium small">'.$langs->trans(
"ProductDoesNotUseBatchSerial").
'</span>';
746 print
'<td class="dispatch_dlc"></td>';
749 print
'<td class="dispatch_dluo"></td>';
753 print
'<td colspan="4">';
759 $up_ht_disc = $objp->subprice;
760 if (!empty($objp->remise_percent) && !
getDolGlobalString(
'STOCK_EXCLUDE_DISCOUNT_FOR_PMP')) {
761 $up_ht_disc =
price2num($up_ht_disc * (100 - $objp->remise_percent) / 100,
'MU');
765 print
'<td class="right">'.$objp->qty.
'</td>';
768 print
'<td class="right">'.$alreadydispatched.
'</td>';
770 print
'<td class="right">';
776 $sql =
"SELECT ed.rowid";
777 $sql .=
", cd.fk_product";
778 $sql .=
", ".$db->ifsql(
'eb.rowid IS NULL',
'ed.qty',
'eb.qty').
" as qty";
779 $sql .=
", ed.fk_entrepot";
780 $sql .=
", eb.batch, eb.eatby, eb.sellby";
781 $sql .=
" FROM ".$db->prefix().
"expeditiondet as ed";
782 $sql .=
" LEFT JOIN ".$db->prefix().
"expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet";
783 $sql .=
" INNER JOIN ".$db->prefix().
"commandedet as cd on ed.fk_origin_line = cd.rowid";
784 $sql .=
" WHERE ed.fk_origin_line = ".(int) $objp->rowid;
785 $sql .=
" AND ed.fk_expedition = ".(int)
$object->id;
786 $sql .=
" ORDER BY ed.rowid, ed.fk_elementdet";
788 $resultsql = $db->query($sql);
791 $numd = $db->num_rows($resultsql);
794 $suffix =
"_".$j.
"_".$i;
795 $objd = $db->fetch_object($resultsql);
797 if (isModEnabled(
'productbatch') && (!empty($objd->batch) || (is_null($objd->batch) && $tmpproduct->status_batch > 0))) {
803 'is_information_row' =>
true,
808 $reshook = $hookmanager->executeHooks(
809 'printFieldListValue',
817 print $hookmanager->resPrint;
821 print
'<!-- line for batch '.$numline.
' -->';
822 print
'<tr class="oddeven autoresettr" name="'.$type.$suffix.
'" data-remove="clear">';
824 print
'<input id="fk_commandedet'.$suffix.
'" name="fk_commandedet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
825 print
'<input id="idline'.$suffix.
'" name="idline'.$suffix.
'" type="hidden" value="'.$objd->rowid.
'">';
826 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objd->fk_product.
'">';
828 print
'<!-- This is a U.P. (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
829 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
834 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.(GETPOSTISSET(
'lot_number'.$suffix) ?
GETPOST(
'lot_number'.$suffix) : $objd->batch).
'">';
838 print
'<td class="nowraponall">';
840 print $form->selectDate($dlcdatesuffix,
'dlc'.$suffix, 0, 0, 1,
'');
844 print
'<td class="nowraponall">';
846 print $form->selectDate($dluodatesuffix,
'dluo'.$suffix, 0, 0, 1,
'');
849 print
'<td colspan="2"> </td>';
859 'is_information_row' =>
true,
864 $reshook = $hookmanager->executeHooks(
865 'printFieldListValue',
873 print $hookmanager->resPrint;
877 print
'<!-- line no batch '.$numline.
' -->';
878 print
'<tr class="oddeven autoresettr" name="'.$type.$suffix.
'" data-remove="clear">';
879 print
'<td colspan="'.$colspan.
'">';
880 print
'<input id="fk_commandedet'.$suffix.
'" name="fk_commandedet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
881 print
'<input id="idline'.$suffix.
'" name="idline'.$suffix.
'" type="hidden" value="'.$objd->rowid.
'">';
882 print
'<input name="product'.$suffix.
'" type="hidden" value="'.$objd->fk_product.
'">';
883 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
884 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
888 print
'<td class="right nowraponall">';
889 print
'<a href="" id="reset'.$suffix.
'" class="resetline">'.
img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').
'</a>';
890 $suggestedvalue = (GETPOSTISSET(
'qty'.$suffix) ?
GETPOSTINT(
'qty'.$suffix) : $objd->qty);
892 print
'<input id="qty'.$suffix.
'" onchange="onChangeDispatchLineQty($(this))" name="qty'.$suffix.
'" data-type="'.$type.
'" data-index="'.$i.
'" class="width50 right qtydispatchinput" value="'.$suggestedvalue.
'" data-expected="'.$objd->qty.
'">';
895 if (isModEnabled(
'productbatch') && $objp->tobatch > 0) {
897 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" '.($numd != $j + 1 ?
'style="display:none"' :
'').
' onClick="addDispatchLine('.$i.
', \''.$type.
'\')"');
900 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" '.($numd != $j + 1 ?
'style="display:none"' :
'').
' onClick="addDispatchLine('.$i.
', \''.$type.
'\')"');
906 print
'<td class="right">';
907 if (count($listwarehouses) > 1) {
908 print $formproduct->selectWarehouses(
GETPOST(
"entrepot".$suffix) ?
GETPOST(
"entrepot".$suffix) : $objd->fk_entrepot,
"entrepot".$suffix,
'', 1, 0, $objp->fk_product,
'', 1, 0, null,
'csswarehouse'.$suffix);
909 } elseif (count($listwarehouses) == 1) {
910 print $formproduct->selectWarehouses(
GETPOST(
"entrepot".$suffix) ?
GETPOST(
"entrepot".$suffix) : $objd->fk_entrepot,
"entrepot".$suffix,
'', 0, 0, $objp->fk_product,
'', 1, 0, null,
'csswarehouse'.$suffix);
912 $langs->load(
"errors");
913 print $langs->trans(
"ErrorNoWarehouseDefined");
919 'is_information_row' =>
false,
924 $reshook = $hookmanager->executeHooks(
925 'printFieldListValue',
933 print $hookmanager->resPrint;
940 $suffix =
"_".$j.
"_".$i;
944 if (isModEnabled(
'productbatch') && !empty($objp->tobatch)) {
950 'is_information_row' =>
true,
955 $reshook = $hookmanager->executeHooks(
956 'printFieldListValue',
964 print $hookmanager->resPrint;
968 print
'<!-- line for batch '.$numline.
' (not dispatched line yet for this order line) -->';
969 print
'<tr class="oddeven autoresettr" name="'.$type.$suffix.
'" data-remove="clear">';
971 print
'<input id="fk_commandedet'.$suffix.
'" name="fk_commandedet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
972 print
'<input id="idline'.$suffix.
'" name="idline'.$suffix.
'" type="hidden" value="-1">';
973 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
975 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
976 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
980 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.
GETPOST(
'lot_number'.$suffix).
'">';
983 print
'<td class="nowraponall">';
985 print $form->selectDate($dlcdatesuffix,
'dlc'.$suffix, 0, 0, 1,
'');
989 print
'<td class="nowraponall">';
991 print $form->selectDate($dluodatesuffix,
'dluo'.$suffix, 0, 0, 1,
'');
994 print
'<td colspan="2"> </td>';
1002 $parameters = array(
1004 'is_information_row' =>
true,
1006 'suffix' => $suffix,
1009 $reshook = $hookmanager->executeHooks(
1010 'printFieldListValue',
1018 print $hookmanager->resPrint;
1022 print
'<!-- line no batch '.$numline.
' (not dispatched line yet for this order line) -->';
1023 print
'<tr class="oddeven autoresettr" name="'.$type.$suffix.
'" data-remove="clear">';
1024 print
'<td colspan="'.$colspan.
'">';
1025 print
'<input id="fk_commandedet'.$suffix.
'" name="fk_commandedet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
1026 print
'<input id="idline'.$suffix.
'" name="idline'.$suffix.
'" type="hidden" value="-1">';
1027 print
'<input name="product'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
1029 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
1030 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
1034 print
'<td class="right">';
1035 print
'<a href="" id="reset'.$suffix.
'" class="resetline">'.
img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').
'</a>';
1036 $amounttosuggest = (GETPOSTISSET(
'qty'.$suffix) ?
GETPOSTINT(
'qty'.$suffix) : (!
getDolGlobalString(
'SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO') ? $remaintodispatch : 0));
1037 if (count($products_dispatched)) {
1040 $amounttosuggest = (GETPOSTISSET(
'qty'.$suffix) ?
GETPOSTINT(
'qty'.$suffix) : (isset($products_dispatched[$objp->
rowid]) ? $products_dispatched[$objp->
rowid] :
''));
1042 print
'<input id="qty'.$suffix.
'" onchange="onChangeDispatchLineQty($(this))" name="qty'.$suffix.
'" data-index="'.$i.
'" data-type="text" class="width50 right qtydispatchinput" value="'.$amounttosuggest.
'" data-expected="'.$amounttosuggest.
'">';
1045 if (isModEnabled(
'productbatch') && $objp->tobatch > 0) {
1047 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" onClick="addDispatchLine('.$i.
', \''.$type.
'\')
"');
1050 print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
1056 print '<td class="right
">';
1057 if (count($listwarehouses) > 1) {
1058 print $formproduct->selectWarehouses(GETPOST("entrepot
".$suffix) ? GETPOST("entrepot
".$suffix) : ($objp->fk_default_warehouse ? $objp->fk_default_warehouse : ''), "entrepot
".$suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix);
1059 } elseif (count($listwarehouses) == 1) {
1060 print $formproduct->selectWarehouses(GETPOST("entrepot
".$suffix) ? GETPOST("entrepot
".$suffix) : ($objp->fk_default_warehouse ? $objp->fk_default_warehouse : ''), "entrepot
".$suffix, '', 0, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix);
1062 $langs->load("errors
");
1063 print $langs->trans("ErrorNoWarehouseDefined
");
1067 // Enable hooks to append additional columns
1068 $parameters = array(
1069 'is_information_row' => false, // this is a dispatch form row
1071 'suffix' => $suffix,
1074 $reshook = $hookmanager->executeHooks(
1075 'printFieldListValue',
1081 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1083 print $hookmanager->resPrint;
1092 dol_print_error($db);
1099 //$checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1101 print '<div class="center
">';
1102 $parameters = array();
1103 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1105 if (empty($reshook)) {
1106 /*if (empty($conf->reception->enabled)) {
1107 print $langs->trans("Comment").' : ';
1108 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1109 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1110 // print ' /
'.$object->ref_supplier; // Not yet available
1111 print '" class="flat
"><br>';
1113 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1116 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1121 print '<input type="submit
" id="submitform
" class="button" name="dispatch
" value="'.$langs->trans("Save").'"';
1123 if (!$usercancreate) {
1126 if (count($listwarehouses) <= 0) {
1138 // Message if nothing to dispatch
1141 if (!getDolGlobalString('SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
1142 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1144 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1151 print dol_get_fiche_end();
1153 // Popup for mass barcode scanning
1154 if ($action == 'updatebyscaning') {
1155 if ($permissiontoadd) {
1156 // Output the javascript to manage the scanner tool.
1160 var duplicatedbatchcode = [];
1166 function barcodescannerjs(){
1167 console.log("We
catch inputs in scanner box
");
1168 jQuery("#scantoolmessage
").text();
1170 var selectaddorreplace = $("select[
name=selectaddorreplace]
").val();
1171 var barcodemode = $("input[
name=barcodemode]:checked
").val();
1172 var barcodeproductqty = $("input[
name=barcodeproductqty]
").val();
1173 var warehousetouse = $("select[
name=warehousenew]
").val();
1174 var textarea = $("textarea[
name=barcodelist]
").val();
1175 var textarray = textarea.split(/[\s,;]+/);
1176 var tabproduct = [];
1177 duplicatedbatchcode = [];
1183 textarray = textarray.filter(function(value){
1186 if(textarray.some((element) => element != "")){
1187 $(".qtydispatchinput
").each(function(){
1188 id = $(this).attr(\'id\');
1189 idarray = id.split(\'_\');
1190 idproduct = idarray[2];
1191 id = idarray[1] + \'_\' + idarray[2];
1192 console.log("Analyze the line
"+id+" in inventory, barcodemode=
"+barcodemode);
1193 warehouse = $("#entrepot_
"+id).val();
1194 console.log(warehouse);
1195 productbarcode = $("#product_
"+idproduct).attr(\'data-barcode\');
1196 console.log(productbarcode);
1197 productbatchcode = $("#lot_number_
"+id).val();
1198 if(productbatchcode == undefined){
1199 productbatchcode = "";
1201 console.log(productbatchcode);
1203 if (barcodemode != "barcodeforproduct
") {
1204 tabproduct.forEach(product=>{
1205 console.log("product.Batch=
"+product.Batch+" productbatchcode=
"+productbatchcode);
1206 if(product.Batch != "" && product.Batch == productbatchcode){
1207 console.log("duplicate batch code found
for batch code
"+productbatchcode);
1208 duplicatedbatchcode.push(productbatchcode);
1212 productinput = $("#qty_
"+id).val();
1213 if(productinput == ""){
1216 tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
1218 console.log("Loop on each record entered in the textarea
");
1220 textarray.forEach(function(element,index){
1221 console.log("Process record element=
"+element+" id=
"+id);
1222 var verify_batch = false;
1223 var verify_barcode = false;
1224 switch(barcodemode){
1225 case "barcodeforautodetect
":
1226 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,"barcode
",true);
1227 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,"lotserial
",true);
1229 case "barcodeforproduct
":
1230 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,"barcode
");
1232 case "barcodeforlotserial
":
1233 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,"lotserial
");
1236 alert(\''.dol_escape_js($langs->trans("ErrorWrongBarcodemode
")).' "\
'+barcodemode+\'"\');
1237 throw \''.dol_escape_js($langs->trans(
'ErrorWrongBarcodemode')).
' "\'+barcodemode+\'"\';
1240 if (verify_batch == false && verify_barcode == false) { /* If the 2 flags are false, not found error */
1241 errortab2.push(element);
1242 } else if (verify_batch == true && verify_barcode == true) { /* If the 2 flags are true, error: we don t know which one to take */
1243 errortab3.push(element);
1244 } else if (verify_batch == true) {
1245 console.log("element="+element);
1246 console.log(duplicatedbatchcode);
1247 if (duplicatedbatchcode.includes(element)) {
1248 errortab1.push(element);
1253 if (Object.keys(errortab1).length < 1 && Object.keys(errortab2).length < 1 && Object.keys(errortab3).length < 1) {
1254 tabproduct.forEach(product => {
1256 if(product.hasOwnProperty("reelqty")){
1257 idprod = $("td[data-idproduct=\'"+product.fk_product+"\']").attr("id");
1258 idproduct = idprod.split("_")[1];
1259 console.log("We create a new line for product_"+idproduct);
1260 if(product.Barcode != null){
1261 modedispatch = "dispatch";
1263 modedispatch = "batch";
1265 addDispatchLine(idproduct,modedispatch);
1266 console.log($("tr[name^=\'"+modedispatch+"_\'][name$=\'_"+idproduct+"\']"));
1267 nbrTrs = $("tr[name^=\'"+modedispatch+"_\'][name$=\'_"+idproduct+"\']").length;
1269 $("#qty_"+(nbrTrs-1)+"_"+idproduct).val(product.Qty);
1270 $("#entrepot_"+(nbrTrs-1)+"_"+idproduct).val(product.Warehouse);
1272 if(modedispatch == "batch"){
1273 $("#lot_number_"+(nbrTrs-1)+"_"+idproduct).val(product.Batch);
1277 console.log("We change #qty_"+product.Id +" to match input in scanner box");
1278 $("#qty_"+product.Id).val(product.Qty);
1282 jQuery("#scantoolmessage").text("'.
dol_escape_js($langs->transnoentities(
"QtyWasAddedToTheScannedBarcode")).
'\n");
1283 /* document.forms["formrecord"].submit(); */
1285 let stringerror = "";
1286 if (Object.keys(errortab1).length > 0) {
1287 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorSameBatchNumber')).
': ";
1288 errortab1.forEach(element => {
1289 stringerror += (element + ", ")
1291 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
1293 if (Object.keys(errortab2).length > 0) {
1294 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCantFindCodeInInventory')).
': ";
1295 errortab2.forEach(element => {
1296 stringerror += (element + ", ")
1298 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
1300 if (Object.keys(errortab3).length > 0) {
1301 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCodeScannedIsBothProductAndSerial')).
': ";
1302 errortab3.forEach(element => {
1303 stringerror += (element + ", ")
1305 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
1307 if (Object.keys(errortab4).length > 0) {
1308 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorBarcodeNotFoundForProductWarehouse')).
': ";
1309 errortab4.forEach(element => {
1310 stringerror += (element + ", ")
1312 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
1315 jQuery("#scantoolmessage").html(\''.
dol_escape_js($langs->transnoentities(
"ErrorOnElementsInventory")).
'\' + stringerror);
1323 function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,mode,autodetect=
false){
1324 BarcodeIsInProduct=0;
1327 tabproduct.forEach(product => {
1328 $.ajax({ url: \
''.DOL_URL_ROOT.
'/expedition/ajax/searchfrombarcode.php\',
1329 data: { "token":"'.
newToken().
'", "action":"existbarcode","fk_entrepot": warehousetouse, "barcode":element, "mode":mode},
1332 success: function(response) {
1333 if (response.status == "success"){
1334 console.log(response.message);
1336 newproductrow = response.object;
1339 if (mode!="lotserial" && autodetect==false && !errortab4.includes(element)){
1340 errortab4.push(element);
1341 console.error(response.message);
1345 error : function(output) {
1346 console.error("Error on barcodeserialforproduct function");
1349 console.log("Product "+(index+=1)+": "+element);
1350 if(mode == "barcode"){
1351 testonproduct = product.Barcode
1352 }else if (mode == "lotserial"){
1353 testonproduct = product.Batch
1355 testonwarehouse = product.Warehouse;
1356 if(testonproduct == element && testonwarehouse == warehousetouse){
1357 if(selectaddorreplace == "add"){
1358 productqty = parseInt(product.Qty,10);
1359 product.Qty = productqty + parseInt(barcodeproductqty,10);
1360 }else if(selectaddorreplace == "replace"){
1361 if(product.fetched == false){
1362 product.Qty = barcodeproductqty
1363 product.fetched=true
1365 productqty = parseInt(product.Qty,10);
1366 product.Qty = productqty + parseInt(barcodeproductqty,10);
1369 BarcodeIsInProduct+=1;
1372 if(BarcodeIsInProduct==0 && newproductrow!=0){
1373 tabproduct.push({\'Id\':tabproduct.length-1,\'Warehouse\':newproductrow.fk_warehouse,\'Barcode\':mode=="barcode"?element:null,\'Batch\':mode=="lotserial"?element:null,\'Qty\':barcodeproductqty,\'fetched\':true,\'reelqty\':newproductrow.reelqty,\'fk_product\':newproductrow.fk_product,\'mode\':mode});
1376 if(BarcodeIsInProduct > 0){
1384 include DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
1386 print $formother->getHTMLScannerForm(
"barcodescannerjs",
'all', 1);
1390 print
'<script type="text/javascript">
1391 $(document).ready(function () {
1392 $("select[name=fk_default_warehouse]").change(function() {
1393 console.log("warehouse is modified");
1394 var fk_default_warehouse = $("option:selected", this).val();
1395 $("select[name^=entrepot_]").val(fk_default_warehouse).change();
1398 $("#autoreset").click(function() {
1399 console.log("we click on autoreset");
1400 $(".autoresettr").each(function(){
1401 id = $(this).attr("name");
1402 idtab = id.split("_");
1403 console.log("we process line "+id+" "+idtab);
1404 if ($(this).data("remove") == "clear") { /* data-remove=clear means that line qty must be cleared but line must not be removed */
1405 console.log("We clear the object to expected value")
1406 $("#qty_"+idtab[1]+"_"+idtab[2]).val("");
1408 qtyexpected = $("#qty_"+idtab[1]+"_"+idtab[2]).data("expected")
1409 console.log(qtyexpected);
1410 $("#qty_"+idtab[1]+"_"+idtab[2]).val(qtyexpected);
1411 qtydispatched = $("#qty_dispatched_0_"+idtab[2]).data("dispatched")
1412 $("#qty_dispatched_0_"+idtab[2]).val(qtydispatched);
1414 } else { /* data-remove=remove means that line must be removed */
1415 console.log("We remove the object")
1417 $("tr[name^=\'"+idtab[0]+"_\'][name$=\'_"+idtab[2]+"\']:last .splitbutton").show();
1423 $("#resetalltoexpected").click(function(){
1424 $(".qtydispatchinput").each(function(){
1425 console.log("We reset to expected "+$(this).attr("id")+" qty to dispatch");
1426 $(this).val($(this).data("expected"));
1431 $(".resetline").on("click", function(event) {
1432 event.preventDefault();
1433 id = $(this).attr("id");
1434 id = id.split("reset_");
1435 console.log("Reset trigger for id = qty_"+id[1]);
1436 $("#qty_"+id[1]).val("");
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
Class to manage warehouses.
Class to manage shipments.
const STATUS_DRAFT
Draft status.
Class to manage lines of shipment.
CRUD class for batch number management within shipment.
Class to manage products or services.
Class to manage projects.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_now($mode='auto')
Return date for now.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
treeview li table
No Email.
ui state ui widget content ui state ui widget header ui state a ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
shipping_prepare_head($object)
Prepare array with list of tabs.
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall TAKEPOS_SHOW_SUBPRICE right right right takeposterminal SELECT e rowid