32require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
50require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
57$langs->loadLangs(array(
'products',
'stocks',
'orders',
'bills',
'sendings',
'receptions',
'mrp'));
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:int');
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_origintype =
GETPOST(
'search_origintype',
'aZ09');
100$search_fk_project =
GETPOST(
"search_fk_project");
106$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
107$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
109if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
113$offset = $limit * $page;
114$pageprev = $page - 1;
115$pagenext = $page + 1;
118 $sortfield =
"m.datem";
129$diroutputmassaction =
$conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
130$hookmanager->initHooks(array($contextpage));
135$extrafields->fetch_name_optionals_label(
$object->table_element);
137$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
140 'm.rowid' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 1),
141 'm.datem' => array(
'label' =>
"Date",
'checked' =>
'1',
'position' => 2),
142 'p.ref' => array(
'label' =>
"ProductRef",
'checked' =>
'1',
'css' =>
'maxwidth100',
'position' => 3),
143 'p.label' => array(
'label' =>
"ProductLabel",
'checked' =>
'0',
'position' => 5),
144 'm.batch' => array(
'label' =>
"BatchNumberShort",
'checked' =>
'1',
'position' => 8,
'enabled' => (
string) (
int) (
isModEnabled(
'productbatch'))),
145 'pl.eatby' => array(
'label' =>
"EatByDate",
'checked' =>
'0',
'position' => 9,
'enabled' => (
string) (
int) (
isModEnabled(
'productbatch'))),
146 'pl.sellby' => array(
'label' =>
"SellByDate",
'checked' =>
'0',
'position' => 10,
'enabled' => (
string) (
int) (
isModEnabled(
'productbatch'))),
147 'e.ref' => array(
'label' =>
"Warehouse",
'checked' =>
'1',
'position' => 100,
'enabled' => (
string) (
int) (!($id > 0))),
148 'm.fk_user_author' => array(
'label' =>
"Author",
'checked' =>
'0',
'position' => 120),
149 'm.inventorycode' => array(
'label' =>
"InventoryCodeShort",
'checked' =>
'1',
'position' => 130),
150 'm.label' => array(
'label' =>
"MovementLabel",
'checked' =>
'1',
'position' => 140),
151 'm.type_mouvement' => array(
'label' =>
"TypeMovement",
'checked' =>
'0',
'position' => 150),
152 'origin' => array(
'label' =>
"Origin",
'checked' =>
'1',
'position' => 155),
153 'm.fk_projet' => array(
'label' =>
'Project',
'checked' =>
'0',
'position' => 180),
154 'm.value' => array(
'label' =>
"Qty",
'checked' =>
'1',
'position' => 200),
155 'm.price' => array(
'label' =>
"UnitPurchaseValue",
'checked' =>
'0',
'position' => 210,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
160include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
162$parameters = array(
'arrayfields' => &$arrayfields);
163$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
166 unset($arrayfields[
'pl.sellby']);
169 unset($arrayfields[
'pl.eatby']);
173 $usercanreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'lire');
175 $usercanreadsupplierprice = $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') || $user->hasRight(
'product',
'service_advance',
'read_supplier_prices');
177 $usercanreadsupplierprice = $user->hasRight(
'product',
'lire') || $user->hasRight(
'service',
'lire');
180if (!$usercanreadsupplierprice) {
181 unset($arrayfields[
'm.price']);
185if ($id > 0 || !empty($ref)) {
186 $tmpwarehouse->fetch($id, $ref);
187 $id = $tmpwarehouse->id;
191if ($user->socid > 0) {
192 $socid = $user->socid;
200if (!$user->hasRight(
'stock',
'mouvement',
'lire')) {
204$uploaddir =
$conf->stock->dir_output.
'/movements';
206$permissiontoread = $user->hasRight(
'stock',
'mouvement',
'lire');
207$permissiontoadd = $user->hasRight(
'stock',
'mouvement',
'creer');
208$permissiontodelete = $user->hasRight(
'stock',
'mouvement',
'creer');
209$permissiontoeditextra = $permissiontoadd;
210if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
212 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
215$usercanread = $user->hasRight(
'stock',
'mouvement',
'lire');
216$usercancreate = $user->hasRight(
'stock',
'mouvement',
'creer');
217$usercandelete = $user->hasRight(
'stock',
'mouvement',
'creer');
226if (
GETPOST(
'cancel',
'alpha')) {
230if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
234$parameters = array();
235$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
240if (empty($reshook)) {
242 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
245 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
246 $search_date_startday =
'';
247 $search_date_startmonth =
'';
248 $search_date_startyear =
'';
249 $search_date_endday =
'';
250 $search_date_endmonth =
'';
251 $search_date_endyear =
'';
252 $search_date_start =
'';
253 $search_date_end =
'';
255 $search_movement =
"";
256 $search_type_mouvement =
"";
257 $search_origintype =
"";
258 $search_inventorycode =
"";
259 $search_product_ref =
"";
260 $search_product =
"";
261 $search_warehouse =
"";
265 $search_fk_project =
"";
268 $search_array_options = array();
270 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
271 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
273 if ($action ==
'confirm_reverse') {
279 $objectclass =
'MouvementStock';
280 $objectlabel =
'MouvementStock';
282 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
283 if (empty($diroutputmassaction)) {
284 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
288 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
289 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
290 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
293 $listofobjectids = array();
294 foreach ($toselect as $toselectid) {
296 $result = $objecttmp->fetch($toselectid);
298 $listofobjectids[$toselectid] = $toselectid;
302 $arrayofinclusion = array();
303 foreach ($listofobjectids as $tmppdf) {
306 foreach ($listofobjectids as $tmppdf) {
307 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
309 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0, 1);
312 $outputlangs = $langs;
315 $newlang =
GETPOST(
'lang_id',
'aZ09');
320 if (!empty($newlang)) {
322 $outputlangs->setDefaultLang($newlang);
330 $filename = preg_replace(
'/\s/',
'_', $filename);
342 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
351 $langs->load(
"exports");
360 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
363if ($action ==
'update_extras' && $permissiontoeditextra) {
364 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse, 2);
366 $attribute_name =
GETPOST(
'attribute',
'aZ09');
369 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse, $attribute_name);
375 $result = $tmpwarehouse->updateExtraField($attribute_name,
'CONTRACT_MODIFY');
383 $action =
'edit_extras';
395if ($action ==
"correct_stock" && $permissiontoadd) {
397 if (!empty($product_id)) {
398 $result = $product->fetch($product_id);
403 if (empty($product_id)) {
405 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
406 $action =
'correction';
410 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
411 $action =
'correction';
415 $origin_element =
'';
419 $origin_element =
'project';
423 if ($product->hasbatch()) {
424 $batch =
GETPOST(
'batch_number',
'alphanohtml');
429 $result = $product->correct_stock_batch(
434 GETPOST(
"label",
'alphanohtml'),
439 GETPOST(
'inventorycode',
'alphanohtml'),
446 $result = $product->correct_stock(
451 GETPOST(
"label",
'alphanohtml'),
453 GETPOST(
'inventorycode',
'alphanohtml'),
462 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
467 $action =
'correction';
477if ($action ==
"transfert_stock" && $permissiontoadd && !$cancel) {
480 if (!empty($product_id)) {
481 $result = $product->fetch($product_id);
484 if (!(
GETPOSTINT(
"id_entrepot_destination") > 0)) {
485 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
487 $action =
'transfer';
489 if (empty($product_id)) {
491 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
492 $action =
'transfer';
495 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
497 $action =
'transfer';
499 if ($id ==
GETPOSTINT(
"id_entrepot_destination")) {
500 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
502 $action =
'transfer';
507 $result = $product->fetch($product_id);
509 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
510 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
512 $action =
'transfer';
519 $result = $warehouse->fetch($id);
523 $product->load_stock(
'novirtual');
527 if (isset($product->pmp)) {
528 $pricesrc = $product->pmp;
530 $pricedest = $pricesrc;
532 if ($product->hasbatch()) {
540 $result = $pdluo->fetch($pdluoid);
542 $srcwarehouseid = $pdluo->warehouseid;
543 $batch = $pdluo->batch;
549 $srcwarehouseid =
$id;
550 $batch =
GETPOST(
'batch_number',
'alphanohtml');
557 $result1 = $product->correct_stock_batch(
574 $result2 = $product->correct_stock_batch(
584 GETPOST(
'inventorycode',
'alphanohtml'),
593 $result1 = $product->correct_stock(
598 GETPOST(
"label",
'alphanohtml'),
600 GETPOST(
'inventorycode',
'alphanohtml'),
608 $result2 = $product->correct_stock(
613 GETPOST(
"label",
'alphanohtml'),
615 GETPOST(
'inventorycode',
'alphanohtml'),
622 if (!$error && $result1 >= 0 && $result2 >= 0) {
626 header(
"Location: ".$backtopage);
629 header(
"Location: movement_list.php?id=".$warehouse->id);
635 $action =
'transfer';
642if (!$error && $action ==
'confirm_reverse' && $confirm ==
"yes" && $permissiontoadd) {
643 $toselect = array_map(
'intval', $toselect);
648 $sql =
"SELECT rowid, label, inventorycode, datem";
649 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement";
650 $sql .=
" WHERE rowid IN (".$db->sanitize(implode(
',', $toselect)).
")";
652 $resql =
$db->query($sql);
654 $num =
$db->num_rows($resql);
657 $obj =
$db->fetch_object($resql);
665 $reverse =
$object->reverseMovement();
685 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
710$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,";
711$sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
712$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
713$sql .=
" m.batch, m.price,";
714$sql .=
" m.type_mouvement,";
715$sql .=
" m.fk_projet as fk_project,";
716$sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
717$sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
719if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
720 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
721 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
725$parameters = array();
726$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
727$sql .= $hookmanager->resPrint;
728$sql = preg_replace(
'/,\s*$/',
'', $sql);
732$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
733$sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
734$sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
735if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
736 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
738$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
739$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
742$parameters = array();
743$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
744$sql .= $hookmanager->resPrint;
746$sql .=
" WHERE m.fk_product = p.rowid";
748 $sql .=
" AND m.rowid = ".((int) $msid);
750$sql .=
" AND m.fk_entrepot = e.rowid";
751$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
753 $sql .=
" AND p.fk_product_type = 0";
756 $sql .=
" AND e.rowid = ".((int) $id);
758if (!empty($search_date_start)) {
759 $sql .=
" AND m.datem >= '" .
$db->idate($search_date_start) .
"'";
761if (!empty($search_date_end)) {
762 $sql .=
" AND m.datem <= '" .
$db->idate($search_date_end) .
"'";
765 $sql .=
" AND p.rowid = ".((int) $idproduct);
767if (!empty($search_ref)) {
770if (!empty($search_movement)) {
773if (!empty($search_inventorycode)) {
776if (!empty($search_product_ref)) {
779if (!empty($search_product)) {
782if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
785if (!empty($search_user)) {
786 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
788if (!empty($search_batch)) {
791if (!empty($product_id) && $product_id !=
'-1') {
794if (!empty($search_fk_project) && $search_fk_project !=
'-1') {
797if ($search_qty !=
'') {
800if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
801 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
803if ($search_origintype !=
'' && $search_origintype !=
'-1') {
804 if ($search_origintype ==
'none') {
805 $sql .=
" AND (m.origintype IS NULL OR m.origintype = '')";
807 $sql .=
" AND m.origintype = '".$db->escape($search_origintype).
"'";
811include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
813$parameters = array();
814$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
815$sql .= $hookmanager->resPrint;
818$nbtotalofrecords =
'';
821 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
822 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
823 $resql =
$db->query($sqlforcount);
825 $objforcount =
$db->fetch_object($resql);
826 $nbtotalofrecords = $objforcount->nbtotalofrecords;
831 if (($page * $limit) > (
int) $nbtotalofrecords) {
839$sql .=
$db->order($sortfield, $sortorder);
841 $sql .=
$db->plimit($limit + 1, $offset);
844$resql =
$db->query($sql);
850$num =
$db->num_rows($resql);
857 $product->fetch($idproduct);
859if ($id > 0 || $ref) {
860 $result = $warehouse->fetch($id, $ref);
867$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
869 $title = $langs->trans(
'StockMovementForId', $msid);
871 $title = $langs->trans(
"StockMovements");
873 if (!empty($warehouse->ref)) {
874 $title .=
' ('.$warehouse->ref.
')';
876 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
885llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-product page-stock_movement_list');
890if ($warehouse->id > 0) {
893 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
896 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
898 $morehtmlref =
'<div class="refidno">';
899 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$warehouse->lieu;
903 $langs->load(
"projects");
904 $morehtmlref .=
'<br>'.img_picto(
'',
'project',
'class="pictofixedwidth"').$langs->trans(
'Project').
' ';
905 if ($usercancreate && 1 == 2) {
906 if ($action !=
'classify') {
907 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$warehouse->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
909 if ($action ==
'classify') {
910 $projectid = $warehouse->fk_project;
911 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id.
'">';
912 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
913 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
914 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), (
string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
915 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
916 $morehtmlref .=
'</form>';
918 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id, $warehouse->socid, (
string) $warehouse->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
921 if (!empty($warehouse->fk_project)) {
923 $proj->fetch($warehouse->fk_project);
924 $morehtmlref .=
' : '.$proj->getNomUrl(1);
926 $morehtmlref .=
' - '.$proj->title;
933 $morehtmlref .=
'</div>';
936 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
940 dol_banner_tab($warehouse,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
943 print
'<div class="fichecenter">';
944 print
'<div class="fichehalfleft">';
945 print
'<div class="underbanner clearboth"></div>';
947 print
'<table class="border centpercent tableforfield">';
952 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($warehouse->description).
'</td></tr>';
954 $calcproductsunique = $warehouse->nb_different_products();
955 $calcproducts = $warehouse->nb_products();
958 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
959 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
963 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
964 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
965 print empty($valtoshow) ?
'0' : $valtoshow;
971 print
'<div class="fichehalfright">';
972 print
'<div class="underbanner clearboth"></div>';
974 print
'<table class="border centpercent tableforfield">';
977 if ($usercanreadsupplierprice) {
978 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
979 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1,
$conf->currency);
984 $sql =
"SELECT MAX(m.datem) as datem";
985 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
986 $sql .=
" WHERE m.fk_entrepot = ".((int) $warehouse->id);
987 $resqlbis =
$db->query($sql);
989 $lastmovementdate = 0;
991 $objbis =
$db->fetch_object($resqlbis);
992 $lastmovementdate =
$db->jdate($objbis->datem);
997 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
998 if ($lastmovementdate) {
1001 print $langs->trans(
"None");
1006 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1010 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1011 print $form->showCategories($warehouse->id, Categorie::TYPE_WAREHOUSE, 1);
1020 print
'<div class="clearboth"></div>';
1027if ($action ==
"correction") {
1028 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
1033if ($action ==
"transfer") {
1036 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
1042if ((empty($action) || $action ==
'list') && $id > 0) {
1043 print
"<div class=\"tabsAction\">\n";
1045 $parameters = array();
1046 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $warehouse, $action);
1048 if (empty($reshook)) {
1049 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
1050 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=transfer&token='.
newToken().
'">'.$langs->trans(
"TransferStock").
'</a>';
1053 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
1054 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=correction&token='.
newToken().
'">'.$langs->trans(
"CorrectStock").
'</a>';
1061$arrayofselected = is_array($toselect) ? $toselect : array();
1065 $param .=
'&mode='.urlencode($mode);
1067if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1068 $param .=
'&contextpage='.urlencode($contextpage);
1070if ($limit > 0 && $limit !=
$conf->liste_limit) {
1071 $param .=
'&limit='.((int) $limit);
1074 $param .=
'&id='.urlencode((
string) (
$id));
1077 $param .=
'&show_files='.urlencode((
string) ($show_files));
1079if ($search_date_startday) {
1080 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1082if ($search_date_startmonth) {
1083 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1085if ($search_date_startyear) {
1086 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1088if ($search_date_endday) {
1089 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1091if ($search_date_endmonth) {
1092 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1094if ($search_date_endyear) {
1095 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1097if ($search_movement) {
1098 $param .=
'&search_movement='.urlencode($search_movement);
1100if ($search_inventorycode) {
1101 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
1103if ($search_type_mouvement) {
1104 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
1106if ($search_origintype) {
1107 $param .=
'&search_origintype='.urlencode($search_origintype);
1109if ($search_product_ref) {
1110 $param .=
'&search_product_ref='.urlencode($search_product_ref);
1112if ($search_product) {
1113 $param .=
'&search_product='.urlencode($search_product);
1116 $param .=
'&search_batch='.urlencode($search_batch);
1118if ($search_warehouse > 0) {
1119 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1122 $param .=
'&search_user='.urlencode($search_user);
1124if ($idproduct > 0) {
1125 $param .=
'&idproduct='.urlencode((
string) ($idproduct));
1127if ($search_fk_project !=
'' && $search_fk_project !=
'-1') {
1128 $param .=
'&search_fk_project='.urlencode((
string) ($search_fk_project));
1131include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1133$parameters = array(
'param' => &$param);
1134$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $warehouse, $action);
1135$param .= $hookmanager->resPrint;
1138$arrayofmassactions = array();
1140 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1144 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1146if (!empty($permissiontoadd)) {
1147 $arrayofmassactions[
'prereverse'] =
img_picto(
'',
'add',
'class="pictofixedwidth"').$langs->trans(
"Reverse");
1149if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'prereverse'))) {
1150 $arrayofmassactions = array();
1153$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1155print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1156if ($optioncss !=
'') {
1157 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1159print
'<input type="hidden" name="token" value="'.newToken().
'">';
1160print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1161print
'<input type="hidden" name="action" value="list">';
1162print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1163print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1164print
'<input type="hidden" name="type" value="'.$type.
'">';
1165print
'<input type="hidden" name="page" value="'.$page.
'">';
1166print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1167print
'<input type="hidden" name="page_y" value="">';
1168print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1170 print
'<input type="hidden" name="id" value="'.$id.
'">';
1176print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1179$topicmail =
"SendStockMovement";
1180$modelmail =
"movementstock";
1182$trackid =
'mov'.$warehouse->id;
1183include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1184if ($massaction ==
'prereverse' && count($toselect) <=
getDolGlobalInt(
'MAIN_LIMIT_FOR_MASS_ACTIONS', 1000)) {
1185 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassReverse"), $langs->trans(
"ConfirmMassReverseQuestion", count($toselect)),
"confirm_reverse",
null,
'', 0, 200, 500, 1,
'Yes');
1191 if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
1193 $fieldstosearchall = array();
1195 foreach ($fieldstosearchall as $key => $val) {
1196 $fieldstosearchall[$key] = $langs->trans($val);
1197 $setupstring .= $key.
"=".$val.
";";
1199 print
'<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1200 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1205$parameters = array(
'arrayfields' => &$arrayfields);
1206$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $warehouse, $action);
1207if (empty($reshook)) {
1208 $moreforfilter .= $hookmanager->resPrint;
1210 $moreforfilter = $hookmanager->resPrint;
1213if (!empty($moreforfilter)) {
1214 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1215 print $moreforfilter;
1219$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1220$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1221$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1222$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1224print
'<div class="div-table-responsive">';
1225print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1229print
'<tr class="liste_titre_filter">';
1231if (
$conf->main_checkbox_left_column) {
1232 print
'<td class="liste_titre center maxwidthsearch">';
1233 $searchpicto = $form->showFilterButtons(
'left');
1237if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1239 print
'<td class="liste_titre left">';
1240 print
'<input class="flat maxwidth40" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1243if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1245 print
'<td class="liste_titre center">';
1246 print
'<div class="nowrapfordate">';
1247 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1249 print
'<div class="nowrapfordate">';
1250 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1254if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1256 print
'<td class="liste_titre left">';
1257 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1260if (!empty($arrayfields[
'p.label'][
'checked'])) {
1262 print
'<td class="liste_titre left">';
1263 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1267if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1268 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1270if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1271 print
'<td class="liste_titre left">';
1274if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1275 print
'<td class="liste_titre left">';
1279if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1280 print
'<td class="liste_titre maxwidthonsmartphone left">';
1282 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'maxwidth150');
1285if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1287 print
'<td class="liste_titre left">';
1288 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1291if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1293 print
'<td class="liste_titre left">';
1294 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1297if (!empty($arrayfields[
'm.label'][
'checked'])) {
1299 print
'<td class="liste_titre left">';
1300 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1303if (!empty($arrayfields[
'origin'][
'checked'])) {
1308 print
'<td class="liste_titre left">';
1309 $arrayoforigintypes = array(
1310 'commande' => $langs->trans(
'Order'),
1311 'shipping' => $langs->trans(
'Shipment'),
1312 'facture' => $langs->trans(
'Invoice'),
1313 'order_supplier' => $langs->trans(
'SupplierOrder'),
1314 'invoice_supplier' => $langs->trans(
'SupplierInvoice'),
1315 'reception' => $langs->trans(
'Reception'),
1316 'inventory' => $langs->trans(
'Inventory'),
1317 'mo' => $langs->trans(
'ManufacturingOrder'),
1318 'user' => $langs->trans(
'User'),
1319 'none' => $langs->trans(
'None'),
1321 print
'<select id="search_origintype" name="search_origintype" class="maxwidth150">';
1322 print
'<option value=""'.(($search_origintype ==
'') ?
' selected="selected"' :
'').
'> </option>';
1323 foreach ($arrayoforigintypes as $keyorigintype => $valorigintype) {
1324 print
'<option value="'.$keyorigintype.
'"'.(($search_origintype == $keyorigintype) ?
' selected="selected"' :
'').
'>'.
dol_escape_htmltag($valorigintype).
'</option>';
1330if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1332 print
'<td class="liste_titre" align="left">';
1333 print $warehouse->showInputField($warehouse->fields[
'fk_project'],
'fk_project', $search_fk_project,
'',
'',
'search_',
'maxwidth125', 1);
1336if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1338 print
'<td class="liste_titre center">';
1340 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1341 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1342 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1343 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1344 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1345 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1352if (!empty($arrayfields[
'm.value'][
'checked'])) {
1354 print
'<td class="liste_titre right">';
1355 print
'<input class="flat width50 right" type="text" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1358if (!empty($arrayfields[
'm.price'][
'checked'])) {
1360 print
'<td class="liste_titre" align="left">';
1366include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1369$parameters = array(
'arrayfields' => $arrayfields);
1370$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $warehouse, $action);
1371print $hookmanager->resPrint;
1373if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1374 print
'<td class="liste_titre">';
1378if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1379 print
'<td class="liste_titre">';
1383if (!
$conf->main_checkbox_left_column) {
1384 print
'<td class="liste_titre center maxwidthsearch">';
1385 $searchpicto = $form->showFilterButtons();
1396print
'<tr class="liste_titre">';
1398if (
$conf->main_checkbox_left_column) {
1399 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1402if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1403 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1405if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1406 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1408if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1409 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1411if (!empty($arrayfields[
'p.label'][
'checked'])) {
1412 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1414if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1415 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1417if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1418 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1420if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1421 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1423if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1425 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1427if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1428 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1430if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1431 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1433if (!empty($arrayfields[
'm.label'][
'checked'])) {
1434 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1436if (!empty($arrayfields[
'origin'][
'checked'])) {
1437 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1439if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1440 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1442if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1443 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1445if (!empty($arrayfields[
'm.value'][
'checked'])) {
1446 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1448if (!empty($arrayfields[
'm.price'][
'checked'])) {
1449 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1453include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1456$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1457$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $warehouse, $action);
1458print $hookmanager->resPrint;
1459if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1460 print_liste_field_titre($arrayfields[
'm.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"m.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1462if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1463 print_liste_field_titre($arrayfields[
'm.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"m.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1466if (!
$conf->main_checkbox_left_column) {
1467 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1473$arrayofuniqueproduct = array();
1482$imaxinloop = ($limit ? min($num, $limit) : $num);
1483while ($i < $imaxinloop) {
1484 $obj =
$db->fetch_object($resql);
1489 $userstatic->id = $obj->fk_user_author;
1490 $userstatic->login = $obj->login;
1491 $userstatic->lastname = $obj->lastname;
1492 $userstatic->firstname = $obj->firstname;
1493 $userstatic->photo = $obj->photo;
1494 $userstatic->email = $obj->user_email;
1495 $userstatic->status = $obj->user_status;
1500 $sql =
"SELECT label";
1501 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1502 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1503 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1506 $result =
$db->query($sql);
1508 $objtp =
$db->fetch_object($result);
1509 if (!empty($objtp->label)) {
1510 $obj->produit = $objtp->label;
1515 $productstatic->id = $obj->rowid;
1516 $productstatic->ref = $obj->product_ref;
1517 $productstatic->label = $obj->produit;
1518 $productstatic->type = $obj->type;
1519 $productstatic->entity = $obj->entity;
1520 $productstatic->status = $obj->tosell;
1521 $productstatic->status_buy = $obj->tobuy;
1522 $productstatic->status_batch = $obj->tobatch;
1524 $productlot->id = $obj->lotid;
1525 $productlot->batch = $obj->batch;
1526 $productlot->eatby = $obj->eatby;
1527 $productlot->sellby = $obj->sellby;
1529 $warehousestatic->id = $obj->entrepot_id;
1530 $warehousestatic->ref = $obj->warehouse_ref;
1531 $warehousestatic->label = $obj->warehouse_ref;
1532 $warehousestatic->lieu = $obj->lieu;
1533 $warehousestatic->fk_parent = $obj->fk_parent;
1534 $warehousestatic->statut = $obj->statut;
1540 $object->warehouse_id = $obj->entrepot_id;
1541 $object->type = $obj->type_mouvement;
1543 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1544 if (!empty($obj->fk_origin)) {
1545 $origin =
$object->get_origin($obj->fk_origin, $obj->origintype);
1550 if ($mode ==
'kanban') {
1552 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1553 print
'<div class="box-flex-container kanban">';
1557 if ($massactionbutton || $massaction) {
1559 if (in_array($warehouse->id, $arrayofselected)) {
1563 print $warehouse->getKanbanView(
'', array(
'selected' => $selected));
1564 if ($i == ($imaxinloop - 1)) {
1571 print
'<tr data-rowid="'.$warehouse->id.
'" class="oddeven">';
1573 if (
$conf->main_checkbox_left_column) {
1574 print
'<td class="nowrap center">';
1575 if ($massactionbutton || $massaction) {
1577 if (in_array($obj->mid, $arrayofselected)) {
1580 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1588 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1589 print
'<td class="nowraponall">';
1594 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1595 print
'<td class="nowraponall center">'.dol_print_date(
$db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1598 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1599 print
'<td class="nowraponall tdoverflowmax150 cell2linesheight">';
1600 print $productstatic->getNomUrl(1,
'stock', 16);
1601 print
'<br><span class="opacitymedium">'.$productstatic->label.
'</span>';
1605 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1606 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1607 print $productstatic->label;
1611 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1612 print
'<td class="center nowraponall">';
1613 if ($productlot->id > 0) {
1614 print $productlot->getNomUrl(1);
1616 print $productlot->batch;
1621 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1622 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1625 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1626 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1629 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1630 print
'<td class="tdoverflowmax150">';
1631 print $warehousestatic->getNomUrl(1);
1635 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1636 print
'<td class="tdoverflowmax100">';
1637 print $userstatic->getNomUrl(-1);
1641 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1642 print
'<td class="tdoverflowmax150" title="'.dolPrintHTMLForAttribute($obj->inventorycode).
'">';
1643 if ($obj->inventorycode) {
1644 print
img_picto(
'',
'movement',
'class="pictofixedwidth"');
1645 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'">'.
dolPrintHTML($obj->inventorycode).
'</a>';
1650 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1651 print
'<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttributeUrl($obj->label).
'">'.
dolPrintHTML($obj->label).
'</td>';
1654 if (!empty($arrayfields[
'origin'][
'checked'])) {
1655 print
'<td class="nowraponall">'.dolPrintHTML($origin).
'</td>';
1658 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1660 if ($obj->fk_project != 0) {
1661 print
$object->get_origin($obj->fk_project,
'project');
1666 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1667 print
'<td class="center">';
1668 print
$object->getTypeMovement();
1672 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1673 print
'<td class="right">';
1674 if ($obj->qty > 0) {
1675 print
'<span class="stockmovemententry">';
1680 print
'<span class="stockmovementexit">';
1687 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1689 $displayprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'lire');
1690 if ($productstatic->isService()) {
1691 $displayprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_supplier_prices') : $user->hasRight(
'service',
'lire');
1693 print
'<td class="right">';
1694 if ($obj->price != 0 && $displayprice) {
1695 print
price($obj->price);
1701 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1703 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1704 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1705 print $hookmanager->resPrint;
1708 if (!
$conf->main_checkbox_left_column) {
1709 print
'<td class="nowrap center">';
1710 if ($massactionbutton || $massaction) {
1712 if (in_array($obj->mid, $arrayofselected)) {
1715 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1732 foreach ($arrayfields as $key => $val) {
1733 if (!empty($val[
'checked'])) {
1737 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1742$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1743$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1744print $hookmanager->resPrint;
1746print
'</table>'.
"\n";
1749print
'</form>'.
"\n";
1752if (count($arrayofuniqueproduct) == 1 && !empty($search_date_startyear) && is_numeric($search_date_startyear)) {
1755 $productidselected = 0;
1756 $productlabelselected =
'';
1757 foreach ($arrayofuniqueproduct as $key => $val) {
1758 $productidselected = $key;
1759 $productlabelselected = $val;
1761 $datebefore =
dol_get_first_day($search_date_startyear ? $search_date_startyear :
dol_print_date(time(),
"%Y"), $search_date_startmonth ? $search_date_startmonth : 1, true);
1762 $dateafter =
dol_get_last_day($search_date_endyear ? $search_date_endyear :
dol_print_date(time(),
"%Y"), $search_date_endmonth ? $search_date_endmonth : 12, true);
1763 $balancebefore =
$object->calculateBalanceForProductBefore($productidselected, $datebefore);
1764 $balanceafter =
$object->calculateBalanceForProductBefore($productidselected, $dateafter);
1767 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1770 print
': '.$balancebefore;
1774 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1777 print
': '.$balanceafter;
1782if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1783 $hidegeneratedfilelistifempty = 1;
1784 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1785 $hidegeneratedfilelistifempty = 0;
1788 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1792 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1793 $urlsource .= str_replace(
'&',
'&', $param);
1795 $filedir = $diroutputmassaction;
1796 $genallowed = $permissiontoread;
1797 $delallowed = $permissiontoadd;
1799 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(! $sortfield) if(! $sortorder) $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_now($mode='gmt')
Return date for now.
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...
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.