27require
'../../main.inc.php';
28include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29include_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
30include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
31include_once DOL_DOCUMENT_ROOT.
'/product/inventory/class/inventory.class.php';
32include_once DOL_DOCUMENT_ROOT.
'/product/inventory/lib/inventory.lib.php';
33include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
34include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
45$langs->loadLangs(array(
"stocks",
"other",
"productbatch"));
50$action =
GETPOST(
'action',
'aZ09');
51$confirm =
GETPOST(
'confirm',
'alpha');
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'inventorycard';
54$backtopage =
GETPOST(
'backtopage',
'alpha');
55$listoffset =
GETPOST(
'listoffset',
'alpha');
56$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60if (empty($page) || $page == -1) {
63$offset = $limit * $page;
70$batch =
GETPOST(
'batch',
'alphanohtml');
71$totalExpectedValuation = 0;
72$totalRealValuation = 0;
73$hookmanager->initHooks(array(
'inventorycard'));
77 $result =
restrictedArea($user,
'stock', $id,
'inventory&stock',
'inventory_advance');
83$diroutputmassaction =
$conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
94$extrafields->fetch_name_optionals_label(
$object->table_element);
96$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
99$search_all =
GETPOST(
"search_all",
'alpha');
101foreach (
$object->fields as $key => $val) {
102 if (
GETPOST(
'search_'.$key,
'alpha')) {
103 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
107if (empty($action) && empty($id) && empty($ref)) {
112include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
120$paramwithsearch =
'&sortfield=' . urlencode($sortfield);
121$paramwithsearch .=
'&sortorder=' . urlencode($sortorder);
122if ($limit > 0 && $limit !=
$conf->liste_limit) {
123 $paramwithsearch .=
'&limit='.((int) $limit);
127$sortfield .=
',' . ($sortfield ==
'e.ref' ?
'p.ref' :
'e.ref') .
',id.batch,id.rowid';
128$sortorder .=
',' . $sortorder.
",ASC,ASC";
131 $permissiontoadd = $user->hasRight(
'stock',
'creer');
132 $permissiontodelete = $user->hasRight(
'stock',
'supprimer');
133 $permissiontoupdatestock = $user->hasRight(
'stock',
'mouvement',
'creer');
135 $permissiontoadd = $user->hasRight(
'stock',
'inventory_advance',
'write');
136 $permissiontodelete = $user->hasRight(
'stock',
'inventory_advance',
'write');
137 $permissiontoupdatestock = $user->hasRight(
'stock',
'inventory_advance',
'write');
153$parameters = array();
154$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
159if (empty($reshook)) {
162 if ($action ==
'cancel_record' && $permissiontoupdatestock) {
167 if ($action ==
'update' && $permissiontoupdatestock &&
$object->status == $object::STATUS_VALIDATED) {
171 $cacheOfProducts = array();
175 $sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
176 $sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real';
177 $sql .=
' FROM '.MAIN_DB_PREFIX.
'inventorydet as id';
178 $sql .=
' WHERE id.fk_inventory = '.((int)
$object->id);
179 $sql .=
' ORDER BY id.rowid';
181 $resql =
$db->query($sql);
183 $num =
$db->num_rows($resql);
189 $line =
$db->fetch_object($resql);
191 $qty_stock = $line->qty_stock;
192 $qty_view = $line->qty_view;
196 if (isset($cacheOfProducts[$line->fk_product])) {
197 $product_static = $cacheOfProducts[$line->fk_product];
200 $result = $product_static->fetch($line->fk_product,
'',
'',
'', 1, 1, 1);
203 $option .=
',novirtual';
204 $product_static->load_stock($option);
206 $cacheOfProducts[$product_static->id] = $product_static;
210 $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->real;
211 if (
isModEnabled(
'productbatch') && $product_static->hasbatch()) {
212 $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->detail_batch[$line->batch]->qty;
215 if (!is_null($qty_view)) {
216 $stock_movement_qty =
price2num($qty_view - $realqtynow,
'MS');
219 if ($stock_movement_qty != 0) {
220 if ($stock_movement_qty < 0) {
228 $inventorycode =
'INV-'.$object->ref;
231 $price = $line->pmp_real;
234 $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, (
float) $stock_movement_qty, $movement_type, $price, $langs->trans(
'LabelOfInventoryMovemement',
$object->ref), $inventorycode, $datemovement,
'',
'', $line->batch);
235 if ($idstockmove < 0) {
242 $sqlupdate =
"UPDATE ".MAIN_DB_PREFIX.
"inventorydet";
243 $sqlupdate .=
" SET fk_movement = ".((int) $idstockmove);
244 if ($qty_stock != $realqtynow) {
245 $sqlupdate .=
", qty_stock = ".((float) $realqtynow);
247 $sqlupdate .=
" WHERE rowid = ".((int) $line->rowid);
248 $resqlupdate =
$db->query($sqlupdate);
249 if (! $resqlupdate) {
257 $sqlpmp =
'UPDATE '.MAIN_DB_PREFIX.
'product SET pmp = '.((float) $line->pmp_real).
' WHERE rowid = '.((int) $line->fk_product);
258 $resqlpmp =
$db->query($sqlpmp);
270 $sqlpmp =
'UPDATE '.MAIN_DB_PREFIX.
'product_perentity SET pmp = '.((float) $line->pmp_real).
' WHERE fk_product = '.((int) $line->fk_product).
' AND entity='.
$conf->entity;
271 $resqlpmp =
$db->query($sqlpmp);
300 if ($action ==
'updateinventorylines' && $permissiontoupdatestock) {
301 $sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
302 $sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
303 $sql .=
' FROM '.MAIN_DB_PREFIX.
'inventorydet as id';
304 $sql .=
' LEFT JOIN ' .
$db->prefix() .
'product as p ON id.fk_product = p.rowid';
305 $sql .=
' LEFT JOIN ' .
$db->prefix() .
'entrepot as e ON id.fk_warehouse = e.rowid';
306 $sql .=
' WHERE id.fk_inventory = '.((int)
$object->id);
307 $sql .=
$db->order($sortfield, $sortorder);
308 $sql .=
$db->plimit($limit, $offset);
312 $resql =
$db->query($sql);
314 $num =
$db->num_rows($resql);
320 $line =
$db->fetch_object($resql);
321 $lineid = $line->rowid;
326 if (
GETPOST(
"id_".$lineid,
'alpha') !=
'') {
328 $result = $inventoryline->fetch($lineid);
329 if ($qtytoupdate < 0) {
331 setEventMessages($langs->trans(
"FieldCannotBeNegative", $langs->transnoentitiesnoconv(
"RealQty")),
null,
'errors');
334 $inventoryline->qty_stock = (float)
price2num(
GETPOST(
'stock_qty_'.$lineid,
'alpha'),
'MS');
335 $inventoryline->qty_view = $qtytoupdate;
336 $inventoryline->pmp_real =
price2num(
GETPOST(
'realpmp_'.$lineid,
'alpha'),
'MS');
337 $inventoryline->pmp_expected =
price2num(
GETPOST(
'expectedpmp_'.$lineid,
'alpha'),
'MS');
338 $resultupdate = $inventoryline->update($user);
340 } elseif (GETPOSTISSET(
'id_' . $lineid)) {
342 $result = $inventoryline->fetch($lineid);
344 $inventoryline->qty_view =
null;
345 $inventoryline->pmp_real =
price2num(
GETPOST(
'realpmp_'.$lineid,
'alpha'),
'MS');
346 $inventoryline->pmp_expected =
price2num(
GETPOST(
'expectedpmp_'.$lineid,
'alpha'),
'MS');
347 $resultupdate = $inventoryline->update($user);
351 if ($result < 0 || $resultupdate < 0) {
361 $sqlupdate =
"UPDATE ".MAIN_DB_PREFIX.
"inventory";
362 $sqlupdate .=
" SET fk_user_modif = ".((int) $user->id);
363 $sqlupdate .=
" WHERE rowid = ".((int)
$object->id);
364 $resqlupdate =
$db->query($sqlupdate);
365 if (! $resqlupdate) {
378 $backurlforlist = DOL_URL_ROOT.
'/product/inventory/list.php';
379 $backtopage = DOL_URL_ROOT.
'/product/inventory/inventory.php?id='.
$object->id.
'&page='.$page.$paramwithsearch;
382 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
385 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
388 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
396 if (
GETPOST(
'addline',
'alpha')) {
398 if ($fk_warehouse <= 0) {
400 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
402 if ($fk_product <= 0) {
404 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
408 setEventMessages($langs->trans(
"FieldCannotBeNegative", $langs->transnoentitiesnoconv(
"RealQty")),
null,
'errors');
412 $result = $tmpproduct->fetch($fk_product);
414 if (empty($error) && $tmpproduct->status_batch > 0 && empty($batch)) {
416 $langs->load(
"errors");
417 setEventMessages($langs->trans(
"ErrorProductNeedBatchNumber", $tmpproduct->ref),
null,
'errors');
419 if (empty($error) && $tmpproduct->status_batch == 2 && !empty($batch) && $qty > 1) {
421 $langs->load(
"errors");
422 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $tmpproduct->ref, $batch),
null,
'errors');
424 if (empty($error) && empty($tmpproduct->status_batch) && !empty($batch)) {
426 $langs->load(
"errors");
427 setEventMessages($langs->trans(
"ErrorProductDoesNotNeedBatchNumber", $tmpproduct->ref),
null,
'errors');
432 $tmp->fk_inventory =
$object->id;
433 $tmp->fk_warehouse = $fk_warehouse;
434 $tmp->fk_product = $fk_product;
435 $tmp->batch = $batch;
437 $tmp->qty_view = $qty;
439 $result = $tmp->create($user);
441 if (
$db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
442 $langs->load(
"errors");
443 setEventMessages($langs->trans(
"ErrorRecordAlreadyExists"),
null,
'errors');
449 $_POST[
'batch'] =
'';
450 $_POST[
'qtytoadd'] =
'';
467llxHeader(
'', $langs->trans(
'Inventory'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-inventory_inventory');
476if ($limit > 0 && $limit !=
$conf->liste_limit) {
477 $param .=
'&limit=' . ((int) $limit);
481$res =
$object->fetch_optionals();
489if ($action ==
'delete') {
490 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteInventory'), $langs->trans(
'ConfirmDeleteOrder'),
'confirm_delete',
'', 0, 1);
493if ($action ==
'deleteline') {
494 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid.
'&page='.$page.$paramwithsearch, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
498if ($action ==
'clone') {
500 $formquestion = array();
501 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMyObject',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
505if ($action ==
'record') {
506 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&page='.$page.$paramwithsearch, $langs->trans(
'Close'), $langs->trans(
'ConfirmFinish'),
'update',
'', 0, 1);
511if ($action ==
'confirm_cancel') {
512 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Cancel'), $langs->trans(
'ConfirmCancel'),
'cancel_record',
'', 0, 1);
516if ($action ==
'validate') {
520 $formquestion = array(
521 array(
'type' =>
'checkbox',
'name' =>
'include_sub_warehouse',
'label' => $langs->trans(
"IncludeSubWarehouse"),
'value' => 1,
'size' =>
'10'),
523 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateInventory'), $langs->trans(
'IncludeSubWarehouseExplanation'),
'confirm_validate', $formquestion,
'', 1);
528$parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
529$reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
530if (empty($reshook)) {
531 $formconfirm .= $hookmanager->resPrint;
532} elseif ($reshook > 0) {
533 $formconfirm = $hookmanager->resPrint;
542$linkback =
'<a href="'.DOL_URL_ROOT.
'/product/inventory/list.php">'.$langs->trans(
"BackToList").
'</a>';
544$morehtmlref =
'<div class="refidno">';
584$morehtmlref .=
'</div>';
587dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
590print
'<div class="fichecenter">';
591print
'<div class="fichehalfleft">';
592print
'<div class="underbanner clearboth"></div>';
593print
'<table class="border centpercent tableforfield">'.
"\n";
596include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
599include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
607print
'<div class="clearboth"></div>';
611print
'<form id="formrecord" name="formrecord" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?page='.$page.
'&id='.
$object->id.
'">';
612print
'<input type="hidden" name="token" value="'.newToken().
'">';
613print
'<input type="hidden" name="action" value="updateinventorylines">';
614print
'<input type="hidden" name="id" value="'.$object->id.
'">';
615print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
616print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
618 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
623if ($action !=
'record') {
624 print
'<div class="tabsAction">'.
"\n";
625 $parameters = array();
626 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
631 if (empty($reshook)) {
632 if (
$object->status == Inventory::STATUS_DRAFT) {
633 if ($permissiontoupdatestock) {
635 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=validate&token='.newToken().
'">'.$langs->trans(
"Validate").
' ('.$langs->trans(
"Start").
')</a>';
637 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_validate&confirm=yes&token='.newToken().
'">'.$langs->trans(
"Validate").
' ('.$langs->trans(
"Start").
')</a>';
640 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Validate').
' ('.$langs->trans(
"Start").
')</a>'.
"\n";
645 if (
$object->status == $object::STATUS_VALIDATED) {
646 if ($permissiontoupdatestock) {
647 print
'<a class="butAction classfortooltip" id="idbuttonmakemovementandclose" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=record&page='.$page.$paramwithsearch.
'&token='.newToken().
'" title="'.
dol_escape_htmltag($langs->trans(
"MakeMovementsAndClose")).
'">'.$langs->trans(
"MakeMovementsAndClose").
'</a>'.
"\n";
649 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'MakeMovementsAndClose').
'</a>'.
"\n";
652 if ($permissiontoupdatestock) {
653 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_cancel&page='.$page.$paramwithsearch.
'&token='.newToken().
'">'.$langs->trans(
"Cancel").
'</a>'.
"\n";
659 if (
$object->status != Inventory::STATUS_DRAFT &&
$object->status != Inventory::STATUS_VALIDATED) {
666if (
$object->status == Inventory::STATUS_VALIDATED) {
668 if (!empty(
$conf->use_javascript_ajax)) {
669 if ($permissiontoupdatestock) {
672 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=updatebyscaning&token='.currentToken().
'" class="marginrightonly paddingright marginleftonly paddingleft">'.
img_picto(
'',
'barcode',
'class="paddingrightonly"').$langs->trans(
"UpdateByScaning").
'</a>';
676 print
'<a id="fillwithexpected" class="marginrightonly paddingright marginleftonly paddingleft" href="#">'.img_picto(
'',
'autofill',
'class="paddingrightonly"').$langs->trans(
'AutofillWithExpected').
'</a>';
678 print
'$( document ).ready(function() {';
679 print
' $("#fillwithexpected").on("click",function fillWithExpected(){
680 $(".expectedqty").each(function(){
681 var object = $(this)[0];
682 var objecttofill = $("#"+object.id+"_input")[0];
683 objecttofill.value = object.innerText;
684 jQuery(".realqty").trigger("change");
686 console.log("Values filled (after click on fillwithexpected)");
687 /* disablebuttonmakemovementandclose(); */
694 print
'<a href="#" id="clearqty" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto(
'',
'eraser',
'class="paddingrightonly"').$langs->trans(
"ClearQtys").
'</a>';
696 print
'<a class="classfortooltip marginrightonly paddingright marginleftonly paddingleft" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Save").
'</a>'.
"\n";
706if ($action ==
'updatebyscaning') {
707 if ($permissiontoupdatestock) {
712 var duplicatedbatchcode = [];
718 function barcodescannerjs(){
719 console.log("We catch inputs in scanner box");
720 jQuery("#scantoolmessage").text();
722 var selectaddorreplace = $("select[name=selectaddorreplace]").val();
723 var barcodemode = $("input[name=barcodemode]:checked").val();
724 var barcodeproductqty = $("input[name=barcodeproductqty]").val();
725 var textarea = $("textarea[name=barcodelist]").val();
726 var textarray = textarea.split(/[\s,;]+/);
728 duplicatedbatchcode = [];
734 textarray = textarray.filter(function(value){
737 if(textarray.some((element) => element != "")){
738 $(".expectedqty").each(function(){
740 console.log("Analyze the line "+id+" in inventory, barcodemode="+barcodemode);
741 warehouse = $("#"+id+"_warehouse").attr(\'data-ref\');
742 //console.log(warehouse);
743 productbarcode = $("#"+id+"_product").attr(\'data-barcode\');
744 //console.log(productbarcode);
745 productbatchcode = $("#"+id+"_batch").attr(\'data-batch\');
746 //console.log(productbatchcode);
748 if (barcodemode != "barcodeforproduct") {
749 tabproduct.forEach(product=>{
750 console.log("product.Batch="+product.Batch+" productbatchcode="+productbatchcode);
751 if(product.Batch != "" && product.Batch == productbatchcode){
752 console.log("duplicate batch code found for batch code "+productbatchcode);
753 duplicatedbatchcode.push(productbatchcode);
757 productinput = $("#"+id+"_input").val();
758 if(productinput == ""){
761 tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
764 console.log("Loop on each record entered in the textarea");
765 textarray.forEach(function(element,index){
766 console.log("Process record element="+element+" id="+id);
767 var verify_batch = false;
768 var verify_barcode = false;
770 case "barcodeforautodetect":
771 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode",true);
772 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial",true);
774 case "barcodeforproduct":
775 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode");
777 case "barcodeforlotserial":
778 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial");
781 alert(\''.dol_escape_js($langs->trans(
"ErrorWrongBarcodemode")).
' "\'+barcodemode+\'"\');
782 throw \''.
dol_escape_js($langs->trans(
'ErrorWrongBarcodemode')).
' "\'+barcodemode+\'"\';
785 if (verify_batch == false && verify_barcode == false) { /* If the 2 flags are false, not found error */
786 errortab2.push(element);
787 } else if (verify_batch == true && verify_barcode == true) { /* If the 2 flags are true, error: we don t know which one to take */
788 errortab3.push(element);
789 } else if (verify_batch == true) {
790 console.log("element="+element);
791 console.log(duplicatedbatchcode);
792 if (duplicatedbatchcode.includes(element)) {
793 errortab1.push(element);
798 if (Object.keys(errortab1).length < 1 && Object.keys(errortab2).length < 1 && Object.keys(errortab3).length < 1) {
799 tabproduct.forEach(product => {
801 console.log("We change #"+product.Id+"_input to match input in scanner box");
802 if(product.hasOwnProperty("reelqty")){
803 $.ajax({ url: \''.DOL_URL_ROOT.
'/product/inventory/ajax/searchfrombarcode.php\',
804 data: { "token":"'.newToken().
'", "action":"addnewlineproduct", "fk_entrepot":product.Warehouse, "batch":product.Batch, "fk_inventory":'.
dol_escape_js((
string)
$object->id).
', "fk_product":product.fk_product, "reelqty":product.reelqty},
807 success: function(response) {
808 response = JSON.parse(response);
809 if(response.status == "success"){
810 console.log(response.message);
811 $("<input type=\'text\' value=\'"+product.Qty+"\' />")
812 .attr("id", "id_"+response.id_line+"_input")
813 .attr("name", "id_"+response.id_line)
814 .appendTo("#formrecord");
816 console.error(response.message);
819 error : function(output) {
820 console.error("Error on line creation function");
824 $("#"+product.Id+"_input").val(product.Qty);
828 jQuery("#scantoolmessage").text("'.
dol_escape_js($langs->transnoentities(
"QtyWasAddedToTheScannedBarcode")).
'\n");
829 /* document.forms["formrecord"].submit(); */
831 let stringerror = "";
832 if (Object.keys(errortab1).length > 0) {
833 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorSameBatchNumber')).
': ";
834 errortab1.forEach(element => {
835 stringerror += (element + ", ")
837 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
839 if (Object.keys(errortab2).length > 0) {
840 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCantFindCodeInInventory')).
': ";
841 errortab2.forEach(element => {
842 stringerror += (element + ", ")
844 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
846 if (Object.keys(errortab3).length > 0) {
847 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCodeScannedIsBothProductAndSerial')).
': ";
848 errortab3.forEach(element => {
849 stringerror += (element + ", ")
851 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
853 if (Object.keys(errortab4).length > 0) {
854 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorBarcodeNotFoundForProductWarehouse')).
': ";
855 errortab4.forEach(element => {
856 stringerror += (element + ", ")
858 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
861 jQuery("#scantoolmessage").html(\''.
dol_escape_js($langs->transnoentities(
"ErrorOnElementsInventory")).
'\' + stringerror);
869 function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,mode,autodetect=
false){
870 BarcodeIsInProduct=0;
873 tabproduct.forEach(product => {
874 $.ajax({ url: \
''.DOL_URL_ROOT.
'/product/inventory/ajax/searchfrombarcode.php\',
875 data: { "token":"'.newToken().
'", "action":"existbarcode", '.(!empty(
$object->fk_warehouse) ?
'"fk_entrepot":'.$object->fk_warehouse.
', ' :
'').(!empty(
$object->fk_product) ?
'"fk_product":'.$object->fk_product.
', ' :
'').
'"barcode":element, "product":product, "mode":mode},
878 success: function(response) {
879 response = JSON.parse(response);
880 if (response.status == "success"){
881 console.log(response.message);
883 newproductrow = response.object;
886 if (mode!="lotserial" && autodetect==false && !errortab4.includes(element)){
887 errortab4.push(element);
888 console.error(response.message);
892 error : function(output) {
893 console.error("Error on barcodeserialforproduct function");
896 console.log("Product "+(index+=1)+": "+element);
897 if(mode == "barcode"){
898 testonproduct = product.Barcode
899 }else if (mode == "lotserial"){
900 testonproduct = product.Batch
902 if(testonproduct == element){
903 if(selectaddorreplace == "add"){
904 productqty = parseInt(product.Qty,10);
905 product.Qty = productqty + parseInt(barcodeproductqty,10);
906 }else if(selectaddorreplace == "replace"){
907 if(product.fetched == false){
908 product.Qty = barcodeproductqty
911 productqty = parseInt(product.Qty,10);
912 product.Qty = productqty + parseInt(barcodeproductqty,10);
915 BarcodeIsInProduct+=1;
918 if(BarcodeIsInProduct==0 && newproductrow!=0){
919 tabproduct.push({\'Id\':tabproduct.length-1,\'Warehouse\':newproductrow.fk_warehouse,\'Barcode\':mode=="barcode"?element:null,\'Batch\':mode=="lotserial"?element:null,\'Qty\':barcodeproductqty,\'fetched\':true,\'reelqty\':newproductrow.reelqty,\'fk_product\':newproductrow.fk_product,\'mode\':mode});
922 if(BarcodeIsInProduct > 0){
930 include DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
932 print $formother->getHTMLScannerForm(
"barcodescannerjs",
'all');
937print
'jQuery(document).ready(function() {
938 $("#clearqty").on("click", function() {
939 console.log("Clear all values");
940 /* disablebuttonmakemovementandclose(); */
941 jQuery(".realqty").val("");
942 jQuery(".realqty").trigger("change");
943 return false; /* disable submit */
945 $(".undochangesqty").on("click", function undochangesqty() {
946 console.log("Clear value of inventory line");
948 id = id.split("_")[1];
949 tmpvalue = $("#id_"+id+"_input_tmp").val()
950 $("#id_"+id+"_input")[0].value = tmpvalue;
951 /* disablebuttonmakemovementandclose(); */
952 return false; /* disable submit */
957print
'<div class="fichecenter">';
959print
'<div class="clearboth"></div>';
963print
'<div class="div-table-responsive-no-min">';
964print
'<table id="tablelines" class="noborder noshadow centpercent">';
966print
'<tr class="liste_titre">';
967print
getTitleFieldOfList($langs->trans(
"Warehouse"), 0, $_SERVER[
'PHP_SELF'],
'e.ref',
'',
'id=' .
$object->id .
'&page=' . $page . $param,
'', $sortfield, $sortorder,
'', 0,
'') .
"\n";
968print
getTitleFieldOfList($langs->trans(
"Product"), 0, $_SERVER[
'PHP_SELF'],
'p.ref',
'',
'id=' .
$object->id .
'&page=' . $page . $param,
'', $sortfield, $sortorder,
'', 0,
'') .
"\n";
971 print $langs->trans(
"Batch");
974if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
976 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ExpectedQty"), $langs->trans(
"QtyCurrentlyKnownInStock")).
'</td>';
979 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ExpectedQty"), $langs->trans(
"QtyInStockWhenInventoryWasValidated")).
'</td>';
982 print
'<td class="right">'.$langs->trans(
'PMPExpected').
'</td>';
983 print
'<td class="right">'.$langs->trans(
'ExpectedValuation').
'</td>';
984 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"RealQty"), $langs->trans(
"InventoryRealQtyHelp")).
'</td>';
985 print
'<td class="right">'.$langs->trans(
'PMPReal').
'</td>';
986 print
'<td class="right">'.$langs->trans(
'RealValuation').
'</td>';
988 print
'<td class="right">';
989 print $form->textwithpicto($langs->trans(
"RealQty"), $langs->trans(
"InventoryRealQtyHelp"));
992if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
994 print
'<td class="center">';
998 print
'<td class="right">';
1005if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1008 print $formproduct->selectWarehouses((GETPOSTISSET(
'fk_warehouse') ?
GETPOSTINT(
'fk_warehouse') :
$object->fk_warehouse),
'fk_warehouse',
'warehouseopen', 1, 0, 0,
'', 0, 0, array(),
'maxwidth300');
1016 print $form->select_produits((GETPOSTISSET(
'fk_product') ?
GETPOSTINT(
'fk_product') :
$object->fk_product),
'fk_product', $filtertype, 0, 0, -1, 2,
'', 0, array(), 0,
'1', 0,
'maxwidth300');
1020 print
'<input type="text" name="batch" class="maxwidth100" value="'.(GETPOSTISSET(
'batch') ?
GETPOST(
'batch') :
'').
'">';
1023 print
'<td class="right"></td>';
1025 print
'<td class="right">';
1027 print
'<td class="right">';
1029 print
'<td class="right">';
1030 print
'<input type="text" name="qtytoadd" class="maxwidth75" value="">';
1032 print
'<td class="right">';
1034 print
'<td class="right">';
1037 print
'<td class="right">';
1038 print
'<input type="text" name="qtytoadd" class="maxwidth75" value="">';
1042 print
'<td class="center">';
1043 if ($permissiontoupdatestock) {
1044 print
'<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans(
"Add").
'">';
1046 print
'<input type="submit" class="button paddingright" disabled="disabled" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'" name="addline" value="'.$langs->trans(
"Add").
'">';
1053$sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
1054$sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
1055$sql .=
' FROM ' .
$db->prefix() .
'inventorydet as id';
1056$sql .=
' LEFT JOIN ' .
$db->prefix() .
'product as p ON id.fk_product = p.rowid';
1057$sql .=
' LEFT JOIN ' .
$db->prefix() .
'entrepot as e ON id.fk_warehouse = e.rowid';
1058$sql .=
' WHERE id.fk_inventory = ' . ((int)
$object->id);
1059$sql .=
$db->order($sortfield, $sortorder);
1060$sql .=
$db->plimit($limit, $offset);
1062$cacheOfProducts = array();
1063$cacheOfWarehouses = array();
1066$resql =
$db->query($sql);
1068 $num =
$db->num_rows($resql);
1070 if (!empty($limit != 0) || $num > $limit || $page) {
1071 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"],
'&id='.
$object->id.$paramwithsearch, ($num >= $limit ? 1 : 0),
'<li class="pagination"><span>' . $langs->trans(
"Page") .
' ' . ($page + 1) .
'</span></li>',
'', $limit);
1078 $obj =
$db->fetch_object($resql);
1080 if (isset($cacheOfWarehouses[$obj->fk_warehouse])) {
1081 $warehouse_static = $cacheOfWarehouses[$obj->fk_warehouse];
1084 $warehouse_static->fetch($obj->fk_warehouse);
1086 $cacheOfWarehouses[$warehouse_static->id] = $warehouse_static;
1091 if (isset($cacheOfProducts[$obj->fk_product])) {
1092 $product_static = $cacheOfProducts[$obj->fk_product];
1095 $result = $product_static->fetch($obj->fk_product,
'',
'',
'', 1, 1, 1);
1098 $option .=
',novirtual';
1099 $product_static->load_stock($option);
1101 $cacheOfProducts[$product_static->id] = $product_static;
1104 print
'<tr class="oddeven">';
1105 print
'<td id="id_'.$obj->rowid.
'_warehouse" data-ref="'.
dol_escape_htmltag($warehouse_static->ref).
'">';
1106 print $warehouse_static->getNomUrl(1);
1109 print $product_static->getNomUrl(1).
' - '.$product_static->label;
1113 print
'<td id="id_'.$obj->rowid.
'_batch" data-batch="'.
dol_escape_htmltag($obj->batch).
'">';
1116 $res = $batch_static->fetch(0, $product_static->id, $obj->batch);
1118 print $batch_static->getNomUrl(1);
1127 print
'<td class="right expectedqty" id="id_'.$obj->rowid.
'" title="Stock viewed at last update: '.$obj->qty_stock.
'">';
1128 $valuetoshow = $obj->qty_stock;
1130 if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1131 if (
isModEnabled(
'productbatch') && $product_static->hasbatch()) {
1132 $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty ?? 0;
1134 $valuetoshow = !empty($product_static->stock_warehouse[$obj->fk_warehouse]->real) ? $product_static->stock_warehouse[$obj->fk_warehouse]->real : 0;
1138 print
'<input type="hidden" name="stock_qty_'.$obj->rowid.
'" value="'.$valuetoshow.
'">';
1142 if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1146 if ($qty_view !=
'') {
1152 if (!empty($obj->pmp_expected)) {
1153 $pmp_expected = $obj->pmp_expected;
1155 $pmp_expected = $product_static->pmp;
1157 $pmp_valuation = $pmp_expected * $valuetoshow;
1158 print
'<td class="right">';
1159 print is_null($pmp_expected) ?
'' :
price($pmp_expected);
1160 print
'<input type="hidden" name="expectedpmp_'.$obj->rowid.
'" value="'.$pmp_expected.
'"/>';
1162 print
'<td class="right">';
1163 print
price($pmp_valuation);
1166 print
'<td class="right">';
1167 print
'<a id="undochangesqty_'.$obj->rowid.
'" href="#" class="undochangesqty reposition marginrightonly" title="'.
dol_escape_htmltag($langs->trans(
"Clear")).
'">';
1168 print
img_picto(
'',
'eraser',
'class="opacitymedium"');
1170 print
'<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input" value="'.$qty_view.
'">';
1174 print
'<td class="right">';
1175 if (!empty($obj->pmp_real) || (
string) $obj->pmp_real ===
'0') {
1176 $pmp_real = $obj->pmp_real;
1178 $pmp_real = $product_static->pmp;
1180 $pmp_valuation_real = $pmp_real * $qty_view;
1181 print
'<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.
'" name="realpmp_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input_pmp" value="'.(is_null($pmp_real) ?
'' :
price2num($pmp_real)).
'">';
1183 print
'<td class="right">';
1184 print
'<input type="text" class="maxwidth75 right realvaluation'.$obj->fk_product.
'" name="realvaluation_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input_real_valuation" value="'.$pmp_valuation_real.
'">';
1187 $totalExpectedValuation += $pmp_valuation;
1188 $totalRealValuation += $pmp_valuation_real;
1190 print
'<td class="right">';
1191 print
'<a id="undochangesqty_'.$obj->rowid.
'" href="#" class="undochangesqty reposition marginrightonly" title="'.
dol_escape_htmltag($langs->trans(
"Clear")).
'">';
1192 print
img_picto(
'',
'eraser',
'class="opacitymedium"');
1194 print
'<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input" value="'.$qty_view.
'">';
1199 print
'<td class="right">';
1200 if ($permissiontoupdatestock) {
1201 print
'<a class="reposition" href="'.DOL_URL_ROOT.
'/product/inventory/inventory.php?id='.
$object->id.
'&lineid='.$obj->rowid.
'&action=deleteline&page='.$page.$paramwithsearch.
'&token='.newToken().
'">'.
img_delete().
'</a>';
1203 $qty_tmp =
price2num(
GETPOST(
"id_".$obj->rowid.
"_input_tmp"),
'MS') >= 0 ?
GETPOST(
"id_".$obj->rowid.
"_input_tmp") : $qty_view;
1204 print
'<input type="hidden" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'_input_tmp" id="id_'.$obj->rowid.
'_input_tmp" value="'.$qty_tmp.
'">';
1209 if (!empty($obj->pmp_expected)) {
1210 $pmp_expected = $obj->pmp_expected;
1212 $pmp_expected = $product_static->pmp;
1214 $pmp_valuation = $pmp_expected * $valuetoshow;
1215 print
'<td class="right">';
1216 print is_null($pmp_expected) ?
'' :
price($pmp_expected);
1218 print
'<td class="right">';
1219 print
price($pmp_valuation);
1222 print
'<td class="right nowraponall">';
1223 print $obj->qty_view;
1227 print
'<td class="right">';
1228 if (!empty($obj->pmp_real)) {
1229 $pmp_real = $obj->pmp_real;
1231 $pmp_real = $product_static->pmp;
1233 $pmp_valuation_real = $pmp_real * $obj->qty_view;
1234 print is_null($pmp_real) ?
'' :
price($pmp_real);
1236 print
'<td class="right">';
1237 print
price($pmp_valuation_real);
1239 print
'<td class="nowraponall right">';
1241 $totalExpectedValuation += $pmp_valuation;
1242 $totalRealValuation += $pmp_valuation_real;
1244 print
'<td class="right nowraponall">';
1245 print $obj->qty_view;
1249 if ($obj->fk_movement > 0) {
1251 $stockmovment->fetch($obj->fk_movement);
1252 print $stockmovment->getNomUrl(1,
'movements');
1264 print
'<tr class="liste_total">';
1265 print
'<td colspan="4">'.$langs->trans(
"Total").
'</td>';
1266 print
'<td class="right" colspan="2">'.price($totalExpectedValuation).
'</td>';
1267 print
'<td class="right" id="totalRealValuation" colspan="3">'.price($totalRealValuation).
'</td>';
1275if (
$object->status == $object::STATUS_VALIDATED) {
1276 print
'<center><input id="submitrecord" type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'"></center>';
1296print
'<script type="text/javascript">
1297 $(document).ready(function() {
1299 $(".paginationnext:last").click(function(e){
1300 var form = $("#formrecord");
1301 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1304 data: form.serialize(),
1306 success: function(result){
1307 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page + 1).$paramwithsearch.
'";
1313 $(".paginationprevious:last").click(function(e){
1314 var form = $("#formrecord");
1315 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1318 data: form.serialize(),
1320 success: function(result){
1321 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page - 1).$paramwithsearch.
'";
1326 $("#idbuttonmakemovementandclose").click(function(e){
1327 var form = $("#formrecord");
1328 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1332 data: form.serialize(),
1334 success: function(result){
1335 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'&action=record";
1345<script
type=
"text/javascript">
1346$(
'.realqty').on(
'change',
function () {
1347 let realqty = $(
this).closest(
'tr').find(
'.realqty').val();
1348 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1349 let realpmp = $(inputPmp).val();
1350 if (!isNaN(realqty) && !isNaN(realpmp)) {
1351 let realval = realqty * realpmp;
1352 $(
this).closest(
'tr').find(
'input[name^=realvaluation]').val(realval.toFixed(2));
1354 updateTotalValuation();
1357$(
'input[class*=realpmp]').on(
'change',
function () {
1358 let inputQtyReal = $(
this).closest(
'tr').find(
'.realqty');
1359 let realqty = $(inputQtyReal).val();
1360 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1361 console.log(inputPmp);
1362 let realPmpClassname = $(inputPmp).attr(
'class').match(/[\w-]*realpmp[\w-]*/g)[0];
1363 let realpmp = $(inputPmp).val();
1364 if (!isNaN(realpmp)) {
1365 $(
'.'+realPmpClassname).val(realpmp);
1367 if (!isNaN(realqty)) {
1368 let realval = realqty * realpmp;
1369 $(
this).closest(
'tr').find(
'input[name^=realvaluation]').val(realval.toFixed(2));
1371 $(
'.realqty').trigger(
'change');
1372 updateTotalValuation();
1376$(
'input[name^=realvaluation]').on(
'change',
function () {
1377 let inputQtyReal = $(
this).closest(
'tr').find(
'.realqty');
1378 let realqty = $(inputQtyReal).val();
1379 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1380 let inputRealValuation = $(
this).closest(
'tr').find(
'input[name^=realvaluation]');
1381 let realPmpClassname = $(inputPmp).attr(
'class').match(/[\w-]*realpmp[\w-]*/g)[0];
1382 let realvaluation = $(inputRealValuation).val();
1383 if (!isNaN(realvaluation) && !isNaN(realqty) && realvaluation !==
'' && realqty !==
'' && realqty !== 0) {
1384 let realpmp = realvaluation / realqty
1385 $(
'.'+realPmpClassname).val(realpmp);
1386 $(
'.realqty').trigger(
'change');
1387 updateTotalValuation();
1391function updateTotalValuation() {
1393 $(
'input[name^=realvaluation]').each(
function( index ) {
1394 let val = $(
this).val();
1395 if(!isNaN(val)) total += parseFloat($(
this).val());
1397 let currencyFractionDigits =
new Intl.NumberFormat(
'fr-FR', {
1400 }).resolvedOptions().maximumFractionDigits;
1401 $(
'#totalRealValuation').html(total.toLocaleString(
'fr-FR', {
1402 maximumFractionDigits: currencyFractionDigits
$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 warehouses.
Class to manage stock movements.
Class to manage products or services.
Class with list of lots and properties.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $selectlimitsuffix='', $beforearrows='', $hidenavigation=0)
Function to show navigation arrows into lists.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
inventoryPrepareHead(&$inventory, $title='Inventory', $get='')
Define head array for tabs of inventory tools setup pages.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
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.