26require
'../../main.inc.php';
27include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28include_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
29include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
30include_once DOL_DOCUMENT_ROOT.
'/product/inventory/class/inventory.class.php';
31include_once DOL_DOCUMENT_ROOT.
'/product/inventory/lib/inventory.lib.php';
32include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
33include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
36$langs->loadLangs(array(
"stocks",
"other",
"productbatch"));
41$action =
GETPOST(
'action',
'aZ09');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$cancel =
GETPOST(
'cancel',
'aZ09');
44$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'inventorycard';
45$backtopage =
GETPOST(
'backtopage',
'alpha');
46$listoffset =
GETPOST(
'listoffset',
'alpha');
47$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
48$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
51if (empty($page) || $page == -1) {
54$offset = $limit * $page;
61$batch =
GETPOST(
'batch',
'alphanohtml');
62$totalExpectedValuation = 0;
63$totalRealValuation = 0;
64$hookmanager->initHooks(array(
'inventorycard'));
68 $result =
restrictedArea($user,
'stock', $id,
'',
'inventory_advance');
74$diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
85$extrafields->fetch_name_optionals_label(
$object->table_element);
87$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
90$search_all =
GETPOST(
"search_all",
'alpha');
92foreach (
$object->fields as $key => $val) {
93 if (
GETPOST(
'search_'.$key,
'alpha')) {
94 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
98if (empty($action) && empty($id) && empty($ref)) {
103include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
111$paramwithsearch =
'&sortfield=' . urlencode($sortfield);
112$paramwithsearch .=
'&sortorder=' . urlencode($sortorder);
113if ($limit > 0 && $limit != $conf->liste_limit) {
114 $paramwithsearch .=
'&limit='.((int) $limit);
119 $permissiontoadd = $user->hasRight(
'stock',
'creer');
120 $permissiontodelete = $user->hasRight(
'stock',
'supprimer');
121 $permissiontoupdatestock = $user->hasRight(
'stock',
'mouvement',
'creer');
123 $permissiontoadd = $user->hasRight(
'stock',
'inventory_advance',
'write');
124 $permissiontodelete = $user->hasRight(
'stock',
'inventory_advance',
'write');
125 $permissiontoupdatestock = $user->hasRight(
'stock',
'inventory_advance',
'write');
141$parameters = array();
142$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
147if (empty($reshook)) {
150 if ($action ==
'cancel_record' && $permissiontoupdatestock) {
155 if ($action ==
'update' && $permissiontoupdatestock &&
$object->status == $object::STATUS_VALIDATED) {
159 $cacheOfProducts = array();
163 $sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
164 $sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real';
165 $sql .=
' FROM '.MAIN_DB_PREFIX.
'inventorydet as id';
166 $sql .=
' WHERE id.fk_inventory = '.((int)
$object->id);
167 $sql .=
' ORDER BY id.rowid';
169 $resql = $db->query($sql);
171 $num = $db->num_rows($resql);
173 $totalarray = array();
177 $line = $db->fetch_object($resql);
179 $qty_stock = $line->qty_stock;
180 $qty_view = $line->qty_view;
184 if (isset($cacheOfProducts[$line->fk_product])) {
185 $product_static = $cacheOfProducts[$line->fk_product];
187 $product_static =
new Product($db);
188 $result = $product_static->fetch($line->fk_product,
'',
'',
'', 1, 1, 1);
191 $option .=
',novirtual';
192 $product_static->load_stock($option);
194 $cacheOfProducts[$product_static->id] = $product_static;
198 $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->real;
199 if (isModEnabled(
'productbatch') && $product_static->hasbatch()) {
200 $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->detail_batch[$line->batch]->qty;
203 if (!is_null($qty_view)) {
204 $stock_movement_qty =
price2num($qty_view - $realqtynow,
'MS');
207 if ($stock_movement_qty != 0) {
208 if ($stock_movement_qty < 0) {
216 $inventorycode =
'INV-'.$object->ref;
219 $price = $line->pmp_real;
222 $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans(
'LabelOfInventoryMovemement',
$object->ref), $inventorycode, $datemovement,
'',
'', $line->batch);
223 if ($idstockmove < 0) {
230 $sqlupdate =
"UPDATE ".MAIN_DB_PREFIX.
"inventorydet";
231 $sqlupdate .=
" SET fk_movement = ".((int) $idstockmove);
232 if ($qty_stock != $realqtynow) {
233 $sqlupdate .=
", qty_stock = ".((float) $realqtynow);
235 $sqlupdate .=
" WHERE rowid = ".((int) $line->rowid);
236 $resqlupdate = $db->query($sqlupdate);
237 if (! $resqlupdate) {
245 $sqlpmp =
'UPDATE '.MAIN_DB_PREFIX.
'product SET pmp = '.((float) $line->pmp_real).
' WHERE rowid = '.((int) $line->fk_product);
246 $resqlpmp = $db->query($sqlpmp);
253 $sqlpmp =
'UPDATE '.MAIN_DB_PREFIX.
'product_perentity SET pmp = '.((float) $line->pmp_real).
' WHERE fk_product = '.((int) $line->fk_product).
' AND entity='.$conf->entity;
254 $resqlpmp = $db->query($sqlpmp);
282 if ($action ==
'updateinventorylines' && $permissiontoupdatestock) {
283 $sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
284 $sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
285 $sql .=
' FROM '.MAIN_DB_PREFIX.
'inventorydet as id';
286 $sql .=
' WHERE id.fk_inventory = '.((int)
$object->id);
287 $sql .= $db->order(
'id.rowid',
'ASC');
288 $sql .= $db->plimit($limit, $offset);
292 $resql = $db->query($sql);
294 $num = $db->num_rows($resql);
296 $totalarray = array();
300 $line = $db->fetch_object($resql);
301 $lineid = $line->rowid;
306 if (
GETPOST(
"id_".$lineid,
'alpha') !=
'') {
308 $result = $inventoryline->fetch($lineid);
309 if ($qtytoupdate < 0) {
311 setEventMessages($langs->trans(
"FieldCannotBeNegative", $langs->transnoentitiesnoconv(
"RealQty")),
null,
'errors');
314 $inventoryline->qty_stock = (float)
price2num(
GETPOST(
'stock_qty_'.$lineid,
'alpha'),
'MS');
315 $inventoryline->qty_view = $qtytoupdate;
316 $inventoryline->pmp_real =
price2num(
GETPOST(
'realpmp_'.$lineid,
'alpha'),
'MS');
317 $inventoryline->pmp_expected =
price2num(
GETPOST(
'expectedpmp_'.$lineid,
'alpha'),
'MS');
318 $resultupdate = $inventoryline->update($user);
320 } elseif (GETPOSTISSET(
'id_' . $lineid)) {
322 $result = $inventoryline->fetch($lineid);
324 $inventoryline->qty_view =
null;
325 $inventoryline->pmp_real =
price2num(
GETPOST(
'realpmp_'.$lineid,
'alpha'),
'MS');
326 $inventoryline->pmp_expected =
price2num(
GETPOST(
'expectedpmp_'.$lineid,
'alpha'),
'MS');
327 $resultupdate = $inventoryline->update($user);
331 if ($result < 0 || $resultupdate < 0) {
341 $sqlupdate =
"UPDATE ".MAIN_DB_PREFIX.
"inventory";
342 $sqlupdate .=
" SET fk_user_modif = ".((int) $user->id);
343 $sqlupdate .=
" WHERE rowid = ".((int)
$object->id);
344 $resqlupdate = $db->query($sqlupdate);
345 if (! $resqlupdate) {
358 $backurlforlist = DOL_URL_ROOT.
'/product/inventory/list.php';
359 $backtopage = DOL_URL_ROOT.
'/product/inventory/inventory.php?id='.
$object->id.
'&page='.$page.$paramwithsearch;
362 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
365 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
368 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
376 if (
GETPOST(
'addline',
'alpha')) {
378 if ($fk_warehouse <= 0) {
380 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
382 if ($fk_product <= 0) {
384 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
388 setEventMessages($langs->trans(
"FieldCannotBeNegative", $langs->transnoentitiesnoconv(
"RealQty")),
null,
'errors');
390 if (!$error && isModEnabled(
'productbatch')) {
391 $tmpproduct =
new Product($db);
392 $result = $tmpproduct->fetch($fk_product);
394 if (empty($error) && $tmpproduct->status_batch > 0 && empty($batch)) {
396 $langs->load(
"errors");
397 setEventMessages($langs->trans(
"ErrorProductNeedBatchNumber", $tmpproduct->ref),
null,
'errors');
399 if (empty($error) && $tmpproduct->status_batch == 2 && !empty($batch) && $qty > 1) {
401 $langs->load(
"errors");
402 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $tmpproduct->ref, $batch),
null,
'errors');
404 if (empty($error) && empty($tmpproduct->status_batch) && !empty($batch)) {
406 $langs->load(
"errors");
407 setEventMessages($langs->trans(
"ErrorProductDoesNotNeedBatchNumber", $tmpproduct->ref),
null,
'errors');
412 $tmp->fk_inventory =
$object->id;
413 $tmp->fk_warehouse = $fk_warehouse;
414 $tmp->fk_product = $fk_product;
415 $tmp->batch = $batch;
417 $tmp->qty_view = $qty;
419 $result = $tmp->create($user);
421 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
422 $langs->load(
"errors");
423 setEventMessages($langs->trans(
"ErrorRecordAlreadyExists"),
null,
'errors');
429 $_POST[
'batch'] =
'';
430 $_POST[
'qtytoadd'] =
'';
442$form =
new Form($db);
447llxHeader(
'', $langs->trans(
'Inventory'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-inventory_inventory');
456if ($limit > 0 && $limit != $conf->liste_limit) {
457 $param .=
'&limit=' . ((int) $limit);
461$res =
$object->fetch_optionals();
469if ($action ==
'delete') {
470 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteInventory'), $langs->trans(
'ConfirmDeleteOrder'),
'confirm_delete',
'', 0, 1);
473if ($action ==
'deleteline') {
474 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid.
'&page='.$page.$paramwithsearch, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
478if ($action ==
'clone') {
480 $formquestion = array();
481 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMyObject',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
485if ($action ==
'record') {
486 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&page='.$page.$paramwithsearch, $langs->trans(
'Close'), $langs->trans(
'ConfirmFinish'),
'update',
'', 0, 1);
491if ($action ==
'confirm_cancel') {
492 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Cancel'), $langs->trans(
'ConfirmCancel'),
'cancel_record',
'', 0, 1);
496if ($action ==
'validate') {
497 $form =
new Form($db);
500 $formquestion = array(
501 array(
'type' =>
'checkbox',
'name' =>
'include_sub_warehouse',
'label' => $langs->trans(
"IncludeSubWarehouse"),
'value' => 1,
'size' =>
'10'),
503 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateInventory'), $langs->trans(
'IncludeSubWarehouseExplanation'),
'confirm_validate', $formquestion,
'', 1);
508$parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
509$reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
510if (empty($reshook)) {
511 $formconfirm .= $hookmanager->resPrint;
512} elseif ($reshook > 0) {
513 $formconfirm = $hookmanager->resPrint;
522$linkback =
'<a href="'.DOL_URL_ROOT.
'/product/inventory/list.php">'.$langs->trans(
"BackToList").
'</a>';
524$morehtmlref =
'<div class="refidno">';
564$morehtmlref .=
'</div>';
567dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
570print
'<div class="fichecenter">';
571print
'<div class="fichehalfleft">';
572print
'<div class="underbanner clearboth"></div>';
573print
'<table class="border centpercent tableforfield">'.
"\n";
576include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
579include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
587print
'<div class="clearboth"></div>';
591print
'<form id="formrecord" name="formrecord" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?page='.$page.
'&id='.
$object->id.
'">';
592print
'<input type="hidden" name="token" value="'.newToken().
'">';
593print
'<input type="hidden" name="action" value="updateinventorylines">';
594print
'<input type="hidden" name="id" value="'.$object->id.
'">';
595print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
596print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
598 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
603if ($action !=
'record') {
604 print
'<div class="tabsAction">'.
"\n";
605 $parameters = array();
606 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
611 if (empty($reshook)) {
612 if (
$object->status == Inventory::STATUS_DRAFT) {
613 if ($permissiontoupdatestock) {
615 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
' ('.$langs->trans(
"Start").
')</a>';
617 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>';
620 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Validate').
' ('.$langs->trans(
"Start").
')</a>'.
"\n";
625 if (
$object->status == $object::STATUS_VALIDATED) {
626 if ($permissiontoupdatestock) {
627 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";
629 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'MakeMovementsAndClose').
'</a>'.
"\n";
632 if ($permissiontoupdatestock) {
633 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_cancel&page='.$page.$paramwithsearch.
'&token='.
newToken().
'">'.$langs->trans(
"Cancel").
'</a>'.
"\n";
639 if (
$object->status != Inventory::STATUS_DRAFT &&
$object->status != Inventory::STATUS_VALIDATED) {
646if (
$object->status == Inventory::STATUS_VALIDATED) {
648 if (!empty($conf->use_javascript_ajax)) {
649 if ($permissiontoupdatestock) {
651 if (isModEnabled(
'barcode') || isModEnabled(
'productbatch')) {
652 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>';
656 print
'<a id="fillwithexpected" class="marginrightonly paddingright marginleftonly paddingleft" href="#">'.img_picto(
'',
'autofill',
'class="paddingrightonly"').$langs->trans(
'AutofillWithExpected').
'</a>';
658 print
'$( document ).ready(function() {';
659 print
' $("#fillwithexpected").on("click",function fillWithExpected(){
660 $(".expectedqty").each(function(){
661 var object = $(this)[0];
662 var objecttofill = $("#"+object.id+"_input")[0];
663 objecttofill.value = object.innerText;
664 jQuery(".realqty").trigger("change");
666 console.log("Values filled (after click on fillwithexpected)");
667 /* disablebuttonmakemovementandclose(); */
674 print
'<a href="#" id="clearqty" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto(
'',
'eraser',
'class="paddingrightonly"').$langs->trans(
"ClearQtys").
'</a>';
676 print
'<a class="classfortooltip marginrightonly paddingright marginleftonly paddingleft" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Save").
'</a>'.
"\n";
686if ($action ==
'updatebyscaning') {
687 if ($permissiontoupdatestock) {
692 var duplicatedbatchcode = [];
698 function barcodescannerjs(){
699 console.log("We catch inputs in scanner box");
700 jQuery("#scantoolmessage").text();
702 var selectaddorreplace = $("select[name=selectaddorreplace]").val();
703 var barcodemode = $("input[name=barcodemode]:checked").val();
704 var barcodeproductqty = $("input[name=barcodeproductqty]").val();
705 var textarea = $("textarea[name=barcodelist]").val();
706 var textarray = textarea.split(/[\s,;]+/);
708 duplicatedbatchcode = [];
714 textarray = textarray.filter(function(value){
717 if(textarray.some((element) => element != "")){
718 $(".expectedqty").each(function(){
720 console.log("Analyze the line "+id+" in inventory, barcodemode="+barcodemode);
721 warehouse = $("#"+id+"_warehouse").attr(\'data-ref\');
722 //console.log(warehouse);
723 productbarcode = $("#"+id+"_product").attr(\'data-barcode\');
724 //console.log(productbarcode);
725 productbatchcode = $("#"+id+"_batch").attr(\'data-batch\');
726 //console.log(productbatchcode);
728 if (barcodemode != "barcodeforproduct") {
729 tabproduct.forEach(product=>{
730 console.log("product.Batch="+product.Batch+" productbatchcode="+productbatchcode);
731 if(product.Batch != "" && product.Batch == productbatchcode){
732 console.log("duplicate batch code found for batch code "+productbatchcode);
733 duplicatedbatchcode.push(productbatchcode);
737 productinput = $("#"+id+"_input").val();
738 if(productinput == ""){
741 tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
744 console.log("Loop on each record entered in the textarea");
745 textarray.forEach(function(element,index){
746 console.log("Process record element="+element+" id="+id);
747 var verify_batch = false;
748 var verify_barcode = false;
750 case "barcodeforautodetect":
751 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode",true);
752 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial",true);
754 case "barcodeforproduct":
755 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode");
757 case "barcodeforlotserial":
758 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial");
761 alert(\''.dol_escape_js($langs->trans(
"ErrorWrongBarcodemode")).
' "\'+barcodemode+\'"\');
762 throw \''.
dol_escape_js($langs->trans(
'ErrorWrongBarcodemode')).
' "\'+barcodemode+\'"\';
765 if (verify_batch == false && verify_barcode == false) { /* If the 2 flags are false, not found error */
766 errortab2.push(element);
767 } else if (verify_batch == true && verify_barcode == true) { /* If the 2 flags are true, error: we don t know which one to take */
768 errortab3.push(element);
769 } else if (verify_batch == true) {
770 console.log("element="+element);
771 console.log(duplicatedbatchcode);
772 if (duplicatedbatchcode.includes(element)) {
773 errortab1.push(element);
778 if (Object.keys(errortab1).length < 1 && Object.keys(errortab2).length < 1 && Object.keys(errortab3).length < 1) {
779 tabproduct.forEach(product => {
781 console.log("We change #"+product.Id+"_input to match input in scanner box");
782 if(product.hasOwnProperty("reelqty")){
783 $.ajax({ url: \''.DOL_URL_ROOT.
'/product/inventory/ajax/searchfrombarcode.php\',
784 data: { "token":"'.
newToken().
'", "action":"addnewlineproduct", "fk_entrepot":product.Warehouse, "batch":product.Batch, "fk_inventory":'.
dol_escape_js(
$object->id).
', "fk_product":product.fk_product, "reelqty":product.reelqty},
787 success: function(response) {
788 response = JSON.parse(response);
789 if(response.status == "success"){
790 console.log(response.message);
791 $("<input type=\'text\' value=\'"+product.Qty+"\' />")
792 .attr("id", "id_"+response.id_line+"_input")
793 .attr("name", "id_"+response.id_line)
794 .appendTo("#formrecord");
796 console.error(response.message);
799 error : function(output) {
800 console.error("Error on line creation function");
804 $("#"+product.Id+"_input").val(product.Qty);
808 jQuery("#scantoolmessage").text("'.
dol_escape_js($langs->transnoentities(
"QtyWasAddedToTheScannedBarcode")).
'\n");
809 /* document.forms["formrecord"].submit(); */
811 let stringerror = "";
812 if (Object.keys(errortab1).length > 0) {
813 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorSameBatchNumber')).
': ";
814 errortab1.forEach(element => {
815 stringerror += (element + ", ")
817 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
819 if (Object.keys(errortab2).length > 0) {
820 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCantFindCodeInInventory')).
': ";
821 errortab2.forEach(element => {
822 stringerror += (element + ", ")
824 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
826 if (Object.keys(errortab3).length > 0) {
827 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCodeScannedIsBothProductAndSerial')).
': ";
828 errortab3.forEach(element => {
829 stringerror += (element + ", ")
831 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
833 if (Object.keys(errortab4).length > 0) {
834 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorBarcodeNotFoundForProductWarehouse')).
': ";
835 errortab4.forEach(element => {
836 stringerror += (element + ", ")
838 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
841 jQuery("#scantoolmessage").html(\''.
dol_escape_js($langs->transnoentities(
"ErrorOnElementsInventory")).
'\' + stringerror);
849 function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,mode,autodetect=
false){
850 BarcodeIsInProduct=0;
853 tabproduct.forEach(product => {
854 $.ajax({ url: \
''.DOL_URL_ROOT.
'/product/inventory/ajax/searchfrombarcode.php\',
855 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},
858 success: function(response) {
859 response = JSON.parse(response);
860 if (response.status == "success"){
861 console.log(response.message);
863 newproductrow = response.object;
866 if (mode!="lotserial" && autodetect==false && !errortab4.includes(element)){
867 errortab4.push(element);
868 console.error(response.message);
872 error : function(output) {
873 console.error("Error on barcodeserialforproduct function");
876 console.log("Product "+(index+=1)+": "+element);
877 if(mode == "barcode"){
878 testonproduct = product.Barcode
879 }else if (mode == "lotserial"){
880 testonproduct = product.Batch
882 if(testonproduct == element){
883 if(selectaddorreplace == "add"){
884 productqty = parseInt(product.Qty,10);
885 product.Qty = productqty + parseInt(barcodeproductqty,10);
886 }else if(selectaddorreplace == "replace"){
887 if(product.fetched == false){
888 product.Qty = barcodeproductqty
891 productqty = parseInt(product.Qty,10);
892 product.Qty = productqty + parseInt(barcodeproductqty,10);
895 BarcodeIsInProduct+=1;
898 if(BarcodeIsInProduct==0 && newproductrow!=0){
899 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});
902 if(BarcodeIsInProduct > 0){
910 include DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
912 print $formother->getHTMLScannerForm(
"barcodescannerjs",
'all');
917print
'jQuery(document).ready(function() {
918 $("#clearqty").on("click", function() {
919 console.log("Clear all values");
920 /* disablebuttonmakemovementandclose(); */
921 jQuery(".realqty").val("");
922 jQuery(".realqty").trigger("change");
923 return false; /* disable submit */
925 $(".undochangesqty").on("click", function undochangesqty() {
926 console.log("Clear value of inventory line");
928 id = id.split("_")[1];
929 tmpvalue = $("#id_"+id+"_input_tmp").val()
930 $("#id_"+id+"_input")[0].value = tmpvalue;
931 /* disablebuttonmakemovementandclose(); */
932 return false; /* disable submit */
937print
'<div class="fichecenter">';
939print
'<div class="clearboth"></div>';
943print
'<div class="div-table-responsive-no-min">';
944print
'<table id="tablelines" class="noborder noshadow centpercent">';
946print
'<tr class="liste_titre">';
947print
getTitleFieldOfList($langs->trans(
"Warehouse"), 0, $_SERVER[
'PHP_SELF'],
'e.ref',
'',
'id=' .
$object->id .
'&page=' . $page . $param,
'', $sortfield, $sortorder,
'', 0,
'') .
"\n";
948print
getTitleFieldOfList($langs->trans(
"Product"), 0, $_SERVER[
'PHP_SELF'],
'p.ref',
'',
'id=' .
$object->id .
'&page=' . $page . $param,
'', $sortfield, $sortorder,
'', 0,
'') .
"\n";
949if (isModEnabled(
'productbatch')) {
951 print $langs->trans(
"Batch");
954if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
956 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ExpectedQty"), $langs->trans(
"QtyCurrentlyKnownInStock")).
'</td>';
959 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ExpectedQty"), $langs->trans(
"QtyInStockWhenInventoryWasValidated")).
'</td>';
962 print
'<td class="right">'.$langs->trans(
'PMPExpected').
'</td>';
963 print
'<td class="right">'.$langs->trans(
'ExpectedValuation').
'</td>';
964 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"RealQty"), $langs->trans(
"InventoryRealQtyHelp")).
'</td>';
965 print
'<td class="right">'.$langs->trans(
'PMPReal').
'</td>';
966 print
'<td class="right">'.$langs->trans(
'RealValuation').
'</td>';
968 print
'<td class="right">';
969 print $form->textwithpicto($langs->trans(
"RealQty"), $langs->trans(
"InventoryRealQtyHelp"));
972if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
974 print
'<td class="center">';
978 print
'<td class="right">';
985if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
988 print $formproduct->selectWarehouses((GETPOSTISSET(
'fk_warehouse') ?
GETPOSTINT(
'fk_warehouse') :
$object->fk_warehouse),
'fk_warehouse',
'warehouseopen', 1, 0, 0,
'', 0, 0, array(),
'maxwidth300');
996 print $form->select_produits((GETPOSTISSET(
'fk_product') ?
GETPOSTINT(
'fk_product') :
$object->fk_product),
'fk_product', $filtertype, 0, 0, -1, 2,
'', 0, null, 0,
'1', 0,
'maxwidth300');
998 if (isModEnabled(
'productbatch')) {
1000 print
'<input type="text" name="batch" class="maxwidth100" value="'.(GETPOSTISSET(
'batch') ?
GETPOST(
'batch') :
'').
'">';
1003 print
'<td class="right"></td>';
1005 print
'<td class="right">';
1007 print
'<td class="right">';
1009 print
'<td class="right">';
1010 print
'<input type="text" name="qtytoadd" class="maxwidth75" value="">';
1012 print
'<td class="right">';
1014 print
'<td class="right">';
1017 print
'<td class="right">';
1018 print
'<input type="text" name="qtytoadd" class="maxwidth75" value="">';
1022 print
'<td class="center">';
1023 if ($permissiontoupdatestock) {
1024 print
'<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans(
"Add").
'">';
1026 print
'<input type="submit" class="button paddingright" disabled="disabled" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'" name="addline" value="'.$langs->trans(
"Add").
'">';
1033$sortfield .=
',' . ($sortfield ==
'e.ref' ?
'p.ref' :
'e.ref');
1034$sortorder .=
',' . $sortorder;
1037$sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
1038$sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
1039$sql .=
' FROM ' . $db->prefix() .
'inventorydet as id';
1040$sql .=
' LEFT JOIN ' . $db->prefix() .
'product as p ON id.fk_product = p.rowid';
1041$sql .=
' LEFT JOIN ' . $db->prefix() .
'entrepot as e ON id.fk_warehouse = e.rowid';
1042$sql .=
' WHERE id.fk_inventory = ' . ((int)
$object->id);
1043$sql .= $db->order($sortfield, $sortorder);
1044$sql .= $db->plimit($limit, $offset);
1046$cacheOfProducts = array();
1047$cacheOfWarehouses = array();
1050$resql = $db->query($sql);
1052 $num = $db->num_rows($resql);
1054 if (!empty($limit != 0) || $num > $limit || $page) {
1055 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);
1060 $totalarray = array();
1062 $obj = $db->fetch_object($resql);
1064 if (isset($cacheOfWarehouses[$obj->fk_warehouse])) {
1065 $warehouse_static = $cacheOfWarehouses[$obj->fk_warehouse];
1067 $warehouse_static =
new Entrepot($db);
1068 $warehouse_static->fetch($obj->fk_warehouse);
1070 $cacheOfWarehouses[$warehouse_static->id] = $warehouse_static;
1075 if (isset($cacheOfProducts[$obj->fk_product])) {
1076 $product_static = $cacheOfProducts[$obj->fk_product];
1078 $product_static =
new Product($db);
1079 $result = $product_static->fetch($obj->fk_product,
'',
'',
'', 1, 1, 1);
1082 $option .=
',novirtual';
1083 $product_static->load_stock($option);
1085 $cacheOfProducts[$product_static->id] = $product_static;
1088 print
'<tr class="oddeven">';
1089 print
'<td id="id_'.$obj->rowid.
'_warehouse" data-ref="'.
dol_escape_htmltag($warehouse_static->ref).
'">';
1090 print $warehouse_static->getNomUrl(1);
1093 print $product_static->getNomUrl(1).
' - '.$product_static->label;
1096 if (isModEnabled(
'productbatch')) {
1097 print
'<td id="id_'.$obj->rowid.
'_batch" data-batch="'.
dol_escape_htmltag($obj->batch).
'">';
1100 $res = $batch_static->fetch(0, $product_static->id, $obj->batch);
1102 print $batch_static->getNomUrl(1);
1111 print
'<td class="right expectedqty" id="id_'.$obj->rowid.
'" title="Stock viewed at last update: '.$obj->qty_stock.
'">';
1112 $valuetoshow = $obj->qty_stock;
1114 if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1115 if (isModEnabled(
'productbatch') && $product_static->hasbatch()) {
1116 $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty ?? 0;
1118 $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real ?? 0;
1122 print
'<input type="hidden" name="stock_qty_'.$obj->rowid.
'" value="'.$valuetoshow.
'">';
1126 if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1130 if ($qty_view !=
'') {
1136 if (!empty($obj->pmp_expected)) {
1137 $pmp_expected = $obj->pmp_expected;
1139 $pmp_expected = $product_static->pmp;
1141 $pmp_valuation = $pmp_expected * $valuetoshow;
1142 print
'<td class="right">';
1143 print
price($pmp_expected);
1144 print
'<input type="hidden" name="expectedpmp_'.$obj->rowid.
'" value="'.$pmp_expected.
'"/>';
1146 print
'<td class="right">';
1147 print
price($pmp_valuation);
1150 print
'<td class="right">';
1151 print
'<a id="undochangesqty_'.$obj->rowid.
'" href="#" class="undochangesqty reposition marginrightonly" title="'.
dol_escape_htmltag($langs->trans(
"Clear")).
'">';
1152 print
img_picto(
'',
'eraser',
'class="opacitymedium"');
1154 print
'<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input" value="'.$qty_view.
'">';
1158 print
'<td class="right">';
1159 if (!empty($obj->pmp_real) || (
string) $obj->pmp_real ===
'0') {
1160 $pmp_real = $obj->pmp_real;
1162 $pmp_real = $product_static->pmp;
1164 $pmp_valuation_real = $pmp_real * $qty_view;
1165 print
'<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.
'" name="realpmp_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input_pmp" value="'.
price2num($pmp_real).
'">';
1167 print
'<td class="right">';
1168 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.
'">';
1171 $totalExpectedValuation += $pmp_valuation;
1172 $totalRealValuation += $pmp_valuation_real;
1174 print
'<td class="right">';
1175 print
'<a id="undochangesqty_'.$obj->rowid.
'" href="#" class="undochangesqty reposition marginrightonly" title="'.
dol_escape_htmltag($langs->trans(
"Clear")).
'">';
1176 print
img_picto(
'',
'eraser',
'class="opacitymedium"');
1178 print
'<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input" value="'.$qty_view.
'">';
1183 print
'<td class="right">';
1184 if ($permissiontoupdatestock) {
1185 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>';
1187 $qty_tmp =
price2num(
GETPOST(
"id_".$obj->rowid.
"_input_tmp",
'MS')) >= 0 ?
GETPOST(
"id_".$obj->rowid.
"_input_tmp") : $qty_view;
1188 print
'<input type="hidden" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'_input_tmp" id="id_'.$obj->rowid.
'_input_tmp" value="'.$qty_tmp.
'">';
1193 if (!empty($obj->pmp_expected)) {
1194 $pmp_expected = $obj->pmp_expected;
1196 $pmp_expected = $product_static->pmp;
1198 $pmp_valuation = $pmp_expected * $valuetoshow;
1199 print
'<td class="right">';
1200 print
price($pmp_expected);
1202 print
'<td class="right">';
1203 print
price($pmp_valuation);
1206 print
'<td class="right nowraponall">';
1207 print $obj->qty_view;
1211 print
'<td class="right">';
1212 if (!empty($obj->pmp_real)) {
1213 $pmp_real = $obj->pmp_real;
1215 $pmp_real = $product_static->pmp;
1217 $pmp_valuation_real = $pmp_real * $obj->qty_view;
1218 print
price($pmp_real);
1220 print
'<td class="right">';
1221 print
price($pmp_valuation_real);
1223 print
'<td class="nowraponall right">';
1225 $totalExpectedValuation += $pmp_valuation;
1226 $totalRealValuation += $pmp_valuation_real;
1228 print
'<td class="right nowraponall">';
1229 print $obj->qty_view;
1233 if ($obj->fk_movement > 0) {
1235 $stockmovment->fetch($obj->fk_movement);
1236 print $stockmovment->getNomUrl(1,
'movements');
1248 print
'<tr class="liste_total">';
1249 print
'<td colspan="4">'.$langs->trans(
"Total").
'</td>';
1250 print
'<td class="right" colspan="2">'.price($totalExpectedValuation).
'</td>';
1251 print
'<td class="right" id="totalRealValuation" colspan="3">'.price($totalRealValuation).
'</td>';
1259if (
$object->status == $object::STATUS_VALIDATED) {
1260 print
'<center><input id="submitrecord" type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'"></center>';
1280print
'<script type="text/javascript">
1281 $(document).ready(function() {
1283 $(".paginationnext:last").click(function(e){
1284 var form = $("#formrecord");
1285 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1288 data: form.serialize(),
1290 success: function(result){
1291 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page + 1).$paramwithsearch.
'";
1296 $(".paginationprevious:last").click(function(e){
1297 var form = $("#formrecord");
1298 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1301 data: form.serialize(),
1303 success: function(result){
1304 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page - 1).$paramwithsearch.
'";
1308 $("#idbuttonmakemovementandclose").click(function(e){
1309 var form = $("#formrecord");
1310 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1313 data: form.serialize(),
1315 success: function(result){
1316 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page - 1).$paramwithsearch.
'&action=record";
1325<script
type=
"text/javascript">
1326$(
'.realqty').on(
'change',
function () {
1327 let realqty = $(
this).closest(
'tr').find(
'.realqty').val();
1328 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1329 let realpmp = $(inputPmp).val();
1330 if (!isNaN(realqty) && !isNaN(realpmp)) {
1331 let realval = realqty * realpmp;
1332 $(
this).closest(
'tr').find(
'input[name^=realvaluation]').val(realval.toFixed(2));
1334 updateTotalValuation();
1337$(
'input[class*=realpmp]').on(
'change',
function () {
1338 let inputQtyReal = $(
this).closest(
'tr').find(
'.realqty');
1339 let realqty = $(inputQtyReal).val();
1340 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1341 console.log(inputPmp);
1342 let realPmpClassname = $(inputPmp).attr(
'class').match(/[\w-]*realpmp[\w-]*/g)[0];
1343 let realpmp = $(inputPmp).val();
1344 if (!isNaN(realpmp)) {
1345 $(
'.'+realPmpClassname).val(realpmp);
1347 if (!isNaN(realqty)) {
1348 let realval = realqty * realpmp;
1349 $(
this).closest(
'tr').find(
'input[name^=realvaluation]').val(realval.toFixed(2));
1351 $(
'.realqty').trigger(
'change');
1352 updateTotalValuation();
1356$(
'input[name^=realvaluation]').on(
'change',
function () {
1357 let inputQtyReal = $(
this).closest(
'tr').find(
'.realqty');
1358 let realqty = $(inputQtyReal).val();
1359 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1360 let inputRealValuation = $(
this).closest(
'tr').find(
'input[name^=realvaluation]');
1361 let realPmpClassname = $(inputPmp).attr(
'class').match(/[\w-]*realpmp[\w-]*/g)[0];
1362 let realvaluation = $(inputRealValuation).val();
1363 if (!isNaN(realvaluation) && !isNaN(realqty) && realvaluation !==
'' && realqty !==
'' && realqty !== 0) {
1364 let realpmp = realvaluation / realqty
1365 $(
'.'+realPmpClassname).val(realpmp);
1366 $(
'.realqty').trigger(
'change');
1367 updateTotalValuation();
1371function updateTotalValuation() {
1373 $(
'input[name^=realvaluation]').each(
function( index ) {
1374 let val = $(
this).val();
1375 if(!isNaN(val)) total += parseFloat($(
this).val());
1377 let currencyFractionDigits =
new Intl.NumberFormat(
'fr-FR', {
1380 }).resolvedOptions().maximumFractionDigits;
1381 $(
'#totalRealValuation').html(total.toLocaleString(
'fr-FR', {
1382 maximumFractionDigits: currencyFractionDigits
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
currentToken()
Return the value of token currently saved into session with name 'token'.
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.
dol_now($mode='auto')
Return date for now.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
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:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
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.