35require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
46require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
59$langs->loadLangs(array(
"bills",
"orders",
"sendings",
"companies",
"products",
"stocks",
"receptions"));
62 $langs->load(
'productbatch');
69$action =
GETPOST(
'action',
'aZ09');
70$fk_default_warehouse =
GETPOSTINT(
'fk_default_warehouse');
71$cancel =
GETPOST(
'cancel',
'alpha');
72$confirm =
GETPOST(
'confirm',
'alpha');
74if ($user->isExternalUser()) {
75 $socid = $user->isExternalUser();
78$hookmanager->initHooks(array(
'ordersupplierdispatch'));
88if ($id > 0 || !empty($ref)) {
89 $result =
$object->fetch($id, $ref);
93 $result =
$object->fetch_thirdparty();
99if (empty(
$conf->reception->enabled)) {
100 $permissiontoreceive = $user->hasRight(
"fournisseur",
"commande",
"receptionner");
101 $permissiontocontrol = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"commande",
"receptionner")) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"commande_advance",
"check")));
103 $permissiontoreceive = $user->hasRight(
"reception",
"creer");
104 $permissiontocontrol = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"reception",
"creer")) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"reception",
"reception_advance",
"validate")));
108$result =
restrictedArea($user,
'fournisseur', $object,
'commande_fournisseur',
'commande');
114$usercancreate = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
115$permissiontoadd = $usercancreate;
124$parameters = array();
125$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
127 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
131if (in_array($action, [
'checkdispatchline',
'uncheckdispatchline',
'denydispatchline',
'confirm_deleteline',
'updateline'])) {
133 if ($tmpdispatchline->fetch($lineid) <= 0 || (
int) $tmpdispatchline->fk_element !== (
int)
$object->id) {
134 setEventMessages($langs->trans(
'ErrorRecordNotFound'),
null,
'errors');
139if ($action ==
'checkdispatchline' && $permissiontocontrol) {
144 $result = $supplierorderdispatch->fetch($lineid);
147 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
152 $result = $supplierorderdispatch->setStatut(1);
154 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
161 $result =
$object->calcAndSetStatusDispatch($user);
175if ($action ==
'uncheckdispatchline' && $permissiontocontrol) {
180 $result = $supplierorderdispatch->fetch($lineid);
183 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
188 $result = $supplierorderdispatch->setStatut(0);
190 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
196 $result =
$object->calcAndSetStatusDispatch($user);
210if ($action ==
'denydispatchline' && $permissiontocontrol) {
215 $result = $supplierorderdispatch->fetch($lineid);
218 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
223 $result = $supplierorderdispatch->setStatut(2);
225 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
231 $result =
$object->calcAndSetStatusDispatch($user);
245$saveprice =
"savepriceIsNotSet";
246if ($action ==
'dispatch' && $permissiontoreceive) {
252 $comment = (string)
GETPOST(
'comment',
'alpha');
254 foreach ($_POST as $key => $value) {
257 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
262 $prod =
"product_".$reg[1].
'_'.$reg[2];
263 $qty =
"qty_".$reg[1].
'_'.$reg[2];
264 $ent =
"entrepot_".$reg[1].
'_'.$reg[2];
266 $ent = $fk_default_warehouse;
268 $pu =
"pu_".$reg[1].
'_'.$reg[2];
269 $fk_commandefourndet =
"fk_commandefourndet_".$reg[1].
'_'.$reg[2];
273 $dto =
GETPOSTINT(
"dto_".$reg[1].
'_'.$reg[2]);
275 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
277 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
284 if ($qtytomove != 0) {
286 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
287 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline);
288 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
293 $result =
$object->dispatchProduct($user,
GETPOSTINT(
$prod), $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'),
'',
'',
'',
GETPOSTINT($fk_commandefourndet), $notrigger);
299 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
309 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
310 $sql .=
" SET unitprice='".price2num(
GETPOST($pu),
'MU').
"'";
311 $sql .=
", price=".price2num(
GETPOST($pu),
'MU').
"*quantity";
312 $sql .=
", remise_percent = ".((float) $dto);
313 $sql .=
" WHERE fk_soc=".((int)
$object->socid);
314 $sql .=
" AND fk_product=".(GETPOSTINT(
$prod));
316 $resql = $db->query($sql);
324 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
330 $prod =
'product_batch_'.$reg[1].
'_'.$reg[2];
331 $qty =
'qty_'.$reg[1].
'_'.$reg[2];
332 $ent =
'entrepot_'.$reg[1].
'_'.$reg[2];
333 $pu =
'pu_'.$reg[1].
'_'.$reg[2];
334 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
335 $lot =
'lot_number_'.$reg[1].
'_'.$reg[2];
339 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
345 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
347 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
354 if ($qtytomove > 0) {
358 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
359 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
360 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
373 if (!
GETPOST($lot,
'alpha') && !$dDLUO && !$dDLC) {
374 dol_syslog(
'No dispatch for line '.$key.
' as serial/eat-by/sellby date are not set');
375 $text = $langs->transnoentities(
'atleast1batchfield').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
376 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
381 $result =
$object->dispatchProduct($user, $productId, $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'), $dDLUO, $dDLC,
GETPOST($lot,
'alpha'),
GETPOSTINT($fk_commandefourndet), $notrigger);
387 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
393 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
394 $sql .=
" SET unitprice = ".price2num(
GETPOST($pu),
'MU', 2);
395 $sql .=
", price = ".price2num(
GETPOST($pu),
'MU', 2).
" * quantity";
396 $sql .=
", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2);
397 $sql .=
" WHERE fk_soc = ".((int)
$object->socid);
398 $sql .=
" AND fk_product=".((int) $productId);
400 $resql = $db->query($sql);
410 $result =
$object->calcAndSetStatusDispatch($user,
GETPOST(
'closeopenorder') ? 1 : 0,
GETPOST(
'comment'));
417 if ($result >= 0 && !$error) {
420 setEventMessages($langs->trans(
"ReceptionsRecorded"),
null,
'mesgs');
422 header(
"Location: dispatch.php?id=".$id);
438if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoreceive) {
444 $result = $supplierorderdispatch->fetch($lineid);
446 $qty = $supplierorderdispatch->qty;
447 $entrepot = $supplierorderdispatch->fk_entrepot;
448 $product = $supplierorderdispatch->fk_product;
450 $comment = $supplierorderdispatch->comment;
451 $eatby = $supplierorderdispatch->eatby;
452 $sellby = $supplierorderdispatch->sellby;
453 $batch = $supplierorderdispatch->batch;
455 $result = $supplierorderdispatch->delete($user);
462 if ($entrepot > 0 &&
isModEnabled(
'stock') &&
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') && empty($supplierorderdispatch->fk_reception)) {
467 $result = $mouv->livraison($user, $product, $entrepot, $qty, (
float) $price, (
string) $comment,
'', (
int) $eatby, (
int) $sellby, $batch);
469 $errors = $mouv->errors;
477 setEventMessages(
null, $errors,
'errors');
484if ($action ==
'updateline' && $permissiontoreceive && empty($cancel)) {
490 $result = $supplierorderdispatch->fetch($lineid);
492 $qty = $supplierorderdispatch->qty;
493 $entrepot = $supplierorderdispatch->fk_entrepot;
494 $product = $supplierorderdispatch->fk_product;
496 $comment = $supplierorderdispatch->comment;
497 $eatby = $supplierorderdispatch->eatby;
498 $sellby = $supplierorderdispatch->sellby;
499 $batch = $supplierorderdispatch->batch;
501 $supplierorderdispatch->qty =
GETPOSTFLOAT(
'qty',
'MS');
502 $supplierorderdispatch->fk_entrepot =
GETPOSTINT(
'fk_entrepot');
503 $result = $supplierorderdispatch->update($user);
507 $errors = $supplierorderdispatch->errors;
515 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, (
string) $comment,
'', (
int) $eatby, (
int) $sellby, $batch);
517 $errors = $mouv->errors;
521 $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, (
string) $comment, (
int) $eatby, (
int) $sellby, $batch);
523 $errors = $mouv->errors;
532 setEventMessages($langs->trans(
"Error"), $errors,
'errors');
545$form =
new Form($db);
547$warehouse_static =
new Entrepot($db);
550$title =
$object->ref.
" - ".$langs->trans(
'OrderDispatch');
551$help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
552$morejs = array(
'/fourn/js/lib_dispatch.js.php');
554llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs,
'',
'',
'mod-supplier-order page-card_dispatch');
556if ($id > 0 || !empty($ref)) {
560 $author =
new User($db);
561 $author->fetch(
$object->user_author_id);
565 $title = $langs->trans(
"SupplierOrder");
571 if ($action ==
'ask_deleteline') {
572 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
576 $parameters = array(
'lineid' => $lineid);
578 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
579 if (empty($reshook)) {
580 $formconfirm .= $hookmanager->resPrint;
581 } elseif ($reshook > 0) {
582 $formconfirm = $hookmanager->resPrint;
590 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
592 $morehtmlref =
'<div class="refidno">';
594 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'', 0, 1);
595 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'',
null,
null,
'', 1);
597 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
600 $langs->load(
"projects");
601 $morehtmlref .=
'<br>';
603 $caneditproject =
false;
604 $morehtmlref .= img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
605 if ($action !=
'classify' && $caneditproject) {
606 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
608 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ?
$object->socid : -1), (string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
610 if (!empty(
$object->fk_project)) {
612 $proj->fetch(
$object->fk_project);
613 $morehtmlref .= $proj->getNomUrl(1);
615 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
620 $morehtmlref .=
'</div>';
623 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
626 print
'<div class="fichecenter">';
627 print
'<div class="underbanner clearboth"></div>';
629 print
'<table class="border tableforfield" width="100%">';
632 if (
$object->methode_commande_id > 0) {
633 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td>';
639 if (
$object->methode_commande) {
640 print
'<tr><td>'.$langs->trans(
"Method").
'</td><td>'.
$object->getInputMethod().
'</td></tr>';
645 print
'<tr><td class="titlefield">'.$langs->trans(
"AuthorRequest").
'</td>';
646 print
'<td>'.$author->getNomUrl(-1,
'', 0, 0, 0).
'</td>';
649 $parameters = array();
650 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
663 print
'<br><span class="opacitymedium">'.$langs->trans(
"OrderStatusNotReadyToDispatch").
'</span>';
669 $listwarehouses = array();
674 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
676 $formproduct->loadWarehouses();
678 $listwarehouses = $entrepot->list_array(1);
681 if (empty(
$conf->reception->enabled)) {
682 print
'<form method="POST" action="dispatch.php?id='.$object->id.
'">';
684 print
'<form method="post" action="'.dol_buildpath(
'/reception/card.php', 1).
'?originid='.
$object->id.
'&origin=supplierorder">';
687 print
'<input type="hidden" name="token" value="'.newToken().
'">';
688 if (empty(
$conf->reception->enabled)) {
689 print
'<input type="hidden" name="action" value="dispatch">';
691 print
'<input type="hidden" name="action" value="create">';
694 print
'<div class="div-table-responsive-no-min">';
695 print
'<table class="noborder centpercent">';
698 $products_dispatched = array();
699 $sql =
"SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
700 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
701 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l on l.rowid = cfd.fk_elementdet";
702 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
703 $sql .=
" GROUP BY l.rowid, cfd.fk_product";
705 $resql = $db->query($sql);
707 $num = $db->num_rows($resql);
712 $objd = $db->fetch_object($resql);
713 $products_dispatched[$objd->rowid] =
price2num($objd->qty,
'MS');
721 $sql =
"SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, l.qty as qty,";
722 $sql .=
" p.ref, p.label, p.tobatch, p.fk_default_warehouse";
725 $parameters = array();
726 $reshook = $hookmanager->executeHooks(
727 'printFieldListSelect',
733 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
735 $sql .= $hookmanager->resPrint;
737 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l";
738 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON l.fk_product=p.rowid";
739 $sql .=
" WHERE l.fk_commande = ".((int)
$object->id);
741 $sql .=
" AND l.product_type = 0";
745 $parameters = array();
746 $reshook = $hookmanager->executeHooks(
747 'printFieldListWhere',
753 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
755 $sql .= $hookmanager->resPrint;
758 $sql .=
" ORDER BY l.rang, p.ref, p.label";
764 $resql = $db->query($sql);
766 $num = $db->num_rows($resql);
770 print
'<tr class="liste_titre">';
772 print
'<td>'.$langs->trans(
"Description").
'</td>';
774 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
776 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
779 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
786 print
'<td class="right">'.$langs->trans(
"SupplierRef").
'</td>';
787 print
'<td class="right">'.$langs->trans(
"QtyOrdered").
'</td>';
788 print
'<td class="right">'.$langs->trans(
"QtyDispatchedShort").
'</td>';
789 print
' <td class="right">'.$langs->trans(
"QtyToDispatchShort");
790 print
'<br><a href="#" id="autoreset">'.img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').$langs->trans(
"Reset").
'</a></td>';
791 print
'<td width="32"></td>';
795 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
796 print
'<td class="right">'.$langs->trans(
"ReductionShort").
' (%)</td>';
797 print
'<td class="right">'.$langs->trans(
"UpdatePrice").
'</td>';
801 print
'<td align="right">'.$langs->trans(
"Warehouse");
804 if (count($listwarehouses) > 1) {
805 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, $langs->trans(
"ForceTo"), 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
806 } elseif (count($listwarehouses) == 1) {
807 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
813 $parameters = array();
814 $reshook = $hookmanager->executeHooks(
815 'printFieldListTitle',
821 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
823 print $hookmanager->resPrint;
830 $conf->cache[
'product'] = array();
834 $objp = $db->fetch_object($resql);
837 if (!$objp->fk_product > 0) {
840 $alreadydispatched = isset($products_dispatched[$objp->rowid]) ? $products_dispatched[$objp->rowid] : 0;
841 $remaintodispatch =
price2num($objp->qty - ((
float) $alreadydispatched), 5);
842 if ($remaintodispatch < 0 && !
getDolGlobalString(
'SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN')) {
843 $remaintodispatch = 0;
846 if ($remaintodispatch || !
getDolGlobalString(
'SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
855 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
857 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$objp->qty.
'">';
858 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.(float) $alreadydispatched.
'">';
859 print
'<tr class="oddeven">';
861 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
862 $tmpproduct =
new Product($db);
863 $tmpproduct->fetch($objp->fk_product);
864 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
866 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
869 $linktoprod = $tmpproduct->getNomUrl(1);
870 $linktoprod .=
' - '.$objp->label.
"\n";
873 if ($objp->tobatch) {
878 print
'<td class="dispatch_batch_number"></td>';
880 print
'<td class="dispatch_dlc"></td>';
883 print
'<td class="dispatch_dluo"></td>';
890 print
'<td class="dispatch_batch_number">';
891 print
'<span class="opacitymedium small">'.$langs->trans(
"ProductDoesNotUseBatchSerial").
'</small>';
894 print
'<td class="dispatch_dlc"></td>';
897 print
'<td class="dispatch_dluo"></td>';
901 print
'<td colspan="4">';
907 $up_ht_disc = $objp->subprice;
908 if (!empty($objp->remise_percent) && !
getDolGlobalString(
'STOCK_EXCLUDE_DISCOUNT_FOR_PMP')) {
909 $up_ht_disc =
price2num($up_ht_disc * (100 - $objp->remise_percent) / 100,
'MU');
913 print
'<td class="right">'.$objp->sref.
'</td>';
916 print
'<td class="right">'.$objp->qty.
'</td>';
919 print
'<td class="right">'.$alreadydispatched.
'</td>';
921 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
923 print
'<td class="right">';
933 'is_information_row' =>
true,
938 $reshook = $hookmanager->executeHooks(
939 'printFieldListValue',
945 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
947 print $hookmanager->resPrint;
951 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
953 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
954 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
956 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
958 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price($up_ht_disc).
'">';
960 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price($up_ht_disc).
'">';
966 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.
GETPOST(
'lot_number'.$suffix).
'">';
969 print
'<td class="nowraponall">';
971 print $form->selectDate($dlcdatesuffix,
'dlc'.$suffix, 0, 0, 1,
'');
975 print
'<td class="nowraponall">';
977 print $form->selectDate($dluodatesuffix,
'dluo'.$suffix, 0, 0, 1,
'');
980 print
'<td colspan="3"> </td>';
986 print
'<td class="right">';
996 'is_information_row' =>
true,
1001 $reshook = $hookmanager->executeHooks(
1002 'printFieldListValue',
1008 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1010 print $hookmanager->resPrint;
1014 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
1015 print
'<td colspan="'.$colspan.
'">';
1016 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
1017 print
'<input name="product'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
1019 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
1021 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
1023 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
1030 print
'<td class="right nowrap">';
1031 if ($remaintodispatch > 0) {
1032 $btnLabel = $langs->trans(
"Fill").
' : '.$remaintodispatch;
1033 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>';
1035 print
'<input id="qty'.$suffix.
'" name="qty'.$suffix.
'" type="number" step="any" class="width75 right qtydispatchinput" value="'.(
GETPOSTISSET(
'qty'.$suffix) ?
GETPOSTINT(
'qty'.$suffix) : (!
getDolGlobalString(
'SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO') ? $remaintodispatch : 0)).
'">';
1036 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>';
1040 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
1042 print img_picto($langs->trans(
'AddStockLocationLine'),
'split',
'class="splitbutton" onClick="addDispatchLine('.$i.
', \''.$type.
'\')
"');
1043 if ($objp->tobatch == 2) {
1044 // Product managed with unique serial numbers: allow to enter several serial numbers at once (one line per serial)
1045 print img_picto($langs->trans('EnterMultipleSerialNumbers'), 'barcode', 'class="splitbutton marginleftonly
" onClick="addDispatchLinesFromSerialList(
'.$i.', \
''.$type.
'\')
"');
1049 print img_picto($langs->trans('AddStockLocationLine'), 'split', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
1053 if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
1054 if (!isModEnabled("multicurrency
") && empty($conf->dynamicprices->enabled)) {
1056 print '<td class="right
">';
1057 print '<input id="pu
'.$suffix.'" name="pu
'.$suffix.'" type="text
" size="8
" value="'.price((GETPOST('pu
'.$suffix) != '' ? price2num(GETPOST('pu
'.$suffix)) : $up_ht_disc)).'">';
1061 print '<td class="right
">';
1062 print '<input id="dto
'.$suffix.'" name="dto
'.$suffix.'" type="text
" size="8
" value="'.(GETPOST('dto
'.$suffix) != '' ? GETPOST('dto
'.$suffix) : '').'">';
1066 print '<td class="center
">';
1067 print '<input class="flat checkformerge
" type="checkbox
" name="saveprice
'.$suffix.'" value="'.(GETPOST('saveprice
'.$suffix) != '' ? GETPOST('saveprice
'.$suffix) : '').'">';
1073 print '<td class="right
">';
1074 if (count($listwarehouses) > 1) {
1075 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);
1076 } elseif (count($listwarehouses) == 1) {
1077 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);
1079 $langs->load("errors
");
1080 print $langs->trans("ErrorNoWarehouseDefined
");
1084 // Enable hooks to append additional columns
1085 $parameters = array(
1086 'is_information_row' => false, // this is a dispatch form row
1088 'suffix' => $suffix,
1091 $reshook = $hookmanager->executeHooks(
1092 'printFieldListValue',
1098 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1100 print $hookmanager->resPrint;
1109 dol_print_error($db);
1116 $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1118 print '<div class="center
">';
1119 $parameters = array();
1120 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1122 if (empty($reshook)) {
1123 if (empty($conf->reception->enabled)) {
1124 print $langs->trans("Comment").' : ';
1125 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1126 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1127 // print ' /
'.$object->ref_supplier; // Not yet available
1128 print '" class="flat
"><br>';
1130 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1133 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1136 print '<input type="hidden
" name="backtopageforcancel
" value="'.$_SERVER["PHP_SELF"].'?
id=
'.$object->id.'">';
1137 print '<input type="submit
" class="button" name="dispatch
" value="'.dol_escape_htmltag($dispatchBt).'"';
1139 if (!$permissiontoreceive) {
1142 if (count($listwarehouses) <= 0) {
1154 // Message if nothing to dispatch
1157 if (!getDolGlobalString('SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
1158 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1160 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1167 print dol_get_fiche_end();
1169 // default warehouse processing
1170 print '<script type="text/javascript
">
1171 $(document).ready(function () {
1172 $("select[
name=fk_default_warehouse]
").change(function() {
1173 var fk_default_warehouse = $("option:selected
", this).val();
1174 $("select[
name^=entrepot_]
").val(fk_default_warehouse).change();
1177 $(".auto-fill-qty
").on("click touchstart
", function(e){
1179 $("input[
name=
"+$(this).data("rowname
")+"]
").val($(this).data("value
")).trigger("change
");
1182 $("#autoreset
").click(function() {
1183 $(".qtydispatchinput
").each(function(){
1184 id = $(this).attr("id");
1185 idtab = id.split("_
");
1189 $("#qty_dispatched_0_
"+idtab[2]).val("0
");
1191 obj = $(this).parent().parent();
1192 nameobj = obj.attr("name");
1193 nametab = nameobj.split("_
");
1195 $("tr[
name^=\
'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
1200 $(".resetline").click(function(e){
1202 id = $(this).attr("id");
1203 id = id.split("reset_");
1204 console.log("Reset trigger for id = qty_"+id[1]);
1205 $("#qty_"+id[1]).val("");
1211 $sql =
"SELECT p.rowid as pid, p.ref, p.label,";
1212 $sql .=
" e.rowid as warehouse_id, e.ref as entrepot,";
1213 $sql .=
" cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
1214 $sql .=
" ,cd.rowid, cd.subprice";
1216 $sql .=
", cfd.fk_reception, r.date_delivery";
1218 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p,";
1219 $sql .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
1220 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet";
1221 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"entrepot as e ON cfd.fk_entrepot = e.rowid";
1223 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"reception as r ON cfd.fk_reception = r.rowid";
1225 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
1226 $sql .=
" AND cfd.fk_product = p.rowid";
1227 $sql .=
" ORDER BY cfd.rowid ASC";
1229 $resql = $db->query($sql);
1231 $num = $db->num_rows($resql);
1239 print
'<div class="div-table-responsive">';
1240 print
'<table id="dispatch_received_products" class="noborder centpercent">';
1242 print
'<tr class="liste_titre">';
1245 print
'<td>'.$langs->trans(
"Reception").
'</td>';
1248 print
'<td>'.$langs->trans(
"Product").
'</td>';
1249 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
1250 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1252 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
1254 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
1257 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
1260 print
'<td class="right">'.$langs->trans(
"QtyDispatched").
'</td>';
1261 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
1262 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1266 print
'<td class="center" colspan="2">'.$langs->trans(
"Status").
'</td>';
1268 print
'<td class="center"></td>';
1271 print
'<td class="center" colspan="2"></td>';
1277 $objp = $db->fetch_object($resql);
1279 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1280 print
'<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#line_'.
GETPOSTINT(
'lineid').
'" method="POST">
1281 <input type="hidden" name="token" value="'.
newToken().
'">
1282 <input type="hidden" name="action" value="updateline">
1283 <input type="hidden" name="mode" value="">
1284 <input type="hidden" name="lineid" value="'.$objp->dispatchlineid.
'">';
1287 print
'<tr class="oddeven" id="line_'.$objp->dispatchlineid.
'" >';
1292 print
'<td class="nowraponall">';
1293 if (!empty($objp->fk_reception)) {
1294 if (empty(
$conf->cache[
'reception'][$objp->fk_reception])) {
1296 $reception->fetch($objp->fk_reception);
1297 $conf->cache[
'reception'][$objp->fk_reception] = $reception;
1299 $reception =
$conf->cache[
'reception'][$objp->fk_reception];
1301 print $reception->getNomUrl(1);
1308 print
'<td class="tdoverflowmax150">';
1309 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
1310 $tmpproduct =
new Product($db);
1311 $tmpproduct->fetch($objp->fk_product);
1312 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
1314 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
1316 print $tmpproduct->getNomUrl(1);
1317 print
' - '.$objp->label;
1321 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'day').
'</td>';
1325 print
'<td class="center">';
1326 if (!empty($objp->date_delivery)) {
1331 print
'<td class="center"></td>';
1337 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1338 $lotcachekey = $objp->pid.
'_'.$objp->batch;
1339 if (empty(
$conf->cache[
'productlot'][$lotcachekey])) {
1341 $lot->fetch(0, $objp->pid, $objp->batch);
1342 $conf->cache[
'productlot'][$lotcachekey] = $lot;
1344 $lot =
$conf->cache[
'productlot'][$lotcachekey];
1346 print
'<td class="dispatch_batch_number" data-col="batch" data-batch="' . dolPrintHTMLForAttribute($objp->batch) .
'" data-productid="' . $objp->fk_product .
'" >'.$lot->getNomUrl(1).
'</td>';
1348 print
'<td class="dispatch_dlc">'.dol_print_date($lot->sellby,
'day').
'</td>';
1351 print
'<td class="dispatch_dluo">'.dol_print_date($lot->eatby,
'day').
'</td>';
1354 print
'<td class="dispatch_batch_number" data-col="batch" data-batch="" data-productid="' . $objp->fk_product .
'" ></td>';
1356 print
'<td class="dispatch_dlc"></td>';
1359 print
'<td class="dispatch_dluo"></td>';
1365 print
'<td class="right">';
1366 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1367 print
'<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.
'" />';
1371 print
'<input type="hidden" name="price" value="'.$objp->subprice.
'" />';
1374 print
'<td class="tdoverflowmax150">';
1375 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1376 $warehouse_id =
GETPOSTINT(
"fk_entrepot") ?
GETPOSTINT(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
'');
1377 if (count($listwarehouses) > 1) {
1378 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 1, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1379 } elseif (count($listwarehouses) == 1) {
1380 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 0, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1382 $langs->load(
"errors");
1383 print $langs->trans(
"ErrorNoWarehouseDefined");
1386 $warehouse_static->id = $objp->warehouse_id;
1387 $warehouse_static->label = $objp->entrepot;
1388 print $warehouse_static->getNomUrl(1);
1393 print
'<td class="tdoverflowmax300" style="white-space: pre;">'.$objp->comment.
'</td>';
1397 print
'<td class="right">';
1398 $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status);
1400 print $supplierorderdispatch->getLibStatut(5);
1404 print
'<td class="center">';
1405 if (!$permissiontocontrol) {
1406 if (empty($objp->status)) {
1407 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Approve").
'</a>';
1408 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1410 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Disapprove").
'</a>';
1411 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1415 if (
$object->status == $object::STATUS_RECEIVED_COMPLETELY) {
1418 if (empty($objp->status)) {
1419 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1420 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1422 if ($objp->status == 1) {
1423 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1424 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1426 if ($objp->status == 2) {
1427 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1428 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1433 print
'<td class="right">';
1434 if ($reception !==
null && !empty($reception->id)) {
1435 print $reception->getLibStatut(5);
1441 if ($action !=
'editline' || $lineid != $objp->dispatchlineid) {
1442 if (($reception ===
null) || empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) {
1443 print
'<td class="linecoledit center">';
1444 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#line_'.$objp->dispatchlineid.
'">';
1449 print
'<td class="linecoldelete center">';
1450 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#dispatch_received_products">';
1455 print
'<td></td><td></td>';
1458 print
'<td class="center valignmiddle">';
1459 print
'<input type="submit" class="button button-save" id="savelinebutton" name="save" value="'.$langs->trans(
"Save").
'" />';
1461 print
'<td class="center valignmiddle">';
1462 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'" />';
1468 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1480 dol_print_error($db);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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_now($mode='gmt')
Return date for now.
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...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
treeview li table
No Email.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
$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, $nodie=0, $mode='')
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.