31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43if (isModEnabled(
'project')) {
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
57$langs->loadLangs(array(
'products',
'stocks',
'orders'));
58if (isModEnabled(
'productbatch')) {
59 $langs->load(
"productbatch");
62$action =
GETPOST(
'action',
'aZ09');
63$massaction =
GETPOST(
'massaction',
'alpha');
64$confirm =
GETPOST(
'confirm',
'alpha');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
67$toselect =
GETPOST(
'toselect',
'array');
68$backtopage =
GETPOST(
"backtopage",
"alpha");
69$optioncss =
GETPOST(
'optioncss',
'aZ');
70$show_files =
GETPOST(
'show_files',
'aZ');
80$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
81$search_date_startday =
GETPOSTINT(
'search_date_startday');
82$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
83$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
84$search_date_endday =
GETPOSTINT(
'search_date_endday');
85$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
86$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
89$search_ref =
GETPOST(
'search_ref',
'alpha');
90$search_movement =
GETPOST(
"search_movement");
91$search_product_ref = trim(
GETPOST(
"search_product_ref"));
92$search_product = trim(
GETPOST(
"search_product"));
93$search_warehouse = trim(
GETPOST(
"search_warehouse"));
94$search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
95$search_user = trim(
GETPOST(
"search_user"));
96$search_batch = trim(
GETPOST(
"search_batch"));
97$search_qty = trim(
GETPOST(
"search_qty"));
98$search_type_mouvement =
GETPOST(
'search_type_mouvement');
99$search_fk_project =
GETPOST(
"search_fk_project");
105$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
106$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
108if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
112$offset = $limit * $page;
113$pageprev = $page - 1;
114$pagenext = $page + 1;
117 $sortfield =
"m.datem";
128$diroutputmassaction =
$conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
129$hookmanager->initHooks(array($contextpage));
134$extrafields->fetch_name_optionals_label(
$object->table_element);
136$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
139 'm.rowid' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 1),
140 'm.datem' => array(
'label' =>
"Date",
'checked' =>
'1',
'position' => 2),
141 'p.ref' => array(
'label' =>
"ProductRef",
'checked' =>
'1',
'css' =>
'maxwidth100',
'position' => 3),
142 'p.label' => array(
'label' =>
"ProductLabel",
'checked' =>
'0',
'position' => 5),
143 'm.batch' => array(
'label' =>
"BatchNumberShort",
'checked' =>
'1',
'position' => 8,
'enabled' => (
string) (
int) (isModEnabled(
'productbatch'))),
144 'pl.eatby' => array(
'label' =>
"EatByDate",
'checked' =>
'0',
'position' => 9,
'enabled' => (
string) (
int) (isModEnabled(
'productbatch'))),
145 'pl.sellby' => array(
'label' =>
"SellByDate",
'checked' =>
'0',
'position' => 10,
'enabled' => (
string) (
int) (isModEnabled(
'productbatch'))),
146 'e.ref' => array(
'label' =>
"Warehouse",
'checked' =>
'1',
'position' => 100,
'enabled' => (
string) (
int) (!($id > 0))),
147 'm.fk_user_author' => array(
'label' =>
"Author",
'checked' =>
'0',
'position' => 120),
148 'm.inventorycode' => array(
'label' =>
"InventoryCodeShort",
'checked' =>
'1',
'position' => 130),
149 'm.label' => array(
'label' =>
"MovementLabel",
'checked' =>
'1',
'position' => 140),
150 'm.type_mouvement' => array(
'label' =>
"TypeMovement",
'checked' =>
'0',
'position' => 150),
151 'origin' => array(
'label' =>
"Origin",
'checked' =>
'1',
'position' => 155),
152 'm.fk_projet' => array(
'label' =>
'Project',
'checked' =>
'0',
'position' => 180),
153 'm.value' => array(
'label' =>
"Qty",
'checked' =>
'1',
'position' => 200),
154 'm.price' => array(
'label' =>
"UnitPurchaseValue",
'checked' =>
'0',
'position' => 210,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
159include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
162 unset($arrayfields[
'pl.sellby']);
165 unset($arrayfields[
'pl.eatby']);
170if ($id > 0 || !empty($ref)) {
171 $tmpwarehouse->fetch($id, $ref);
172 $id = $tmpwarehouse->id;
181if (!$user->hasRight(
'stock',
'mouvement',
'lire')) {
185$uploaddir =
$conf->stock->dir_output.
'/movements';
187$permissiontoread = $user->hasRight(
'stock',
'mouvement',
'lire');
188$permissiontoadd = $user->hasRight(
'stock',
'mouvement',
'creer');
189$permissiontodelete = $user->hasRight(
'stock',
'mouvement',
'creer');
190$permissiontoeditextra = $permissiontoadd;
191if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
193 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
196$usercanread = $user->hasRight(
'stock',
'mouvement',
'lire');
197$usercancreate = $user->hasRight(
'stock',
'mouvement',
'creer');
198$usercandelete = $user->hasRight(
'stock',
'mouvement',
'creer');
207if (
GETPOST(
'cancel',
'alpha')) {
211if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
215$parameters = array();
216$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
221if (empty($reshook)) {
223 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
226 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
227 $search_date_startday =
'';
228 $search_date_startmonth =
'';
229 $search_date_startyear =
'';
230 $search_date_endday =
'';
231 $search_date_endmonth =
'';
232 $search_date_endyear =
'';
233 $search_date_start =
'';
234 $search_date_end =
'';
236 $search_movement =
"";
237 $search_type_mouvement =
"";
238 $search_inventorycode =
"";
239 $search_product_ref =
"";
240 $search_product =
"";
241 $search_warehouse =
"";
245 $search_fk_project =
"";
248 $search_array_options = array();
250 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
251 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
253 if ($action ==
'confirm_reverse') {
259 $objectclass =
'MouvementStock';
260 $objectlabel =
'MouvementStock';
262 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
263 if (empty($diroutputmassaction)) {
264 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
268 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
269 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
270 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
273 $listofobjectid = array();
274 foreach ($toselect as $toselectid) {
276 $result = $objecttmp->fetch($toselectid);
278 $listofobjectid[$toselectid] = $toselectid;
282 $arrayofinclusion = array();
283 foreach ($listofobjectref as $tmppdf) {
286 foreach ($listofobjectref as $tmppdf) {
287 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
289 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0, 1);
292 $outputlangs = $langs;
295 $newlang =
GETPOST(
'lang_id',
'aZ09');
300 if (!empty($newlang)) {
302 $outputlangs->setDefaultLang($newlang);
310 $filename = preg_replace(
'/\s/',
'_', $filename);
322 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
331 $langs->load(
"exports");
340 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
343if ($action ==
'update_extras' && $permissiontoeditextra) {
344 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse, 2);
346 $attribute_name =
GETPOST(
'attribute',
'aZ09');
349 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse, $attribute_name);
355 $result = $tmpwarehouse->updateExtraField($attribute_name,
'CONTRACT_MODIFY');
363 $action =
'edit_extras';
375if ($action ==
"correct_stock" && $permissiontoadd) {
377 if (!empty($product_id)) {
378 $result = $product->fetch($product_id);
383 if (empty($product_id)) {
385 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
386 $action =
'correction';
390 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
391 $action =
'correction';
395 $origin_element =
'';
399 $origin_element =
'project';
403 if ($product->hasbatch()) {
404 $batch =
GETPOST(
'batch_number',
'alphanohtml');
409 $result = $product->correct_stock_batch(
414 GETPOST(
"label",
'alphanohtml'),
419 GETPOST(
'inventorycode',
'alphanohtml'),
426 $result = $product->correct_stock(
431 GETPOST(
"label",
'alphanohtml'),
433 GETPOST(
'inventorycode',
'alphanohtml'),
442 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
447 $action =
'correction';
457if ($action ==
"transfert_stock" && $permissiontoadd && !$cancel) {
460 if (!empty($product_id)) {
461 $result = $product->fetch($product_id);
464 if (!(
GETPOSTINT(
"id_entrepot_destination") > 0)) {
465 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
467 $action =
'transfert';
469 if (empty($product_id)) {
471 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
472 $action =
'transfert';
475 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
477 $action =
'transfert';
479 if ($id ==
GETPOSTINT(
"id_entrepot_destination")) {
480 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
482 $action =
'transfert';
485 if (isModEnabled(
'productbatch')) {
487 $result = $product->fetch($product_id);
489 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
490 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
492 $action =
'transfert';
499 $result = $warehouse->fetch($id);
503 $product->load_stock(
'novirtual');
507 if (isset($product->pmp)) {
508 $pricesrc = $product->pmp;
510 $pricedest = $pricesrc;
512 if ($product->hasbatch()) {
520 $result = $pdluo->fetch($pdluoid);
522 $srcwarehouseid = $pdluo->warehouseid;
523 $batch = $pdluo->batch;
529 $srcwarehouseid =
$id;
530 $batch =
GETPOST(
'batch_number',
'alphanohtml');
537 $result1 = $product->correct_stock_batch(
554 $result2 = $product->correct_stock_batch(
564 GETPOST(
'inventorycode',
'alphanohtml'),
573 $result1 = $product->correct_stock(
578 GETPOST(
"label",
'alphanohtml'),
580 GETPOST(
'inventorycode',
'alphanohtml'),
588 $result2 = $product->correct_stock(
593 GETPOST(
"label",
'alphanohtml'),
595 GETPOST(
'inventorycode',
'alphanohtml'),
602 if (!$error && $result1 >= 0 && $result2 >= 0) {
606 header(
"Location: ".$backtopage);
609 header(
"Location: movement_list.php?id=".$warehouse->id);
615 $action =
'transfert';
622if (!$error && $action ==
'confirm_reverse' && $confirm ==
"yes" && $permissiontoadd) {
623 $toselect = array_map(
'intval', $toselect);
628 $sql =
"SELECT rowid, label, inventorycode, datem";
629 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement";
630 $sql .=
" WHERE rowid IN (".$db->sanitize(implode(
',', $toselect)).
")";
632 $resql = $db->query($sql);
634 $num = $db->num_rows($resql);
637 $obj = $db->fetch_object($resql);
645 $reverse =
$object->reverseMovement();
665 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
673$form =
new Form($db);
675if (isModEnabled(
'project')) {
681$productstatic =
new Product($db);
682$warehousestatic =
new Entrepot($db);
684$userstatic =
new User($db);
690$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,";
691$sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
692$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
693$sql .=
" m.batch, m.price,";
694$sql .=
" m.type_mouvement,";
695$sql .=
" m.fk_projet as fk_project,";
696$sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
697$sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
699if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
700 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
701 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
705$parameters = array();
706$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
707$sql .= $hookmanager->resPrint;
708$sql = preg_replace(
'/,\s*$/',
'', $sql);
712$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
713$sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
714$sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
715if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
716 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
718$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
719$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
722$parameters = array();
723$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
724$sql .= $hookmanager->resPrint;
726$sql .=
" WHERE m.fk_product = p.rowid";
728 $sql .=
" AND m.rowid = ".((int) $msid);
730$sql .=
" AND m.fk_entrepot = e.rowid";
731$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
733 $sql .=
" AND p.fk_product_type = 0";
736 $sql .=
" AND e.rowid = ".((int) $id);
738if (!empty($search_date_start)) {
739 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
741if (!empty($search_date_end)) {
742 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
745 $sql .=
" AND p.rowid = ".((int) $idproduct);
747if (!empty($search_ref)) {
750if (!empty($search_movement)) {
753if (!empty($search_inventorycode)) {
756if (!empty($search_product_ref)) {
759if (!empty($search_product)) {
762if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
765if (!empty($search_user)) {
766 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
768if (!empty($search_batch)) {
771if (!empty($product_id) && $product_id !=
'-1') {
774if (!empty($search_fk_project) && $search_fk_project !=
'-1') {
777if ($search_qty !=
'') {
780if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
781 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
784include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
786$parameters = array();
787$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
788$sql .= $hookmanager->resPrint;
791$nbtotalofrecords =
'';
794 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
795 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
796 $resql = $db->query($sqlforcount);
798 $objforcount = $db->fetch_object($resql);
799 $nbtotalofrecords = $objforcount->nbtotalofrecords;
804 if (($page * $limit) > $nbtotalofrecords) {
812$sql .= $db->order($sortfield, $sortorder);
814 $sql .= $db->plimit($limit + 1, $offset);
817$resql = $db->query($sql);
823$num = $db->num_rows($resql);
830 $product->fetch($idproduct);
832if ($id > 0 || $ref) {
833 $result = $warehouse->fetch($id, $ref);
840$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
842 $title = $langs->trans(
'StockMovementForId', $msid);
844 $title = $langs->trans(
"StockMovements");
846 if (!empty($warehouse->ref)) {
847 $title .=
' ('.$warehouse->ref.
')';
849 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
858llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-product page-stock_movement_list');
863if ($warehouse->id > 0) {
866 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
869 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
871 $morehtmlref =
'<div class="refidno">';
872 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$warehouse->lieu;
875 if (isModEnabled(
'project') && $formproject !==
null) {
876 $langs->load(
"projects");
877 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
878 if ($usercancreate && 1 == 2) {
879 if ($action !=
'classify') {
880 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$warehouse->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
882 if ($action ==
'classify') {
883 $projectid = $warehouse->fk_project;
884 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id.
'">';
885 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
886 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
887 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
888 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
889 $morehtmlref .=
'</form>';
891 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id, $warehouse->socid, (
string) $warehouse->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
894 if (!empty($warehouse->fk_project)) {
896 $proj->fetch($warehouse->fk_project);
897 $morehtmlref .=
' : '.$proj->getNomUrl(1);
899 $morehtmlref .=
' - '.$proj->title;
906 $morehtmlref .=
'</div>';
909 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
913 dol_banner_tab($warehouse,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
916 print
'<div class="fichecenter">';
917 print
'<div class="fichehalfleft">';
918 print
'<div class="underbanner clearboth"></div>';
920 print
'<table class="border centpercent tableforfield">';
925 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($warehouse->description).
'</td></tr>';
927 $calcproductsunique = $warehouse->nb_different_products();
928 $calcproducts = $warehouse->nb_products();
931 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
932 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
936 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
937 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
938 print empty($valtoshow) ?
'0' : $valtoshow;
944 print
'<div class="fichehalfright">';
945 print
'<div class="underbanner clearboth"></div>';
947 print
'<table class="border centpercent tableforfield">';
950 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
951 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1,
$conf->currency);
955 $sql =
"SELECT MAX(m.datem) as datem";
956 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
957 $sql .=
" WHERE m.fk_entrepot = ".((int) $warehouse->id);
958 $resqlbis = $db->query($sql);
960 $lastmovementdate = 0;
962 $objbis = $db->fetch_object($resqlbis);
963 $lastmovementdate = $db->jdate($objbis->datem);
968 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
969 if ($lastmovementdate) {
972 print $langs->trans(
"None");
977 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
980 if (isModEnabled(
'category')) {
981 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
982 print $form->showCategories($warehouse->id, Categorie::TYPE_WAREHOUSE, 1);
991 print
'<div class="clearboth"></div>';
998if ($action ==
"correction") {
999 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
1004if ($action ==
"transfert") {
1007 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
1013if ((empty($action) || $action ==
'list') && $id > 0) {
1014 print
"<div class=\"tabsAction\">\n";
1016 $parameters = array();
1017 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $warehouse, $action);
1019 if (empty($reshook)) {
1020 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
1021 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=transfert&token='.
newToken().
'">'.$langs->trans(
"TransferStock").
'</a>';
1024 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
1025 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=correction&token='.
newToken().
'">'.$langs->trans(
"CorrectStock").
'</a>';
1032$arrayofselected = is_array($toselect) ? $toselect : array();
1036 $param .=
'&mode='.urlencode($mode);
1038if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1039 $param .=
'&contextpage='.urlencode($contextpage);
1041if ($limit > 0 && $limit !=
$conf->liste_limit) {
1042 $param .=
'&limit='.((int) $limit);
1045 $param .=
'&id='.urlencode((
string) (
$id));
1048 $param .=
'&show_files='.urlencode((
string) ($show_files));
1050if ($search_date_startday) {
1051 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1053if ($search_date_startmonth) {
1054 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1056if ($search_date_startyear) {
1057 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1059if ($search_date_endday) {
1060 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1062if ($search_date_endmonth) {
1063 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1065if ($search_date_endyear) {
1066 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1068if ($search_movement) {
1069 $param .=
'&search_movement='.urlencode($search_movement);
1071if ($search_inventorycode) {
1072 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
1074if ($search_type_mouvement) {
1075 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
1077if ($search_product_ref) {
1078 $param .=
'&search_product_ref='.urlencode($search_product_ref);
1080if ($search_product) {
1081 $param .=
'&search_product='.urlencode($search_product);
1084 $param .=
'&search_batch='.urlencode($search_batch);
1086if ($search_warehouse > 0) {
1087 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1090 $param .=
'&search_user='.urlencode($search_user);
1092if ($idproduct > 0) {
1093 $param .=
'&idproduct='.urlencode((
string) ($idproduct));
1095if ($search_fk_project !=
'' && $search_fk_project !=
'-1') {
1096 $param .=
'&search_fk_project='.urlencode((
string) ($search_fk_project));
1099include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1101$parameters = array(
'param' => &$param);
1102$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $warehouse, $action);
1103$param .= $hookmanager->resPrint;
1106$arrayofmassactions = array();
1108 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1112 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1114if (!empty($permissiontoadd)) {
1115 $arrayofmassactions[
'prereverse'] =
img_picto(
'',
'add',
'class="pictofixedwidth"').$langs->trans(
"Reverse");
1117if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'prereverse'))) {
1118 $arrayofmassactions = array();
1121$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1123print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1124if ($optioncss !=
'') {
1125 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1127print
'<input type="hidden" name="token" value="'.newToken().
'">';
1128print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1129print
'<input type="hidden" name="action" value="list">';
1130print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1131print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1132print
'<input type="hidden" name="type" value="'.$type.
'">';
1133print
'<input type="hidden" name="page" value="'.$page.
'">';
1134print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1135print
'<input type="hidden" name="page_y" value="">';
1136print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1138 print
'<input type="hidden" name="id" value="'.$id.
'">';
1144print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1147$topicmail =
"SendStockMovement";
1148$modelmail =
"movementstock";
1150$trackid =
'mov'.$warehouse->id;
1151include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1152if ($massaction ==
'prereverse' && count($toselect) <=
getDolGlobalInt(
'MAIN_LIMIT_FOR_MASS_ACTIONS', 1000)) {
1153 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassReverse"), $langs->trans(
"ConfirmMassReverseQuestion", count($toselect)),
"confirm_reverse",
null,
'', 0, 200, 500, 1,
'Yes');
1159 if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
1161 $fieldstosearchall = array();
1163 foreach ($fieldstosearchall as $key => $val) {
1164 $fieldstosearchall[$key] = $langs->trans($val);
1165 $setupstring .= $key.
"=".$val.
";";
1167 print
'<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1168 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1173$parameters = array(
'arrayfields' => &$arrayfields);
1174$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $warehouse, $action);
1175if (empty($reshook)) {
1176 $moreforfilter .= $hookmanager->resPrint;
1178 $moreforfilter = $hookmanager->resPrint;
1181if (!empty($moreforfilter)) {
1182 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1183 print $moreforfilter;
1187$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1188$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1189$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1190$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1192print
'<div class="div-table-responsive">';
1193print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1197print
'<tr class="liste_titre_filter">';
1200 print
'<td class="liste_titre center maxwidthsearch">';
1201 $searchpicto = $form->showFilterButtons(
'left');
1205if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1207 print
'<td class="liste_titre left">';
1208 print
'<input class="flat maxwidth40" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1211if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1213 print
'<td class="liste_titre center">';
1214 print
'<div class="nowrapfordate">';
1215 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1217 print
'<div class="nowrapfordate">';
1218 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1222if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1224 print
'<td class="liste_titre left">';
1225 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1228if (!empty($arrayfields[
'p.label'][
'checked'])) {
1230 print
'<td class="liste_titre left">';
1231 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1235if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1236 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1238if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1239 print
'<td class="liste_titre left">';
1242if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1243 print
'<td class="liste_titre left">';
1247if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1248 print
'<td class="liste_titre maxwidthonsmartphone left">';
1250 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'maxwidth150');
1253if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1255 print
'<td class="liste_titre left">';
1256 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1259if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1261 print
'<td class="liste_titre left">';
1262 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1265if (!empty($arrayfields[
'm.label'][
'checked'])) {
1267 print
'<td class="liste_titre left">';
1268 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1271if (!empty($arrayfields[
'origin'][
'checked'])) {
1273 print
'<td class="liste_titre left">';
1277if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1279 print
'<td class="liste_titre" align="left">';
1280 print $warehouse->showInputField($warehouse->fields[
'fk_project'],
'fk_project', $search_fk_project,
'',
'',
'search_',
'maxwidth125', 1);
1283if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1285 print
'<td class="liste_titre center">';
1287 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1288 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1289 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1290 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1291 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1292 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1299if (!empty($arrayfields[
'm.value'][
'checked'])) {
1301 print
'<td class="liste_titre right">';
1302 print
'<input class="flat width50 right" type="text" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1305if (!empty($arrayfields[
'm.price'][
'checked'])) {
1307 print
'<td class="liste_titre" align="left">';
1313include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1316$parameters = array(
'arrayfields' => $arrayfields);
1317$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $warehouse, $action);
1318print $hookmanager->resPrint;
1320if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1321 print
'<td class="liste_titre">';
1325if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1326 print
'<td class="liste_titre">';
1331 print
'<td class="liste_titre center maxwidthsearch">';
1332 $searchpicto = $form->showFilterButtons();
1343print
'<tr class="liste_titre">';
1346 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1349if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1350 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1352if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1355if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1358if (!empty($arrayfields[
'p.label'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1361if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1364if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1367if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1370if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1374if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1375 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1377if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1378 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1380if (!empty($arrayfields[
'm.label'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1383if (!empty($arrayfields[
'origin'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1386if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1387 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1389if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1390 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1392if (!empty($arrayfields[
'm.value'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1395if (!empty($arrayfields[
'm.price'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1400include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1403$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1404$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $warehouse, $action);
1405print $hookmanager->resPrint;
1406if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1407 print_liste_field_titre($arrayfields[
'm.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"m.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1409if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1410 print_liste_field_titre($arrayfields[
'm.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"m.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1414 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1420$arrayofuniqueproduct = array();
1429$imaxinloop = ($limit ? min($num, $limit) : $num);
1430while ($i < $imaxinloop) {
1431 $obj = $db->fetch_object($resql);
1436 $userstatic->id = $obj->fk_user_author;
1437 $userstatic->login = $obj->login;
1438 $userstatic->lastname = $obj->lastname;
1439 $userstatic->firstname = $obj->firstname;
1440 $userstatic->photo = $obj->photo;
1441 $userstatic->email = $obj->user_email;
1442 $userstatic->status = $obj->user_status;
1447 $sql =
"SELECT label";
1448 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1449 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1450 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1453 $result = $db->query($sql);
1455 $objtp = $db->fetch_object($result);
1456 if (!empty($objtp->label)) {
1457 $obj->produit = $objtp->label;
1462 $productstatic->id = $obj->rowid;
1463 $productstatic->ref = $obj->product_ref;
1464 $productstatic->label = $obj->produit;
1465 $productstatic->type = $obj->type;
1466 $productstatic->entity = $obj->entity;
1467 $productstatic->status = $obj->tosell;
1468 $productstatic->status_buy = $obj->tobuy;
1469 $productstatic->status_batch = $obj->tobatch;
1471 $productlot->id = $obj->lotid;
1472 $productlot->batch = $obj->batch;
1473 $productlot->eatby = $obj->eatby;
1474 $productlot->sellby = $obj->sellby;
1476 $warehousestatic->id = $obj->entrepot_id;
1477 $warehousestatic->ref = $obj->warehouse_ref;
1478 $warehousestatic->label = $obj->warehouse_ref;
1479 $warehousestatic->lieu = $obj->lieu;
1480 $warehousestatic->fk_parent = $obj->fk_parent;
1481 $warehousestatic->statut = $obj->statut;
1487 $object->warehouse_id = $obj->entrepot_id;
1488 $object->type = $obj->type_mouvement;
1490 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1491 if (!empty($obj->fk_origin)) {
1492 $origin =
$object->get_origin($obj->fk_origin, $obj->origintype);
1497 if ($mode ==
'kanban') {
1499 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1500 print
'<div class="box-flex-container kanban">';
1504 if ($massactionbutton || $massaction) {
1506 if (in_array($warehouse->id, $arrayofselected)) {
1510 print $warehouse->getKanbanView(
'', array(
'selected' => $selected));
1511 if ($i == ($imaxinloop - 1)) {
1518 print
'<tr data-rowid="'.$warehouse->id.
'" class="oddeven">';
1521 print
'<td class="nowrap center">';
1522 if ($massactionbutton || $massaction) {
1524 if (in_array($obj->mid, $arrayofselected)) {
1527 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1535 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1536 print
'<td class="nowraponall">';
1543 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1544 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1547 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1548 print
'<td class="nowraponall">';
1549 print $productstatic->getNomUrl(1,
'stock', 16);
1553 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1554 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1555 print $productstatic->label;
1559 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1560 print
'<td class="center nowraponall">';
1561 if ($productlot->id > 0) {
1562 print $productlot->getNomUrl(1);
1564 print $productlot->batch;
1569 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1570 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1573 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1574 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1577 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1578 print
'<td class="tdoverflowmax150">';
1579 print $warehousestatic->getNomUrl(1);
1583 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1584 print
'<td class="tdoverflowmax100">';
1585 print $userstatic->getNomUrl(-1);
1589 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1590 print
'<td class="tdoverflowmax150" title="'.dolPrintHTML($obj->inventorycode).
'">';
1591 if ($obj->inventorycode) {
1592 print
img_picto(
'',
'movement',
'class="pictofixedwidth"');
1593 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'">'.
dol_escape_htmltag($obj->inventorycode).
'</a>';
1598 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1599 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
1602 if (!empty($arrayfields[
'origin'][
'checked'])) {
1603 print
'<td class="nowraponall">'.$origin.
'</td>';
1606 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1608 if ($obj->fk_project != 0) {
1609 print
$object->get_origin($obj->fk_project,
'project');
1614 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1615 print
'<td class="center">';
1616 print
$object->getTypeMovement();
1620 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1621 print
'<td class="right">';
1622 if ($obj->qty > 0) {
1623 print
'<span class="stockmovemententry">';
1628 print
'<span class="stockmovementexit">';
1635 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1636 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'lire');
1637 if ($productstatic->isService()) {
1638 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_supplier_prices') : $user->hasRight(
'service',
'lire');
1640 print
'<td class="right">';
1641 if ($obj->price != 0 && $usercancreadsupplierprice) {
1642 print
price($obj->price);
1648 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1650 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1651 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1652 print $hookmanager->resPrint;
1656 print
'<td class="nowrap center">';
1657 if ($massactionbutton || $massaction) {
1659 if (in_array($obj->mid, $arrayofselected)) {
1662 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1679 foreach ($arrayfields as $key => $val) {
1680 if (!empty($val[
'checked'])) {
1684 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1689$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1690$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1691print $hookmanager->resPrint;
1693print
'</table>'.
"\n";
1696print
'</form>'.
"\n";
1699if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) {
1702 $productidselected = 0;
1703 foreach ($arrayofuniqueproduct as $key => $val) {
1704 $productidselected = $key;
1705 $productlabelselected = $val;
1709 $balancebefore =
$object->calculateBalanceForProductBefore($productidselected, $datebefore);
1710 $balanceafter =
$object->calculateBalanceForProductBefore($productidselected, $dateafter);
1713 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1716 print
': '.$balancebefore;
1720 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1723 print
': '.$balanceafter;
1728if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1729 $hidegeneratedfilelistifempty = 1;
1730 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1731 $hidegeneratedfilelistifempty = 0;
1734 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1738 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1739 $urlsource .= str_replace(
'&',
'&', $param);
1741 $filedir = $diroutputmassaction;
1742 $genallowed = $permissiontoread;
1743 $delallowed = $permissiontoadd;
1745 print $formfile->showdocuments(
'massfilesarea_stock',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage warehouses.
Class to manage stock movements.
Class to manage products or services.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage translations.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.