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';
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
58$langs->loadLangs(array(
"bills",
"orders",
"sendings",
"companies",
"products",
"stocks",
"receptions"));
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');
114if (($action ==
'confirm_deleteline' || ($action ==
'updateline' && empty($cancel))) && $lineid > 0) {
116 if ($tmpdispatchline->fetch($lineid) > 0 && $tmpdispatchline->fk_reception > 0) {
117 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
119 if ($tmpreception->fetch($tmpdispatchline->fk_reception) > 0 && $tmpreception->status != Reception::STATUS_DRAFT) {
120 setEventMessages($langs->trans(
'StatusOfRefMustBe', $langs->transnoentitiesnoconv(
'Reception'), $langs->transnoentitiesnoconv(
'StatusReceptionDraftShort')),
null,
'errors');
126$usercancreate = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
127$permissiontoadd = $usercancreate;
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
143if (in_array($action, [
'checkdispatchline',
'uncheckdispatchline',
'denydispatchline',
'confirm_deleteline',
'updateline'])) {
145 if ($tmpdispatchline->fetch($lineid) <= 0 || (
int) $tmpdispatchline->fk_element !== (
int)
$object->id) {
151if ($action ==
'checkdispatchline' && $permissiontocontrol) {
156 $result = $supplierorderdispatch->fetch($lineid);
159 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
164 $result = $supplierorderdispatch->setStatut(1);
166 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
173 $result =
$object->calcAndSetStatusDispatch($user);
187if ($action ==
'uncheckdispatchline' && $permissiontocontrol) {
192 $result = $supplierorderdispatch->fetch($lineid);
195 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
200 $result = $supplierorderdispatch->setStatut(0);
202 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
208 $result =
$object->calcAndSetStatusDispatch($user);
222if ($action ==
'denydispatchline' && $permissiontocontrol) {
227 $result = $supplierorderdispatch->fetch($lineid);
230 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
235 $result = $supplierorderdispatch->setStatut(2);
237 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
243 $result =
$object->calcAndSetStatusDispatch($user);
257$saveprice =
"savepriceIsNotSet";
258if ($action ==
'dispatch' && $permissiontoreceive) {
264 foreach ($_POST as $key => $value) {
267 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
272 $prod =
"product_".$reg[1].
'_'.$reg[2];
273 $qty =
"qty_".$reg[1].
'_'.$reg[2];
274 $ent =
"entrepot_".$reg[1].
'_'.$reg[2];
276 $ent = $fk_default_warehouse;
278 $pu =
"pu_".$reg[1].
'_'.$reg[2];
279 $fk_commandefourndet =
"fk_commandefourndet_".$reg[1].
'_'.$reg[2];
282 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
283 $dto =
GETPOSTINT(
"dto_".$reg[1].
'_'.$reg[2]);
285 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
287 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
294 if ($qtytomove != 0) {
296 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
297 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline);
298 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
303 $result =
$object->dispatchProduct($user,
GETPOSTINT($prod), $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'),
'',
'',
'',
GETPOSTINT($fk_commandefourndet), $notrigger);
309 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
310 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
317 if (GETPOSTISSET($saveprice)) {
319 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
320 $sql .=
" SET unitprice='".price2num(
GETPOST($pu),
'MU').
"'";
321 $sql .=
", price=".price2num(
GETPOST($pu),
'MU').
"*quantity";
322 $sql .=
", remise_percent = ".((float) $dto);
323 $sql .=
" WHERE fk_soc=".((int)
$object->socid);
324 $sql .=
" AND fk_product=".(GETPOSTINT($prod));
326 $resql = $db->query($sql);
334 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
340 $prod =
'product_batch_'.$reg[1].
'_'.$reg[2];
341 $qty =
'qty_'.$reg[1].
'_'.$reg[2];
342 $ent =
'entrepot_'.$reg[1].
'_'.$reg[2];
343 $pu =
'pu_'.$reg[1].
'_'.$reg[2];
344 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
345 $lot =
'lot_number_'.$reg[1].
'_'.$reg[2];
349 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
352 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
355 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
357 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
364 if ($qtytomove > 0) {
368 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
369 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
370 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
383 if (!
GETPOST($lot,
'alpha') && !$dDLUO && !$dDLC) {
384 dol_syslog(
'No dispatch for line '.$key.
' as serial/eat-by/sellby date are not set');
385 $text = $langs->transnoentities(
'atleast1batchfield').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
386 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
391 $result =
$object->dispatchProduct($user, $productId, $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'), $dDLUO, $dDLC,
GETPOST($lot,
'alpha'),
GETPOSTINT($fk_commandefourndet), $notrigger);
397 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
398 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
401 if (GETPOSTISSET($saveprice)) {
403 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
404 $sql .=
" SET unitprice = ".price2num(
GETPOST($pu),
'MU', 2);
405 $sql .=
", price = ".price2num(
GETPOST($pu),
'MU', 2).
" * quantity";
406 $sql .=
", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2);
407 $sql .=
" WHERE fk_soc = ".((int)
$object->socid);
408 $sql .=
" AND fk_product=".((int) $productId);
410 $resql = $db->query($sql);
420 $result =
$object->calcAndSetStatusDispatch($user,
GETPOST(
'closeopenorder') ? 1 : 0,
GETPOST(
'comment'));
427 if ($result >= 0 && !$error) {
432 header(
"Location: dispatch.php?id=".$id);
447if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoreceive) {
451 $result = $supplierorderdispatch->fetch($lineid);
453 $qty = $supplierorderdispatch->qty;
454 $entrepot = $supplierorderdispatch->fk_entrepot;
455 $product = $supplierorderdispatch->fk_product;
457 $comment = $supplierorderdispatch->comment;
458 $eatby = $supplierorderdispatch->eatby;
459 $sellby = $supplierorderdispatch->sellby;
460 $batch = $supplierorderdispatch->batch;
462 $result = $supplierorderdispatch->delete($user);
469 if ($entrepot > 0 &&
isModEnabled(
'stock') &&
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') && empty($supplierorderdispatch->fk_reception)) {
474 $result = $mouv->livraison($user, $product, $entrepot, $qty, (
float) $price, $comment,
'', (
int) $eatby, (
int) $sellby, $batch);
476 $errors = $mouv->errors;
491if ($action ==
'updateline' && $permissiontoreceive && empty($cancel)) {
495 $result = $supplierorderdispatch->fetch($lineid);
497 $qty = $supplierorderdispatch->qty;
498 $entrepot = $supplierorderdispatch->fk_entrepot;
499 $product = $supplierorderdispatch->fk_product;
501 $comment = $supplierorderdispatch->comment;
505 $batch = $supplierorderdispatch->batch;
507 $supplierorderdispatch->qty =
GETPOSTFLOAT(
'qty',
'MS');
508 $supplierorderdispatch->fk_entrepot =
GETPOSTINT(
'fk_entrepot');
509 $result = $supplierorderdispatch->update($user);
513 $errors = $supplierorderdispatch->errors;
521 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment,
'', (
int) $eatby, (
int) $sellby, $batch);
523 $errors = $mouv->errors;
527 $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, (
int) $eatby, (
int) $sellby, $batch);
529 $errors = $mouv->errors;
551$form =
new Form($db);
553$warehouse_static =
new Entrepot($db);
556$title =
$object->ref.
" - ".$langs->trans(
'OrderDispatch');
557$help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
558$morejs = array(
'/fourn/js/lib_dispatch.js.php');
560llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs,
'',
'',
'mod-supplier-order page-card_dispatch');
562if ($id > 0 || !empty($ref)) {
566 $author =
new User($db);
567 $author->fetch(
$object->user_author_id);
571 $title = $langs->trans(
"SupplierOrder");
577 if ($action ==
'ask_deleteline') {
578 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
582 $parameters = array(
'lineid' => $lineid);
584 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
585 if (empty($reshook)) {
586 $formconfirm .= $hookmanager->resPrint;
587 } elseif ($reshook > 0) {
588 $formconfirm = $hookmanager->resPrint;
596 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
598 $morehtmlref =
'<div class="refidno">';
600 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'', 0, 1);
601 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'',
null,
null,
'', 1);
603 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
606 $langs->load(
"projects");
607 $morehtmlref .=
'<br>';
609 $caneditproject =
false;
610 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
611 if ($action !=
'classify' && $caneditproject) {
612 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
614 $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');
616 if (!empty(
$object->fk_project)) {
618 $proj->fetch(
$object->fk_project);
619 $morehtmlref .= $proj->getNomUrl(1);
621 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
626 $morehtmlref .=
'</div>';
629 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
632 print
'<div class="fichecenter">';
633 print
'<div class="underbanner clearboth"></div>';
635 print
'<table class="border tableforfield" width="100%">';
638 if (
$object->methode_commande_id > 0) {
639 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td>';
645 if (
$object->methode_commande) {
646 print
'<tr><td>'.$langs->trans(
"Method").
'</td><td>'.
$object->getInputMethod().
'</td></tr>';
651 print
'<tr><td class="titlefield">'.$langs->trans(
"AuthorRequest").
'</td>';
652 print
'<td>'.$author->getNomUrl(-1,
'', 0, 0, 0).
'</td>';
655 $parameters = array();
656 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
669 print
'<br><span class="opacitymedium">'.$langs->trans(
"OrderStatusNotReadyToDispatch").
'</span>';
675 $listwarehouses = array();
680 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
682 $formproduct->loadWarehouses();
684 $listwarehouses = $entrepot->list_array(1);
687 if (empty($conf->reception->enabled)) {
688 print
'<form method="POST" action="dispatch.php?id='.$object->id.
'">';
690 print
'<form method="post" action="'.dol_buildpath(
'/reception/card.php', 1).
'?originid='.
$object->id.
'&origin=supplierorder">';
693 print
'<input type="hidden" name="token" value="'.newToken().
'">';
694 if (empty($conf->reception->enabled)) {
695 print
'<input type="hidden" name="action" value="dispatch">';
697 print
'<input type="hidden" name="action" value="create">';
700 print
'<div class="div-table-responsive-no-min">';
701 print
'<table class="noborder centpercent">';
704 $products_dispatched = array();
705 $sql =
"SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
706 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
707 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l on l.rowid = cfd.fk_elementdet";
708 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
709 $sql .=
" GROUP BY l.rowid, cfd.fk_product";
711 $resql = $db->query($sql);
713 $num = $db->num_rows($resql);
718 $objd = $db->fetch_object($resql);
719 $products_dispatched[$objd->rowid] =
price2num($objd->qty,
'MS');
727 $sql =
"SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, l.qty as qty,";
728 $sql .=
" p.ref, p.label, p.tobatch, p.fk_default_warehouse";
731 $parameters = array();
732 $reshook = $hookmanager->executeHooks(
733 'printFieldListSelect',
741 $sql .= $hookmanager->resPrint;
743 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l";
744 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON l.fk_product=p.rowid";
745 $sql .=
" WHERE l.fk_commande = ".((int)
$object->id);
747 $sql .=
" AND l.product_type = 0";
751 $parameters = array();
752 $reshook = $hookmanager->executeHooks(
753 'printFieldListWhere',
761 $sql .= $hookmanager->resPrint;
764 $sql .=
" ORDER BY l.rang, p.ref, p.label";
770 $resql = $db->query($sql);
772 $num = $db->num_rows($resql);
776 print
'<tr class="liste_titre">';
778 print
'<td>'.$langs->trans(
"Description").
'</td>';
780 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
782 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
785 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
792 print
'<td class="right">'.$langs->trans(
"SupplierRef").
'</td>';
793 print
'<td class="right">'.$langs->trans(
"QtyOrdered").
'</td>';
794 print
'<td class="right">'.$langs->trans(
"QtyDispatchedShort").
'</td>';
795 print
' <td class="right">'.$langs->trans(
"QtyToDispatchShort");
796 print
'<br><a href="#" id="autoreset">'.img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').$langs->trans(
"Reset").
'</a></td>';
797 print
'<td width="32"></td>';
800 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
801 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
802 print
'<td class="right">'.$langs->trans(
"ReductionShort").
' (%)</td>';
803 print
'<td class="right">'.$langs->trans(
"UpdatePrice").
'</td>';
807 print
'<td align="right">'.$langs->trans(
"Warehouse");
810 if (count($listwarehouses) > 1) {
811 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, $langs->trans(
"ForceTo"), 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
812 } elseif (count($listwarehouses) == 1) {
813 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
819 $parameters = array();
820 $reshook = $hookmanager->executeHooks(
821 'printFieldListTitle',
829 print $hookmanager->resPrint;
836 $conf->cache[
'product'] = array();
840 $objp = $db->fetch_object($resql);
843 if (!$objp->fk_product > 0) {
846 $alreadydispatched = isset($products_dispatched[$objp->rowid]) ? $products_dispatched[$objp->rowid] : 0;
847 $remaintodispatch =
price2num($objp->qty - ((
float) $alreadydispatched), 5);
848 if ($remaintodispatch < 0 && !
getDolGlobalString(
'SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN')) {
849 $remaintodispatch = 0;
852 if ($remaintodispatch || !
getDolGlobalString(
'SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
861 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
863 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$objp->qty.
'">';
864 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.(float) $alreadydispatched.
'">';
865 print
'<tr class="oddeven">';
867 if (empty($conf->cache[
'product'][$objp->fk_product])) {
868 $tmpproduct =
new Product($db);
869 $tmpproduct->fetch($objp->fk_product);
870 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
872 $tmpproduct = $conf->cache[
'product'][$objp->fk_product];
875 $linktoprod = $tmpproduct->getNomUrl(1);
876 $linktoprod .=
' - '.$objp->label.
"\n";
879 if ($objp->tobatch) {
884 print
'<td class="dispatch_batch_number"></td>';
886 print
'<td class="dispatch_dlc"></td>';
889 print
'<td class="dispatch_dluo"></td>';
896 print
'<td class="dispatch_batch_number">';
897 print
'<span class="opacitymedium small">'.$langs->trans(
"ProductDoesNotUseBatchSerial").
'</small>';
900 print
'<td class="dispatch_dlc"></td>';
903 print
'<td class="dispatch_dluo"></td>';
907 print
'<td colspan="4">';
913 $up_ht_disc = $objp->subprice;
914 if (!empty($objp->remise_percent) && !
getDolGlobalString(
'STOCK_EXCLUDE_DISCOUNT_FOR_PMP')) {
915 $up_ht_disc =
price2num($up_ht_disc * (100 - $objp->remise_percent) / 100,
'MU');
919 print
'<td class="right">'.$objp->sref.
'</td>';
922 print
'<td class="right">'.$objp->qty.
'</td>';
925 print
'<td class="right">'.$alreadydispatched.
'</td>';
927 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
929 print
'<td class="right">';
939 'is_information_row' =>
true,
944 $reshook = $hookmanager->executeHooks(
945 'printFieldListValue',
953 print $hookmanager->resPrint;
957 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
959 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
960 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
962 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
964 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price($up_ht_disc).
'">';
966 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price($up_ht_disc).
'">';
972 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.
GETPOST(
'lot_number'.$suffix).
'">';
975 print
'<td class="nowraponall">';
977 print $form->selectDate($dlcdatesuffix,
'dlc'.$suffix, 0, 0, 1,
'');
981 print
'<td class="nowraponall">';
983 print $form->selectDate($dluodatesuffix,
'dluo'.$suffix, 0, 0, 1,
'');
986 print
'<td colspan="3"> </td>';
992 print
'<td class="right">';
1000 $parameters = array(
1002 'is_information_row' =>
true,
1004 'suffix' => $suffix,
1007 $reshook = $hookmanager->executeHooks(
1008 'printFieldListValue',
1016 print $hookmanager->resPrint;
1020 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
1021 print
'<td colspan="'.$colspan.
'">';
1022 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
1023 print
'<input name="product'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
1025 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
1027 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
1029 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
1036 print
'<td class="right nowrap">';
1037 if ($remaintodispatch > 0) {
1038 $btnLabel = $langs->trans(
"Fill").
' : '.$remaintodispatch;
1039 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>';
1041 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)).
'">';
1042 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>';
1046 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
1048 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split',
'class="splitbutton" onClick="addDispatchLine('.$i.
', \''.$type.
'\')
"');
1051 print img_picto($langs->trans('AddStockLocationLine'), 'split', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
1055 if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
1056 if (!isModEnabled("multicurrency
") && empty($conf->dynamicprices->enabled)) {
1058 print '<td class="right
">';
1059 print '<input id="pu
'.$suffix.'" name="pu
'.$suffix.'" type="text
" size="8
" value="'.price((GETPOST('pu
'.$suffix) != '' ? price2num(GETPOST('pu
'.$suffix)) : $up_ht_disc)).'">';
1063 print '<td class="right
">';
1064 print '<input id="dto
'.$suffix.'" name="dto
'.$suffix.'" type="text
" size="8
" value="'.(GETPOST('dto
'.$suffix) != '' ? GETPOST('dto
'.$suffix) : '').'">';
1068 print '<td class="center
">';
1069 print '<input class="flat checkformerge
" type="checkbox
" name="saveprice
'.$suffix.'" value="'.(GETPOST('saveprice
'.$suffix) != '' ? GETPOST('saveprice
'.$suffix) : '').'">';
1075 print '<td class="right
">';
1076 if (count($listwarehouses) > 1) {
1077 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);
1078 } elseif (count($listwarehouses) == 1) {
1079 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);
1081 $langs->load("errors
");
1082 print $langs->trans("ErrorNoWarehouseDefined
");
1086 // Enable hooks to append additional columns
1087 $parameters = array(
1088 'is_information_row' => false, // this is a dispatch form row
1090 'suffix' => $suffix,
1093 $reshook = $hookmanager->executeHooks(
1094 'printFieldListValue',
1100 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1102 print $hookmanager->resPrint;
1111 dol_print_error($db);
1118 $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1120 print '<div class="center
">';
1121 $parameters = array();
1122 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1124 if (empty($reshook)) {
1125 if (empty($conf->reception->enabled)) {
1126 print $langs->trans("Comment").' : ';
1127 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1128 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1129 // print ' /
'.$object->ref_supplier; // Not yet available
1130 print '" class="flat
"><br>';
1132 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1135 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1138 print '<input type="hidden
" name="backtopageforcancel
" value="'.$_SERVER["PHP_SELF"].'?
id=
'.$object->id.'">';
1139 print '<input type="submit
" class="button" name="dispatch
" value="'.dol_escape_htmltag($dispatchBt).'"';
1141 if (!$permissiontoreceive) {
1144 if (count($listwarehouses) <= 0) {
1156 // Message if nothing to dispatch
1159 if (!getDolGlobalString('SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
1160 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1162 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1169 print dol_get_fiche_end();
1171 // traitement entrepot par défaut
1172 print '<script type="text/javascript
">
1173 $(document).ready(function () {
1174 $("select[
name=fk_default_warehouse]
").change(function() {
1175 var fk_default_warehouse = $("option:selected
", this).val();
1176 $("select[
name^=entrepot_]
").val(fk_default_warehouse).change();
1179 $(".auto-fill-qty
").on("click touchstart
", function(e){
1181 $("input[
name=
"+$(this).data("rowname
")+"]
").val($(this).data("value
")).trigger("change
");
1184 $("#autoreset
").click(function() {
1185 $(".qtydispatchinput
").each(function(){
1186 id = $(this).attr("id");
1187 idtab = id.split("_
");
1191 $("#qty_dispatched_0_
"+idtab[2]).val("0
");
1193 obj = $(this).parent().parent();
1194 nameobj = obj.attr("name");
1195 nametab = nameobj.split("_
");
1197 $("tr[
name^=\
'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
1202 $(".resetline").click(function(e){
1204 id = $(this).attr("id");
1205 id = id.split("reset_");
1206 console.log("Reset trigger for id = qty_"+id[1]);
1207 $("#qty_"+id[1]).val("");
1213 $sql =
"SELECT p.rowid as pid, p.ref, p.label,";
1214 $sql .=
" e.rowid as warehouse_id, e.ref as entrepot,";
1215 $sql .=
" cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
1216 $sql .=
" ,cd.rowid, cd.subprice";
1218 $sql .=
", cfd.fk_reception, r.date_delivery";
1220 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p,";
1221 $sql .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
1222 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet";
1223 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"entrepot as e ON cfd.fk_entrepot = e.rowid";
1225 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"reception as r ON cfd.fk_reception = r.rowid";
1227 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
1228 $sql .=
" AND cfd.fk_product = p.rowid";
1229 $sql .=
" ORDER BY cfd.rowid ASC";
1231 $resql = $db->query($sql);
1233 $num = $db->num_rows($resql);
1241 print
'<div class="div-table-responsive">';
1242 print
'<table id="dispatch_received_products" class="noborder centpercent">';
1244 print
'<tr class="liste_titre">';
1247 print
'<td>'.$langs->trans(
"Reception").
'</td>';
1250 print
'<td>'.$langs->trans(
"Product").
'</td>';
1251 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
1252 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1254 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
1256 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
1259 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
1262 print
'<td class="right">'.$langs->trans(
"QtyDispatched").
'</td>';
1263 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
1264 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1268 print
'<td class="center" colspan="2">'.$langs->trans(
"Status").
'</td>';
1270 print
'<td class="center"></td>';
1273 print
'<td class="center" colspan="2"></td>';
1279 $objp = $db->fetch_object($resql);
1281 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1282 print
'<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#line_'.
GETPOSTINT(
'lineid').
'" method="POST">
1283 <input type="hidden" name="token" value="'.
newToken().
'">
1284 <input type="hidden" name="action" value="updateline">
1285 <input type="hidden" name="mode" value="">
1286 <input type="hidden" name="lineid" value="'.$objp->dispatchlineid.
'">';
1289 print
'<tr class="oddeven" id="line_'.$objp->dispatchlineid.
'" >';
1294 print
'<td class="nowraponall">';
1295 if (!empty($objp->fk_reception)) {
1297 $reception->fetch($objp->fk_reception);
1298 print $reception->getNomUrl(1);
1305 print
'<td class="tdoverflowmax150">';
1306 if (empty($conf->cache[
'product'][$objp->fk_product])) {
1307 $tmpproduct =
new Product($db);
1308 $tmpproduct->fetch($objp->fk_product);
1309 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
1311 $tmpproduct = $conf->cache[
'product'][$objp->fk_product];
1313 print $tmpproduct->getNomUrl(1);
1314 print
' - '.$objp->label;
1318 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'day').
'</td>';
1322 print
'<td class="center">';
1323 if (!empty($objp->date_delivery)) {
1328 print
'<td class="center"></td>';
1334 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1336 $lot->fetch(0, $objp->pid, $objp->batch);
1337 print
'<td class="dispatch_batch_number">'.$lot->getNomUrl(1).
'</td>';
1339 print
'<td class="dispatch_dlc">'.dol_print_date($lot->sellby,
'day').
'</td>';
1342 print
'<td class="dispatch_dluo">'.dol_print_date($lot->eatby,
'day').
'</td>';
1345 print
'<td class="dispatch_batch_number"></td>';
1347 print
'<td class="dispatch_dlc"></td>';
1350 print
'<td class="dispatch_dluo"></td>';
1356 print
'<td class="right">';
1357 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1358 print
'<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.
'" />';
1362 print
'<input type="hidden" name="price" value="'.$objp->subprice.
'" />';
1365 print
'<td class="tdoverflowmax150">';
1366 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1367 $warehouse_id =
GETPOSTINT(
"fk_entrepot") ?
GETPOSTINT(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
'');
1368 if (count($listwarehouses) > 1) {
1369 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 1, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1370 } elseif (count($listwarehouses) == 1) {
1371 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 0, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1373 $langs->load(
"errors");
1374 print $langs->trans(
"ErrorNoWarehouseDefined");
1377 $warehouse_static->id = $objp->warehouse_id;
1378 $warehouse_static->label = $objp->entrepot;
1379 print $warehouse_static->getNomUrl(1);
1384 print
'<td class="tdoverflowmax300" style="white-space: pre;">'.$objp->comment.
'</td>';
1388 print
'<td class="right">';
1389 $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status);
1391 print $supplierorderdispatch->getLibStatut(5);
1395 print
'<td class="center">';
1396 if (!$permissiontocontrol) {
1397 if (empty($objp->status)) {
1398 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Approve").
'</a>';
1399 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1401 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Disapprove").
'</a>';
1402 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1406 if (
$object->status == $object::STATUS_RECEIVED_COMPLETELY) {
1409 if (empty($objp->status)) {
1410 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1411 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1413 if ($objp->status == 1) {
1414 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1415 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1417 if ($objp->status == 2) {
1418 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1419 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1424 print
'<td class="right">';
1425 if ($reception !==
null && !empty($reception->id)) {
1426 print $reception->getLibStatut(5);
1432 if ($action !=
'editline' || $lineid != $objp->dispatchlineid) {
1433 if (($reception ===
null) || empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) {
1434 print
'<td class="linecoledit center">';
1435 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#line_'.$objp->dispatchlineid.
'">';
1440 print
'<td class="linecoldelete center">';
1441 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#dispatch_received_products">';
1446 print
'<td></td><td></td>';
1449 print
'<td class="center valignmiddle">';
1450 print
'<input type="submit" class="button button-save" id="savelinebutton" name="save" value="'.$langs->trans(
"Save").
'" />';
1452 print
'<td class="center valignmiddle">';
1453 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'" />';
1459 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
$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...
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, $morecssdiv='')
Show tabs of a record.
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'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
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.
$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.