dolibarr 21.0.0-beta
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 $toselect = array();
187 $search_array_options = array();
188 $search_category_list = array();
189 }
190 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
191 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
192 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
193 }
194
195 // Mass actions
196 $objectclass = 'Entrepot';
197 $objectlabel = 'Warehouse';
198 $uploaddir = $conf->stock->dir_output;
199 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
200}
201
202
203/*
204 * View
205 */
206
207$form = new Form($db);
208$warehouse = new Entrepot($db);
209
210$now = dol_now();
211
212$title = $langs->trans("Warehouses");
213$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
214
215
216// Build and execute select
217// --------------------------------------------------------------------
218$sql = 'SELECT ';
219$sql .= $object->getFieldList('t');
220// Add fields from extrafields
221if (!empty($extrafields->attributes[$object->table_element]['label'])) {
222 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
223 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
224 }
225}
226
227//For Multicompany PMP per entity
228$separatedPMP = false;
229if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED') && getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
230 $separatedPMP = true;
231 $sql .= ", SUM(pa.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
232} else {
233 $sql .= ", SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
234}
235
236
237// Add fields from hooks
238$parameters = array();
239$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
240$sql .= $hookmanager->resPrint;
241$sql = preg_replace('/,\s*$/', '', $sql);
242
243$sqlfields = $sql; // $sql fields to remove for count total
244
245$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
246if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
247 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
248}
249$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON t.rowid = ps.fk_entrepot";
250$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
251$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c_dep ON c_dep.rowid = t.fk_departement";
252$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk_pays";
253if ($separatedPMP) {
254 $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;
255}
256$sql .= " WHERE t.entity IN (".getEntity('stock').")";
257foreach ($search as $key => $val) {
258 if (array_key_exists($key, $object->fields)||$key == 'status') {
259 $class_key = $key;
260 if ($class_key == 'status') {
261 $class_key = 'statut'; // remove this after refactoring entrepot.class property statut to status
262 }
263 if (($key == 'status' && $search[$key] == -1) || $key == 'entity') {
264 continue;
265 }
266 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
267 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
268 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
269 $search[$key] = '';
270 }
271 $mode_search = 2;
272 }
273 if ($search[$key] != '') {
274 $sql .= natural_search((($key == "ref") ? "t.ref" : "t.".$class_key), $search[$key], (($key == 'status') ? 2 : $mode_search));
275 }
276 } else {
277 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
278 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
279 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
280 if (preg_match('/_dtstart$/', $key)) {
281 $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
282 }
283 if (preg_match('/_dtend$/', $key)) {
284 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
285 }
286 }
287 }
288 }
289}
290if ($search_all) {
291 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
292}
293// Search for tag/category ($searchCategoryWarehouseList is an array of ID)
294$searchCategoryWarehouseList = $search_category_list;
295$searchCategoryWarehouseOperator = 0;
296if (!empty($searchCategoryWarehouseList)) {
297 $searchCategoryWarehouseSqlList = array();
298 $listofcategoryid = '';
299 foreach ($searchCategoryWarehouseList as $searchCategoryWarehouse) {
300 if (intval($searchCategoryWarehouse) == -2) {
301 $searchCategoryWarehouseSqlList[] = " NOT EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse)";
302 } elseif (intval($searchCategoryWarehouse) > 0) {
303 if ($searchCategoryWarehouseOperator == 0) {
304 $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).")";
305 } else {
306 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryWarehouse);
307 }
308 }
309 }
310 if ($listofcategoryid) {
311 $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)."))";
312 }
313 if ($searchCategoryWarehouseOperator == 1) {
314 if (!empty($searchCategoryWarehouseSqlList)) {
315 $sql .= " AND (".implode(' OR ', $searchCategoryWarehouseSqlList).")";
316 }
317 } else {
318 if (!empty($searchCategoryWarehouseSqlList)) {
319 $sql .= " AND (".implode(' AND ', $searchCategoryWarehouseSqlList).")";
320 }
321 }
322}
323
324// Add where from extra fields
325include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
326// Add where from hooks
327$parameters = array();
328$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
329$sql .= $hookmanager->resPrint;
330
331$sql .= " GROUP BY ";
332foreach ($object->fields as $key => $val) {
333 $sql .= "t.".$db->escape($key).", ";
334}
335// Add fields from extrafields
336if (!empty($extrafields->attributes[$object->table_element]['label'])) {
337 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
338 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
339 }
340}
341// Add groupby from hooks
342$parameters = array();
343$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
344$sql .= $hookmanager->resPrint;
345$sql = preg_replace('/,\s*$/', '', $sql);
346//print $sql;
347
348$result = $db->query($sql);
349if ($result) {
350 $totalnboflines = $db->num_rows($result);
351 // fetch totals
352 $line = $total = $totalsell = $totalStock = 0;
353 while ($line < $totalnboflines) {
354 $objp = $db->fetch_object($result);
355 $total += $objp->estimatedvalue;
356 $totalsell += $objp->sellvalue;
357 $totalStock += $objp->stockqty;
358 $line++;
359 }
360 $totalarray['val']['stockqty'] = price2num($totalStock, 'MS');
361 $totalarray['val']['estimatedvalue'] = price2num($total, 'MT');
362 $totalarray['val']['estimatedstockvaluesell'] = price2num($totalsell, 'MT');
363}
364
365// Count total nb of records
366$nbtotalofrecords = '';
367if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
368 /* The fast and low memory method to get and count full list converts the sql into a sql count */
369 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
370 $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);
371 $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);
372 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
373
374 $resql = $db->query($sqlforcount);
375 if ($resql) {
376 $objforcount = $db->fetch_object($resql);
377 $nbtotalofrecords = $objforcount->nbtotalofrecords;
378 } else {
379 dol_print_error($db);
380 }
381
382 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
383 $page = 0;
384 $offset = 0;
385 }
386 $db->free($resql);
387}
388
389// Complete request and execute it with limit
390$sql .= $db->order($sortfield, $sortorder);
391if ($limit) {
392 $sql .= $db->plimit($limit + 1, $offset);
393}
394
395$resql = $db->query($sql);
396if (!$resql) {
397 dol_print_error($db);
398 exit;
399}
400
401$num = $db->num_rows($resql);
402
403// Direct jump if only one record found
404if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
405 $obj = $db->fetch_object($resql);
406 $id = $obj->rowid;
407 header("Location: ".DOL_URL_ROOT.'/product/stock/card.php?id='.$id);
408 exit;
409}
410
411
412// Output page
413// --------------------------------------------------------------------
414
415llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-product page-stock_list');
416
417$arrayofselected = is_array($toselect) ? $toselect : array();
418
419$param = '';
420if (!empty($mode)) {
421 $param .= '&mode='.urlencode($mode);
422}
423if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
424 $param .= '&contextpage='.urlencode($contextpage);
425}
426if ($limit > 0 && $limit != $conf->liste_limit) {
427 $param .= '&limit='.((int) $limit);
428}
429if ($optioncss != '') {
430 $param .= '&optioncss='.urlencode($optioncss);
431}
432foreach ($search as $key => $val) {
433 if (is_array($search[$key])) {
434 foreach ($search[$key] as $skey) {
435 if ($skey != '') {
436 $param .= '&search_'.$key.'[]='.urlencode($skey);
437 }
438 }
439 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
440 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
441 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
442 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
443 } elseif ($search[$key] != '') {
444 $param .= '&search_'.$key.'='.urlencode($search[$key]);
445 }
446}
447// Add $param from extra fields
448include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
449// Add $param from hooks
450$parameters = array('param' => &$param);
451$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
452$param .= $hookmanager->resPrint;
453
454// List of mass actions available
455$arrayofmassactions = array(
456 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
457 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
458);
459//if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
460if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
461 $arrayofmassactions = array();
462}
463if (isModEnabled('category') && $user->hasRight('stock', 'creer')) {
464 $arrayofmassactions['preaffecttag'] = img_picto('', 'label', 'class="pictofixedwidth"').$langs->trans("AffectTag");
465}
466$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
467
468print '<form action="'.$_SERVER["PHP_SELF"].'" id="searchFormList" method="POST" name="formulaire">';
469if ($optioncss != '') {
470 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
471}
472print '<input type="hidden" name="token" value="'.newToken().'">';
473print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
474print '<input type="hidden" name="action" value="list">';
475print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
476print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
477print '<input type="hidden" name="page" value="'.$page.'">';
478print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
479print '<input type="hidden" name="page_y" value="">';
480print '<input type="hidden" name="mode" value="'.$mode.'">';
481
482
483$newcardbutton = '';
484$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'));
485$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'));
486$newcardbutton .= dolGetButtonTitleSeparator();
487$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'));
488
489print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit, 0, 0, 1);
490
491// Add code for pre mass action (confirmation or email presend form)
492$topicmail = "Information";
493$modelmail = "warehouse";
494$objecttmp = new Entrepot($db);
495$trackid = 'ware'.$object->id;
496include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
497
498
499if ($search_all) {
500 $setupstring = '';
501 foreach ($fieldstosearchall as $key => $val) {
502 $fieldstosearchall[$key] = $langs->trans($val);
503 $setupstring .= $key."=".$val.";";
504 }
505 print '<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
506 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).implode(', ', $fieldstosearchall).'</div>';
507}
508
509$moreforfilter = '';
510
511if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
512 $formcategory = new FormCategory($db);
513 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
514}
515
516/*$moreforfilter.='<div class="divsearchfield">';
517 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
518 $moreforfilter.= '</div>';*/
519
520$parameters = array();
521$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
522if (empty($reshook)) {
523 $moreforfilter .= $hookmanager->resPrint;
524} else {
525 $moreforfilter = $hookmanager->resPrint;
526}
527
528if (!empty($moreforfilter)) {
529 print '<div class="liste_titre liste_titre_bydiv centpercent">';
530 print $moreforfilter;
531 print '</div>';
532}
533
534$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
535$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
536$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
537$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
538
539print '<div class="div-table-responsive">';
540print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
541
542// Fields title search
543// --------------------------------------------------------------------
544print '<tr class="liste_titre_filter">';
545// Action column
546if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
547 print '<td class="liste_titre center maxwidthsearch">';
548 $searchpicto = $form->showFilterButtons('left');
549 print $searchpicto;
550 print '</td>';
551}
552foreach ($object->fields as $key => $val) {
553 if ($key == 'statut') {
554 continue;
555 }
556 $searchkey = empty($search[$key]) ? '' : $search[$key];
557 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
558 if ($key == 'status') {
559 $cssforfield .= ($cssforfield ? ' ' : '').'center';
560 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
561 $cssforfield .= ($cssforfield ? ' ' : '').'center';
562 } elseif (in_array($val['type'], array('timestamp'))) {
563 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
564 } 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'])) {
565 $cssforfield .= ($cssforfield ? ' ' : '').'right';
566 }
567 if (!empty($arrayfields['t.'.$key]['checked'])) {
568 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
569 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
570 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);
571 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
572 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
573 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
574 print '<div class="nowrap">';
575 print $form->selectDate(isset($search[$key.'_dtstart']) ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
576 print '</div>';
577 print '<div class="nowrap">';
578 print $form->selectDate(isset($search[$key.'_dtend']) ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
579 print '</div>';
580 } elseif ($key == 'lang') {
581 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
582 $formadmin = new FormAdmin($db);
583 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
584 } else {
585 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
586 }
587 print '</td>';
588 }
589}
590
591if (!empty($arrayfields["stockqty"]['checked'])) {
592 print '<td class="liste_titre"></td>';
593}
594
595if (!empty($arrayfields["estimatedvalue"]['checked'])) {
596 print '<td class="liste_titre"></td>';
597}
598
599if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
600 print '<td class="liste_titre"></td>';
601}
602
603// Extra fields
604include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
605
606// Fields from hook
607$parameters = array('arrayfields' => $arrayfields);
608$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
609print $hookmanager->resPrint;
610
611// Status
612if (!empty($arrayfields['t.statut']['checked'])) {
613 print '<td class="liste_titre center parentonrightofpage">';
614 print $form->selectarray('search_status', $warehouse->labelStatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
615 print '</td>';
616}
617
618// Action column
619if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
620 print '<td class="liste_titre center maxwidthsearch">';
621 $searchpicto = $form->showFilterButtons();
622 print $searchpicto;
623 print '</td>';
624}
625print '</tr>'."\n";
626
627$totalarray = array();
628$totalarray['nbfield'] = 0;
629
630// Fields title label
631// --------------------------------------------------------------------
632print '<tr class="liste_titre">';
633// Action column
634if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
635 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
636 $totalarray['nbfield']++;
637}
638foreach ($object->fields as $key => $val) {
639 if ($key == 'statut') {
640 continue;
641 }
642 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
643 if ($key == 'status') {
644 $cssforfield .= ($cssforfield ? ' ' : '').'center';
645 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
646 $cssforfield .= ($cssforfield ? ' ' : '').'center';
647 } elseif (in_array($val['type'], array('timestamp'))) {
648 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
649 } 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'])) {
650 $cssforfield .= ($cssforfield ? ' ' : '').'right';
651 }
652 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
653 if (!empty($arrayfields['t.'.$key]['checked'])) {
654 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";
655 $totalarray['nbfield']++;
656 }
657}
658
659if (!empty($arrayfields["stockqty"]['checked'])) {
660 print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right ');
661 $totalarray['nbfield']++;
662 $totalarray['type'][$totalarray['nbfield']] = 'stock';
663}
664
665if (!empty($arrayfields["estimatedvalue"]['checked'])) {
666 print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right ');
667 $totalarray['nbfield']++;
668 $totalarray['type'][$totalarray['nbfield']] = 'price';
669}
670
671if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
672 print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ');
673 $totalarray['nbfield']++;
674 $totalarray['type'][$totalarray['nbfield']] = 'price';
675}
676
677// Extra fields
678include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
679
680// Hook fields
681$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
682$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
683print $hookmanager->resPrint;
684
685if (!empty($arrayfields['t.statut']['checked'])) {
686 print_liste_field_titre($arrayfields['t.statut']['label'], $_SERVER["PHP_SELF"], "t.statut", '', $param, '', $sortfield, $sortorder, 'center ');
687 $totalarray['nbfield']++;
688}
689
690// Action column
691if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
692 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
693 $totalarray['nbfield']++;
694}
695print '</tr>'."\n";
696
697$warehouse = new Entrepot($db);
698
699// Loop on record
700// --------------------------------------------------------------------
701$i = 0;
702$savnbfield = $totalarray['nbfield'];
703$totalarray['nbfield'] = 0;
704$imaxinloop = ($limit ? min($num, $limit) : $num);
705while ($i < $imaxinloop) {
706 $obj = $db->fetch_object($resql);
707 if (empty($obj)) {
708 break; // Should not happen
709 }
710
711 // Store properties in $object
712 $warehouse->setVarsFromFetchObj($obj);
713
714 $warehouse->label = $warehouse->ref;
715 $warehouse->sellvalue = $obj->sellvalue;
716
717 $object = $warehouse;
718
719 if ($mode == 'kanban') {
720 if ($i == 0) {
721 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
722 print '<div class="box-flex-container kanban">';
723 }
724 // Output Kanban
725 $selected = -1;
726 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
727 $selected = 0;
728 if (in_array($object->id, $arrayofselected)) {
729 $selected = 1;
730 }
731 }
732 print $object->getKanbanView('', array('selected' => $selected));
733 if ($i == ($imaxinloop - 1)) {
734 print '</div>';
735 print '</td></tr>';
736 }
737 } else {
738 // Show line of result
739 $j = 0;
740 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
741
742 // Action column
743 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
744 print '<td class="nowrap center">';
745 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
746 $selected = 0;
747 if (in_array($object->id, $arrayofselected)) {
748 $selected = 1;
749 }
750 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
751 }
752 print '</td>';
753 if (!$i) {
754 $totalarray['nbfield']++;
755 }
756 }
757 foreach ($object->fields as $key => $val) {
758 if ($key == 'statut') {
759 continue;
760 }
761 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
762 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
763 $cssforfield .= ($cssforfield ? ' ' : '').'center';
764 } elseif ($key == 'status') {
765 $cssforfield .= ($cssforfield ? ' ' : '').'center';
766 }
767
768 if (in_array($val['type'], array('timestamp'))) {
769 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
770 } elseif ($key == 'ref') {
771 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
772 }
773
774 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'])) {
775 $cssforfield .= ($cssforfield ? ' ' : '').'right';
776 }
777 if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) {
778 $cssforfield = 'tdoverflowmax100';
779 }
780
781 if (!empty($arrayfields['t.'.$key]['checked'])) {
782 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
783 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
784 print ' title="'.dol_escape_htmltag($object->$key).'"';
785 }
786 print '>';
787 if ($key == 'statut') {
788 print $object->getLibStatut(5);
789 }
790 if ($key == 'phone') {
791 print dol_print_phone($object->phone, '', 0, $object->id, 'AC_TEL');
792 } elseif ($key == 'fax') {
793 print dol_print_phone($object->fax, '', 0, $object->id, 'AC_FAX');
794 } else {
795 print $warehouse->showOutputField($val, $key, $object->$key, '');
796 }
797 print '</td>';
798 if (!$i) {
799 $totalarray['nbfield']++;
800 }
801 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
802 if (!$i) {
803 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
804 }
805 if (!isset($totalarray['val'])) {
806 $totalarray['val'] = array();
807 }
808 if (!isset($totalarray['val']['t.'.$key])) {
809 $totalarray['val']['t.'.$key] = 0;
810 }
811 $totalarray['val']['t.'.$key] += $object->$key;
812 }
813 }
814 }
815
816 // Stock qty
817 if (!empty($arrayfields["stockqty"]['checked'])) {
818 print '<td class="right">'.price(price2num($obj->stockqty, 'MS')).'</td>';
819 if (!$i) {
820 $totalarray['nbfield']++;
821 }
822 if (!$i) {
823 $totalarray['pos'][$totalarray['nbfield']] = 'stockqty';
824 }
825 }
826
827 // PMP value
828 if (!empty($arrayfields["estimatedvalue"]['checked'])) {
829 print '<td class="right">';
830 if (price2num($obj->estimatedvalue, 'MT')) {
831 print '<span class="amount">'.price(price2num($obj->estimatedvalue, 'MT'), 1).'</span>';
832 } else {
833 print '';
834 }
835 print '</td>';
836 if (!$i) {
837 $totalarray['nbfield']++;
838 }
839 if (!$i) {
840 $totalarray['pos'][$totalarray['nbfield']] = 'estimatedvalue';
841 }
842 }
843
844 // Selling value
845 if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
846 print '<td class="right">';
847 if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
848 if ($obj->sellvalue) {
849 print '<span class="amount">'.price(price2num($obj->sellvalue, 'MT'), 1).'</span>';
850 }
851 } else {
852 $htmltext = $langs->trans("OptionMULTIPRICESIsOn");
853 print $form->textwithtooltip('<span class="opacitymedium">'.$langs->trans("Variable").'</span>', $htmltext);
854 }
855 print '</td>';
856 if (!$i) {
857 $totalarray['nbfield']++;
858 }
859 if (!$i) {
860 $totalarray['pos'][$totalarray['nbfield']] = 'estimatedstockvaluesell';
861 }
862 }
863
864 // Extra fields
865 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
866 // Fields from hook
867 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
868 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
869 print $hookmanager->resPrint;
870
871 // Status
872 if (!empty($arrayfields['t.statut']['checked'])) {
873 print '<td class="center">'.$warehouse->LibStatut($obj->statut, 5).'</td>';
874 if (!$i) {
875 $totalarray['nbfield']++;
876 }
877 }
878
879 // Action column
880 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
881 print '<td class="nowrap center">';
882 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
883 $selected = 0;
884 if (in_array($object->id, $arrayofselected)) {
885 $selected = 1;
886 }
887 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
888 }
889 print '</td>';
890 if (!$i) {
891 $totalarray['nbfield']++;
892 }
893 }
894
895 print '</tr>'."\n";
896 }
897
898 $i++;
899}
900
901if ($totalnboflines - $offset <= $limit) {
902 // Show total line
903 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
904}
905
906// If no record found
907if ($num == 0) {
908 $colspan = 1;
909 foreach ($arrayfields as $key => $val) {
910 if (!empty($val['checked'])) {
911 $colspan++;
912 }
913 }
914 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
915}
916
917$db->free($resql);
918
919$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
920$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
921print $hookmanager->resPrint;
922
923print '</table>'."\n";
924print '</div>'."\n";
925
926print '</form>'."\n";
927
928if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
929 $hidegeneratedfilelistifempty = 1;
930 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
931 $hidegeneratedfilelistifempty = 0;
932 }
933
934 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
935 $formfile = new FormFile($db);
936
937 // Show list of available documents
938 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
939 $urlsource .= str_replace('&amp;', '&', $param);
940
941 $filedir = $diroutputmassaction;
942 $genallowed = $user->hasRight('stock', 'lire');
943 $delallowed = $user->hasRight('stock', 'creer');
944
945 print $formfile->showdocuments('massfilesarea_stock', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
946}
947
948// End of page
949llxFooter();
950$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)
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.