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 // The start date can be set IF (the end date is empty OR the new date is BEFORE the existing end date).
266 if (empty($objMo->date_end_planned) || $newDate < $objMo->date_end_planned) {
267 $objMo->date_start_planned = $newDate;
268 } else {
269 setEventMessages($langs->trans('ErrorModifyMoDateStart', $objMo->ref), null, 'errors');
270 break;
271 }
272 } elseif ($action == 'changedateend_confirm') { // Test on permission not required
273 // The end date can be set IF (the start date is empty OR the new date is AFTER the existing start date).
274 if (empty($objMo->date_start_planned) || $newDate > $objMo->date_start_planned) {
275 $objMo->date_end_planned = $newDate;
276 } else {
277 setEventMessages($langs->trans('ErrorModifyMoDateEnd', $objMo->ref), null, 'errors');
278 break;
279 }
280 }
281 if ($objMo->update($user)) {
282 setEventMessages($langs->trans('ModifyMoDate', $objMo->ref), null, 'mesgs');
283 } else {
284 setEventMessages($langs->trans('ErrorModifyMoDate', $objMo->ref), null, 'errors');
285 }
286 } else {
287 setEventMessages($langs->trans('ErrorEmptyChangeDate'), null, 'errors');
288 break;
289 }
290 }
291 }
292 }
293 }
294 }
295}
296
297
298
299/*
300 * View
301 */
302
303$form = new Form($db);
304
305$now = dol_now();
306
307$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
308$title = $langs->trans('ListOfManufacturingOrders');
309$morejs = array();
310$morecss = array();
311
312
313// Build and execute select
314// --------------------------------------------------------------------
315$sql = "SELECT ";
316$sql .= " ".$object->getFieldList('t');
317// Add fields from extrafields
318if (!empty($extrafields->attributes[$object->table_element]['label'])) {
319 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
320 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
321 }
322}
323// Add fields from hooks
324$parameters = array();
325$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
326$sql .= $hookmanager->resPrint;
327$sql = preg_replace('/,\s*$/', '', $sql);
328
329$sqlfields = $sql; // $sql fields to remove for count total
330
331$sql .= " FROM ".$db->prefix().$object->table_element." as t";
332if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
333 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
334}
335$sql .= " LEFT JOIN ".$db->prefix()."mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid";
336$sql .= " LEFT JOIN ".$db->prefix()."mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid";
337$sql .= " LEFT JOIN ".$db->prefix()."product as p ON t.fk_product = p.rowid";
338// Add table from hooks
339$parameters = array();
340$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
341$sql .= $hookmanager->resPrint;
342if ($object->ismultientitymanaged == 1) {
343 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
344} else {
345 $sql .= " WHERE 1 = 1";
346}
347
348foreach ($search as $key => $val) {
349 if (array_key_exists($key, $object->fields)) {
350 if ($key == 'status' && $search[$key] == -1) {
351 continue;
352 }
353 if ($key == 'status' && $search[$key] == -2) {
354 $sql .= " AND (t.status IN (".$db->sanitize($object::STATUS_VALIDATED.",".$object::STATUS_INPROGRESS)."))";
355 if ($search_option == 'late') {
356 $sql .= " AND (t.date_end_planned < '".$db->idate(dol_now() - $conf->mrp->progress->warning_delay)."')";
357 }
358 continue;
359 }
360 if ($key == 'fk_parent_line' && $search[$key] != '') {
361 $sql .= natural_search('moparent.ref', $search[$key], 0);
362 continue;
363 }
364 if ($key == 'status') {
365 $sql .= natural_search('t.status', (string) $search[$key], 1);
366 continue;
367 }
368
369 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
370 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
371 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
372 $search[$key] = '';
373 }
374 $mode_search = 2;
375 }
376 if ($search[$key] != '') {
377 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
378 }
379 } else {
380 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
381 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
382 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
383 if (preg_match('/_dtstart$/', $key)) {
384 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
385 }
386 if (preg_match('/_dtend$/', $key)) {
387 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
388 }
389 }
390 }
391 }
392}
393
394
395if ($search_all) {
396 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
397}
398
399
400
401//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
402// Add where from extra fields
403include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
404// Add where from hooks
405$parameters = array();
406$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
407$sql .= $hookmanager->resPrint;
408/* If a group by is required
409$sql.= " GROUP BY ";
410foreach($object->fields as $key => $val) {
411 $sql .= "t.".$db->sanitize($key).", ";
412}
413// Add fields from extrafields
414if (!empty($extrafields->attributes[$object->table_element]['label'])) {
415 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
416 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
417 }
418}
419// Add groupby from hooks
420$parameters=array();
421$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
422$sql.=$hookmanager->resPrint;
423$sql=preg_replace('/,\s*$/','', $sql);
424*/
425
426// Count total nb of records
427$nbtotalofrecords = '';
428if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
429 /* The fast and low memory method to get and count full list converts the sql into a sql count */
430 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
431 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
432 $resql = $db->query($sqlforcount);
433 if ($resql) {
434 $objforcount = $db->fetch_object($resql);
435 $nbtotalofrecords = $objforcount->nbtotalofrecords;
436 } else {
437 dol_print_error($db);
438 }
439
440 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
441 $page = 0;
442 $offset = 0;
443 }
444 $db->free($resql);
445}
446
447// Complete request and execute it with limit
448$sql .= $db->order($sortfield, $sortorder);
449if ($limit) {
450 $sql .= $db->plimit($limit + 1, $offset);
451}
452$resql = $db->query($sql);
453if (!$resql) {
454 dol_print_error($db);
455 exit;
456}
457
458$num = $db->num_rows($resql);
459
460// Direct jump if only one record found
461if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
462 $obj = $db->fetch_object($resql);
463 $id = $obj->rowid;
464 header("Location: ".dol_buildpath('/mrp/mo_card.php', 1).'?id='.((int) $id));
465 exit;
466}
467
468
469// Output page
470// --------------------------------------------------------------------
471
472llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-mrp page-list');
473
474
475$arrayofselected = is_array($toselect) ? $toselect : array();
476
477$param = '';
478if (!empty($mode)) {
479 $param .= '&mode='.urlencode($mode);
480}
481if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
482 $param .= '&contextpage='.urlencode($contextpage);
483}
484if ($limit > 0 && $limit != $conf->liste_limit) {
485 $param .= '&limit='.((int) $limit);
486}
487if ($optioncss != '') {
488 $param .= '&optioncss='.urlencode($optioncss);
489}
490if ($groupby != '') {
491 $param .= '&groupby='.urlencode($groupby);
492}
493foreach ($search as $key => $val) {
494 if (is_array($search[$key])) {
495 foreach ($search[$key] as $skey) {
496 if ($skey != '') {
497 $param .= '&search_'.$key.'[]='.urlencode($skey);
498 }
499 }
500 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
501 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
502 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
503 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
504 } elseif ($search[$key] != '') {
505 $param .= '&search_'.$key.'='.urlencode($search[$key]);
506 }
507}
508// Add $param from extra fields
509include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
510// Add $param from hooks
511$parameters = array('param' => &$param);
512$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
513$param .= $hookmanager->resPrint;
514
515// List of mass actions available
516$arrayofmassactions = array(
517 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
518 'precancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"),
519 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
520 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
521 'predatestart'=>img_picto('', 'object_calendar', 'class="pictofixedwidth"').$langs->trans("MoChangeDateStart"),
522 'predateend'=>img_picto('', 'object_calendar', 'class="pictofixedwidth"').$langs->trans("MoChangeDateEnd"),
523 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
524);
525if (!empty($permissiontodelete)) {
526 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
527}
528if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
529 $arrayofmassactions = array();
530}
531$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
532
533print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
534if ($optioncss != '') {
535 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
536}
537print '<input type="hidden" name="token" value="'.newToken().'">';
538print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
539print '<input type="hidden" name="action" value="list">';
540print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
541print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
542print '<input type="hidden" name="page" value="'.$page.'">';
543print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
544print '<input type="hidden" name="page_y" value="">';
545print '<input type="hidden" name="mode" value="'.$mode.'">';
546
547$newcardbutton = '';
548$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'));
549$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'));
550$newcardbutton .= dolGetButtonTitleSeparator();
551$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
552
553print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
554
555// Add code for pre mass action (confirmation or email presend form)
556$topicmail = "SendMoRef";
557$modelmail = "mo";
558$objecttmp = new Mo($db);
559$trackid = 'mo'.$object->id;
560include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
561
562if ($massaction == 'precancel') {
563 $formquestion = array(
564 array(
565 'label' => $langs->trans('MoCancelConsumedAndProducedLines'),
566 'name' => 'alsoCancelConsumedAndProducedLines',
567 'type' => 'checkbox',
568 'value' => 0
569 ),
570 );
571
572 print $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'],
573 $langs->trans('CancelMo'),
574 $langs->trans('ConfirmCancelMo'),
575 'confirm_cancel', $formquestion,
576 1, 0, 200, 500, 1);
577}
578
579if ($massaction == 'predatestart') {
580 $formquestion = array(
581 array(
582 'type' => 'datetime',
583 'tdclass' => 'fieldrequired',
584 'name' => 'change_date',
585 'label' => $langs->trans('ModifyDateStart'),
586 'value' => -1),
587 );
588 print $form->formconfirm($_SERVER['PHP_SELF'],
589 $langs->trans('ConfirmMassChangeDateStart'),
590 $langs->trans('ConfirmMassChangeDateStartQuestion',
591 count($toselect)), 'changedatestart_confirm', $formquestion,
592 '', 0, 200, 500, 1);
593}
594
595if ($massaction == 'predateend') {
596 $formquestion = array(
597 array(
598 'type' => 'datetime',
599 'tdclass' => 'fieldrequired',
600 'name' => 'change_date',
601 'label' => $langs->trans('ModifyDateEnd'),
602 'value' => -1),
603 );
604 print $form->formconfirm($_SERVER['PHP_SELF'],
605 $langs->trans('ConfirmMassChangeDateEnd'),
606 $langs->trans('ConfirmMassChangeDateEndQuestion',
607 count($toselect)), 'changedateend_confirm', $formquestion,
608 '', 0, 200, 500, 1);
609}
610
611if ($search_all) {
612 foreach ($fieldstosearchall as $key => $val) {
613 $fieldstosearchall[$key] = $langs->trans($val);
614 }
615 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
616}
617
618$moreforfilter = '';
619/*$moreforfilter.='<div class="divsearchfield">';
620$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
621$moreforfilter.= '</div>';*/
622
623$parameters = array();
624$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
625if (empty($reshook)) {
626 $moreforfilter .= $hookmanager->resPrint;
627} else {
628 $moreforfilter = $hookmanager->resPrint;
629}
630
631if (!empty($moreforfilter)) {
632 print '<div class="liste_titre liste_titre_bydiv centpercent">';
633 print $moreforfilter;
634 print '</div>';
635}
636
637$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
638$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
639$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
640$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
641
642print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
643print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
644
645
646// Fields title search
647// --------------------------------------------------------------------
648print '<tr class="liste_titre_filter">';
649// Action column
650if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
651 print '<td class="liste_titre center maxwidthsearch">';
652 $searchpicto = $form->showFilterButtons('left');
653 print $searchpicto;
654 print '</td>';
655}
656foreach ($object->fields as $key => $val) {
657 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
658 if ($key == 'status') {
659 $cssforfield .= ($cssforfield ? ' ' : '').'center';
660 } elseif ($key == 'fk_parent_line') {
661 $cssforfield .= ($cssforfield ? ' ' : '').'center';
662 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
663 $cssforfield .= ($cssforfield ? ' ' : '').'center';
664 } elseif (in_array($val['type'], array('timestamp'))) {
665 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
666 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
667 $cssforfield .= ($cssforfield ? ' ' : '').'right';
668 }
669 if (!empty($arrayfields['t.'.$key]['checked'])) {
670 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
671 if ($key == 'fk_parent_line') {
672 print '<input type="text" class="flat maxwidth75" name="search_fk_parent_line">';
673 print '</td>';
674 continue;
675 }
676 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
677 if ($key == 'status') {
678 $val['arrayofkeyval'][-2] = $langs->trans("StatusMrpValidated").'+'.$langs->trans("StatusMrpProgress");
679 }
680 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
681 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
682 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1);
683 } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
684 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
685 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
686 print '<div class="nowrap">';
687 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
688 print '</div>';
689 print '<div class="nowrap">';
690 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
691 print '</div>';
692 }
693 print '</td>';
694 }
695}
696// Extra fields
697include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
698
699// Fields from hook
700$parameters = array('arrayfields' => $arrayfields);
701$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
702print $hookmanager->resPrint;
703// Action column
704if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
705 print '<td class="liste_titre center maxwidthsearch">';
706 $searchpicto = $form->showFilterButtons();
707 print $searchpicto;
708 print '</td>';
709}
710print '</tr>'."\n";
711
712$totalarray = array();
713$totalarray['nbfield'] = 0;
714
715
716// Fields title label
717// --------------------------------------------------------------------
718print '<tr class="liste_titre">';
719// Action column
720if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
721 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
722 $totalarray['nbfield']++;
723}
724foreach ($object->fields as $key => $val) {
725 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
726 if ($key == 'status') {
727 $cssforfield .= ($cssforfield ? ' ' : '').'center';
728 } elseif ($key == 'fk_parent_line') {
729 $cssforfield .= ($cssforfield ? ' ' : '').'center';
730 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
731 $cssforfield .= ($cssforfield ? ' ' : '').'center';
732 } elseif (in_array($val['type'], array('timestamp'))) {
733 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
734 } 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'])) {
735 $cssforfield .= ($cssforfield ? ' ' : '').'right';
736 }
737 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
738 if (!empty($arrayfields['t.'.$key]['checked'])) {
739 if ($key == "fk_product") {
740 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'p.ref', '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
741 } else {
742 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
743 }
744 $totalarray['nbfield']++;
745 }
746}
747// Extra fields
748include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
749// Hook fields
750$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
751$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
752print $hookmanager->resPrint;
753// Action column
754if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
755 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
756 $totalarray['nbfield']++;
757}
758print '</tr>'."\n";
759
760
761// Detect if we need a fetch on each output line
762$needToFetchEachLine = 0;
763if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
764 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
765 if (!is_null($val) && preg_match('/\$object/', $val)) {
766 $needToFetchEachLine++; // There is at least one compute field that use $object
767 }
768 }
769}
770
771
772$bom = new BOM($db);
773$product = new Product($db);
774
775// Loop on record
776// --------------------------------------------------------------------
777$i = 0;
778$savnbfield = $totalarray['nbfield'];
779$totalarray = array();
780$totalarray['nbfield'] = 0;
781$imaxinloop = ($limit ? min($num, $limit) : $num);
782while ($i < $imaxinloop) {
783 $obj = $db->fetch_object($resql);
784 if (empty($obj)) {
785 break; // Should not happen
786 }
787
788 // Store properties in $object
789 $object->setVarsFromFetchObj($obj);
790
791
792 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
793 if ($i == 0) {
794 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
795 print '<div class="box-flex-container kanban">';
796 }
797 //$object->type_id = $obj->type_id;
798
799 // TODO Use a cache on BOM
800 if ($obj->fk_bom > 0) {
801 $bom->fetch($obj->fk_bom);
802 }
803 if ($obj->fk_product > 0) {
804 $product->fetch($obj->fk_product);
805 }
806
807 // Output Kanban
808 $selected = -1;
809 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
810 $selected = 0;
811 if (in_array($object->id, $arrayofselected)) {
812 $selected = 1;
813 }
814 }
815 print $object->getKanbanView('', array('bom' => ($obj->fk_bom > 0 ? $bom : null), 'product' => ($obj->fk_product > 0 ? $product : null), 'selected' => $selected));
816 if ($i == ($imaxinloop - 1)) {
817 print '</div>';
818 print '</td></tr>';
819 }
820 } else {
821 // Show line of result
822 $j = 0;
823 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
824
825 // Action column
826 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
827 print '<td class="nowrap center">';
828 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
829 $selected = 0;
830 if (in_array($object->id, $arrayofselected)) {
831 $selected = 1;
832 }
833 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
834 }
835 print '</td>';
836 if (!$i) {
837 $totalarray['nbfield']++;
838 }
839 }
840 // Fields
841 foreach ($object->fields as $key => $val) {
842 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
843 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
844 $cssforfield .= ($cssforfield ? ' ' : '').'center';
845 } elseif ($key == 'status') {
846 $cssforfield .= ($cssforfield ? ' ' : '').'center';
847 } elseif ($key == 'fk_parent_line') {
848 $cssforfield .= ($cssforfield ? ' ' : '').'center';
849 }
850
851 if (in_array($val['type'], array('timestamp'))) {
852 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
853 } elseif ($key == 'ref') {
854 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
855 }
856
857 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'])) {
858 $cssforfield .= ($cssforfield ? ' ' : '').'right';
859 }
860
861 if (!empty($arrayfields['t.'.$key]['checked'])) {
862 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
863 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
864 print ' title="'.dolPrintHTMLForAttribute((string) $object->$key).'"';
865 }
866 print '>';
867 if ($key == 'status') {
868 print $object->getLibStatut(5);
869 } elseif ($key == 'fk_parent_line') {
870 $moparent = $object->getMoParent();
871 if (is_object($moparent)) {
872 print $moparent->getNomUrl(1);
873 }
874 } elseif ($key == 'rowid') {
875 print $object->showOutputField($val, $key, (string) $object->id, '');
876 } else {
877 if ($val['type'] == 'html') {
878 print '<div class="small lineheightsmall twolinesmax-normallineheight">';
879 }
880 print $object->showOutputField($val, $key, (string) $object->$key, '');
881 if ($val['type'] == 'html') {
882 print '</div>';
883 }
884
885 if ($key == 'date_end_planned' && $object->hasDelay()) {
886 print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
887 }
888 }
889 print '</td>';
890 if (!$i) {
891 $totalarray['nbfield']++;
892 }
893 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
894 if (!$i) {
895 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
896 }
897 if (!isset($totalarray['val'])) {
898 $totalarray['val'] = array();
899 }
900 if (!isset($totalarray['val']['t.'.$key])) {
901 $totalarray['val']['t.'.$key] = 0;
902 }
903 $totalarray['val']['t.'.$key] += $object->$key;
904 }
905 }
906 }
907 // Extra fields
908 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
909 // Fields from hook
910 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
911 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
912 print $hookmanager->resPrint;
913
914 // Action column
915 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
916 print '<td class="nowrap center">';
917 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
918 $selected = 0;
919 if (in_array($object->id, $arrayofselected)) {
920 $selected = 1;
921 }
922 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
923 }
924 print '</td>';
925 if (!$i) {
926 $totalarray['nbfield']++;
927 }
928 }
929
930 print '</tr>'."\n";
931 }
932 $i++;
933}
934
935// Show total line
936include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
937
938
939// If no record found
940if ($num == 0) {
941 $colspan = 1;
942 foreach ($arrayfields as $key => $val) {
943 if (!empty($val['checked'])) {
944 $colspan++;
945 }
946 }
947 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
948}
949
950
951$db->free($resql);
952
953$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
954$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
955print $hookmanager->resPrint;
956
957print '</table>'."\n";
958print '</div>'."\n";
959
960print '</form>'."\n";
961
962if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
963 $hidegeneratedfilelistifempty = 1;
964 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
965 $hidegeneratedfilelistifempty = 0;
966 }
967
968 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
969 $formfile = new FormFile($db);
970
971 // Show list of available documents
972 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
973 $urlsource .= str_replace('&amp;', '&', $param);
974
975 $filedir = $diroutputmassaction;
976 $genallowed = $permissiontoread;
977 $delallowed = $permissiontoadd;
978
979 print $formfile->showdocuments('massfilesarea_mrp', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
980}
981
982// End of page
983llxFooter();
984$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.