29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/modules/import/import_csv.modules.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/import.lib.php';
48$confirm =
GETPOST(
'confirm',
'alpha');
49$filetoimport =
GETPOST(
'filetoimport');
52$langs->loadLangs(array(
'products',
'stocks',
'orders',
'productbatch'));
55$hookmanager->initHooks(array(
'massstockmove'));
59 $socid = $user->socid;
65$action =
GETPOST(
'action',
'aZ09');
75$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
76$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
78if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
82$offset = $limit * $page;
94 unset($_SESSION[
'massstockmove']);
97if (!empty($_SESSION[
'massstockmove'])) {
98 $listofdata = json_decode($_SESSION[
'massstockmove'],
true);
99 if (!is_array($listofdata)) {
100 $listofdata = array();
111if ($action ==
'addline' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
121 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseTarget")),
null,
'errors');
123 if ($id_sw > 0 && $id_tw == $id_sw) {
125 $langs->load(
"errors");
126 setEventMessages($langs->trans(
"ErrorWarehouseMustDiffers"),
null,
'errors');
128 if (!($id_product > 0)) {
130 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
134 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Qty")),
null,
'errors');
139 $producttmp =
new Product($db);
140 $producttmp->fetch($id_product);
141 if ($producttmp->hasbatch()) {
144 $langs->load(
"errors");
145 setEventMessages($langs->trans(
"ErrorTryToMakeMoveOnProductRequiringBatchData", $producttmp->ref),
null,
'errors');
154 if ($producttmp->hasbatch()) {
161 if (count(array_keys($listofdata)) > 0) {
162 $id = max(array_keys($listofdata)) + 1;
166 $listofdata[
$id] = array(
'id' =>
$id,
'id_product' => $id_product,
'qty' => $qty,
'id_sw' => $id_sw,
'id_tw' => $id_tw,
'batch' => $batch);
167 $_SESSION[
'massstockmove'] = json_encode($listofdata);
177if ($action ==
'delline' && $idline !=
'' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
178 if (!empty($listofdata[$idline])) {
179 unset($listofdata[$idline]);
181 if (count($listofdata) > 0) {
182 $_SESSION[
'massstockmove'] = json_encode($listofdata);
184 unset($_SESSION[
'massstockmove']);
188if ($action ==
'createmovements' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
193 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MovementLabel")),
null,
'errors');
201 foreach ($listofdata as $key => $val) {
203 $id_product = $val[
'id_product'];
204 $id_sw = $val[
'id_sw'];
205 $id_tw = $val[
'id_tw'];
207 $batch = $val[
'batch'];
211 if (!$error && $id_sw != $id_tw && is_numeric($qty) && $id_product) {
212 $result = $product->fetch($id_product);
214 $product->load_stock(
'novirtual');
218 if (!empty($product->pmp)) {
219 $pricesrc = $product->pmp;
221 $pricedest = $pricesrc;
225 if (empty(
$conf->productbatch->enabled) || !$product->hasbatch()) {
228 $result1 = $product->correct_stock(
244 $result2 = $product->correct_stock(
258 $arraybatchinfo = $product->loadBatchInfo($batch);
259 if (count($arraybatchinfo) > 0) {
260 $firstrecord = array_shift($arraybatchinfo);
261 $dlc = $firstrecord[
'eatby'];
262 $dluo = $firstrecord[
'sellby'];
275 $result1 = $product->correct_stock_batch(
294 $result2 = $product->correct_stock_batch(
320 unset($_SESSION[
'massstockmove']);
324 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php');
332if ($action ==
'importCSV' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
336 $fullpath =
$conf->stock->dir_temp.
"/".$user->id.
'-csvfiletotimport.csv';
338 if (is_numeric($resultupload) && $resultupload > 0) {
339 dol_syslog(
"File ".$fullpath.
" was added for import");
342 $langs->load(
"errors");
343 if ($resultupload ===
'ErrorDirNotWritable') {
344 setEventMessages($langs->trans(
"ErrorFailedToSaveFile").
' - '.$langs->trans($resultupload, $fullpath),
null,
'errors');
351 $importcsv =
new ImportCsv($db,
'massstocklist');
354 $nblinesrecord = $importcsv->import_get_nb_of_lines($fullpath) - 1;
355 $importcsv->import_open_file($fullpath);
356 $labelsrecord = $importcsv->import_read_record();
358 if ($nblinesrecord < 1) {
359 setEventMessages($langs->trans(
"BadNumberOfLinesMustHaveAtLeastOneLinePlusTitle"),
null,
'errors');
363 $productstatic =
new Product($db);
364 $warehousestatics =
new Entrepot($db);
365 $warehousestatict =
new Entrepot($db);
368 while (($i < $nblinesrecord) && !$error) {
369 $newrecord = $importcsv->import_read_record();
371 $data[$i] = $newrecord;
372 if (count($data[$i]) == 1) {
379 $tmp_id_sw = $data[$i][0][
'val'];
380 $tmp_id_tw = $data[$i][1][
'val'];
381 $tmp_id_product = $data[$i][2][
'val'];
382 $tmp_qty = $data[$i][3][
'val'];
383 $tmp_batch = $data[$i][4][
'val'];
385 $errorforproduct = 0;
387 if (!is_numeric($tmp_id_product) && $tmp_id_product !=
'' && preg_match(
'/^id:/i', $tmp_id_product)) {
390 $tmp_id_product = preg_replace(
'/^(id|ref):/i',
'', $tmp_id_product);
392 if ($isidorref ===
'ref') {
393 $tmp_id_product = preg_replace(
'/^ref:/',
'', $tmp_id_product);
394 $result =
fetchref($productstatic, $tmp_id_product);
395 if ($result === -2) {
397 $errorforproduct = 1;
398 $langs->load(
"errors");
399 setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_product),
null,
'errors');
400 } elseif ($result <= 0) {
402 $errorforproduct = 1;
403 $langs->load(
"errors");
404 setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_product),
null,
'errors');
406 $tmp_id_product = $result;
408 $data[$i][2][
'val'] = $tmp_id_product;
409 if (!$errorforproduct && !($tmp_id_product > 0)) {
411 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
414 if ($tmp_id_sw !==
'') {
416 $errorforwarehouses = 0;
418 if (!is_numeric($tmp_id_sw) && $tmp_id_sw !=
'' && preg_match(
'/^id:/i', $tmp_id_sw)) {
421 $tmp_id_sw = preg_replace(
'/^(id|ref):/i',
'', $tmp_id_sw);
422 if ($isidorref ===
'ref') {
423 $tmp_id_sw = preg_replace(
'/^ref:/',
'', $tmp_id_sw);
424 $result =
fetchref($warehousestatics, $tmp_id_sw);
425 if ($result === -2) {
427 $errorforwarehouses = 1;
428 $langs->load(
"errors");
429 setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_sw),
null,
'errors');
430 } elseif ($result <= 0) {
432 $errorforwarehouses = 1;
433 $langs->load(
"errors");
434 setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_sw),
null,
'errors');
436 $tmp_id_sw = $result;
438 $data[$i][0][
'val'] = $tmp_id_sw;
439 if (!$errorforwarehouses && !($tmp_id_sw > 0)) {
441 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseSource")),
null,
'errors');
445 $errorforwarehouset = 0;
447 if (!is_numeric($tmp_id_tw) && $tmp_id_tw !=
'' && preg_match(
'/^id:/i', $tmp_id_tw)) {
450 $tmp_id_tw = preg_replace(
'/^(id|ref):/i',
'', $tmp_id_tw);
451 if ($isidorref ===
'ref') {
452 $tmp_id_tw = preg_replace(
'/^ref:/',
'', $tmp_id_tw);
453 $result =
fetchref($warehousestatict, $tmp_id_tw);
454 if ($result === -2) {
456 $errorforwarehouset = 1;
457 $langs->load(
"errors");
458 setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_tw),
null,
'errors');
459 } elseif ($result <= 0) {
461 $errorforwarehouset = 1;
462 $langs->load(
"errors");
463 setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_tw),
null,
'errors');
465 $tmp_id_tw = $result;
467 $data[$i][1][
'val'] = $tmp_id_tw;
468 if (!$errorforwarehouset && !($tmp_id_tw > 0)) {
470 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseTarget")),
null,
'errors');
474 if ($tmp_id_sw > 0 && $tmp_id_tw == $tmp_id_sw) {
476 $langs->load(
"errors");
477 setEventMessages($langs->trans(
"ErrorWarehouseMustDiffers"),
null,
'errors');
481 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Qty")),
null,
'errors');
486 $producttmp =
new Product($db);
487 $producttmp->fetch($tmp_id_product);
488 if ($producttmp->hasbatch()) {
489 if (empty($tmp_batch)) {
491 $langs->load(
"errors");
492 setEventMessages($langs->trans(
"ErrorTryToMakeMoveOnProductRequiringBatchData", $producttmp->ref),
null,
'errors');
501 foreach ($data as $key => $value) {
502 if (count(array_keys($listofdata)) > 0) {
503 $id = max(array_keys($listofdata)) + 1;
507 $tmp_id_sw = $data[$key][0][
'val'];
508 $tmp_id_tw = $data[$key][1][
'val'];
509 $tmp_id_product = $data[$key][2][
'val'];
510 $tmp_qty = $data[$key][3][
'val'];
511 $tmp_batch = $data[$key][4][
'val'];
512 $listofdata[$key] = array(
'id' => $key,
'id_sw' => $tmp_id_sw,
'id_tw' => $tmp_id_tw,
'id_product' => $tmp_id_product,
'qty' => $tmp_qty,
'batch' => $tmp_batch);
518 $listofdata = array();
521 $_SESSION[
'massstockmove'] = json_encode($listofdata);
524if ($action ==
'confirm_deletefile' && $confirm ==
'yes') {
525 $langs->load(
"other");
527 $param =
'&datatoimport='.urlencode($datatoimport).
'&format='.urlencode($format);
528 if ($excludefirstline) {
529 $param .=
'&excludefirstline='.urlencode($excludefirstline);
532 $param .=
'&endatlinenb='.urlencode($endatlinenb);
542 header(
'Location: '.$_SERVER[
"PHP_SELF"]);
554$form =
new Form($db);
556$productstatic =
new Product($db);
557$warehousestatics =
new Entrepot($db);
558$warehousestatict =
new Entrepot($db);
560$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks|DE:Modul_Bestände';
562$title = $langs->trans(
'MassMovement');
564llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_massstomove');
566print
load_fiche_titre($langs->trans(
"MassStockTransferShort"),
'',
'stock');
568$titletoadd = $langs->trans(
"Select");
569$buttonrecord = $langs->trans(
"RecordMovements");
570$titletoaddnoent = $langs->transnoentitiesnoconv(
"Select");
571$buttonrecordnoent = $langs->transnoentitiesnoconv(
"RecordMovements");
572print
'<span class="opacitymedium">'.$langs->trans(
"SelectProductInAndOutWareHouse", $titletoaddnoent, $buttonrecordnoent).
'</span>';
578print
'<form name="userfile" action="'.$_SERVER[
"PHP_SELF"].
'" enctype="multipart/form-data" method="POST">';
579print
'<input type="hidden" name="token" value="'.newToken().
'">';
580print
'<input type="hidden" name="action" value="importCSV">';
581if (!empty(
$conf->dol_optimize_smallscreen)) {
584print
'<span class="opacitymedium">';
585print $langs->trans(
"or");
587$importcsv =
new ImportCsv($db,
'massstocklist');
588print $form->textwithpicto($langs->trans(
'SelectAStockMovementFileToImport'), $langs->transnoentitiesnoconv(
"InfoTemplateImport", $importcsv->separator));
592$maxmin = $maxfilesizearray[
'maxmin'];
594 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
596print
'<input type="file" name="userfile" size="20" maxlength="80"> ';
598print
'<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans(
"ImportFromCSV").
'"'.$out.
' name="sendit">';
602 $maxphp = @ini_get(
'upload_max_filesize');
603 if (preg_match(
'/k$/i', $maxphp)) {
604 $maxphp = preg_replace(
'/k$/i',
'', $maxphp);
605 $maxphp = (int) $maxphp * 1;
607 if (preg_match(
'/m$/i', $maxphp)) {
608 $maxphp = preg_replace(
'/m$/i',
'', $maxphp);
609 $maxphp = (int) $maxphp * 1024;
611 if (preg_match(
'/g$/i', $maxphp)) {
612 $maxphp = preg_replace(
'/g$/i',
'', $maxphp);
613 $maxphp = (int) $maxphp * 1024 * 1024;
615 if (preg_match(
'/t$/i', $maxphp)) {
616 $maxphp = preg_replace(
'/t$/i',
'', $maxphp);
617 $maxphp = (int) $maxphp * 1024 * 1024 * 1024;
619 $maxphp2 = @ini_get(
'post_max_size');
620 if (preg_match(
'/k$/i', $maxphp2)) {
621 $maxphp2 = preg_replace(
'/k$/i',
'', $maxphp2);
622 $maxphp2 = (int) $maxphp2 * 1;
624 if (preg_match(
'/m$/i', $maxphp2)) {
625 $maxphp2 = preg_replace(
'/m$/i',
'', $maxphp2);
626 $maxphp2 = (int) $maxphp2 * 1024;
628 if (preg_match(
'/g$/i', $maxphp2)) {
629 $maxphp2 = preg_replace(
'/g$/i',
'', $maxphp2);
630 $maxphp2 = (int) $maxphp2 * 1024 * 1024;
632 if (preg_match(
'/t$/i', $maxphp2)) {
633 $maxphp2 = preg_replace(
'/t$/i',
'', $maxphp2);
634 $maxphp2 = (int) $maxphp2 * 1024 * 1024 * 1024;
638 $maxphptoshow = $maxphptoshowparam =
'';
640 $maxmin = min($max, $maxphp);
641 $maxphptoshow = $maxphp;
642 $maxphptoshowparam =
'upload_max_filesize';
645 $maxmin = min($max, $maxphp2);
646 if ($maxphp2 < $maxphp) {
647 $maxphptoshow = $maxphp2;
648 $maxphptoshowparam =
'post_max_size';
652 $langs->load(
'other');
654 $out .=
info_admin($langs->trans(
"ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
656 $out .=
' ('.$langs->trans(
"UploadDisabled").
')';
665print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">';
666print
'<input type="hidden" name="token" value="'.newToken().
'">';
667print
'<input type="hidden" name="action" value="addline">';
670print
'<div class="div-table-responsive-no-min">';
671print
'<table class="liste noborder centpercent">';
675print
'<tr class="liste_titre">';
676print
getTitleFieldOfList($langs->trans(
'WarehouseSource'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
677print
getTitleFieldOfList($langs->trans(
'WarehouseTarget'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
678print
getTitleFieldOfList($langs->trans(
'Product'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
679if (isModEnabled(
'productbatch')) {
680 print
getTitleFieldOfList($langs->trans(
'Batch'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
682print
getTitleFieldOfList($langs->trans(
'Qty'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right tagtd maxwidthonsmartphone ');
686print
'<tr class="oddeven">';
688print
'<td class="nowraponall">';
689print
img_picto($langs->trans(
"WarehouseSource"),
'stock',
'class="paddingright"').$formproduct->selectWarehouses($id_sw,
'id_sw',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'minwidth200imp maxwidth200');
692print
'<td class="nowraponall">';
693print
img_picto($langs->trans(
"WarehouseTarget"),
'stock',
'class="paddingright"').$formproduct->selectWarehouses($id_tw,
'id_tw',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'minwidth200imp maxwidth200');
696print
'<td class="nowraponall">';
706print
img_picto($langs->trans(
"Product"),
'product',
'class="paddingright"');
707print $form->select_produits((isset($id_product) ? $id_product : 0),
'productid', $filtertype, $limit, 0, -1, 2,
'', 1, array(), 0,
'1', 0,
'minwidth200imp maxwidth300', 1,
'', null, 1);
710if (isModEnabled(
'productbatch')) {
711 print
'<td class="nowraponall">';
712 print
img_picto($langs->trans(
"LotSerial"),
'lot',
'class="paddingright"');
713 print
'<input type="text" name="batch" class="flat maxwidth75" value="'.dol_escape_htmltag((isset($batch) ? $batch :
'')).
'">';
717print
'<td class="right"><input type="text" class="flat maxwidth50 right" name="qty" value="'.price2num((
float) (isset($qty) ? $qty : 0),
'MS').
'"></td>';
719print
'<td class="right"><input type="submit" class="button" name="addline" value="'.dol_escape_htmltag($titletoadd).
'"></td>';
723foreach ($listofdata as $key => $val) {
724 $productstatic->id = 0;
725 $productstatic->fetch($val[
'id_product']);
727 $warehousestatics->id = 0;
728 if ($val[
'id_sw'] > 0) {
729 $warehousestatics->fetch($val[
'id_sw']);
731 $warehousestatict->id = 0;
732 if ($val[
'id_tw'] > 0) {
733 $warehousestatict->fetch($val[
'id_tw']);
736 if ($productstatic->id <= 0) {
738 setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"Product").
' (id='.$val[
'id_product'].
')'),
null,
'errors');
740 if ($warehousestatics->id < 0) {
742 setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"WarehouseSource").
' (id='.$val[
'id_sw'].
')'),
null,
'errors');
744 if ($warehousestatict->id <= 0) {
746 setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"WarehouseTarget").
' (id='.$val[
'id_tw'].
')'),
null,
'errors');
750 print
'<tr class="oddeven">';
752 if ($warehousestatics->id > 0) {
753 print $warehousestatics->getNomUrl(1);
755 print
'<span class="opacitymedium">';
756 print $langs->trans(
"None");
761 print $warehousestatict->getNomUrl(1);
766 if (isModEnabled(
'productbatch')) {
771 print
'<td class="right">'.price2num((
float) $val[
'qty'],
'MS').
'</td>';
772 print
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=delline&token='.
newToken().
'&idline='.$val[
'id'].
'">'.
img_delete($langs->trans(
"Remove")).
'</a></td>';
785if (count($listofdata)) {
786 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire2" class="formconsumeproduce">';
787 print
'<input type="hidden" name="token" value="'.newToken().
'">';
788 print
'<input type="hidden" name="action" value="createmovements">';
792 $labelmovement =
GETPOST(
"label") ?
GETPOST(
'label') : $langs->trans(
"MassStockTransferShort").
' '.
dol_print_date($now,
'%Y-%m-%d %H:%M');
794 print
'<div class="center">';
795 print
'<span class="fieldrequired">'.$langs->trans(
"InventoryCode").
':</span> ';
796 print
'<input type="text" name="codemove" class="maxwidth300" value="'.dol_escape_htmltag($codemove).
'"> ';
797 print
'<span class="clearbothonsmartphone"></span>';
798 print $langs->trans(
"MovementLabel").
': ';
799 print
'<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($labelmovement).
'"><br>';
802 print
'<div class="center"><input type="submit" class="button" name="valid" value="'.dol_escape_htmltag($buttonrecord).
'"></div>';
810if ($action ==
'delete') {
811 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?urlfile='.urlencode(
GETPOST(
'urlfile')).
'&step=3'.$param, $langs->trans(
'DeleteFile'), $langs->trans(
'ConfirmDeleteFile'),
'confirm_deletefile',
'', 0, 1);
828 $length = strlen($needle);
829 return substr($haystack, 0, $length) === $needle;
842 $tmp_ref = str_replace(
'ref:',
'', $tmp_ref);
844 $static_object->id = 0;
845 $static_object->fetch(0, $tmp_ref);
846 return $static_object->id;
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 import CSV files.
Class to manage products or services.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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...
startsWith($haystack, $needle)
Verify if $haystack startswith $needle.
fetchref($static_object, $tmp_ref)
Fetch object with ref.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
getMaxFileSizeArray()
Return the max allowed for file upload.
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.