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);
140 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
144if (in_array($action, [
'checkdispatchline',
'uncheckdispatchline',
'denydispatchline',
'confirm_deleteline',
'updateline'])) {
146 if ($tmpdispatchline->fetch($lineid) <= 0 || (
int) $tmpdispatchline->fk_element !== (
int)
$object->id) {
147 setEventMessages($langs->trans(
'ErrorRecordNotFound'),
null,
'errors');
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) {
265 $comment = (string)
GETPOST(
'comment',
'alpha');
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) {
433 setEventMessages($langs->trans(
"ReceptionsRecorded"),
null,
'mesgs');
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;
490 setEventMessages(
null, $errors,
'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;
546 setEventMessages($langs->trans(
"Error"), $errors,
'errors');
559$form =
new Form($db);
561$warehouse_static =
new Entrepot($db);
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)) {
574 $author =
new User($db);
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((
int)
$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',
747 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
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',
767 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
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',
835 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
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])) {
876 $tmpproduct =
new Product($db);
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',
959 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
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',
1022 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
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.
'\')
"');
1057 if ($objp->tobatch == 2) {
1058 // Product managed with unique serial numbers: allow to enter several serial numbers at once (one line per serial)
1059 print img_picto($langs->trans('EnterMultipleSerialNumbers'), 'barcode', 'class="splitbutton marginleftonly
" onClick="addDispatchLinesFromSerialList(
'.$i.', \
''.$type.
'\')
"');
1063 print img_picto($langs->trans('AddStockLocationLine'), 'split', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
1067 if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
1068 if (!isModEnabled("multicurrency
") && empty($conf->dynamicprices->enabled)) {
1070 print '<td class="right
">';
1071 print '<input id="pu
'.$suffix.'" name="pu
'.$suffix.'" type="text
" size="8
" value="'.price((GETPOST('pu
'.$suffix) != '' ? price2num(GETPOST('pu
'.$suffix)) : $up_ht_disc)).'">';
1075 print '<td class="right
">';
1076 print '<input id="dto
'.$suffix.'" name="dto
'.$suffix.'" type="text
" size="8
" value="'.(GETPOST('dto
'.$suffix) != '' ? GETPOST('dto
'.$suffix) : '').'">';
1080 print '<td class="center
">';
1081 print '<input class="flat checkformerge
" type="checkbox
" name="saveprice
'.$suffix.'" value="'.(GETPOST('saveprice
'.$suffix) != '' ? GETPOST('saveprice
'.$suffix) : '').'">';
1087 print '<td class="right
">';
1088 if (count($listwarehouses) > 1) {
1089 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);
1090 } elseif (count($listwarehouses) == 1) {
1091 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);
1093 $langs->load("errors
");
1094 print $langs->trans("ErrorNoWarehouseDefined
");
1098 // Enable hooks to append additional columns
1099 $parameters = array(
1100 'is_information_row' => false, // this is a dispatch form row
1102 'suffix' => $suffix,
1105 $reshook = $hookmanager->executeHooks(
1106 'printFieldListValue',
1112 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1114 print $hookmanager->resPrint;
1123 dol_print_error($db);
1130 $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1132 print '<div class="center
">';
1133 $parameters = array();
1134 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1136 if (empty($reshook)) {
1137 if (empty($conf->reception->enabled)) {
1138 print $langs->trans("Comment").' : ';
1139 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1140 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1141 // print ' /
'.$object->ref_supplier; // Not yet available
1142 print '" class="flat
"><br>';
1144 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1147 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1150 print '<input type="hidden
" name="backtopageforcancel
" value="'.$_SERVER["PHP_SELF"].'?
id=
'.$object->id.'">';
1151 print '<input type="submit
" class="button" name="dispatch
" value="'.dol_escape_htmltag($dispatchBt).'"';
1153 if (!$permissiontoreceive) {
1156 if (count($listwarehouses) <= 0) {
1168 // Message if nothing to dispatch
1171 if (!getDolGlobalString('SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED')) {
1172 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1174 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1181 print dol_get_fiche_end();
1183 // default warehouse processing
1184 print '<script type="text/javascript
">
1185 $(document).ready(function () {
1186 $("select[
name=fk_default_warehouse]
").change(function() {
1187 var fk_default_warehouse = $("option:selected
", this).val();
1188 $("select[
name^=entrepot_]
").val(fk_default_warehouse).change();
1191 $(".auto-fill-qty
").on("click touchstart
", function(e){
1193 $("input[
name=
"+$(this).data("rowname
")+"]
").val($(this).data("value
")).trigger("change
");
1196 $("#autoreset
").click(function() {
1197 $(".qtydispatchinput
").each(function(){
1198 id = $(this).attr("id");
1199 idtab = id.split("_
");
1203 $("#qty_dispatched_0_
"+idtab[2]).val("0
");
1205 obj = $(this).parent().parent();
1206 nameobj = obj.attr("name");
1207 nametab = nameobj.split("_
");
1209 $("tr[
name^=\
'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
1214 $(".resetline").click(function(e){
1216 id = $(this).attr("id");
1217 id = id.split("reset_");
1218 console.log("Reset trigger for id = qty_"+id[1]);
1219 $("#qty_"+id[1]).val("");
1225 $sql =
"SELECT p.rowid as pid, p.ref, p.label,";
1226 $sql .=
" e.rowid as warehouse_id, e.ref as entrepot,";
1227 $sql .=
" cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
1228 $sql .=
" ,cd.rowid, cd.subprice";
1230 $sql .=
", cfd.fk_reception, r.date_delivery";
1232 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p,";
1233 $sql .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as cfd";
1234 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet";
1235 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"entrepot as e ON cfd.fk_entrepot = e.rowid";
1237 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"reception as r ON cfd.fk_reception = r.rowid";
1239 $sql .=
" WHERE cfd.fk_element = ".((int)
$object->id);
1240 $sql .=
" AND cfd.fk_product = p.rowid";
1241 $sql .=
" ORDER BY cfd.rowid ASC";
1243 $resql = $db->query($sql);
1245 $num = $db->num_rows($resql);
1253 print
'<div class="div-table-responsive">';
1254 print
'<table id="dispatch_received_products" class="noborder centpercent">';
1256 print
'<tr class="liste_titre">';
1259 print
'<td>'.$langs->trans(
"Reception").
'</td>';
1262 print
'<td>'.$langs->trans(
"Product").
'</td>';
1263 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
1264 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1266 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
1268 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
1271 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
1274 print
'<td class="right">'.$langs->trans(
"QtyDispatched").
'</td>';
1275 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
1276 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1280 print
'<td class="center" colspan="2">'.$langs->trans(
"Status").
'</td>';
1282 print
'<td class="center"></td>';
1285 print
'<td class="center" colspan="2"></td>';
1291 $objp = $db->fetch_object($resql);
1293 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1294 print
'<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'#line_'.
GETPOSTINT(
'lineid').
'" method="POST">
1295 <input type="hidden" name="token" value="'.
newToken().
'">
1296 <input type="hidden" name="action" value="updateline">
1297 <input type="hidden" name="mode" value="">
1298 <input type="hidden" name="lineid" value="'.$objp->dispatchlineid.
'">';
1301 print
'<tr class="oddeven" id="line_'.$objp->dispatchlineid.
'" >';
1306 print
'<td class="nowraponall">';
1307 if (!empty($objp->fk_reception)) {
1308 if (empty(
$conf->cache[
'reception'][$objp->fk_reception])) {
1310 $reception->fetch($objp->fk_reception);
1311 $conf->cache[
'reception'][$objp->fk_reception] = $reception;
1313 $reception =
$conf->cache[
'reception'][$objp->fk_reception];
1315 print $reception->getNomUrl(1);
1322 print
'<td class="tdoverflowmax150">';
1323 if (empty(
$conf->cache[
'product'][$objp->fk_product])) {
1324 $tmpproduct =
new Product($db);
1325 $tmpproduct->fetch($objp->fk_product);
1326 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
1328 $tmpproduct =
$conf->cache[
'product'][$objp->fk_product];
1330 print $tmpproduct->getNomUrl(1);
1331 print
' - '.$objp->label;
1335 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'day').
'</td>';
1339 print
'<td class="center">';
1340 if (!empty($objp->date_delivery)) {
1345 print
'<td class="center"></td>';
1351 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1352 $lotcachekey = $objp->pid.
'_'.$objp->batch;
1353 if (empty(
$conf->cache[
'productlot'][$lotcachekey])) {
1355 $lot->fetch(0, $objp->pid, $objp->batch);
1356 $conf->cache[
'productlot'][$lotcachekey] = $lot;
1358 $lot =
$conf->cache[
'productlot'][$lotcachekey];
1360 print
'<td class="dispatch_batch_number" data-col="batch" data-batch="' . dolPrintHTMLForAttribute($objp->batch) .
'" data-productid="' . $objp->fk_product .
'" >'.$lot->getNomUrl(1).
'</td>';
1362 print
'<td class="dispatch_dlc">'.dol_print_date($lot->sellby,
'day').
'</td>';
1365 print
'<td class="dispatch_dluo">'.dol_print_date($lot->eatby,
'day').
'</td>';
1368 print
'<td class="dispatch_batch_number" data-col="batch" data-batch="" data-productid="' . $objp->fk_product .
'" ></td>';
1370 print
'<td class="dispatch_dlc"></td>';
1373 print
'<td class="dispatch_dluo"></td>';
1379 print
'<td class="right">';
1380 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1381 print
'<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.
'" />';
1385 print
'<input type="hidden" name="price" value="'.$objp->subprice.
'" />';
1388 print
'<td class="tdoverflowmax150">';
1389 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1390 $warehouse_id =
GETPOSTINT(
"fk_entrepot") ?
GETPOSTINT(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
'');
1391 if (count($listwarehouses) > 1) {
1392 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 1, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1393 } elseif (count($listwarehouses) == 1) {
1394 print $formproduct->selectWarehouses($warehouse_id,
"fk_entrepot",
'', 0, 0, $objp->fk_product,
'', 1, 1, array(),
'csswarehouse');
1396 $langs->load(
"errors");
1397 print $langs->trans(
"ErrorNoWarehouseDefined");
1400 $warehouse_static->id = $objp->warehouse_id;
1401 $warehouse_static->label = $objp->entrepot;
1402 print $warehouse_static->getNomUrl(1);
1407 print
'<td class="tdoverflowmax300" style="white-space: pre;">'.$objp->comment.
'</td>';
1411 print
'<td class="right">';
1412 $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status);
1414 print $supplierorderdispatch->getLibStatut(5);
1418 print
'<td class="center">';
1419 if (!$permissiontocontrol) {
1420 if (empty($objp->status)) {
1421 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Approve").
'</a>';
1422 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1424 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Disapprove").
'</a>';
1425 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1429 if (
$object->status == $object::STATUS_RECEIVED_COMPLETELY) {
1432 if (empty($objp->status)) {
1433 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1434 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1436 if ($objp->status == 1) {
1437 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1438 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=denydispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1440 if ($objp->status == 2) {
1441 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=uncheckdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1442 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".
$id.
"&action=checkdispatchline&token=".
newToken().
"&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1447 print
'<td class="right">';
1448 if ($reception !==
null && !empty($reception->id)) {
1449 print $reception->getLibStatut(5);
1455 if ($action !=
'editline' || $lineid != $objp->dispatchlineid) {
1456 if (($reception ===
null) || empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) {
1457 print
'<td class="linecoledit center">';
1458 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#line_'.$objp->dispatchlineid.
'">';
1463 print
'<td class="linecoldelete center">';
1464 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#dispatch_received_products">';
1469 print
'<td></td><td></td>';
1472 print
'<td class="center valignmiddle">';
1473 print
'<input type="submit" class="button button-save" id="savelinebutton" name="save" value="'.$langs->trans(
"Save").
'" />';
1475 print
'<td class="center valignmiddle">';
1476 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'" />';
1482 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1494 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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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, $currencycode='')
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.
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.
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.