30require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/modules/import/import_csv.modules.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
46require_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();
106$permissiontodelete = $user->hasRight(
'stock',
'mouvement',
'creer');
113if ($action ==
'addline' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
123 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseTarget")),
null,
'errors');
125 if ($id_sw > 0 && $id_tw == $id_sw) {
127 $langs->load(
"errors");
128 setEventMessages($langs->trans(
"ErrorWarehouseMustDiffers"),
null,
'errors');
130 if (!($id_product > 0)) {
132 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
136 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Qty")),
null,
'errors');
143 $producttmp->fetch($id_product);
144 if ($producttmp->hasbatch()) {
147 $langs->load(
"errors");
148 setEventMessages($langs->trans(
"ErrorTryToMakeMoveOnProductRequiringBatchData", $producttmp->ref),
null,
'errors');
155 if (!$error && $producttmp !==
null) {
157 if ($producttmp->hasbatch()) {
163 if (count(array_keys($listofdata)) > 0) {
164 $id = max(array_keys($listofdata)) + 1;
168 $listofdata[
$id] = array(
'id' =>
$id,
'id_product' => $id_product,
'qty' => $qty,
'id_sw' => $id_sw,
'id_tw' => $id_tw,
'batch' => $batch);
169 $_SESSION[
'massstockmove'] = json_encode($listofdata);
179if ($action ==
'delline' && $idline !=
'' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
180 if (!empty($listofdata[$idline])) {
181 unset($listofdata[$idline]);
183 if (count($listofdata) > 0) {
184 $_SESSION[
'massstockmove'] = json_encode($listofdata);
186 unset($_SESSION[
'massstockmove']);
190if ($action ==
'createmovements' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
195 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MovementLabel")),
null,
'errors');
203 foreach ($listofdata as $key => $val) {
205 $id_product = $val[
'id_product'];
206 $id_sw = $val[
'id_sw'];
207 $id_tw = $val[
'id_tw'];
209 $batch = $val[
'batch'];
213 if (!$error && $id_sw != $id_tw && is_numeric($qty) && $id_product) {
214 $result = $product->fetch($id_product);
216 $product->load_stock(
'novirtual');
220 if (!empty($product->pmp)) {
221 $pricesrc = (float) $product->pmp;
223 $pricedest = $pricesrc;
227 if (!
isModEnabled(
'productbatch') || !$product->hasbatch()) {
230 $result1 = $product->correct_stock(
246 $result2 = $product->correct_stock(
260 $arraybatchinfo = $product->loadBatchInfo($batch);
261 if (count($arraybatchinfo) > 0) {
262 $firstrecord = array_shift($arraybatchinfo);
263 $dlc = $firstrecord[
'eatby'];
264 $dluo = $firstrecord[
'sellby'];
272 $result1 = $product->correct_stock_batch(
291 $result2 = $product->correct_stock_batch(
316 unset($_SESSION[
'massstockmove']);
320 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php');
328if ($action ==
'importCSV' && $user->hasRight(
'stock',
'mouvement',
'creer')) {
332 $fullpath =
$conf->stock->dir_temp.
"/".$user->id.
'-csvfiletotimport.csv';
334 if (is_numeric($resultupload) && $resultupload > 0) {
335 dol_syslog(
"File ".$fullpath.
" was added for import");
338 $langs->load(
"errors");
339 if ($resultupload ===
'ErrorDirNotWritable') {
340 setEventMessages($langs->trans(
"ErrorFailedToSaveFile").
' - '.$langs->trans($resultupload, $fullpath),
null,
'errors');
350 $nblinesrecord = $importcsv->import_get_nb_of_lines($fullpath) - 1;
351 $importcsv->import_open_file($fullpath);
352 $labelsrecord = $importcsv->import_read_record();
354 if ($nblinesrecord < 1) {
355 $langs->load(
"errors");
356 setEventMessages($langs->trans(
"ErrorBadNumberOfLinesMustHaveAtLeastOneLinePlusTitle"),
null,
'errors');
365 while (($i < $nblinesrecord) && !$error) {
366 $newrecord = $importcsv->import_read_record();
368 $data[$i] = $newrecord;
369 if (count($data[$i]) == 1) {
376 $tmp_id_sw = $data[$i][0][
'val'];
377 $tmp_id_tw = $data[$i][1][
'val'];
378 $tmp_id_product = $data[$i][2][
'val'];
379 $tmp_qty = $data[$i][3][
'val'];
380 $tmp_batch = $data[$i][4][
'val'];
382 $errorforproduct = 0;
384 if (!is_numeric($tmp_id_product) && $tmp_id_product !=
'' && preg_match(
'/^id:/i', $tmp_id_product)) {
387 $tmp_id_product = preg_replace(
'/^(id|ref):/i',
'', $tmp_id_product);
389 if ($isidorref ===
'ref') {
390 $tmp_id_product = preg_replace(
'/^ref:/',
'', $tmp_id_product);
391 $result =
fetchref($productstatic, $tmp_id_product);
392 if ($result === -2) {
394 $errorforproduct = 1;
395 $langs->load(
"errors");
396 setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_product),
null,
'errors');
397 } elseif ($result <= 0) {
399 $errorforproduct = 1;
400 $langs->load(
"errors");
401 setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_product),
null,
'errors');
403 $tmp_id_product = $result;
405 $data[$i][2][
'val'] = $tmp_id_product;
406 if (!$errorforproduct && !($tmp_id_product > 0)) {
408 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
411 if ($tmp_id_sw !==
'') {
413 $errorforwarehouses = 0;
415 if (!is_numeric($tmp_id_sw) && $tmp_id_sw !=
'' && preg_match(
'/^id:/i', $tmp_id_sw)) {
418 $tmp_id_sw = preg_replace(
'/^(id|ref):/i',
'', $tmp_id_sw);
419 if ($isidorref ===
'ref') {
420 $tmp_id_sw = preg_replace(
'/^ref:/',
'', $tmp_id_sw);
421 $result =
fetchref($warehousestatics, $tmp_id_sw);
422 if ($result === -2) {
424 $errorforwarehouses = 1;
425 $langs->load(
"errors");
426 setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_sw),
null,
'errors');
427 } elseif ($result <= 0) {
429 $errorforwarehouses = 1;
430 $langs->load(
"errors");
431 setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_sw),
null,
'errors');
433 $tmp_id_sw = $result;
435 $data[$i][0][
'val'] = $tmp_id_sw;
436 if (!$errorforwarehouses && !($tmp_id_sw > 0)) {
438 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseSource")),
null,
'errors');
442 $errorforwarehouset = 0;
444 if (!is_numeric($tmp_id_tw) && $tmp_id_tw !=
'' && preg_match(
'/^id:/i', $tmp_id_tw)) {
447 $tmp_id_tw = preg_replace(
'/^(id|ref):/i',
'', $tmp_id_tw);
448 if ($isidorref ===
'ref') {
449 $tmp_id_tw = preg_replace(
'/^ref:/',
'', $tmp_id_tw);
450 $result =
fetchref($warehousestatict, $tmp_id_tw);
451 if ($result === -2) {
453 $errorforwarehouset = 1;
454 $langs->load(
"errors");
455 setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_tw),
null,
'errors');
456 } elseif ($result <= 0) {
458 $errorforwarehouset = 1;
459 $langs->load(
"errors");
460 setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_tw),
null,
'errors');
462 $tmp_id_tw = $result;
464 $data[$i][1][
'val'] = $tmp_id_tw;
465 if (!$errorforwarehouset && !($tmp_id_tw > 0)) {
467 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseTarget")),
null,
'errors');
471 if ($tmp_id_sw > 0 && $tmp_id_tw == $tmp_id_sw) {
473 $langs->load(
"errors");
474 setEventMessages($langs->trans(
"ErrorWarehouseMustDiffers"),
null,
'errors');
478 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Qty")),
null,
'errors');
480 if (!is_numeric($tmp_qty)) {
488 $producttmp->fetch($tmp_id_product);
489 if ($producttmp->hasbatch()) {
490 if (empty($tmp_batch)) {
492 $langs->load(
"errors");
493 setEventMessages($langs->trans(
"ErrorTryToMakeMoveOnProductRequiringBatchData", $producttmp->ref),
null,
'errors');
502 foreach ($data as $key => $value) {
503 if (count(array_keys($listofdata)) > 0) {
504 $id = max(array_keys($listofdata)) + 1;
508 $tmp_id_sw = $data[$key][0][
'val'];
509 $tmp_id_tw = $data[$key][1][
'val'];
510 $tmp_id_product = $data[$key][2][
'val'];
511 $tmp_qty = $data[$key][3][
'val'];
512 $tmp_batch = $data[$key][4][
'val'];
513 $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);
519 $listofdata = array();
522 $_SESSION[
'massstockmove'] = json_encode($listofdata);
525if ($action ==
'confirm_deletefile' && $confirm ==
'yes' && $permissiontodelete) {
526 $langs->load(
"other");
535 header(
'Location: '.$_SERVER[
"PHP_SELF"]);
553$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks|DE:Modul_Bestände';
555$title = $langs->trans(
'MassMovement');
557llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_massstomove');
559print
load_fiche_titre($langs->trans(
"MassStockTransferShort"),
'',
'stock');
561$titletoadd = $langs->trans(
"Select");
562$buttonrecord = $langs->trans(
"RecordMovements");
563$titletoaddnoent = $langs->transnoentitiesnoconv(
"Select");
564$buttonrecordnoent = $langs->transnoentitiesnoconv(
"RecordMovements");
565print
'<span class="opacitymedium">'.$langs->trans(
"SelectProductInAndOutWareHouse", $titletoaddnoent, $buttonrecordnoent).
'</span>';
571print
'<form name="userfile" action="'.$_SERVER[
"PHP_SELF"].
'" enctype="multipart/form-data" method="POST">';
572print
'<input type="hidden" name="token" value="'.newToken().
'">';
573print
'<input type="hidden" name="action" value="importCSV">';
574if (!empty(
$conf->dol_optimize_smallscreen)) {
577print
'<span class="opacitymedium">';
578print $langs->trans(
"or");
581print $form->textwithpicto($langs->trans(
'SelectAStockMovementFileToImport'), $langs->transnoentitiesnoconv(
"InfoTemplateImport", $importcsv->separator));
585$maxmin = $maxfilesizearray[
'maxmin'];
587 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
589print
'<input type="file" name="userfile" size="20" maxlength="80"> ';
591print
'<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans(
"ImportFromCSV").
'"'.$out.
' name="sendit">';
595 $maxphp = @ini_get(
'upload_max_filesize');
596 if (preg_match(
'/k$/i', $maxphp)) {
597 $maxphp = preg_replace(
'/k$/i',
'', $maxphp);
598 $maxphp = (int) $maxphp * 1;
600 if (preg_match(
'/m$/i', $maxphp)) {
601 $maxphp = preg_replace(
'/m$/i',
'', $maxphp);
602 $maxphp = (int) $maxphp * 1024;
604 if (preg_match(
'/g$/i', $maxphp)) {
605 $maxphp = preg_replace(
'/g$/i',
'', $maxphp);
606 $maxphp = (int) $maxphp * 1024 * 1024;
608 if (preg_match(
'/t$/i', $maxphp)) {
609 $maxphp = preg_replace(
'/t$/i',
'', $maxphp);
610 $maxphp = (int) $maxphp * 1024 * 1024 * 1024;
612 $maxphp2 = @ini_get(
'post_max_size');
613 if (preg_match(
'/k$/i', $maxphp2)) {
614 $maxphp2 = preg_replace(
'/k$/i',
'', $maxphp2);
615 $maxphp2 = (int) $maxphp2 * 1;
617 if (preg_match(
'/m$/i', $maxphp2)) {
618 $maxphp2 = preg_replace(
'/m$/i',
'', $maxphp2);
619 $maxphp2 = (int) $maxphp2 * 1024;
621 if (preg_match(
'/g$/i', $maxphp2)) {
622 $maxphp2 = preg_replace(
'/g$/i',
'', $maxphp2);
623 $maxphp2 = (int) $maxphp2 * 1024 * 1024;
625 if (preg_match(
'/t$/i', $maxphp2)) {
626 $maxphp2 = preg_replace(
'/t$/i',
'', $maxphp2);
627 $maxphp2 = (int) $maxphp2 * 1024 * 1024 * 1024;
631 $maxphptoshow = $maxphptoshowparam =
'';
633 $maxmin = min($max, $maxphp);
634 $maxphptoshow = $maxphp;
635 $maxphptoshowparam =
'upload_max_filesize';
638 $maxmin = min($max, $maxphp2);
639 if ($maxphp2 < $maxphp) {
640 $maxphptoshow = $maxphp2;
641 $maxphptoshowparam =
'post_max_size';
645 $langs->load(
'other');
647 $out .=
info_admin($langs->trans(
"ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
649 $out .=
' ('.$langs->trans(
"UploadDisabled").
')';
658print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">';
659print
'<input type="hidden" name="token" value="'.newToken().
'">';
660print
'<input type="hidden" name="action" value="addline">';
663print
'<div class="div-table-responsive-no-min">';
664print
'<table class="liste noborder centpercent">';
668print
'<tr class="liste_titre">';
669print
getTitleFieldOfList($langs->trans(
'WarehouseSource'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
670print
getTitleFieldOfList($langs->trans(
'WarehouseTarget'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
671print
getTitleFieldOfList($langs->trans(
'Product'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
673 print
getTitleFieldOfList($langs->trans(
'Batch'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'tagtd maxwidthonsmartphone ');
675print
getTitleFieldOfList($langs->trans(
'Qty'), 0, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right tagtd maxwidthonsmartphone ');
679print
'<tr class="oddeven">';
681print
'<td class="nowraponall">';
682print
img_picto($langs->trans(
"WarehouseSource"),
'stock',
'class="paddingright"').$formproduct->selectWarehouses(is_null($id_sw) ?
'' : $id_sw,
'id_sw',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'minwidth200imp maxwidth200');
685print
'<td class="nowraponall">';
686print
img_picto($langs->trans(
"WarehouseTarget"),
'stock',
'class="paddingright"').$formproduct->selectWarehouses(is_null($id_sw) ?
'' : $id_tw,
'id_tw',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'minwidth200imp maxwidth200');
689print
'<td class="nowraponall">';
699print
img_picto($langs->trans(
"Product"),
'product',
'class="paddingright"');
700print $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);
704 print
'<td class="nowraponall">';
705 print
img_picto($langs->trans(
"LotSerial"),
'lot',
'class="paddingright"');
706 print
'<input type="text" name="batch" class="flat maxwidth75" value="'.dol_escape_htmltag((isset($batch) ? $batch :
'')).
'">';
710print
'<td class="right"><input type="text" class="flat maxwidth50 right" name="qty" value="'.price2num((
float) (isset($qty) ? $qty : 0),
'MS').
'"></td>';
712print
'<td class="right"><input type="submit" class="button" name="addline" value="'.dol_escape_htmltag($titletoadd).
'"></td>';
716foreach ($listofdata as $key => $val) {
717 $productstatic->id = 0;
718 $productstatic->fetch($val[
'id_product']);
720 $warehousestatics->id = 0;
721 if ($val[
'id_sw'] > 0) {
722 $warehousestatics->fetch($val[
'id_sw']);
724 $warehousestatict->id = 0;
725 if ($val[
'id_tw'] > 0) {
726 $warehousestatict->fetch($val[
'id_tw']);
729 if ($productstatic->id <= 0) {
731 setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"Product").
' (id='.$val[
'id_product'].
')'),
null,
'errors');
733 if ($warehousestatics->id < 0) {
735 setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"WarehouseSource").
' (id='.$val[
'id_sw'].
')'),
null,
'errors');
737 if ($warehousestatict->id <= 0) {
739 setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"WarehouseTarget").
' (id='.$val[
'id_tw'].
')'),
null,
'errors');
743 print
'<tr class="oddeven">';
745 if ($warehousestatics->id > 0) {
746 print $warehousestatics->getNomUrl(1);
748 print
'<span class="opacitymedium">';
749 print $langs->trans(
"None");
754 print $warehousestatict->getNomUrl(1);
764 print
'<td class="right">'.price2num((
float) $val[
'qty'],
'MS').
'</td>';
765 print
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=delline&token='.
newToken().
'&idline='.$val[
'id'].
'">'.
img_delete($langs->trans(
"Remove")).
'</a></td>';
778if (count($listofdata)) {
779 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire2" class="formconsumeproduce">';
780 print
'<input type="hidden" name="token" value="'.newToken().
'">';
781 print
'<input type="hidden" name="action" value="createmovements">';
785 $labelmovement =
GETPOST(
"label") ?
GETPOST(
'label') : $langs->trans(
"MassStockTransferShort").
' '.
dol_print_date($now,
'%Y-%m-%d %H:%M');
787 print
'<div class="center">';
788 print
'<span class="fieldrequired">'.$langs->trans(
"InventoryCode").
':</span> ';
789 print
'<input type="text" name="codemove" class="maxwidth300" value="'.dol_escape_htmltag($codemove).
'"> ';
790 print
'<span class="clearbothonsmartphone"></span>';
791 print $langs->trans(
"MovementLabel").
': ';
792 print
'<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($labelmovement).
'"><br>';
795 print
'<div class="center"><input type="submit" class="button" name="valid" value="'.dol_escape_htmltag($buttonrecord).
'"></div>';
803if ($action ==
'delete') {
804 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?urlfile='.urlencode(
GETPOST(
'urlfile')).
'&step=3'.$param, $langs->trans(
'DeleteFile'), $langs->trans(
'ConfirmDeleteFile'),
'confirm_deletefile',
'', 0, 1);
821 $length = strlen($needle);
822 return substr($haystack, 0, $length) === $needle;
835 $tmp_ref = str_replace(
'ref:',
'', $tmp_ref);
837 $static_object->id = 0;
838 $static_object->fetch(0, $tmp_ref);
839 return $static_object->id;
$id
Support class for third parties, contacts, members, users or resources.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage warehouses.
Class to 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, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
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.
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.