30 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48 $langs->loadLangs(array(
'products',
'stocks',
'orders'));
50 $langs->load(
"productbatch");
53 $action =
GETPOST(
'action',
'aZ09');
54 $massaction =
GETPOST(
'massaction',
'alpha');
55 $confirm =
GETPOST(
'confirm',
'alpha');
56 $cancel =
GETPOST(
'cancel',
'alpha');
57 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
58 $toselect =
GETPOST(
'toselect',
'array');
59 $backtopage =
GETPOST(
"backtopage",
"alpha");
60 $optioncss =
GETPOST(
'optioncss',
'aZ');
66 $idproduct =
GETPOST(
'idproduct',
'int');
67 $product_id =
GETPOST(
"product_id",
'int');
69 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
70 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
71 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
72 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
73 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
74 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
75 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
76 $search_date_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_startmonth',
'int'),
GETPOST(
'search_date_startday',
'int'),
GETPOST(
'search_date_startyear',
'int'),
'tzuserrel');
77 $search_date_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_endmonth',
'int'),
GETPOST(
'search_date_endday',
'int'),
GETPOST(
'search_date_endyear',
'int'),
'tzuserrel');
78 $search_ref =
GETPOST(
'search_ref',
'alpha');
79 $search_movement =
GETPOST(
"search_movement");
80 $search_product_ref = trim(
GETPOST(
"search_product_ref"));
81 $search_product = trim(
GETPOST(
"search_product"));
82 $search_warehouse = trim(
GETPOST(
"search_warehouse"));
83 $search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
84 $search_user = trim(
GETPOST(
"search_user"));
85 $search_batch = trim(
GETPOST(
"search_batch"));
86 $search_qty = trim(
GETPOST(
"search_qty"));
87 $search_type_mouvement =
GETPOST(
'search_type_mouvement',
'int');
88 $search_fk_project=
GETPOST(
"search_fk_project",
'int');
93 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
94 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
95 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
97 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
101 $offset = $limit * $page;
102 $pageprev = $page - 1;
103 $pagenext = $page + 1;
106 $sortfield =
"m.datem";
112 $pdluoid =
GETPOST(
'pdluoid',
'int');
117 $diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
118 $hookmanager->initHooks(array($contextpage));
123 $extrafields->fetch_name_optionals_label($object->table_element);
125 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
127 $arrayfields = array(
128 'm.rowid'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>1),
129 'm.datem'=>array(
'label'=>
"Date",
'checked'=>1,
'position'=>2),
130 'p.ref'=>array(
'label'=>
"ProductRef",
'checked'=>1,
'css'=>
'maxwidth100',
'position'=>3),
131 'p.label'=>array(
'label'=>
"ProductLabel",
'checked'=>0,
'position'=>5),
132 'm.batch'=>array(
'label'=>
"BatchNumberShort",
'checked'=>1,
'position'=>8,
'enabled'=>(
isModEnabled(
'productbatch'))),
133 'pl.eatby'=>array(
'label'=>
"EatByDate",
'checked'=>0,
'position'=>9,
'enabled'=>(
isModEnabled(
'productbatch'))),
134 'pl.sellby'=>array(
'label'=>
"SellByDate",
'checked'=>0,
'position'=>10,
'enabled'=>(
isModEnabled(
'productbatch'))),
135 'e.ref'=>array(
'label'=>
"Warehouse",
'checked'=>1,
'position'=>100,
'enabled'=>(!($id > 0))),
136 'm.fk_user_author'=>array(
'label'=>
"Author",
'checked'=>0,
'position'=>120),
137 'm.inventorycode'=>array(
'label'=>
"InventoryCodeShort",
'checked'=>1,
'position'=>130),
138 'm.label'=>array(
'label'=>
"MovementLabel",
'checked'=>1,
'position'=>140),
139 'm.type_mouvement'=>array(
'label'=>
"TypeMovement",
'checked'=>0,
'position'=>150),
140 'origin'=>array(
'label'=>
"Origin",
'checked'=>1,
'position'=>155),
141 'm.fk_projet'=>array(
'label'=>
'Project',
'checked'=>0,
'position'=>180),
142 'm.value'=>array(
'label'=>
"Qty",
'checked'=>1,
'position'=>200),
143 'm.price'=>array(
'label'=>
"UnitPurchaseValue",
'checked'=>0,
'position'=>210,
'enabled'=>(!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
148 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
150 if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
151 unset($arrayfields[
'pl.sellby']);
153 if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) {
154 unset($arrayfields[
'pl.eatby']);
159 if ($id > 0 || !empty($ref)) {
160 $tmpwarehouse->fetch($id, $ref);
161 $id = $tmpwarehouse->id;
170 if (!$user->rights->stock->mouvement->lire) {
174 $uploaddir = $conf->stock->dir_output.
'/movements';
176 $permissiontoread = $user->rights->stock->mouvement->lire;
177 $permissiontoadd = $user->rights->stock->mouvement->creer;
178 $permissiontodelete = $user->rights->stock->mouvement->creer;
180 $usercanread = $user->rights->stock->mouvement->lire;
181 $usercancreate = $user->rights->stock->mouvement->creer;
182 $usercandelete = $user->rights->stock->mouvement->creer;
191 if (
GETPOST(
'cancel',
'alpha')) {
195 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
199 $parameters = array();
200 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
205 if (empty($reshook)) {
207 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
211 $search_date_startday =
'';
212 $search_date_startmonth =
'';
213 $search_date_startyear =
'';
214 $search_date_endday =
'';
215 $search_date_endmonth =
'';
216 $search_date_endyear =
'';
217 $search_date_start =
'';
218 $search_date_end =
'';
220 $search_movement =
"";
221 $search_type_mouvement =
"";
222 $search_inventorycode =
"";
223 $search_product_ref =
"";
224 $search_product =
"";
225 $search_warehouse =
"";
229 $search_fk_project =
"";
232 $search_array_options = array();
234 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
235 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
240 $objectclass =
'MouvementStock';
241 $objectlabel =
'MouvementStock';
243 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
244 if (empty($diroutputmassaction)) {
245 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
249 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
250 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
251 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
253 $objecttmp =
new $objectclass($db);
254 $listofobjectid = array();
255 foreach ($toselect as $toselectid) {
256 $objecttmp =
new $objectclass($db);
257 $result = $objecttmp->fetch($toselectid);
259 $listofobjectid[$toselectid] = $toselectid;
263 $arrayofinclusion = array();
264 foreach ($listofobjectref as $tmppdf) {
267 foreach ($listofobjectref as $tmppdf) {
268 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
270 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0,
true);
273 $outputlangs = $langs;
276 $newlang =
GETPOST(
'lang_id',
'aZ09');
281 if (!empty($newlang)) {
283 $outputlangs->setDefaultLang($newlang);
291 $filename = preg_replace(
'/\s/',
'_', $filename);
303 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
312 $langs->load(
"exports");
320 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
323 if ($action ==
'update_extras') {
324 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse);
327 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse,
GETPOST(
'attribute',
'restricthtml'));
332 $result = $tmpwarehouse->insertExtraFields();
339 $action =
'edit_extras';
344 if ($action ==
"correct_stock") {
346 if (!empty($product_id)) {
347 $result = $product->fetch($product_id);
352 if (empty($product_id)) {
354 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
355 $action =
'correction';
357 if (!is_numeric(
GETPOST(
"nbpiece"))) {
359 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
360 $action =
'correction';
364 $origin_element =
'';
367 if (
GETPOST(
'projectid',
'int')) {
368 $origin_element =
'project';
369 $origin_id =
GETPOST(
'projectid',
'int');
372 if ($product->hasbatch()) {
373 $batch =
GETPOST(
'batch_number',
'alphanohtml');
380 $result = $product->correct_stock_batch(
385 GETPOST(
"label",
'alphanohtml'),
390 GETPOST(
'inventorycode',
'alphanohtml'),
397 $result = $product->correct_stock(
402 GETPOST(
"label",
'alphanohtml'),
404 GETPOST(
'inventorycode',
'alphanohtml'),
413 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
418 $action =
'correction';
428 if ($action ==
"transfert_stock" && !$cancel) {
430 if (!empty($product_id)) {
431 $result = $product->fetch($product_id);
434 if (!(
GETPOST(
"id_entrepot_destination",
'int') > 0)) {
435 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
437 $action =
'transfert';
439 if (empty($product_id)) {
441 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
442 $action =
'transfert';
444 if (!
GETPOST(
"nbpiece",
'int')) {
445 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
447 $action =
'transfert';
449 if ($id ==
GETPOST(
"id_entrepot_destination",
'int')) {
450 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
452 $action =
'transfert';
457 $result = $product->fetch($product_id);
459 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
460 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
462 $action =
'transfert';
469 $result = $object->fetch($id);
473 $product->load_stock(
'novirtual');
477 if (isset($product->pmp)) {
478 $pricesrc = $product->pmp;
480 $pricedest = $pricesrc;
482 if ($product->hasbatch()) {
486 $result = $pdluo->fetch($pdluoid);
488 $srcwarehouseid = $pdluo->warehouseid;
489 $batch = $pdluo->batch;
490 $eatby = $pdluo->eatby;
491 $sellby = $pdluo->sellby;
497 $srcwarehouseid = $id;
498 $batch =
GETPOST(
'batch_number',
'alphanohtml');
505 $result1 = $product->correct_stock_batch(
522 $result2 = $product->correct_stock_batch(
524 GETPOST(
"id_entrepot_destination",
'int'),
532 GETPOST(
'inventorycode',
'alphanohtml'),
541 $result1 = $product->correct_stock(
548 GETPOST(
'inventorycode',
'alphanohtml'),
556 $result2 = $product->correct_stock(
558 GETPOST(
"id_entrepot_destination"),
563 GETPOST(
'inventorycode',
'alphanohtml'),
570 if (!$error && $result1 >= 0 && $result2 >= 0) {
574 header(
"Location: ".$backtopage);
577 header(
"Location: movement_list.php?id=".$object->id);
583 $action =
'transfert';
600 $productstatic =
new Product($db);
601 $warehousestatic =
new Entrepot($db);
603 $userstatic =
new User($db);
609 $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,";
610 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
611 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
612 $sql .=
" m.batch, m.price,";
613 $sql .=
" m.type_mouvement,";
614 $sql .=
" m.fk_projet as fk_project,";
615 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
616 $sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
618 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
619 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
620 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
624 $parameters = array();
625 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
626 $sql .= $hookmanager->resPrint;
627 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
631 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
632 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
633 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
634 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
635 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
637 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
638 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
641 $parameters = array();
642 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
643 $sql .= $hookmanager->resPrint;
645 $sql .=
" WHERE m.fk_product = p.rowid";
647 $sql .=
" AND m.rowid = ".((int) $msid);
649 $sql .=
" AND m.fk_entrepot = e.rowid";
650 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
651 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
652 $sql .=
" AND p.fk_product_type = 0";
655 $sql .=
" AND e.rowid = ".((int) $id);
657 if (!empty($search_date_start)) {
658 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
660 if (!empty($search_date_end)) {
661 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
663 if ($idproduct > 0) {
664 $sql .=
" AND p.rowid = ".((int) $idproduct);
666 if (!empty($search_ref)) {
669 if (!empty($search_movement)) {
672 if (!empty($search_inventorycode)) {
675 if (!empty($search_product_ref)) {
678 if (!empty($search_product)) {
681 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
684 if (!empty($search_user)) {
687 if (!empty($search_batch)) {
690 if (!empty($product_id) && $product_id !=
'-1') {
693 if (!empty($search_fk_project) && $search_fk_project !=
'-1') {
696 if ($search_qty !=
'') {
699 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
703 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
705 $parameters = array();
706 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
707 $sql .= $hookmanager->resPrint;
710 $nbtotalofrecords =
'';
713 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
714 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
715 $resql = $db->query($sqlforcount);
717 $objforcount = $db->fetch_object($resql);
718 $nbtotalofrecords = $objforcount->nbtotalofrecords;
723 if (($page * $limit) > $nbtotalofrecords) {
731 $sql .= $db->order($sortfield, $sortorder);
733 $sql .= $db->plimit($limit + 1, $offset);
736 $resql = $db->query(
$sql);
742 $num = $db->num_rows($resql);
748 if ($idproduct > 0) {
749 $product->fetch($idproduct);
751 if ($id > 0 || $ref) {
752 $result = $object->fetch($id, $ref);
763 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
765 $title = $langs->trans(
'StockMovementForId', $msid);
767 $title = $langs->trans(
"ListOfStockMovements");
769 if (!empty($object->ref)) {
770 $title .=
' ('.$object->ref.
')';
772 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
786 if ($object->id > 0) {
789 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
792 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
794 $morehtmlref =
'<div class="refidno">';
795 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$object->lieu;
799 $langs->load(
"projects");
800 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
801 if ($usercancreate && 1 == 2) {
802 if ($action !=
'classify') {
803 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
805 if ($action ==
'classify') {
806 $projectid = $object->fk_project;
807 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
808 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
809 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
810 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
811 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
812 $morehtmlref .=
'</form>';
814 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
817 if (!empty($object->fk_project)) {
819 $proj->fetch($object->fk_project);
820 $morehtmlref .=
' : '.$proj->getNomUrl(1);
822 $morehtmlref .=
' - '.$proj->title;
829 $morehtmlref .=
'</div>';
832 if ($user->socid && !in_array(
'stock', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
836 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
839 print
'<div class="fichecenter">';
840 print
'<div class="fichehalfleft">';
841 print
'<div class="underbanner clearboth"></div>';
843 print
'<table class="border centpercent tableforfield">';
848 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($object->description).
'</td></tr>';
850 $calcproductsunique = $object->nb_different_products();
851 $calcproducts = $object->nb_products();
854 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
855 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
859 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
860 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
861 print empty($valtoshow) ?
'0' : $valtoshow;
867 print
'<div class="fichehalfright">';
868 print
'<div class="underbanner clearboth"></div>';
870 print
'<table class="border centpercent tableforfield">';
873 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
874 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
878 $sql =
"SELECT MAX(m.datem) as datem";
879 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
880 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
881 $resqlbis = $db->query(
$sql);
883 $objbis = $db->fetch_object($resqlbis);
884 $lastmovementdate = $db->jdate($objbis->datem);
889 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
890 if ($lastmovementdate) {
893 print $langs->trans(
"None");
898 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
902 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
903 print
$form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
912 print
'<div class="clearboth"></div>';
919 if ($action ==
"correction") {
920 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
925 if ($action ==
"transfert") {
926 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
932 if ((empty($action) || $action ==
'list') && $id > 0) {
933 print
"<div class=\"tabsAction\">\n";
935 $parameters = array();
936 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
938 if (empty($reshook)) {
939 if ($user->rights->stock->mouvement->creer) {
940 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=correction">'.$langs->trans(
"CorrectStock").
'</a>';
943 if ($user->rights->stock->mouvement->creer) {
944 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=transfert">'.$langs->trans(
"TransferStock").
'</a>';
951 $arrayofselected = is_array($toselect) ? $toselect : array();
955 $param .=
'&mode='.urlencode($mode);
957 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
958 $param .=
'&contextpage='.urlencode($contextpage);
960 if ($limit > 0 && $limit != $conf->liste_limit) {
961 $param .=
'&limit='.((int) $limit);
964 $param .=
'&id='.urlencode($id);
966 if ($search_date_startday) {
967 $param .=
'&search_date_startday='.urlencode($search_date_startday);
969 if ($search_date_startmonth) {
970 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
972 if ($search_date_startyear) {
973 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
975 if ($search_date_endday) {
976 $param .=
'&search_date_endday='.urlencode($search_date_endday);
978 if ($search_date_endmonth) {
979 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
981 if ($search_date_endyear) {
982 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
984 if ($search_movement) {
985 $param .=
'&search_movement='.urlencode($search_movement);
987 if ($search_inventorycode) {
988 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
990 if ($search_type_mouvement) {
991 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
993 if ($search_product_ref) {
994 $param .=
'&search_product_ref='.urlencode($search_product_ref);
996 if ($search_product) {
997 $param .=
'&search_product='.urlencode($search_product);
1000 $param .=
'&search_batch='.urlencode($search_batch);
1002 if ($search_warehouse > 0) {
1003 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1006 $param .=
'&search_user='.urlencode($search_user);
1008 if ($idproduct > 0) {
1009 $param .=
'&idproduct='.urlencode($idproduct);
1011 if ($search_fk_project !=
'' && $search_fk_project !=
'-1') {
1012 $param .=
'&search_fk_project='.urlencode($search_fk_project);
1015 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1017 $parameters = array();
1018 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1019 $param .= $hookmanager->resPrint;
1022 $arrayofmassactions = array();
1024 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1027 if (!empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) {
1028 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1030 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1031 $arrayofmassactions = array();
1033 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1035 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1036 if ($optioncss !=
'') {
1037 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1039 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1040 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1041 print
'<input type="hidden" name="action" value="list">';
1042 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1043 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1044 print
'<input type="hidden" name="type" value="'.$type.
'">';
1045 print
'<input type="hidden" name="page" value="'.$page.
'">';
1046 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1047 print
'<input type="hidden" name="page_y" value="">';
1048 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1050 print
'<input type="hidden" name="id" value="'.$id.
'">';
1054 $newcardbutton =
'';
1057 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1059 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1063 $topicmail =
"SendStockMovement";
1064 $modelmail =
"movementstock";
1066 $trackid =
'mov'.$object->id;
1067 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1071 foreach ($fieldstosearchall as $key => $val) {
1072 $fieldstosearchall[$key] = $langs->trans($val);
1073 $setupstring .= $key.
"=".$val.
";";
1075 print
'<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1076 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
1079 $moreforfilter =
'';
1081 $parameters = array(
'arrayfields'=>&$arrayfields);
1082 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1083 if (empty($reshook)) {
1084 $moreforfilter .= $hookmanager->resPrint;
1086 $moreforfilter = $hookmanager->resPrint;
1089 if (!empty($moreforfilter)) {
1090 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1091 print $moreforfilter;
1095 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1096 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1097 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1099 print
'<div class="div-table-responsive">';
1100 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1104 print
'<tr class="liste_titre">';
1107 print
'<td class="liste_titre center maxwidthsearch">';
1108 $searchpicto =
$form->showFilterButtons(
'left');
1112 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1114 print
'<td class="liste_titre left">';
1115 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1118 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1120 print
'<td class="liste_titre center">';
1121 print
'<div class="nowrap">';
1122 print
$form->selectDate($search_date_start?$search_date_start:-1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1124 print
'<div class="nowrap">';
1125 print
$form->selectDate($search_date_end?$search_date_end:-1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1129 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1131 print
'<td class="liste_titre left">';
1132 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1135 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1137 print
'<td class="liste_titre left">';
1138 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1142 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1143 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1145 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1146 print
'<td class="liste_titre left">';
1149 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1150 print
'<td class="liste_titre left">';
1154 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1155 print
'<td class="liste_titre maxwidthonsmartphone left">';
1157 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
1160 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1162 print
'<td class="liste_titre left">';
1163 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1166 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1168 print
'<td class="liste_titre left">';
1169 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1172 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1174 print
'<td class="liste_titre left">';
1175 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1178 if (!empty($arrayfields[
'origin'][
'checked'])) {
1180 print
'<td class="liste_titre left">';
1184 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1186 print
'<td class="liste_titre" align="left">';
1187 print $object->showInputField($object->fields[
'fk_project'],
'fk_project', $search_fk_project,
'',
'',
'search_',
'maxwidth125', 1);
1190 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1192 print
'<td class="liste_titre center">';
1194 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1195 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1196 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1197 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1198 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1199 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1206 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1208 print
'<td class="liste_titre right">';
1209 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1212 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1214 print
'<td class="liste_titre" align="left">';
1220 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1223 $parameters = array(
'arrayfields'=>$arrayfields);
1224 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1225 print $hookmanager->resPrint;
1227 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1228 print
'<td class="liste_titre">';
1232 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1233 print
'<td class="liste_titre">';
1238 print
'<td class="liste_titre center maxwidthsearch">';
1239 $searchpicto =
$form->showFilterButtons();
1245 $totalarray = array();
1246 $totalarray[
'nbfield'] = 0;
1250 print
'<tr class="liste_titre">';
1253 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1254 $totalarray[
'nbfield']++;
1256 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1257 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1259 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1260 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1262 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1263 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1265 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1266 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1268 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1269 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1271 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1272 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1274 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1275 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1277 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1279 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1281 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1282 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1284 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1285 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1287 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1288 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1290 if (!empty($arrayfields[
'origin'][
'checked'])) {
1291 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1293 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1294 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1296 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1297 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1299 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1300 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1302 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1303 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1307 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1310 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1311 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1312 print $hookmanager->resPrint;
1313 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1314 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1316 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1317 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1321 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1322 $totalarray[
'nbfield']++;
1327 $arrayofuniqueproduct = array();
1333 $savnbfield = $totalarray[
'nbfield'];
1334 $totalarray = array();
1335 $totalarray[
'nbfield'] = 0;
1336 $imaxinloop = ($limit ? min($num, $limit) : $num);
1337 while ($i < $imaxinloop) {
1338 $obj = $db->fetch_object($resql);
1343 $userstatic->id = $obj->fk_user_author;
1344 $userstatic->login = $obj->login;
1345 $userstatic->lastname = $obj->lastname;
1346 $userstatic->firstname = $obj->firstname;
1347 $userstatic->photo = $obj->photo;
1348 $userstatic->email = $obj->user_email;
1349 $userstatic->statut = $obj->user_status;
1354 $sql =
"SELECT label";
1355 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1356 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1357 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1360 $result = $db->query(
$sql);
1362 $objtp = $db->fetch_object($result);
1363 if (!empty($objtp->label)) {
1364 $obj->produit = $objtp->label;
1369 $productstatic->id = $obj->rowid;
1370 $productstatic->ref = $obj->product_ref;
1371 $productstatic->label = $obj->produit;
1372 $productstatic->type = $obj->type;
1373 $productstatic->entity = $obj->entity;
1374 $productstatic->status = $obj->tosell;
1375 $productstatic->status_buy = $obj->tobuy;
1376 $productstatic->status_batch = $obj->tobatch;
1378 $productlot->id = $obj->lotid;
1379 $productlot->batch = $obj->batch;
1380 $productlot->eatby = $obj->eatby;
1381 $productlot->sellby = $obj->sellby;
1383 $warehousestatic->id = $obj->entrepot_id;
1384 $warehousestatic->ref = $obj->warehouse_ref;
1385 $warehousestatic->label = $obj->warehouse_ref;
1386 $warehousestatic->lieu = $obj->lieu;
1387 $warehousestatic->fk_parent = $obj->fk_parent;
1388 $warehousestatic->statut = $obj->statut;
1390 $movement->type = $obj->type_mouvement;
1392 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1393 if (!empty($obj->fk_origin)) {
1394 $origin = $movement->get_origin($obj->fk_origin, $obj->origintype);
1399 if ($mode ==
'kanban') {
1401 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1402 print
'<div class="box-flex-container kanban">';
1405 if ($massactionbutton || $massaction) {
1407 if (in_array($object->id, $arrayofselected)) {
1411 print $object->getKanbanView(
'', array(
'selected' => in_array($warehousestatic->id, $arrayofselected)));
1412 if ($i == ($imaxinloop - 1)) {
1419 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1422 print
'<td class="nowrap center">';
1423 if ($massactionbutton || $massaction) {
1425 if (in_array($obj->mid, $arrayofselected)) {
1428 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1432 $totalarray[
'nbfield']++;
1436 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1437 print
'<td class="nowraponall">';
1438 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
1442 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1444 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1446 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1448 print
'<td class="nowraponall">';
1449 print $productstatic->getNomUrl(1,
'stock', 16);
1452 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1454 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1455 print $productstatic->label;
1458 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1459 print
'<td class="center nowraponall">';
1460 if ($productlot->id > 0) {
1461 print $productlot->getNomUrl(1);
1463 print $productlot->batch;
1467 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1468 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1470 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1471 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1474 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1475 print
'<td class="tdoverflowmax100">';
1476 print $warehousestatic->getNomUrl(1);
1480 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1481 print
'<td class="tdoverflowmax100">';
1482 print $userstatic->getNomUrl(-1);
1485 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1487 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'&search_type_mouvement='.urlencode($obj->type_mouvement).
'">'.$obj->inventorycode.
'</a></td>';
1489 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1491 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.$obj->label.
'</td>';
1493 if (!empty($arrayfields[
'origin'][
'checked'])) {
1495 print
'<td class="nowraponall">'.$origin.
'</td>';
1497 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1500 if ($obj->fk_project != 0) {
1501 print $movement->get_origin($obj->fk_project,
'project');
1505 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1507 print
'<td class="center">';
1508 print $movement->getTypeMovement();
1511 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1513 print
'<td class="right">';
1514 if ($obj->qty > 0) {
1515 print
'<span class="stockmovemententry">';
1520 print
'<span class="stockmovementexit">';
1526 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1528 print
'<td class="right">';
1529 if ($obj->price != 0) {
1530 print
price($obj->price);
1536 $object = $movement;
1537 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1539 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1540 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1541 print $hookmanager->resPrint;
1545 print
'<td class="nowrap center">';
1546 if ($massactionbutton || $massaction) {
1548 if (in_array($obj->mid, $arrayofselected)) {
1551 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1555 $totalarray[
'nbfield']++;
1568 foreach ($arrayfields as $key => $val) {
1569 if (!empty($val[
'checked'])) {
1573 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1578 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
1579 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1580 print $hookmanager->resPrint;
1582 print
'</table>'.
"\n";
1583 print
'</div>'.
"\n";
1585 print
'</form>'.
"\n";
1588 if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) {
1591 $productidselected = 0;
1592 foreach ($arrayofuniqueproduct as $key => $val) {
1593 $productidselected = $key;
1594 $productlabelselected = $val;
1596 $datebefore =
dol_get_first_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 1,
true);
1597 $dateafter =
dol_get_last_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 12,
true);
1598 $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
1599 $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
1602 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1605 print
': '.$balancebefore;
1609 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1612 print
': '.$balanceafter;
1617 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1618 $hidegeneratedfilelistifempty = 1;
1619 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1620 $hidegeneratedfilelistifempty = 0;
1623 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1627 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1628 $urlsource .= str_replace(
'&',
'&', $param);
1630 $filedir = $diroutputmassaction;
1631 $genallowed = $permissiontoread;
1632 $delallowed = $permissiontoadd;
1634 print $formfile->showdocuments(
'massfilesarea_'.$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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()
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.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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($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_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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 dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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.