34require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT .
'/product/class/product.class.php';
43require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT .
'/core/class/html.form.class.php';
45require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.commande.class.php';
46require_once DOL_DOCUMENT_ROOT .
'/product/class/html.formproduct.class.php';
47require_once
'./lib/replenishment.lib.php';
50$langs->loadLangs(array(
'products',
'stocks',
'orders'));
54 $socid = $user->socid;
58$hookmanager->initHooks(array(
'stockreplenishlist'));
62$action =
GETPOST(
'action',
'aZ09');
63$search_ref =
GETPOST(
'search_ref',
'alpha');
64$search_label =
GETPOST(
'search_label',
'alpha');
65$sall = trim(
GETPOST(
'search_all',
'alphanohtml'));
68$salert =
GETPOST(
'salert',
'alpha');
69$includeproductswithoutdesiredqty =
GETPOST(
'includeproductswithoutdesiredqty',
'alpha');
70$mode =
GETPOST(
'mode',
'alpha');
71$draftorder =
GETPOST(
'draftorder',
'alpha');
79$resWar = $db->query(
"SELECT rowid FROM " . MAIN_DB_PREFIX .
"entrepot WHERE entity IN (" . $db->sanitize(
getEntity(
'stock')) .
")");
80$listofqualifiedwarehousesid =
"";
83while ($tmpobj = $db->fetch_object($resWar)) {
84 if (!empty($listofqualifiedwarehousesid)) {
85 $listofqualifiedwarehousesid .=
",";
87 $listofqualifiedwarehousesid .= $tmpobj->rowid;
88 $lastWarehouseID = (int) $tmpobj->rowid;
93if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) &&
getDolGlobalString(
'MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
94 $fk_entrepot = $lastWarehouseID;
98 $fk_entrepot = $user->fk_warehouse;
103$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
104$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
106if (empty($page) || $page == -1) {
110$offset = $limit * $page;
113 $sortfield =
'p.ref';
121$virtualdiffersfromphysical = 0;
128 $virtualdiffersfromphysical = 1;
131if ($virtualdiffersfromphysical) {
132 $usevirtualstock =
getDolGlobalString(
'STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT') ? 0 : 1;
134 $usevirtualstock = 0;
136if ($mode ==
'physical') {
137 $usevirtualstock = 0;
139if ($mode ==
'virtual') {
140 $usevirtualstock = 1;
148if (!$user->hasRight(
'stock',
'read')) {
149 accessforbidden(
"You need permission to read stock to access this feature");
159$parameters = array();
160$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
162 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
165if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
170 $includeproductswithoutdesiredqty =
'';
174if ($draftorder ==
'on') {
175 $draftchecked =
"checked";
179if ($action ==
'order' &&
GETPOST(
'valid') && $user->hasRight(
'fournisseur',
'commande',
'creer')) {
183 unset($_POST[
'linecount']);
184 if ($linecount > 0) {
187 $suppliers = array();
188 require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.product.class.php';
190 for ($i = 0; $i < $linecount; $i++) {
203 if ($tmpprodfourn->fetch_product_fournisseur_price($supplierpriceid) > 0) {
204 $idprod = $productsupplier->get_buyprice($supplierpriceid, $qty, $tmpprodfourn->product_id,
'none', $tmpprodfourn->fourn_id);
206 $idprod = $productsupplier->get_buyprice($supplierpriceid, $qty);
209 $res = $productsupplier->fetch($idprod);
210 if ($res && $idprod > 0 && $fk_supplier > 0 && (
int) $productsupplier->fourn_socid !== (
int) $fk_supplier) {
212 dol_syslog(
"replenish.php: get_buyprice returned fourn_socid=".$productsupplier->fourn_socid.
" for fk_product=".$idprod.
" instead of expected fk_supplier=".$fk_supplier.
" (line $i, product_fournisseur_price id $supplierpriceid, qty $qty)", LOG_WARNING);
214 } elseif ($res && $idprod > 0) {
219 $line->fk_product = $idprod;
224 $productsupplier->getMultiLangs();
228 if (!empty($productsupplier->desc_supplier) &&
getDolGlobalString(
'PRODUIT_FOURN_TEXTS')) {
229 $desc = $productsupplier->desc_supplier;
231 $desc = $productsupplier->description;
238 $line->tva_tx = $productsupplier->vatrate_supplier;
239 $tva = $line->tva_tx / 100;
242 if (
isModEnabled(
'multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code !=
$conf->currency) {
243 $line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
244 $line->fk_multicurrency = (int) $productsupplier->fourn_multicurrency_id;
245 $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice;
246 $line->multicurrency_total_ht = $line->multicurrency_subprice * $qty;
247 $line->multicurrency_total_tva = $line->multicurrency_total_ht * $tva;
248 $line->multicurrency_total_ttc = $line->multicurrency_total_ht + $line->multicurrency_total_tva;
250 $line->subprice = $productsupplier->fourn_pu;
251 $line->total_ht = $productsupplier->fourn_pu * $qty;
252 $line->total_tva = $line->total_ht * $tva;
253 $line->total_ttc = $line->total_ht + $line->total_tva;
254 $line->remise_percent = (float) $productsupplier->remise_percent;
255 $line->ref_fourn = $productsupplier->ref_supplier;
256 $line->ref_supplier = $productsupplier->ref_supplier;
257 $line->type = $productsupplier->type;
258 $line->fk_unit = $productsupplier->fk_unit;
260 $suppliers[$productsupplier->fourn_socid][
'lines'][] = $line;
262 } elseif ($idprod == -1) {
265 $error = $db->lasterror();
266 dol_print_error($db);
269 unset($_POST[
'fourn' . $i]);
279 $suppliersid = array_keys($suppliers);
280 foreach ($suppliers as $supplier) {
284 $sql =
"SELECT rowid FROM " . MAIN_DB_PREFIX .
"commande_fournisseur";
285 $sql .=
" WHERE fk_soc = " . ((int) $suppliersid[$i]);
286 $sql .=
" AND source = " . ((int) $order::SOURCE_ID_REPLENISHMENT) .
" AND fk_statut = " . ((int) $order::STATUS_DRAFT);
287 $sql .=
" AND entity IN (" .
getEntity(
'commande_fournisseur') .
")";
288 $sql .=
" ORDER BY date_creation DESC";
289 $resql = $db->query($sql);
290 if ($resql && $db->num_rows($resql) > 0) {
291 $obj = $db->fetch_object($resql);
293 $order->fetch($obj->rowid);
294 $order->fetch_thirdparty();
297 foreach ($supplier[
'lines'] as $line) {
298 if (empty($line->remise_percent)) {
299 $line->remise_percent = (float) $order->thirdparty->remise_supplier_percent;
301 $result = $order->addline(
311 $line->remise_percent,
321 $line->multicurrency_subprice
329 $msg = $langs->trans(
'OrderFail') .
" : ";
330 $msg .= $order->error;
331 setEventMessages($msg,
null,
'errors');
337 $order->socid = $suppliersid[$i];
338 $order->fetch_thirdparty();
339 $order->multicurrency_code = $order->thirdparty->multicurrency_code;
342 $order->source = $order::SOURCE_ID_REPLENISHMENT;
344 foreach ($supplier[
'lines'] as $line) {
345 if (empty($line->remise_percent)) {
346 $line->remise_percent = (float) $order->thirdparty->remise_supplier_percent;
348 $order->lines[] = $line;
350 $order->cond_reglement_id = (int) $order->thirdparty->cond_reglement_supplier_id;
351 $order->mode_reglement_id = (int) $order->thirdparty->mode_reglement_supplier_id;
353 $id = $order->create($user);
356 $msg = $langs->trans(
'OrderFail') .
" : ";
357 $msg .= $order->error;
358 setEventMessages($msg,
null,
'errors');
365 setEventMessages($langs->trans(
'ErrorOrdersNotCreatedQtyTooLow'),
null,
'warnings');
371 setEventMessages($langs->trans(
'OrderCreated'),
null,
'mesgs');
372 header(
'Location: replenishorders.php');
379 setEventMessages($langs->trans(
'SelectProductWithNotNullQty'),
null,
'warnings');
388$form =
new Form($db);
392$title = $langs->trans(
'MissingStocks');
394if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
395 $sqldesiredstock = $db->ifsql(
"pse.desiredstock IS NULL",
"p.desiredstock",
"pse.desiredstock");
396 $sqlalertstock = $db->ifsql(
"pse.seuil_stock_alerte IS NULL",
"p.seuil_stock_alerte",
"pse.seuil_stock_alerte");
398 $sqldesiredstock =
'p.desiredstock';
399 $sqlalertstock =
'p.seuil_stock_alerte';
402$sql =
'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
403$sql .=
' p.price_ttc, p.price_base_type, p.fk_product_type,';
404$sql .=
' p.tms as datem, p.duration, p.tobuy,';
405$sql .=
' p.desiredstock, p.seuil_stock_alerte,';
406if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
407 $sql .=
' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,';
409$sql .=
" " . $sqldesiredstock .
" as desiredstockcombined, " . $sqlalertstock .
" as seuil_stock_alertecombined,";
410$sql .=
' s.fk_product,';
411$sql .=
" SUM(".$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel").
') as stock_physique';
412if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
413 $sql .=
", SUM(".$db->ifsql(
"s.reel IS NULL OR s.fk_entrepot <> ".((
int) $fk_entrepot),
"0",
"s.reel").
') as stock_real_warehouse';
417$parameters = array();
418$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
419$sql .= $hookmanager->resPrint;
421$list_warehouse = (empty($listofqualifiedwarehousesid) ?
'0' : $listofqualifiedwarehousesid);
423$sql .=
' FROM ' . MAIN_DB_PREFIX .
'product as p';
424$sql .=
' LEFT JOIN ' . MAIN_DB_PREFIX .
'product_stock as s ON p.rowid = s.fk_product';
425$sql .=
' AND s.fk_entrepot IN (' . $db->sanitize($list_warehouse) .
')';
427$list_warehouse_selected = ($fk_entrepot < 0 || empty($fk_entrepot)) ? $list_warehouse : $fk_entrepot;
428$sql .=
' AND s.fk_entrepot IN (' . $db->sanitize($list_warehouse_selected) .
')';
432if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
433 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).
')';
436$parameters = array();
437$reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters);
438$sql .= $hookmanager->resPrint;
440$sql .=
' WHERE p.entity IN (' .
getEntity(
'product') .
')';
442 $sql .=
natural_search(array(
'p.ref',
'p.label',
'p.description',
'p.note'), $sall);
447 $sql .=
' AND p.fk_product_type = 1';
449 $sql .=
' AND p.fk_product_type <> 1';
458$sql .=
' AND p.tobuy = 1';
460 $sql .=
' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.
'product_attribute_combination as pac WHERE pac.entity IN ('.
getEntity(
'product').
'))';
462if ($fk_supplier > 0) {
463 $sql .=
' AND EXISTS (SELECT pfp.rowid FROM ' . MAIN_DB_PREFIX .
'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = ' . ((int) $fk_supplier) .
' AND pfp.entity IN (' .
getEntity(
'productsupplierprice') .
'))';
466$parameters = array();
467$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
468$sql .= $hookmanager->resPrint;
470$sql .=
' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
471$sql .=
', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
472$sql .=
', p.duration, p.tobuy';
473$sql .=
', p.desiredstock';
474$sql .=
', p.seuil_stock_alerte';
475if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
476 $sql .=
', pse.desiredstock';
477 $sql .=
', pse.seuil_stock_alerte';
479$sql .=
', s.fk_product';
481if ($usevirtualstock) {
483 $sqlCommandesCli =
"(SELECT ".$db->ifsql(
"SUM(cd1.qty) IS NULL",
"0",
"SUM(cd1.qty)").
" as qty";
484 $sqlCommandesCli .=
" FROM ".MAIN_DB_PREFIX.
"commandedet as cd1, ".MAIN_DB_PREFIX.
"commande as c1";
485 $sqlCommandesCli .=
" WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'commande').
")";
486 $sqlCommandesCli .=
" AND cd1.fk_product = p.rowid";
487 $sqlCommandesCli .=
" AND c1.fk_statut IN (1,2))";
489 $sqlCommandesCli =
'0';
493 $sqlExpeditionsCli =
"(SELECT ".$db->ifsql(
"SUM(ed2.qty) IS NULL",
"0",
"SUM(ed2.qty)").
" as qty";
494 $sqlExpeditionsCli .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e2,";
495 $sqlExpeditionsCli .=
" ".MAIN_DB_PREFIX.
"expeditiondet as ed2,";
496 $sqlExpeditionsCli .=
" ".MAIN_DB_PREFIX.
"commande as c2,";
497 $sqlExpeditionsCli .=
" ".MAIN_DB_PREFIX.
"commandedet as cd2";
498 $sqlExpeditionsCli .=
" WHERE ed2.fk_expedition = e2.rowid AND cd2.rowid = ed2.fk_elementdet AND e2.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'expedition').
")";
499 $sqlExpeditionsCli .=
" AND cd2.fk_commande = c2.rowid";
500 $sqlExpeditionsCli .=
" AND c2.fk_statut IN (1,2)";
501 $sqlExpeditionsCli .=
" AND cd2.fk_product = p.rowid";
502 $sqlExpeditionsCli .=
" AND e2.fk_statut IN (1,2))";
504 $sqlExpeditionsCli =
'0';
508 $sqlCommandesFourn =
"(SELECT " . $db->ifsql(
"SUM(cd3.qty) IS NULL",
"0",
"SUM(cd3.qty)") .
" as qty";
509 $sqlCommandesFourn .=
" FROM " . MAIN_DB_PREFIX .
"commande_fournisseurdet as cd3,";
510 $sqlCommandesFourn .=
" " . MAIN_DB_PREFIX .
"commande_fournisseur as c3";
511 $sqlCommandesFourn .=
" WHERE c3.rowid = cd3.fk_commande";
512 $sqlCommandesFourn .=
" AND c3.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'supplier_order').
")";
513 $sqlCommandesFourn .=
" AND cd3.fk_product = p.rowid";
514 $sqlCommandesFourn .=
" AND c3.fk_statut IN (3,4))";
516 $sqlReceptionFourn =
"(SELECT ".$db->ifsql(
"SUM(fd4.qty) IS NULL",
"0",
"SUM(fd4.qty)").
" as qty";
517 $sqlReceptionFourn .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf4,";
518 $sqlReceptionFourn .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as fd4";
519 $sqlReceptionFourn .=
" WHERE fd4.fk_element = cf4.rowid AND cf4.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'supplier_order').
")";
520 $sqlReceptionFourn .=
" AND fd4.fk_product = p.rowid";
521 $sqlReceptionFourn .=
" AND cf4.fk_statut IN (3,4))";
523 $sqlCommandesFourn =
'0';
524 $sqlReceptionFourn =
'0';
528 $sqlProductionToConsume =
"(SELECT GREATEST(0, ".$db->ifsql(
"SUM(".$db->ifsql(
"mp5.role = 'toconsume'",
'mp5.qty',
'- mp5.qty').
") IS NULL",
"0",
"SUM(".$db->ifsql(
"mp5.role = 'toconsume'",
'mp5.qty',
'- mp5.qty').
")").
") as qty";
529 $sqlProductionToConsume .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as mm5,";
530 $sqlProductionToConsume .=
" ".MAIN_DB_PREFIX.
"mrp_production as mp5";
531 $sqlProductionToConsume .=
" WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'mo').
")";
532 $sqlProductionToConsume .=
" AND mp5.fk_product = p.rowid";
533 $sqlProductionToConsume .=
" AND mp5.role IN ('toconsume', 'consumed')";
534 $sqlProductionToConsume .=
" AND mm5.status IN (1,2))";
536 $sqlProductionToProduce =
"(SELECT GREATEST(0, ".$db->ifsql(
"SUM(".$db->ifsql(
"mp5.role = 'toproduce'",
'mp5.qty',
'- mp5.qty').
") IS NULL",
"0",
"SUM(".$db->ifsql(
"mp5.role = 'toproduce'",
'mp5.qty',
'- mp5.qty').
")").
") as qty";
537 $sqlProductionToProduce .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as mm5,";
538 $sqlProductionToProduce .=
" ".MAIN_DB_PREFIX.
"mrp_production as mp5";
539 $sqlProductionToProduce .=
" WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'mo').
")";
540 $sqlProductionToProduce .=
" AND mp5.fk_product = p.rowid";
541 $sqlProductionToProduce .=
" AND mp5.role IN ('toproduce', 'produced')";
542 $sqlProductionToProduce .=
" AND mm5.status IN (1,2))";
544 $sqlProductionToConsume =
'0';
545 $sqlProductionToProduce =
'0';
548 $parameters = array();
549 $sqlHookVirtualStock =
"0";
550 $reshook = $hookmanager->executeHooks(
'printFieldListHavingVirtualStock', $parameters);
551 if (!empty($hookmanager->resPrint)) {
552 $sqlHookVirtualStock = $hookmanager->resPrint;
556 $sql .=
" (" . $sqldesiredstock .
" >= 0 AND (" . $sqldesiredstock .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')';
557 $sql .=
" - (" . $sqlCommandesCli .
" - " . $sqlExpeditionsCli .
") + (" . $sqlCommandesFourn .
" - " . $sqlReceptionFourn .
") + (" . $sqlProductionToProduce .
" - " . $sqlProductionToConsume .
") + ".$sqlHookVirtualStock.
"))";
559 if ($includeproductswithoutdesiredqty ==
'on') {
560 $sql .=
" ((" . $sqlalertstock .
" >= 0 OR " . $sqlalertstock .
" IS NULL) AND (" . $db->ifsql($sqlalertstock .
" IS NULL",
"0", $sqlalertstock) .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
")";
562 $sql .=
" (" . $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')';
564 $sql .=
" - (" . $sqlCommandesCli .
" - " . $sqlExpeditionsCli .
") + (" . $sqlCommandesFourn .
" - " . $sqlReceptionFourn .
") + (" . $sqlProductionToProduce .
" - " . $sqlProductionToConsume .
") + ".$sqlHookVirtualStock.
"))";
566 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
568 $sql .=
" pse.desiredstock > 0)";
571 if ($salert ==
'on') {
573 if ($includeproductswithoutdesiredqty ==
'on') {
574 $sql .=
"(" . $sqlalertstock .
" >= 0 OR " . $sqlalertstock .
" IS NULL) AND (" . $db->ifsql($sqlalertstock .
" IS NULL",
"0", $sqlalertstock) .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
")";
576 $sql .= $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
")";
578 $sql .=
" - (" . $sqlCommandesCli .
" - " . $sqlExpeditionsCli .
") + (" . $sqlCommandesFourn .
" - " . $sqlReceptionFourn .
") + (" . $sqlProductionToProduce .
" - " . $sqlProductionToConsume .
") + ".$sqlHookVirtualStock.
")";
580 $alertchecked =
'checked';
584 $sql .=
"(" . $sqldesiredstock .
" >= 0 AND (" . $sqldesiredstock .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
")))";
586 if ($includeproductswithoutdesiredqty ==
'on') {
587 $sql .=
" ((" . $sqlalertstock .
" >= 0 OR " . $sqlalertstock .
" IS NULL) AND (" . $db->ifsql($sqlalertstock .
" IS NULL",
"0", $sqlalertstock) .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')))';
589 $sql .=
" (" . $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')))';
592 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
594 $sql .=
" pse.desiredstock > 0)";
597 if ($salert ==
'on') {
599 if ($includeproductswithoutdesiredqty ==
'on') {
600 $sql .=
" (" . $sqlalertstock .
" >= 0 OR " . $sqlalertstock .
" IS NULL) AND (" . $db->ifsql($sqlalertstock .
" IS NULL",
"0", $sqlalertstock) .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
"))";
602 $sql .=
" " . $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" . $db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
'))';
605 $alertchecked =
'checked';
609$includeproductswithoutdesiredqtychecked =
'';
610if ($includeproductswithoutdesiredqty ==
'on') {
611 $includeproductswithoutdesiredqtychecked =
'checked';
614$nbtotalofrecords =
'';
616 $result = $db->query($sql);
617 $nbtotalofrecords = $db->num_rows($result);
618 if (($page * $limit) > (
int) $nbtotalofrecords) {
624$sql .= $db->order($sortfield, $sortorder);
625$sql .= $db->plimit($limit + 1, $offset);
628$resql = $db->query($sql);
630 dol_print_error($db);
634$num = $db->num_rows($resql);
637$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|';
638$helpurl .=
'ES:Módulo_Stocks';
640llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_replenish');
644$head[0][0] = DOL_URL_ROOT .
'/product/stock/replenish.php';
646$head[0][2] =
'replenish';
648$head[1][0] = DOL_URL_ROOT .
'/product/stock/replenishorders.php';
649$head[1][1] = $langs->trans(
"ReplenishmentOrders");
650$head[1][2] =
'replenishorders';
657print
'<span class="opacitymedium">' . $langs->trans(
"ReplenishmentStatusDesc") .
'</span>' .
"\n";
661if (empty($fk_entrepot) &&
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) {
662 print
'<span class="opacitymedium">'.$langs->trans(
"ReplenishmentStatusDescPerWarehouse").
'</span>'.
"\n";
665if ($usevirtualstock == 1) {
666 print $langs->trans(
"CurentSelectionMode") .
': ';
667 print
'<span class="a-mesure">' . $langs->trans(
"UseVirtualStock") .
'</span>';
668 print
' <a class="a-mesure-disabled" href="' . $_SERVER[
"PHP_SELF"] .
'?mode=physical' . ($fk_supplier > 0 ?
'&fk_supplier=' . $fk_supplier :
'') . ($fk_entrepot > 0 ?
'&fk_entrepot=' . $fk_entrepot :
'') .
'">' . $langs->trans(
"UsePhysicalStock") .
'</a>';
671if ($usevirtualstock == 0) {
672 print $langs->trans(
"CurentSelectionMode") .
': ';
673 print
'<a class="a-mesure-disabled" href="' . $_SERVER[
"PHP_SELF"] .
'?mode=virtual' . ($fk_supplier > 0 ?
'&fk_supplier=' . $fk_supplier :
'') . ($fk_entrepot > 0 ?
'&fk_entrepot=' . $fk_entrepot :
'') .
'">' . $langs->trans(
"UseVirtualStock") .
'</a>';
674 print
' <span class="a-mesure">' . $langs->trans(
"UsePhysicalStock") .
'</span>';
679print
'<form name="formFilterWarehouse" method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
680print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
681print
'<input type="hidden" name="action" value="filter">';
682print
'<input type="hidden" name="search_ref" value="' . $search_ref .
'">';
683print
'<input type="hidden" name="search_label" value="' . $search_label .
'">';
684print
'<input type="hidden" name="salert" value="' . $salert .
'">';
685print
'<input type="hidden" name="includeproductswithoutdesiredqty" value="' . $includeproductswithoutdesiredqty .
'">';
686print
'<input type="hidden" name="draftorder" value="' . $draftorder .
'">';
687print
'<input type="hidden" name="mode" value="' . $mode .
'">';
688if ($limit > 0 && $limit !=
$conf->liste_limit) {
689 print
'<input type="hidden" name="limit" value="' . $limit .
'">';
692 print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
693 print $langs->trans(
'Warehouse') .
' ' . $formproduct->selectWarehouses((
int) $fk_entrepot,
'fk_entrepot',
'', 1);
696print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
697$filter =
'(fournisseur:=:1)';
698print $langs->trans(
'Supplier') .
' ' . $form->select_company($fk_supplier,
'fk_supplier', $filter, 1);
701$parameters = array();
702$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
703if (empty($reshook)) {
704 print $hookmanager->resPrint;
707print
'<div class="inline-block valignmiddle">';
708print
'<input type="submit" class="button smallpaddingimp" name="valid" value="' . $langs->trans(
'ToFilter') .
'">';
713print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" name="formulaire">';
714print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
715print
'<input type="hidden" name="fk_supplier" value="' . $fk_supplier .
'">';
716print
'<input type="hidden" name="fk_entrepot" value="' . $fk_entrepot .
'">';
717print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
718print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
719print
'<input type="hidden" name="type" value="' . $type .
'">';
720print
'<input type="hidden" name="linecount" value="' . $num .
'">';
721print
'<input type="hidden" name="action" value="order">';
722print
'<input type="hidden" name="mode" value="' . $mode .
'">';
725if ($search_ref || $search_label || $sall || $salert || $draftorder ||
GETPOST(
'search',
'alpha')) {
726 $filters =
'&search_ref=' . urlencode($search_ref) .
'&search_label=' . urlencode($search_label);
727 $filters .=
'&sall=' . urlencode($sall);
728 $filters .=
'&salert=' . urlencode($salert);
729 $filters .=
'&draftorder=' . urlencode($draftorder);
730 $filters .=
'&mode=' . urlencode($mode);
731 if ($fk_supplier > 0) {
732 $filters .=
'&fk_supplier='.urlencode((
string) ($fk_supplier));
734 if ($fk_entrepot > 0) {
735 $filters .=
'&fk_entrepot='.urlencode((
string) ($fk_entrepot));
738 $filters =
'&search_ref='.urlencode($search_ref).
'&search_label='.urlencode($search_label);
739 $filters .=
'&fourn_id='.urlencode((
string) ($fourn_id));
740 $filters .= (isset($type) ?
'&type='.urlencode((
string) ($type)) :
'');
741 $filters .=
'&salert='.urlencode($salert);
742 $filters .=
'&draftorder='.urlencode($draftorder);
743 $filters .=
'&mode='.urlencode($mode);
744 if ($fk_supplier > 0) {
745 $filters .=
'&fk_supplier='.urlencode((
string) ($fk_supplier));
747 if ($fk_entrepot > 0) {
748 $filters .=
'&fk_entrepot='.urlencode((
string) ($fk_entrepot));
751if ($limit > 0 && $limit !=
$conf->liste_limit) {
752 $filters .=
'&limit=' . ((int) $limit);
754if (!empty($includeproductswithoutdesiredqty)) {
755 $filters .=
'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
757if (!empty($salert)) {
758 $filters .=
'&salert='.urlencode($salert);
761$param = (isset($type) ?
'&type='.urlencode((
string) ($type)) :
'');
762$param .=
'&fourn_id='.urlencode((
string) ($fourn_id)).
'&search_label='.urlencode((
string) ($search_label)).
'&includeproductswithoutdesiredqty='.urlencode((
string) ($includeproductswithoutdesiredqty)).
'&salert='.urlencode((
string) ($salert)).
'&draftorder='.urlencode((
string) ($draftorder));
763$param .=
'&search_ref='.urlencode($search_ref);
764$param .=
'&mode='.urlencode($mode);
765$param .=
'&fk_supplier='.urlencode((
string) ($fk_supplier));
766$param .=
'&fk_entrepot='.urlencode((
string) ($fk_entrepot));
767if (!empty($includeproductswithoutdesiredqty)) {
768 $param .=
'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
770if (!empty($salert)) {
771 $param .=
'&salert='.urlencode($salert);
774$stocklabel = $langs->trans(
'Stock');
775$stocklabelbis = $langs->trans(
'Stock');
777if ($usevirtualstock == 1) {
778 $stocklabel = $langs->trans(
'VirtualStock');
779 $stocktooltip = $langs->trans(
"VirtualStockDesc");
781if ($usevirtualstock == 0) {
782 $stocklabel = $langs->trans(
'PhysicalStock');
784if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
785 $stocklabelbis = $stocklabel.
' ('.$langs->trans(
'SelectedWarehouse').
')';
786 $stocklabel .=
' ('.$langs->trans(
"AllWarehouses").
')';
788$texte = $langs->trans(
'Replenishment');
826print
'<div class="div-table-responsive-no-min">';
827print
'<table class="liste centpercent">';
830print
'<tr class="liste_titre_filter">';
831print
'<td class="liste_titre"> </td>';
832print
'<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="' .
dol_escape_htmltag($search_ref) .
'"></td>';
833print
'<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="' .
dol_escape_htmltag($search_label) .
'"></td>';
835 print
'<td class="liste_titre"> </td>';
837print
'<td class="liste_titre right">' . $form->textwithpicto($langs->trans(
'IncludeEmptyDesiredStock'), $langs->trans(
'IncludeProductWithUndefinedAlerts')) .
' <input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" ' . (!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked :
'') .
'></td>';
838print
'<td class="liste_titre right"></td>';
839print
'<td class="liste_titre right">'.$langs->trans(
'AlertOnly').
' <input type="checkbox" id="salert" name="salert" '.(!empty($alertchecked) ? $alertchecked :
'').
'></td>';
840if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
841 print
'<td class="liste_titre"> </td>';
843print
'<td class="liste_titre right">';
845 print $langs->trans(
'IncludeAlsoDraftOrders').
' <input type="checkbox" id="draftorder" name="draftorder" '.(!empty($draftchecked) ? $draftchecked :
'').
'>';
848print
'<td class="liste_titre"> </td>';
850$parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
851$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
852print $hookmanager->resPrint;
854print
'<td class="liste_titre maxwidthsearch right">';
855$searchpicto = $form->showFilterAndCheckAddButtons(0);
861print
'<tr class="liste_titre">';
866 print_liste_field_titre(
'Duration', $_SERVER[
"PHP_SELF"],
'p.duration',
'', $param,
'', $sortfield, $sortorder,
'center ');
868print_liste_field_titre(
'DesiredStock', $_SERVER[
"PHP_SELF"],
'p.desiredstock',
'', $param,
'', $sortfield, $sortorder,
'right ');
869print_liste_field_titre(
'StockLimitShort', $_SERVER[
"PHP_SELF"],
'p.seuil_stock_alerte',
'', $param,
'', $sortfield, $sortorder,
'right ');
870print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'stock_physique',
'', $param,
'', $sortfield, $sortorder,
'right ', $stocktooltip);
871if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
872 print_liste_field_titre($stocklabelbis, $_SERVER[
"PHP_SELF"],
'stock_real_warehouse',
'', $param,
'', $sortfield, $sortorder,
'right ');
875print_liste_field_titre(
'StockToBuy', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
876print_liste_field_titre(
'SupplierRef', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
879$parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
880$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
881print $hookmanager->resPrint;
885while ($i < ($limit ? min($num, $limit) : $num)) {
886 $objp = $db->fetch_object($resql);
889 $result =
$prod->fetch($objp->rowid);
891 dol_print_error($db);
895 $prod->load_stock(
'warehouseopen, warehouseinternal'.(!$usevirtualstock ?
', novirtual' :
''), $draftchecked ===
'checked' ? 1 : 0);
899 $sql =
'SELECT label,description';
900 $sql .=
' FROM ' . MAIN_DB_PREFIX .
'product_lang';
901 $sql .=
' WHERE fk_product = ' . ((int) $objp->rowid);
902 $sql .=
" AND lang = '" . $db->escape($langs->getDefaultLang()) .
"'";
905 $resqlm = $db->query($sql);
907 $objtp = $db->fetch_object($resqlm);
908 if (!empty($objtp->description)) {
909 $objp->description = $objtp->description;
911 if (!empty($objtp->label)) {
912 $objp->label = $objtp->label;
918 if ($usevirtualstock) {
920 $stock =
$prod->stock_theorique;
923 $stockwarehouse =
$prod->stock_warehouse[(int) $fk_entrepot]->
virtual;
926 $stock =
$prod->stock_reel;
927 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
928 $stockwarehouse =
$prod->stock_warehouse[(int) $fk_entrepot]->real;
934 if (isset($draftchecked)) {
935 $result =
$prod->load_stats_commande_fournisseur(0,
'0,1,2,3,4');
936 } elseif (!$usevirtualstock) {
937 $result =
$prod->load_stats_commande_fournisseur(0,
'1,2,3,4');
940 if (!$usevirtualstock) {
941 $result =
$prod->load_stats_reception(0,
'4');
946 $ordered =
$prod->stats_commande_fournisseur[
'qty'] -
$prod->stats_reception[
'qty'];
948 $desiredstock = $objp->desiredstock;
949 $alertstock = $objp->seuil_stock_alerte;
950 $desiredstockwarehouse = (!empty($objp->desiredstockpse) ? $objp->desiredstockpse : 0);
951 $alertstockwarehouse = (!empty($objp->seuil_stock_alertepse) ? $objp->seuil_stock_alertepse : 0);
954 if ($alertstock && ($stock < $alertstock)) {
955 $warning = img_warning($langs->trans(
'StockTooLow')) .
' ';
957 $warningwarehouse =
'';
958 if ($alertstockwarehouse && ($stockwarehouse < $alertstockwarehouse)) {
959 $warningwarehouse = img_warning($langs->trans(
'StockTooLow')) .
' ';
965 if (empty($usevirtualstock)) {
966 $stocktobuy = max(max($desiredstock, $alertstock) - $stock - $ordered, 0);
967 $stocktobuywarehouse = max(max($desiredstockwarehouse, $alertstockwarehouse) - $stockwarehouse - $ordered, 0);
969 $stocktobuy = max(max($desiredstock, $alertstock) - $stock, 0);
970 $stocktobuywarehouse = max(max($desiredstockwarehouse, $alertstockwarehouse) - $stockwarehouse, 0);
972 $tobuy = ((
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy);
973 $order_zero_message =
'';
975 $order_zero_message = $langs->trans(
'ReplenishQuantityZeroExplanation');
980 $stockforcompare = ($usevirtualstock ? $stock : $stock + $ordered);
988 $picto = img_picto($langs->trans(
"NoPendingReceptionOnSupplierOrder"),
'help');
991 print
'<tr class="oddeven" '.($tobuy <= 0 ?
'title="$order_zero_message"' :
'').
'>';
994 print
'<td><input type="checkbox" class="check" name="choose' . $i .
'"></td>';
996 print
'<td class="nowrap">' .
$prod->getNomUrl(1,
'stock') .
'</td>';
998 print
'<td class="tdoverflowmax200" title="' .
dol_escape_htmltag($objp->label) .
'">';
1000 print
'<input type="hidden" name="desc' . $i .
'" value="' .
dol_escape_htmltag($objp->description) .
'">';
1005 if (preg_match(
'/([0-9]+)y/i', $objp->duration, $regs)) {
1006 $duration = $regs[1] .
' ' . $langs->trans(
'DurationYear');
1007 } elseif (preg_match(
'/([0-9]+)m/i', $objp->duration, $regs)) {
1008 $duration = $regs[1] .
' ' . $langs->trans(
'DurationMonth');
1009 } elseif (preg_match(
'/([0-9]+)d/i', $objp->duration, $regs)) {
1010 $duration = $regs[1] .
' ' . $langs->trans(
'DurationDay');
1012 $duration = $objp->duration;
1014 print
'<td class="center">' . $duration .
'</td>';
1018 print
'<td class="right">'.((getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->desiredstockpse ? $desiredstockwarehouse : img_info($langs->trans(
'ProductValuesUsedBecauseNoValuesForThisWarehouse')) .
'0') : $desiredstock).
'</td>';
1021 print
'<td class="right">'.((getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->seuil_stock_alertepse ? $alertstockwarehouse : img_info($langs->trans(
'ProductValuesUsedBecauseNoValuesForThisWarehouse')) .
'0') : $alertstock).
'</td>';
1024 print
'<td class="right">' . $warning .
price(
price2num($stock,
'MS'));
1025 print
'<!-- stock returned by main sql is ' . $objp->stock_physique .
' -->';
1029 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
1030 print
'<td class="right">'.$warningwarehouse.$stockwarehouse.
'</td>';
1034 print
'<td class="right"><a href="replenishorders.php?search_product=' .
$prod->id .
'">' . $ordered .
'</a> ' . $picto .
'</td>';
1037 print
'<td class="right">';
1038 $input_html =
'<input type="text" size="4" name="tobuy'.$i.
'" value="'.$tobuy.
'">';
1039 print ($tobuy <= 0) ? $form->textwithpicto($input_html, $order_zero_message, -1) : $input_html;
1043 print
'<td class="right">';
1044 print $form->select_product_fourn_price(
$prod->id,
'fourn' . $i, $fk_supplier);
1048 $parameters = array(
'objp' => $objp,
'i' => $i,
'tobuy' => $tobuy);
1049 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1050 print $hookmanager->resPrint;
1062 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
1065 print
'<tr><td colspan="' . $colspan .
'">';
1066 print
'<span class="opacitymedium">';
1067 print $langs->trans(
"None");
1072$parameters = array(
'sql' => $sql);
1073$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1074print $hookmanager->resPrint;
1084$value = $langs->trans(
"CreateOrders");
1085print
'<div class="center"><input type="submit" class="button" name="valid" value="' . $value .
'"></div>';
1093<script type="text/javascript">
1094function toggle(source)
1096 checkboxes = document.getElementsByClassName("check");
1097 for (var i=0; i < checkboxes.length;i++) {
1098 if (!checkboxes[i].disabled) {
1099 checkboxes[i].checked = source.checked;
$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 predefined suppliers products.
Class to manage line orders.
Class to manage predefined suppliers products.
Class to manage products or services.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
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.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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)
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.