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';
44$langs->loadLangs(array(
"stocks",
"other",
"productbatch"));
49$action =
GETPOST(
'action',
'aZ09');
50$confirm =
GETPOST(
'confirm',
'alpha');
51$cancel =
GETPOST(
'cancel',
'aZ09');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'inventorycard';
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$listoffset =
GETPOST(
'listoffset',
'alpha');
55$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
56$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
59if (empty($page) || $page == -1) {
62$offset = $limit * $page;
69$batch =
GETPOST(
'batch',
'alphanohtml');
70$totalExpectedValuation = 0;
71$totalRealValuation = 0;
72$hookmanager->initHooks(array(
'inventorycard'));
76 $result =
restrictedArea($user,
'stock', $id,
'',
'inventory_advance');
82$diroutputmassaction =
$conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
93$extrafields->fetch_name_optionals_label(
$object->table_element);
95$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
98$search_all =
GETPOST(
"search_all",
'alpha');
100foreach (
$object->fields as $key => $val) {
101 if (
GETPOST(
'search_'.$key,
'alpha')) {
102 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
106if (empty($action) && empty($id) && empty($ref)) {
111include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
119$paramwithsearch =
'&sortfield=' . urlencode($sortfield);
120$paramwithsearch .=
'&sortorder=' . urlencode($sortorder);
121if ($limit > 0 && $limit !=
$conf->liste_limit) {
122 $paramwithsearch .=
'&limit='.((int) $limit);
127 $permissiontoadd = $user->hasRight(
'stock',
'creer');
128 $permissiontodelete = $user->hasRight(
'stock',
'supprimer');
129 $permissiontoupdatestock = $user->hasRight(
'stock',
'mouvement',
'creer');
131 $permissiontoadd = $user->hasRight(
'stock',
'inventory_advance',
'write');
132 $permissiontodelete = $user->hasRight(
'stock',
'inventory_advance',
'write');
133 $permissiontoupdatestock = $user->hasRight(
'stock',
'inventory_advance',
'write');
149$parameters = array();
150$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
155if (empty($reshook)) {
158 if ($action ==
'cancel_record' && $permissiontoupdatestock) {
163 if ($action ==
'update' && $permissiontoupdatestock &&
$object->status == $object::STATUS_VALIDATED) {
167 $cacheOfProducts = array();
171 $sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
172 $sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real';
173 $sql .=
' FROM '.MAIN_DB_PREFIX.
'inventorydet as id';
174 $sql .=
' WHERE id.fk_inventory = '.((int)
$object->id);
175 $sql .=
' ORDER BY id.rowid';
177 $resql = $db->query($sql);
179 $num = $db->num_rows($resql);
181 $totalarray = array();
185 $line = $db->fetch_object($resql);
187 $qty_stock = $line->qty_stock;
188 $qty_view = $line->qty_view;
192 if (isset($cacheOfProducts[$line->fk_product])) {
193 $product_static = $cacheOfProducts[$line->fk_product];
195 $product_static =
new Product($db);
196 $result = $product_static->fetch($line->fk_product,
'',
'',
'', 1, 1, 1);
199 $option .=
',novirtual';
200 $product_static->load_stock($option);
202 $cacheOfProducts[$product_static->id] = $product_static;
206 $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->real;
207 if (isModEnabled(
'productbatch') && $product_static->hasbatch()) {
208 $realqtynow = $product_static->stock_warehouse[$line->fk_warehouse]->detail_batch[$line->batch]->qty;
211 if (!is_null($qty_view)) {
212 $stock_movement_qty =
price2num($qty_view - $realqtynow,
'MS');
215 if ($stock_movement_qty != 0) {
216 if ($stock_movement_qty < 0) {
224 $inventorycode =
'INV-'.$object->ref;
227 $price = $line->pmp_real;
230 $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);
231 if ($idstockmove < 0) {
238 $sqlupdate =
"UPDATE ".MAIN_DB_PREFIX.
"inventorydet";
239 $sqlupdate .=
" SET fk_movement = ".((int) $idstockmove);
240 if ($qty_stock != $realqtynow) {
241 $sqlupdate .=
", qty_stock = ".((float) $realqtynow);
243 $sqlupdate .=
" WHERE rowid = ".((int) $line->rowid);
244 $resqlupdate = $db->query($sqlupdate);
245 if (! $resqlupdate) {
253 $sqlpmp =
'UPDATE '.MAIN_DB_PREFIX.
'product SET pmp = '.((float) $line->pmp_real).
' WHERE rowid = '.((int) $line->fk_product);
254 $resqlpmp = $db->query($sqlpmp);
261 $sqlpmp =
'UPDATE '.MAIN_DB_PREFIX.
'product_perentity SET pmp = '.((float) $line->pmp_real).
' WHERE fk_product = '.((int) $line->fk_product).
' AND entity='.
$conf->entity;
262 $resqlpmp = $db->query($sqlpmp);
290 if ($action ==
'updateinventorylines' && $permissiontoupdatestock) {
291 $sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
292 $sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
293 $sql .=
' FROM '.MAIN_DB_PREFIX.
'inventorydet as id';
294 $sql .=
' WHERE id.fk_inventory = '.((int)
$object->id);
295 $sql .= $db->order(
'id.rowid',
'ASC');
296 $sql .= $db->plimit($limit, $offset);
300 $resql = $db->query($sql);
302 $num = $db->num_rows($resql);
304 $totalarray = array();
308 $line = $db->fetch_object($resql);
309 $lineid = $line->rowid;
314 if (
GETPOST(
"id_".$lineid,
'alpha') !=
'') {
316 $result = $inventoryline->fetch($lineid);
317 if ($qtytoupdate < 0) {
319 setEventMessages($langs->trans(
"FieldCannotBeNegative", $langs->transnoentitiesnoconv(
"RealQty")),
null,
'errors');
322 $inventoryline->qty_stock = (float)
price2num(
GETPOST(
'stock_qty_'.$lineid,
'alpha'),
'MS');
323 $inventoryline->qty_view = $qtytoupdate;
324 $inventoryline->pmp_real =
price2num(
GETPOST(
'realpmp_'.$lineid,
'alpha'),
'MS');
325 $inventoryline->pmp_expected =
price2num(
GETPOST(
'expectedpmp_'.$lineid,
'alpha'),
'MS');
326 $resultupdate = $inventoryline->update($user);
328 } elseif (GETPOSTISSET(
'id_' . $lineid)) {
330 $result = $inventoryline->fetch($lineid);
332 $inventoryline->qty_view =
null;
333 $inventoryline->pmp_real =
price2num(
GETPOST(
'realpmp_'.$lineid,
'alpha'),
'MS');
334 $inventoryline->pmp_expected =
price2num(
GETPOST(
'expectedpmp_'.$lineid,
'alpha'),
'MS');
335 $resultupdate = $inventoryline->update($user);
339 if ($result < 0 || $resultupdate < 0) {
349 $sqlupdate =
"UPDATE ".MAIN_DB_PREFIX.
"inventory";
350 $sqlupdate .=
" SET fk_user_modif = ".((int) $user->id);
351 $sqlupdate .=
" WHERE rowid = ".((int)
$object->id);
352 $resqlupdate = $db->query($sqlupdate);
353 if (! $resqlupdate) {
366 $backurlforlist = DOL_URL_ROOT.
'/product/inventory/list.php';
367 $backtopage = DOL_URL_ROOT.
'/product/inventory/inventory.php?id='.
$object->id.
'&page='.$page.$paramwithsearch;
370 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
373 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
376 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
384 if (
GETPOST(
'addline',
'alpha')) {
386 if ($fk_warehouse <= 0) {
388 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
390 if ($fk_product <= 0) {
392 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
396 setEventMessages($langs->trans(
"FieldCannotBeNegative", $langs->transnoentitiesnoconv(
"RealQty")),
null,
'errors');
398 if (!$error && isModEnabled(
'productbatch')) {
399 $tmpproduct =
new Product($db);
400 $result = $tmpproduct->fetch($fk_product);
402 if (empty($error) && $tmpproduct->status_batch > 0 && empty($batch)) {
404 $langs->load(
"errors");
405 setEventMessages($langs->trans(
"ErrorProductNeedBatchNumber", $tmpproduct->ref),
null,
'errors');
407 if (empty($error) && $tmpproduct->status_batch == 2 && !empty($batch) && $qty > 1) {
409 $langs->load(
"errors");
410 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $tmpproduct->ref, $batch),
null,
'errors');
412 if (empty($error) && empty($tmpproduct->status_batch) && !empty($batch)) {
414 $langs->load(
"errors");
415 setEventMessages($langs->trans(
"ErrorProductDoesNotNeedBatchNumber", $tmpproduct->ref),
null,
'errors');
420 $tmp->fk_inventory =
$object->id;
421 $tmp->fk_warehouse = $fk_warehouse;
422 $tmp->fk_product = $fk_product;
423 $tmp->batch = $batch;
425 $tmp->qty_view = $qty;
427 $result = $tmp->create($user);
429 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
430 $langs->load(
"errors");
431 setEventMessages($langs->trans(
"ErrorRecordAlreadyExists"),
null,
'errors');
437 $_POST[
'batch'] =
'';
438 $_POST[
'qtytoadd'] =
'';
450$form =
new Form($db);
455llxHeader(
'', $langs->trans(
'Inventory'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-inventory_inventory');
464if ($limit > 0 && $limit !=
$conf->liste_limit) {
465 $param .=
'&limit=' . ((int) $limit);
469$res =
$object->fetch_optionals();
477if ($action ==
'delete') {
478 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteInventory'), $langs->trans(
'ConfirmDeleteOrder'),
'confirm_delete',
'', 0, 1);
481if ($action ==
'deleteline') {
482 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid.
'&page='.$page.$paramwithsearch, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
486if ($action ==
'clone') {
488 $formquestion = array();
489 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMyObject',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
493if ($action ==
'record') {
494 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&page='.$page.$paramwithsearch, $langs->trans(
'Close'), $langs->trans(
'ConfirmFinish'),
'update',
'', 0, 1);
499if ($action ==
'confirm_cancel') {
500 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Cancel'), $langs->trans(
'ConfirmCancel'),
'cancel_record',
'', 0, 1);
504if ($action ==
'validate') {
505 $form =
new Form($db);
508 $formquestion = array(
509 array(
'type' =>
'checkbox',
'name' =>
'include_sub_warehouse',
'label' => $langs->trans(
"IncludeSubWarehouse"),
'value' => 1,
'size' =>
'10'),
511 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateInventory'), $langs->trans(
'IncludeSubWarehouseExplanation'),
'confirm_validate', $formquestion,
'', 1);
516$parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
517$reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
518if (empty($reshook)) {
519 $formconfirm .= $hookmanager->resPrint;
520} elseif ($reshook > 0) {
521 $formconfirm = $hookmanager->resPrint;
530$linkback =
'<a href="'.DOL_URL_ROOT.
'/product/inventory/list.php">'.$langs->trans(
"BackToList").
'</a>';
532$morehtmlref =
'<div class="refidno">';
572$morehtmlref .=
'</div>';
575dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
578print
'<div class="fichecenter">';
579print
'<div class="fichehalfleft">';
580print
'<div class="underbanner clearboth"></div>';
581print
'<table class="border centpercent tableforfield">'.
"\n";
584include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
587include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
595print
'<div class="clearboth"></div>';
599print
'<form id="formrecord" name="formrecord" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?page='.$page.
'&id='.
$object->id.
'">';
600print
'<input type="hidden" name="token" value="'.newToken().
'">';
601print
'<input type="hidden" name="action" value="updateinventorylines">';
602print
'<input type="hidden" name="id" value="'.$object->id.
'">';
603print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
604print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
606 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
611if ($action !=
'record') {
612 print
'<div class="tabsAction">'.
"\n";
613 $parameters = array();
614 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
619 if (empty($reshook)) {
620 if (
$object->status == Inventory::STATUS_DRAFT) {
621 if ($permissiontoupdatestock) {
623 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
' ('.$langs->trans(
"Start").
')</a>';
625 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>';
628 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Validate').
' ('.$langs->trans(
"Start").
')</a>'.
"\n";
633 if (
$object->status == $object::STATUS_VALIDATED) {
634 if ($permissiontoupdatestock) {
635 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";
637 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'MakeMovementsAndClose').
'</a>'.
"\n";
640 if ($permissiontoupdatestock) {
641 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_cancel&page='.$page.$paramwithsearch.
'&token='.
newToken().
'">'.$langs->trans(
"Cancel").
'</a>'.
"\n";
647 if (
$object->status != Inventory::STATUS_DRAFT &&
$object->status != Inventory::STATUS_VALIDATED) {
654if (
$object->status == Inventory::STATUS_VALIDATED) {
656 if (!empty(
$conf->use_javascript_ajax)) {
657 if ($permissiontoupdatestock) {
659 if (isModEnabled(
'barcode') || isModEnabled(
'productbatch')) {
660 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>';
664 print
'<a id="fillwithexpected" class="marginrightonly paddingright marginleftonly paddingleft" href="#">'.img_picto(
'',
'autofill',
'class="paddingrightonly"').$langs->trans(
'AutofillWithExpected').
'</a>';
666 print
'$( document ).ready(function() {';
667 print
' $("#fillwithexpected").on("click",function fillWithExpected(){
668 $(".expectedqty").each(function(){
669 var object = $(this)[0];
670 var objecttofill = $("#"+object.id+"_input")[0];
671 objecttofill.value = object.innerText;
672 jQuery(".realqty").trigger("change");
674 console.log("Values filled (after click on fillwithexpected)");
675 /* disablebuttonmakemovementandclose(); */
682 print
'<a href="#" id="clearqty" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto(
'',
'eraser',
'class="paddingrightonly"').$langs->trans(
"ClearQtys").
'</a>';
684 print
'<a class="classfortooltip marginrightonly paddingright marginleftonly paddingleft" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Save").
'</a>'.
"\n";
694if ($action ==
'updatebyscaning') {
695 if ($permissiontoupdatestock) {
700 var duplicatedbatchcode = [];
706 function barcodescannerjs(){
707 console.log("We catch inputs in scanner box");
708 jQuery("#scantoolmessage").text();
710 var selectaddorreplace = $("select[name=selectaddorreplace]").val();
711 var barcodemode = $("input[name=barcodemode]:checked").val();
712 var barcodeproductqty = $("input[name=barcodeproductqty]").val();
713 var textarea = $("textarea[name=barcodelist]").val();
714 var textarray = textarea.split(/[\s,;]+/);
716 duplicatedbatchcode = [];
722 textarray = textarray.filter(function(value){
725 if(textarray.some((element) => element != "")){
726 $(".expectedqty").each(function(){
728 console.log("Analyze the line "+id+" in inventory, barcodemode="+barcodemode);
729 warehouse = $("#"+id+"_warehouse").attr(\'data-ref\');
730 //console.log(warehouse);
731 productbarcode = $("#"+id+"_product").attr(\'data-barcode\');
732 //console.log(productbarcode);
733 productbatchcode = $("#"+id+"_batch").attr(\'data-batch\');
734 //console.log(productbatchcode);
736 if (barcodemode != "barcodeforproduct") {
737 tabproduct.forEach(product=>{
738 console.log("product.Batch="+product.Batch+" productbatchcode="+productbatchcode);
739 if(product.Batch != "" && product.Batch == productbatchcode){
740 console.log("duplicate batch code found for batch code "+productbatchcode);
741 duplicatedbatchcode.push(productbatchcode);
745 productinput = $("#"+id+"_input").val();
746 if(productinput == ""){
749 tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
752 console.log("Loop on each record entered in the textarea");
753 textarray.forEach(function(element,index){
754 console.log("Process record element="+element+" id="+id);
755 var verify_batch = false;
756 var verify_barcode = false;
758 case "barcodeforautodetect":
759 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode",true);
760 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial",true);
762 case "barcodeforproduct":
763 verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode");
765 case "barcodeforlotserial":
766 verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial");
769 alert(\''.dol_escape_js($langs->trans(
"ErrorWrongBarcodemode")).
' "\'+barcodemode+\'"\');
770 throw \''.
dol_escape_js($langs->trans(
'ErrorWrongBarcodemode')).
' "\'+barcodemode+\'"\';
773 if (verify_batch == false && verify_barcode == false) { /* If the 2 flags are false, not found error */
774 errortab2.push(element);
775 } else if (verify_batch == true && verify_barcode == true) { /* If the 2 flags are true, error: we don t know which one to take */
776 errortab3.push(element);
777 } else if (verify_batch == true) {
778 console.log("element="+element);
779 console.log(duplicatedbatchcode);
780 if (duplicatedbatchcode.includes(element)) {
781 errortab1.push(element);
786 if (Object.keys(errortab1).length < 1 && Object.keys(errortab2).length < 1 && Object.keys(errortab3).length < 1) {
787 tabproduct.forEach(product => {
789 console.log("We change #"+product.Id+"_input to match input in scanner box");
790 if(product.hasOwnProperty("reelqty")){
791 $.ajax({ url: \''.DOL_URL_ROOT.
'/product/inventory/ajax/searchfrombarcode.php\',
792 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},
795 success: function(response) {
796 response = JSON.parse(response);
797 if(response.status == "success"){
798 console.log(response.message);
799 $("<input type=\'text\' value=\'"+product.Qty+"\' />")
800 .attr("id", "id_"+response.id_line+"_input")
801 .attr("name", "id_"+response.id_line)
802 .appendTo("#formrecord");
804 console.error(response.message);
807 error : function(output) {
808 console.error("Error on line creation function");
812 $("#"+product.Id+"_input").val(product.Qty);
816 jQuery("#scantoolmessage").text("'.
dol_escape_js($langs->transnoentities(
"QtyWasAddedToTheScannedBarcode")).
'\n");
817 /* document.forms["formrecord"].submit(); */
819 let stringerror = "";
820 if (Object.keys(errortab1).length > 0) {
821 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorSameBatchNumber')).
': ";
822 errortab1.forEach(element => {
823 stringerror += (element + ", ")
825 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
827 if (Object.keys(errortab2).length > 0) {
828 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCantFindCodeInInventory')).
': ";
829 errortab2.forEach(element => {
830 stringerror += (element + ", ")
832 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
834 if (Object.keys(errortab3).length > 0) {
835 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorCodeScannedIsBothProductAndSerial')).
': ";
836 errortab3.forEach(element => {
837 stringerror += (element + ", ")
839 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
841 if (Object.keys(errortab4).length > 0) {
842 stringerror += "<br>'.
dol_escape_js($langs->transnoentities(
'ErrorBarcodeNotFoundForProductWarehouse')).
': ";
843 errortab4.forEach(element => {
844 stringerror += (element + ", ")
846 stringerror = stringerror.slice(0, -2); /* Remove last ", " */
849 jQuery("#scantoolmessage").html(\''.
dol_escape_js($langs->transnoentities(
"ErrorOnElementsInventory")).
'\' + stringerror);
857 function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,mode,autodetect=
false){
858 BarcodeIsInProduct=0;
861 tabproduct.forEach(product => {
862 $.ajax({ url: \
''.DOL_URL_ROOT.
'/product/inventory/ajax/searchfrombarcode.php\',
863 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},
866 success: function(response) {
867 response = JSON.parse(response);
868 if (response.status == "success"){
869 console.log(response.message);
871 newproductrow = response.object;
874 if (mode!="lotserial" && autodetect==false && !errortab4.includes(element)){
875 errortab4.push(element);
876 console.error(response.message);
880 error : function(output) {
881 console.error("Error on barcodeserialforproduct function");
884 console.log("Product "+(index+=1)+": "+element);
885 if(mode == "barcode"){
886 testonproduct = product.Barcode
887 }else if (mode == "lotserial"){
888 testonproduct = product.Batch
890 if(testonproduct == element){
891 if(selectaddorreplace == "add"){
892 productqty = parseInt(product.Qty,10);
893 product.Qty = productqty + parseInt(barcodeproductqty,10);
894 }else if(selectaddorreplace == "replace"){
895 if(product.fetched == false){
896 product.Qty = barcodeproductqty
899 productqty = parseInt(product.Qty,10);
900 product.Qty = productqty + parseInt(barcodeproductqty,10);
903 BarcodeIsInProduct+=1;
906 if(BarcodeIsInProduct==0 && newproductrow!=0){
907 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});
910 if(BarcodeIsInProduct > 0){
918 include DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
920 print $formother->getHTMLScannerForm(
"barcodescannerjs",
'all');
925print
'jQuery(document).ready(function() {
926 $("#clearqty").on("click", function() {
927 console.log("Clear all values");
928 /* disablebuttonmakemovementandclose(); */
929 jQuery(".realqty").val("");
930 jQuery(".realqty").trigger("change");
931 return false; /* disable submit */
933 $(".undochangesqty").on("click", function undochangesqty() {
934 console.log("Clear value of inventory line");
936 id = id.split("_")[1];
937 tmpvalue = $("#id_"+id+"_input_tmp").val()
938 $("#id_"+id+"_input")[0].value = tmpvalue;
939 /* disablebuttonmakemovementandclose(); */
940 return false; /* disable submit */
945print
'<div class="fichecenter">';
947print
'<div class="clearboth"></div>';
951print
'<div class="div-table-responsive-no-min">';
952print
'<table id="tablelines" class="noborder noshadow centpercent">';
954print
'<tr class="liste_titre">';
955print
getTitleFieldOfList($langs->trans(
"Warehouse"), 0, $_SERVER[
'PHP_SELF'],
'e.ref',
'',
'id=' .
$object->id .
'&page=' . $page . $param,
'', $sortfield, $sortorder,
'', 0,
'') .
"\n";
956print
getTitleFieldOfList($langs->trans(
"Product"), 0, $_SERVER[
'PHP_SELF'],
'p.ref',
'',
'id=' .
$object->id .
'&page=' . $page . $param,
'', $sortfield, $sortorder,
'', 0,
'') .
"\n";
957if (isModEnabled(
'productbatch')) {
959 print $langs->trans(
"Batch");
962if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
964 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ExpectedQty"), $langs->trans(
"QtyCurrentlyKnownInStock")).
'</td>';
967 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ExpectedQty"), $langs->trans(
"QtyInStockWhenInventoryWasValidated")).
'</td>';
970 print
'<td class="right">'.$langs->trans(
'PMPExpected').
'</td>';
971 print
'<td class="right">'.$langs->trans(
'ExpectedValuation').
'</td>';
972 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"RealQty"), $langs->trans(
"InventoryRealQtyHelp")).
'</td>';
973 print
'<td class="right">'.$langs->trans(
'PMPReal').
'</td>';
974 print
'<td class="right">'.$langs->trans(
'RealValuation').
'</td>';
976 print
'<td class="right">';
977 print $form->textwithpicto($langs->trans(
"RealQty"), $langs->trans(
"InventoryRealQtyHelp"));
980if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
982 print
'<td class="center">';
986 print
'<td class="right">';
993if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
996 print $formproduct->selectWarehouses((GETPOSTISSET(
'fk_warehouse') ?
GETPOSTINT(
'fk_warehouse') :
$object->fk_warehouse),
'fk_warehouse',
'warehouseopen', 1, 0, 0,
'', 0, 0, array(),
'maxwidth300');
1004 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');
1006 if (isModEnabled(
'productbatch')) {
1008 print
'<input type="text" name="batch" class="maxwidth100" value="'.(GETPOSTISSET(
'batch') ?
GETPOST(
'batch') :
'').
'">';
1011 print
'<td class="right"></td>';
1013 print
'<td class="right">';
1015 print
'<td class="right">';
1017 print
'<td class="right">';
1018 print
'<input type="text" name="qtytoadd" class="maxwidth75" value="">';
1020 print
'<td class="right">';
1022 print
'<td class="right">';
1025 print
'<td class="right">';
1026 print
'<input type="text" name="qtytoadd" class="maxwidth75" value="">';
1030 print
'<td class="center">';
1031 if ($permissiontoupdatestock) {
1032 print
'<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans(
"Add").
'">';
1034 print
'<input type="submit" class="button paddingright" disabled="disabled" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'" name="addline" value="'.$langs->trans(
"Add").
'">';
1041$sortfield .=
',' . ($sortfield ==
'e.ref' ?
'p.ref' :
'e.ref');
1042$sortorder .=
',' . $sortorder;
1045$sql =
'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
1046$sql .=
' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
1047$sql .=
' FROM ' . $db->prefix() .
'inventorydet as id';
1048$sql .=
' LEFT JOIN ' . $db->prefix() .
'product as p ON id.fk_product = p.rowid';
1049$sql .=
' LEFT JOIN ' . $db->prefix() .
'entrepot as e ON id.fk_warehouse = e.rowid';
1050$sql .=
' WHERE id.fk_inventory = ' . ((int)
$object->id);
1051$sql .= $db->order($sortfield, $sortorder);
1052$sql .= $db->plimit($limit, $offset);
1054$cacheOfProducts = array();
1055$cacheOfWarehouses = array();
1058$resql = $db->query($sql);
1060 $num = $db->num_rows($resql);
1062 if (!empty($limit != 0) || $num > $limit || $page) {
1063 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);
1068 $totalarray = array();
1070 $obj = $db->fetch_object($resql);
1072 if (isset($cacheOfWarehouses[$obj->fk_warehouse])) {
1073 $warehouse_static = $cacheOfWarehouses[$obj->fk_warehouse];
1075 $warehouse_static =
new Entrepot($db);
1076 $warehouse_static->fetch($obj->fk_warehouse);
1078 $cacheOfWarehouses[$warehouse_static->id] = $warehouse_static;
1083 if (isset($cacheOfProducts[$obj->fk_product])) {
1084 $product_static = $cacheOfProducts[$obj->fk_product];
1086 $product_static =
new Product($db);
1087 $result = $product_static->fetch($obj->fk_product,
'',
'',
'', 1, 1, 1);
1090 $option .=
',novirtual';
1091 $product_static->load_stock($option);
1093 $cacheOfProducts[$product_static->id] = $product_static;
1096 print
'<tr class="oddeven">';
1097 print
'<td id="id_'.$obj->rowid.
'_warehouse" data-ref="'.
dol_escape_htmltag($warehouse_static->ref).
'">';
1098 print $warehouse_static->getNomUrl(1);
1101 print $product_static->getNomUrl(1).
' - '.$product_static->label;
1104 if (isModEnabled(
'productbatch')) {
1105 print
'<td id="id_'.$obj->rowid.
'_batch" data-batch="'.
dol_escape_htmltag($obj->batch).
'">';
1108 $res = $batch_static->fetch(0, $product_static->id, $obj->batch);
1110 print $batch_static->getNomUrl(1);
1119 print
'<td class="right expectedqty" id="id_'.$obj->rowid.
'" title="Stock viewed at last update: '.$obj->qty_stock.
'">';
1120 $valuetoshow = $obj->qty_stock;
1122 if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1123 if (isModEnabled(
'productbatch') && $product_static->hasbatch()) {
1124 $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty ?? 0;
1126 $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real ?? 0;
1130 print
'<input type="hidden" name="stock_qty_'.$obj->rowid.
'" value="'.$valuetoshow.
'">';
1134 if (
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) {
1138 if ($qty_view !=
'') {
1144 if (!empty($obj->pmp_expected)) {
1145 $pmp_expected = $obj->pmp_expected;
1147 $pmp_expected = $product_static->pmp;
1149 $pmp_valuation = $pmp_expected * $valuetoshow;
1150 print
'<td class="right">';
1151 print
price($pmp_expected);
1152 print
'<input type="hidden" name="expectedpmp_'.$obj->rowid.
'" value="'.$pmp_expected.
'"/>';
1154 print
'<td class="right">';
1155 print
price($pmp_valuation);
1158 print
'<td class="right">';
1159 print
'<a id="undochangesqty_'.$obj->rowid.
'" href="#" class="undochangesqty reposition marginrightonly" title="'.
dol_escape_htmltag($langs->trans(
"Clear")).
'">';
1160 print
img_picto(
'',
'eraser',
'class="opacitymedium"');
1162 print
'<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input" value="'.$qty_view.
'">';
1166 print
'<td class="right">';
1167 if (!empty($obj->pmp_real) || (
string) $obj->pmp_real ===
'0') {
1168 $pmp_real = $obj->pmp_real;
1170 $pmp_real = $product_static->pmp;
1172 $pmp_valuation_real = $pmp_real * $qty_view;
1173 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).
'">';
1175 print
'<td class="right">';
1176 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.
'">';
1179 $totalExpectedValuation += $pmp_valuation;
1180 $totalRealValuation += $pmp_valuation_real;
1182 print
'<td class="right">';
1183 print
'<a id="undochangesqty_'.$obj->rowid.
'" href="#" class="undochangesqty reposition marginrightonly" title="'.
dol_escape_htmltag($langs->trans(
"Clear")).
'">';
1184 print
img_picto(
'',
'eraser',
'class="opacitymedium"');
1186 print
'<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'" id="id_'.$obj->rowid.
'_input" value="'.$qty_view.
'">';
1191 print
'<td class="right">';
1192 if ($permissiontoupdatestock) {
1193 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>';
1195 $qty_tmp =
price2num(
GETPOST(
"id_".$obj->rowid.
"_input_tmp",
'MS')) >= 0 ?
GETPOST(
"id_".$obj->rowid.
"_input_tmp") : $qty_view;
1196 print
'<input type="hidden" class="maxwidth50 right realqty" name="id_'.$obj->rowid.
'_input_tmp" id="id_'.$obj->rowid.
'_input_tmp" value="'.$qty_tmp.
'">';
1201 if (!empty($obj->pmp_expected)) {
1202 $pmp_expected = $obj->pmp_expected;
1204 $pmp_expected = $product_static->pmp;
1206 $pmp_valuation = $pmp_expected * $valuetoshow;
1207 print
'<td class="right">';
1208 print
price($pmp_expected);
1210 print
'<td class="right">';
1211 print
price($pmp_valuation);
1214 print
'<td class="right nowraponall">';
1215 print $obj->qty_view;
1219 print
'<td class="right">';
1220 if (!empty($obj->pmp_real)) {
1221 $pmp_real = $obj->pmp_real;
1223 $pmp_real = $product_static->pmp;
1225 $pmp_valuation_real = $pmp_real * $obj->qty_view;
1226 print
price($pmp_real);
1228 print
'<td class="right">';
1229 print
price($pmp_valuation_real);
1231 print
'<td class="nowraponall right">';
1233 $totalExpectedValuation += $pmp_valuation;
1234 $totalRealValuation += $pmp_valuation_real;
1236 print
'<td class="right nowraponall">';
1237 print $obj->qty_view;
1241 if ($obj->fk_movement > 0) {
1243 $stockmovment->fetch($obj->fk_movement);
1244 print $stockmovment->getNomUrl(1,
'movements');
1256 print
'<tr class="liste_total">';
1257 print
'<td colspan="4">'.$langs->trans(
"Total").
'</td>';
1258 print
'<td class="right" colspan="2">'.price($totalExpectedValuation).
'</td>';
1259 print
'<td class="right" id="totalRealValuation" colspan="3">'.price($totalRealValuation).
'</td>';
1267if (
$object->status == $object::STATUS_VALIDATED) {
1268 print
'<center><input id="submitrecord" type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'"></center>';
1288print
'<script type="text/javascript">
1289 $(document).ready(function() {
1291 $(".paginationnext:last").click(function(e){
1292 var form = $("#formrecord");
1293 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1296 data: form.serialize(),
1298 success: function(result){
1299 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page + 1).$paramwithsearch.
'";
1304 $(".paginationprevious:last").click(function(e){
1305 var form = $("#formrecord");
1306 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1309 data: form.serialize(),
1311 success: function(result){
1312 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page - 1).$paramwithsearch.
'";
1316 $("#idbuttonmakemovementandclose").click(function(e){
1317 var form = $("#formrecord");
1318 var actionURL = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page).$paramwithsearch.
'";
1321 data: form.serialize(),
1323 success: function(result){
1324 window.location.href = "'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&page='.($page - 1).$paramwithsearch.
'&action=record";
1333<script
type=
"text/javascript">
1334$(
'.realqty').on(
'change',
function () {
1335 let realqty = $(
this).closest(
'tr').find(
'.realqty').val();
1336 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1337 let realpmp = $(inputPmp).val();
1338 if (!isNaN(realqty) && !isNaN(realpmp)) {
1339 let realval = realqty * realpmp;
1340 $(
this).closest(
'tr').find(
'input[name^=realvaluation]').val(realval.toFixed(2));
1342 updateTotalValuation();
1345$(
'input[class*=realpmp]').on(
'change',
function () {
1346 let inputQtyReal = $(
this).closest(
'tr').find(
'.realqty');
1347 let realqty = $(inputQtyReal).val();
1348 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1349 console.log(inputPmp);
1350 let realPmpClassname = $(inputPmp).attr(
'class').match(/[\w-]*realpmp[\w-]*/g)[0];
1351 let realpmp = $(inputPmp).val();
1352 if (!isNaN(realpmp)) {
1353 $(
'.'+realPmpClassname).val(realpmp);
1355 if (!isNaN(realqty)) {
1356 let realval = realqty * realpmp;
1357 $(
this).closest(
'tr').find(
'input[name^=realvaluation]').val(realval.toFixed(2));
1359 $(
'.realqty').trigger(
'change');
1360 updateTotalValuation();
1364$(
'input[name^=realvaluation]').on(
'change',
function () {
1365 let inputQtyReal = $(
this).closest(
'tr').find(
'.realqty');
1366 let realqty = $(inputQtyReal).val();
1367 let inputPmp = $(
this).closest(
'tr').find(
'input[class*=realpmp]');
1368 let inputRealValuation = $(
this).closest(
'tr').find(
'input[name^=realvaluation]');
1369 let realPmpClassname = $(inputPmp).attr(
'class').match(/[\w-]*realpmp[\w-]*/g)[0];
1370 let realvaluation = $(inputRealValuation).val();
1371 if (!isNaN(realvaluation) && !isNaN(realqty) && realvaluation !==
'' && realqty !==
'' && realqty !== 0) {
1372 let realpmp = realvaluation / realqty
1373 $(
'.'+realPmpClassname).val(realpmp);
1374 $(
'.realqty').trigger(
'change');
1375 updateTotalValuation();
1379function updateTotalValuation() {
1381 $(
'input[name^=realvaluation]').each(
function( index ) {
1382 let val = $(
this).val();
1383 if(!isNaN(val)) total += parseFloat($(
this).val());
1385 let currencyFractionDigits =
new Intl.NumberFormat(
'fr-FR', {
1388 }).resolvedOptions().maximumFractionDigits;
1389 $(
'#totalRealValuation').html(total.toLocaleString(
'fr-FR', {
1390 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.