dolibarr 20.0.5
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
32if (isModEnabled('category')) {
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
35}
36
37// Load translation files required by the page
38$langs->loadLangs(array("stocks", "other"));
39
40$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
41$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
42$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
43$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
44$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
45$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
46$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'stocklist'; // To manage different context of search
47$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
48$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
49$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
50
51$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
52$search_ref = GETPOST("sref", "alpha") ? GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha");
53$search_label = GETPOST("snom", "alpha") ? GETPOST("snom", "alpha") : GETPOST("search_label", "alpha");
54$search_status = GETPOST("search_status", "intcomma");
55
56$search_category_list = array();
57if (isModEnabled('category')) {
58 $search_category_list = GETPOST("search_category_".Categorie::TYPE_WAREHOUSE."_list", "array");
59}
60
61// Load variable for pagination
62$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
63$sortfield = GETPOST('sortfield', 'aZ09comma');
64$sortorder = GETPOST('sortorder', 'aZ09comma');
65$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
66if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
67 // If $page is not defined, or '' or -1 or if we click on clear filters
68 $page = 0;
69}
70// Initialize technical objects
71$offset = $limit * $page;
72$pageprev = $page - 1;
73$pagenext = $page + 1;
74if (!$sortfield) {
75 $sortfield = "t.ref";
76}
77if (!$sortorder) {
78 $sortorder = "ASC";
79}
80
81// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
82$object = new Entrepot($db);
83$extrafields = new ExtraFields($db);
84$diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id;
85$hookmanager->initHooks(array($contextpage));
86
87// Fetch optionals attributes and labels
88$extrafields->fetch_name_optionals_label($object->table_element);
89
90$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
91
92// Initialize array of search criteria
93$search_all = GETPOST("search_all", 'alphanohtml');
94$search = array();
95foreach ($object->fields as $key => $val) {
96 $search_key = $key;
97 if ($search_key == 'statut') {
98 $search_key = 'status'; // remove this after refactor entrepot.class property statut to status
99 }
100 if (GETPOST('search_'.$search_key, 'alpha') !== '') {
101 $search[$search_key] = GETPOST('search_'.$search_key, 'alpha');
102 }
103}
104
105// List of fields to search into when doing a "search in all"
106$fieldstosearchall = array();
107foreach ($object->fields as $key => $val) {
108 if (!empty($val['searchall'])) {
109 $fieldstosearchall['t.'.$key] = $val['label'];
110 }
111}
112
113// Definition of array of fields for columns
114$arrayfields = array(
115 'stockqty' => array('type' => 'float', 'label' => 'PhysicalStock', 'enabled' => 1, 'visible' => -2, 'checked' => 0, 'position' => 170),
116 'estimatedvalue' => array('type' => 'float', 'label' => 'EstimatedStockValue', 'enabled' => 1, 'visible' => 1, 'checked' => 1, 'position' => 171),
117 'estimatedstockvaluesell' => array('type' => 'float', 'label' => 'EstimatedStockValueSell', 'enabled' => 1, 'checked' => 1, 'visible' => 2, 'position' => 172),
118);
119foreach ($object->fields as $key => $val) {
120 // If $val['visible']==0, then we never show the field
121 if (!empty($val['visible'])) {
122 $visible = (int) dol_eval($val['visible'], 1);
123 $arrayfields['t.'.$key] = array(
124 'label' => $val['label'],
125 'checked' => (($visible < 0) ? 0 : 1),
126 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
127 'position' => $val['position'],
128 'help' => isset($val['help']) ? $val['help'] : ''
129 );
130 }
131}
132// Extra fields
133include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
134
135$object->fields = dol_sort_array($object->fields, 'position');
136$arrayfields = dol_sort_array($arrayfields, 'position');
137
138$permissiontoread = $user->hasRight('stock', 'lire');
139$permissiontodelete = $user->hasRight('stock', 'supprimer');
140$permissiontoadd = $user->hasRight('stock', 'creer');
141
142// Security check
143$result = restrictedArea($user, 'stock');
144
145
146/*
147 * Actions
148 */
149
150if (GETPOST('cancel', 'alpha')) {
151 $action = 'list';
152 $massaction = '';
153}
154if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
155 $massaction = '';
156}
157
158$parameters = array();
159$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
160if ($reshook < 0) {
161 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
162}
163
164if (empty($reshook)) {
165 // Selection of new fields
166 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
167
168 // Purge search criteria
169 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
170 foreach ($object->fields as $key => $val) {
171 $search[$key] = '';
172 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
173 $search[$key.'_dtstart'] = '';
174 $search[$key.'_dtend'] = '';
175 }
176 }
177 $toselect = array();
178 $search_array_options = array();
179 $search_category_list = array();
180 }
181 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
182 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
183 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
184 }
185
186 // Mass actions
187 $objectclass = 'Entrepot';
188 $objectlabel = 'Warehouse';
189 $uploaddir = $conf->stock->dir_output;
190 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
191}
192
193
194/*
195 * View
196 */
197
198$form = new Form($db);
199$warehouse = new Entrepot($db);
200
201$now = dol_now();
202$totalarray = array();
203
204$title = $langs->trans("Warehouses");
205$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
206
207
208// Build and execute select
209// --------------------------------------------------------------------
210$sql = 'SELECT ';
211$sql .= $object->getFieldList('t');
212// Add fields from extrafields
213if (!empty($extrafields->attributes[$object->table_element]['label'])) {
214 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
215 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
216 }
217}
218
219//For Multicompany PMP per entity
220$separatedPMP = false;
221if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED') && getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
222 $separatedPMP = true;
223 $sql .= ", SUM(pa.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
224} else {
225 $sql .= ", SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
226}
227
228
229// Add fields from hooks
230$parameters = array();
231$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
232$sql .= $hookmanager->resPrint;
233$sql = preg_replace('/,\s*$/', '', $sql);
234
235$sqlfields = $sql; // $sql fields to remove for count total
236
237$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
238if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
239 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
240}
241$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON t.rowid = ps.fk_entrepot";
242$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
243$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c_dep ON c_dep.rowid = t.fk_departement";
244$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk_pays";
245if ($separatedPMP) {
246 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as pa ON pa.fk_product = p.rowid AND pa.fk_product = ps.fk_product AND pa.entity = ". (int) $conf->entity;
247}
248$sql .= " WHERE t.entity IN (".getEntity('stock').")";
249foreach ($search as $key => $val) {
250 if (array_key_exists($key, $object->fields)) {
251 $class_key = $key;
252 if ($class_key == 'status') {
253 $class_key = 'statut'; // remove this after refactoring entrepot.class property statut to status
254 }
255 if (($key == 'status' && $search[$key] == -1) || $key == 'entity') {
256 continue;
257 }
258 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
259 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
260 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
261 $search[$key] = '';
262 }
263 $mode_search = 2;
264 }
265 if ($search[$key] != '') {
266 $sql .= natural_search((($key == "ref") ? "t.ref" : "t.".$class_key), $search[$key], (($key == 'status') ? 2 : $mode_search));
267 }
268 } else {
269 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
270 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
271 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
272 if (preg_match('/_dtstart$/', $key)) {
273 $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
274 }
275 if (preg_match('/_dtend$/', $key)) {
276 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
277 }
278 }
279 }
280 }
281}
282if ($search_all) {
283 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
284}
285// Search for tag/category ($searchCategoryWarehouseList is an array of ID)
286$searchCategoryWarehouseList = $search_category_list;
287$searchCategoryWarehouseOperator = 0;
288if (!empty($searchCategoryWarehouseList)) {
289 $searchCategoryWarehouseSqlList = array();
290 $listofcategoryid = '';
291 foreach ($searchCategoryWarehouseList as $searchCategoryWarehouse) {
292 if (intval($searchCategoryWarehouse) == -2) {
293 $searchCategoryWarehouseSqlList[] = " NOT EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse)";
294 } elseif (intval($searchCategoryWarehouse) > 0) {
295 if ($searchCategoryWarehouseOperator == 0) {
296 $searchCategoryWarehouseSqlList[] = " EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse AND ck.fk_categorie = ".((int) $searchCategoryWarehouse).")";
297 } else {
298 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryWarehouse);
299 }
300 }
301 }
302 if ($listofcategoryid) {
303 $searchCategoryWarehouseSqlList[] = " EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
304 }
305 if ($searchCategoryWarehouseOperator == 1) {
306 if (!empty($searchCategoryWarehouseSqlList)) {
307 $sql .= " AND (".implode(' OR ', $searchCategoryWarehouseSqlList).")";
308 }
309 } else {
310 if (!empty($searchCategoryWarehouseSqlList)) {
311 $sql .= " AND (".implode(' AND ', $searchCategoryWarehouseSqlList).")";
312 }
313 }
314}
315
316// Add where from extra fields
317include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
318// Add where from hooks
319$parameters = array();
320$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
321$sql .= $hookmanager->resPrint;
322
323$sql .= " GROUP BY ";
324foreach ($object->fields as $key => $val) {
325 $sql .= "t.".$db->escape($key).", ";
326}
327// Add fields from extrafields
328if (!empty($extrafields->attributes[$object->table_element]['label'])) {
329 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
330 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
331 }
332}
333// Add groupby from hooks
334$parameters = array();
335$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
336$sql .= $hookmanager->resPrint;
337$sql = preg_replace('/,\s*$/', '', $sql);
338//print $sql;
339
340$result = $db->query($sql);
341if ($result) {
342 $totalnboflines = $db->num_rows($result);
343 // fetch totals
344 $line = $total = $totalsell = $totalStock = 0;
345 while ($line < $totalnboflines) {
346 $objp = $db->fetch_object($result);
347 $total += $objp->estimatedvalue;
348 $totalsell += $objp->sellvalue;
349 $totalStock += $objp->stockqty;
350 $line++;
351 }
352 $totalarray['val']['stockqty'] = price2num($totalStock, 'MS');
353 $totalarray['val']['estimatedvalue'] = price2num($total, 'MT');
354 $totalarray['val']['estimatedstockvaluesell'] = price2num($totalsell, 'MT');
355}
356
357// Count total nb of records
358$nbtotalofrecords = '';
359if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
360 /* The fast and low memory method to get and count full list converts the sql into a sql count */
361 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
362 $sqlforcount = preg_replace('/LEFT JOIN [a-z]+_product_stock as ps ON t.rowid = ps.fk_entrepot LEFT JOIN [a-z]+_product as p ON ps.fk_product = p.rowid/', '', $sqlforcount);
363 $sqlforcount = preg_replace('/LEFT JOIN [a-z]+_product_perentity as pa ON pa.fk_product = p.rowid AND pa.fk_product = ps.fk_product AND pa.entity = -?[0-9]+/', '', $sqlforcount);
364 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
365
366 $resql = $db->query($sqlforcount);
367 if ($resql) {
368 $objforcount = $db->fetch_object($resql);
369 $nbtotalofrecords = $objforcount->nbtotalofrecords;
370 } else {
371 dol_print_error($db);
372 }
373
374 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
375 $page = 0;
376 $offset = 0;
377 }
378 $db->free($resql);
379}
380
381// Complete request and execute it with limit
382$sql .= $db->order($sortfield, $sortorder);
383if ($limit) {
384 $sql .= $db->plimit($limit + 1, $offset);
385}
386
387$resql = $db->query($sql);
388if (!$resql) {
389 dol_print_error($db);
390 exit;
391}
392
393$num = $db->num_rows($resql);
394
395// Direct jump if only one record found
396if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
397 $obj = $db->fetch_object($resql);
398 $id = $obj->rowid;
399 header("Location: ".DOL_URL_ROOT.'/product/stock/card.php?id='.$id);
400 exit;
401}
402
403
404// Output page
405// --------------------------------------------------------------------
406
407llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-product page-stock_list');
408
409$arrayofselected = is_array($toselect) ? $toselect : array();
410
411$param = '';
412if (!empty($mode)) {
413 $param .= '&mode='.urlencode($mode);
414}
415if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
416 $param .= '&contextpage='.urlencode($contextpage);
417}
418if ($limit > 0 && $limit != $conf->liste_limit) {
419 $param .= '&limit='.((int) $limit);
420}
421if ($optioncss != '') {
422 $param .= '&optioncss='.urlencode($optioncss);
423}
424foreach ($search as $key => $val) {
425 if (is_array($search[$key])) {
426 foreach ($search[$key] as $skey) {
427 if ($skey != '') {
428 $param .= '&search_'.$key.'[]='.urlencode($skey);
429 }
430 }
431 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
432 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
433 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
434 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
435 } elseif ($search[$key] != '') {
436 $param .= '&search_'.$key.'='.urlencode($search[$key]);
437 }
438}
439// Add $param from extra fields
440include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
441// Add $param from hooks
442$parameters = array('param' => &$param);
443$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
444$param .= $hookmanager->resPrint;
445
446// List of mass actions available
447$arrayofmassactions = array(
448 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
449 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
450);
451//if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
452if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
453 $arrayofmassactions = array();
454}
455if (isModEnabled('category') && $user->hasRight('stock', 'creer')) {
456 $arrayofmassactions['preaffecttag'] = img_picto('', 'label', 'class="pictofixedwidth"').$langs->trans("AffectTag");
457}
458$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
459
460print '<form action="'.$_SERVER["PHP_SELF"].'" id="searchFormList" method="POST" name="formulaire">';
461if ($optioncss != '') {
462 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
463}
464print '<input type="hidden" name="token" value="'.newToken().'">';
465print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
466print '<input type="hidden" name="action" value="list">';
467print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
468print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
469print '<input type="hidden" name="page" value="'.$page.'">';
470print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
471print '<input type="hidden" name="page_y" value="">';
472print '<input type="hidden" name="mode" value="'.$mode.'">';
473
474
475$newcardbutton = '';
476$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
477$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
478$newcardbutton .= dolGetButtonTitleSeparator();
479$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewWarehouse'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->hasRight('stock', 'creer'));
480
481print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit, 0, 0, 1);
482
483// Add code for pre mass action (confirmation or email presend form)
484$topicmail = "Information";
485$modelmail = "warehouse";
486$objecttmp = new Entrepot($db);
487$trackid = 'ware'.$object->id;
488include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
489
490
491if ($search_all) {
492 $setupstring = '';
493 foreach ($fieldstosearchall as $key => $val) {
494 $fieldstosearchall[$key] = $langs->trans($val);
495 $setupstring .= $key."=".$val.";";
496 }
497 print '<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
498 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).implode(', ', $fieldstosearchall).'</div>';
499}
500
501$moreforfilter = '';
502
503if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
504 $formcategory = new FormCategory($db);
505 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
506}
507
508/*$moreforfilter.='<div class="divsearchfield">';
509 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
510 $moreforfilter.= '</div>';*/
511
512$parameters = array();
513$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
514if (empty($reshook)) {
515 $moreforfilter .= $hookmanager->resPrint;
516} else {
517 $moreforfilter = $hookmanager->resPrint;
518}
519
520if (!empty($moreforfilter)) {
521 print '<div class="liste_titre liste_titre_bydiv centpercent">';
522 print $moreforfilter;
523 print '</div>';
524}
525
526$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
527$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
528$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
529$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
530
531print '<div class="div-table-responsive">';
532print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
533
534// Fields title search
535// --------------------------------------------------------------------
536print '<tr class="liste_titre_filter">';
537// Action column
538if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
539 print '<td class="liste_titre center maxwidthsearch">';
540 $searchpicto = $form->showFilterButtons('left');
541 print $searchpicto;
542 print '</td>';
543}
544foreach ($object->fields as $key => $val) {
545 if ($key == 'statut') {
546 continue;
547 }
548 $searchkey = empty($search[$key]) ? '' : $search[$key];
549 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
550 if ($key == 'status') {
551 $cssforfield .= ($cssforfield ? ' ' : '').'center';
552 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
553 $cssforfield .= ($cssforfield ? ' ' : '').'center';
554 } elseif (in_array($val['type'], array('timestamp'))) {
555 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
556 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
557 $cssforfield .= ($cssforfield ? ' ' : '').'right';
558 }
559 if (!empty($arrayfields['t.'.$key]['checked'])) {
560 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
561 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
562 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
563 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
564 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
565 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
566 print '<div class="nowrap">';
567 print $form->selectDate(isset($search[$key.'_dtstart']) ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
568 print '</div>';
569 print '<div class="nowrap">';
570 print $form->selectDate(isset($search[$key.'_dtend']) ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
571 print '</div>';
572 } elseif ($key == 'lang') {
573 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
574 $formadmin = new FormAdmin($db);
575 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
576 } else {
577 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
578 }
579 print '</td>';
580 }
581}
582
583if (!empty($arrayfields["stockqty"]['checked'])) {
584 print '<td class="liste_titre"></td>';
585}
586
587if (!empty($arrayfields["estimatedvalue"]['checked'])) {
588 print '<td class="liste_titre"></td>';
589}
590
591if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
592 print '<td class="liste_titre"></td>';
593}
594
595// Extra fields
596include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
597
598// Fields from hook
599$parameters = array('arrayfields' => $arrayfields);
600$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
601print $hookmanager->resPrint;
602
603// Status
604if (!empty($arrayfields['t.statut']['checked'])) {
605 print '<td class="liste_titre center parentonrightofpage">';
606 print $form->selectarray('search_status', $warehouse->labelStatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
607 print '</td>';
608}
609
610// Action column
611if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
612 print '<td class="liste_titre center maxwidthsearch">';
613 $searchpicto = $form->showFilterButtons();
614 print $searchpicto;
615 print '</td>';
616}
617print '</tr>'."\n";
618
619$totalarray['nbfield'] = 0;
620
621// Fields title label
622// --------------------------------------------------------------------
623print '<tr class="liste_titre">';
624// Action column
625if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
626 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
627 $totalarray['nbfield']++;
628}
629foreach ($object->fields as $key => $val) {
630 if ($key == 'statut') {
631 continue;
632 }
633 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
634 if ($key == 'status') {
635 $cssforfield .= ($cssforfield ? ' ' : '').'center';
636 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
637 $cssforfield .= ($cssforfield ? ' ' : '').'center';
638 } elseif (in_array($val['type'], array('timestamp'))) {
639 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
640 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
641 $cssforfield .= ($cssforfield ? ' ' : '').'right';
642 }
643 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
644 if (!empty($arrayfields['t.'.$key]['checked'])) {
645 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
646 $totalarray['nbfield']++;
647 }
648}
649
650if (!empty($arrayfields["stockqty"]['checked'])) {
651 print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right ');
652 $totalarray['nbfield']++;
653 $totalarray['type'][$totalarray['nbfield']] = 'stock';
654}
655
656if (!empty($arrayfields["estimatedvalue"]['checked'])) {
657 print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right ');
658 $totalarray['nbfield']++;
659 $totalarray['type'][$totalarray['nbfield']] = 'price';
660}
661
662if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
663 print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ');
664 $totalarray['nbfield']++;
665 $totalarray['type'][$totalarray['nbfield']] = 'price';
666}
667
668// Extra fields
669include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
670
671// Hook fields
672$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
673$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
674print $hookmanager->resPrint;
675
676if (!empty($arrayfields['t.statut']['checked'])) {
677 print_liste_field_titre($arrayfields['t.statut']['label'], $_SERVER["PHP_SELF"], "t.statut", '', $param, '', $sortfield, $sortorder, 'center ');
678 $totalarray['nbfield']++;
679}
680
681// Action column
682if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
683 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
684 $totalarray['nbfield']++;
685}
686print '</tr>'."\n";
687
688$warehouse = new Entrepot($db);
689
690// Loop on record
691// --------------------------------------------------------------------
692$i = 0;
693$savnbfield = $totalarray['nbfield'];
694$totalarray['nbfield'] = 0;
695$imaxinloop = ($limit ? min($num, $limit) : $num);
696while ($i < $imaxinloop) {
697 $obj = $db->fetch_object($resql);
698 if (empty($obj)) {
699 break; // Should not happen
700 }
701
702 // Store properties in $object
703 $warehouse->setVarsFromFetchObj($obj);
704
705 $warehouse->label = $warehouse->ref;
706 $warehouse->sellvalue = $obj->sellvalue;
707
708 $object = $warehouse;
709
710 if ($mode == 'kanban') {
711 if ($i == 0) {
712 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
713 print '<div class="box-flex-container kanban">';
714 }
715 // Output Kanban
716 $selected = -1;
717 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
718 $selected = 0;
719 if (in_array($object->id, $arrayofselected)) {
720 $selected = 1;
721 }
722 }
723 print $object->getKanbanView('', array('selected' => $selected));
724 if ($i == ($imaxinloop - 1)) {
725 print '</div>';
726 print '</td></tr>';
727 }
728 } else {
729 // Show line of result
730 $j = 0;
731 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
732
733 // Action column
734 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
735 print '<td class="nowrap center">';
736 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
737 $selected = 0;
738 if (in_array($object->id, $arrayofselected)) {
739 $selected = 1;
740 }
741 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
742 }
743 print '</td>';
744 if (!$i) {
745 $totalarray['nbfield']++;
746 }
747 }
748 foreach ($object->fields as $key => $val) {
749 if ($key == 'statut') {
750 continue;
751 }
752 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
753 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
754 $cssforfield .= ($cssforfield ? ' ' : '').'center';
755 } elseif ($key == 'status') {
756 $cssforfield .= ($cssforfield ? ' ' : '').'center';
757 }
758
759 if (in_array($val['type'], array('timestamp'))) {
760 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
761 } elseif ($key == 'ref') {
762 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
763 }
764
765 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
766 $cssforfield .= ($cssforfield ? ' ' : '').'right';
767 }
768 if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) {
769 $cssforfield = 'tdoverflowmax100';
770 }
771
772 if (!empty($arrayfields['t.'.$key]['checked'])) {
773 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
774 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
775 print ' title="'.dol_escape_htmltag($object->$key).'"';
776 }
777 print '>';
778 if ($key == 'statut') {
779 print $object->getLibStatut(5);
780 }
781 if ($key == 'phone') {
782 print dol_print_phone($object->phone, '', 0, $object->id, 'AC_TEL');
783 } elseif ($key == 'fax') {
784 print dol_print_phone($object->fax, '', 0, $object->id, 'AC_FAX');
785 } else {
786 print $warehouse->showOutputField($val, $key, $object->$key, '');
787 }
788 print '</td>';
789 if (!$i) {
790 $totalarray['nbfield']++;
791 }
792 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
793 if (!$i) {
794 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
795 }
796 if (!isset($totalarray['val'])) {
797 $totalarray['val'] = array();
798 }
799 if (!isset($totalarray['val']['t.'.$key])) {
800 $totalarray['val']['t.'.$key] = 0;
801 }
802 $totalarray['val']['t.'.$key] += $object->$key;
803 }
804 }
805 }
806
807 // Stock qty
808 if (!empty($arrayfields["stockqty"]['checked'])) {
809 print '<td class="right">'.price(price2num($obj->stockqty, 'MS')).'</td>';
810 if (!$i) {
811 $totalarray['nbfield']++;
812 }
813 if (!$i) {
814 $totalarray['pos'][$totalarray['nbfield']] = 'stockqty';
815 }
816 }
817
818 // PMP value
819 if (!empty($arrayfields["estimatedvalue"]['checked'])) {
820 print '<td class="right">';
821 if (price2num($obj->estimatedvalue, 'MT')) {
822 print '<span class="amount">'.price(price2num($obj->estimatedvalue, 'MT'), 1).'</span>';
823 } else {
824 print '';
825 }
826 print '</td>';
827 if (!$i) {
828 $totalarray['nbfield']++;
829 }
830 if (!$i) {
831 $totalarray['pos'][$totalarray['nbfield']] = 'estimatedvalue';
832 }
833 }
834
835 // Selling value
836 if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
837 print '<td class="right">';
838 if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
839 if ($obj->sellvalue) {
840 print '<span class="amount">'.price(price2num($obj->sellvalue, 'MT'), 1).'</span>';
841 }
842 } else {
843 $htmltext = $langs->trans("OptionMULTIPRICESIsOn");
844 print $form->textwithtooltip('<span class="opacitymedium">'.$langs->trans("Variable").'</span>', $htmltext);
845 }
846 print '</td>';
847 if (!$i) {
848 $totalarray['nbfield']++;
849 }
850 if (!$i) {
851 $totalarray['pos'][$totalarray['nbfield']] = 'estimatedstockvaluesell';
852 }
853 }
854
855 // Extra fields
856 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
857 // Fields from hook
858 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
859 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
860 print $hookmanager->resPrint;
861
862 // Status
863 if (!empty($arrayfields['t.statut']['checked'])) {
864 print '<td class="center">'.$warehouse->LibStatut($obj->statut, 5).'</td>';
865 if (!$i) {
866 $totalarray['nbfield']++;
867 }
868 }
869
870 // Action column
871 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
872 print '<td class="nowrap center">';
873 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
874 $selected = 0;
875 if (in_array($object->id, $arrayofselected)) {
876 $selected = 1;
877 }
878 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
879 }
880 print '</td>';
881 if (!$i) {
882 $totalarray['nbfield']++;
883 }
884 }
885
886 print '</tr>'."\n";
887 }
888
889 $i++;
890}
891
892if ($totalnboflines - $offset <= $limit) {
893 // Show total line
894 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
895}
896
897// If no record found
898if ($num == 0) {
899 $colspan = 1;
900 foreach ($arrayfields as $key => $val) {
901 if (!empty($val['checked'])) {
902 $colspan++;
903 }
904 }
905 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
906}
907
908$db->free($resql);
909
910$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
911$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
912print $hookmanager->resPrint;
913
914print '</table>'."\n";
915print '</div>'."\n";
916
917print '</form>'."\n";
918
919if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
920 $hidegeneratedfilelistifempty = 1;
921 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
922 $hidegeneratedfilelistifempty = 0;
923 }
924
925 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
926 $formfile = new FormFile($db);
927
928 // Show list of available documents
929 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
930 $urlsource .= str_replace('&amp;', '&', $param);
931
932 $filedir = $diroutputmassaction;
933 $genallowed = $user->hasRight('stock', 'lire');
934 $delallowed = $user->hasRight('stock', 'creer');
935
936 print $formfile->showdocuments('massfilesarea_stock', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
937}
938
939// End of page
940llxFooter();
941$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage warehouses.
Class to manage standard extra fields.
Class to generate html code for admin pages.
Class to manage forms for categories.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ="&nbsp;", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='')
Format phone numbers according to country.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.