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';
42 if (!empty($conf->project->enabled)) {
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");
56 $product_id =
GETPOST(
"product_id",
'int');
57 $action =
GETPOST(
'action',
'aZ09');
58 $massaction =
GETPOST(
'massaction',
'alpha');
59 $confirm =
GETPOST(
'confirm',
'alpha');
60 $cancel =
GETPOST(
'cancel',
'alpha');
61 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'movementlist';
62 $toselect =
GETPOST(
'toselect',
'array');
63 $backtopage =
GETPOST(
"backtopage",
"alpha");
65 $idproduct =
GETPOST(
'idproduct',
'int');
66 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
67 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
68 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
69 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
70 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
71 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
72 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
73 $search_date_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_startmonth',
'int'),
GETPOST(
'search_date_startday',
'int'),
GETPOST(
'search_date_startyear',
'int'),
'tzuserrel');
74 $search_date_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_endmonth',
'int'),
GETPOST(
'search_date_endday',
'int'),
GETPOST(
'search_date_endyear',
'int'),
'tzuserrel');
75 $search_ref =
GETPOST(
'search_ref',
'alpha');
76 $search_movement =
GETPOST(
"search_movement");
77 $search_product_ref = trim(
GETPOST(
"search_product_ref"));
78 $search_product = trim(
GETPOST(
"search_product"));
79 $search_warehouse = trim(
GETPOST(
"search_warehouse"));
80 $search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
81 $search_user = trim(
GETPOST(
"search_user"));
82 $search_batch = trim(
GETPOST(
"search_batch"));
83 $search_qty = trim(
GETPOST(
"search_qty"));
84 $search_type_mouvement =
GETPOST(
'search_type_mouvement',
'int');
85 $search_fk_projet=
GETPOST(
"search_fk_projet",
'int');
86 $optioncss =
GETPOST(
'optioncss',
'alpha');
90 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
91 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
92 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
94 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
98 $offset = $limit * $page;
99 $pageprev = $page - 1;
100 $pagenext = $page + 1;
103 $sortfield =
"m.datem";
109 $pdluoid =
GETPOST(
'pdluoid',
'int');
114 $diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
115 $hookmanager->initHooks(array(
'movementlist'));
120 $extrafields->fetch_name_optionals_label($object->table_element);
122 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
124 $arrayfields = array(
125 'm.rowid'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>1),
126 'm.datem'=>array(
'label'=>
"Date",
'checked'=>1,
'position'=>2),
127 'p.ref'=>array(
'label'=>
"ProductRef",
'checked'=>1,
'css'=>
'maxwidth100',
'position'=>3),
128 'p.label'=>array(
'label'=>
"ProductLabel",
'checked'=>0,
'position'=>5),
129 'm.batch'=>array(
'label'=>
"BatchNumberShort",
'checked'=>1,
'position'=>8,
'enabled'=>(
isModEnabled(
'productbatch'))),
130 'pl.eatby'=>array(
'label'=>
"EatByDate",
'checked'=>0,
'position'=>9,
'enabled'=>(
isModEnabled(
'productbatch'))),
131 'pl.sellby'=>array(
'label'=>
"SellByDate",
'checked'=>0,
'position'=>10,
'enabled'=>(
isModEnabled(
'productbatch'))),
132 'e.ref'=>array(
'label'=>
"Warehouse",
'checked'=>1,
'position'=>100,
'enabled'=>(!($id > 0))),
133 'm.fk_user_author'=>array(
'label'=>
"Author",
'checked'=>0,
'position'=>120),
134 'm.inventorycode'=>array(
'label'=>
"InventoryCodeShort",
'checked'=>1,
'position'=>130),
135 'm.label'=>array(
'label'=>
"MovementLabel",
'checked'=>1,
'position'=>140),
136 'm.type_mouvement'=>array(
'label'=>
"TypeMovement",
'checked'=>0,
'position'=>150),
137 'origin'=>array(
'label'=>
"Origin",
'checked'=>1,
'position'=>155),
138 'm.fk_projet'=>array(
'label'=>
'Project',
'checked'=>0,
'position'=>180),
139 'm.value'=>array(
'label'=>
"Qty",
'checked'=>1,
'position'=>200),
140 'm.price'=>array(
'label'=>
"UnitPurchaseValue",
'checked'=>0,
'position'=>210,
'enabled'=>(!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
145 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
147 if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
148 unset($arrayfields[
'pl.sellby']);
150 if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) {
151 unset($arrayfields[
'pl.eatby']);
156 if ($id > 0 || !empty($ref)) {
157 $tmpwarehouse->fetch($id, $ref);
158 $id = $tmpwarehouse->id;
167 if (!$user->rights->stock->mouvement->lire) {
171 $uploaddir = $conf->stock->dir_output.
'/movements';
173 $permissiontoread = $user->rights->stock->mouvement->lire;
174 $permissiontoadd = $user->rights->stock->mouvement->creer;
175 $permissiontodelete = $user->rights->stock->mouvement->creer;
177 $usercanread = $user->rights->stock->mouvement->lire;
178 $usercancreate = $user->rights->stock->mouvement->creer;
179 $usercandelete = $user->rights->stock->mouvement->creer;
188 if (
GETPOST(
'cancel',
'alpha')) {
192 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
196 $parameters = array();
197 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
202 if (empty($reshook)) {
204 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
207 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
208 $search_date_startday =
'';
209 $search_date_startmonth =
'';
210 $search_date_startyear =
'';
211 $search_date_endday =
'';
212 $search_date_endmonth =
'';
213 $search_date_endyear =
'';
214 $search_date_start =
'';
215 $search_date_end =
'';
217 $search_movement =
"";
218 $search_type_mouvement =
"";
219 $search_inventorycode =
"";
220 $search_product_ref =
"";
221 $search_product =
"";
222 $search_warehouse =
"";
229 $search_array_options = array();
231 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
232 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
237 $objectclass =
'MouvementStock';
238 $objectlabel =
'MouvementStock';
240 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
241 if (empty($diroutputmassaction)) {
242 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
246 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
247 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
248 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
250 $objecttmp =
new $objectclass($db);
251 $listofobjectid = array();
252 foreach ($toselect as $toselectid) {
253 $objecttmp =
new $objectclass($db);
254 $result = $objecttmp->fetch($toselectid);
256 $listofobjectid[$toselectid] = $toselectid;
260 $arrayofinclusion = array();
261 foreach ($listofobjectref as $tmppdf) {
264 foreach ($listofobjectref as $tmppdf) {
265 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
267 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0,
true);
270 $outputlangs = $langs;
273 $newlang =
GETPOST(
'lang_id',
'aZ09');
278 if (!empty($newlang)) {
280 $outputlangs->setDefaultLang($newlang);
288 $filename = preg_replace(
'/\s/',
'_', $filename);
300 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
309 $langs->load(
"exports");
317 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
320 if ($action ==
'update_extras') {
321 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse);
324 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse,
GETPOST(
'attribute',
'restricthtml'));
329 $result = $tmpwarehouse->insertExtraFields();
336 $action =
'edit_extras';
341 if ($action ==
"correct_stock") {
343 if (!empty($product_id)) {
344 $result = $product->fetch($product_id);
349 if (empty($product_id)) {
351 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
352 $action =
'correction';
354 if (!is_numeric(
GETPOST(
"nbpiece"))) {
356 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
357 $action =
'correction';
361 $origin_element =
'';
364 if (
GETPOST(
'projectid',
'int')) {
365 $origin_element =
'project';
366 $origin_id =
GETPOST(
'projectid',
'int');
369 if ($product->hasbatch()) {
370 $batch =
GETPOST(
'batch_number',
'alphanohtml');
377 $result = $product->correct_stock_batch(
382 GETPOST(
"label",
'alphanohtml'),
387 GETPOST(
'inventorycode',
'alphanohtml'),
394 $result = $product->correct_stock(
399 GETPOST(
"label",
'alphanohtml'),
401 GETPOST(
'inventorycode',
'alphanohtml'),
410 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
415 $action =
'correction';
425 if ($action ==
"transfert_stock" && !$cancel) {
427 if (!empty($product_id)) {
428 $result = $product->fetch($product_id);
431 if (!(
GETPOST(
"id_entrepot_destination",
'int') > 0)) {
432 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
434 $action =
'transfert';
436 if (empty($product_id)) {
438 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
439 $action =
'transfert';
441 if (!
GETPOST(
"nbpiece",
'int')) {
442 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
444 $action =
'transfert';
446 if ($id ==
GETPOST(
"id_entrepot_destination",
'int')) {
447 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
449 $action =
'transfert';
454 $result = $product->fetch($product_id);
456 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
457 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
459 $action =
'transfert';
466 $result = $object->fetch($id);
470 $product->load_stock(
'novirtual');
474 if (isset($product->pmp)) {
475 $pricesrc = $product->pmp;
477 $pricedest = $pricesrc;
479 if ($product->hasbatch()) {
483 $result = $pdluo->fetch($pdluoid);
485 $srcwarehouseid = $pdluo->warehouseid;
486 $batch = $pdluo->batch;
487 $eatby = $pdluo->eatby;
488 $sellby = $pdluo->sellby;
494 $srcwarehouseid = $id;
495 $batch =
GETPOST(
'batch_number',
'alphanohtml');
502 $result1 = $product->correct_stock_batch(
519 $result2 = $product->correct_stock_batch(
521 GETPOST(
"id_entrepot_destination",
'int'),
529 GETPOST(
'inventorycode',
'alphanohtml'),
538 $result1 = $product->correct_stock(
545 GETPOST(
'inventorycode',
'alphanohtml'),
553 $result2 = $product->correct_stock(
555 GETPOST(
"id_entrepot_destination"),
560 GETPOST(
'inventorycode',
'alphanohtml'),
567 if (!$error && $result1 >= 0 && $result2 >= 0) {
571 header(
"Location: ".$backtopage);
574 header(
"Location: movement_list.php?id=".$object->id);
580 $action =
'transfert';
591 $productlot =
new ProductLot($db);
592 $productstatic =
new Product($db);
593 $warehousestatic =
new Entrepot($db);
595 $userstatic =
new User($db);
598 if (!empty($conf->project->enabled)) {
603 $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,";
604 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
605 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
606 $sql .=
" m.batch, m.price,";
607 $sql .=
" m.type_mouvement,";
608 $sql .=
" m.fk_projet as fk_project,";
609 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
610 $sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
612 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
613 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
614 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
618 $parameters = array();
619 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
620 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
621 $sql = preg_replace(
'/,\s*$/',
'', $sql);
625 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
626 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
627 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
628 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
629 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
631 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
632 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
633 $sql .=
" WHERE m.fk_product = p.rowid";
635 $sql .=
" AND m.rowid = ".((int) $msid);
637 $sql .=
" AND m.fk_entrepot = e.rowid";
638 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
639 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
640 $sql .=
" AND p.fk_product_type = 0";
643 $sql .=
" AND e.rowid = ".((int) $id);
645 if (!empty($search_date_start)) {
646 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
648 if (!empty($search_date_end)) {
649 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
651 if ($idproduct > 0) {
652 $sql .=
" AND p.rowid = ".((int) $idproduct);
654 if (!empty($search_ref)) {
657 if (!empty($search_movement)) {
660 if (!empty($search_inventorycode)) {
663 if (!empty($search_product_ref)) {
666 if (!empty($search_product)) {
669 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
672 if (!empty($search_user)) {
673 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
675 if (!empty($search_batch)) {
678 if (!empty($product_id) && $product_id !=
'-1') {
681 if (!empty($search_fk_projet) && $search_fk_projet !=
'-1') {
684 if ($search_qty !=
'') {
687 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
688 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
691 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
693 $parameters = array();
694 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
695 $sql .= $hookmanager->resPrint;
699 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
701 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
702 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
703 $resql = $db->query($sqlforcount);
705 $objforcount = $db->fetch_object(
$resql);
719 $sql .= $db->order($sortfield, $sortorder);
721 $sql .= $db->plimit($limit + 1, $offset);
724 $resql = $db->query($sql);
733 if ($idproduct > 0) {
734 $product->fetch($idproduct);
736 if ($id > 0 || $ref) {
737 $result = $object->fetch($id, $ref);
743 $num = $db->num_rows(
$resql);
750 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
752 $title = $langs->trans(
'StockMovementForId', $msid);
754 $title = $langs->trans(
"ListOfStockMovements");
756 if (!empty($object->ref)) {
757 $title .=
' ('.$object->ref.
')';
759 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
766 $arrayofselected = is_array($toselect) ? $toselect : array();
771 if ($object->id > 0) {
774 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
777 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
779 $morehtmlref =
'<div class="refidno">';
780 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$object->lieu;
783 if (!empty($conf->project->enabled)) {
784 $langs->load(
"projects");
785 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
786 if ($usercancreate && 1 == 2) {
787 if ($action !=
'classify') {
788 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
790 if ($action ==
'classify') {
791 $projectid = $object->fk_project;
792 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
793 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
794 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
795 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
796 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
797 $morehtmlref .=
'</form>';
799 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
802 if (!empty($object->fk_project)) {
804 $proj->fetch($object->fk_project);
805 $morehtmlref .=
' : '.$proj->getNomUrl(1);
807 $morehtmlref .=
' - '.$proj->title;
814 $morehtmlref .=
'</div>';
817 if ($user->socid && !in_array(
'stock', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
821 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
824 print
'<div class="fichecenter">';
825 print
'<div class="fichehalfleft">';
826 print
'<div class="underbanner clearboth"></div>';
828 print
'<table class="border centpercent tableforfield">';
833 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($object->description).
'</td></tr>';
835 $calcproductsunique = $object->nb_different_products();
836 $calcproducts = $object->nb_products();
839 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
840 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
844 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
845 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
846 print empty($valtoshow) ?
'0' : $valtoshow;
852 print
'<div class="fichehalfright">';
853 print
'<div class="underbanner clearboth"></div>';
855 print
'<table class="border centpercent tableforfield">';
858 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
859 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
863 $sql =
"SELECT MAX(m.datem) as datem";
864 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
865 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
866 $resqlbis = $db->query($sql);
868 $objbis = $db->fetch_object($resqlbis);
869 $lastmovementdate = $db->jdate($objbis->datem);
874 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
875 if ($lastmovementdate) {
878 print $langs->trans(
"None");
883 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
887 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
888 print
$form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
897 print
'<div class="clearboth"></div>';
904 if ($action ==
"correction") {
905 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
910 if ($action ==
"transfert") {
911 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
917 if ((empty($action) || $action ==
'list') && $id > 0) {
918 print
"<div class=\"tabsAction\">\n";
920 $parameters = array();
921 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
923 if (empty($reshook)) {
924 if ($user->rights->stock->mouvement->creer) {
925 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=correction">'.$langs->trans(
"CorrectStock").
'</a>';
928 if ($user->rights->stock->mouvement->creer) {
929 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=transfert">'.$langs->trans(
"TransferStock").
'</a>';
937 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
938 $param .=
'&contextpage='.urlencode($contextpage);
940 if ($limit > 0 && $limit != $conf->liste_limit) {
941 $param .=
'&limit='.urlencode($limit);
944 $param .=
'&id='.urlencode($id);
946 if ($search_date_startday) {
947 $param .=
'&search_date_startday='.urlencode($search_date_startday);
949 if ($search_date_startmonth) {
950 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
952 if ($search_date_startyear) {
953 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
955 if ($search_date_endday) {
956 $param .=
'&search_date_endday='.urlencode($search_date_endday);
958 if ($search_date_endmonth) {
959 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
961 if ($search_date_endyear) {
962 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
964 if ($search_movement) {
965 $param .=
'&search_movement='.urlencode($search_movement);
967 if ($search_inventorycode) {
968 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
970 if ($search_type_mouvement) {
971 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
973 if ($search_product_ref) {
974 $param .=
'&search_product_ref='.urlencode($search_product_ref);
976 if ($search_product) {
977 $param .=
'&search_product='.urlencode($search_product);
980 $param .=
'&search_batch='.urlencode($search_batch);
982 if ($search_warehouse > 0) {
983 $param .=
'&search_warehouse='.urlencode($search_warehouse);
986 $param .=
'&search_user='.urlencode($search_user);
988 if ($idproduct > 0) {
989 $param .=
'&idproduct='.urlencode($idproduct);
992 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
995 $arrayofmassactions = array();
997 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1000 if (!empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) {
1001 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1003 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1004 $arrayofmassactions = array();
1006 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1008 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1009 if ($optioncss !=
'') {
1010 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1012 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1013 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1014 print
'<input type="hidden" name="action" value="list">';
1015 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1016 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1017 print
'<input type="hidden" name="type" value="'.$type.
'">';
1018 print
'<input type="hidden" name="page" value="'.$page.
'">';
1019 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1021 print
'<input type="hidden" name="id" value="'.$id.
'">';
1025 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1027 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1031 $topicmail =
"SendStockMovement";
1032 $modelmail =
"movementstock";
1034 $trackid =
'mov'.$object->id;
1035 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1038 foreach ($fieldstosearchall as $key => $val) {
1039 $fieldstosearchall[$key] = $langs->trans($val);
1041 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1044 $moreforfilter =
'';
1046 $parameters = array(
'arrayfields'=>&$arrayfields);
1047 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
1048 if (empty($reshook)) {
1049 $moreforfilter .= $hookmanager->resPrint;
1051 $moreforfilter = $hookmanager->resPrint;
1054 if (!empty($moreforfilter)) {
1055 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1056 print $moreforfilter;
1060 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1061 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
1062 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1064 print
'<div class="div-table-responsive">';
1065 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1069 print
'<tr class="liste_titre">';
1070 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1072 print
'<td class="liste_titre left">';
1073 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1076 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1078 print
'<td class="liste_titre center">';
1079 print
'<div class="nowrap">';
1080 print
$form->selectDate($search_date_start?$search_date_start:-1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1082 print
'<div class="nowrap">';
1083 print
$form->selectDate($search_date_end?$search_date_end:-1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1087 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1089 print
'<td class="liste_titre left">';
1090 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1093 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1095 print
'<td class="liste_titre left">';
1096 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1100 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1101 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1103 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1104 print
'<td class="liste_titre left">';
1107 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1108 print
'<td class="liste_titre left">';
1112 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1113 print
'<td class="liste_titre maxwidthonsmartphone left">';
1115 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
1118 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1120 print
'<td class="liste_titre left">';
1121 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1124 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1126 print
'<td class="liste_titre left">';
1127 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1130 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1132 print
'<td class="liste_titre left">';
1133 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1136 if (!empty($arrayfields[
'origin'][
'checked'])) {
1138 print
'<td class="liste_titre left">';
1142 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1144 print
'<td class="liste_titre" align="left">';
1148 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1150 print
'<td class="liste_titre center">';
1152 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1153 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1154 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1155 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1156 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1157 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1164 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1166 print
'<td class="liste_titre right">';
1167 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1170 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1172 print
'<td class="liste_titre" align="left">';
1178 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1181 $parameters = array(
'arrayfields'=>$arrayfields);
1182 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
1183 print $hookmanager->resPrint;
1185 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1186 print
'<td class="liste_titre">';
1190 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1191 print
'<td class="liste_titre">';
1195 print
'<td class="liste_titre maxwidthsearch">';
1196 $searchpicto =
$form->showFilterButtons();
1204 print
'<tr class="liste_titre">';
1205 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1206 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1208 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1209 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1211 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1212 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1214 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1215 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1217 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1218 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1220 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1221 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1223 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1224 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1226 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1228 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1230 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1231 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1233 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1234 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1236 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1237 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1239 if (!empty($arrayfields[
'origin'][
'checked'])) {
1240 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1242 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1243 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1245 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1246 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1248 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1249 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1251 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1252 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1256 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1259 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1260 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1261 print $hookmanager->resPrint;
1262 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1263 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1265 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1266 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1269 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1273 $arrayofuniqueproduct = array();
1279 $totalarray = array();
1280 $totalarray[
'nbfield'] = 0;
1281 while ($i < ($limit ? min($num, $limit) : $num)) {
1282 $obj = $db->fetch_object(
$resql);
1287 $userstatic->id = $obj->fk_user_author;
1288 $userstatic->login = $obj->login;
1289 $userstatic->lastname = $obj->lastname;
1290 $userstatic->firstname = $obj->firstname;
1291 $userstatic->photo = $obj->photo;
1292 $userstatic->email = $obj->user_email;
1293 $userstatic->statut = $obj->user_status;
1298 $sql =
"SELECT label";
1299 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1300 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1301 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1304 $result = $db->query($sql);
1306 $objtp = $db->fetch_object($result);
1307 if (!empty($objtp->label)) {
1308 $obj->produit = $objtp->label;
1313 $productstatic->id = $obj->rowid;
1314 $productstatic->ref = $obj->product_ref;
1315 $productstatic->label = $obj->produit;
1316 $productstatic->type = $obj->type;
1317 $productstatic->entity = $obj->entity;
1318 $productstatic->status = $obj->tosell;
1319 $productstatic->status_buy = $obj->tobuy;
1320 $productstatic->status_batch = $obj->tobatch;
1322 $productlot->id = $obj->lotid;
1323 $productlot->batch = $obj->batch;
1324 $productlot->eatby = $obj->eatby;
1325 $productlot->sellby = $obj->sellby;
1327 $warehousestatic->id = $obj->entrepot_id;
1328 $warehousestatic->ref = $obj->warehouse_ref;
1329 $warehousestatic->label = $obj->warehouse_ref;
1330 $warehousestatic->lieu = $obj->lieu;
1331 $warehousestatic->fk_parent = $obj->fk_parent;
1332 $warehousestatic->statut = $obj->statut;
1334 $movement->type = $obj->type_mouvement;
1336 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1337 if (!empty($obj->fk_origin)) {
1338 $origin = $movement->get_origin($obj->fk_origin, $obj->origintype);
1343 print
'<tr class="oddeven">';
1345 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1346 print
'<td class="nowraponall">';
1347 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
1351 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1353 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1355 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1357 print
'<td class="nowraponall">';
1358 print $productstatic->getNomUrl(1,
'stock', 16);
1361 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1363 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1364 print $productstatic->label;
1367 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1368 print
'<td class="center nowraponall">';
1369 if ($productlot->id > 0) {
1370 print $productlot->getNomUrl(1);
1372 print $productlot->batch;
1376 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1377 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1379 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1380 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1383 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1384 print
'<td class="tdoverflowmax100">';
1385 print $warehousestatic->getNomUrl(1);
1389 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1390 print
'<td class="tdoverflowmax100">';
1391 print $userstatic->getNomUrl(-1);
1394 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1396 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'&search_type_mouvement='.urlencode($obj->type_mouvement).
'">'.$obj->inventorycode.
'</a></td>';
1398 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1400 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.$obj->label.
'</td>';
1402 if (!empty($arrayfields[
'origin'][
'checked'])) {
1404 print
'<td class="nowraponall">'.$origin.
'</td>';
1406 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1409 if ($obj->fk_project != 0) {
1410 print $movement->get_origin($obj->fk_project,
'project');
1414 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1416 print
'<td class="center">';
1417 print $movement->getTypeMovement();
1420 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1422 print
'<td class="right">';
1423 if ($obj->qty > 0) {
1424 print
'<span class="stockmovemententry">';
1429 print
'<span class="stockmovementexit">';
1435 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1437 print
'<td class="right">';
1438 if ($obj->price != 0) {
1439 print
price($obj->price);
1445 $object = $movement;
1446 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1448 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1449 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1450 print $hookmanager->resPrint;
1453 print
'<td class="nowrap center">';
1454 if ($massactionbutton || $massaction) {
1456 if (in_array($obj->mid, $arrayofselected)) {
1459 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1463 $totalarray[
'nbfield']++;
1478 if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) {
1481 $productidselected = 0;
1482 foreach ($arrayofuniqueproduct as $key => $val) {
1483 $productidselected = $key;
1484 $productlabelselected = $val;
1486 $datebefore =
dol_get_first_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 1,
true);
1487 $dateafter =
dol_get_last_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 12,
true);
1488 $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
1489 $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
1492 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1495 print
': '.$balancebefore;
1499 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1502 print
': '.$balanceafter;
1508 $hidegeneratedfilelistifempty = 1;
1509 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1510 $hidegeneratedfilelistifempty = 0;
1513 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1517 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1518 $urlsource .= str_replace(
'&',
'&', $param);
1520 $filedir = $diroutputmassaction;
1521 $genallowed = $permissiontoread;
1522 $delallowed = $permissiontoadd;
1524 print $formfile->showdocuments(
'massfilesarea_mymodule',
'', $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 to manage projects.
Class to manage translations.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
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='')
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages 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_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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
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)
$nbtotalofrecords
Count total nb of records.
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.