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);
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();
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
326 $msg = $langs->trans(
'OrderFail') .
" : ";
327 $msg .= $order->error;
334 $order->socid = $suppliersid[$i];
335 $order->fetch_thirdparty();
336 $order->multicurrency_code = $order->thirdparty->multicurrency_code;
339 $order->source = $order::SOURCE_ID_REPLENISHMENT;
341 foreach ($supplier[
'lines'] as $line) {
342 if (empty($line->remise_percent)) {
343 $line->remise_percent = (float) $order->thirdparty->remise_supplier_percent;
345 $order->lines[] = $line;
347 $order->cond_reglement_id = (int) $order->thirdparty->cond_reglement_supplier_id;
348 $order->mode_reglement_id = (int) $order->thirdparty->mode_reglement_supplier_id;
350 $id = $order->create($user);
353 $msg = $langs->trans(
'OrderFail') .
" : ";
354 $msg .= $order->error;
362 setEventMessages($langs->trans(
'ErrorOrdersNotCreatedQtyTooLow'),
null,
'warnings');
369 header(
'Location: replenishorders.php');
376 setEventMessages($langs->trans(
'SelectProductWithNotNullQty'),
null,
'warnings');
389$title = $langs->trans(
'MissingStocks');
391if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
392 $sqldesiredstock =
$db->ifsql(
"pse.desiredstock IS NULL",
"p.desiredstock",
"pse.desiredstock");
393 $sqlalertstock =
$db->ifsql(
"pse.seuil_stock_alerte IS NULL",
"p.seuil_stock_alerte",
"pse.seuil_stock_alerte");
395 $sqldesiredstock =
'p.desiredstock';
396 $sqlalertstock =
'p.seuil_stock_alerte';
399$sql =
'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
400$sql .=
' p.price_ttc, p.price_base_type, p.fk_product_type,';
401$sql .=
' p.tms as datem, p.duration, p.tobuy,';
402$sql .=
' p.desiredstock, p.seuil_stock_alerte,';
403if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
404 $sql .=
' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,';
406$sql .=
" " . $sqldesiredstock .
" as desiredstockcombined, " . $sqlalertstock .
" as seuil_stock_alertecombined,";
407$sql .=
' s.fk_product,';
408$sql .=
" SUM(".$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel").
') as stock_physique';
409if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
410 $sql .=
", SUM(".$db->ifsql(
"s.reel IS NULL OR s.fk_entrepot <> ".((
int) $fk_entrepot),
"0",
"s.reel").
') as stock_real_warehouse';
414$parameters = array();
415$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
416$sql .= $hookmanager->resPrint;
418$list_warehouse = (empty($listofqualifiedwarehousesid) ?
'0' : $listofqualifiedwarehousesid);
420$sql .=
' FROM ' . MAIN_DB_PREFIX .
'product as p';
421$sql .=
' LEFT JOIN ' . MAIN_DB_PREFIX .
'product_stock as s ON p.rowid = s.fk_product';
422$sql .=
' AND s.fk_entrepot IN (' .
$db->sanitize($list_warehouse) .
')';
424$list_warehouse_selected = ($fk_entrepot < 0 || empty($fk_entrepot)) ? $list_warehouse : $fk_entrepot;
425$sql .=
' AND s.fk_entrepot IN (' .
$db->sanitize($list_warehouse_selected) .
')';
429if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
430 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).
')';
433$parameters = array();
434$reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters);
435$sql .= $hookmanager->resPrint;
437$sql .=
' WHERE p.entity IN (' .
getEntity(
'product') .
')';
439 $sql .=
natural_search(array(
'p.ref',
'p.label',
'p.description',
'p.note'), $sall);
444 $sql .=
' AND p.fk_product_type = 1';
446 $sql .=
' AND p.fk_product_type <> 1';
455$sql .=
' AND p.tobuy = 1';
457 $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').
'))';
459if ($fk_supplier > 0) {
460 $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') .
'))';
463$parameters = array();
464$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
465$sql .= $hookmanager->resPrint;
467$sql .=
' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
468$sql .=
', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
469$sql .=
', p.duration, p.tobuy';
470$sql .=
', p.desiredstock';
471$sql .=
', p.seuil_stock_alerte';
472if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
473 $sql .=
', pse.desiredstock';
474 $sql .=
', pse.seuil_stock_alerte';
476$sql .=
', s.fk_product';
478if ($usevirtualstock) {
480 $sqlCommandesCli =
"(SELECT ".$db->ifsql(
"SUM(cd1.qty) IS NULL",
"0",
"SUM(cd1.qty)").
" as qty";
481 $sqlCommandesCli .=
" FROM ".MAIN_DB_PREFIX.
"commandedet as cd1, ".MAIN_DB_PREFIX.
"commande as c1";
482 $sqlCommandesCli .=
" WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'commande').
")";
483 $sqlCommandesCli .=
" AND cd1.fk_product = p.rowid";
484 $sqlCommandesCli .=
" AND c1.fk_statut IN (1,2))";
486 $sqlCommandesCli =
'0';
490 $sqlExpeditionsCli =
"(SELECT ".$db->ifsql(
"SUM(ed2.qty) IS NULL",
"0",
"SUM(ed2.qty)").
" as qty";
491 $sqlExpeditionsCli .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e2,";
492 $sqlExpeditionsCli .=
" ".MAIN_DB_PREFIX.
"expeditiondet as ed2,";
493 $sqlExpeditionsCli .=
" ".MAIN_DB_PREFIX.
"commande as c2,";
494 $sqlExpeditionsCli .=
" ".MAIN_DB_PREFIX.
"commandedet as cd2";
495 $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').
")";
496 $sqlExpeditionsCli .=
" AND cd2.fk_commande = c2.rowid";
497 $sqlExpeditionsCli .=
" AND c2.fk_statut IN (1,2)";
498 $sqlExpeditionsCli .=
" AND cd2.fk_product = p.rowid";
499 $sqlExpeditionsCli .=
" AND e2.fk_statut IN (1,2))";
501 $sqlExpeditionsCli =
'0';
505 $sqlCommandesFourn =
"(SELECT " .
$db->ifsql(
"SUM(cd3.qty) IS NULL",
"0",
"SUM(cd3.qty)") .
" as qty";
506 $sqlCommandesFourn .=
" FROM " . MAIN_DB_PREFIX .
"commande_fournisseurdet as cd3,";
507 $sqlCommandesFourn .=
" " . MAIN_DB_PREFIX .
"commande_fournisseur as c3";
508 $sqlCommandesFourn .=
" WHERE c3.rowid = cd3.fk_commande";
509 $sqlCommandesFourn .=
" AND c3.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'supplier_order').
")";
510 $sqlCommandesFourn .=
" AND cd3.fk_product = p.rowid";
511 $sqlCommandesFourn .=
" AND c3.fk_statut IN (3,4))";
513 $sqlReceptionFourn =
"(SELECT ".$db->ifsql(
"SUM(fd4.qty) IS NULL",
"0",
"SUM(fd4.qty)").
" as qty";
514 $sqlReceptionFourn .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf4,";
515 $sqlReceptionFourn .=
" ".MAIN_DB_PREFIX.
"receptiondet_batch as fd4";
516 $sqlReceptionFourn .=
" WHERE fd4.fk_element = cf4.rowid AND cf4.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'supplier_order').
")";
517 $sqlReceptionFourn .=
" AND fd4.fk_product = p.rowid";
518 $sqlReceptionFourn .=
" AND cf4.fk_statut IN (3,4))";
520 $sqlCommandesFourn =
'0';
521 $sqlReceptionFourn =
'0';
525 $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";
526 $sqlProductionToConsume .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as mm5,";
527 $sqlProductionToConsume .=
" ".MAIN_DB_PREFIX.
"mrp_production as mp5";
528 $sqlProductionToConsume .=
" WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'mo').
")";
529 $sqlProductionToConsume .=
" AND mp5.fk_product = p.rowid";
530 $sqlProductionToConsume .=
" AND mp5.role IN ('toconsume', 'consumed')";
531 $sqlProductionToConsume .=
" AND mm5.status IN (1,2))";
533 $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";
534 $sqlProductionToProduce .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as mm5,";
535 $sqlProductionToProduce .=
" ".MAIN_DB_PREFIX.
"mrp_production as mp5";
536 $sqlProductionToProduce .=
" WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity(
getDolGlobalString(
'STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ?
'stock' :
'mo').
")";
537 $sqlProductionToProduce .=
" AND mp5.fk_product = p.rowid";
538 $sqlProductionToProduce .=
" AND mp5.role IN ('toproduce', 'produced')";
539 $sqlProductionToProduce .=
" AND mm5.status IN (1,2))";
541 $sqlProductionToConsume =
'0';
542 $sqlProductionToProduce =
'0';
545 $parameters = array();
546 $sqlHookVirtualStock =
"0";
547 $reshook = $hookmanager->executeHooks(
'printFieldListHavingVirtualStock', $parameters);
548 if (!empty($hookmanager->resPrint)) {
549 $sqlHookVirtualStock = $hookmanager->resPrint;
553 $sql .=
" (" . $sqldesiredstock .
" >= 0 AND (" . $sqldesiredstock .
" > SUM(" .
$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')';
554 $sql .=
" - (" . $sqlCommandesCli .
" - " . $sqlExpeditionsCli .
") + (" . $sqlCommandesFourn .
" - " . $sqlReceptionFourn .
") + (" . $sqlProductionToProduce .
" - " . $sqlProductionToConsume .
") + ".$sqlHookVirtualStock.
"))";
556 if ($includeproductswithoutdesiredqty ==
'on') {
557 $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") .
")";
559 $sql .=
" (" . $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" .
$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')';
561 $sql .=
" - (" . $sqlCommandesCli .
" - " . $sqlExpeditionsCli .
") + (" . $sqlCommandesFourn .
" - " . $sqlReceptionFourn .
") + (" . $sqlProductionToProduce .
" - " . $sqlProductionToConsume .
") + ".$sqlHookVirtualStock.
"))";
563 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
565 $sql .=
" pse.desiredstock > 0)";
568 if ($salert ==
'on') {
570 if ($includeproductswithoutdesiredqty ==
'on') {
571 $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") .
")";
573 $sql .= $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" .
$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
")";
575 $sql .=
" - (" . $sqlCommandesCli .
" - " . $sqlExpeditionsCli .
") + (" . $sqlCommandesFourn .
" - " . $sqlReceptionFourn .
") + (" . $sqlProductionToProduce .
" - " . $sqlProductionToConsume .
") + ".$sqlHookVirtualStock.
")";
577 $alertchecked =
'checked';
581 $sql .=
"(" . $sqldesiredstock .
" >= 0 AND (" . $sqldesiredstock .
" > SUM(" .
$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
")))";
583 if ($includeproductswithoutdesiredqty ==
'on') {
584 $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") .
')))';
586 $sql .=
" (" . $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" .
$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
')))';
589 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
591 $sql .=
" pse.desiredstock > 0)";
594 if ($salert ==
'on') {
596 if ($includeproductswithoutdesiredqty ==
'on') {
597 $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") .
"))";
599 $sql .=
" " . $sqlalertstock .
" >= 0 AND (" . $sqlalertstock .
" > SUM(" .
$db->ifsql(
"s.reel IS NULL",
"0",
"s.reel") .
'))';
602 $alertchecked =
'checked';
606$includeproductswithoutdesiredqtychecked =
'';
607if ($includeproductswithoutdesiredqty ==
'on') {
608 $includeproductswithoutdesiredqtychecked =
'checked';
611$nbtotalofrecords =
'';
613 $result =
$db->query($sql);
614 $nbtotalofrecords =
$db->num_rows($result);
615 if (($page * $limit) > (
int) $nbtotalofrecords) {
621$sql .=
$db->order($sortfield, $sortorder);
622$sql .=
$db->plimit($limit + 1, $offset);
625$resql =
$db->query($sql);
631$num =
$db->num_rows($resql);
634$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|';
635$helpurl .=
'ES:Módulo_Stocks';
637llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_replenish');
641$head[0][0] = DOL_URL_ROOT .
'/product/stock/replenish.php';
643$head[0][2] =
'replenish';
645$head[1][0] = DOL_URL_ROOT .
'/product/stock/replenishorders.php';
646$head[1][1] = $langs->trans(
"ReplenishmentOrders");
647$head[1][2] =
'replenishorders';
654print
'<span class="opacitymedium">' . $langs->trans(
"ReplenishmentStatusDesc") .
'</span>' .
"\n";
658if (empty($fk_entrepot) &&
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) {
659 print
'<span class="opacitymedium">'.$langs->trans(
"ReplenishmentStatusDescPerWarehouse").
'</span>'.
"\n";
662if ($usevirtualstock == 1) {
663 print $langs->trans(
"CurentSelectionMode") .
': ';
664 print
'<span class="a-mesure">' . $langs->trans(
"UseVirtualStock") .
'</span>';
665 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>';
668if ($usevirtualstock == 0) {
669 print $langs->trans(
"CurentSelectionMode") .
': ';
670 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>';
671 print
' <span class="a-mesure">' . $langs->trans(
"UsePhysicalStock") .
'</span>';
676print
'<form name="formFilterWarehouse" method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
677print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
678print
'<input type="hidden" name="action" value="filter">';
679print
'<input type="hidden" name="search_ref" value="' . $search_ref .
'">';
680print
'<input type="hidden" name="search_label" value="' . $search_label .
'">';
681print
'<input type="hidden" name="salert" value="' . $salert .
'">';
682print
'<input type="hidden" name="includeproductswithoutdesiredqty" value="' . $includeproductswithoutdesiredqty .
'">';
683print
'<input type="hidden" name="draftorder" value="' . $draftorder .
'">';
684print
'<input type="hidden" name="mode" value="' . $mode .
'">';
685if ($limit > 0 && $limit !=
$conf->liste_limit) {
686 print
'<input type="hidden" name="limit" value="' . $limit .
'">';
689 print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
690 print $langs->trans(
'Warehouse') .
' ' . $formproduct->selectWarehouses((
int) $fk_entrepot,
'fk_entrepot',
'', 1);
693print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
694$filter =
'(fournisseur:=:1)';
695print $langs->trans(
'Supplier') .
' ' . $form->select_company($fk_supplier,
'fk_supplier', $filter, 1);
698$parameters = array();
699$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
700if (empty($reshook)) {
701 print $hookmanager->resPrint;
704print
'<div class="inline-block valignmiddle">';
705print
'<input type="submit" class="button smallpaddingimp" name="valid" value="' . $langs->trans(
'ToFilter') .
'">';
710print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" name="formulaire">';
711print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
712print
'<input type="hidden" name="fk_supplier" value="' . $fk_supplier .
'">';
713print
'<input type="hidden" name="fk_entrepot" value="' . $fk_entrepot .
'">';
714print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
715print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
716print
'<input type="hidden" name="type" value="' . $type .
'">';
717print
'<input type="hidden" name="linecount" value="' . $num .
'">';
718print
'<input type="hidden" name="action" value="order">';
719print
'<input type="hidden" name="mode" value="' . $mode .
'">';
722if ($search_ref || $search_label || $sall || $salert || $draftorder ||
GETPOST(
'search',
'alpha')) {
723 $filters =
'&search_ref=' . urlencode($search_ref) .
'&search_label=' . urlencode($search_label);
724 $filters .=
'&sall=' . urlencode($sall);
725 $filters .=
'&salert=' . urlencode($salert);
726 $filters .=
'&draftorder=' . urlencode($draftorder);
727 $filters .=
'&mode=' . urlencode($mode);
728 if ($fk_supplier > 0) {
729 $filters .=
'&fk_supplier='.urlencode((
string) ($fk_supplier));
731 if ($fk_entrepot > 0) {
732 $filters .=
'&fk_entrepot='.urlencode((
string) ($fk_entrepot));
735 $filters =
'&search_ref='.urlencode($search_ref).
'&search_label='.urlencode($search_label);
736 $filters .=
'&fourn_id='.urlencode((
string) ($fourn_id));
737 $filters .= (isset($type) ?
'&type='.urlencode((
string) ($type)) :
'');
738 $filters .=
'&salert='.urlencode($salert);
739 $filters .=
'&draftorder='.urlencode($draftorder);
740 $filters .=
'&mode='.urlencode($mode);
741 if ($fk_supplier > 0) {
742 $filters .=
'&fk_supplier='.urlencode((
string) ($fk_supplier));
744 if ($fk_entrepot > 0) {
745 $filters .=
'&fk_entrepot='.urlencode((
string) ($fk_entrepot));
748if ($limit > 0 && $limit !=
$conf->liste_limit) {
749 $filters .=
'&limit=' . ((int) $limit);
751if (!empty($includeproductswithoutdesiredqty)) {
752 $filters .=
'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
754if (!empty($salert)) {
755 $filters .=
'&salert='.urlencode($salert);
758$param = (isset($type) ?
'&type='.urlencode((
string) ($type)) :
'');
759$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));
760$param .=
'&search_ref='.urlencode($search_ref);
761$param .=
'&mode='.urlencode($mode);
762$param .=
'&fk_supplier='.urlencode((
string) ($fk_supplier));
763$param .=
'&fk_entrepot='.urlencode((
string) ($fk_entrepot));
764if (!empty($includeproductswithoutdesiredqty)) {
765 $param .=
'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
767if (!empty($salert)) {
768 $param .=
'&salert='.urlencode($salert);
771$stocklabel = $langs->trans(
'Stock');
772$stocklabelbis = $langs->trans(
'Stock');
774if ($usevirtualstock == 1) {
775 $stocklabel = $langs->trans(
'VirtualStock');
776 $stocktooltip = $langs->trans(
"VirtualStockDesc");
778if ($usevirtualstock == 0) {
779 $stocklabel = $langs->trans(
'PhysicalStock');
781if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
782 $stocklabelbis = $stocklabel.
' ('.$langs->trans(
'SelectedWarehouse').
')';
783 $stocklabel .=
' ('.$langs->trans(
"AllWarehouses").
')';
785$texte = $langs->trans(
'Replenishment');
823print
'<div class="div-table-responsive-no-min">';
824print
'<table class="liste centpercent">';
827print
'<tr class="liste_titre_filter">';
828print
'<td class="liste_titre"> </td>';
829print
'<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="' .
dol_escape_htmltag($search_ref) .
'"></td>';
830print
'<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="' .
dol_escape_htmltag($search_label) .
'"></td>';
832 print
'<td class="liste_titre"> </td>';
834print
'<td class="liste_titre right">' . $form->textwithpicto($langs->trans(
'IncludeEmptyDesiredStock'), $langs->trans(
'IncludeProductWithUndefinedAlerts')) .
' <input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" ' . (!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked :
'') .
'></td>';
835print
'<td class="liste_titre right"></td>';
836print
'<td class="liste_titre right">'.$langs->trans(
'AlertOnly').
' <input type="checkbox" id="salert" name="salert" '.(!empty($alertchecked) ? $alertchecked :
'').
'></td>';
837if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
838 print
'<td class="liste_titre"> </td>';
840print
'<td class="liste_titre right">';
842 print $langs->trans(
'IncludeAlsoDraftOrders').
' <input type="checkbox" id="draftorder" name="draftorder" '.(!empty($draftchecked) ? $draftchecked :
'').
'>';
845print
'<td class="liste_titre"> </td>';
847$parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
848$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
849print $hookmanager->resPrint;
851print
'<td class="liste_titre maxwidthsearch right">';
852$searchpicto = $form->showFilterAndCheckAddButtons(0);
858print
'<tr class="liste_titre">';
863 print_liste_field_titre(
'Duration', $_SERVER[
"PHP_SELF"],
'p.duration',
'', $param,
'', $sortfield, $sortorder,
'center ');
865print_liste_field_titre(
'DesiredStock', $_SERVER[
"PHP_SELF"],
'p.desiredstock',
'', $param,
'', $sortfield, $sortorder,
'right ');
866print_liste_field_titre(
'StockLimitShort', $_SERVER[
"PHP_SELF"],
'p.seuil_stock_alerte',
'', $param,
'', $sortfield, $sortorder,
'right ');
867print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'stock_physique',
'', $param,
'', $sortfield, $sortorder,
'right ', $stocktooltip);
868if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
869 print_liste_field_titre($stocklabelbis, $_SERVER[
"PHP_SELF"],
'stock_real_warehouse',
'', $param,
'', $sortfield, $sortorder,
'right ');
872print_liste_field_titre(
'StockToBuy', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
873print_liste_field_titre(
'SupplierRef', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
876$parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
877$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
878print $hookmanager->resPrint;
882while ($i < ($limit ? min($num, $limit) : $num)) {
883 $objp =
$db->fetch_object($resql);
886 $result =
$prod->fetch($objp->rowid);
892 $prod->load_stock(
'warehouseopen, warehouseinternal'.(!$usevirtualstock ?
', novirtual' :
''), $draftchecked ===
'checked' ? 1 : 0);
896 $sql =
'SELECT label,description';
897 $sql .=
' FROM ' . MAIN_DB_PREFIX .
'product_lang';
898 $sql .=
' WHERE fk_product = ' . ((int) $objp->rowid);
899 $sql .=
" AND lang = '" .
$db->escape($langs->getDefaultLang()) .
"'";
902 $resqlm =
$db->query($sql);
904 $objtp =
$db->fetch_object($resqlm);
905 if (!empty($objtp->description)) {
906 $objp->description = $objtp->description;
908 if (!empty($objtp->label)) {
909 $objp->label = $objtp->label;
915 if ($usevirtualstock) {
917 $stock =
$prod->stock_theorique;
920 $stockwarehouse =
$prod->stock_warehouse[(int) $fk_entrepot]->
virtual;
923 $stock =
$prod->stock_reel;
924 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
925 $stockwarehouse =
$prod->stock_warehouse[(int) $fk_entrepot]->real;
930 if (isset($draftchecked)) {
931 $result =
$prod->load_stats_commande_fournisseur(0,
'0,1,2,3,4');
932 } elseif (!$usevirtualstock) {
933 $result =
$prod->load_stats_commande_fournisseur(0,
'1,2,3,4');
936 if (!$usevirtualstock) {
937 $result =
$prod->load_stats_reception(0,
'4');
942 $ordered =
$prod->stats_commande_fournisseur[
'qty'] -
$prod->stats_reception[
'qty'];
944 $desiredstock = $objp->desiredstock;
945 $alertstock = $objp->seuil_stock_alerte;
946 $desiredstockwarehouse = (!empty($objp->desiredstockpse) ? $objp->desiredstockpse : 0);
947 $alertstockwarehouse = (!empty($objp->seuil_stock_alertepse) ? $objp->seuil_stock_alertepse : 0);
950 if ($alertstock && ($stock < $alertstock)) {
951 $warning =
img_warning($langs->trans(
'StockTooLow')) .
' ';
953 $warningwarehouse =
'';
954 if ($alertstockwarehouse && ($stockwarehouse < $alertstockwarehouse)) {
955 $warningwarehouse =
img_warning($langs->trans(
'StockTooLow')) .
' ';
961 if (empty($usevirtualstock)) {
962 $stocktobuy = max(max($desiredstock, $alertstock) - $stock - $ordered, 0);
964 $stocktobuy = max(max($desiredstock, $alertstock) - $stock, 0);
966 if (empty($usevirtualstock)) {
967 $stocktobuywarehouse = max(max($desiredstockwarehouse, $alertstockwarehouse) - $stockwarehouse - $ordered, 0);
969 $stocktobuywarehouse = max(max($desiredstockwarehouse, $alertstockwarehouse) - $stockwarehouse, 0);
974 $stockforcompare = ($usevirtualstock ? $stock : $stock + $ordered);
982 $picto =
img_picto($langs->trans(
"NoPendingReceptionOnSupplierOrder"),
'help');
985 print
'<tr class="oddeven">';
988 print
'<td><input type="checkbox" class="check" name="choose' . $i .
'"></td>';
990 print
'<td class="nowrap">' .
$prod->getNomUrl(1,
'stock') .
'</td>';
992 print
'<td class="tdoverflowmax200" title="' .
dol_escape_htmltag($objp->label) .
'">';
994 print
'<input type="hidden" name="desc' . $i .
'" value="' .
dol_escape_htmltag($objp->description) .
'">';
999 if (preg_match(
'/([0-9]+)y/i', $objp->duration, $regs)) {
1000 $duration = $regs[1] .
' ' . $langs->trans(
'DurationYear');
1001 } elseif (preg_match(
'/([0-9]+)m/i', $objp->duration, $regs)) {
1002 $duration = $regs[1] .
' ' . $langs->trans(
'DurationMonth');
1003 } elseif (preg_match(
'/([0-9]+)d/i', $objp->duration, $regs)) {
1004 $duration = $regs[1] .
' ' . $langs->trans(
'DurationDay');
1006 $duration = $objp->duration;
1008 print
'<td class="center">' . $duration .
'</td>';
1012 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>';
1015 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>';
1018 print
'<td class="right">' . $warning .
price(
price2num($stock,
'MS'));
1019 print
'<!-- stock returned by main sql is ' . $objp->stock_physique .
' -->';
1023 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
1024 print
'<td class="right">'.$warningwarehouse.$stockwarehouse.
'</td>';
1028 print
'<td class="right"><a href="replenishorders.php?search_product=' .
$prod->id .
'">' . $ordered .
'</a> ' . $picto .
'</td>';
1031 $tobuy = ((
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy);
1032 print
'<td class="right"><input type="text" size="4" name="tobuy'.$i.
'" value="'.$tobuy.
'"></td>';
1035 print
'<td class="right">';
1036 print $form->select_product_fourn_price(
$prod->id,
'fourn' . $i, $fk_supplier);
1040 $parameters = array(
'objp' => $objp,
'i' => $i,
'tobuy' => $tobuy);
1041 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1042 print $hookmanager->resPrint;
1054 if (
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
1057 print
'<tr><td colspan="' . $colspan .
'">';
1058 print
'<span class="opacitymedium">';
1059 print $langs->trans(
"None");
1064$parameters = array(
'sql' => $sql);
1065$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1066print $hookmanager->resPrint;
1076$value = $langs->trans(
"CreateOrders");
1077print
'<div class="center"><input type="submit" class="button" name="valid" value="' . $value .
'"></div>';
1085<script type="text/javascript">
1086function toggle(source)
1088 checkboxes = document.getElementsByClassName("check");
1089 for (var i=0; i < checkboxes.length;i++) {
1090 if (!checkboxes[i].disabled) {
1091 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
img_info($titlealt='default')
Show info logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.