dolibarr  13.0.2
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
3  * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
4  * Copyright (C) 2018 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2019-2021 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2019-2020 Laurent Destailleur <eldy@users.sourceforge.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
34 include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
35 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
36 include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
37 
38 // Load translation files required by the page
39 $langs->loadLangs(array("ticket", "companies", "other", "projects"));
40 
41 // Get parameters
42 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
43 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
44 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
45 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
46 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
47 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
48 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'ticketlist'; // To manage different context of search
49 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
50 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
51 
52 $id = GETPOST('id', 'int');
53 $msg_id = GETPOST('msg_id', 'int');
54 $socid = GETPOST('socid', 'int');
55 $projectid = GETPOST('projectid', 'int');
56 $project_ref = GETPOST('project_ref', 'alpha');
57 $search_societe = GETPOST('search_societe', 'alpha');
58 $search_fk_project = GETPOST('search_fk_project', 'int') ?GETPOST('search_fk_project', 'int') : GETPOST('projectid', 'int');
59 $search_fk_status = GETPOST('search_fk_statut', 'array');
60 $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
61 $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
62 $search_dateread_start = dol_mktime(0, 0, 0, GETPOST('search_dateread_startmonth', 'int'), GETPOST('search_dateread_startday', 'int'), GETPOST('search_dateread_startyear', 'int'));
63 $search_dateread_end = dol_mktime(23, 59, 59, GETPOST('search_dateread_endmonth', 'int'), GETPOST('search_dateread_endday', 'int'), GETPOST('search_dateread_endyear', 'int'));
64 $search_dateclose_start = dol_mktime(0, 0, 0, GETPOST('search_dateclose_startmonth', 'int'), GETPOST('search_dateclose_startday', 'int'), GETPOST('search_dateclose_startyear', 'int'));
65 $search_dateclose_end = dol_mktime(23, 59, 59, GETPOST('search_dateclose_endmonth', 'int'), GETPOST('search_dateclose_endday', 'int'), GETPOST('search_dateclose_endyear', 'int'));
66 
67 
68 $mode = GETPOST('mode', 'alpha');
69 
70 // Load variable for pagination
71 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
72 $sortfield = GETPOST('sortfield', 'aZ09comma');
73 $sortorder = GETPOST('sortorder', 'aZ09comma');
74 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
75 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
76 $offset = $limit * $page;
77 $pageprev = $page - 1;
78 $pagenext = $page + 1;
79 
80 // Initialize technical objects
81 $object = new Ticket($db);
82 $extrafields = new ExtraFields($db);
83 $diroutputmassaction = $conf->ticket->dir_output.'/temp/massgeneration/'.$user->id;
84 if ($socid > 0) $hookmanager->initHooks(array('thirdpartyticket'));
85 elseif ($projectid > 0) $hookmanager->initHooks(array('projectticket'));
86 else $hookmanager->initHooks(array('ticketlist'));
87 // Fetch optionals attributes and labels
88 $extrafields->fetch_name_optionals_label($object->table_element);
89 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
90 
91 // Default sort order (if not yet defined by previous GETPOST)
92 if (!$sortfield) $sortfield = "t.datec";
93 if (!$sortorder) $sortorder = "DESC";
94 
95 if (GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][] = 'openall'; // For backward compatibility
96 
97 // Initialize array of search criterias
98 $search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall'));
99 $search = array();
100 foreach ($object->fields as $key => $val)
101 {
102  if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
103 }
104 
105 // List of fields to search into when doing a "search in all"
106 $fieldstosearchall = array();
107 foreach ($object->fields as $key => $val)
108 {
109  if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
110 }
111 $fieldstosearchall['s.name_alias'] = "AliasNameShort";
112 $fieldstosearchall['s.zip'] = "Zip";
113 $fieldstosearchall['s.town'] = "Town";
114 
115 // Definition of fields for list
116 $arrayfields = array();
117 foreach ($object->fields as $key => $val)
118 {
119  // If $val['visible']==0, then we never show the field
120  if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
121 }
122 // Extra fields
123 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
124 
125 $object->fields = dol_sort_array($object->fields, 'position');
126 $arrayfields = dol_sort_array($arrayfields, 'position');
127 //if ($socid > 0) $arrayfields['t.fk_soc']['enabled']=0;
128 //if ($projectid > 0) $arrayfields['t.fk_project']['enabled']=0;
129 
130 
131 // Security check
132 if (!$user->rights->ticket->read) {
133  accessforbidden();
134 }
135 
136 // Store current page url
137 $url_page_current = dol_buildpath('/ticket/list.php', 1);
138 
139 if ($project_ref)
140 {
141  $tmpproject = new Project($db);
142  $tmpproject->fetch(0, $project_ref);
143  $projectid = $tmpproject->id;
144  $search_fk_project = $projectid;
145 }
146 
147 $permissiontoread = $user->rights->ticket->read;
148 $permissiontoadd = $user->rights->ticket->write;
149 $permissiontodelete = $user->rights->ticket->delete;
150 
151 $error = 0;
152 
153 
154 /*
155  * Actions
156  */
157 
158 if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
159 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
160 
161 $parameters = array();
162 if ($socid > 0) $parameters['socid'] = $socid;
163 if ($projectid > 0) $parameters['projectid'] = $projectid;
164 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
165 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
166 
167 if (empty($reshook))
168 {
169  // Selection of new fields
170  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
171 
172  // Purge search criteria
173  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
174  {
175  foreach ($object->fields as $key => $val)
176  {
177  $search[$key] = '';
178  }
179  $toselect = '';
180  $search_array_options = array();
181  $search_date_start = '';
182  $search_date_end = '';
183  $search_dateread_start = '';
184  $search_dateread_end = '';
185  $search_dateclose_start = '';
186  $search_dateclose_end = '';
187  }
188  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
189  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
190  {
191  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
192  }
193 
194  // Mass actions
195  $objectclass = 'Ticket';
196  $objectlabel = 'Ticket';
197  $uploaddir = $conf->ticket->dir_output;
198  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
199 
200  // Close records
201  if (!$error && $massaction == 'close' && $permissiontoadd)
202  {
203  $objecttmp = new $objectclass($db);
204  if (!$error)
205  {
206  $db->begin();
207 
208  $nbok = 0;
209  foreach ($toselect as $toselectid)
210  {
211  $result = $objecttmp->fetch($toselectid);
212  if ($result > 0)
213  {
214  $result = $objecttmp->close($user);
215  if ($result < 0)
216  {
217  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
218  $error++;
219  break;
220  } else $nbok++;
221  } else {
222  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
223  $error++;
224  break;
225  }
226  }
227 
228  if (!$error)
229  {
230  if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
231  else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
232  $db->commit();
233  } else {
234  $db->rollback();
235  }
236  //var_dump($listofobjectthirdparties);exit;
237  }
238  }
239 
240  // Reopen records
241  if (!$error && $massaction == 'reopen' && $permissiontoadd)
242  {
243  $objecttmp = new $objectclass($db);
244  if (!$error)
245  {
246  $db->begin();
247 
248  $nbok = 0;
249  foreach ($toselect as $toselectid)
250  {
251  $result = $objecttmp->fetch($toselectid);
252  if ($result > 0)
253  {
254  if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
255  $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED);
256  if ($result < 0)
257  {
258  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
259  $error++;
260  break;
261  } else $nbok++;
262  } else {
263  $langs->load("errors");
264  setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors');
265  $error++;
266  break;
267  }
268  } else {
269  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
270  $error++;
271  break;
272  }
273  }
274 
275  if (!$error)
276  {
277  if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
278  else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
279  $db->commit();
280  } else {
281  $db->rollback();
282  }
283  //var_dump($listofobjectthirdparties);exit;
284  }
285  }
286 }
287 
288 
289 
290 /*
291  * View
292  */
293 
294 $form = new Form($db);
295 $formTicket = new FormTicket($db);
296 
297 $now = dol_now();
298 
299 $user_assign = new User($db);
300 $user_create = new User($db);
301 $socstatic = new Societe($db);
302 
303 $help_url = '';
304 $title = $langs->trans('TicketList');
305 
306 
307 // Build and execute select
308 // --------------------------------------------------------------------
309 $sql = 'SELECT ';
310 foreach ($object->fields as $key => $val)
311 {
312  $sql .= 't.'.$key.', ';
313 }
314 // Add fields from extrafields
315 if (!empty($extrafields->attributes[$object->table_element]['label']))
316  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
317 // Add fields from hooks
318 $parameters = array();
319 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
320 $sql .= $hookmanager->resPrint;
321 $sql = preg_replace('/, $/', '', $sql);
322 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
323 if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
324 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
325 $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
326 if ($socid > 0)
327 {
328  $sql .= " AND t.fk_soc = ".$socid;
329 }
330 
331 foreach ($search as $key => $val)
332 {
333  if ($key == 'fk_statut' && !empty($search['fk_statut']))
334  {
335  $newarrayofstatus = array();
336  foreach ($search['fk_statut'] as $key2 => $val2) {
337  if (in_array($val2, array('openall', 'closeall'))) continue;
338  $newarrayofstatus[] = $val2;
339  }
340  if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) {
341  $newarrayofstatus[] = Ticket::STATUS_NOT_READ;
342  $newarrayofstatus[] = Ticket::STATUS_READ;
343  $newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
344  $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS;
345  $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
346  $newarrayofstatus[] = Ticket::STATUS_WAITING;
347  }
348  if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) {
349  $newarrayofstatus[] = Ticket::STATUS_CLOSED;
350  $newarrayofstatus[] = Ticket::STATUS_CANCELED;
351  }
352  if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2);
353  continue;
354  }
355  if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project')
356  {
357  if ($search[$key] > 0) $sql .= natural_search($key, $search[$key], 2);
358  continue;
359  }
360  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
361  if ($search[$key] != '') $sql .= natural_search($key, $search[$key], $mode_search);
362 }
363 if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
364 if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
365 if ($search_fk_project > 0) $sql .= natural_search('fk_project', $search_fk_project, 2);
366 if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
367 if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
368 if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";
369 if ($search_dateread_end) $sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'";
370 if ($search_dateclose_start) $sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'";
371 if ($search_dateclose_end) $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'";
372 
373 
374 if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
375  $sql .= " AND (t.fk_user_assign = ".$user->id;
376  if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql .= " OR t.fk_user_create = ".$user->id;
377  $sql .= ")";
378 }
379 
380 // Add where from extra fields
381 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
382 // Add where from hooks
383 $parameters = array();
384 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
385 $sql .= $hookmanager->resPrint;
386 
387 $sql .= $db->order($sortfield, $sortorder);
388 
389 // Count total nb of records
390 $nbtotalofrecords = '';
391 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
392 {
393  $resql = $db->query($sql);
394  $nbtotalofrecords = $db->num_rows($resql);
395  if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
396  {
397  $page = 0;
398  $offset = 0;
399  }
400 }
401 // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
402 if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
403 {
404  $num = $nbtotalofrecords;
405 } else {
406  $sql .= $db->plimit($limit + 1, $offset);
407 
408  $resql = $db->query($sql);
409  if (!$resql)
410  {
411  dol_print_error($db);
412  exit;
413  }
414 
415  $num = $db->num_rows($resql);
416 }
417 
418 // Direct jump if only one record found
419 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
420 {
421  $obj = $db->fetch_object($resql);
422  $id = $obj->rowid;
423  header("Location: ".DOL_URL_ROOT.'/ticket/card.php?id='.$id);
424  exit;
425 }
426 
427 
428 // Output page
429 // --------------------------------------------------------------------
430 
431 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
432 
433 
434 if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
435  $socstat = new Societe($db);
436  $res = $socstat->fetch($socid);
437  if ($res > 0) {
438  $tmpobject = $object;
439  $object = $socstat; // $object must be of type Societe when calling societe_prepare_head
440  $head = societe_prepare_head($socstat);
441  $object = $tmpobject;
442 
443  print dol_get_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), -1, 'company');
444 
445  dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
446 
447  print '<div class="fichecenter">';
448 
449  print '<div class="underbanner clearboth"></div>';
450  print '<table class="border centpercent tableforfield">';
451 
452  // Customer code
453  if ($socstat->client && !empty($socstat->code_client)) {
454  print '<tr><td class="titlefield">';
455  print $langs->trans('CustomerCode').'</td><td>';
456  print $socstat->code_client;
457  $tmpcheck = $socstat->check_codeclient();
458  if ($tmpcheck != 0 && $tmpcheck != -5) {
459  print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
460  }
461  print '</td>';
462  print '</tr>';
463  }
464  // Supplier code
465  if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
466  print '<tr><td class="titlefield">';
467  print $langs->trans('SupplierCode').'</td><td>';
468  print $socstat->code_fournisseur;
469  $tmpcheck = $socstat->check_codefournisseur();
470  if ($tmpcheck != 0 && $tmpcheck != -5) {
471  print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
472  }
473  print '</td>';
474  print '</tr>';
475  }
476 
477  print '</table>';
478  print '</div>';
480  }
481 }
482 
483 if ($projectid > 0 || $project_ref) {
484  $projectstat = new Project($db);
485  if ($projectstat->fetch($projectid, $project_ref) > 0) {
486  $projectid = $projectstat->id;
487  $projectstat->fetch_thirdparty();
488 
489  $savobject = $object;
490  $object = $projectstat;
491 
492  // To verify role of users
493  //$userAccess = $object->restrictedProjectArea($user,'read');
494  $userWrite = $projectstat->restrictedProjectArea($user, 'write');
495  //$userDelete = $object->restrictedProjectArea($user,'delete');
496  //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
497 
498  $head = project_prepare_head($projectstat);
499  print dol_get_fiche_head($head, 'ticket', $langs->trans("Project"), -1, ($projectstat->public ? 'projectpub' : 'project'));
500 
501  // Project card
502 
503  $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
504 
505  $morehtmlref = '<div class="refidno">';
506  // Title
507  $morehtmlref .= $object->title;
508  // Thirdparty
509  if ($object->thirdparty->id > 0)
510  {
511  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
512  }
513  $morehtmlref .= '</div>';
514 
515  // Define a complementary filter for search of next/prev ref.
516  if (!$user->rights->projet->all->lire)
517  {
518  $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
519  $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
520  }
521 
522  dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
523 
524  print '<div class="fichecenter">';
525  print '<div class="underbanner clearboth"></div>';
526 
527  print '<table class="border tableforfield" width="100%">';
528 
529  // Visibility
530  print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
531  if ($projectstat->public) {
532  print $langs->trans('SharedProject');
533  } else {
534  print $langs->trans('PrivateProject');
535  }
536  print '</td></tr>';
537 
538  print "</table>";
539 
540  print '</div>';
542 
543  $object = $savobject;
544  } else {
545  print "ErrorRecordNotFound";
546  }
547 }
548 
549 $arrayofselected = is_array($toselect) ? $toselect : array();
550 
551 $param = '';
552 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
553 if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
554 foreach ($search as $key => $val)
555 {
556  if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
557  else $param .= '&search_'.$key.'='.urlencode($search[$key]);
558 }
559 if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
560 // Add $param from extra fields
561 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
562 if ($socid) $param .= '&socid='.urlencode($socid);
563 if ($projectid) $param .= '&projectid='.urlencode($projectid);
564 
565 if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
566 if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
567 if ($search_dateread_start) $param .= '&search_dateread_start='.urlencode($search_dateread_start);
568 if ($search_dateread_end) $param .= '&search_dateread_end='.urlencode($search_dateread_end);
569 if ($search_dateclose_start) $param .= '&search_dateclose_start='.urlencode($search_dateclose_start);
570 if ($search_dateclose_end) $param .= '&search_dateclose_end='.urlencode($search_dateclose_end);
571 
572 // List of mass actions available
573 $arrayofmassactions = array(
574  //'presend'=>$langs->trans("SendByMail"),
575  //'builddoc'=>$langs->trans("PDFMerge"),
576 );
577 if ($user->rights->ticket->write) $arrayofmassactions['close'] = $langs->trans("Close");
578 if ($user->rights->ticket->write) $arrayofmassactions['reopen'] = $langs->trans("ReOpen");
579 if ($user->rights->ticket->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
580 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
581 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
582 
583 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
584 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
585 print '<input type="hidden" name="token" value="'.newToken().'">';
586 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
587 print '<input type="hidden" name="action" value="list">';
588 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
589 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
590 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
591 print '<input type="hidden" name="mode" value="'.$mode.'" >';
592 if ($socid) print '<input type="hidden" name="socid" value="'.$socid.'" >';
593 if ($projectid) print '<input type="hidden" name="projectid" value="'.$projectid.'" >';
594 
595 $url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : '');
596 if (!empty($socid)) $url .= '&socid='.$socid;
597 $newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write);
598 
599 $picto = 'ticket';
600 if ($socid > 0) $picto = '';
601 
602 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
603 
604 if ($mode == 'mine') {
605  print '<div class="opacitymedium">'.$langs->trans('TicketAssignedToMeInfos').'</div><br>';
606 }
607 // Add code for pre mass action (confirmation or email presend form)
608 $topicmail = "SendTicketRef";
609 $modelmail = "ticket";
610 $objecttmp = new Ticket($db);
611 $trackid = 'tic'.$object->id;
612 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
613 
614 if ($search_all)
615 {
616  foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
617  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
618 }
619 
620 $moreforfilter = '';
621 /*$moreforfilter.='<div class="divsearchfield">';
622 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
623 $moreforfilter.= '</div>';*/
624 
625 $parameters = array();
626 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
627 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
628 else $moreforfilter = $hookmanager->resPrint;
629 
630 if (!empty($moreforfilter))
631 {
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 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
639 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
640 
641 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
642 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
643 
644 
645 // Fields title search
646 // --------------------------------------------------------------------
647 print '<tr class="liste_titre">';
648 foreach ($object->fields as $key => $val)
649 {
650  $cssforfield = (empty($val['css']) ? '' : $val['css']);
651  if ($key == 'fk_statut') $cssforfield .= ($cssforfield ? ' ' : '').'center';
652  elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
653  elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
654  elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
655  if (!empty($arrayfields['t.'.$key]['checked'])) {
656  if ($key == 'type_code') {
657  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
658  $formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150'));
659  print '</td>';
660  } elseif ($key == 'category_code') {
661  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
662  $formTicket->selectGroupTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150'));
663  print '</td>';
664  } elseif ($key == 'severity_code') {
665  print '<td class="liste_titre center'.($cssforfield ? ' '.$cssforfield : '').'">';
666  $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150'));
667  print '</td>';
668  } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') {
669  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
670  print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth125'));
671  print '</td>';
672  } elseif ($key == 'fk_statut') {
673  $arrayofstatus = array();
674  $arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --';
675  foreach ($object->statuts_short as $key2 => $val2)
676  {
677  if ($key2 == Ticket::STATUS_CLOSED) $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --';
678  $arrayofstatus[$key2] = $val2;
679  }
680  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
681  //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key]));
682  $selectedarray = null;
683  if ($search[$key]) $selectedarray = array_values($search[$key]);
684  print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', '');
685  print '</td>';
686  } elseif ($key == "fk_soc") {
687  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
688  } elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close'){
689  print '<td class="liste_titre center">';
690  print '<div class="nowrap">';
691  switch ($key){
692  case 'datec':
693  print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
694  break;
695  case 'date_read':
696  print $form->selectDate($search_dateread_start ?: -1, 'search_dateread_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
697  break;
698  case 'date_close':
699  print $form->selectDate($search_dateclose_start ?: -1, 'search_dateclose_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
700  }
701  print '</div>';
702  print '<div class="nowrap">';
703  switch ($key){
704  case 'datec':
705  print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
706  break;
707  case 'date_read':
708  print $form->selectDate($search_dateread_end ?: -1, 'search_dateread_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
709  break;
710  case 'date_close':
711  print $form->selectDate($search_dateclose_end ?: -1, 'search_dateclose_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
712  }
713  print '</div>';
714  print '</td>';
715  }
716  else {
717  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
718  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
719  elseif (strpos($val['type'], 'integer:') === 0) {
720  print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
721  } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
722  print '</td>';
723  }
724  }
725 }
726 // Extra fields
727 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
728 
729 // Fields from hook
730 $parameters = array('arrayfields'=>$arrayfields);
731 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
732 print $hookmanager->resPrint;
733 // Action column
734 print '<td class="liste_titre maxwidthsearch">';
735 $searchpicto = $form->showFilterButtons();
736 print $searchpicto;
737 print '</td>';
738 print '</tr>'."\n";
739 
740 
741 // Fields title label
742 // --------------------------------------------------------------------
743 print '<tr class="liste_titre">';
744 foreach ($object->fields as $key => $val)
745 {
746  $cssforfield = (empty($val['css']) ? '' : $val['css']);
747  if ($key == 'fk_statut' || $key == 'severity_code') $cssforfield .= ($cssforfield ? ' ' : '').'center';
748  elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
749  elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
750  elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
751  if (!empty($arrayfields['t.'.$key]['checked']))
752  {
753  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
754  }
755 }
756 // Extra fields
757 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
758 // Hook fields
759 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
760 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
761 print $hookmanager->resPrint;
762 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n";
763 print '</tr>'."\n";
764 
765 
766 // Detect if we need a fetch on each output line
767 $needToFetchEachLine = 0;
768 if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
769 {
770  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
771  {
772  if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
773  }
774 }
775 
776 
777 // Loop on record
778 // --------------------------------------------------------------------
779 $i = 0;
780 $totalarray = array();
781 $cacheofoutputfield = array();
782 while ($i < min($num, $limit))
783 {
784  $obj = $db->fetch_object($resql);
785  if (empty($obj)) break; // Should not happen
786 
787  // Store properties in $object
788  $object->id = $obj->rowid;
789  foreach ($object->fields as $key => $val)
790  {
791  if (property_exists($obj, $key)) $object->$key = $obj->$key;
792  }
793  $langs->load("ticket");
794 
795  // Show here line of result
796  print '<tr class="oddeven">';
797  foreach ($object->fields as $key => $val)
798  {
799  $cssforfield = '';
800  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
801  if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
802  if (in_array($key, array('ref', 'fk_project'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
803  if ($key == 'fk_statut' || $key == 'severity_code') $cssforfield .= ($cssforfield ? ' ' : '').'center';
804  if (!empty($arrayfields['t.'.$key]['checked']))
805  {
806  print '<td';
807  if ($cssforfield || $val['css']) print ' class="';
808  print $cssforfield;
809  if ($cssforfield && $val['css']) print ' ';
810  print $val['css'];
811  if ($cssforfield || $val['css']) print '"';
812  print '>';
813  if ($key == 'fk_statut') print $object->getLibStatut(5);
814  elseif ($key == 'subject') {
815  $s = $obj->subject;
816  print '<span title="'.$s.'">';
817  print $s;
818  print '</span>';
819  }
820  elseif ($key == 'type_code') {
821  $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
822  print '<span title="'.$s.'">';
823  print $s;
824  print '</span>';
825  }
826  elseif ($key == 'category_code') {
827  $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
828  print '<span title="'.$s.'">';
829  print $s;
830  print '</span>';
831  }
832  elseif ($key == 'severity_code') {
833  $s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
834  print '<span title="'.$s.'">';
835  print $s;
836  print '</span>';
837  }
838  elseif ($key == 'tms') print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
839  elseif ($key == 'fk_user_create') {
840  if ($object->fk_user_create > 0) {
841  $user_create->fetch($object->fk_user_create);
842  print $user_create->getNomUrl(-1);
843  }
844  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
845  else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
846  $tmp = explode(':', $val['type']);
847  if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
848  // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making.
849  //var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']);
850  if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) {
851  $result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']];
852  } else {
853  $result = $object->showOutputField($val, $key, $obj->$key, '');
854  $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result;
855  }
856  } else {
857  $result = $object->showOutputField($val, $key, $obj->$key, '');
858  }
859  print $result;
860  }
861 
862  print '</td>';
863  if (!$i) $totalarray['nbfield']++;
864  if (!empty($val['isameasure']))
865  {
866  if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
867  $totalarray['val']['t.'.$key] += $obj->$key;
868  }
869  }
870  }
871  // Extra fields
872  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
873  // Fields from hook
874  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
875  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
876  print $hookmanager->resPrint;
877  // Action column
878  print '<td class="nowrap center">';
879  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
880  {
881  $selected = 0;
882  if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
883  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
884  }
885  print '</td>';
886  if (!$i) $totalarray['nbfield']++;
887 
888  print '</tr>';
889 
890  $i++;
891 }
892 
893 // Show total line
894 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
895 
896 
897 // If no record found
898 if ($num == 0)
899 {
900  $colspan = 1;
901  foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
902  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
903 }
904 
905 
906 $db->free($resql);
907 
908 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
909 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
910 print $hookmanager->resPrint;
911 
912 print '</table>'."\n";
913 print '</div>'."\n";
914 
915 print '</form>'."\n";
916 
917 
918 
919 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
920 {
921  $hidegeneratedfilelistifempty = 1;
922  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
923 
924  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
925  $formfile = new FormFile($db);
926 
927  // Show list of available documents
928  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
929  $urlsource .= str_replace('&amp;', '&', $param);
930 
931  $filedir = $diroutputmassaction;
932  $genallowed = $user->rights->ticket->read;
933  $delallowed = $user->rights->ticket->write;
934 
935  print $formfile->showdocuments('massfilesarea_ticket', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
936 }
937 
938 // End of page
939 llxFooter();
940 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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.
foreach($object->fields as $key=> $val) if(is_array($extrafields->attributes[$object->table_element]['label'])&&count($extrafields->attributes[$object->table_element]['label']) > 0) $object fields
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
Definition: user.class.php:44
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Class to manage ticket.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
Definition: notice.php:44
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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...
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Definition: company.lib.php:42
Class to offer components to list and upload files.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
Definition: project.lib.php:36
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss= '', $translate=0, $width=0, $moreattrib= '', $elemtype= '', $placeholder= '', $addjscombo=-1)
Show a multiselect form from an array.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
print $_SERVER["PHP_SELF"] n
Edit parameters.
Definition: categories.php:101
const STATUS_NOT_READ
Status.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...