34 require
'../../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
36 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48 $langs->loadLangs(array(
"bills",
"orders",
"sendings",
"companies",
"deliveries",
"products",
"stocks",
"receptions"));
51 $langs->load(
'productbatch');
57 $lineid =
GETPOST(
'lineid',
'int');
58 $action =
GETPOST(
'action',
'aZ09');
59 $fk_default_warehouse =
GETPOST(
'fk_default_warehouse',
'int');
60 $cancel =
GETPOST(
'cancel',
'alpha');
61 $confirm =
GETPOST(
'confirm',
'alpha');
64 $socid = $user->socid;
67 $hookmanager->initHooks(array(
'ordersupplierdispatch'));
72 $projectid =
GETPOST(
"projectid",
'int');
77 if ($id > 0 || !empty($ref)) {
78 $result = $object->fetch($id, $ref);
82 $result = $object->fetch_thirdparty();
88 if (empty($conf->reception->enabled)) {
89 $permissiontoreceive = $user->hasRight(
"fournisseur",
"commande",
"receptionner");
90 $permissiontocontrol = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
"fournisseur",
"commande",
"receptionner")) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
"fournisseur",
"commande_advance",
"check")));
92 $permissiontoreceive = $user->hasRight(
"reception",
"creer");
93 $permissiontocontrol = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
"reception",
"creer")) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
"reception",
"reception_advance",
"validate")));
97 $result =
restrictedArea($user,
'fournisseur', $object,
'commande_fournisseur',
'commande');
103 $usercancreate = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
104 $permissiontoadd = $usercancreate;
111 $parameters = array();
112 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
117 if ($action ==
'checkdispatchline' && $permissiontocontrol) {
123 $result = $supplierorderdispatch->fetch($lineid);
126 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
131 $result = $supplierorderdispatch->setStatut(1);
133 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
140 $result = $object->calcAndSetStatusDispatch($user);
154 if ($action ==
'uncheckdispatchline' && $permissiontocontrol) {
160 $result = $supplierorderdispatch->fetch($lineid);
163 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
168 $result = $supplierorderdispatch->setStatut(0);
170 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
176 $result = $object->calcAndSetStatusDispatch($user);
190 if ($action ==
'denydispatchline' && $permissiontocontrol) {
196 $result = $supplierorderdispatch->fetch($lineid);
199 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
204 $result = $supplierorderdispatch->setStatut(2);
206 setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors,
'errors');
212 $result = $object->calcAndSetStatusDispatch($user);
226 if ($action ==
'dispatch' && $permissiontoreceive) {
233 foreach ($_POST as $key => $value) {
236 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
241 $prod =
"product_".$reg[1].
'_'.$reg[2];
242 $qty =
"qty_".$reg[1].
'_'.$reg[2];
243 $ent =
"entrepot_".$reg[1].
'_'.$reg[2];
245 $ent = $fk_default_warehouse;
247 $pu =
"pu_".$reg[1].
'_'.$reg[2];
248 $fk_commandefourndet =
"fk_commandefourndet_".$reg[1].
'_'.$reg[2];
250 if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
251 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
252 $dto =
GETPOST(
"dto_".$reg[1].
'_'.$reg[2],
'int');
256 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
262 if (!(
GETPOST($ent,
'int') > 0)) {
263 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
264 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline);
265 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
270 $result = $object->dispatchProduct($user,
GETPOST($prod,
'int'),
GETPOST($qty),
GETPOST($ent,
'int'),
GETPOST($pu),
GETPOST(
'comment'),
'',
'',
'',
GETPOST($fk_commandefourndet,
'int'), $notrigger);
276 if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
277 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
286 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
287 $sql .=
" SET unitprice='".price2num(
GETPOST($pu),
'MU').
"'";
288 $sql .=
", price=".price2num(
GETPOST($pu),
'MU').
"*quantity";
289 $sql .=
", remise_percent = ".((float) $dto);
290 $sql .=
" WHERE fk_soc=".((int) $object->socid);
291 $sql .=
" AND fk_product=".((int)
GETPOST($prod,
'int'));
293 $resql = $db->query(
$sql);
301 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
307 $prod =
'product_batch_'.$reg[1].
'_'.$reg[2];
308 $qty =
'qty_'.$reg[1].
'_'.$reg[2];
309 $ent =
'entrepot_'.$reg[1].
'_'.$reg[2];
310 $pu =
'pu_'.$reg[1].
'_'.$reg[2];
311 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
312 $lot =
'lot_number_'.$reg[1].
'_'.$reg[2];
313 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo_'.$reg[1].
'_'.$reg[2].
'month',
'int'),
GETPOST(
'dluo_'.$reg[1].
'_'.$reg[2].
'day',
'int'),
GETPOST(
'dluo_'.$reg[1].
'_'.$reg[2].
'year',
'int'));
314 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc_'.$reg[1].
'_'.$reg[2].
'month',
'int'),
GETPOST(
'dlc_'.$reg[1].
'_'.$reg[2].
'day',
'int'),
GETPOST(
'dlc_'.$reg[1].
'_'.$reg[2].
'year',
'int'));
316 $fk_commandefourndet =
'fk_commandefourndet_'.$reg[1].
'_'.$reg[2];
318 if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
319 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
320 $dto =
GETPOST(
"dto_".$reg[1].
'_'.$reg[2],
'int');
324 $saveprice =
"saveprice_".$reg[1].
'_'.$reg[2];
330 if (!(
GETPOST($ent,
'int') > 0)) {
331 dol_syslog(
'No dispatch for line '.$key.
' as no warehouse was chosen.');
332 $text = $langs->transnoentities(
'Warehouse').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.($reg[1] + 1);
333 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
337 if (!(
GETPOST($lot,
'alpha') || $dDLUO || $dDLC)) {
338 dol_syslog(
'No dispatch for line '.$key.
' as serial/eat-by/sellby date are not set');
339 $text = $langs->transnoentities(
'atleast1batchfield').
', '.$langs->transnoentities(
'Line').
' '.($numline).
'-'.($reg[1] + 1);
340 setEventMessages($langs->trans(
'ErrorFieldRequired', $text),
null,
'errors');
345 $result = $object->dispatchProduct($user,
GETPOST($prod,
'int'),
GETPOST($qty),
GETPOST($ent,
'int'),
GETPOST($pu),
GETPOST(
'comment'), $dDLUO, $dDLC,
GETPOST($lot,
'alpha'),
GETPOST($fk_commandefourndet,
'int'), $notrigger);
351 if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
352 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
353 $dto =
GETPOST(
"dto_".$reg[1].
'_'.$reg[2],
'int');
357 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price";
358 $sql .=
" SET unitprice = ".price2num(
GETPOST($pu),
'MU', 2);
359 $sql .=
", price = ".price2num(
GETPOST($pu),
'MU', 2).
" * quantity";
360 $sql .=
", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2).
"'";
361 $sql .=
" WHERE fk_soc = ".((int) $object->socid);
362 $sql .=
" AND fk_product=".((int)
GETPOST($prod,
'int'));
364 $resql = $db->query(
$sql);
374 $result = $object->calcAndSetStatusDispatch($user,
GETPOST(
'closeopenorder') ? 1 : 0,
GETPOST(
'comment'));
381 if ($result >= 0 && !$error) {
384 header(
"Location: dispatch.php?id=".$id);
392 if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoreceive) {
396 $result = $supplierorderdispatch->fetch($lineid);
398 $qty = $supplierorderdispatch->qty;
399 $entrepot = $supplierorderdispatch->fk_entrepot;
400 $product = $supplierorderdispatch->fk_product;
402 $comment = $supplierorderdispatch->comment;
403 $eatby = $supplierorderdispatch->eatby;
404 $sellby = $supplierorderdispatch->sellby;
405 $batch = $supplierorderdispatch->batch;
407 $result = $supplierorderdispatch->delete($user);
410 $errors = $object->errors;
414 if ($entrepot > 0 &&
isModEnabled(
'stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) && empty($supplierorderdispatch->fk_reception)) {
417 $mouv->origin = &$object;
418 $mouv->setOrigin($object->element, $object->id);
419 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment,
'', $eatby, $sellby, $batch);
421 $errors = $mouv->errors;
436 if ($action ==
'updateline' && $permissiontoreceive) {
441 $result = $supplierorderdispatch->fetch($lineid);
443 $qty = $supplierorderdispatch->qty;
444 $entrepot = $supplierorderdispatch->fk_entrepot;
445 $product = $supplierorderdispatch->fk_product;
447 $comment = $supplierorderdispatch->comment;
448 $eatby = $supplierorderdispatch->eatby;
449 $sellby = $supplierorderdispatch->sellby;
450 $batch = $supplierorderdispatch->batch;
453 $supplierorderdispatch->fk_entrepot =
GETPOST(
'fk_entrepot');
454 $result = $supplierorderdispatch->update($user);
458 $errors = $supplierorderdispatch->errors;
461 if ($entrepot > 0 &&
isModEnabled(
'stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
464 $mouv->origin = &$object;
465 $mouv->setOrigin($object->element, $object->id);
466 $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment,
'', $eatby, $sellby, $batch);
468 $errors = $mouv->errors;
471 $mouv->origin = &$object;
472 $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, $eatby, $sellby, $batch);
474 $errors = $mouv->errors;
498 $warehouse_static =
new Entrepot($db);
501 $title = $object->ref.
" - ".$langs->trans(
'OrderDispatch');
502 $help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
503 $morejs = array(
'/fourn/js/lib_dispatch.js.php');
507 if ($id > 0 || !empty($ref)) {
509 $soc->fetch($object->socid);
511 $author =
new User($db);
512 $author->fetch($object->user_author_id);
516 $title = $langs->trans(
"SupplierOrder");
522 if ($action ==
'ask_deleteline') {
523 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
527 $parameters = array(
'lineid' => $lineid);
529 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
530 if (empty($reshook)) {
532 } elseif ($reshook > 0) {
541 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
543 $morehtmlref =
'<div class="refidno">';
545 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
546 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'',
null,
null,
'', 1);
548 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
551 $langs->load(
"projects");
552 $morehtmlref .=
'<br>';
554 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
555 if ($action !=
'classify' && $caneditproject) {
556 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
558 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
560 if (!empty($object->fk_project)) {
562 $proj->fetch($object->fk_project);
563 $morehtmlref .= $proj->getNomUrl(1);
565 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
570 $morehtmlref .=
'</div>';
573 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
576 print
'<div class="fichecenter">';
577 print
'<div class="underbanner clearboth"></div>';
579 print
'<table class="border tableforfield" width="100%">';
582 if ($object->methode_commande_id > 0) {
583 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td>';
584 if ($object->date_commande) {
589 if ($object->methode_commande) {
590 print
'<tr><td>'.$langs->trans(
"Method").
'</td><td>'.$object->getInputMethod().
'</td></tr>';
595 print
'<tr><td class="titlefield">'.$langs->trans(
"AuthorRequest").
'</td>';
596 print
'<td>'.$author->getNomUrl(1,
'', 0, 0, 0).
'</td>';
599 $parameters = array();
600 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
617 print
'<br><span class="opacitymedium">'.$langs->trans(
"OrderStatusNotReadyToDispatch").
'</span>';
627 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
629 $formproduct->loadWarehouses();
631 $listwarehouses = $entrepot->list_array(1);
634 if (empty($conf->reception->enabled)) {
635 print
'<form method="POST" action="dispatch.php?id='.$object->id.
'">';
637 print
'<form method="post" action="'.dol_buildpath(
'/reception/card.php', 1).
'?originid='.$object->id.
'&origin=supplierorder">';
640 print
'<input type="hidden" name="token" value="'.newToken().
'">';
641 if (empty($conf->reception->enabled)) {
642 print
'<input type="hidden" name="action" value="dispatch">';
644 print
'<input type="hidden" name="action" value="create">';
647 print
'<div class="div-table-responsive-no-min">';
648 print
'<table class="noborder centpercent">';
651 $products_dispatched = array();
652 $sql =
"SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
653 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as cfd";
654 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet";
655 $sql .=
" WHERE cfd.fk_commande = ".((int) $object->id);
656 $sql .=
" GROUP BY l.rowid, cfd.fk_product";
658 $resql = $db->query(
$sql);
660 $num = $db->num_rows($resql);
665 $objd = $db->fetch_object($resql);
666 $products_dispatched[$objd->rowid] =
price2num($objd->qty,
'MS');
674 $sql =
"SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, l.qty as qty,";
675 $sql .=
" p.ref, p.label, p.tobatch, p.fk_default_warehouse";
678 $parameters = array();
679 $reshook = $hookmanager->executeHooks(
680 'printFieldListSelect',
688 $sql .= $hookmanager->resPrint;
690 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseurdet as l";
691 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON l.fk_product=p.rowid";
692 $sql .=
" WHERE l.fk_commande = ".((int) $object->id);
693 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
694 $sql .=
" AND l.product_type = 0";
698 $parameters = array();
699 $reshook = $hookmanager->executeHooks(
700 'printFieldListWhere',
708 $sql .= $hookmanager->resPrint;
711 $sql .=
" ORDER BY l.rang, p.ref, p.label";
713 $resql = $db->query(
$sql);
715 $num = $db->num_rows($resql);
719 print
'<tr class="liste_titre">';
721 print
'<td>'.$langs->trans(
"Description").
'</td>';
723 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
724 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
725 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
727 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
728 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
735 print
'<td class="right">'.$langs->trans(
"SupplierRef").
'</td>';
736 print
'<td class="right">'.$langs->trans(
"QtyOrdered").
'</td>';
737 print
'<td class="right">'.$langs->trans(
"QtyDispatchedShort").
'</td>';
738 print
' <td class="right">'.$langs->trans(
"QtyToDispatchShort");
739 print
'<br><a href="#" id="autoreset">'.img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').$langs->trans(
"Reset").
'</a></td>';
740 print
'<td width="32"></td>';
742 if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
743 if (!
isModEnabled(
"multicurrency") && empty($conf->dynamicprices->enabled)) {
744 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
745 print
'<td class="right">'.$langs->trans(
"ReductionShort").
' (%)</td>';
746 print
'<td class="right">'.$langs->trans(
"UpdatePrice").
'</td>';
750 print
'<td align="right">'.$langs->trans(
"Warehouse");
753 if (count($listwarehouses) > 1) {
754 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, $langs->trans(
"ForceTo"), 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
755 } elseif (count($listwarehouses) == 1) {
756 print
'<br>'.$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, $disabled,
'',
'minwidth100 maxwidth300', 1);
762 $parameters = array();
763 $reshook = $hookmanager->executeHooks(
764 'printFieldListTitle',
772 print $hookmanager->resPrint;
781 $conf->cache[
'product'] = array();
785 $objp = $db->fetch_object($resql);
788 if (!$objp->fk_product > 0) {
791 $alreadydispatched = isset($products_dispatched[$objp->rowid])?$products_dispatched[$objp->rowid]:0;
792 $remaintodispatch =
price2num($objp->qty - ((
float) $alreadydispatched), 5);
793 if ($remaintodispatch < 0 && empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN)) {
794 $remaintodispatch = 0;
797 if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) {
806 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
808 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$objp->qty.
'">';
809 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.(
float) $alreadydispatched.
'">';
810 print
'<tr class="oddeven">';
812 if (empty($conf->cache[
'product'][$objp->fk_product])) {
813 $tmpproduct =
new Product($db);
814 $tmpproduct->fetch($objp->fk_product);
815 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
817 $tmpproduct = $conf->cache[
'product'][$objp->fk_product];
820 $linktoprod = $tmpproduct->getNomUrl(1);
821 $linktoprod .=
' - '.$objp->label.
"\n";
824 if ($objp->tobatch) {
829 print
'<td class="dispatch_batch_number"></td>';
830 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
831 print
'<td class="dispatch_dlc"></td>';
833 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
834 print
'<td class="dispatch_dluo"></td>';
841 print
'<td class="dispatch_batch_number">';
842 print
'<span class="opacitymedium small">'.$langs->trans(
"ProductDoesNotUseBatchSerial").
'</small>';
844 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
845 print
'<td class="dispatch_dlc"></td>';
847 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
848 print
'<td class="dispatch_dluo"></td>';
852 print
'<td colspan="4">';
858 $up_ht_disc = $objp->subprice;
859 if (!empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) {
860 $up_ht_disc =
price2num($up_ht_disc * (100 - $objp->remise_percent) / 100,
'MU');
864 print
'<td class="right">'.$objp->sref.
'</td>';
867 print
'<td class="right">'.$objp->qty.
'</td>';
870 print
'<td class="right">'.$alreadydispatched.
'</td>';
872 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
874 print
'<td class="right">';
884 'is_information_row' =>
true,
889 $reshook = $hookmanager->executeHooks(
890 'printFieldListValue',
898 print $hookmanager->resPrint;
902 print
'<tr class="oddeven" name="'.$type.$suffix.
'">';
904 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
905 print
'<input name="product_batch'.$suffix.
'" type="hidden" value="'.$objp->fk_product.
'">';
907 print
'<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
908 if (!empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) {
909 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
911 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
917 print
'<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.
'" name="lot_number'.$suffix.
'" value="'.
GETPOST(
'lot_number'.$suffix).
'">';
919 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
920 print
'<td class="nowraponall">';
922 print
$form->selectDate($dlcdatesuffix,
'dlc'.$suffix,
'',
'', 1,
'');
925 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
926 print
'<td class="nowraponall">';
928 print
$form->selectDate($dluodatesuffix,
'dluo'.$suffix,
'',
'', 1,
'');
931 print
'<td colspan="3"> </td>';
935 $colspan = (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) ? --$colspan : $colspan;
936 $colspan = (!empty($conf->global->PRODUCT_DISABLE_EATBY)) ? --$colspan : $colspan;
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.
'">';
966 print
'<td colspan="'.$colspan.
'">';
967 print
'<input name="fk_commandefourndet'.$suffix.
'" type="hidden" value="'.$objp->rowid.
'">';
968 print
'<input name="product'.$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) -->';
971 if (!empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) {
972 print $langs->trans(
"BuyingPrice").
': <input class="maxwidth75" name="pu'.$suffix.
'" type="text" value="'.
price2num($up_ht_disc,
'MU').
'">';
974 print
'<input class="maxwidth75" name="pu'.$suffix.
'" type="hidden" value="'.
price2num($up_ht_disc,
'MU').
'">';
981 print
'<td class="right">';
982 print
'<a href="#" id="reset'.$suffix.
'" class="resetline">'.
img_picto($langs->trans(
"Reset"),
'eraser',
'class="pictofixedwidth opacitymedium"').
'</a>';
983 print
'<input id="qty'.$suffix.
'" name="qty'.$suffix.
'" type="text" class="width50 right qtydispatchinput" value="'.(
GETPOSTISSET(
'qty'.$suffix) ?
GETPOST(
'qty'.$suffix,
'int') : (empty($conf->global->SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO) ? $remaintodispatch : 0)).
'">';
987 if (
isModEnabled(
'productbatch') && $objp->tobatch > 0) {
989 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" onClick="addDispatchLine('.$i.
', \''.$type.
'\')
"');
992 print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton
" onClick="addDispatchLine(
'.$i.', \
''.$type.
'\')
"');
996 if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
997 if (!isModEnabled("multicurrency
") && empty($conf->dynamicprices->enabled)) {
999 print '<td class="right
">';
1000 print '<input id="pu
'.$suffix.'" name="pu
'.$suffix.'" type="text
" size="8
" value="'.price((GETPOST('pu
'.$suffix) != '' ? price2num(GETPOST('pu
'.$suffix)) : $up_ht_disc)).'">';
1004 print '<td class="right
">';
1005 print '<input id="dto
'.$suffix.'" name="dto
'.$suffix.'" type="text
" size="8
" value="'.(GETPOST('dto
'.$suffix) != '' ? GETPOST('dto
'.$suffix) : '').'">';
1009 print '<td class="center
">';
1010 print '<input class="flat checkformerge
" type="checkbox
" name="saveprice
'.$suffix.'" value="'.(GETPOST('saveprice
'.$suffix) != '' ? GETPOST('saveprice
'.$suffix) : '').'">';
1016 print '<td class="right
">';
1017 if (count($listwarehouses) > 1) {
1018 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, null, 'csswarehouse'.$suffix);
1019 } elseif (count($listwarehouses) == 1) {
1020 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, null, 'csswarehouse'.$suffix);
1022 $langs->load("errors
");
1023 print $langs->trans("ErrorNoWarehouseDefined
");
1027 // Enable hooks to append additional columns
1028 $parameters = array(
1029 'is_information_row' => false, // this is a dispatch form row
1031 'suffix' => $suffix,
1034 $reshook = $hookmanager->executeHooks(
1035 'printFieldListValue',
1041 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1043 print $hookmanager->resPrint;
1052 dol_print_error($db);
1059 $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically
", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
1061 print '<div class="center
">';
1062 $parameters = array();
1063 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1065 if (empty($reshook)) {
1066 if (empty($conf->reception->enabled)) {
1067 print $langs->trans("Comment").' : ';
1068 print '<input type="text
" class="minwidth400
" maxlength="128
" name="comment
" value="';
1069 print GETPOSTISSET("comment") ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
1070 // print ' /
'.$object->ref_supplier; // Not yet available
1071 print '" class="flat
"><br>';
1073 print '<input type="checkbox
" checked="checked
" name="closeopenorder
"> '.$checkboxlabel;
1076 $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive
") : $langs->trans("CreateReception
");
1079 print '<input type="hidden
" name="backtopageforcancel
" value="'.$_SERVER["PHP_SELF"].'?
id=
'.$object->id.'">';
1080 print '<input type="submit
" class="button" name="dispatch
" value="'.dol_escape_htmltag($dispatchBt).'"';
1082 if (!$permissiontoreceive) {
1085 if (count($listwarehouses) <= 0) {
1097 // Message if nothing to dispatch
1100 if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) {
1101 print '<div class="opacitymedium
">'.$langs->trans("NoPredefinedProductToDispatch
").'</div>'; // No predefined line at all
1103 print '<div class="opacitymedium
">'.$langs->trans("NoMorePredefinedProductToDispatch
").'</div>'; // No predefined line that remain to be dispatched.
1110 print dol_get_fiche_end();
1112 // traitement entrepot par défaut
1113 print '<script type="text/javascript
">
1114 $(document).ready(function () {
1115 $("select[
name=fk_default_warehouse]
").change(function() {
1116 var fk_default_warehouse = $("option:selected
", this).val();
1117 $("select[
name^=entrepot_]
").val(fk_default_warehouse).change();
1120 $("#autoreset
").click(function() {
1121 $(".qtydispatchinput
").each(function(){
1122 id = $(this).attr("id");
1123 idtab = id.split("_
");
1127 $("#qty_dispatched_0_
"+idtab[2]).val("0
");
1129 obj = $(this).parent().parent();
1130 nameobj = obj.attr("name");
1131 nametab = nameobj.split("_
");
1133 $("tr[
name^=\
'"+nametab[0]+"_\'][name$=\'_"+nametab[2]+"\']:last .splitbutton").show();
1138 $(".resetline").click(function(){
1139 id = $(this).attr("id");
1140 id = id.split("reset_");
1141 console.log("Reset trigger for id = qty_"+id[1]);
1142 $("#qty_"+id[1]).val("");
1148 $sql =
"SELECT p.rowid as pid, p.ref, p.label,";
1149 $sql .=
" e.rowid as warehouse_id, e.ref as entrepot,";
1150 $sql .=
" cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
1151 $sql .=
" ,cd.rowid, cd.subprice";
1152 if ($conf->reception->enabled) {
1153 $sql .=
" ,cfd.fk_reception, r.date_delivery";
1155 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p,";
1156 $sql .=
" ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as cfd";
1157 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet";
1158 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"entrepot as e ON cfd.fk_entrepot = e.rowid";
1159 if ($conf->reception->enabled) {
1160 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"reception as r ON cfd.fk_reception = r.rowid";
1162 $sql .=
" WHERE cfd.fk_commande = ".((int) $object->id);
1163 $sql .=
" AND cfd.fk_product = p.rowid";
1164 $sql .=
" ORDER BY cfd.rowid ASC";
1166 $resql = $db->query(
$sql);
1168 $num = $db->num_rows($resql);
1176 print
'<div class="div-table-responsive">';
1177 print
'<table id="dispatch_received_products" class="noborder centpercent">';
1179 print
'<tr class="liste_titre">';
1181 if ($conf->reception->enabled) {
1182 print
'<td>'.$langs->trans(
"Reception").
'</td>';
1185 print
'<td>'.$langs->trans(
"Product").
'</td>';
1186 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
1187 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1189 print
'<td class="dispatch_batch_number_title">'.$langs->trans(
"batch_number").
'</td>';
1190 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1191 print
'<td class="dispatch_dlc_title">'.$langs->trans(
"SellByDate").
'</td>';
1193 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1194 print
'<td class="dispatch_dluo_title">'.$langs->trans(
"EatByDate").
'</td>';
1197 print
'<td class="right">'.$langs->trans(
"QtyDispatched").
'</td>';
1198 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
1199 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1202 if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && empty($reception->rowid)) {
1203 print
'<td class="center" colspan="2">'.$langs->trans(
"Status").
'</td>';
1205 print
'<td class="center"></td>';
1208 print
'<td class="center" colspan="2"></td>';
1214 $objp = $db->fetch_object($resql);
1216 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1217 print
'<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'#line_'.
GETPOST(
'lineid',
'int').
'" method="POST">
1218 <input type="hidden" name="token" value="'.
newToken().
'">
1219 <input type="hidden" name="action" value="updateline">
1220 <input type="hidden" name="mode" value="">
1221 <input type="hidden" name="lineid" value="'.$objp->dispatchlineid.
'">';
1224 print
'<tr class="oddeven" id="line_'.$objp->dispatchlineid.
'" >';
1228 print
'<td class="nowraponall">';
1229 if (!empty($objp->fk_reception)) {
1231 $reception->fetch($objp->fk_reception);
1232 print $reception->getNomUrl(1);
1239 print
'<td class="tdoverflowmax150">';
1240 if (empty($conf->cache[
'product'][$objp->fk_product])) {
1241 $tmpproduct =
new Product($db);
1242 $tmpproduct->fetch($objp->fk_product);
1243 $conf->cache[
'product'][$objp->fk_product] = $tmpproduct;
1245 $tmpproduct = $conf->cache[
'product'][$objp->fk_product];
1247 print $tmpproduct->getNomUrl(1);
1248 print
' - '.$objp->label;
1252 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'day').
'</td>';
1255 print
'<td class="center">'.dol_print_date($db->jdate($objp->date_delivery),
'day').
'</td>';
1260 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1262 $lot->fetch(0, $objp->pid, $objp->batch);
1263 print
'<td class="dispatch_batch_number">'.$lot->getNomUrl(1).
'</td>';
1264 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1265 print
'<td class="dispatch_dlc">'.dol_print_date($lot->sellby,
'day').
'</td>';
1267 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1268 print
'<td class="dispatch_dluo">'.dol_print_date($lot->eatby,
'day').
'</td>';
1271 print
'<td class="dispatch_batch_number"></td>';
1272 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1273 print
'<td class="dispatch_dlc"></td>';
1275 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1276 print
'<td class="dispatch_dluo"></td>';
1282 print
'<td class="right">';
1283 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1284 print
'<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.
'" />';
1288 print
'<input type="hidden" name="price" value="'.$objp->subprice.
'" />';
1292 print
'<td class="tdoverflowmax150">';
1293 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
1294 if (count($listwarehouses) > 1) {
1295 print $formproduct->selectWarehouses(
GETPOST(
"fk_entrepot") ?
GETPOST(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
''),
"fk_entrepot",
'', 1, 0, $objp->fk_product,
'', 1, 1,
null,
'csswarehouse');
1296 } elseif (count($listwarehouses) == 1) {
1297 print $formproduct->selectWarehouses(
GETPOST(
"fk_entrepot") ?
GETPOST(
"fk_entrepot") : ($objp->warehouse_id ? $objp->warehouse_id :
''),
"fk_entrepot",
'', 0, 0, $objp->fk_product,
'', 1, 1,
null,
'csswarehouse');
1299 $langs->load(
"errors");
1300 print $langs->trans(
"ErrorNoWarehouseDefined");
1303 $warehouse_static->id = $objp->warehouse_id;
1304 $warehouse_static->label = $objp->entrepot;
1305 print $warehouse_static->getNomUrl(1);
1310 print
'<td class="tdoverflowmax300" style="white-space: pre;">'.$objp->comment.
'</td>';
1313 if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && empty($reception->rowid)) {
1314 print
'<td class="right">';
1315 $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status);
1317 print $supplierorderdispatch->getLibStatut(5);
1321 print
'<td class="center">';
1322 if (!$permissiontocontrol) {
1323 if (empty($objp->status)) {
1324 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Approve").
'</a>';
1325 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1327 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Disapprove").
'</a>';
1328 print
'<a class="button buttonRefused" href="#">'.$langs->trans(
"Deny").
'</a>';
1332 if ($object->statut == 5) {
1335 if (empty($objp->status)) {
1336 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$id.
"&action=checkdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1337 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$id.
"&action=denydispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1339 if ($objp->status == 1) {
1340 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$id.
"&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1341 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$id.
"&action=denydispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Deny").
'</a>';
1343 if ($objp->status == 2) {
1344 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$id.
"&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Reinit").
'</a>';
1345 print
'<a class="button'.($disabled ?
' buttonRefused' :
'').
'" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$id.
"&action=checkdispatchline&lineid=".$objp->dispatchlineid.
'">'.$langs->trans(
"Approve").
'</a>';
1350 print
'<td class="right">';
1351 if (!empty($reception->id)) {
1352 print $reception->getLibStatut(5);
1358 if ($action !=
'editline' || $lineid != $objp->dispatchlineid) {
1359 if (empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) {
1360 print
'<td class="linecoledit center">';
1361 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#line_'.$objp->dispatchlineid.
'">';
1366 print
'<td class="linecoldelete center">';
1367 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteline&token='.
newToken().
'&lineid='.$objp->dispatchlineid.
'#dispatch_received_products">';
1372 print
'<td></td><td></td>';
1375 print
'<td class="center valignmiddle">';
1376 print
'<input type="submit" class="button button-save" id="savelinebutton" name="save" value="'.$langs->trans(
"Save").
'" />';
1378 print
'<td class="center valignmiddle">';
1379 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'" />';
1385 if ($action ==
'editline' && $lineid == $objp->dispatchlineid) {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage table commandefournisseurdispatch.
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.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
ordersupplier_prepare_head(CommandeFournisseur $object)
Prepare array with list of tabs.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$formconfirm
if ($action == 'delbookkeepingyear') {
table tableforfield button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
div float
Buy price without taxes.
$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.