31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43if (isModEnabled(
'project')) {
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49$langs->loadLangs(array(
'products',
'stocks',
'orders'));
50if (isModEnabled(
'productbatch')) {
51 $langs->load(
"productbatch");
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$cancel =
GETPOST(
'cancel',
'alpha');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
59$toselect =
GETPOST(
'toselect',
'array');
60$backtopage =
GETPOST(
"backtopage",
"alpha");
61$optioncss =
GETPOST(
'optioncss',
'aZ');
62$show_files =
GETPOST(
'show_files',
'aZ');
68$idproduct =
GETPOST(
'idproduct',
'intcomma');
69$product_id =
GETPOST(
"product_id",
'intcomma');
72$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
73$search_date_startday =
GETPOSTINT(
'search_date_startday');
74$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
75$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
76$search_date_endday =
GETPOSTINT(
'search_date_endday');
77$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
78$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
81$search_ref =
GETPOST(
'search_ref',
'alpha');
82$search_movement =
GETPOST(
"search_movement");
83$search_product_ref = trim(
GETPOST(
"search_product_ref"));
84$search_product = trim(
GETPOST(
"search_product"));
85$search_warehouse = trim(
GETPOST(
"search_warehouse"));
86$search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
87$search_user = trim(
GETPOST(
"search_user"));
88$search_batch = trim(
GETPOST(
"search_batch"));
89$search_qty = trim(
GETPOST(
"search_qty"));
90$search_type_mouvement =
GETPOST(
'search_type_mouvement');
91$search_fk_project =
GETPOST(
"search_fk_project");
97$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
98$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
100if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
104$offset = $limit * $page;
105$pageprev = $page - 1;
106$pagenext = $page + 1;
109 $sortfield =
"m.datem";
120$diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
121$hookmanager->initHooks(array($contextpage));
126$extrafields->fetch_name_optionals_label(
$object->table_element);
128$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
131 'm.rowid' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 1),
132 'm.datem' => array(
'label' =>
"Date",
'checked' => 1,
'position' => 2),
133 'p.ref' => array(
'label' =>
"ProductRef",
'checked' => 1,
'css' =>
'maxwidth100',
'position' => 3),
134 'p.label' => array(
'label' =>
"ProductLabel",
'checked' => 0,
'position' => 5),
135 'm.batch' => array(
'label' =>
"BatchNumberShort",
'checked' => 1,
'position' => 8,
'enabled' => (isModEnabled(
'productbatch'))),
136 'pl.eatby' => array(
'label' =>
"EatByDate",
'checked' => 0,
'position' => 9,
'enabled' => (isModEnabled(
'productbatch'))),
137 'pl.sellby' => array(
'label' =>
"SellByDate",
'checked' => 0,
'position' => 10,
'enabled' => (isModEnabled(
'productbatch'))),
138 'e.ref' => array(
'label' =>
"Warehouse",
'checked' => 1,
'position' => 100,
'enabled' => (!($id > 0))),
139 'm.fk_user_author' => array(
'label' =>
"Author",
'checked' => 0,
'position' => 120),
140 'm.inventorycode' => array(
'label' =>
"InventoryCodeShort",
'checked' => 1,
'position' => 130),
141 'm.label' => array(
'label' =>
"MovementLabel",
'checked' => 1,
'position' => 140),
142 'm.type_mouvement' => array(
'label' =>
"TypeMovement",
'checked' => 0,
'position' => 150),
143 'origin' => array(
'label' =>
"Origin",
'checked' => 1,
'position' => 155),
144 'm.fk_projet' => array(
'label' =>
'Project',
'checked' => 0,
'position' => 180),
145 'm.value' => array(
'label' =>
"Qty",
'checked' => 1,
'position' => 200),
146 'm.price' => array(
'label' =>
"UnitPurchaseValue",
'checked' => 0,
'position' => 210,
'enabled' => (!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
151include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
154 unset($arrayfields[
'pl.sellby']);
157 unset($arrayfields[
'pl.eatby']);
162if ($id > 0 || !empty($ref)) {
163 $tmpwarehouse->fetch($id, $ref);
164 $id = $tmpwarehouse->id;
173if (!$user->hasRight(
'stock',
'mouvement',
'lire')) {
177$uploaddir = $conf->stock->dir_output.
'/movements';
179$permissiontoread = $user->hasRight(
'stock',
'mouvement',
'lire');
180$permissiontoadd = $user->hasRight(
'stock',
'mouvement',
'creer');
181$permissiontodelete = $user->hasRight(
'stock',
'mouvement',
'creer');
183$usercanread = $user->hasRight(
'stock',
'mouvement',
'lire');
184$usercancreate = $user->hasRight(
'stock',
'mouvement',
'creer');
185$usercandelete = $user->hasRight(
'stock',
'mouvement',
'creer');
194if (
GETPOST(
'cancel',
'alpha')) {
198if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
202$parameters = array();
203$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
208if (empty($reshook)) {
210 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
213 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
214 $search_date_startday =
'';
215 $search_date_startmonth =
'';
216 $search_date_startyear =
'';
217 $search_date_endday =
'';
218 $search_date_endmonth =
'';
219 $search_date_endyear =
'';
220 $search_date_start =
'';
221 $search_date_end =
'';
223 $search_movement =
"";
224 $search_type_mouvement =
"";
225 $search_inventorycode =
"";
226 $search_product_ref =
"";
227 $search_product =
"";
228 $search_warehouse =
"";
232 $search_fk_project =
"";
235 $search_array_options = array();
237 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
238 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
243 $objectclass =
'MouvementStock';
244 $objectlabel =
'MouvementStock';
246 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
247 if (empty($diroutputmassaction)) {
248 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
252 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
253 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
254 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
257 $listofobjectid = array();
258 foreach ($toselect as $toselectid) {
260 $result = $objecttmp->fetch($toselectid);
262 $listofobjectid[$toselectid] = $toselectid;
266 $arrayofinclusion = array();
267 foreach ($listofobjectref as $tmppdf) {
270 foreach ($listofobjectref as $tmppdf) {
271 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
273 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0, 1);
276 $outputlangs = $langs;
279 $newlang =
GETPOST(
'lang_id',
'aZ09');
284 if (!empty($newlang)) {
286 $outputlangs->setDefaultLang($newlang);
294 $filename = preg_replace(
'/\s/',
'_', $filename);
306 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
315 $langs->load(
"exports");
324 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
327if ($action ==
'update_extras' && $permissiontoadd) {
328 $whClass = get_class($whClass);
329 $whClass::$oldcopy =
dol_clone($tmpwarehouse, 2);
332 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse,
GETPOST(
'attribute',
'restricthtml'));
337 $result = $tmpwarehouse->insertExtraFields();
344 $action =
'edit_extras';
356if ($action ==
"correct_stock" && $permissiontoadd) {
358 if (!empty($product_id)) {
359 $result = $product->fetch($product_id);
364 if (empty($product_id)) {
366 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
367 $action =
'correction';
369 if (!is_numeric(
GETPOST(
"nbpiece"))) {
371 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
372 $action =
'correction';
376 $origin_element =
'';
380 $origin_element =
'project';
384 if ($product->hasbatch()) {
385 $batch =
GETPOST(
'batch_number',
'alphanohtml');
392 $result = $product->correct_stock_batch(
397 GETPOST(
"label",
'alphanohtml'),
402 GETPOST(
'inventorycode',
'alphanohtml'),
409 $result = $product->correct_stock(
414 GETPOST(
"label",
'alphanohtml'),
416 GETPOST(
'inventorycode',
'alphanohtml'),
425 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
430 $action =
'correction';
440if ($action ==
"transfert_stock" && $permissiontoadd && !$cancel) {
443 if (!empty($product_id)) {
444 $result = $product->fetch($product_id);
447 if (!(
GETPOSTINT(
"id_entrepot_destination") > 0)) {
448 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
450 $action =
'transfert';
452 if (empty($product_id)) {
454 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
455 $action =
'transfert';
458 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
460 $action =
'transfert';
462 if ($id ==
GETPOSTINT(
"id_entrepot_destination")) {
463 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
465 $action =
'transfert';
468 if (isModEnabled(
'productbatch')) {
470 $result = $product->fetch($product_id);
472 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
473 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
475 $action =
'transfert';
482 $result = $warehouse->fetch($id);
486 $product->load_stock(
'novirtual');
490 if (isset($product->pmp)) {
491 $pricesrc = $product->pmp;
493 $pricedest = $pricesrc;
495 if ($product->hasbatch()) {
502 $result = $pdluo->fetch($pdluoid);
504 $srcwarehouseid = $pdluo->warehouseid;
505 $batch = $pdluo->batch;
506 $eatby = $pdluo->eatby;
507 $sellby = $pdluo->sellby;
513 $srcwarehouseid =
$id;
514 $batch =
GETPOST(
'batch_number',
'alphanohtml');
523 $result1 = $product->correct_stock_batch(
540 $result2 = $product->correct_stock_batch(
550 GETPOST(
'inventorycode',
'alphanohtml'),
559 $result1 = $product->correct_stock(
566 GETPOST(
'inventorycode',
'alphanohtml'),
574 $result2 = $product->correct_stock(
576 GETPOST(
"id_entrepot_destination"),
581 GETPOST(
'inventorycode',
'alphanohtml'),
588 if (!$error && $result1 >= 0 && $result2 >= 0) {
592 header(
"Location: ".$backtopage);
595 header(
"Location: movement_list.php?id=".$warehouse->id);
601 $action =
'transfert';
608if ($action ==
'confirm_reverse' && $confirm ==
"yes" && $permissiontoadd) {
609 $toselect = array_map(
'intval', $toselect);
611 $sql =
"SELECT rowid, label, inventorycode, datem";
612 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement";
613 $sql .=
" WHERE rowid IN (";
614 foreach ($toselect as $id) {
615 $sql .= ((int) $id).
",";
617 $sql = rtrim($sql,
',');
620 $resql = $db->query($sql);
622 $num = $db->num_rows($resql);
627 $obj = $db->fetch_object($resql);
629 $reverse =
$object->reverseMouvement();
638 setEventMessages($langs->trans(
"WarningAlreadyReverse", $langs->transnoentities($idAlreadyReverse)),
null,
'warnings');
643 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
652$form =
new Form($db);
654if (isModEnabled(
'project')) {
660$productstatic =
new Product($db);
661$warehousestatic =
new Entrepot($db);
663$userstatic =
new User($db);
669$sql =
"SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tosell, p.tobuy, p.tobatch, p.fk_product_type as type, p.entity,";
670$sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
671$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
672$sql .=
" m.batch, m.price,";
673$sql .=
" m.type_mouvement,";
674$sql .=
" m.fk_projet as fk_project,";
675$sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
676$sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
678if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
679 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
680 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
684$parameters = array();
685$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
686$sql .= $hookmanager->resPrint;
687$sql = preg_replace(
'/,\s*$/',
'', $sql);
691$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
692$sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
693$sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
694if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
695 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
697$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
698$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
701$parameters = array();
702$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
703$sql .= $hookmanager->resPrint;
705$sql .=
" WHERE m.fk_product = p.rowid";
707 $sql .=
" AND m.rowid = ".((int) $msid);
709$sql .=
" AND m.fk_entrepot = e.rowid";
710$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
712 $sql .=
" AND p.fk_product_type = 0";
715 $sql .=
" AND e.rowid = ".((int) $id);
717if (!empty($search_date_start)) {
718 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
720if (!empty($search_date_end)) {
721 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
724 $sql .=
" AND p.rowid = ".((int) $idproduct);
726if (!empty($search_ref)) {
729if (!empty($search_movement)) {
732if (!empty($search_inventorycode)) {
735if (!empty($search_product_ref)) {
738if (!empty($search_product)) {
741if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
744if (!empty($search_user)) {
745 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
747if (!empty($search_batch)) {
750if (!empty($product_id) && $product_id !=
'-1') {
753if (!empty($search_fk_project) && $search_fk_project !=
'-1') {
756if ($search_qty !=
'') {
759if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
760 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
763include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
765$parameters = array();
766$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
767$sql .= $hookmanager->resPrint;
770$nbtotalofrecords =
'';
773 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
774 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
775 $resql = $db->query($sqlforcount);
777 $objforcount = $db->fetch_object($resql);
778 $nbtotalofrecords = $objforcount->nbtotalofrecords;
783 if (($page * $limit) > $nbtotalofrecords) {
791$sql .= $db->order($sortfield, $sortorder);
793 $sql .= $db->plimit($limit + 1, $offset);
796$resql = $db->query($sql);
802$num = $db->num_rows($resql);
809 $product->fetch($idproduct);
811if ($id > 0 || $ref) {
812 $result = $warehouse->fetch($id, $ref);
823$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
825 $title = $langs->trans(
'StockMovementForId', $msid);
827 $title = $langs->trans(
"ListOfStockMovements");
829 if (!empty($warehouse->ref)) {
830 $title .=
' ('.$warehouse->ref.
')';
832 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
841llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-product page-stock_movement_list');
846if ($warehouse->id > 0) {
849 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
852 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
854 $morehtmlref =
'<div class="refidno">';
855 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$warehouse->lieu;
858 if (isModEnabled(
'project') && $formproject !==
null) {
859 $langs->load(
"projects");
860 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
861 if ($usercancreate && 1 == 2) {
862 if ($action !=
'classify') {
863 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$warehouse->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
865 if ($action ==
'classify') {
866 $projectid = $warehouse->fk_project;
867 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id.
'">';
868 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
869 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
870 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
871 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
872 $morehtmlref .=
'</form>';
874 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id, $warehouse->socid, $warehouse->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
877 if (!empty($warehouse->fk_project)) {
879 $proj->fetch($warehouse->fk_project);
880 $morehtmlref .=
' : '.$proj->getNomUrl(1);
882 $morehtmlref .=
' - '.$proj->title;
889 $morehtmlref .=
'</div>';
892 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
896 dol_banner_tab($warehouse,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
899 print
'<div class="fichecenter">';
900 print
'<div class="fichehalfleft">';
901 print
'<div class="underbanner clearboth"></div>';
903 print
'<table class="border centpercent tableforfield">';
908 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($warehouse->description).
'</td></tr>';
910 $calcproductsunique = $warehouse->nb_different_products();
911 $calcproducts = $warehouse->nb_products();
914 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
915 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
919 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
920 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
921 print empty($valtoshow) ?
'0' : $valtoshow;
927 print
'<div class="fichehalfright">';
928 print
'<div class="underbanner clearboth"></div>';
930 print
'<table class="border centpercent tableforfield">';
933 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
934 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
938 $sql =
"SELECT MAX(m.datem) as datem";
939 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
940 $sql .=
" WHERE m.fk_entrepot = ".((int) $warehouse->id);
941 $resqlbis = $db->query($sql);
943 $lastmovementdate = 0;
945 $objbis = $db->fetch_object($resqlbis);
946 $lastmovementdate = $db->jdate($objbis->datem);
951 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
952 if ($lastmovementdate) {
955 print $langs->trans(
"None");
960 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
963 if (isModEnabled(
'category')) {
964 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
965 print $form->showCategories($warehouse->id, Categorie::TYPE_WAREHOUSE, 1);
974 print
'<div class="clearboth"></div>';
981if ($action ==
"correction") {
982 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
987if ($action ==
"transfert") {
988 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
994if ((empty($action) || $action ==
'list') && $id > 0) {
995 print
"<div class=\"tabsAction\">\n";
997 $parameters = array();
998 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $warehouse, $action);
1000 if (empty($reshook)) {
1001 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
1002 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=transfert&token='.
newToken().
'">'.$langs->trans(
"TransferStock").
'</a>';
1005 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
1006 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=correction&token='.
newToken().
'">'.$langs->trans(
"CorrectStock").
'</a>';
1013$arrayofselected = is_array($toselect) ? $toselect : array();
1017 $param .=
'&mode='.urlencode($mode);
1019if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1020 $param .=
'&contextpage='.urlencode($contextpage);
1022if ($limit > 0 && $limit != $conf->liste_limit) {
1023 $param .=
'&limit='.((int) $limit);
1026 $param .=
'&id='.urlencode((
string) (
$id));
1029 $param .=
'&show_files='.urlencode((
string) ($show_files));
1031if ($search_date_startday) {
1032 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1034if ($search_date_startmonth) {
1035 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1037if ($search_date_startyear) {
1038 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1040if ($search_date_endday) {
1041 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1043if ($search_date_endmonth) {
1044 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1046if ($search_date_endyear) {
1047 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1049if ($search_movement) {
1050 $param .=
'&search_movement='.urlencode($search_movement);
1052if ($search_inventorycode) {
1053 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
1055if ($search_type_mouvement) {
1056 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
1058if ($search_product_ref) {
1059 $param .=
'&search_product_ref='.urlencode($search_product_ref);
1061if ($search_product) {
1062 $param .=
'&search_product='.urlencode($search_product);
1065 $param .=
'&search_batch='.urlencode($search_batch);
1067if ($search_warehouse > 0) {
1068 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1071 $param .=
'&search_user='.urlencode($search_user);
1073if ($idproduct > 0) {
1074 $param .=
'&idproduct='.urlencode((
string) ($idproduct));
1076if ($search_fk_project !=
'' && $search_fk_project !=
'-1') {
1077 $param .=
'&search_fk_project='.urlencode((
string) ($search_fk_project));
1080include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1082$parameters = array(
'param' => &$param);
1083$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $warehouse, $action);
1084$param .= $hookmanager->resPrint;
1087$arrayofmassactions = array();
1089 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1093 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1095if (!empty($permissiontoadd)) {
1096 $arrayofmassactions[
'prereverse'] =
img_picto(
'',
'add',
'class="pictofixedwidth"').$langs->trans(
"Reverse");
1098if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'prereverse'))) {
1099 $arrayofmassactions = array();
1102$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1104print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1105if ($optioncss !=
'') {
1106 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1108print
'<input type="hidden" name="token" value="'.newToken().
'">';
1109print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1110print
'<input type="hidden" name="action" value="list">';
1111print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1112print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1113print
'<input type="hidden" name="type" value="'.$type.
'">';
1114print
'<input type="hidden" name="page" value="'.$page.
'">';
1115print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1116print
'<input type="hidden" name="page_y" value="">';
1117print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1119 print
'<input type="hidden" name="id" value="'.$id.
'">';
1125print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1128$topicmail =
"SendStockMovement";
1129$modelmail =
"movementstock";
1131$trackid =
'mov'.$warehouse->id;
1132include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1133if ($massaction ==
'prereverse') {
1134 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassReverse"), $langs->trans(
"ConfirmMassReverseQuestion", count($toselect)),
"confirm_reverse",
null,
'', 0, 200, 500, 1,
'Yes');
1140 if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
1142 $fieldstosearchall = array();
1144 foreach ($fieldstosearchall as $key => $val) {
1145 $fieldstosearchall[$key] = $langs->trans($val);
1146 $setupstring .= $key.
"=".$val.
";";
1148 print
'<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1149 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1154$parameters = array(
'arrayfields' => &$arrayfields);
1155$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $warehouse, $action);
1156if (empty($reshook)) {
1157 $moreforfilter .= $hookmanager->resPrint;
1159 $moreforfilter = $hookmanager->resPrint;
1162if (!empty($moreforfilter)) {
1163 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1164 print $moreforfilter;
1168$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1169$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1170$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1171$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1173print
'<div class="div-table-responsive">';
1174print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1178print
'<tr class="liste_titre_filter">';
1181 print
'<td class="liste_titre center maxwidthsearch">';
1182 $searchpicto = $form->showFilterButtons(
'left');
1186if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1188 print
'<td class="liste_titre left">';
1189 print
'<input class="flat maxwidth40" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1192if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1194 print
'<td class="liste_titre center">';
1195 print
'<div class="nowrapfordate">';
1196 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1198 print
'<div class="nowrapfordate">';
1199 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1203if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1205 print
'<td class="liste_titre left">';
1206 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1209if (!empty($arrayfields[
'p.label'][
'checked'])) {
1211 print
'<td class="liste_titre left">';
1212 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1216if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1217 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1219if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1220 print
'<td class="liste_titre left">';
1223if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1224 print
'<td class="liste_titre left">';
1228if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1229 print
'<td class="liste_titre maxwidthonsmartphone left">';
1231 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'maxwidth200');
1234if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1236 print
'<td class="liste_titre left">';
1237 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1240if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1242 print
'<td class="liste_titre left">';
1243 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1246if (!empty($arrayfields[
'm.label'][
'checked'])) {
1248 print
'<td class="liste_titre left">';
1249 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1252if (!empty($arrayfields[
'origin'][
'checked'])) {
1254 print
'<td class="liste_titre left">';
1258if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1260 print
'<td class="liste_titre" align="left">';
1261 print $warehouse->showInputField($warehouse->fields[
'fk_project'],
'fk_project', $search_fk_project,
'',
'',
'search_',
'maxwidth125', 1);
1264if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1266 print
'<td class="liste_titre center">';
1268 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1269 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1270 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1271 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1272 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1273 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1280if (!empty($arrayfields[
'm.value'][
'checked'])) {
1282 print
'<td class="liste_titre right">';
1283 print
'<input class="flat width50 right" type="text" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1286if (!empty($arrayfields[
'm.price'][
'checked'])) {
1288 print
'<td class="liste_titre" align="left">';
1294include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1297$parameters = array(
'arrayfields' => $arrayfields);
1298$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $warehouse, $action);
1299print $hookmanager->resPrint;
1301if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1302 print
'<td class="liste_titre">';
1306if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1307 print
'<td class="liste_titre">';
1312 print
'<td class="liste_titre center maxwidthsearch">';
1313 $searchpicto = $form->showFilterButtons();
1319$totalarray = array();
1320$totalarray[
'nbfield'] = 0;
1324print
'<tr class="liste_titre">';
1327 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1328 $totalarray[
'nbfield']++;
1330if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1331 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1333if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1334 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1336if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1337 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1339if (!empty($arrayfields[
'p.label'][
'checked'])) {
1340 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1342if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1343 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1345if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1346 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1348if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1349 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1351if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1355if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1358if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1361if (!empty($arrayfields[
'm.label'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1364if (!empty($arrayfields[
'origin'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1367if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1370if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1371 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1373if (!empty($arrayfields[
'm.value'][
'checked'])) {
1374 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1376if (!empty($arrayfields[
'm.price'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1381include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1384$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1385$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $warehouse, $action);
1386print $hookmanager->resPrint;
1387if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1388 print_liste_field_titre($arrayfields[
'm.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"m.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1390if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1391 print_liste_field_titre($arrayfields[
'm.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"m.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1395 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1396 $totalarray[
'nbfield']++;
1401$arrayofuniqueproduct = array();
1407$savnbfield = $totalarray[
'nbfield'];
1408$totalarray = array();
1409$totalarray[
'nbfield'] = 0;
1410$imaxinloop = ($limit ? min($num, $limit) : $num);
1411while ($i < $imaxinloop) {
1412 $obj = $db->fetch_object($resql);
1417 $userstatic->id = $obj->fk_user_author;
1418 $userstatic->login = $obj->login;
1419 $userstatic->lastname = $obj->lastname;
1420 $userstatic->firstname = $obj->firstname;
1421 $userstatic->photo = $obj->photo;
1422 $userstatic->email = $obj->user_email;
1423 $userstatic->status = $obj->user_status;
1428 $sql =
"SELECT label";
1429 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1430 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1431 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1434 $result = $db->query($sql);
1436 $objtp = $db->fetch_object($result);
1437 if (!empty($objtp->label)) {
1438 $obj->produit = $objtp->label;
1443 $productstatic->id = $obj->rowid;
1444 $productstatic->ref = $obj->product_ref;
1445 $productstatic->label = $obj->produit;
1446 $productstatic->type = $obj->type;
1447 $productstatic->entity = $obj->entity;
1448 $productstatic->status = $obj->tosell;
1449 $productstatic->status_buy = $obj->tobuy;
1450 $productstatic->status_batch = $obj->tobatch;
1452 $productlot->id = $obj->lotid;
1453 $productlot->batch = $obj->batch;
1454 $productlot->eatby = $obj->eatby;
1455 $productlot->sellby = $obj->sellby;
1457 $warehousestatic->id = $obj->entrepot_id;
1458 $warehousestatic->ref = $obj->warehouse_ref;
1459 $warehousestatic->label = $obj->warehouse_ref;
1460 $warehousestatic->lieu = $obj->lieu;
1461 $warehousestatic->fk_parent = $obj->fk_parent;
1462 $warehousestatic->statut = $obj->statut;
1468 $object->warehouse_id = $obj->entrepot_id;
1469 $object->type = $obj->type_mouvement;
1471 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1472 if (!empty($obj->fk_origin)) {
1473 $origin =
$object->get_origin($obj->fk_origin, $obj->origintype);
1478 if ($mode ==
'kanban') {
1480 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1481 print
'<div class="box-flex-container kanban">';
1485 if ($massactionbutton || $massaction) {
1487 if (in_array($warehouse->id, $arrayofselected)) {
1491 print $warehouse->getKanbanView(
'', array(
'selected' => $selected));
1492 if ($i == ($imaxinloop - 1)) {
1499 print
'<tr data-rowid="'.$warehouse->id.
'" class="oddeven">';
1502 print
'<td class="nowrap center">';
1503 if ($massactionbutton || $massaction) {
1505 if (in_array($obj->mid, $arrayofselected)) {
1508 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1512 $totalarray[
'nbfield']++;
1516 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1517 print
'<td class="nowraponall">';
1524 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1525 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1528 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1529 print
'<td class="nowraponall">';
1530 print $productstatic->getNomUrl(1,
'stock', 16);
1534 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1535 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1536 print $productstatic->label;
1540 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1541 print
'<td class="center nowraponall">';
1542 if ($productlot->id > 0) {
1543 print $productlot->getNomUrl(1);
1545 print $productlot->batch;
1550 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1551 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1554 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1555 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1558 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1559 print
'<td class="tdoverflowmax100">';
1560 print $warehousestatic->getNomUrl(1);
1564 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1565 print
'<td class="tdoverflowmax100">';
1566 print $userstatic->getNomUrl(-1);
1570 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1571 print
'<td class="tdoverflowmax150" title="'.dolPrintHTML($obj->inventorycode).
'">';
1572 if ($obj->inventorycode) {
1573 print
img_picto(
'',
'movement',
'class="pictofixedwidth"');
1574 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'">'.
dol_escape_htmltag($obj->inventorycode).
'</a>';
1579 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1580 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
1583 if (!empty($arrayfields[
'origin'][
'checked'])) {
1584 print
'<td class="nowraponall">'.$origin.
'</td>';
1587 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1589 if ($obj->fk_project != 0) {
1590 print
$object->get_origin($obj->fk_project,
'project');
1595 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1596 print
'<td class="center">';
1597 print
$object->getTypeMovement();
1601 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1602 print
'<td class="right">';
1603 if ($obj->qty > 0) {
1604 print
'<span class="stockmovemententry">';
1609 print
'<span class="stockmovementexit">';
1616 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1617 print
'<td class="right">';
1618 if ($obj->price != 0) {
1619 print
price($obj->price);
1625 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1627 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1628 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1629 print $hookmanager->resPrint;
1633 print
'<td class="nowrap center">';
1634 if ($massactionbutton || $massaction) {
1636 if (in_array($obj->mid, $arrayofselected)) {
1639 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1643 $totalarray[
'nbfield']++;
1656 foreach ($arrayfields as $key => $val) {
1657 if (!empty($val[
'checked'])) {
1661 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1666$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1667$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1668print $hookmanager->resPrint;
1670print
'</table>'.
"\n";
1673print
'</form>'.
"\n";
1676if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) {
1679 $productidselected = 0;
1680 foreach ($arrayofuniqueproduct as $key => $val) {
1681 $productidselected = $key;
1682 $productlabelselected = $val;
1686 $balancebefore =
$object->calculateBalanceForProductBefore($productidselected, $datebefore);
1687 $balanceafter =
$object->calculateBalanceForProductBefore($productidselected, $dateafter);
1690 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1693 print
': '.$balancebefore;
1697 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1700 print
': '.$balanceafter;
1705if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1706 $hidegeneratedfilelistifempty = 1;
1707 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1708 $hidegeneratedfilelistifempty = 0;
1711 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1715 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1716 $urlsource .= str_replace(
'&',
'&', $param);
1718 $filedir = $diroutputmassaction;
1719 $genallowed = $permissiontoread;
1720 $delallowed = $permissiontoadd;
1722 print $formfile->showdocuments(
'massfilesarea_stock',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
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.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage translations.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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 '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
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_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'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
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...
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
stock_prepare_head($object)
Prepare array with list of tabs.