dolibarr 22.0.5
mo_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../main.inc.php';
29
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
34require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
35// load mrp libraries
36require_once __DIR__.'/class/mo.class.php';
37
46// Load translation files required by the page
47$langs->loadLangs(array("mrp", "other"));
48
49// Get parameters
50$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
51$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
52$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
53$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
54$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
55$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
56$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
57$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
58$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
59$mode = GETPOST('mode', 'alpha');
60$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
61
62$id = GETPOSTINT('id');
63
64// Load variable for pagination
65$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
66$sortfield = GETPOST('sortfield', 'aZ09comma');
67$sortorder = GETPOST('sortorder', 'aZ09comma');
68$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
69$also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);
70$changeDate = GETPOST('change_date', 'alpha');
71
72//Data request for date
73$year = GETPOST('change_dateyear', 'int');
74$month = GETPOST('change_datemonth', 'int');
75$day = GETPOST('change_dateday', 'int');
76$hour = GETPOST('change_datehour', 'int');
77$min = GETPOST('change_datemin', 'int');
78
79if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
80 // If $page is not defined, or '' or -1 or if we click on clear filters
81 $page = 0;
82}
83$offset = $limit * $page;
84$pageprev = $page - 1;
85$pagenext = $page + 1;
86//if (! $sortfield) $sortfield="p.date_fin";
87//if (! $sortorder) $sortorder="DESC";
88
89// Initialize a technical objects
90$object = new Mo($db);
91$extrafields = new ExtraFields($db);
92$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id;
93$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
94
95// Fetch optionals attributes and labels
96$extrafields->fetch_name_optionals_label($object->table_element);
97
98$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
99
100$search_option = GETPOST('search_option', 'alphanohtml');
101
102// Default sort order (if not yet defined by previous GETPOST)
103if (!$sortfield) {
104 $sortfield = "t.ref"; // Set here default search field. By default 1st field in definition.
105}
106if (!$sortorder) {
107 $sortorder = "ASC";
108}
109
110// Initialize array of search criteria
111$search_all = trim(GETPOST('search_all', 'alphanohtml'));
112$search = array();
113foreach ($object->fields as $key => $val) {
114 if (GETPOST('search_'.$key, 'alpha') !== '') {
115 $search[$key] = GETPOST('search_'.$key, 'alpha');
116 }
117 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
118 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
119 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
120 }
121}
122// List of fields to search into when doing a "search in all"
123$fieldstosearchall = array();
124foreach ($object->fields as $key => $val) {
125 if (!empty($val['searchall'])) {
126 $fieldstosearchall['t.'.$key] = $val['label'];
127 }
128}
129
130// Definition of array of fields for columns
131$tableprefix = 't';
132$arrayfields = array();
133foreach ($object->fields as $key => $val) {
134 // If $val['visible']==0, then we never show the field
135 if (!empty($val['visible'])) {
136 $visible = (int) dol_eval((string) $val['visible'], 1);
137 $arrayfields[$tableprefix.'.'.$key] = array(
138 'label' => $val['label'],
139 'checked' => (($visible < 0) ? '0' : '1'),
140 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
141 'position' => $val['position'],
142 'help' => isset($val['help']) ? $val['help'] : ''
143 );
144 }
145
146 if ($key == 'fk_parent_line') {
147 $visible = (int) dol_eval((string) $val['visible'], 1);
148 $arrayfields[$tableprefix.'.'.$key] = array(
149 'label' => $val['label'],
150 'checked' => (($visible <= 0) ? 0 : 1),
151 'enabled' => (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
152 'position' => $val['position'],
153 'help' => isset($val['help']) ? $val['help'] : ''
154 );
155 }
156}
157// Extra fields
158include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
159
160$object->fields = dol_sort_array($object->fields, 'position');
161$arrayfields = dol_sort_array($arrayfields, 'position');
162
163$permissiontoread = $user->hasRight('mrp', 'read');
164$permissiontoadd = $user->hasRight('mrp', 'write');
165$permissiontodelete = $user->hasRight('mrp', 'delete');
166
167// Security check
168if ($user->socid > 0) {
170}
171$result = restrictedArea($user, 'mrp');
172
173
174/*
175 * Actions
176 */
177
178if (GETPOST('cancel', 'alpha')) {
179 $action = 'list';
180 $massaction = '';
181}
182if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
183 $massaction = '';
184}
185
186$parameters = array('arrayfields' => &$arrayfields);
187$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
188if ($reshook < 0) {
189 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
190}
191
192if (empty($reshook)) {
193 // Selection of new fields
194 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
195
196 // Purge search criteria
197 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
198 foreach ($object->fields as $key => $val) {
199 $search[$key] = '';
200 if ($key == 'status') {
201 $search[$key] = -1;
202 }
203 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
204 $search[$key.'_dtstart'] = '';
205 $search[$key.'_dtend'] = '';
206 }
207 }
208 $search_all = '';
209 $toselect = array();
210 $search_array_options = array();
211 }
212 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
213 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
214 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
215 }
216
217 // Mass actions
218 $objectclass = 'Mo';
219 $objectlabel = 'Mo';
220 $uploaddir = $conf->mrp->dir_output;
221 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
222 $objMo = new Mo($db);
223
224 if ($action == 'confirm_cancel' && $confirm == 'yes' && $permissiontoadd) {
225 if (!empty($toselect)) {
226 foreach ($toselect as $key => $idMo) {
227 if ($objMo->fetch($idMo)) {
228 if ($objMo->status == Mo::STATUS_VALIDATED || $objMo->status == Mo::STATUS_INPROGRESS) {
229 if ($also_cancel_consumed_and_produced_lines) {
230 if ($objMo->cancelConsumedAndProducedLines($user, 0, true, 1)) {
231 $objMo->status = Mo::STATUS_CANCELED;
232 }
233 } else {
234 $objMo->status = Mo::STATUS_CANCELED;
235 }
236 if ($objMo->update($user)) {
237 setEventMessages($langs->trans('CancelMoValidated', $objMo->ref), null, 'mesgs');
238 } else {
239 setEventMessages($langs->trans('ErrorCancelMo', $objMo->ref), null, 'errors');
240 }
241 } else {
242 setEventMessages($langs->trans('ErrorObjectMustHaveStatusValidatedToBeCanceled', $objMo->ref), null, 'errors');
243 }
244 }
245 }
246 }
247 }
248
249 if (($action == 'changedatestart_confirm' || $action == 'changedateend_confirm') && $permissiontoadd) {
250 if ($confirm == 'yes') {
251 $newDate = dol_mktime((int) $hour, (int) $min, (int) 0, (int) $month, (int) $day, (int) $year);
252
253 if (!empty($toselect)) {
254 foreach ($toselect as $key => $idMo) {
255 if ($objMo->fetch($idMo)) {
256 if (in_array($action, array('changedatestart_confirm', 'changedateend_confirm'), true) && $objMo->status == Mo::STATUS_PRODUCED) {
257 $errorKey = $action == 'changedatestart_confirm'
258 ? 'ErrorObjectMustNotBeFinishedToModifyDateStart'
259 : 'ErrorObjectMustNotBeFinishedToModifyDateEnd';
260 setEventMessages($langs->trans($errorKey, $objMo->ref), null, 'errors');
261 continue;
262 }
263 if (!empty($changeDate)) {
264 if ($action == 'changedatestart_confirm') { // Test on permission not required
265 if (empty($objMo->date_end_planned) || $newDate < $objMo->date_end_planned) {
266 $objMo->date_start_planned = $newDate;
267 } else {
268 setEventMessages($langs->trans('ErrorModifyMoDateStart', $objMo->ref), null, 'errors');
269 break;
270 }
271 } elseif ($action == 'changedateend_confirm') { // Test on permission not required
272 if ($newDate > $objMo->date_start_planned) {
273 $objMo->date_end_planned = $newDate;
274 } else {
275 setEventMessages($langs->trans('ErrorModifyMoDateEnd', $objMo->ref), null, 'errors');
276 break;
277 }
278 }
279 if ($objMo->update($user)) {
280 setEventMessages($langs->trans('ModifyMoDate', $objMo->ref), null, 'mesgs');
281 } else {
282 setEventMessages($langs->trans('ErrorModifyMoDate', $objMo->ref), null, 'errors');
283 }
284 } else {
285 setEventMessages($langs->trans('ErrorEmptyChangeDate'), null, 'errors');
286 break;
287 }
288 }
289 }
290 }
291 }
292 }
293}
294
295
296
297/*
298 * View
299 */
300
301$form = new Form($db);
302
303$now = dol_now();
304
305$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
306$title = $langs->trans('ListOfManufacturingOrders');
307$morejs = array();
308$morecss = array();
309
310
311// Build and execute select
312// --------------------------------------------------------------------
313$sql = "SELECT ";
314$sql .= " ".$object->getFieldList('t');
315// Add fields from extrafields
316if (!empty($extrafields->attributes[$object->table_element]['label'])) {
317 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
318 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
319 }
320}
321// Add fields from hooks
322$parameters = array();
323$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
324$sql .= $hookmanager->resPrint;
325$sql = preg_replace('/,\s*$/', '', $sql);
326
327$sqlfields = $sql; // $sql fields to remove for count total
328
329$sql .= " FROM ".$db->prefix().$object->table_element." as t";
330if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
331 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
332}
333$sql .= " LEFT JOIN ".$db->prefix()."mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid";
334$sql .= " LEFT JOIN ".$db->prefix()."mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid";
335$sql .= " LEFT JOIN ".$db->prefix()."product as p ON t.fk_product = p.rowid";
336// Add table from hooks
337$parameters = array();
338$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
339$sql .= $hookmanager->resPrint;
340if ($object->ismultientitymanaged == 1) {
341 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
342} else {
343 $sql .= " WHERE 1 = 1";
344}
345
346foreach ($search as $key => $val) {
347 if (array_key_exists($key, $object->fields)) {
348 if ($key == 'status' && $search[$key] == -1) {
349 continue;
350 }
351 if ($key == 'status' && $search[$key] == -2) {
352 $sql .= " AND (t.status IN (".$db->sanitize($object::STATUS_VALIDATED.",".$object::STATUS_INPROGRESS)."))";
353 if ($search_option == 'late') {
354 $sql .= " AND (t.date_end_planned < '".$db->idate(dol_now() - $conf->mrp->progress->warning_delay)."')";
355 }
356 continue;
357 }
358 if ($key == 'fk_parent_line' && $search[$key] != '') {
359 $sql .= natural_search('moparent.ref', $search[$key], 0);
360 continue;
361 }
362 if ($key == 'status') {
363 $sql .= natural_search('t.status', (string) $search[$key], 1);
364 continue;
365 }
366
367 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
368 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
369 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
370 $search[$key] = '';
371 }
372 $mode_search = 2;
373 }
374 if ($search[$key] != '') {
375 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
376 }
377 } else {
378 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
379 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
380 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
381 if (preg_match('/_dtstart$/', $key)) {
382 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
383 }
384 if (preg_match('/_dtend$/', $key)) {
385 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
386 }
387 }
388 }
389 }
390}
391
392
393if ($search_all) {
394 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
395}
396
397
398
399//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
400// Add where from extra fields
401include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
402// Add where from hooks
403$parameters = array();
404$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
405$sql .= $hookmanager->resPrint;
406/* If a group by is required
407$sql.= " GROUP BY ";
408foreach($object->fields as $key => $val) {
409 $sql .= "t.".$db->sanitize($key).", ";
410}
411// Add fields from extrafields
412if (!empty($extrafields->attributes[$object->table_element]['label'])) {
413 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
414 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
415 }
416}
417// Add groupby from hooks
418$parameters=array();
419$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
420$sql.=$hookmanager->resPrint;
421$sql=preg_replace('/,\s*$/','', $sql);
422*/
423
424// Count total nb of records
425$nbtotalofrecords = '';
426if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
427 /* The fast and low memory method to get and count full list converts the sql into a sql count */
428 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
429 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
430 $resql = $db->query($sqlforcount);
431 if ($resql) {
432 $objforcount = $db->fetch_object($resql);
433 $nbtotalofrecords = $objforcount->nbtotalofrecords;
434 } else {
435 dol_print_error($db);
436 }
437
438 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
439 $page = 0;
440 $offset = 0;
441 }
442 $db->free($resql);
443}
444
445// Complete request and execute it with limit
446$sql .= $db->order($sortfield, $sortorder);
447if ($limit) {
448 $sql .= $db->plimit($limit + 1, $offset);
449}
450$resql = $db->query($sql);
451if (!$resql) {
452 dol_print_error($db);
453 exit;
454}
455
456$num = $db->num_rows($resql);
457
458// Direct jump if only one record found
459if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
460 $obj = $db->fetch_object($resql);
461 $id = $obj->rowid;
462 header("Location: ".dol_buildpath('/mrp/mo_card.php', 1).'?id='.((int) $id));
463 exit;
464}
465
466
467// Output page
468// --------------------------------------------------------------------
469
470llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-mrp page-list');
471
472
473$arrayofselected = is_array($toselect) ? $toselect : array();
474
475$param = '';
476if (!empty($mode)) {
477 $param .= '&mode='.urlencode($mode);
478}
479if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
480 $param .= '&contextpage='.urlencode($contextpage);
481}
482if ($limit > 0 && $limit != $conf->liste_limit) {
483 $param .= '&limit='.((int) $limit);
484}
485if ($optioncss != '') {
486 $param .= '&optioncss='.urlencode($optioncss);
487}
488if ($groupby != '') {
489 $param .= '&groupby='.urlencode($groupby);
490}
491foreach ($search as $key => $val) {
492 if (is_array($search[$key])) {
493 foreach ($search[$key] as $skey) {
494 if ($skey != '') {
495 $param .= '&search_'.$key.'[]='.urlencode($skey);
496 }
497 }
498 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
499 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
500 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
501 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
502 } elseif ($search[$key] != '') {
503 $param .= '&search_'.$key.'='.urlencode($search[$key]);
504 }
505}
506// Add $param from extra fields
507include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
508// Add $param from hooks
509$parameters = array('param' => &$param);
510$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
511$param .= $hookmanager->resPrint;
512
513// List of mass actions available
514$arrayofmassactions = array(
515 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
516 'precancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"),
517 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
518 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
519 'predatestart'=>img_picto('', 'object_calendar', 'class="pictofixedwidth"').$langs->trans("MoChangeDateStart"),
520 'predateend'=>img_picto('', 'object_calendar', 'class="pictofixedwidth"').$langs->trans("MoChangeDateEnd"),
521 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
522);
523if (!empty($permissiontodelete)) {
524 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
525}
526if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
527 $arrayofmassactions = array();
528}
529$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
530
531print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
532if ($optioncss != '') {
533 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
534}
535print '<input type="hidden" name="token" value="'.newToken().'">';
536print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
537print '<input type="hidden" name="action" value="list">';
538print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
539print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
540print '<input type="hidden" name="page" value="'.$page.'">';
541print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
542print '<input type="hidden" name="page_y" value="">';
543print '<input type="hidden" name="mode" value="'.$mode.'">';
544
545$newcardbutton = '';
546$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'));
547$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'));
548$newcardbutton .= dolGetButtonTitleSeparator();
549$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
550
551print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
552
553// Add code for pre mass action (confirmation or email presend form)
554$topicmail = "SendMoRef";
555$modelmail = "mo";
556$objecttmp = new Mo($db);
557$trackid = 'mo'.$object->id;
558include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
559
560if ($massaction == 'precancel') {
561 $formquestion = array(
562 array(
563 'label' => $langs->trans('MoCancelConsumedAndProducedLines'),
564 'name' => 'alsoCancelConsumedAndProducedLines',
565 'type' => 'checkbox',
566 'value' => 0
567 ),
568 );
569
570 print $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'],
571 $langs->trans('CancelMo'),
572 $langs->trans('ConfirmCancelMo'),
573 'confirm_cancel', $formquestion,
574 1, 0, 200, 500, 1);
575}
576
577if ($massaction == 'predatestart') {
578 $formquestion = array(
579 array(
580 'type' => 'datetime',
581 'tdclass' => 'fieldrequired',
582 'name' => 'change_date',
583 'label' => $langs->trans('ModifyDateStart'),
584 'value' => -1),
585 );
586 print $form->formconfirm($_SERVER['PHP_SELF'],
587 $langs->trans('ConfirmMassChangeDateStart'),
588 $langs->trans('ConfirmMassChangeDateStartQuestion',
589 count($toselect)), 'changedatestart_confirm', $formquestion,
590 '', 0, 200, 500, 1);
591}
592
593if ($massaction == 'predateend') {
594 $formquestion = array(
595 array(
596 'type' => 'datetime',
597 'tdclass' => 'fieldrequired',
598 'name' => 'change_date',
599 'label' => $langs->trans('ModifyDateEnd'),
600 'value' => -1),
601 );
602 print $form->formconfirm($_SERVER['PHP_SELF'],
603 $langs->trans('ConfirmMassChangeDateEnd'),
604 $langs->trans('ConfirmMassChangeDateEndQuestion',
605 count($toselect)), 'changedateend_confirm', $formquestion,
606 '', 0, 200, 500, 1);
607}
608
609if ($search_all) {
610 foreach ($fieldstosearchall as $key => $val) {
611 $fieldstosearchall[$key] = $langs->trans($val);
612 }
613 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
614}
615
616$moreforfilter = '';
617/*$moreforfilter.='<div class="divsearchfield">';
618$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
619$moreforfilter.= '</div>';*/
620
621$parameters = array();
622$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
623if (empty($reshook)) {
624 $moreforfilter .= $hookmanager->resPrint;
625} else {
626 $moreforfilter = $hookmanager->resPrint;
627}
628
629if (!empty($moreforfilter)) {
630 print '<div class="liste_titre liste_titre_bydiv centpercent">';
631 print $moreforfilter;
632 print '</div>';
633}
634
635$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
636$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
637$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
638$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
639
640print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
641print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
642
643
644// Fields title search
645// --------------------------------------------------------------------
646print '<tr class="liste_titre_filter">';
647// Action column
648if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
649 print '<td class="liste_titre center maxwidthsearch">';
650 $searchpicto = $form->showFilterButtons('left');
651 print $searchpicto;
652 print '</td>';
653}
654foreach ($object->fields as $key => $val) {
655 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
656 if ($key == 'status') {
657 $cssforfield .= ($cssforfield ? ' ' : '').'center';
658 } elseif ($key == 'fk_parent_line') {
659 $cssforfield .= ($cssforfield ? ' ' : '').'center';
660 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
661 $cssforfield .= ($cssforfield ? ' ' : '').'center';
662 } elseif (in_array($val['type'], array('timestamp'))) {
663 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
664 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
665 $cssforfield .= ($cssforfield ? ' ' : '').'right';
666 }
667 if (!empty($arrayfields['t.'.$key]['checked'])) {
668 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
669 if ($key == 'fk_parent_line') {
670 print '<input type="text" class="flat maxwidth75" name="search_fk_parent_line">';
671 print '</td>';
672 continue;
673 }
674 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
675 if ($key == 'status') {
676 $val['arrayofkeyval'][-2] = $langs->trans("StatusMrpValidated").'+'.$langs->trans("StatusMrpProgress");
677 }
678 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
679 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
680 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1);
681 } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
682 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
683 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
684 print '<div class="nowrap">';
685 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
686 print '</div>';
687 print '<div class="nowrap">';
688 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
689 print '</div>';
690 }
691 print '</td>';
692 }
693}
694// Extra fields
695include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
696
697// Fields from hook
698$parameters = array('arrayfields' => $arrayfields);
699$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
700print $hookmanager->resPrint;
701// Action column
702if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
703 print '<td class="liste_titre center maxwidthsearch">';
704 $searchpicto = $form->showFilterButtons();
705 print $searchpicto;
706 print '</td>';
707}
708print '</tr>'."\n";
709
710$totalarray = array();
711$totalarray['nbfield'] = 0;
712
713
714// Fields title label
715// --------------------------------------------------------------------
716print '<tr class="liste_titre">';
717// Action column
718if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
719 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
720 $totalarray['nbfield']++;
721}
722foreach ($object->fields as $key => $val) {
723 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
724 if ($key == 'status') {
725 $cssforfield .= ($cssforfield ? ' ' : '').'center';
726 } elseif ($key == 'fk_parent_line') {
727 $cssforfield .= ($cssforfield ? ' ' : '').'center';
728 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
729 $cssforfield .= ($cssforfield ? ' ' : '').'center';
730 } elseif (in_array($val['type'], array('timestamp'))) {
731 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
732 } 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'])) {
733 $cssforfield .= ($cssforfield ? ' ' : '').'right';
734 }
735 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
736 if (!empty($arrayfields['t.'.$key]['checked'])) {
737 if ($key == "fk_product") {
738 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'p.ref', '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
739 } else {
740 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
741 }
742 $totalarray['nbfield']++;
743 }
744}
745// Extra fields
746include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
747// Hook fields
748$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
749$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
750print $hookmanager->resPrint;
751// Action column
752if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
753 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
754 $totalarray['nbfield']++;
755}
756print '</tr>'."\n";
757
758
759// Detect if we need a fetch on each output line
760$needToFetchEachLine = 0;
761if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
762 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
763 if (!is_null($val) && preg_match('/\$object/', $val)) {
764 $needToFetchEachLine++; // There is at least one compute field that use $object
765 }
766 }
767}
768
769
770$bom = new BOM($db);
771$product = new Product($db);
772
773// Loop on record
774// --------------------------------------------------------------------
775$i = 0;
776$savnbfield = $totalarray['nbfield'];
777$totalarray = array();
778$totalarray['nbfield'] = 0;
779$imaxinloop = ($limit ? min($num, $limit) : $num);
780while ($i < $imaxinloop) {
781 $obj = $db->fetch_object($resql);
782 if (empty($obj)) {
783 break; // Should not happen
784 }
785
786 // Store properties in $object
787 $object->setVarsFromFetchObj($obj);
788
789
790 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
791 if ($i == 0) {
792 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
793 print '<div class="box-flex-container kanban">';
794 }
795 //$object->type_id = $obj->type_id;
796
797 // TODO Use a cache on BOM
798 if ($obj->fk_bom > 0) {
799 $bom->fetch($obj->fk_bom);
800 }
801 if ($obj->fk_product > 0) {
802 $product->fetch($obj->fk_product);
803 }
804
805 // Output Kanban
806 $selected = -1;
807 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
808 $selected = 0;
809 if (in_array($object->id, $arrayofselected)) {
810 $selected = 1;
811 }
812 }
813 print $object->getKanbanView('', array('bom' => ($obj->fk_bom > 0 ? $bom : null), 'product' => ($obj->fk_product > 0 ? $product : null), 'selected' => $selected));
814 if ($i == ($imaxinloop - 1)) {
815 print '</div>';
816 print '</td></tr>';
817 }
818 } else {
819 // Show line of result
820 $j = 0;
821 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
822
823 // Action column
824 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
825 print '<td class="nowrap center">';
826 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
827 $selected = 0;
828 if (in_array($object->id, $arrayofselected)) {
829 $selected = 1;
830 }
831 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
832 }
833 print '</td>';
834 if (!$i) {
835 $totalarray['nbfield']++;
836 }
837 }
838 // Fields
839 foreach ($object->fields as $key => $val) {
840 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
841 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
842 $cssforfield .= ($cssforfield ? ' ' : '').'center';
843 } elseif ($key == 'status') {
844 $cssforfield .= ($cssforfield ? ' ' : '').'center';
845 } elseif ($key == 'fk_parent_line') {
846 $cssforfield .= ($cssforfield ? ' ' : '').'center';
847 }
848
849 if (in_array($val['type'], array('timestamp'))) {
850 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
851 } elseif ($key == 'ref') {
852 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
853 }
854
855 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'])) {
856 $cssforfield .= ($cssforfield ? ' ' : '').'right';
857 }
858
859 if (!empty($arrayfields['t.'.$key]['checked'])) {
860 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
861 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
862 print ' title="'.dolPrintHTMLForAttribute((string) $object->$key).'"';
863 }
864 print '>';
865 if ($key == 'status') {
866 print $object->getLibStatut(5);
867 } elseif ($key == 'fk_parent_line') {
868 $moparent = $object->getMoParent();
869 if (is_object($moparent)) {
870 print $moparent->getNomUrl(1);
871 }
872 } elseif ($key == 'rowid') {
873 print $object->showOutputField($val, $key, (string) $object->id, '');
874 } else {
875 if ($val['type'] == 'html') {
876 print '<div class="small lineheightsmall twolinesmax-normallineheight">';
877 }
878 print $object->showOutputField($val, $key, (string) $object->$key, '');
879 if ($val['type'] == 'html') {
880 print '</div>';
881 }
882
883 if ($key == 'date_end_planned' && $object->hasDelay()) {
884 print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
885 }
886 }
887 print '</td>';
888 if (!$i) {
889 $totalarray['nbfield']++;
890 }
891 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
892 if (!$i) {
893 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
894 }
895 if (!isset($totalarray['val'])) {
896 $totalarray['val'] = array();
897 }
898 if (!isset($totalarray['val']['t.'.$key])) {
899 $totalarray['val']['t.'.$key] = 0;
900 }
901 $totalarray['val']['t.'.$key] += $object->$key;
902 }
903 }
904 }
905 // Extra fields
906 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
907 // Fields from hook
908 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
909 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
910 print $hookmanager->resPrint;
911
912 // Action column
913 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
914 print '<td class="nowrap center">';
915 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
916 $selected = 0;
917 if (in_array($object->id, $arrayofselected)) {
918 $selected = 1;
919 }
920 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
921 }
922 print '</td>';
923 if (!$i) {
924 $totalarray['nbfield']++;
925 }
926 }
927
928 print '</tr>'."\n";
929 }
930 $i++;
931}
932
933// Show total line
934include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
935
936
937// If no record found
938if ($num == 0) {
939 $colspan = 1;
940 foreach ($arrayfields as $key => $val) {
941 if (!empty($val['checked'])) {
942 $colspan++;
943 }
944 }
945 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
946}
947
948
949$db->free($resql);
950
951$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
952$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
953print $hookmanager->resPrint;
954
955print '</table>'."\n";
956print '</div>'."\n";
957
958print '</form>'."\n";
959
960if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
961 $hidegeneratedfilelistifempty = 1;
962 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
963 $hidegeneratedfilelistifempty = 0;
964 }
965
966 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
967 $formfile = new FormFile($db);
968
969 // Show list of available documents
970 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
971 $urlsource .= str_replace('&amp;', '&', $param);
972
973 $filedir = $diroutputmassaction;
974 $genallowed = $permissiontoread;
975 $delallowed = $permissiontoadd;
976
977 print $formfile->showdocuments('massfilesarea_mrp', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
978}
979
980// End of page
981llxFooter();
982$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
$totalarray
Definition export.php:1206
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class for BOM.
Definition bom.class.php:42
Class to manage standard extra fields.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class for Mo.
Definition mo.class.php:35
Class to manage products or services.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.