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