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