dolibarr  19.0.0-dev
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 $mode = GETPOST("mode");
40 
41 $massaction = GETPOST('massaction', 'alpha');
42 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
43 $sortfield = GETPOST('sortfield', 'aZ09comma');
44 $sortorder = GETPOST('sortorder', 'aZ09comma');
45 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
46 if (empty($page) || $page == -1) {
47  $page = 0;
48 } // If $page is not defined, or '' or -1
49 $offset = $limit * $page;
50 $pageprev = $page - 1;
51 $pagenext = $page + 1;
52 if (!$sortfield) {
53  $sortfield = "c.rowid";
54 }
55 if (!$sortorder) {
56  $sortorder = "ASC";
57 }
58 
59 $filter = GETPOST("filter", 'alpha');
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');
106 if (!empty($user->socid)) {
107  $socid = $user->socid;
108 }
109 $result = restrictedArea($user, 'contrat', $contratid);
110 
111 if ($search_status != '') {
112  $tmp = explode('&', $search_status);
113  if (empty($tmp[1])) {
114  $filter = '';
115  } else {
116  if ($tmp[1] == 'filter=notexpired') {
117  $filter = 'notexpired';
118  }
119  if ($tmp[1] == 'filter=expired') {
120  $filter = 'expired';
121  }
122  }
123 }
124 
125 $staticcontrat = new Contrat($db);
126 $staticcontratligne = new ContratLigne($db);
127 $companystatic = new Societe($db);
128 
129 $arrayfields = array(
130  'c.ref'=>array('label'=>"Contract", 'checked'=>1, 'position'=>80),
131  'p.description'=>array('label'=>"Service", 'checked'=>1, 'position'=>80),
132  's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>90),
133  'cd.tva_tx'=>array('label'=>"VATRate", 'checked'=>-1, 'position'=>100),
134  'cd.subprice'=>array('label'=>"PriceUHT", 'checked'=>-1, 'position'=>105),
135  'cd.qty'=>array('label'=>"Qty", 'checked'=>1, 'position'=>108),
136  'cd.total_ht'=>array('label'=>"TotalHT", 'checked'=>-1, 'position'=>109, 'isameasure'=>1),
137  'cd.total_tva'=>array('label'=>"TotalVAT", 'checked'=>-1, 'position'=>110),
138  'cd.date_ouverture_prevue'=>array('label'=>"DateStartPlannedShort", 'checked'=>1, 'position'=>150),
139  'cd.date_ouverture'=>array('label'=>"DateStartRealShort", 'checked'=>1, 'position'=>160),
140  'cd.date_fin_validite'=>array('label'=>"DateEndPlannedShort", 'checked'=>1, 'position'=>170),
141  'cd.date_cloture'=>array('label'=>"DateEndRealShort", 'checked'=>1, 'position'=>180),
142  //'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
143  'cd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
144  'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
145 );
146 // Extra fields
147 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
148 
149 $object->fields = dol_sort_array($object->fields, 'position');
150 $arrayfields = dol_sort_array($arrayfields, 'position');
151 
152 
153 
154 
155 /*
156  * Actions
157  */
158 
159 if (GETPOST('cancel', 'alpha')) {
160  $action = 'list'; $massaction = '';
161 }
162 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
163  $massaction = '';
164 }
165 
166 $parameters = array('socid'=>$socid);
167 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
168 if ($reshook < 0) {
169  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
170 }
171 
172 if (empty($reshook)) {
173  // Selection of new fields
174  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
175 
176  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
177  $search_product_category = 0;
178  $search_name = "";
179  $search_subprice = "";
180  $search_qty = "";
181  $search_total_ht = "";
182  $search_total_tva = "";
183  $search_total_ttc = "";
184  $search_contract = "";
185  $search_service = "";
186  $search_status = -1;
187  $opouvertureprevuemonth = "";
188  $opouvertureprevueday = "";
189  $opouvertureprevueyear = "";
190  $filter_opouvertureprevue = "";
191  $op1month = "";
192  $op1day = "";
193  $op1year = "";
194  $filter_op1 = "";
195  $op2month = "";
196  $op2day = "";
197  $op2year = "";
198  $filter_op2 = "";
199  $opcloturemonth = "";
200  $opclotureday = "";
201  $opclotureyear = "";
202  $filter_opcloture = "";
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 ($search_status == "0") {
269  $sql .= " AND cd.statut = 0";
270 }
271 if ($search_status == "4") {
272  $sql .= " AND cd.statut = 4";
273 }
274 if ($search_status == "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_subprice) {
284  $sql .= natural_search("cd.subprice", $search_subprice, 1);
285 }
286 if ($search_qty) {
287  $sql .= natural_search("cd.qty", $search_qty, 1);
288 }
289 if ($search_total_ht) {
290  $sql .= natural_search("cd.total_ht", $search_total_ht, 1);
291 }
292 if ($search_total_tva) {
293  $sql .= natural_search("cd.total_tva", $search_total_tva, 1);
294 }
295 if ($search_total_ttc) {
296  $sql .= natural_search("cd.total_ttc", $search_total_ttc, 1);
297 }
298 if ($search_name) {
299  $sql .= natural_search("s.nom", $search_name);
300 }
301 if ($search_contract) {
302  $sql .= natural_search("c.ref", $search_contract);
303 }
304 if ($search_service) {
305  $sql .= natural_search(array("p.ref", "p.description", "cd.description"), $search_service);
306 }
307 if ($socid > 0) {
308  $sql .= " AND s.rowid = ".((int) $socid);
309 }
310 
311 $filter_dateouvertureprevue = '';
312 $filter_date1 = '';
313 $filter_date2 = '';
314 $filter_opcloture = '';
315 
316 $filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
317 $filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
318 if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) {
319  $filter_opouvertureprevue = ' BETWEEN ';
320 }
321 
322 $filter_date1_start = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
323 $filter_date1_end = dol_mktime(23, 59, 59, $op1month, $op1day, $op1year);
324 if ($filter_date1_start != '' && $filter_op1 == -1) {
325  $filter_op1 = ' BETWEEN ';
326 }
327 
328 $filter_date2_start = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
329 $filter_date2_end = dol_mktime(23, 59, 59, $op2month, $op2day, $op2year);
330 if ($filter_date2_start != '' && $filter_op2 == -1) {
331  $filter_op2 = ' BETWEEN ';
332 }
333 
334 $filter_datecloture_start = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
335 $filter_datecloture_end = dol_mktime(23, 59, 59, $opcloturemonth, $opclotureday, $opclotureyear);
336 if ($filter_datecloture_start != '' && $filter_opcloture == -1) {
337  $filter_opcloture = ' BETWEEN ';
338 }
339 
340 if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_opouvertureprevue != ' BETWEEN ' && $filter_dateouvertureprevue_start != '') {
341  $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
342 }
343 if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') {
344  $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."' AND '".$db->idate($filter_dateouvertureprevue_end)."'";
345 }
346 if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') {
347  $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
348 }
349 if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') {
350  $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."' AND '".$db->idate($filter_date1_end)."'";
351 }
352 if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') {
353  $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
354 }
355 if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') {
356  $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."' AND '".$db->idate($filter_date2_end)."'";
357 }
358 if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') {
359  $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
360 }
361 if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
362  $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."' AND '".$db->idate($filter_datecloture_end)."'";
363 }
364 // Add where from extra fields
365 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
366 $sql .= $db->order($sortfield, $sortorder);
367 
368 //print $sql;
369 
370 $nbtotalofrecords = '';
371 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
372  $result = $db->query($sql);
373  $nbtotalofrecords = $db->num_rows($result);
374  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
375  $page = 0;
376  $offset = 0;
377  }
378 }
379 
380 $sql .= $db->plimit($limit + 1, $offset);
381 
382 //print $sql;
383 dol_syslog("contrat/services_list.php", LOG_DEBUG);
384 $resql = $db->query($sql);
385 if (!$resql) {
386  dol_print_error($db);
387  exit;
388 }
389 
390 $num = $db->num_rows($resql);
391 
392 /*
393 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
394 {
395  $obj = $db->fetch_object($resql);
396  $id = $obj->id;
397  header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
398  exit;
399 }*/
400 
401 llxHeader(null, $langs->trans("Services"));
402 
403 $param = '';
404 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
405  $param .= '&contextpage='.urlencode($contextpage);
406 }
407 if ($limit > 0 && $limit != $conf->liste_limit) {
408  $param .= '&limit='.$limit;
409 }
410 if ($mode) {
411  $param .= '&amp;mode='.urlencode($mode);
412 }
413 if ($search_contract) {
414  $param .= '&amp;search_contract='.urlencode($search_contract);
415 }
416 if ($search_name) {
417  $param .= '&amp;search_name='.urlencode($search_name);
418 }
419 if ($search_subprice) {
420  $param .= '&amp;search_subprice='.urlencode($search_subprice);
421 }
422 if ($search_qty) {
423  $param .= '&amp;search_qty='.urlencode($search_qty);
424 }
425 if ($search_total_ht) {
426  $param .= '&amp;search_total_ht='.urlencode($search_total_ht);
427 }
428 if ($search_total_tva) {
429  $param .= '&amp;search_total_tva='.urlencode($search_total_tva);
430 }
431 if ($search_total_ttc) {
432  $param .= '&amp;search_total_ttc='.urlencode($search_total_ttc);
433 }
434 if ($search_service) {
435  $param .= '&amp;search_service='.urlencode($search_service);
436 }
437 if ($search_status) {
438  $param .= '&amp;search_status='.urlencode($search_status);
439 }
440 if ($filter) {
441  $param .= '&amp;filter='.urlencode($filter);
442 }
443 if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) {
444  $param .= '&amp;filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
445 }
446 if (!empty($filter_op1) && $filter_op1 != -1) {
447  $param .= '&amp;filter_op1='.urlencode($filter_op1);
448 }
449 if (!empty($filter_op2) && $filter_op2 != -1) {
450  $param .= '&amp;filter_op2='.urlencode($filter_op2);
451 }
452 if (!empty($filter_opcloture) && $filter_opcloture != -1) {
453  $param .= '&amp;filter_opcloture='.urlencode($filter_opcloture);
454 }
455 if ($filter_dateouvertureprevue_start != '') {
456  $param .= '&amp;opouvertureprevueday='.((int) $opouvertureprevueday).'&amp;opouvertureprevuemonth='.((int) $opouvertureprevuemonth).'&amp;opouvertureprevueyear='.((int) $opouvertureprevueyear);
457 }
458 if ($filter_date1_start != '') {
459  $param .= '&amp;op1day='.((int) $op1day).'&amp;op1month='.((int) $op1month).'&amp;op1year='.((int) $op1year);
460 }
461 if ($filter_date2_start != '') {
462  $param .= '&amp;op2day='.((int) $op2day).'&amp;op2month='.((int) $op2month).'&amp;op2year='.((int) $op2year);
463 }
464 if ($filter_datecloture_start != '') {
465  $param .= '&amp;opclotureday='.((int) $op2day).'&amp;opcloturemonth='.((int) $op2month).'&amp;opclotureyear='.((int) $op2year);
466 }
467 
468 if ($optioncss != '') {
469  $param .= '&optioncss='.urlencode($optioncss);
470 }
471 // Add $param from extra fields
472 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
473 
474 // List of mass actions available
475 $arrayofmassactions = array(
476  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
477  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
478 );
479 //if ($user->hasRight('contrat', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
480 //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
481 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
482 
483 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
484 if ($optioncss != '') {
485  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
486 }
487 print '<input type="hidden" name="token" value="'.newToken().'">';
488 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
489 print '<input type="hidden" name="action" value="list">';
490 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
491 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
492 print '<input type="hidden" name="page" value="'.$page.'">';
493 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
494 
495 $title = $langs->trans("ListOfServices");
496 if ($search_status == "0") {
497  $title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
498 }
499 if ($search_status == "4" && $filter != "expired") {
500  $title = $langs->trans("ListOfRunningServices");
501 }
502 if ($search_status == "4" && $filter == "expired") {
503  $title = $langs->trans("ListOfExpiredServices");
504 }
505 if ($search_status == "5") {
506  $title = $langs->trans("ListOfClosedServices");
507 }
508 
509 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit);
510 
511 if (!empty($sall)) {
512  foreach ($fieldstosearchall as $key => $val) {
513  $fieldstosearchall[$key] = $langs->trans($val);
514  }
515  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
516 }
517 
518 $morefilter = '';
519 $moreforfilter = '';
520 
521 // If the user can view categories of products
522 if (isModEnabled('categorie') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
523  include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
524  $moreforfilter .= '<div class="divsearchfield">';
525  $tmptitle = $langs->trans('IncludingProductWithTag');
526  $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
527  $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);
528  $moreforfilter .= '</div>';
529 }
530 
531 $parameters = array();
532 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
533 if (empty($reshook)) {
534  $moreforfilter .= $hookmanager->resPrint;
535 } else {
536  $moreforfilter = $hookmanager->resPrint;
537 }
538 
539 
540 if (!empty($moreforfilter)) {
541  print '<div class="liste_titre liste_titre_bydiv centpercent">';
542  print $moreforfilter;
543  print '</div>';
544 }
545 
546 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
547 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
548 
549 
550 print '<div class="div-table-responsive">';
551 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
552 
553 
554 print '<tr class="liste_titre">';
555 if (!empty($arrayfields['c.ref']['checked'])) {
556  print '<td class="liste_titre">';
557  print '<input type="hidden" name="filter" value="'.$filter.'">';
558  print '<input type="hidden" name="mode" value="'.$mode.'">';
559  print '<input type="text" class="flat maxwidth75" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
560  print '</td>';
561 }
562 // Service label
563 if (!empty($arrayfields['p.description']['checked'])) {
564  print '<td class="liste_titre">';
565  print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
566  print '</td>';
567 }
568 // detail lines
569 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
570  print '<td class="liste_titre">';
571  print '</td>';
572 }
573 if (!empty($arrayfields['cd.subprice']['checked'])) {
574  print '<td class="liste_titre right">';
575  print '<input type="text" class="flat maxwidth50 right" name="search_subprice" value="'.dol_escape_htmltag($search_subprice).'">';
576  print '</td>';
577 }
578 if (!empty($arrayfields['cd.qty']['checked'])) {
579  print '<td class="liste_titre right">';
580  print '<input type="text" class="flat maxwidth50 right" name="search_qty" value="'.dol_escape_htmltag($search_qty).'">';
581  print '</td>';
582 }
583 if (!empty($arrayfields['cd.total_ht']['checked'])) {
584  print '<td class="liste_titre right">';
585  print '<input type="text" class="flat maxwidth50" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).'">';
586  print '</td>';
587 }
588 if (!empty($arrayfields['cd.total_tva']['checked'])) {
589  print '<td class="liste_titre right">';
590  print '<input type="text" class="flat maxwidth50" name="search_total_tva" value="'.dol_escape_htmltag($search_total_tva).'">';
591  print '</td>';
592 }
593 // Third party
594 if (!empty($arrayfields['s.nom']['checked'])) {
595  print '<td class="liste_titre">';
596  print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
597  print '</td>';
598 }
599 
600 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
601  print '<td class="liste_titre center">';
602  $arrayofoperators = array('<'=>'<', '>'=>'>');
603  print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1, 0, 0, '', 0, 0, 0, '', 'width50');
604  print ' ';
605  $filter_dateouvertureprevue = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
606  print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0);
607  print '</td>';
608 }
609 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
610  print '<td class="liste_titre center">';
611  $arrayofoperators = array('<'=>'<', '>'=>'>');
612  print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1, 0, 0, '', 0, 0, 0, '', 'width50');
613  print ' ';
614  $filter_date1 = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
615  print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0);
616  print '</td>';
617 }
618 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
619  print '<td class="liste_titre center">';
620  $arrayofoperators = array('<'=>'<', '>'=>'>');
621  print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1, 0, 0, '', 0, 0, 0, '', 'width50');
622  print ' ';
623  $filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
624  print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0);
625  print '</td>';
626 }
627 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
628  print '<td class="liste_titre center">';
629  $arrayofoperators = array('<'=>'<', '>'=>'>');
630  print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1, 0, 0, '', 0, 0, 0, '', 'width50');
631  print ' ';
632  $filter_date_cloture = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
633  print $form->selectDate($filter_date_cloture, 'opcloture', 0, 0, 1, '', 1, 0);
634  print '</td>';
635 }
636 // Extra fields
637 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
638 
639 // Fields from hook
640 $parameters = array('arrayfields'=>$arrayfields);
641 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
642 print $hookmanager->resPrint;
643 if (!empty($arrayfields['cd.datec']['checked'])) {
644  // Date creation
645  print '<td class="liste_titre">';
646  print '</td>';
647 }
648 if (!empty($arrayfields['cd.tms']['checked'])) {
649  // Date modification
650  print '<td class="liste_titre">';
651  print '</td>';
652 }
653 if (!empty($arrayfields['status']['checked'])) {
654  // Status
655  print '<td class="liste_titre right parentonrightofpage">';
656  $arrayofstatus = array(
657  '0'=>$langs->trans("ServiceStatusInitial"),
658  '4'=>$langs->trans("ServiceStatusRunning"),
659  '4&filter=notexpired'=>$langs->trans("ServiceStatusNotLate"),
660  '4&filter=expired'=>$langs->trans("ServiceStatusLate"),
661  '5'=>$langs->trans("ServiceStatusClosed")
662  );
663  print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',') ?-1 : $search_status), 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
664  print '</td>';
665 }
666 // Action column
667 print '<td class="liste_titre maxwidthsearch">';
668 $searchpicto = $form->showFilterAndCheckAddButtons(0);
669 print $searchpicto;
670 print '</td>';
671 print "</tr>\n";
672 
673 print '<tr class="liste_titre">';
674 if (!empty($arrayfields['c.ref']['checked'])) {
675  print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
676 }
677 if (!empty($arrayfields['p.description']['checked'])) {
678  print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
679 }
680 if (!empty($arrayfields['cd.tva_tx']['checked'])) {
681  print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
682 }
683 if (!empty($arrayfields['cd.subprice']['checked'])) {
684  print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
685 }
686 if (!empty($arrayfields['cd.qty']['checked'])) {
687  print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'right nowrap ');
688 }
689 if (!empty($arrayfields['cd.total_ht']['checked'])) {
690  print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'right nowrap ');
691 }
692 if (!empty($arrayfields['cd.total_tva']['checked'])) {
693  print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'right nowrap ');
694 }
695 if (!empty($arrayfields['s.nom']['checked'])) {
696  print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
697 }
698 if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
699  print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
700 }
701 if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
702  print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
703 }
704 if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
705  print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
706 }
707 if (!empty($arrayfields['cd.date_cloture']['checked'])) {
708  print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
709 }
710 // Extra fields
711 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
712 // Hook fields
713 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
714 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
715 print $hookmanager->resPrint;
716 if (!empty($arrayfields['cd.datec']['checked'])) {
717  print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
718 }
719 if (!empty($arrayfields['cd.tms']['checked'])) {
720  print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
721 }
722 if (!empty($arrayfields['status']['checked'])) {
723  print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
724 }
725 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
726 print "</tr>\n";
727 
728 
729 $contractstatic = new Contrat($db);
730 $productstatic = new Product($db);
731 
732 $i = 0;
733 $totalarray = array('nbfield'=>0, 'cd.qty'=>0, 'cd.total_ht'=>0, 'cd.total_tva'=>0);
734 while ($i < min($num, $limit)) {
735  $obj = $db->fetch_object($resql);
736 
737  $contractstatic->id = $obj->cid;
738  $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
739  $contractstatic->ref_customer = $obj->ref_customer;
740  $contractstatic->ref_supplier = $obj->ref_supplier;
741 
742  $companystatic->id = $obj->socid;
743  $companystatic->name = $obj->name;
744  $companystatic->email = $obj->email;
745  $companystatic->client = $obj->client;
746  $companystatic->fournisseur = $obj->fournisseur;
747 
748  $productstatic->id = $obj->pid;
749  $productstatic->type = $obj->ptype;
750  $productstatic->ref = $obj->pref;
751  $productstatic->entity = $obj->pentity;
752  $productstatic->status = $obj->tosell;
753  $productstatic->status_buy = $obj->tobuy;
754  $productstatic->label = $obj->label;
755  $productstatic->description = $obj->description;
756  $productstatic->barcode = $obj->barcode;
757 
758  print '<tr class="oddeven">';
759 
760  // Ref
761  if (!empty($arrayfields['c.ref']['checked'])) {
762  print '<td class="nowraponall">';
763  print $contractstatic->getNomUrl(1, 16);
764  print '</td>';
765  if (!$i) {
766  $totalarray['nbfield']++;
767  }
768  }
769  // Service
770  if (!empty($arrayfields['p.description']['checked'])) {
771  print '<td class="tdoverflowmax300">';
772  if ($obj->pid > 0) {
773  print $productstatic->getNomUrl(1, '', 24);
774  print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
775  if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
776  print '<br><span class="small">'.dol_nl2br($obj->description).'</span>';
777  }
778  } else {
779  if ($obj->type == 0) {
780  print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
781  }
782  if ($obj->type == 1) {
783  print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
784  }
785  }
786  print '</td>';
787  if (!$i) {
788  $totalarray['nbfield']++;
789  }
790  }
791 
792  if (!empty($arrayfields['cd.tva_tx']['checked'])) {
793  print '<td class="right nowraponall">';
794  print price2num($obj->tva_tx).'%';
795  print '</td>';
796  if (!$i) {
797  $totalarray['nbfield']++;
798  }
799  }
800  if (!empty($arrayfields['cd.subprice']['checked'])) {
801  print '<td class="right nowraponall">';
802  print price($obj->subprice);
803  print '</td>';
804  if (!$i) {
805  $totalarray['nbfield']++;
806  }
807  }
808  if (!empty($arrayfields['cd.qty']['checked'])) {
809  print '<td class="right nowraponall">';
810  print $obj->qty;
811  print '</td>';
812  if (!$i) {
813  $totalarray['nbfield']++;
814  }
815  if (!$i) {
816  $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty';
817  }
818  if (!$i) {
819  $totalarray['val']['cd.qty'] = $obj->qty;
820  }
821  $totalarray['val']['cd.qty'] += $obj->qty;
822  }
823  if (!empty($arrayfields['cd.total_ht']['checked'])) {
824  print '<td class="right nowraponall">';
825  print '<span class="amount">'.price($obj->total_ht).'</span>';
826  print '</td>';
827  if (!$i) {
828  $totalarray['nbfield']++;
829  }
830  if (!$i) {
831  $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
832  }
833  $totalarray['val']['cd.total_ht'] += $obj->total_ht;
834  }
835  if (!empty($arrayfields['cd.total_tva']['checked'])) {
836  print '<td class="right nowraponall">';
837  print '<span class="amount">'.price($obj->total_tva).'</span>';
838  print '</td>';
839  if (!$i) {
840  $totalarray['nbfield']++;
841  }
842  if (!$i) {
843  $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
844  }
845  $totalarray['val']['cd.total_tva'] += $obj->total_tva;
846  }
847 
848  // Third party
849  if (!empty($arrayfields['s.nom']['checked'])) {
850  print '<td class="tdoverflowmax100">';
851  print $companystatic->getNomUrl(1, 'customer', 28);
852  print '</td>';
853  if (!$i) {
854  $totalarray['nbfield']++;
855  }
856  }
857 
858  // Start date
859  if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
860  print '<td class="center nowraponall">';
861  print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : '&nbsp;');
862  if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
863  print ' '.img_picto($langs->trans("Late"), "warning");
864  } else {
865  print '&nbsp;&nbsp;&nbsp;&nbsp;';
866  }
867  print '</td>';
868  if (!$i) {
869  $totalarray['nbfield']++;
870  }
871  }
872  if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
873  print '<td class="center nowraponall">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : '&nbsp;').'</td>';
874  if (!$i) {
875  $totalarray['nbfield']++;
876  }
877  }
878  // End date
879  if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
880  print '<td class="center nowraponall">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : '&nbsp;');
881  if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
882  $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
883  $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
884  print img_warning($textlate);
885  } else {
886  print '&nbsp;&nbsp;&nbsp;&nbsp;';
887  }
888  print '</td>';
889  if (!$i) {
890  $totalarray['nbfield']++;
891  }
892  }
893  // Close date (real end date)
894  if (!empty($arrayfields['cd.date_cloture']['checked'])) {
895  print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
896  if (!$i) {
897  $totalarray['nbfield']++;
898  }
899  }
900 
901  // Extra fields
902  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
903  // Fields from hook
904  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
905  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
906  print $hookmanager->resPrint;
907  // Date creation
908  if (!empty($arrayfields['cd.datec']['checked'])) {
909  print '<td class="center">';
910  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
911  print '</td>';
912  if (!$i) {
913  $totalarray['nbfield']++;
914  }
915  }
916  // Date modification
917  if (!empty($arrayfields['cd.tms']['checked'])) {
918  print '<td class="center nowraponall">';
919  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
920  print '</td>';
921  if (!$i) {
922  $totalarray['nbfield']++;
923  }
924  }
925  // Status
926  if (!empty($arrayfields['status']['checked'])) {
927  print '<td class="right">';
928  if ($obj->cstatut == 0) {
929  // If contract is draft, we say line is also draft
930  print $contractstatic->LibStatut(0, 5);
931  } else {
932  print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
933  }
934  print '</td>';
935  if (!$i) {
936  $totalarray['nbfield']++;
937  }
938  }
939  // Action column
940  print '<td class="nowrap center">';
941  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
942  $selected = 0;
943  if (in_array($obj->rowid, $arrayofselected)) {
944  $selected = 1;
945  }
946  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
947  }
948  print '</td>';
949  if (!$i) {
950  $totalarray['nbfield']++;
951  }
952 
953  print "</tr>\n";
954  $i++;
955 }
956 
957 // Show total line
958 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
959 
960 // If no record found
961 if ($num == 0) {
962  $colspan = 1;
963  foreach ($arrayfields as $key => $val) {
964  if (!empty($val['checked'])) {
965  $colspan++;
966  }
967  }
968  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
969 }
970 
971 $db->free($resql);
972 
973 $parameters = array('sql' => $sql);
974 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
975 print $hookmanager->resPrint;
976 
977 print '</table>';
978 print '</div>';
979 
980 print '</form>';
981 
982 
983 
984 llxFooter();
985 
986 $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') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
Definition: index.php:746
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...
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.
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.
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.