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');
115if (($action ==
'confirm_deleteline' || ($action ==
'updateline' && empty($cancel))) && $lineid > 0) {
117 if ($tmpdispatchline->fetch($lineid) > 0 && $tmpdispatchline->fk_reception > 0) {
118 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
120 if ($tmpreception->fetch($tmpdispatchline->fk_reception) > 0 && $tmpreception->status != Reception::STATUS_DRAFT) {
121 setEventMessages($langs->trans(
'StatusOfRefMustBe', $langs->transnoentitiesnoconv(
'Reception'), $langs->transnoentitiesnoconv(
'StatusReceptionDraftShort')),
null,
'errors');
127$usercancreate = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
128$permissiontoadd = $usercancreate;
137$parameters = array();
138$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
144if (in_array($action, [
'checkdispatchline',
'uncheckdispatchline',
'denydispatchline',
'confirm_deleteline',
'updateline'])) {
146 if ($tmpdispatchline->fetch($lineid) <= 0 || (
int) $tmpdispatchline->fk_element !== (
int)
$object->id) {
152if ($action ==
'checkdispatchline' && $permissiontocontrol) {
157 $result = $supplierorderdispatch->fetch($lineid);
160 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
165 $result = $supplierorderdispatch->setStatut(1);
167 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
174 $result =
$object->calcAndSetStatusDispatch($user);
188if ($action ==
'uncheckdispatchline' && $permissiontocontrol) {
193 $result = $supplierorderdispatch->fetch($lineid);
196 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
201 $result = $supplierorderdispatch->setStatut(0);
203 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
209 $result =
$object->calcAndSetStatusDispatch($user);
223if ($action ==
'denydispatchline' && $permissiontocontrol) {
228 $result = $supplierorderdispatch->fetch($lineid);
231 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
236 $result = $supplierorderdispatch->setStatut(2);
238 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
244 $result =
$object->calcAndSetStatusDispatch($user);
258$saveprice =
"savepriceIsNotSet";
259if ($action ==
'dispatch' && $permissiontoreceive) {
267 foreach ($_POST as $key => $value) {
270 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
275 $prod =
"product_".$reg[1].
'_'.$reg[2];
276 $qty =
"qty_".$reg[1].
'_'.$reg[2];
277 $ent =
"entrepot_".$reg[1].
'_'.$reg[2];
279 $ent = $fk_default_warehouse;
281 $pu =
"pu_".$reg[1].
'_'.$reg[2];
282 $fk_commandefourndet =
"fk_commandefourndet_".$reg[1].
'_'.$reg[2];
286 $dto =
GETPOSTINT(
"dto_".$reg[1].
'_'.$reg[2]);
288 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
290 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
297 if ($qtytomove != 0) {
299 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
300 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline);
301 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
306 $result =
$object->dispatchProduct($user,
GETPOSTINT(
$prod), $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'),
'',
'',
'',
GETPOSTINT($fk_commandefourndet), $notrigger);
312 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
322 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
323 $sql .=
" SET unitprice='".price2num(
GETPOST($pu),
'MU').
"'";
324 $sql .=
", price=".price2num(
GETPOST($pu),
'MU').
"*quantity";
325 $sql .=
", remise_percent = ".((float) $dto);
326 $sql .=
" WHERE fk_soc=".((int)
$object->socid);
327 $sql .=
" AND fk_product=".(GETPOSTINT(
$prod));
329 $resql =
$db->query($sql);
337 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
343 $prod =
'product_batch_'.$reg[1].
'_'.$reg[2];
344 $qty =
'qty_'.$reg[1].
'_'.$reg[2];
345 $ent =
'entrepot_'.$reg[1].
'_'.$reg[2];
346 $pu =
'pu_'.$reg[1].
'_'.$reg[2];
347 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
348 $lot =
'lot_number_'.$reg[1].
'_'.$reg[2];
352 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
358 $unit_price =
price2num((
float)
GETPOST(
"pu_".$reg[1]) * (100 - $dto) / 100,
'MU');
360 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
367 if ($qtytomove > 0) {
371 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
372 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
373 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
386 if (!
GETPOST($lot,
'alpha') && !$dDLUO && !$dDLC) {
387 dol_syslog(
'No dispatch for line '.$key.
' as serial/eat-by/sellby date are not set');
388 $text = $langs->transnoentities(
'atleast1batchfield').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.((
int) $reg[1] + 1);
389 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
394 $result =
$object->dispatchProduct($user, $productId, $qtytomove,
GETPOSTINT($ent), $puformove,
GETPOST(
'comment'), $dDLUO, $dDLC,
GETPOST($lot,
'alpha'),
GETPOSTINT($fk_commandefourndet), $notrigger);
400 if (!$error &&
getDolGlobalString(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
406 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
407 $sql .=
" SET unitprice = ".price2num(
GETPOST($pu),
'MU', 2);
408 $sql .=
", price = ".price2num(
GETPOST($pu),
'MU', 2).
" * quantity";
409 $sql .=
", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2);
410 $sql .=
" WHERE fk_soc = ".((int)
$object->socid);
411 $sql .=
" AND fk_product=".((int) $productId);
413 $resql =
$db->query($sql);
423 $result =
$object->calcAndSetStatusDispatch($user,
GETPOST(
'closeopenorder') ? 1 : 0,
GETPOST(
'comment'));
430 if ($result >= 0 && !$error) {
435 header(
"Location: dispatch.php?id=".$id);
451if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoreceive) {
457 $result = $supplierorderdispatch->fetch($lineid);
459 $qty = $supplierorderdispatch->qty;
460 $entrepot = $supplierorderdispatch->fk_entrepot;
461 $product = $supplierorderdispatch->fk_product;
463 $comment = $supplierorderdispatch->comment;
464 $eatby = $supplierorderdispatch->eatby;
465 $sellby = $supplierorderdispatch->sellby;
466 $batch = $supplierorderdispatch->batch;
468 $result = $supplierorderdispatch->delete($user);
475 if ($entrepot > 0 &&
isModEnabled(
'stock') &&
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') && empty($supplierorderdispatch->fk_reception)) {
480 $result = $mouv->livraison($user, $product, $entrepot, $qty, (
float) $price, (
string) $comment,
'', (
int) $eatby, (
int) $sellby, $batch);
482 $errors = $mouv->errors;
497if ($action ==
'updateline' && $permissiontoreceive && empty($cancel)) {
503 $result = $supplierorderdispatch->fetch($lineid);
505 $qty = $supplierorderdispatch->qty;
506 $entrepot = $supplierorderdispatch->fk_entrepot;
507 $product = $supplierorderdispatch->fk_product;
509 $comment = $supplierorderdispatch->comment;
513 $batch = $supplierorderdispatch->batch;
515 $supplierorderdispatch->qty =
GETPOSTFLOAT(
'qty',
'MS');
516 $supplierorderdispatch->fk_entrepot =
GETPOSTINT(
'fk_entrepot');
517 $result = $supplierorderdispatch->update($user);
521 $errors = $supplierorderdispatch->errors;
529 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, (
string) $comment,
'', (
int) $eatby, (
int) $sellby, $batch);
531 $errors = $mouv->errors;
535 $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, (
string) $comment, (
int) $eatby, (
int) $sellby, $batch);
537 $errors = $mouv->errors;
564$title =
$object->ref.
" - ".$langs->trans(
'OrderDispatch');
565$help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
566$morejs = array(
'/fourn/js/lib_dispatch.js.php');
568llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs,
'',
'',
'mod-supplier-order page-card_dispatch');
570if ($id > 0 || !empty($ref)) {
575 $author->fetch(
$object->user_author_id);
579 $title = $langs->trans(
"SupplierOrder");
585 if ($action ==
'ask_deleteline') {
586 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
590 $parameters = array(
'lineid' => $lineid);
592 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
593 if (empty($reshook)) {
594 $formconfirm .= $hookmanager->resPrint;
595 } elseif ($reshook > 0) {
596 $formconfirm = $hookmanager->resPrint;
604 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
606 $morehtmlref =
'<div class="refidno">';
608 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'', 0, 1);
609 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, 0,
'string',
'',
null,
null,
'', 1);
611 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
614 $langs->load(
"projects");
615 $morehtmlref .=
'<br>';
617 $caneditproject =
false;
618 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
619 if ($action !=
'classify' && $caneditproject) {
620 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
622 $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');
624 if (!empty(
$object->fk_project)) {
626 $proj->fetch(
$object->fk_project);
627 $morehtmlref .= $proj->getNomUrl(1);
629 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
634 $morehtmlref .=
'</div>';
637 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
640 print
'<div class="fichecenter">';
641 print
'<div class="underbanner clearboth"></div>';
643 print
'<table class="border tableforfield" width="100%">';
646 if (
$object->methode_commande_id > 0) {
647 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td>';
653 if (
$object->methode_commande) {
654 print
'<tr><td>'.$langs->trans(
"Method").
'</td><td>'.
$object->getInputMethod().
'</td></tr>';
659 print
'<tr><td class="titlefield">'.$langs->trans(
"AuthorRequest").
'</td>';
660 print
'<td>'.$author->getNomUrl(-1,
'', 0, 0, 0).
'</td>';
663 $parameters = array();
664 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
677 print
'<br><span class="opacitymedium">'.$langs->trans(
"OrderStatusNotReadyToDispatch").
'</span>';
683 $listwarehouses = array();
688 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
690 $formproduct->loadWarehouses();
692 $listwarehouses = $entrepot->list_array(1);
695 if (empty(
$conf->reception->enabled)) {
696 print
'<form method="POST" action="dispatch.php?id='.$object->id.
'">';
698 print
'<form method="post" action="'.dol_buildpath(
'/reception/card.php', 1).
'?originid='.
$object->id.
'&origin=supplierorder">';
701 print
'<input type="hidden" name="token" value="'.newToken().
'">';
702 if (empty(
$conf->reception->enabled)) {
703 print
'<input type="hidden" name="action" value="dispatch">';
705 print
'<input type="hidden" name="action" value="create">';
708 print
'<div class="div-table-responsive-no-min">';
709 print
'<table class="noborder centpercent">';
712 $products_dispatched = array();
713 $sql =
"SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
714 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
715 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l on l.rowid = cfd.fk_elementdet";
716 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
717 $sql .=
" GROUP BY l.rowid, cfd.fk_product";
719 $resql =
$db->query($sql);
721 $num =
$db->num_rows($resql);
726 $objd =
$db->fetch_object($resql);
727 $products_dispatched[$objd->rowid] =
price2num($objd->qty,
'MS');
735 $sql =
"SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, l.qty as qty,";
736 $sql .=
" p.ref, p.label, p.tobatch, p.fk_default_warehouse";
739 $parameters = array();
740 $reshook = $hookmanager->executeHooks(
741 'printFieldListSelect',
749 $sql .= $hookmanager->resPrint;
751 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l";
752 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON l.fk_product=p.rowid";
753 $sql .=
" WHERE l.fk_commande = ".((int)
$object->id);
755 $sql .=
" AND l.product_type = 0";
759 $parameters = array();
760 $reshook = $hookmanager->executeHooks(
761 'printFieldListWhere',
769 $sql .= $hookmanager->resPrint;
772 $sql .=
" ORDER BY l.rang, p.ref, p.label";
778 $resql =
$db->query($sql);
780 $num =
$db->num_rows($resql);
784 print
'<tr class="liste_titre">';
786 print
'<td>'.$langs->trans(
"Description").
'</td>';
788 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
790 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
793 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
800 print
'<td class="right">'.$langs->trans(
"SupplierRef").
'</td>';
801 print
'<td class="right">'.$langs->trans(
"QtyOrdered").
'</td>';
802 print
'<td class="right">'.$langs->trans(
"QtyDispatchedShort").
'</td>';
803 print
' <td class="right">'.$langs->trans(
"QtyToDispatchShort");
804 print
'<br><a href="#" id="autoreset">'.img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').$langs->trans(
"Reset").
'</a></td>';
805 print
'<td width="32"></td>';
809 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
810 print
'<td class="right">'.$langs->trans(
"ReductionShort").
' (%)</td>';
811 print
'<td class="right">'.$langs->trans(
"UpdatePrice").
'</td>';
815 print
'<td align="right">'.$langs->trans(
"Warehouse");
818 if (count($listwarehouses) > 1) {
819 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, $langs->trans(
"ForceTo"), 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
820 } elseif (count($listwarehouses) == 1) {
821 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
827 $parameters = array();
828 $reshook = $hookmanager->executeHooks(
829 'printFieldListTitle',
837 print $hookmanager->resPrint;
844 $conf->cache[
'product'] = array();
848 $objp =
$db->fetch_object($resql);
851 if (!$objp->fk_product > 0) {
854 $alreadydispatched = isset($products_dispatched[$objp->rowid]) ? $products_dispatched[$objp->rowid] : 0;
855 $remaintodispatch =
price2num($objp->qty - ((
float) $alreadydispatched), 5);
856 if ($remaintodispatch < 0 && !
getDolGlobalString(
'SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN')) {
857 $remaintodispatch = 0;
860 if ($remaintodispatch || !
getDolGlobalString(
'SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
869 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
871 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$objp->qty.
'">';
872 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.(float) $alreadydispatched.
'">';
873 print
'<tr class="oddeven">';
875 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
877 $tmpproduct->fetch($objp->fk_product);
878 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
880 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
883 $linktoprod = $tmpproduct->getNomUrl(1);
884 $linktoprod .=
' - '.$objp->label.
"\n";
887 if ($objp->tobatch) {
892 print
'<td class="dispatch_batch_number"></td>';
894 print
'<td class="dispatch_dlc"></td>';
897 print
'<td class="dispatch_dluo"></td>';
904 print
'<td class="dispatch_batch_number">';
905 print
'<span class="opacitymedium small">'.$langs->trans(
"ProductDoesNotUseBatchSerial").
'</small>';
908 print
'<td class="dispatch_dlc"></td>';
911 print
'<td class="dispatch_dluo"></td>';
915 print
'<td colspan="4">';
921 $up_ht_disc = $objp->subprice;
922 if (!empty($objp->remise_percent) && !
getDolGlobalString(
'STOCK_EXCLUDE_DISCOUNT_FOR_PMP')) {
923 $up_ht_disc =
price2num($up_ht_disc * (100 - $objp->remise_percent) / 100,
'MU');
927 print
'<td class="right">'.$objp->sref.
'</td>';
930 print
'<td class="right">'.$objp->qty.
'</td>';
933 print
'<td class="right">'.$alreadydispatched.
'</td>';
935 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
937 print
'<td class="right">';
947 'is_information_row' =>
true,
952 $reshook = $hookmanager->executeHooks(
953 'printFieldListValue',
961 print $hookmanager->resPrint;
965 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
967 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
968 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
970 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
972 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price($up_ht_disc).
'">';
974 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price($up_ht_disc).
'">';
980 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.
GETPOST(
'lot_number'.$suffix).
'">';
983 print
'<td class="nowraponall">';
985 print $form->selectDate($dlcdatesuffix,
'dlc'.$suffix, 0, 0, 1,
'');
989 print
'<td class="nowraponall">';
991 print $form->selectDate($dluodatesuffix,
'dluo'.$suffix, 0, 0, 1,
'');
994 print
'<td colspan="3"> </td>';
1000 print
'<td class="right">';
1008 $parameters = array(
1010 'is_information_row' =>
true,
1012 'suffix' => $suffix,
1015 $reshook = $hookmanager->executeHooks(
1016 'printFieldListValue',
1024 print $hookmanager->resPrint;
1028 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
1029 print
'<td colspan="'.$colspan.
'">';
1030 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
1031 print
'<input name="product'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
1033 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
1035 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
1037 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
1044 print
'<td class="right nowrap">';
1045 if ($remaintodispatch > 0) {
1046 $btnLabel = $langs->trans(
"Fill").
' : '.$remaintodispatch;
1047 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>';
1049 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)).
'">';
1050 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>';
1054 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
1056 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split',
'class="splitbutton" onClick="addDispatchLine('.$i.
', \''.$type.
'\')
"');
1059 print img_picto($langs->trans('AddStockLocationLine'), 'split', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
1063 if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
1064 if (!isModEnabled("multicurrency
") && empty($conf->dynamicprices->enabled)) {
1066 print '<td class="right
">';
1067 print '<input id="pu
'.$suffix.'" name="pu
'.$suffix.'" type="text
" size="8
" value="'.price((GETPOST('pu
'.$suffix) != '' ? price2num(GETPOST('pu
'.$suffix)) : $up_ht_disc)).'">';
1071 print '<td class="right
">';
1072 print '<input id="dto
'.$suffix.'" name="dto
'.$suffix.'" type="text
" size="8
" value="'.(GETPOST('dto
'.$suffix) != '' ? GETPOST('dto
'.$suffix) : '').'">';
1076 print '<td class="center
">';
1077 print '<input class="flat checkformerge
" type="checkbox
" name="saveprice
'.$suffix.'" value="'.(GETPOST('saveprice
'.$suffix) != '' ? GETPOST('saveprice
'.$suffix) : '').'">';
1083 print '<td class="right
">';
1084 if (count($listwarehouses) > 1) {
1085 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);
1086 } elseif (count($listwarehouses) == 1) {
1087 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);
1089 $langs->load("errors
");
1090 print $langs->trans("ErrorNoWarehouseDefined
");
1094 // Enable hooks to append additional columns
1095 $parameters = array(
1096 'is_information_row' => false, // this is a dispatch form row
1098 'suffix' => $suffix,
1101 $reshook = $hookmanager->executeHooks(
1102 'printFieldListValue',
1108 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1110 print $hookmanager->resPrint;
1119 dol_print_error($db);
1126 $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1128 print '<div class="center
">';
1129 $parameters = array();
1130 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1132 if (empty($reshook)) {
1133 if (empty($conf->reception->enabled)) {
1134 print $langs->trans("Comment").' : ';
1135 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1136 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1137 // print ' /
'.$object->ref_supplier; // Not yet available
1138 print '" class="flat
"><br>';
1140 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1143 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1146 print '<input type="hidden
" name="backtopageforcancel
" value="'.$_SERVER["PHP_SELF"].'?
id=
'.$object->id.'">';
1147 print '<input type="submit
" class="button" name="dispatch
" value="'.dol_escape_htmltag($dispatchBt).'"';
1149 if (!$permissiontoreceive) {
1152 if (count($listwarehouses) <= 0) {
1164 // Message if nothing to dispatch
1167 if (!getDolGlobalString('SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
1168 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1170 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1177 print dol_get_fiche_end();
1179 // default warehouse processing
1180 print '<script type="text/javascript
">
1181 $(document).ready(function () {
1182 $("select[
name=fk_default_warehouse]
").change(function() {
1183 var fk_default_warehouse = $("option:selected
", this).val();
1184 $("select[
name^=entrepot_]
").val(fk_default_warehouse).change();
1187 $(".auto-fill-qty
").on("click touchstart
", function(e){
1189 $("input[
name=
"+$(this).data("rowname
")+"]
").val($(this).data("value
")).trigger("change
");
1192 $("#autoreset
").click(function() {
1193 $(".qtydispatchinput
").each(function(){
1194 id = $(this).attr("id");
1195 idtab = id.split("_
");
1199 $("#qty_dispatched_0_
"+idtab[2]).val("0
");
1201 obj = $(this).parent().parent();
1202 nameobj = obj.attr("name");
1203 nametab = nameobj.split("_
");
1205 $("tr[
name^=\
'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
1210 $(".resetline").click(function(e){
1212 id = $(this).attr("id");
1213 id = id.split("reset_");
1214 console.log("Reset trigger for id = qty_"+id[1]);
1215 $("#qty_"+id[1]).val("");
1221 $sql =
"SELECT p.rowid as pid, p.ref, p.label,";
1222 $sql .=
" e.rowid as warehouse_id, e.ref as entrepot,";
1223 $sql .=
" cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
1224 $sql .=
" ,cd.rowid, cd.subprice";
1226 $sql .=
", cfd.fk_reception, r.date_delivery";
1228 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p,";
1229 $sql .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
1230 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet";
1231 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"entrepot as e ON cfd.fk_entrepot = e.rowid";
1233 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"reception as r ON cfd.fk_reception = r.rowid";
1235 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
1236 $sql .=
" AND cfd.fk_product = p.rowid";
1237 $sql .=
" ORDER BY cfd.rowid ASC";
1239 $resql =
$db->query($sql);
1241 $num =
$db->num_rows($resql);
1249 print
'<div class="div-table-responsive">';
1250 print
'<table id="dispatch_received_products" class="noborder centpercent">';
1252 print
'<tr class="liste_titre">';
1255 print
'<td>'.$langs->trans(
"Reception").
'</td>';
1258 print
'<td>'.$langs->trans(
"Product").
'</td>';
1259 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
1260 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1262 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
1264 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
1267 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
1270 print
'<td class="right">'.$langs->trans(
"QtyDispatched").
'</td>';
1271 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
1272 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1276 print
'<td class="center" colspan="2">'.$langs->trans(
"Status").
'</td>';
1278 print
'<td class="center"></td>';
1281 print
'<td class="center" colspan="2"></td>';
1287 $objp =
$db->fetch_object($resql);
1289 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1290 print
'<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#line_'.
GETPOSTINT(
'lineid').
'" method="POST">
1291 <input type="hidden" name="token" value="'.
newToken().
'">
1292 <input type="hidden" name="action" value="updateline">
1293 <input type="hidden" name="mode" value="">
1294 <input type="hidden" name="lineid" value="'.$objp->dispatchlineid.
'">';
1297 print
'<tr class="oddeven" id="line_'.$objp->dispatchlineid.
'" >';
1302 print
'<td class="nowraponall">';
1303 if (!empty($objp->fk_reception)) {
1305 $reception->fetch($objp->fk_reception);
1306 print $reception->getNomUrl(1);
1313 print
'<td class="tdoverflowmax150">';
1314 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
1316 $tmpproduct->fetch($objp->fk_product);
1317 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
1319 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
1321 print $tmpproduct->getNomUrl(1);
1322 print
' - '.$objp->label;
1326 print
'<td class="center">'.dol_print_date(
$db->jdate($objp->datec),
'day').
'</td>';
1330 print
'<td class="center">';
1331 if (!empty($objp->date_delivery)) {
1336 print
'<td class="center"></td>';
1342 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1344 $lot->fetch(0, $objp->pid, $objp->batch);
1345 print
'<td class="dispatch_batch_number" data-col="batch" data-batch="' .
dolPrintHTMLForAttribute($objp->batch) .
'" data-productid="' . $objp->fk_product .
'" >'.$lot->getNomUrl(1).
'</td>';
1347 print
'<td class="dispatch_dlc">'.dol_print_date($lot->sellby,
'day').
'</td>';
1350 print
'<td class="dispatch_dluo">'.dol_print_date($lot->eatby,
'day').
'</td>';
1353 print
'<td class="dispatch_batch_number" data-col="batch" data-batch="" data-productid="' . $objp->fk_product .
'" ></td>';
1355 print
'<td class="dispatch_dlc"></td>';
1358 print
'<td class="dispatch_dluo"></td>';
1364 print
'<td class="right">';
1365 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1366 print
'<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.
'" />';
1370 print
'<input type="hidden" name="price" value="'.$objp->subprice.
'" />';
1373 print
'<td class="tdoverflowmax150">';
1374 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1375 $warehouse_id =
GETPOSTINT(
"fk_entrepot") ?
GETPOSTINT(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
'');
1376 if (count($listwarehouses) > 1) {
1377 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 1, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1378 } elseif (count($listwarehouses) == 1) {
1379 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 0, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1381 $langs->load(
"errors");
1382 print $langs->trans(
"ErrorNoWarehouseDefined");
1385 $warehouse_static->id = $objp->warehouse_id;
1386 $warehouse_static->label = $objp->entrepot;
1387 print $warehouse_static->getNomUrl(1);
1392 print
'<td class="tdoverflowmax300" style="white-space: pre;">'.$objp->comment.
'</td>';
1396 print
'<td class="right">';
1397 $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status);
1399 print $supplierorderdispatch->getLibStatut(5);
1403 print
'<td class="center">';
1404 if (!$permissiontocontrol) {
1405 if (empty($objp->status)) {
1406 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Approve").
'</a>';
1407 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1409 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Disapprove").
'</a>';
1410 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1414 if (
$object->status == $object::STATUS_RECEIVED_COMPLETELY) {
1417 if (empty($objp->status)) {
1418 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1419 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1421 if ($objp->status == 1) {
1422 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1423 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1425 if ($objp->status == 2) {
1426 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1427 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1432 print
'<td class="right">';
1433 if ($reception !==
null && !empty($reception->id)) {
1434 print $reception->getLibStatut(5);
1440 if ($action !=
'editline' || $lineid != $objp->dispatchlineid) {
1441 if (($reception ===
null) || empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) {
1442 print
'<td class="linecoledit center">';
1443 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#line_'.$objp->dispatchlineid.
'">';
1448 print
'<td class="linecoldelete center">';
1449 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#dispatch_received_products">';
1454 print
'<td></td><td></td>';
1457 print
'<td class="center valignmiddle">';
1458 print
'<input type="submit" class="button button-save" id="savelinebutton" name="save" value="'.$langs->trans(
"Save").
'" />';
1460 print
'<td class="center valignmiddle">';
1461 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'" />';
1467 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.
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'.
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.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
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).
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.
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.
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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
$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.