dolibarr  17.0.4
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, cd.product_type as type,";
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 IN (".getEntity($object->element).")";
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 .= natural_search("c.ref", $search_name);
285 }
286 if ($search_contract) {
287  $sql .= natural_search("c.ref", $search_contract);
288 }
289 if ($search_service) {
290  $sql .= natural_search(array("p.ref", "p.description", "cd.description"), $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 
521 print '<tr class="liste_titre">';
522 if (!empty($arrayfields['c.ref']['checked'])) {
523  print '<td class="liste_titre">';
524  print '<input type="hidden" name="filter" value="'.$filter.'">';
525  print '<input type="hidden" name="mode" value="'.$mode.'">';
526  print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
527  print '</td>';
528 }
529 // Service label
530 if (!empty($arrayfields['p.description']['checked'])) {
531  print '<td class="liste_titre">';
532  print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
533  print '</td>';
534 }
535 // detail lines
536 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
537  print '<td class="liste_titre">';
538  print '</td>';
539 }
540 if (!empty($arrayfields['cd.subprice']['checked'])) {
541  print '<td class="liste_titre">';
542  print '</td>';
543 }
544 if (!empty($arrayfields['cd.qty']['checked'])) {
545  print '<td class="liste_titre">';
546  print '</td>';
547 }
548 if (!empty($arrayfields['cd.total_ht']['checked'])) {
549  print '<td class="liste_titre">';
550  print '</td>';
551 }
552 if (!empty($arrayfields['cd.total_tva']['checked'])) {
553  print '<td class="liste_titre">';
554  print '</td>';
555 }
556 // Third party
557 if (!empty($arrayfields['s.nom']['checked'])) {
558  print '<td class="liste_titre">';
559  print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
560  print '</td>';
561 }
562 
563 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
564  print '<td class="liste_titre center">';
565  $arrayofoperators = array('<'=>'<', '>'=>'>');
566  print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1, 0, 0, '', 0, 0, 0, '', 'width50');
567  print ' ';
568  $filter_dateouvertureprevue = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
569  print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0);
570  print '</td>';
571 }
572 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
573  print '<td class="liste_titre center">';
574  $arrayofoperators = array('<'=>'<', '>'=>'>');
575  print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1, 0, 0, '', 0, 0, 0, '', 'width50');
576  print ' ';
577  $filter_date1 = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
578  print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0);
579  print '</td>';
580 }
581 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
582  print '<td class="liste_titre center">';
583  $arrayofoperators = array('<'=>'<', '>'=>'>');
584  print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1, 0, 0, '', 0, 0, 0, '', 'width50');
585  print ' ';
586  $filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
587  print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0);
588  print '</td>';
589 }
590 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
591  print '<td class="liste_titre center">';
592  $arrayofoperators = array('<'=>'<', '>'=>'>');
593  print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1, 0, 0, '', 0, 0, 0, '', 'width50');
594  print ' ';
595  $filter_date_cloture = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
596  print $form->selectDate($filter_date_cloture, 'opcloture', 0, 0, 1, '', 1, 0);
597  print '</td>';
598 }
599 // Extra fields
600 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
601 
602 // Fields from hook
603 $parameters = array('arrayfields'=>$arrayfields);
604 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
605 print $hookmanager->resPrint;
606 if (!empty($arrayfields['cd.datec']['checked'])) {
607  // Date creation
608  print '<td class="liste_titre">';
609  print '</td>';
610 }
611 if (!empty($arrayfields['cd.tms']['checked'])) {
612  // Date modification
613  print '<td class="liste_titre">';
614  print '</td>';
615 }
616 if (!empty($arrayfields['status']['checked'])) {
617  // Status
618  print '<td class="liste_titre right">';
619  $arrayofstatus = array(
620  '0'=>$langs->trans("ServiceStatusInitial"),
621  '4'=>$langs->trans("ServiceStatusRunning"),
622  '4&filter=notexpired'=>$langs->trans("ServiceStatusNotLate"),
623  '4&filter=expired'=>$langs->trans("ServiceStatusLate"),
624  '5'=>$langs->trans("ServiceStatusClosed")
625  );
626  print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',') ?-1 : $search_status), 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidth150');
627  print '</td>';
628 }
629 // Action column
630 print '<td class="liste_titre maxwidthsearch">';
631 $searchpicto = $form->showFilterAndCheckAddButtons(0);
632 print $searchpicto;
633 print '</td>';
634 print "</tr>\n";
635 
636 print '<tr class="liste_titre">';
637 if (!empty($arrayfields['c.ref']['checked'])) {
638  print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
639 }
640 if (!empty($arrayfields['p.description']['checked'])) {
641  print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
642 }
643 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
644  print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
645 }
646 if (!empty($arrayfields['cd.subprice']['checked'])) {
647  print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
648 }
649 if (!empty($arrayfields['cd.qty']['checked'])) {
650  print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
651 }
652 if (!empty($arrayfields['cd.total_ht']['checked'])) {
653  print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
654 }
655 if (!empty($arrayfields['cd.total_tva']['checked'])) {
656  print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
657 }
658 if (!empty($arrayfields['s.nom']['checked'])) {
659  print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
660 }
661 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
662  print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
663 }
664 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
665  print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
666 }
667 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
668  print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
669 }
670 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
671  print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
672 }
673 // Extra fields
674 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
675 // Hook fields
676 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
677 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
678 print $hookmanager->resPrint;
679 if (!empty($arrayfields['cd.datec']['checked'])) {
680  print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
681 }
682 if (!empty($arrayfields['cd.tms']['checked'])) {
683  print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
684 }
685 if (!empty($arrayfields['status']['checked'])) {
686  print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
687 }
688 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
689 print "</tr>\n";
690 
691 
692 $contractstatic = new Contrat($db);
693 $productstatic = new Product($db);
694 
695 $i = 0;
696 $totalarray = array('nbfield'=>0);
697 while ($i < min($num, $limit)) {
698  $obj = $db->fetch_object($resql);
699 
700  $contractstatic->id = $obj->cid;
701  $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
702  $contractstatic->ref_customer = $obj->ref_customer;
703  $contractstatic->ref_supplier = $obj->ref_supplier;
704 
705  $companystatic->id = $obj->socid;
706  $companystatic->name = $obj->name;
707  $companystatic->email = $obj->email;
708  $companystatic->client = $obj->client;
709  $companystatic->fournisseur = $obj->fournisseur;
710 
711  $productstatic->id = $obj->pid;
712  $productstatic->type = $obj->ptype;
713  $productstatic->ref = $obj->pref;
714  $productstatic->entity = $obj->pentity;
715  $productstatic->status = $obj->tosell;
716  $productstatic->status_buy = $obj->tobuy;
717  $productstatic->label = $obj->label;
718  $productstatic->description = $obj->description;
719  $productstatic->barcode = $obj->barcode;
720 
721  print '<tr class="oddeven">';
722 
723  // Ref
724  if (!empty($arrayfields['c.ref']['checked'])) {
725  print '<td class="nowraponall">';
726  print $contractstatic->getNomUrl(1, 16);
727  print '</td>';
728  if (!$i) {
729  $totalarray['nbfield']++;
730  }
731  }
732  // Service
733  if (!empty($arrayfields['p.description']['checked'])) {
734  print '<td class="tdoverflowmax300">';
735  if ($obj->pid > 0) {
736  print $productstatic->getNomUrl(1, '', 24);
737  print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
738  if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
739  print '<br><span class="small">'.dol_nl2br($obj->description).'</span>';
740  }
741  } else {
742  if ($obj->type == 0) {
743  print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
744  }
745  if ($obj->type == 1) {
746  print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
747  }
748  }
749  print '</td>';
750  if (!$i) {
751  $totalarray['nbfield']++;
752  }
753  }
754 
755  if (!empty($arrayfields['cd.tva_tx']['checked'])) {
756  print '<td class="right nowraponall">';
757  print price2num($obj->tva_tx).'%';
758  print '</td>';
759  if (!$i) {
760  $totalarray['nbfield']++;
761  }
762  }
763  if (!empty($arrayfields['cd.subprice']['checked'])) {
764  print '<td class="right nowraponall">';
765  print price($obj->subprice);
766  print '</td>';
767  if (!$i) {
768  $totalarray['nbfield']++;
769  }
770  }
771  if (!empty($arrayfields['cd.qty']['checked'])) {
772  print '<td class="right nowraponall">';
773  print $obj->qty;
774  print '</td>';
775  if (!$i) {
776  $totalarray['nbfield']++;
777  }
778  }
779  if (!empty($arrayfields['cd.total_ht']['checked'])) {
780  print '<td class="right nowraponall">';
781  print '<span class="amount">'.price($obj->total_ht).'</span>';
782  print '</td>';
783  if (!$i) {
784  $totalarray['nbfield']++;
785  }
786  if (!$i) {
787  $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
788  }
789  $totalarray['val']['cd.total_ht'] += $obj->total_ht;
790  }
791  if (!empty($arrayfields['cd.total_tva']['checked'])) {
792  print '<td class="right nowraponall">';
793  print '<span class="amount">'.price($obj->total_tva).'</span>';
794  print '</td>';
795  if (!$i) {
796  $totalarray['nbfield']++;
797  }
798  if (!$i) {
799  $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
800  }
801  $totalarray['val']['cd.total_tva'] += $obj->total_tva;
802  }
803 
804  // Third party
805  if (!empty($arrayfields['s.nom']['checked'])) {
806  print '<td class="tdoverflowmax100">';
807  print $companystatic->getNomUrl(1, 'customer', 28);
808  print '</td>';
809  if (!$i) {
810  $totalarray['nbfield']++;
811  }
812  }
813 
814  // Start date
815  if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
816  print '<td class="center nowraponall">';
817  print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : '&nbsp;');
818  if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
819  print ' '.img_picto($langs->trans("Late"), "warning");
820  } else {
821  print '&nbsp;&nbsp;&nbsp;&nbsp;';
822  }
823  print '</td>';
824  if (!$i) {
825  $totalarray['nbfield']++;
826  }
827  }
828  if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
829  print '<td class="center nowraponall">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : '&nbsp;').'</td>';
830  if (!$i) {
831  $totalarray['nbfield']++;
832  }
833  }
834  // End date
835  if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
836  print '<td class="center nowraponall">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : '&nbsp;');
837  if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
838  $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
839  $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
840  print img_warning($textlate);
841  } else {
842  print '&nbsp;&nbsp;&nbsp;&nbsp;';
843  }
844  print '</td>';
845  if (!$i) {
846  $totalarray['nbfield']++;
847  }
848  }
849  // Close date (real end date)
850  if (!empty($arrayfields['cd.date_cloture']['checked'])) {
851  print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
852  if (!$i) {
853  $totalarray['nbfield']++;
854  }
855  }
856 
857  // Extra fields
858  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
859  // Fields from hook
860  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
861  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
862  print $hookmanager->resPrint;
863  // Date creation
864  if (!empty($arrayfields['cd.datec']['checked'])) {
865  print '<td class="center">';
866  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
867  print '</td>';
868  if (!$i) {
869  $totalarray['nbfield']++;
870  }
871  }
872  // Date modification
873  if (!empty($arrayfields['cd.tms']['checked'])) {
874  print '<td class="center nowraponall">';
875  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
876  print '</td>';
877  if (!$i) {
878  $totalarray['nbfield']++;
879  }
880  }
881  // Status
882  if (!empty($arrayfields['status']['checked'])) {
883  print '<td class="right">';
884  if ($obj->cstatut == 0) {
885  // If contract is draft, we say line is also draft
886  print $contractstatic->LibStatut(0, 5);
887  } else {
888  print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
889  }
890  print '</td>';
891  if (!$i) {
892  $totalarray['nbfield']++;
893  }
894  }
895  // Action column
896  print '<td class="nowrap center">';
897  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
898  $selected = 0;
899  if (in_array($obj->rowid, $arrayofselected)) {
900  $selected = 1;
901  }
902  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
903  }
904  print '</td>';
905  if (!$i) {
906  $totalarray['nbfield']++;
907  }
908 
909  print "</tr>\n";
910  $i++;
911 }
912 
913 // Show total line
914 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
915 
916 $db->free($resql);
917 
918 $parameters = array('sql' => $sql);
919 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
920 print $hookmanager->resPrint;
921 
922 print '</table>';
923 print '</div>';
924 
925 print '</form>';
926 
927 
928 
929 llxFooter();
930 
931 $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)
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...
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.