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$sql .= $db->order($sortfield, $sortorder);
352
353//print $sql;
354
355$nbtotalofrecords = '';
356if (!getDolGlobalInt('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;
368dol_syslog("contrat/services_list.php", LOG_DEBUG);
369$resql = $db->query($sql);
370if (!$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
386llxHeader(null, $langs->trans("Services"));
387
388$param = '';
389if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
390 $param .= '&contextpage='.urlencode($contextpage);
391}
392if ($limit > 0 && $limit != $conf->liste_limit) {
393 $param .= '&limit='.$limit;
394}
395if ($mode) {
396 $param .= '&amp;mode='.urlencode($mode);
397}
398if ($search_contract) {
399 $param .= '&amp;search_contract='.urlencode($search_contract);
400}
401if ($search_name) {
402 $param .= '&amp;search_name='.urlencode($search_name);
403}
404if ($search_subprice) {
405 $param .= '&amp;search_subprice='.urlencode($search_subprice);
406}
407if ($search_qty) {
408 $param .= '&amp;search_qty='.urlencode($search_qty);
409}
410if ($search_total_ht) {
411 $param .= '&amp;search_total_ht='.urlencode($search_total_ht);
412}
413if ($search_total_tva) {
414 $param .= '&amp;search_total_tva='.urlencode($search_total_tva);
415}
416if ($search_total_ttc) {
417 $param .= '&amp;search_total_ttc='.urlencode($search_total_ttc);
418}
419if ($search_service) {
420 $param .= '&amp;search_service='.urlencode($search_service);
421}
422if ($search_status) {
423 $param .= '&amp;search_status='.urlencode($search_status);
424}
425if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) {
426 $param .= '&amp;filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
427}
428if (!empty($filter_op1) && $filter_op1 != -1) {
429 $param .= '&amp;filter_op1='.urlencode($filter_op1);
430}
431if (!empty($filter_op2) && $filter_op2 != -1) {
432 $param .= '&amp;filter_op2='.urlencode($filter_op2);
433}
434if (!empty($filter_opcloture) && $filter_opcloture != -1) {
435 $param .= '&amp;filter_opcloture='.urlencode($filter_opcloture);
436}
437if ($filter_dateouvertureprevue_start != '') {
438 $param .= '&amp;opouvertureprevueday='.((int) $opouvertureprevueday).'&amp;opouvertureprevuemonth='.((int) $opouvertureprevuemonth).'&amp;opouvertureprevueyear='.((int) $opouvertureprevueyear);
439}
440if ($filter_date1_start != '') {
441 $param .= '&amp;op1day='.((int) $op1day).'&amp;op1month='.((int) $op1month).'&amp;op1year='.((int) $op1year);
442}
443if ($filter_date2_start != '') {
444 $param .= '&amp;op2day='.((int) $op2day).'&amp;op2month='.((int) $op2month).'&amp;op2year='.((int) $op2year);
445}
446if ($filter_datecloture_start != '') {
447 $param .= '&amp;opclotureday='.((int) $op2day).'&amp;opcloturemonth='.((int) $op2month).'&amp;opclotureyear='.((int) $op2year);
448}
449
450if ($optioncss != '') {
451 $param .= '&optioncss='.urlencode($optioncss);
452}
453// Add $param from extra fields
454include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
455
456// List of mass actions available
457$arrayofmassactions = array(
458 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
459 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
460);
461//if ($user->hasRight('contrat', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
462//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
463$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
464
465print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
466if ($optioncss != '') {
467 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
468}
469print '<input type="hidden" name="token" value="'.newToken().'">';
470print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
471print '<input type="hidden" name="action" value="list">';
472print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
473print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
474print '<input type="hidden" name="page" value="'.$page.'">';
475print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
476
477$title = $langs->trans("ListOfServices");
478if ($search_status == "0") {
479 $title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
480}
481if ($search_status == "4") {
482 $title = $langs->trans("ListOfRunningServices");
483}
484if ($search_status == "4&filter=notexpired") {
485 $title = $langs->trans("ListOfNotExpiredServices");
486}
487if ($search_status == "4&filter=expired") {
488 $title = $langs->trans("ListOfExpiredServices");
489}
490if ($search_status == "5") {
491 $title = $langs->trans("ListOfClosedServices");
492}
493
494print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit);
495
496if (!empty($sall)) {
497 foreach ($fieldstosearchall as $key => $val) {
498 $fieldstosearchall[$key] = $langs->trans($val);
499 }
500 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
501}
502
503$morefilter = '';
504$moreforfilter = '';
505
506// If the user can view categories of products
507if (isModEnabled('categorie') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
508 include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
509 $moreforfilter .= '<div class="divsearchfield">';
510 $tmptitle = $langs->trans('IncludingProductWithTag');
511 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
512 $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);
513 $moreforfilter .= '</div>';
514}
515
516$parameters = array();
517$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
518if (empty($reshook)) {
519 $moreforfilter .= $hookmanager->resPrint;
520} else {
521 $moreforfilter = $hookmanager->resPrint;
522}
523
524
525if (!empty($moreforfilter)) {
526 print '<div class="liste_titre liste_titre_bydiv centpercent">';
527 print $moreforfilter;
528 print '</div>';
529}
530
531$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
532$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
533
534
535print '<div class="div-table-responsive">';
536print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
537
538
539print '<tr class="liste_titre">';
540if (!empty($arrayfields['c.ref']['checked'])) {
541 print '<td class="liste_titre">';
542 print '<input type="hidden" name="mode" value="'.$mode.'">';
543 print '<input type="text" class="flat maxwidth75" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
544 print '</td>';
545}
546// Service label
547if (!empty($arrayfields['p.description']['checked'])) {
548 print '<td class="liste_titre">';
549 print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
550 print '</td>';
551}
552// detail lines
553if (!empty($arrayfields['cd.tva_tx']['checked'])) {
554 print '<td class="liste_titre">';
555 print '</td>';
556}
557if (!empty($arrayfields['cd.subprice']['checked'])) {
558 print '<td class="liste_titre right">';
559 print '<input type="text" class="flat maxwidth50 right" name="search_subprice" value="'.dol_escape_htmltag($search_subprice).'">';
560 print '</td>';
561}
562if (!empty($arrayfields['cd.qty']['checked'])) {
563 print '<td class="liste_titre right">';
564 print '<input type="text" class="flat maxwidth50 right" name="search_qty" value="'.dol_escape_htmltag($search_qty).'">';
565 print '</td>';
566}
567if (!empty($arrayfields['cd.total_ht']['checked'])) {
568 print '<td class="liste_titre right">';
569 print '<input type="text" class="flat maxwidth50" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).'">';
570 print '</td>';
571}
572if (!empty($arrayfields['cd.total_tva']['checked'])) {
573 print '<td class="liste_titre right">';
574 print '<input type="text" class="flat maxwidth50" name="search_total_tva" value="'.dol_escape_htmltag($search_total_tva).'">';
575 print '</td>';
576}
577// Third party
578if (!empty($arrayfields['s.nom']['checked'])) {
579 print '<td class="liste_titre">';
580 print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
581 print '</td>';
582}
583
584if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
585 print '<td class="liste_titre center">';
586 $arrayofoperators = array('<'=>'<', '>'=>'>');
587 print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1, 0, 0, '', 0, 0, 0, '', 'width50');
588 print ' ';
589 $filter_dateouvertureprevue = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
590 print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0);
591 print '</td>';
592}
593if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
594 print '<td class="liste_titre center">';
595 $arrayofoperators = array('<'=>'<', '>'=>'>');
596 print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1, 0, 0, '', 0, 0, 0, '', 'width50');
597 print ' ';
598 $filter_date1 = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
599 print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0);
600 print '</td>';
601}
602if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
603 print '<td class="liste_titre center">';
604 $arrayofoperators = array('<'=>'<', '>'=>'>');
605 print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1, 0, 0, '', 0, 0, 0, '', 'width50');
606 print ' ';
607 $filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
608 print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0);
609 print '</td>';
610}
611if (!empty($arrayfields['cd.date_cloture']['checked'])) {
612 print '<td class="liste_titre center">';
613 $arrayofoperators = array('<'=>'<', '>'=>'>');
614 print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1, 0, 0, '', 0, 0, 0, '', 'width50');
615 print ' ';
616 $filter_date_cloture = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
617 print $form->selectDate($filter_date_cloture, 'opcloture', 0, 0, 1, '', 1, 0);
618 print '</td>';
619}
620// Extra fields
621include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
622
623// Fields from hook
624$parameters = array('arrayfields'=>$arrayfields);
625$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
626print $hookmanager->resPrint;
627if (!empty($arrayfields['cd.datec']['checked'])) {
628 // Date creation
629 print '<td class="liste_titre">';
630 print '</td>';
631}
632if (!empty($arrayfields['cd.tms']['checked'])) {
633 // Date modification
634 print '<td class="liste_titre">';
635 print '</td>';
636}
637if (!empty($arrayfields['status']['checked'])) {
638 // Status
639 print '<td class="liste_titre right parentonrightofpage">';
640 $arrayofstatus = array(
641 '0'=>$langs->trans("ServiceStatusInitial"),
642 '4'=>$langs->trans("ServiceStatusRunning"),
643 '4&filter=notexpired'=>$langs->trans("ServiceStatusNotLate"),
644 '4&filter=expired'=>$langs->trans("ServiceStatusLate"),
645 '5'=>$langs->trans("ServiceStatusClosed")
646 );
647 print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',') ?-1 : $search_status), 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
648 print '</td>';
649}
650// Action column
651print '<td class="liste_titre maxwidthsearch">';
652$searchpicto = $form->showFilterAndCheckAddButtons(0);
653print $searchpicto;
654print '</td>';
655print "</tr>\n";
656
657print '<tr class="liste_titre">';
658if (!empty($arrayfields['c.ref']['checked'])) {
659 print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
660}
661if (!empty($arrayfields['p.description']['checked'])) {
662 print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
663}
664if (!empty($arrayfields['cd.tva_tx']['checked'])) {
665 print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
666}
667if (!empty($arrayfields['cd.subprice']['checked'])) {
668 print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
669}
670if (!empty($arrayfields['cd.qty']['checked'])) {
671 print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'right nowrap ');
672}
673if (!empty($arrayfields['cd.total_ht']['checked'])) {
674 print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'right nowrap ');
675}
676if (!empty($arrayfields['cd.total_tva']['checked'])) {
677 print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'right nowrap ');
678}
679if (!empty($arrayfields['s.nom']['checked'])) {
680 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
681}
682if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
683 print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
684}
685if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
686 print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
687}
688if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
689 print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
690}
691if (!empty($arrayfields['cd.date_cloture']['checked'])) {
692 print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
693}
694// Extra fields
695include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
696// Hook fields
697$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
698$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
699print $hookmanager->resPrint;
700if (!empty($arrayfields['cd.datec']['checked'])) {
701 print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
702}
703if (!empty($arrayfields['cd.tms']['checked'])) {
704 print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
705}
706if (!empty($arrayfields['status']['checked'])) {
707 print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
708}
709print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
710print "</tr>\n";
711
712
713$contractstatic = new Contrat($db);
714$productstatic = new Product($db);
715
716$i = 0;
717$totalarray = array('nbfield'=>0, 'cd.qty'=>0, 'cd.total_ht'=>0, 'cd.total_tva'=>0);
718while ($i < min($num, $limit)) {
719 $obj = $db->fetch_object($resql);
720
721 $contractstatic->id = $obj->cid;
722 $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
723 $contractstatic->ref_customer = $obj->ref_customer;
724 $contractstatic->ref_supplier = $obj->ref_supplier;
725
726 $companystatic->id = $obj->socid;
727 $companystatic->name = $obj->name;
728 $companystatic->email = $obj->email;
729 $companystatic->client = $obj->client;
730 $companystatic->fournisseur = $obj->fournisseur;
731
732 $productstatic->id = $obj->pid;
733 $productstatic->type = $obj->ptype;
734 $productstatic->ref = $obj->pref;
735 $productstatic->entity = $obj->pentity;
736 $productstatic->status = $obj->tosell;
737 $productstatic->status_buy = $obj->tobuy;
738 $productstatic->label = $obj->label;
739 $productstatic->description = $obj->description;
740 $productstatic->barcode = $obj->barcode;
741
742 print '<tr class="oddeven">';
743
744 // Ref
745 if (!empty($arrayfields['c.ref']['checked'])) {
746 print '<td class="nowraponall">';
747 print $contractstatic->getNomUrl(1, 16);
748 print '</td>';
749 if (!$i) {
750 $totalarray['nbfield']++;
751 }
752 }
753 // Service
754 if (!empty($arrayfields['p.description']['checked'])) {
755 print '<td class="tdoverflowmax300">';
756 if ($obj->pid > 0) {
757 print $productstatic->getNomUrl(1, '', 24);
758 print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
759 if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
760 print '<br><span class="small">'.dol_nl2br($obj->description).'</span>';
761 }
762 } else {
763 if ($obj->type == 0) {
764 print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
765 }
766 if ($obj->type == 1) {
767 print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
768 }
769 }
770 print '</td>';
771 if (!$i) {
772 $totalarray['nbfield']++;
773 }
774 }
775
776 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
777 print '<td class="right nowraponall">';
778 print price2num($obj->tva_tx).'%';
779 print '</td>';
780 if (!$i) {
781 $totalarray['nbfield']++;
782 }
783 }
784 if (!empty($arrayfields['cd.subprice']['checked'])) {
785 print '<td class="right nowraponall">';
786 print price($obj->subprice);
787 print '</td>';
788 if (!$i) {
789 $totalarray['nbfield']++;
790 }
791 }
792 if (!empty($arrayfields['cd.qty']['checked'])) {
793 print '<td class="right nowraponall">';
794 print $obj->qty;
795 print '</td>';
796 if (!$i) {
797 $totalarray['nbfield']++;
798 }
799 if (!$i) {
800 $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty';
801 }
802 $totalarray['val']['cd.qty'] += $obj->qty;
803 }
804 if (!empty($arrayfields['cd.total_ht']['checked'])) {
805 print '<td class="right nowraponall">';
806 print '<span class="amount">'.price($obj->total_ht).'</span>';
807 print '</td>';
808 if (!$i) {
809 $totalarray['nbfield']++;
810 }
811 if (!$i) {
812 $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
813 }
814 $totalarray['val']['cd.total_ht'] += $obj->total_ht;
815 }
816 if (!empty($arrayfields['cd.total_tva']['checked'])) {
817 print '<td class="right nowraponall">';
818 print '<span class="amount">'.price($obj->total_tva).'</span>';
819 print '</td>';
820 if (!$i) {
821 $totalarray['nbfield']++;
822 }
823 if (!$i) {
824 $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
825 }
826 $totalarray['val']['cd.total_tva'] += $obj->total_tva;
827 }
828
829 // Third party
830 if (!empty($arrayfields['s.nom']['checked'])) {
831 print '<td class="tdoverflowmax100">';
832 print $companystatic->getNomUrl(1, 'customer', 28);
833 print '</td>';
834 if (!$i) {
835 $totalarray['nbfield']++;
836 }
837 }
838
839 // Start date
840 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
841 print '<td class="center nowraponall">';
842 print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : '&nbsp;');
843 if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
844 print ' '.img_picto($langs->trans("Late"), "warning");
845 } else {
846 print '&nbsp;&nbsp;&nbsp;&nbsp;';
847 }
848 print '</td>';
849 if (!$i) {
850 $totalarray['nbfield']++;
851 }
852 }
853 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
854 print '<td class="center nowraponall">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : '&nbsp;').'</td>';
855 if (!$i) {
856 $totalarray['nbfield']++;
857 }
858 }
859 // End date
860 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
861 print '<td class="center nowraponall">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : '&nbsp;');
862 if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
863 $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
864 $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
865 print img_warning($textlate);
866 } else {
867 print '&nbsp;&nbsp;&nbsp;&nbsp;';
868 }
869 print '</td>';
870 if (!$i) {
871 $totalarray['nbfield']++;
872 }
873 }
874 // Close date (real end date)
875 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
876 print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
877 if (!$i) {
878 $totalarray['nbfield']++;
879 }
880 }
881
882 // Extra fields
883 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
884 // Fields from hook
885 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
886 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
887 print $hookmanager->resPrint;
888 // Date creation
889 if (!empty($arrayfields['cd.datec']['checked'])) {
890 print '<td class="center">';
891 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
892 print '</td>';
893 if (!$i) {
894 $totalarray['nbfield']++;
895 }
896 }
897 // Date modification
898 if (!empty($arrayfields['cd.tms']['checked'])) {
899 print '<td class="center nowraponall">';
900 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
901 print '</td>';
902 if (!$i) {
903 $totalarray['nbfield']++;
904 }
905 }
906 // Status
907 if (!empty($arrayfields['status']['checked'])) {
908 print '<td class="right">';
909 if ($obj->cstatut == 0) {
910 // If contract is draft, we say line is also draft
911 print $contractstatic->LibStatut(0, 5);
912 } else {
913 print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
914 }
915 print '</td>';
916 if (!$i) {
917 $totalarray['nbfield']++;
918 }
919 }
920 // Action column
921 print '<td class="nowrap center">';
922 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
923 $selected = 0;
924 if (in_array($obj->rowid, $arrayofselected)) {
925 $selected = 1;
926 }
927 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
928 }
929 print '</td>';
930 if (!$i) {
931 $totalarray['nbfield']++;
932 }
933
934 print "</tr>\n";
935 $i++;
936}
937
938// Show total line
939include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
940
941// If no record found
942if ($num == 0) {
943 $colspan = 1;
944 foreach ($arrayfields as $key => $val) {
945 if (!empty($val['checked'])) {
946 $colspan++;
947 }
948 }
949 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
950}
951
952$db->free($resql);
953
954$parameters = array('sql' => $sql);
955$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
956print $hookmanager->resPrint;
957
958print '</table>';
959print '</div>';
960
961print '</form>';
962
963
964
965llxFooter();
966
967$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.