dolibarr  x.y.z
services_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
6  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
7  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
8  * Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
30 require "../main.inc.php";
31 require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php";
32 require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
33 require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array('products', 'contracts', 'companies'));
37 
38 $optioncss = GETPOST('optioncss', 'aZ09');
39 
40 $massaction = GETPOST('massaction', 'alpha');
41 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
42 $sortfield = GETPOST('sortfield', 'aZ09comma');
43 $sortorder = GETPOST('sortorder', 'aZ09comma');
44 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
45 if (empty($page) || $page == -1) {
46  $page = 0;
47 } // If $page is not defined, or '' or -1
48 $offset = $limit * $page;
49 $pageprev = $page - 1;
50 $pagenext = $page + 1;
51 if (!$sortfield) {
52  $sortfield = "c.rowid";
53 }
54 if (!$sortorder) {
55  $sortorder = "ASC";
56 }
57 
58 $mode = GETPOST("mode");
59 $filter = GETPOST("filter");
60 $search_name = GETPOST("search_name", 'alpha');
61 $search_contract = GETPOST("search_contract", 'alpha');
62 $search_service = GETPOST("search_service", 'alpha');
63 $search_status = GETPOST("search_status", 'alpha');
64 $search_product_category = GETPOST('search_product_category', 'int');
65 $socid = GETPOST('socid', 'int');
66 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractservicelist'.$mode;
67 
68 $opouvertureprevuemonth = GETPOST('opouvertureprevuemonth');
69 $opouvertureprevueday = GETPOST('opouvertureprevueday');
70 $opouvertureprevueyear = GETPOST('opouvertureprevueyear');
71 $filter_opouvertureprevue = GETPOST('filter_opouvertureprevue');
72 
73 $op1month = GETPOST('op1month', 'int');
74 $op1day = GETPOST('op1day', 'int');
75 $op1year = GETPOST('op1year', 'int');
76 $filter_op1 = GETPOST('filter_op1', 'alpha');
77 
78 $op2month = GETPOST('op2month', 'int');
79 $op2day = GETPOST('op2day', 'int');
80 $op2year = GETPOST('op2year', 'int');
81 $filter_op2 = GETPOST('filter_op2', 'alpha');
82 
83 $opcloturemonth = GETPOST('opcloturemonth', 'int');
84 $opclotureday = GETPOST('opclotureday', 'int');
85 $opclotureyear = GETPOST('opclotureyear', 'int');
86 $filter_opcloture = GETPOST('filter_opcloture', 'alpha');
87 
88 
89 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
90 $object = new ContratLigne($db);
91 $hookmanager->initHooks(array('contractservicelist'));
92 $extrafields = new ExtraFields($db);
93 
94 // fetch optionals attributes and labels
95 $extrafields->fetch_name_optionals_label($object->table_element);
96 
97 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
98 
99 // Security check
100 $contratid = GETPOST('id', 'int');
101 if (!empty($user->socid)) {
102  $socid = $user->socid;
103 }
104 $result = restrictedArea($user, 'contrat', $contratid);
105 
106 if ($search_status != '') {
107  $tmp = explode('&', $search_status);
108  $mode = $tmp[0];
109  if (empty($tmp[1])) {
110  $filter = '';
111  } else {
112  if ($tmp[1] == 'filter=notexpired') {
113  $filter = 'notexpired';
114  }
115  if ($tmp[1] == 'filter=expired') {
116  $filter = 'expired';
117  }
118  }
119 } else {
120  $search_status = $mode;
121  if ($filter == 'expired') {
122  $search_status .= '&filter=expired';
123  }
124  if ($filter == 'notexpired') {
125  $search_status .= '&filter=notexpired';
126  }
127 }
128 
129 $staticcontrat = new Contrat($db);
130 $staticcontratligne = new ContratLigne($db);
131 $companystatic = new Societe($db);
132 
133 $arrayfields = array(
134  'c.ref'=>array('label'=>"Contract", 'checked'=>1, 'position'=>80),
135  'p.description'=>array('label'=>"Service", 'checked'=>1, 'position'=>80),
136  's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>90),
137  'cd.tva_tx'=>array('label'=>"VATRate", 'checked'=>-1, 'position'=>100),
138  'cd.subprice'=>array('label'=>"PriceUHT", 'checked'=>-1, 'position'=>105),
139  'cd.qty'=>array('label'=>"Qty", 'checked'=>-1, 'position'=>108),
140  'cd.total_ht'=>array('label'=>"TotalHT", 'checked'=>-1, 'position'=>109),
141  'cd.total_tva'=>array('label'=>"TotalVAT", 'checked'=>-1, 'position'=>110),
142  'cd.date_ouverture_prevue'=>array('label'=>"DateStartPlannedShort", 'checked'=>(($mode == "" || $mode == -1) || $mode == "0"), 'position'=>150),
143  'cd.date_ouverture'=>array('label'=>"DateStartRealShort", 'checked'=>(($mode == "" || $mode == -1) || $mode > 0), 'position'=>160),
144  'cd.date_fin_validite'=>array('label'=>"DateEndPlannedShort", 'checked'=>(($mode == "" || $mode == -1) || $mode < 5), 'position'=>170),
145  'cd.date_cloture'=>array('label'=>"DateEndRealShort", 'checked'=>(($mode == "" || $mode == -1) || $mode >= 5), 'position'=>180),
146  //'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
147  'cd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
148  'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
149 );
150 // Extra fields
151 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
152 
153 $object->fields = dol_sort_array($object->fields, 'position');
154 $arrayfields = dol_sort_array($arrayfields, 'position');
155 
156 
157 
158 
159 /*
160  * Actions
161  */
162 
163 if (GETPOST('cancel', 'alpha')) {
164  $action = 'list'; $massaction = '';
165 }
166 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
167  $massaction = '';
168 }
169 
170 $parameters = array('socid'=>$socid);
171 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
172 if ($reshook < 0) {
173  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
174 }
175 
176 if (empty($reshook)) {
177  // Selection of new fields
178  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
179 
180  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
181  $search_product_category = 0;
182  $search_name = "";
183  $search_contract = "";
184  $search_service = "";
185  $search_status = -1;
186  $opouvertureprevuemonth = "";
187  $opouvertureprevueday = "";
188  $opouvertureprevueyear = "";
189  $filter_opouvertureprevue = "";
190  $op1month = "";
191  $op1day = "";
192  $op1year = "";
193  $filter_op1 = "";
194  $op2month = "";
195  $op2day = "";
196  $op2year = "";
197  $filter_op2 = "";
198  $opcloturemonth = "";
199  $opclotureday = "";
200  $opclotureyear = "";
201  $filter_opcloture = "";
202  $mode = '';
203  $filter = '';
204  $toselect = array();
205  $search_array_options = array();
206  }
207 }
208 
209 
210 /*
211  * View
212  */
213 
214 $now = dol_now();
215 
216 $form = new Form($db);
217 
218 $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref_supplier,";
219 $sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
220 $sql .= " cd.rowid, cd.description, cd.statut,";
221 $sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.tobuy, p.tosell, p.barcode, p.entity as pentity,";
222 if (empty($user->rights->societe->client->voir) && !$socid) {
223  $sql .= " sc.fk_soc, sc.fk_user,";
224 }
225 $sql .= " cd.date_ouverture_prevue,";
226 $sql .= " cd.date_ouverture,";
227 $sql .= " cd.date_fin_validite,";
228 $sql .= " cd.date_cloture,";
229 $sql .= " cd.qty,";
230 $sql .= " cd.total_ht,";
231 $sql .= " cd.total_tva,";
232 $sql .= " cd.tva_tx,";
233 $sql .= " cd.subprice,";
234 //$sql.= " cd.date_c as date_creation,";
235 $sql .= " cd.tms as date_update";
236 // Add fields from extrafields
237 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
238  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
239  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
240  }
241 }
242 // Add fields from hooks
243 $parameters = array();
244 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
245 $sql .= $hookmanager->resPrint;
246 $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c,";
247 $sql .= " ".MAIN_DB_PREFIX."societe as s,";
248 if (empty($user->rights->societe->client->voir) && !$socid) {
249  $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
250 }
251 $sql .= " ".MAIN_DB_PREFIX."contratdet as cd";
252 if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
253  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)";
254 }
255 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
256 if ($search_product_category > 0) {
257  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
258 }
259 $sql .= " WHERE c.entity = ".$conf->entity;
260 $sql .= " AND c.rowid = cd.fk_contrat";
261 if ($search_product_category > 0) {
262  $sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
263 }
264 $sql .= " AND c.fk_soc = s.rowid";
265 if (empty($user->rights->societe->client->voir) && !$socid) {
266  $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
267 }
268 if ($mode == "0") {
269  $sql .= " AND cd.statut = 0";
270 }
271 if ($mode == "4") {
272  $sql .= " AND cd.statut = 4";
273 }
274 if ($mode == "5") {
275  $sql .= " AND cd.statut = 5";
276 }
277 if ($filter == "expired") {
278  $sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
279 }
280 if ($filter == "notexpired") {
281  $sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
282 }
283 if ($search_name) {
284  $sql .= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
285 }
286 if ($search_contract) {
287  $sql .= " AND c.ref LIKE '%".$db->escape($search_contract)."%' ";
288 }
289 if ($search_service) {
290  $sql .= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
291 }
292 if ($socid > 0) {
293  $sql .= " AND s.rowid = ".((int) $socid);
294 }
295 
296 $filter_dateouvertureprevue = '';
297 $filter_date1 = '';
298 $filter_date2 = '';
299 $filter_opcloture = '';
300 
301 $filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
302 $filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
303 if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) {
304  $filter_opouvertureprevue = ' BETWEEN ';
305 }
306 
307 $filter_date1_start = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
308 $filter_date1_end = dol_mktime(23, 59, 59, $op1month, $op1day, $op1year);
309 if ($filter_date1_start != '' && $filter_op1 == -1) {
310  $filter_op1 = ' BETWEEN ';
311 }
312 
313 $filter_date2_start = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
314 $filter_date2_end = dol_mktime(23, 59, 59, $op2month, $op2day, $op2year);
315 if ($filter_date2_start != '' && $filter_op2 == -1) {
316  $filter_op2 = ' BETWEEN ';
317 }
318 
319 $filter_datecloture_start = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
320 $filter_datecloture_end = dol_mktime(23, 59, 59, $opcloturemonth, $opclotureday, $opclotureyear);
321 if ($filter_datecloture_start != '' && $filter_opcloture == -1) {
322  $filter_opcloture = ' BETWEEN ';
323 }
324 
325 if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_opouvertureprevue != ' BETWEEN ' && $filter_dateouvertureprevue_start != '') {
326  $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
327 }
328 if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') {
329  $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."' AND '".$db->idate($filter_dateouvertureprevue_end)."'";
330 }
331 if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') {
332  $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
333 }
334 if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') {
335  $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."' AND '".$db->idate($filter_date1_end)."'";
336 }
337 if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') {
338  $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
339 }
340 if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') {
341  $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."' AND '".$db->idate($filter_date2_end)."'";
342 }
343 if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') {
344  $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
345 }
346 if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
347  $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."' AND '".$db->idate($filter_datecloture_end)."'";
348 }
349 // Add where from extra fields
350 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
351 $sql .= $db->order($sortfield, $sortorder);
352 
353 //print $sql;
354 
355 $nbtotalofrecords = '';
356 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
357  $result = $db->query($sql);
358  $nbtotalofrecords = $db->num_rows($result);
359  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
360  $page = 0;
361  $offset = 0;
362  }
363 }
364 
365 $sql .= $db->plimit($limit + 1, $offset);
366 
367 //print $sql;
368 dol_syslog("contrat/services_list.php", LOG_DEBUG);
369 $resql = $db->query($sql);
370 if (!$resql) {
371  dol_print_error($db);
372  exit;
373 }
374 
375 $num = $db->num_rows($resql);
376 
377 /*
378 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
379 {
380  $obj = $db->fetch_object($resql);
381  $id = $obj->id;
382  header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
383  exit;
384 }*/
385 
386 llxHeader(null, $langs->trans("Services"));
387 
388 $param = '';
389 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
390  $param .= '&contextpage='.urlencode($contextpage);
391 }
392 if ($limit > 0 && $limit != $conf->liste_limit) {
393  $param .= '&limit='.$limit;
394 }
395 if ($search_contract) {
396  $param .= '&amp;search_contract='.urlencode($search_contract);
397 }
398 if ($search_name) {
399  $param .= '&amp;search_name='.urlencode($search_name);
400 }
401 if ($search_service) {
402  $param .= '&amp;search_service='.urlencode($search_service);
403 }
404 if ($mode) {
405  $param .= '&amp;mode='.urlencode($mode);
406 }
407 if ($filter) {
408  $param .= '&amp;filter='.urlencode($filter);
409 }
410 if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) {
411  $param .= '&amp;filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
412 }
413 if (!empty($filter_op1) && $filter_op1 != -1) {
414  $param .= '&amp;filter_op1='.urlencode($filter_op1);
415 }
416 if (!empty($filter_op2) && $filter_op2 != -1) {
417  $param .= '&amp;filter_op2='.urlencode($filter_op2);
418 }
419 if (!empty($filter_opcloture) && $filter_opcloture != -1) {
420  $param .= '&amp;filter_opcloture='.urlencode($filter_opcloture);
421 }
422 if ($filter_dateouvertureprevue_start != '') {
423  $param .= '&amp;opouvertureprevueday='.((int) $opouvertureprevueday).'&amp;opouvertureprevuemonth='.((int) $opouvertureprevuemonth).'&amp;opouvertureprevueyear='.((int) $opouvertureprevueyear);
424 }
425 if ($filter_date1_start != '') {
426  $param .= '&amp;op1day='.((int) $op1day).'&amp;op1month='.((int) $op1month).'&amp;op1year='.((int) $op1year);
427 }
428 if ($filter_date2_start != '') {
429  $param .= '&amp;op2day='.((int) $op2day).'&amp;op2month='.((int) $op2month).'&amp;op2year='.((int) $op2year);
430 }
431 if ($filter_datecloture_start != '') {
432  $param .= '&amp;opclotureday='.((int) $op2day).'&amp;opcloturemonth='.((int) $op2month).'&amp;opclotureyear='.((int) $op2year);
433 }
434 
435 if ($optioncss != '') {
436  $param .= '&optioncss='.urlencode($optioncss);
437 }
438 // Add $param from extra fields
439 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
440 
441 // List of mass actions available
442 $arrayofmassactions = array(
443  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
444  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
445 );
446 //if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
447 //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
448 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
449 
450 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
451 if ($optioncss != '') {
452  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
453 }
454 print '<input type="hidden" name="token" value="'.newToken().'">';
455 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
456 print '<input type="hidden" name="action" value="list">';
457 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
458 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
459 print '<input type="hidden" name="page" value="'.$page.'">';
460 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
461 
462 $title = $langs->trans("ListOfServices");
463 if ($mode == "0") {
464  $title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
465 }
466 if ($mode == "4" && $filter != "expired") {
467  $title = $langs->trans("ListOfRunningServices");
468 }
469 if ($mode == "4" && $filter == "expired") {
470  $title = $langs->trans("ListOfExpiredServices");
471 }
472 if ($mode == "5") {
473  $title = $langs->trans("ListOfClosedServices");
474 }
475 
476 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit);
477 
478 if (!empty($sall)) {
479  foreach ($fieldstosearchall as $key => $val) {
480  $fieldstosearchall[$key] = $langs->trans($val);
481  }
482  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
483 }
484 
485 $morefilter = '';
486 $moreforfilter = '';
487 
488 // If the user can view categories of products
489 if (isModEnabled('categorie') && ($user->rights->produit->lire || $user->rights->service->lire)) {
490  include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
491  $moreforfilter .= '<div class="divsearchfield">';
492  $tmptitle = $langs->trans('IncludingProductWithTag');
493  $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
494  $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'widthcentpercentminusx maxwidth300', 1);
495  $moreforfilter .= '</div>';
496 }
497 
498 $parameters = array();
499 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
500 if (empty($reshook)) {
501  $moreforfilter .= $hookmanager->resPrint;
502 } else {
503  $moreforfilter = $hookmanager->resPrint;
504 }
505 
506 
507 if (!empty($moreforfilter)) {
508  print '<div class="liste_titre liste_titre_bydiv centpercent">';
509  print $moreforfilter;
510  print '</div>';
511 }
512 
513 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
514 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
515 
516 
517 print '<div class="div-table-responsive">';
518 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
519 
520 print '<tr class="liste_titre">';
521 if (!empty($arrayfields['c.ref']['checked'])) {
522  print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
523 }
524 if (!empty($arrayfields['p.description']['checked'])) {
525  print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
526 }
527 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
528  print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
529 }
530 if (!empty($arrayfields['cd.subprice']['checked'])) {
531  print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
532 }
533 if (!empty($arrayfields['cd.qty']['checked'])) {
534  print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
535 }
536 if (!empty($arrayfields['cd.total_ht']['checked'])) {
537  print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
538 }
539 if (!empty($arrayfields['cd.total_tva']['checked'])) {
540  print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
541 }
542 if (!empty($arrayfields['s.nom']['checked'])) {
543  print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
544 }
545 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
546  print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
547 }
548 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
549  print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
550 }
551 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
552  print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
553 }
554 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
555  print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
556 }
557 // Extra fields
558 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
559 // Hook fields
560 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
561 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
562 print $hookmanager->resPrint;
563 if (!empty($arrayfields['cd.datec']['checked'])) {
564  print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
565 }
566 if (!empty($arrayfields['cd.tms']['checked'])) {
567  print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
568 }
569 if (!empty($arrayfields['status']['checked'])) {
570  print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
571 }
572 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
573 print "</tr>\n";
574 
575 print '<tr class="liste_titre">';
576 if (!empty($arrayfields['c.ref']['checked'])) {
577  print '<td class="liste_titre">';
578  print '<input type="hidden" name="filter" value="'.$filter.'">';
579  print '<input type="hidden" name="mode" value="'.$mode.'">';
580  print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
581  print '</td>';
582 }
583 // Service label
584 if (!empty($arrayfields['p.description']['checked'])) {
585  print '<td class="liste_titre">';
586  print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
587  print '</td>';
588 }
589 // detail lines
590 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
591  print '<td class="liste_titre">';
592  print '</td>';
593 }
594 if (!empty($arrayfields['cd.subprice']['checked'])) {
595  print '<td class="liste_titre">';
596  print '</td>';
597 }
598 if (!empty($arrayfields['cd.qty']['checked'])) {
599  print '<td class="liste_titre">';
600  print '</td>';
601 }
602 if (!empty($arrayfields['cd.total_ht']['checked'])) {
603  print '<td class="liste_titre">';
604  print '</td>';
605 }
606 if (!empty($arrayfields['cd.total_tva']['checked'])) {
607  print '<td class="liste_titre">';
608  print '</td>';
609 }
610 // Third party
611 if (!empty($arrayfields['s.nom']['checked'])) {
612  print '<td class="liste_titre">';
613  print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
614  print '</td>';
615 }
616 
617 
618 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
619  print '<td class="liste_titre center">';
620  $arrayofoperators = array('<'=>'<', '>'=>'>');
621  print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1, 0, 0, '', 0, 0, 0, '', 'width50');
622  print ' ';
623  $filter_dateouvertureprevue = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
624  print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0);
625  print '</td>';
626 }
627 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
628  print '<td class="liste_titre center">';
629  $arrayofoperators = array('<'=>'<', '>'=>'>');
630  print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1, 0, 0, '', 0, 0, 0, '', 'width50');
631  print ' ';
632  $filter_date1 = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
633  print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0);
634  print '</td>';
635 }
636 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
637  print '<td class="liste_titre center">';
638  $arrayofoperators = array('<'=>'<', '>'=>'>');
639  print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1, 0, 0, '', 0, 0, 0, '', 'width50');
640  print ' ';
641  $filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
642  print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0);
643  print '</td>';
644 }
645 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
646  print '<td class="liste_titre center">';
647  $arrayofoperators = array('<'=>'<', '>'=>'>');
648  print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1, 0, 0, '', 0, 0, 0, '', 'width50');
649  print ' ';
650  $filter_date_cloture = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
651  print $form->selectDate($filter_date_cloture, 'opcloture', 0, 0, 1, '', 1, 0);
652  print '</td>';
653 }
654 // Extra fields
655 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
656 
657 // Fields from hook
658 $parameters = array('arrayfields'=>$arrayfields);
659 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
660 print $hookmanager->resPrint;
661 if (!empty($arrayfields['cd.datec']['checked'])) {
662  // Date creation
663  print '<td class="liste_titre">';
664  print '</td>';
665 }
666 if (!empty($arrayfields['cd.tms']['checked'])) {
667  // Date modification
668  print '<td class="liste_titre">';
669  print '</td>';
670 }
671 if (!empty($arrayfields['status']['checked'])) {
672  // Status
673  print '<td class="liste_titre right">';
674  $arrayofstatus = array(
675  '0'=>$langs->trans("ServiceStatusInitial"),
676  '4'=>$langs->trans("ServiceStatusRunning"),
677  '4&filter=notexpired'=>$langs->trans("ServiceStatusNotLate"),
678  '4&filter=expired'=>$langs->trans("ServiceStatusLate"),
679  '5'=>$langs->trans("ServiceStatusClosed")
680  );
681  print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',') ?-1 : $search_status), 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidth150');
682  print '</td>';
683 }
684 // Action column
685 print '<td class="liste_titre maxwidthsearch">';
686 $searchpicto = $form->showFilterAndCheckAddButtons(0);
687 print $searchpicto;
688 print '</td>';
689 print "</tr>\n";
690 
691 $contractstatic = new Contrat($db);
692 $productstatic = new Product($db);
693 
694 $i = 0;
695 $totalarray = array();
696 while ($i < min($num, $limit)) {
697  $obj = $db->fetch_object($resql);
698 
699  $contractstatic->id = $obj->cid;
700  $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
701  $contractstatic->ref_customer = $obj->ref_customer;
702  $contractstatic->ref_supplier = $obj->ref_supplier;
703 
704  $companystatic->id = $obj->socid;
705  $companystatic->name = $obj->name;
706  $companystatic->email = $obj->email;
707  $companystatic->client = $obj->client;
708  $companystatic->fournisseur = $obj->fournisseur;
709 
710  $productstatic->id = $obj->pid;
711  $productstatic->type = $obj->ptype;
712  $productstatic->ref = $obj->pref;
713  $productstatic->entity = $obj->pentity;
714  $productstatic->status = $obj->tosell;
715  $productstatic->status_buy = $obj->tobuy;
716  $productstatic->label = $obj->label;
717  $productstatic->description = $obj->description;
718  $productstatic->barcode = $obj->barcode;
719 
720  print '<tr class="oddeven">';
721 
722  // Ref
723  if (!empty($arrayfields['c.ref']['checked'])) {
724  print '<td class="nowraponall">';
725  print $contractstatic->getNomUrl(1, 16);
726  print '</td>';
727  if (!$i) {
728  $totalarray['nbfield']++;
729  }
730  }
731  // Service
732  if (!empty($arrayfields['p.description']['checked'])) {
733  print '<td class="tdoverflowmax300">';
734  if ($obj->pid > 0) {
735  print $productstatic->getNomUrl(1, '', 24);
736  print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
737  if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
738  print '<br><span class="small">'.dol_nl2br($obj->description).'</span>';
739  }
740  } else {
741  if ($obj->type == 0) {
742  print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
743  }
744  if ($obj->type == 1) {
745  print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
746  }
747  }
748  print '</td>';
749  if (!$i) {
750  $totalarray['nbfield']++;
751  }
752  }
753 
754  if (!empty($arrayfields['cd.tva_tx']['checked'])) {
755  print '<td class="right nowraponall">';
756  print price2num($obj->tva_tx).'%';
757  print '</td>';
758  if (!$i) {
759  $totalarray['nbfield']++;
760  }
761  }
762  if (!empty($arrayfields['cd.subprice']['checked'])) {
763  print '<td class="right nowraponall">';
764  print price($obj->subprice);
765  print '</td>';
766  if (!$i) {
767  $totalarray['nbfield']++;
768  }
769  }
770  if (!empty($arrayfields['cd.qty']['checked'])) {
771  print '<td class="right nowraponall">';
772  print $obj->qty;
773  print '</td>';
774  if (!$i) {
775  $totalarray['nbfield']++;
776  }
777  }
778  if (!empty($arrayfields['cd.total_ht']['checked'])) {
779  print '<td class="right nowraponall">';
780  print '<span class="amount">'.price($obj->total_ht).'</span>';
781  print '</td>';
782  if (!$i) {
783  $totalarray['nbfield']++;
784  }
785  if (!$i) {
786  $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
787  }
788  $totalarray['val']['cd.total_ht'] += $obj->total_ht;
789  }
790  if (!empty($arrayfields['cd.total_tva']['checked'])) {
791  print '<td class="right nowraponall">';
792  print '<span class="amount">'.price($obj->total_tva).'</span>';
793  print '</td>';
794  if (!$i) {
795  $totalarray['nbfield']++;
796  }
797  if (!$i) {
798  $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
799  }
800  $totalarray['val']['cd.total_tva'] += $obj->total_tva;
801  }
802 
803  // Third party
804  if (!empty($arrayfields['s.nom']['checked'])) {
805  print '<td class="tdoverflowmax100">';
806  print $companystatic->getNomUrl(1, 'customer', 28);
807  print '</td>';
808  if (!$i) {
809  $totalarray['nbfield']++;
810  }
811  }
812 
813  // Start date
814  if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
815  print '<td class="center nowraponall">';
816  print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : '&nbsp;');
817  if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
818  print ' '.img_picto($langs->trans("Late"), "warning");
819  } else {
820  print '&nbsp;&nbsp;&nbsp;&nbsp;';
821  }
822  print '</td>';
823  if (!$i) {
824  $totalarray['nbfield']++;
825  }
826  }
827  if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
828  print '<td class="center nowraponall">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : '&nbsp;').'</td>';
829  if (!$i) {
830  $totalarray['nbfield']++;
831  }
832  }
833  // End date
834  if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
835  print '<td class="center nowraponall">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : '&nbsp;');
836  if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
837  $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
838  $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
839  print img_warning($textlate);
840  } else {
841  print '&nbsp;&nbsp;&nbsp;&nbsp;';
842  }
843  print '</td>';
844  if (!$i) {
845  $totalarray['nbfield']++;
846  }
847  }
848  // Close date (real end date)
849  if (!empty($arrayfields['cd.date_cloture']['checked'])) {
850  print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
851  if (!$i) {
852  $totalarray['nbfield']++;
853  }
854  }
855 
856  // Extra fields
857  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
858  // Fields from hook
859  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
860  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
861  print $hookmanager->resPrint;
862  // Date creation
863  if (!empty($arrayfields['cd.datec']['checked'])) {
864  print '<td class="center">';
865  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
866  print '</td>';
867  if (!$i) {
868  $totalarray['nbfield']++;
869  }
870  }
871  // Date modification
872  if (!empty($arrayfields['cd.tms']['checked'])) {
873  print '<td class="center nowraponall">';
874  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
875  print '</td>';
876  if (!$i) {
877  $totalarray['nbfield']++;
878  }
879  }
880  // Status
881  if (!empty($arrayfields['status']['checked'])) {
882  print '<td class="right">';
883  if ($obj->cstatut == 0) {
884  // If contract is draft, we say line is also draft
885  print $contractstatic->LibStatut(0, 5);
886  } else {
887  print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
888  }
889  print '</td>';
890  if (!$i) {
891  $totalarray['nbfield']++;
892  }
893  }
894  // Action column
895  print '<td class="nowrap center">';
896  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
897  $selected = 0;
898  if (in_array($obj->rowid, $arrayofselected)) {
899  $selected = 1;
900  }
901  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
902  }
903  print '</td>';
904  if (!$i) {
905  $totalarray['nbfield']++;
906  }
907 
908  print "</tr>\n";
909  $i++;
910 }
911 
912 // Show total line
913 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
914 
915 $db->free($resql);
916 
917 $parameters = array('sql' => $sql);
918 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
919 print $hookmanager->resPrint;
920 
921 print '</table>';
922 print '</div>';
923 
924 print '</form>';
925 
926 
927 
928 llxFooter();
929 
930 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage contracts.
Class to manage lines of contracts.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
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.