35require
'../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
37require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
45if (isModEnabled(
'project')) {
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
58$langs->loadLangs(array(
"bills",
"orders",
"sendings",
"companies",
"deliveries",
"products",
"stocks",
"receptions"));
60if (isModEnabled(
'productbatch')) {
61 $langs->load(
'productbatch');
68$action =
GETPOST(
'action',
'aZ09');
69$fk_default_warehouse =
GETPOSTINT(
'fk_default_warehouse');
70$cancel =
GETPOST(
'cancel',
'alpha');
71$confirm =
GETPOST(
'confirm',
'alpha');
74 $socid = $user->socid;
77$hookmanager->initHooks(array(
'ordersupplierdispatch'));
81if (GETPOSTISSET(
"projectid")) {
87if ($id > 0 || !empty($ref)) {
88 $result =
$object->fetch($id, $ref);
92 $result =
$object->fetch_thirdparty();
98if (empty(
$conf->reception->enabled)) {
99 $permissiontoreceive = $user->hasRight(
"fournisseur",
"commande",
"receptionner");
100 $permissiontocontrol = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"commande",
"receptionner")) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"commande_advance",
"check")));
102 $permissiontoreceive = $user->hasRight(
"reception",
"creer");
103 $permissiontocontrol = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"reception",
"creer")) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"reception",
"reception_advance",
"validate")));
107$result =
restrictedArea($user,
'fournisseur', $object,
'commande_fournisseur',
'commande');
109if (!isModEnabled(
'stock')) {
113$usercancreate = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
114$permissiontoadd = $usercancreate;
123$parameters = array();
124$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
129if ($action ==
'checkdispatchline' && $permissiontocontrol) {
134 $result = $supplierorderdispatch->fetch($lineid);
137 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
142 $result = $supplierorderdispatch->setStatut(1);
144 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
151 $result =
$object->calcAndSetStatusDispatch($user);
165if ($action ==
'uncheckdispatchline' && $permissiontocontrol) {
170 $result = $supplierorderdispatch->fetch($lineid);
173 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
178 $result = $supplierorderdispatch->setStatut(0);
180 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
186 $result =
$object->calcAndSetStatusDispatch($user);
200if ($action ==
'denydispatchline' && $permissiontocontrol) {
205 $result = $supplierorderdispatch->fetch($lineid);
208 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
213 $result = $supplierorderdispatch->setStatut(2);
215 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
221 $result =
$object->calcAndSetStatusDispatch($user);
235$saveprice =
"savepriceIsNotSet";
236if ($action ==
'dispatch' && $permissiontoreceive) {
242 foreach ($_POST as $key => $value) {
245 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
250 $prod =
"product_".$reg[1].
'_'.$reg[2];
251 $qty =
"qty_".$reg[1].
'_'.$reg[2];
252 $ent =
"entrepot_".$reg[1].
'_'.$reg[2];
254 $ent = $fk_default_warehouse;
256 $pu =
"pu_".$reg[1].
'_'.$reg[2];
257 $fk_commandefourndet =
"fk_commandefourndet_".$reg[1].
'_'.$reg[2];
260 if (!isModEnabled(
"multicurrency") && empty(
$conf->dynamicprices->enabled)) {
261 $dto =
GETPOSTINT(
"dto_".$reg[1].
'_'.$reg[2]);
263 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
265 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
272 if ($qtytomove != 0) {
274 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
275 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline);
276 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
281 $result =
$object->dispatchProduct($user,
GETPOSTINT($prod), $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'),
'',
'',
'',
GETPOSTINT($fk_commandefourndet), $notrigger);
287 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
288 if (!isModEnabled(
"multicurrency") && empty(
$conf->dynamicprices->enabled)) {
295 if (GETPOSTISSET($saveprice)) {
297 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
298 $sql .=
" SET unitprice='".price2num(
GETPOST($pu),
'MU').
"'";
299 $sql .=
", price=".price2num(
GETPOST($pu),
'MU').
"*quantity";
300 $sql .=
", remise_percent = ".((float) $dto);
301 $sql .=
" WHERE fk_soc=".((int)
$object->socid);
302 $sql .=
" AND fk_product=".(GETPOSTINT($prod));
304 $resql = $db->query($sql);
312 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
318 $prod =
'product_batch_'.$reg[1].
'_'.$reg[2];
319 $qty =
'qty_'.$reg[1].
'_'.$reg[2];
320 $ent =
'entrepot_'.$reg[1].
'_'.$reg[2];
321 $pu =
'pu_'.$reg[1].
'_'.$reg[2];
322 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
323 $lot =
'lot_number_'.$reg[1].
'_'.$reg[2];
327 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
330 if (!isModEnabled(
"multicurrency") && empty(
$conf->dynamicprices->enabled)) {
331 $dto =
GETPOSTINT(
"dto_".$reg[1].
'_'.$reg[2]);
333 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
335 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
342 if ($qtytomove > 0) {
346 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
347 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
348 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
361 if (!
GETPOST($lot,
'alpha') && !$dDLUO && !$dDLC) {
362 dol_syslog(
'No dispatch for line '.$key.
' as serial/eat-by/sellby date are not set');
363 $text = $langs->transnoentities(
'atleast1batchfield').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
364 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
369 $result =
$object->dispatchProduct($user, $productId, $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'), $dDLUO, $dDLC,
GETPOST($lot,
'alpha'),
GETPOSTINT($fk_commandefourndet), $notrigger);
375 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
376 if (!isModEnabled(
"multicurrency") && empty(
$conf->dynamicprices->enabled)) {
377 $dto =
GETPOSTINT(
"dto_".$reg[1].
'_'.$reg[2]);
379 if (GETPOSTISSET($saveprice)) {
381 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
382 $sql .=
" SET unitprice = ".price2num(
GETPOST($pu),
'MU', 2);
383 $sql .=
", price = ".price2num(
GETPOST($pu),
'MU', 2).
" * quantity";
384 $sql .=
", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2).
"'";
385 $sql .=
" WHERE fk_soc = ".((int)
$object->socid);
386 $sql .=
" AND fk_product=".((int) $productId);
388 $resql = $db->query($sql);
398 $result =
$object->calcAndSetStatusDispatch($user,
GETPOST(
'closeopenorder') ? 1 : 0,
GETPOST(
'comment'));
405 if ($result >= 0 && !$error) {
410 header(
"Location: dispatch.php?id=".$id);
425if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoreceive) {
429 $result = $supplierorderdispatch->fetch($lineid);
431 $qty = $supplierorderdispatch->qty;
432 $entrepot = $supplierorderdispatch->fk_entrepot;
433 $product = $supplierorderdispatch->fk_product;
435 $comment = $supplierorderdispatch->comment;
436 $eatby = $supplierorderdispatch->eatby;
437 $sellby = $supplierorderdispatch->sellby;
438 $batch = $supplierorderdispatch->batch;
440 $result = $supplierorderdispatch->delete($user);
447 if ($entrepot > 0 && isModEnabled(
'stock') &&
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') && empty($supplierorderdispatch->fk_reception)) {
452 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment,
'', $eatby, $sellby, $batch);
454 $errors = $mouv->errors;
469if ($action ==
'updateline' && $permissiontoreceive && empty($cancel)) {
473 $result = $supplierorderdispatch->fetch($lineid);
475 $qty = $supplierorderdispatch->qty;
476 $entrepot = $supplierorderdispatch->fk_entrepot;
477 $product = $supplierorderdispatch->fk_product;
479 $comment = $supplierorderdispatch->comment;
480 $eatby = $supplierorderdispatch->eatby;
481 $sellby = $supplierorderdispatch->sellby;
482 $batch = $supplierorderdispatch->batch;
484 $supplierorderdispatch->qty =
GETPOSTFLOAT(
'qty',
'MS');
485 $supplierorderdispatch->fk_entrepot =
GETPOSTINT(
'fk_entrepot');
486 $result = $supplierorderdispatch->update($user);
490 $errors = $supplierorderdispatch->errors;
493 if ($entrepot > 0 && isModEnabled(
'stock') &&
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')) {
498 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment,
'', $eatby, $sellby, $batch);
500 $errors = $mouv->errors;
504 $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, $eatby, $sellby, $batch);
506 $errors = $mouv->errors;
528$form =
new Form($db);
530$warehouse_static =
new Entrepot($db);
533$title =
$object->ref.
" - ".$langs->trans(
'OrderDispatch');
534$help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
535$morejs = array(
'/fourn/js/lib_dispatch.js.php');
537llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs,
'',
'',
'mod-supplier-order page-card_dispatch');
539if ($id > 0 || !empty($ref)) {
543 $author =
new User($db);
544 $author->fetch(
$object->user_author_id);
548 $title = $langs->trans(
"SupplierOrder");
554 if ($action ==
'ask_deleteline') {
555 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
559 $parameters = array(
'lineid' => $lineid);
561 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
562 if (empty($reshook)) {
563 $formconfirm .= $hookmanager->resPrint;
564 } elseif ($reshook > 0) {
565 $formconfirm = $hookmanager->resPrint;
573 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
575 $morehtmlref =
'<div class="refidno">';
577 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'', 0, 1);
578 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'',
null,
null,
'', 1);
580 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
582 if (isModEnabled(
'project')) {
583 $langs->load(
"projects");
584 $morehtmlref .=
'<br>';
586 $caneditproject =
false;
587 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
588 if ($action !=
'classify' && $caneditproject) {
589 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
591 $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');
593 if (!empty(
$object->fk_project)) {
595 $proj->fetch(
$object->fk_project);
596 $morehtmlref .= $proj->getNomUrl(1);
598 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
603 $morehtmlref .=
'</div>';
606 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
609 print
'<div class="fichecenter">';
610 print
'<div class="underbanner clearboth"></div>';
612 print
'<table class="border tableforfield" width="100%">';
615 if (
$object->methode_commande_id > 0) {
616 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td>';
622 if (
$object->methode_commande) {
623 print
'<tr><td>'.$langs->trans(
"Method").
'</td><td>'.
$object->getInputMethod().
'</td></tr>';
628 print
'<tr><td class="titlefield">'.$langs->trans(
"AuthorRequest").
'</td>';
629 print
'<td>'.$author->getNomUrl(1,
'', 0, 0, 0).
'</td>';
632 $parameters = array();
633 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
646 print
'<br><span class="opacitymedium">'.$langs->trans(
"OrderStatusNotReadyToDispatch").
'</span>';
652 $listwarehouses = array();
657 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
659 $formproduct->loadWarehouses();
661 $listwarehouses = $entrepot->list_array(1);
664 if (empty(
$conf->reception->enabled)) {
665 print
'<form method="POST" action="dispatch.php?id='.$object->id.
'">';
667 print
'<form method="post" action="'.dol_buildpath(
'/reception/card.php', 1).
'?originid='.
$object->id.
'&origin=supplierorder">';
670 print
'<input type="hidden" name="token" value="'.newToken().
'">';
671 if (empty(
$conf->reception->enabled)) {
672 print
'<input type="hidden" name="action" value="dispatch">';
674 print
'<input type="hidden" name="action" value="create">';
677 print
'<div class="div-table-responsive-no-min">';
678 print
'<table class="noborder centpercent">';
681 $products_dispatched = array();
682 $sql =
"SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
683 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
684 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l on l.rowid = cfd.fk_elementdet";
685 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
686 $sql .=
" GROUP BY l.rowid, cfd.fk_product";
688 $resql = $db->query($sql);
690 $num = $db->num_rows($resql);
695 $objd = $db->fetch_object($resql);
696 $products_dispatched[$objd->rowid] =
price2num($objd->qty,
'MS');
704 $sql =
"SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, l.qty as qty,";
705 $sql .=
" p.ref, p.label, p.tobatch, p.fk_default_warehouse";
708 $parameters = array();
709 $reshook = $hookmanager->executeHooks(
710 'printFieldListSelect',
718 $sql .= $hookmanager->resPrint;
720 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l";
721 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON l.fk_product=p.rowid";
722 $sql .=
" WHERE l.fk_commande = ".((int)
$object->id);
724 $sql .=
" AND l.product_type = 0";
728 $parameters = array();
729 $reshook = $hookmanager->executeHooks(
730 'printFieldListWhere',
738 $sql .= $hookmanager->resPrint;
741 $sql .=
" ORDER BY l.rang, p.ref, p.label";
747 $resql = $db->query($sql);
749 $num = $db->num_rows($resql);
753 print
'<tr class="liste_titre">';
755 print
'<td>'.$langs->trans(
"Description").
'</td>';
756 if (isModEnabled(
'productbatch')) {
757 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
759 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
762 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
769 print
'<td class="right">'.$langs->trans(
"SupplierRef").
'</td>';
770 print
'<td class="right">'.$langs->trans(
"QtyOrdered").
'</td>';
771 print
'<td class="right">'.$langs->trans(
"QtyDispatchedShort").
'</td>';
772 print
' <td class="right">'.$langs->trans(
"QtyToDispatchShort");
773 print
'<br><a href="#" id="autoreset">'.img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').$langs->trans(
"Reset").
'</a></td>';
774 print
'<td width="32"></td>';
777 if (!isModEnabled(
"multicurrency") && empty(
$conf->dynamicprices->enabled)) {
778 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
779 print
'<td class="right">'.$langs->trans(
"ReductionShort").
' (%)</td>';
780 print
'<td class="right">'.$langs->trans(
"UpdatePrice").
'</td>';
784 print
'<td align="right">'.$langs->trans(
"Warehouse");
787 if (count($listwarehouses) > 1) {
788 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, $langs->trans(
"ForceTo"), 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
789 } elseif (count($listwarehouses) == 1) {
790 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
796 $parameters = array();
797 $reshook = $hookmanager->executeHooks(
798 'printFieldListTitle',
806 print $hookmanager->resPrint;
813 $conf->cache[
'product'] = array();
817 $objp = $db->fetch_object($resql);
820 if (!$objp->fk_product > 0) {
823 $alreadydispatched = isset($products_dispatched[$objp->rowid]) ? $products_dispatched[$objp->rowid] : 0;
824 $remaintodispatch =
price2num($objp->qty - ((
float) $alreadydispatched), 5);
825 if ($remaintodispatch < 0 && !
getDolGlobalString(
'SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN')) {
826 $remaintodispatch = 0;
829 if ($remaintodispatch || !
getDolGlobalString(
'SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
838 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
840 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$objp->qty.
'">';
841 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.(float) $alreadydispatched.
'">';
842 print
'<tr class="oddeven">';
844 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
845 $tmpproduct =
new Product($db);
846 $tmpproduct->fetch($objp->fk_product);
847 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
849 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
852 $linktoprod = $tmpproduct->getNomUrl(1);
853 $linktoprod .=
' - '.$objp->label.
"\n";
855 if (isModEnabled(
'productbatch')) {
856 if ($objp->tobatch) {
861 print
'<td class="dispatch_batch_number"></td>';
863 print
'<td class="dispatch_dlc"></td>';
866 print
'<td class="dispatch_dluo"></td>';
873 print
'<td class="dispatch_batch_number">';
874 print
'<span class="opacitymedium small">'.$langs->trans(
"ProductDoesNotUseBatchSerial").
'</small>';
877 print
'<td class="dispatch_dlc"></td>';
880 print
'<td class="dispatch_dluo"></td>';
884 print
'<td colspan="4">';
890 $up_ht_disc = $objp->subprice;
891 if (!empty($objp->remise_percent) && !
getDolGlobalString(
'STOCK_EXCLUDE_DISCOUNT_FOR_PMP')) {
892 $up_ht_disc =
price2num($up_ht_disc * (100 - $objp->remise_percent) / 100,
'MU');
896 print
'<td class="right">'.$objp->sref.
'</td>';
899 print
'<td class="right">'.$objp->qty.
'</td>';
902 print
'<td class="right">'.$alreadydispatched.
'</td>';
904 if (isModEnabled(
'productbatch') && $objp->tobatch > 0) {
906 print
'<td class="right">';
916 'is_information_row' =>
true,
921 $reshook = $hookmanager->executeHooks(
922 'printFieldListValue',
930 print $hookmanager->resPrint;
934 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
936 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
937 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
939 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
941 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
943 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
949 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.
GETPOST(
'lot_number'.$suffix).
'">';
952 print
'<td class="nowraponall">';
954 print $form->selectDate($dlcdatesuffix,
'dlc'.$suffix, 0, 0, 1,
'');
958 print
'<td class="nowraponall">';
960 print $form->selectDate($dluodatesuffix,
'dluo'.$suffix, 0, 0, 1,
'');
963 print
'<td colspan="3"> </td>';
969 print
'<td class="right">';
979 'is_information_row' =>
true,
984 $reshook = $hookmanager->executeHooks(
985 'printFieldListValue',
993 print $hookmanager->resPrint;
997 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
998 print
'<td colspan="'.$colspan.
'">';
999 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
1000 print
'<input name="product'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
1002 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
1004 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
1006 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
1013 print
'<td class="right nowrap">';
1014 if ($remaintodispatch > 0) {
1015 $btnLabel = $langs->trans(
"Fill").
' : '.$remaintodispatch;
1016 print
'<button class="auto-fill-qty btn-low-emphasis --btn-icon" data-rowname="qty'.$suffix.
'" data-value="'.$remaintodispatch.
'" title="'.
dol_escape_htmltag($btnLabel).
'" aria-label="'.
dol_escape_htmltag($btnLabel).
'" >'.
img_picto($btnLabel,
'fa-arrow-right',
'aria-hidden="true"', 0, 0, 1).
'</button>';
1018 print
'<input id="qty'.$suffix.
'" name="qty'.$suffix.
'" type="number" step="any" class="width50 right qtydispatchinput" value="'.(GETPOSTISSET(
'qty'.$suffix) ?
GETPOSTINT(
'qty'.$suffix) : (!
getDolGlobalString(
'SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO') ? $remaintodispatch : 0)).
'">';
1019 print
'<button class="resetline btn-low-emphasis --btn-icon" id="reset'.$suffix.
'" title="'.
dol_escape_htmltag($langs->trans(
"Reset")).
'" >'.
img_picto($langs->trans(
"Reset"),
'eraser',
'aria-hidden="true"', 0, 0, 1).
'</button>';
1023 if (isModEnabled(
'productbatch') && $objp->tobatch > 0) {
1025 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" onClick="addDispatchLine('.$i.
', \''.$type.
'\')
"');
1028 print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
1032 if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
1033 if (!isModEnabled("multicurrency
") && empty($conf->dynamicprices->enabled)) {
1035 print '<td class="right
">';
1036 print '<input id="pu
'.$suffix.'" name="pu
'.$suffix.'" type="text
" size="8
" value="'.price((GETPOST('pu
'.$suffix) != '' ? price2num(GETPOST('pu
'.$suffix)) : $up_ht_disc)).'">';
1040 print '<td class="right
">';
1041 print '<input id="dto
'.$suffix.'" name="dto
'.$suffix.'" type="text
" size="8
" value="'.(GETPOST('dto
'.$suffix) != '' ? GETPOST('dto
'.$suffix) : '').'">';
1045 print '<td class="center
">';
1046 print '<input class="flat checkformerge
" type="checkbox
" name="saveprice
'.$suffix.'" value="'.(GETPOST('saveprice
'.$suffix) != '' ? GETPOST('saveprice
'.$suffix) : '').'">';
1052 print '<td class="right
">';
1053 if (count($listwarehouses) > 1) {
1054 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, array(), 'csswarehouse'.$suffix);
1055 } elseif (count($listwarehouses) == 1) {
1056 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, array(), 'csswarehouse'.$suffix);
1058 $langs->load("errors
");
1059 print $langs->trans("ErrorNoWarehouseDefined
");
1063 // Enable hooks to append additional columns
1064 $parameters = array(
1065 'is_information_row' => false, // this is a dispatch form row
1067 'suffix' => $suffix,
1070 $reshook = $hookmanager->executeHooks(
1071 'printFieldListValue',
1077 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1079 print $hookmanager->resPrint;
1088 dol_print_error($db);
1095 $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1097 print '<div class="center
">';
1098 $parameters = array();
1099 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1101 if (empty($reshook)) {
1102 if (empty($conf->reception->enabled)) {
1103 print $langs->trans("Comment").' : ';
1104 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1105 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1106 // print ' /
'.$object->ref_supplier; // Not yet available
1107 print '" class="flat
"><br>';
1109 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1112 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1115 print '<input type="hidden
" name="backtopageforcancel
" value="'.$_SERVER["PHP_SELF"].'?
id=
'.$object->id.'">';
1116 print '<input type="submit
" class="button" name="dispatch
" value="'.dol_escape_htmltag($dispatchBt).'"';
1118 if (!$permissiontoreceive) {
1121 if (count($listwarehouses) <= 0) {
1133 // Message if nothing to dispatch
1136 if (!getDolGlobalString('SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
1137 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1139 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1146 print dol_get_fiche_end();
1148 // traitement entrepot par défaut
1149 print '<script type="text/javascript
">
1150 $(document).ready(function () {
1151 $("select[
name=fk_default_warehouse]
").change(function() {
1152 var fk_default_warehouse = $("option:selected
", this).val();
1153 $("select[
name^=entrepot_]
").val(fk_default_warehouse).change();
1156 $(".auto-fill-qty
").on("click touchstart
", function(e){
1158 $("input[
name=
"+$(this).data("rowname
")+"]
").val($(this).data("value
")).trigger("change
");
1161 $("#autoreset
").click(function() {
1162 $(".qtydispatchinput
").each(function(){
1163 id = $(this).attr("id");
1164 idtab = id.split("_
");
1168 $("#qty_dispatched_0_
"+idtab[2]).val("0
");
1170 obj = $(this).parent().parent();
1171 nameobj = obj.attr("name");
1172 nametab = nameobj.split("_
");
1174 $("tr[
name^=\
'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
1179 $(".resetline").click(function(e){
1181 id = $(this).attr("id");
1182 id = id.split("reset_");
1183 console.log("Reset trigger for id = qty_"+id[1]);
1184 $("#qty_"+id[1]).val("");
1190 $sql =
"SELECT p.rowid as pid, p.ref, p.label,";
1191 $sql .=
" e.rowid as warehouse_id, e.ref as entrepot,";
1192 $sql .=
" cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
1193 $sql .=
" ,cd.rowid, cd.subprice";
1194 if (isModEnabled(
'reception')) {
1195 $sql .=
", cfd.fk_reception, r.date_delivery";
1197 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p,";
1198 $sql .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
1199 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet";
1200 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"entrepot as e ON cfd.fk_entrepot = e.rowid";
1201 if (isModEnabled(
'reception')) {
1202 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"reception as r ON cfd.fk_reception = r.rowid";
1204 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
1205 $sql .=
" AND cfd.fk_product = p.rowid";
1206 $sql .=
" ORDER BY cfd.rowid ASC";
1208 $resql = $db->query($sql);
1210 $num = $db->num_rows($resql);
1218 print
'<div class="div-table-responsive">';
1219 print
'<table id="dispatch_received_products" class="noborder centpercent">';
1221 print
'<tr class="liste_titre">';
1223 if (isModEnabled(
"reception")) {
1224 print
'<td>'.$langs->trans(
"Reception").
'</td>';
1227 print
'<td>'.$langs->trans(
"Product").
'</td>';
1228 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
1229 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1230 if (isModEnabled(
'productbatch')) {
1231 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
1233 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
1236 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
1239 print
'<td class="right">'.$langs->trans(
"QtyDispatched").
'</td>';
1240 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
1241 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1244 if (
getDolGlobalString(
'SUPPLIER_ORDER_USE_DISPATCH_STATUS') && !isModEnabled(
"reception")) {
1245 print
'<td class="center" colspan="2">'.$langs->trans(
"Status").
'</td>';
1246 } elseif (isModEnabled(
"reception")) {
1247 print
'<td class="center"></td>';
1250 print
'<td class="center" colspan="2"></td>';
1256 $objp = $db->fetch_object($resql);
1258 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1259 print
'<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#line_'.
GETPOSTINT(
'lineid').
'" method="POST">
1260 <input type="hidden" name="token" value="'.
newToken().
'">
1261 <input type="hidden" name="action" value="updateline">
1262 <input type="hidden" name="mode" value="">
1263 <input type="hidden" name="lineid" value="'.$objp->dispatchlineid.
'">';
1266 print
'<tr class="oddeven" id="line_'.$objp->dispatchlineid.
'" >';
1270 if (isModEnabled(
"reception")) {
1271 print
'<td class="nowraponall">';
1272 if (!empty($objp->fk_reception)) {
1274 $reception->fetch($objp->fk_reception);
1275 print $reception->getNomUrl(1);
1282 print
'<td class="tdoverflowmax150">';
1283 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
1284 $tmpproduct =
new Product($db);
1285 $tmpproduct->fetch($objp->fk_product);
1286 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
1288 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
1290 print $tmpproduct->getNomUrl(1);
1291 print
' - '.$objp->label;
1295 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'day').
'</td>';
1298 if (property_exists($objp,
"date_delivery")) {
1299 print
'<td class="center">' .
dol_print_date($db->jdate($objp->date_delivery),
'day') .
'</td>';
1301 print
'<td class="center"></td>';
1305 if (isModEnabled(
'productbatch')) {
1307 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1309 $lot->fetch(0, $objp->pid, $objp->batch);
1310 print
'<td class="dispatch_batch_number">'.$lot->getNomUrl(1).
'</td>';
1312 print
'<td class="dispatch_dlc">'.dol_print_date($lot->sellby,
'day').
'</td>';
1315 print
'<td class="dispatch_dluo">'.dol_print_date($lot->eatby,
'day').
'</td>';
1318 print
'<td class="dispatch_batch_number"></td>';
1320 print
'<td class="dispatch_dlc"></td>';
1323 print
'<td class="dispatch_dluo"></td>';
1329 print
'<td class="right">';
1330 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1331 print
'<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.
'" />';
1335 print
'<input type="hidden" name="price" value="'.$objp->subprice.
'" />';
1338 print
'<td class="tdoverflowmax150">';
1339 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1340 $warehouse_id =
GETPOSTINT(
"fk_entrepot") ?
GETPOSTINT(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
'');
1341 if (count($listwarehouses) > 1) {
1342 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 1, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1343 } elseif (count($listwarehouses) == 1) {
1344 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 0, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1346 $langs->load(
"errors");
1347 print $langs->trans(
"ErrorNoWarehouseDefined");
1350 $warehouse_static->id = $objp->warehouse_id;
1351 $warehouse_static->label = $objp->entrepot;
1352 print $warehouse_static->getNomUrl(1);
1357 print
'<td class="tdoverflowmax300" style="white-space: pre;">'.$objp->comment.
'</td>';
1360 if (
getDolGlobalString(
'SUPPLIER_ORDER_USE_DISPATCH_STATUS') && !isModEnabled(
"reception")) {
1361 print
'<td class="right">';
1362 $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status);
1364 print $supplierorderdispatch->getLibStatut(5);
1368 print
'<td class="center">';
1369 if (!$permissiontocontrol) {
1370 if (empty($objp->status)) {
1371 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Approve").
'</a>';
1372 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1374 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Disapprove").
'</a>';
1375 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1379 if (
$object->status == $object::STATUS_RECEIVED_COMPLETELY) {
1382 if (empty($objp->status)) {
1383 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1384 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1386 if ($objp->status == 1) {
1387 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1388 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1390 if ($objp->status == 2) {
1391 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1392 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1396 } elseif (isModEnabled(
"reception")) {
1397 print
'<td class="right">';
1398 if ($reception !==
null && !empty($reception->id)) {
1399 print $reception->getLibStatut(5);
1405 if ($action !=
'editline' || $lineid != $objp->dispatchlineid) {
1406 if (($reception ===
null) || empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) {
1407 print
'<td class="linecoledit center">';
1408 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#line_'.$objp->dispatchlineid.
'">';
1413 print
'<td class="linecoldelete center">';
1414 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#dispatch_received_products">';
1419 print
'<td></td><td></td>';
1422 print
'<td class="center valignmiddle">';
1423 print
'<input type="submit" class="button button-save" id="savelinebutton" name="save" value="'.$langs->trans(
"Save").
'" />';
1425 print
'<td class="center valignmiddle">';
1426 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'" />';
1432 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage table ReceptionLineBatch.
Class to manage predefined suppliers products.
const STATUS_RECEIVED_PARTIALLY
Received partially.
const STATUS_CANCELED
Order canceled.
const STATUS_RECEIVED_COMPLETELY
Received completely.
const STATUS_ACCEPTED
Accepted.
const STATUS_ORDERSENT
Order sent, shipment on process.
Class to manage warehouses.
Class to manage stock movements.
Class to manage products or services.
Class with list of lots and properties.
Class to manage projects.
Class to manage receptions.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
ordersupplier_prepare_head(CommandeFournisseur $object)
Prepare array with list of tabs.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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 '.
dol_now($mode='auto')
Return date for now.
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.
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 a 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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$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.