dolibarr  x.y.z
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
5  * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
7  * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
8  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
9  * Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
10  * Copyright (C) 2020 Tobias Sean <tobias.sekan@startmail.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>.
24  */
25 
32 // Load Dolibarr environment
33 require '../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
40 
41 if (isModEnabled('categorie')) {
42  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
43  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
44 }
45 
46 // Load translation files required by the page
47 $langs->loadLangs(array('projects', 'companies', 'commercial'));
48 if (isModEnabled('eventorganization') && $conf->eventorganization->enabled) {
49  $langs->loadLangs(array('eventorganization'));
50 }
51 
52 $action = GETPOST('action', 'aZ09');
53 $massaction = GETPOST('massaction', 'alpha');
54 $show_files = GETPOST('show_files', 'int');
55 $confirm = GETPOST('confirm', 'alpha');
56 $toselect = GETPOST('toselect', 'array');
57 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projectlist';
58 
59 $title = $langs->trans("Projects");
60 
61 // Security check
62 $socid = GETPOST('socid', 'int');
63 //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
64 if ($socid > 0) {
65  $soc = new Societe($db);
66  $soc->fetch($socid);
67  $title .= ' (<a href="list.php">'.$soc->name.'</a>)';
68 }
69 if (!$user->rights->projet->lire) {
71 }
72 
73 $diroutputmassaction = $conf->project->dir_output.'/temp/massgeneration/'.$user->id;
74 
75 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
76 $sortfield = GETPOST('sortfield', 'aZ09comma');
77 $sortorder = GETPOST('sortorder', 'aZ09comma');
78 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
79 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
80  // If $page is not defined, or '' or -1 or if we click on clear filters
81  $page = 0;
82 }
83 if (!$sortfield) {
84  $sortfield = "p.ref";
85 }
86 if (!$sortorder) {
87  $sortorder = "ASC";
88 }
89 $offset = $limit * $page;
90 $pageprev = $page - 1;
91 $pagenext = $page + 1;
92 
93 $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
94 $search_ref = GETPOST("search_ref", 'alpha');
95 $search_label = GETPOST("search_label", 'alpha');
96 $search_societe = GETPOST("search_societe", 'alpha');
97 $search_societe_alias = GETPOST("search_societe_alias", 'alpha');
98 $search_status = GETPOST("search_status", 'int');
99 $search_opp_status = GETPOST("search_opp_status", 'alpha');
100 $search_opp_percent = GETPOST("search_opp_percent", 'alpha');
101 $search_opp_amount = GETPOST("search_opp_amount", 'alpha');
102 $search_budget_amount = GETPOST("search_budget_amount", 'alpha');
103 $search_public = GETPOST("search_public", 'int');
104 $search_project_user = GETPOST('search_project_user', 'int');
105 $search_project_contact = GETPOST('search_project_contact', 'int');
106 $search_sale = GETPOST('search_sale', 'int');
107 $search_usage_opportunity = GETPOST('search_usage_opportunity', 'int');
108 $search_usage_task = GETPOST('search_usage_task', 'int');
109 $search_usage_bill_time = GETPOST('search_usage_bill_time', 'int');
110 $search_usage_event_organization = GETPOST('search_usage_event_organization', 'int');
111 $search_accept_conference_suggestions = GETPOST('search_accept_conference_suggestions', 'int');
112 $search_accept_booth_suggestions = GETPOST('search_accept_booth_suggestions', 'int');
113 $search_price_registration = GETPOST("search_price_registration", 'alpha');
114 $search_price_booth = GETPOST("search_price_booth", 'alpha');
115 $search_login = GETPOST('search_login', 'alpha');
116 $searchCategoryCustomerOperator = 0;
117 if (GETPOSTISSET('formfilteraction')) {
118  $searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int');
119 } elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
120  $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
121 }
122 $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array');
123 $optioncss = GETPOST('optioncss', 'alpha');
124 
125 $mine = ((GETPOST('mode') == 'mine') ? 1 : 0);
126 if ($mine) {
127  $search_project_user = $user->id; $mine = 0;
128 }
129 
130 $search_sday = GETPOST('search_sday', 'int');
131 $search_smonth = GETPOST('search_smonth', 'int');
132 $search_syear = GETPOST('search_syear', 'int');
133 $search_eday = GETPOST('search_eday', 'int');
134 $search_emonth = GETPOST('search_emonth', 'int');
135 $search_eyear = GETPOST('search_eyear', 'int');
136 
137 
138 $search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int');
139 $search_date_start_startyear = GETPOST('search_date_start_startyear', 'int');
140 $search_date_start_startday = GETPOST('search_date_start_startday', 'int');
141 $search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver
142 $search_date_start_endmonth = GETPOST('search_date_start_endmonth', 'int');
143 $search_date_start_endyear = GETPOST('search_date_start_endyear', 'int');
144 $search_date_start_endday = GETPOST('search_date_start_endday', 'int');
145 $search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver
146 
147 $search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
148 $search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
149 $search_date_end_startday = GETPOST('search_date_end_startday', 'int');
150 $search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver
151 $search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
152 $search_date_end_endyear = GETPOST('search_date_end_endyear', 'int');
153 $search_date_end_endday = GETPOST('search_date_end_endday', 'int');
154 $search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver
155 $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array");
156 
157 if ($search_status == '') {
158  $search_status = -1; // -1 or 1
159 }
160 
161 
162 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
163 $object = new Project($db);
164 $hookmanager->initHooks(array('projectlist'));
165 $extrafields = new ExtraFields($db);
166 
167 // fetch optionals attributes and labels
168 $extrafields->fetch_name_optionals_label($object->table_element);
169 
170 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
171 
172 // List of fields to search into when doing a "search in all"
173 $fieldstosearchall = array();
174 foreach ($object->fields as $key => $val) {
175  if (empty($val['searchall'])) {
176  continue;
177  }
178 
179  // Don't allow search in private notes for external users when doing "search in all"
180  if (!empty($user->socid) && $key == "note_private") {
181  continue;
182  }
183 
184  $fieldstosearchall['p.'.$key] = $val['label'];
185 }
186 
187 // Add name object fields to "search in all"
188 $fieldstosearchall['s.nom'] = "ThirdPartyName";
189 
190 // Definition of array of fields for columns
191 $arrayfields = array();
192 foreach ($object->fields as $key => $val) {
193  // If $val['visible']==0, then we never show the field
194  if (!empty($val['visible'])) {
195  $visible = dol_eval($val['visible'], 1, 1, '1');
196  $arrayfields['p.'.$key] = array(
197  'label'=>$val['label'],
198  'checked'=>(($visible < 0) ? 0 : 1),
199  'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
200  'position'=>$val['position'],
201  'help'=> isset($val['help']) ? $val['help'] : ''
202  );
203  }
204 }
205 // Extra fields
206 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
207 
208 // Add non object fields to fields for list
209 $arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>21, 'enabled'=>(!isModEnabled('societe') ? 0 : 1));
210 $arrayfields['s.name_alias'] = array('label'=>"AliasNameShort", 'checked'=>0, 'position'=>22);
211 $arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'position'=>23);
212 $arrayfields['c.assigned'] = array('label'=>$langs->trans("AssignedTo"), 'checked'=>-1, 'position'=>120);
213 $arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1), 'position'=>106);
214 $arrayfields['u.login'] = array('label'=>"Author", 'checked'=>1, 'position'=>165);
215 // Force some fields according to search_usage filter...
216 if (GETPOST('search_usage_opportunity')) {
217  //$arrayfields['p.usage_opportunity']['visible'] = 1; // Not require, filter on search_opp_status is enough
218  //$arrayfields['p.usage_opportunity']['checked'] = 1; // Not require, filter on search_opp_status is enough
219 }
220 if (GETPOST('search_usage_event_organization')) {
221  $arrayfields['p.fk_opp_status']['enabled'] = 0;
222  $arrayfields['p.opp_amount']['enabled'] = 0;
223  $arrayfields['p.opp_percent']['enabled'] = 0;
224  $arrayfields['opp_weighted_amount']['enabled'] = 0;
225  $arrayfields['p.usage_organize_event']['visible'] = 1;
226  $arrayfields['p.usage_organize_event']['checked'] = 1;
227 }
228 
229 $object->fields = dol_sort_array($object->fields, 'position');
230 $arrayfields = dol_sort_array($arrayfields, 'position');
231 
232 
233 /*
234  * Actions
235  */
236 
237 if (GETPOST('cancel', 'alpha')) {
238  $action = 'list';
239  $massaction = '';
240 }
241 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
242  $massaction = '';
243 }
244 
245 $parameters = array('socid'=>$socid);
246 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
247 if ($reshook < 0) {
248  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
249 }
250 
251 if (empty($reshook)) {
252  // Selection of new fields
253  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
254 
255  // Purge search criteria
256  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
257  $search_all = '';
258  $search_ref = "";
259  $search_label = "";
260  $search_societe = "";
261  $search_societe_alias = '';
262  $search_status = -1;
263  $search_opp_status = -1;
264  $search_opp_amount = '';
265  $search_opp_percent = '';
266  $search_budget_amount = '';
267  $search_public = "";
268  $search_sale = "";
269  $search_project_user = '';
270  $search_project_contact = '';
271  $search_sday = "";
272  $search_smonth = "";
273  $search_syear = "";
274  $search_eday = "";
275  $search_emonth = "";
276  $search_eyear = "";
277  $search_date_start_startmonth = "";
278  $search_date_start_startyear = "";
279  $search_date_start_startday = "";
280  $search_date_start_start = "";
281  $search_date_start_endmonth = "";
282  $search_date_start_endyear = "";
283  $search_date_start_endday = "";
284  $search_date_start_end = "";
285  $search_date_end_startmonth = "";
286  $search_date_end_startyear = "";
287  $search_date_end_startday = "";
288  $search_date_end_start = "";
289  $search_date_end_endmonth = "";
290  $search_date_end_endyear = "";
291  $search_date_end_endday = "";
292  $search_date_end_end = "";
293  $search_usage_opportunity = '';
294  $search_usage_task = '';
295  $search_usage_bill_time = '';
296  $search_usage_event_organization = '';
297  $search_accept_conference_suggestions = '';
298  $search_accept_booth_suggestions = '';
299  $search_price_registration = '';
300  $search_price_booth = '';
301  $search_login = '';
302  $toselect = array();
303  $search_array_options = array();
304  $search_category_array = array();
305  }
306 
307 
308  // Mass actions
309  $objectclass = 'Project';
310  $objectlabel = 'Project';
311  $permissiontoread = $user->rights->projet->lire;
312  $permissiontodelete = $user->rights->projet->supprimer;
313  $permissiontoadd = $user->rights->projet->creer;
314  $uploaddir = $conf->project->dir_output;
315  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
316 
317  // Close records
318  if (!$error && $massaction == 'close' && $user->rights->projet->creer) {
319  $db->begin();
320 
321  $objecttmp = new $objectclass($db);
322  $nbok = 0;
323  foreach ($toselect as $toselectid) {
324  $result = $objecttmp->fetch($toselectid);
325  if ($result > 0) {
326  $userWrite = $object->restrictedProjectArea($user, 'write');
327  if ($userWrite > 0 && $objecttmp->statut == 1) {
328  $result = $objecttmp->setClose($user);
329  if ($result <= 0) {
330  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
331  $error++;
332  break;
333  } else {
334  $nbok++;
335  }
336  } elseif ($userWrite <= 0) {
337  setEventMessages($langs->trans("DontHavePermissionForCloseProject", $objecttmp->ref), null, 'warnings');
338  } else {
339  setEventMessages($langs->trans("DontHaveTheValidateStatus", $objecttmp->ref), null, 'warnings');
340  }
341  } else {
342  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
343  $error++;
344  break;
345  }
346  }
347 
348  if (!$error) {
349  if ($nbok > 1) {
350  setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs');
351  } else {
352  setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs');
353  }
354  $db->commit();
355  } else {
356  $db->rollback();
357  }
358  }
359 }
360 
361 
362 /*
363  * View
364  */
365 
366 $form = new Form($db);
367 $formcompany = new FormCompany($db);
368 
369 $companystatic = new Societe($db);
370 $taskstatic = new Task($db);
371 $formother = new FormOther($db);
372 $formproject = new FormProjets($db);
373 
374 $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
375 $title = $langs->trans("LeadsOrProjects");
376 if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
377  $title = $langs->trans("Projects");
378 }
379 if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
380  $title = $langs->trans("Leads");
381 }
382 $morejs = array();
383 $morecss = array();
384 
385 
386 // Get list of project id allowed to user (in a string list separated by comma)
387 $projectsListId = '';
388 if (empty($user->rights->projet->all->lire)) {
389  $projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
390 }
391 
392 // Get id of types of contacts for projects (This list never contains a lot of elements)
393 $listofprojectcontacttype = array();
394 $listofprojectcontacttypeexternal = array();
395 $sql = "SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
396 $sql .= " WHERE ctc.element = '".$db->escape($object->element)."'";
397 $resql = $db->query($sql);
398 if ($resql) {
399  while ($obj = $db->fetch_object($resql)) {
400  if ($obj->source == 'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code;
401  else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
402  }
403 } else {
404  dol_print_error($db);
405 }
406 if (count($listofprojectcontacttype) == 0) {
407  $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
408 }
409 if (count($listofprojectcontacttypeexternal) == 0) {
410  $listofprojectcontacttypeexternal[0] = '0'; // To avoid sql syntax error if not found
411 }
412 
413 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
414 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
415 
416 $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
417 $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
418 $sql .= " p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,";
419 $sql .= " p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
420 $sql .= " p.email_msgid, p.import_key,";
421 $sql .= " p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,";
422 $sql .= " s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
423 $sql .= " country.code as country_code,";
424 $sql .= " cls.code as opp_status_code,";
425 $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
426 // Add fields from extrafields
427 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
428  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
429  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
430  }
431 }
432 // Add fields from hooks
433 $parameters = array();
434 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
435 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
436 $sql = preg_replace('/,\s*$/', '', $sql);
437 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as p";
438 if (!empty($extrafields->attributes[$object->table_element]['label']) &&is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
439  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
440 }
441 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
442 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
443 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
444 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON p.fk_user_creat = u.rowid';
445 // We'll need this table joined to the select in order to filter by sale
446 // No check is done on company permission because readability is managed by public status of project and assignement.
447 //if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
448 if ($search_sale > 0) {
449  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
450 }
451 if ($search_project_user > 0) {
452  $sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp";
453 }
454 if ($search_project_contact > 0) {
455  $sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp_contact";
456 }
457 
458 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
459 $sql .= $hookmanager->resPrint;
460 
461 $sql .= " WHERE p.entity IN (".getEntity('project').')';
462 if (empty($user->rights->projet->all->lire)) {
463  $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
464 }
465 // No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser
466 if ($socid > 0) {
467  $sql .= " AND (p.fk_soc = ".((int) $socid).")"; // This filter if when we use a hard coded filter on company on url (not related to filter for external users)
468 }
469 if ($search_ref) {
470  $sql .= natural_search('p.ref', $search_ref);
471 }
472 if ($search_label) {
473  $sql .= natural_search('p.title', $search_label);
474 }
475 if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
476  $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
477 } else {
478  if ($search_societe) {
479  $sql .= natural_search('s.nom', $search_societe);
480  }
481  if ($search_societe_alias) {
482  $sql .= natural_search('s.name_alias', $search_societe_alias);
483  }
484 }
485 if ($search_opp_amount) {
486  $sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
487 }
488 if ($search_opp_percent) {
489  $sql .= natural_search('p.opp_percent', $search_opp_percent, 1);
490 }
491 $sql .= dolSqlDateFilter('p.dateo', $search_sday, $search_smonth, $search_syear);
492 $sql .= dolSqlDateFilter('p.datee', $search_eday, $search_emonth, $search_eyear);
493 
494 
495 if ($search_date_start_start) {
496  $sql .= " AND p.dateo >= '".$db->idate($search_date_start_start)."'";
497 }
498 if ($search_date_start_end) {
499  $sql .= " AND p.dateo <= '".$db->idate($search_date_start_end)."'";
500 }
501 
502 if ($search_date_end_start) {
503  $sql .= " AND p.datee >= '".$db->idate($search_date_end_start)."'";
504 }
505 if ($search_date_end_end) {
506  $sql .= " AND p.datee <= '".$db->idate($search_date_end_end)."'";
507 }
508 
509 if ($search_all) {
510  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
511 }
512 if ($search_status >= 0) {
513  if ($search_status == 99) {
514  $sql .= " AND p.fk_statut <> 2";
515  } else {
516  $sql .= " AND p.fk_statut = ".((int) $search_status);
517  }
518 }
519 if ($search_opp_status) {
520  if (is_numeric($search_opp_status) && $search_opp_status > 0) {
521  $sql .= " AND p.fk_opp_status = ".((int) $search_opp_status);
522  }
523  if ($search_opp_status == 'all') {
524  $sql .= " AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
525  }
526  if ($search_opp_status == 'openedopp') {
527  $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1 AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))";
528  }
529  if ($search_opp_status == 'notopenedopp') {
530  $sql .= " AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1 OR p.fk_opp_status IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code = 'WON'))";
531  }
532  if ($search_opp_status == 'none') {
533  $sql .= " AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
534  }
535 }
536 if ($search_public != '') {
537  $sql .= " AND p.public = ".((int) $search_public);
538 }
539 // For external user, no check is done on company permission because readability is managed by public status of project and assignement.
540 //if ($socid > 0) $sql.= " AND s.rowid = ".((int) $socid);
541 if ($search_sale > 0) {
542  $sql .= " AND sc.fk_user = ".((int) $search_sale);
543 }
544 // No check is done on company permission because readability is managed by public status of project and assignement.
545 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id).") OR (s.rowid IS NULL))";
546 if ($search_project_user > 0) {
547  $sql .= " AND ecp.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
548 }
549 if ($search_project_contact > 0) {
550  $sql .= " AND ecp_contact.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttypeexternal))).") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact);
551 }
552 if ($search_opp_amount != '') {
553  $sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
554 }
555 if ($search_budget_amount != '') {
556  $sql .= natural_search('p.budget_amount', $search_budget_amount, 1);
557 }
558 if ($search_usage_opportunity != '' && $search_usage_opportunity >= 0) {
559  $sql .= natural_search('p.usage_opportunity', $search_usage_opportunity, 2);
560 }
561 if ($search_usage_task != '' && $search_usage_task >= 0) {
562  $sql .= natural_search('p.usage_task', $search_usage_task, 2);
563 }
564 if ($search_usage_bill_time != '' && $search_usage_bill_time >= 0) {
565  $sql .= natural_search('p.usage_bill_time', $search_usage_bill_time, 2);
566 }
567 if ($search_usage_event_organization != '' && $search_usage_event_organization >= 0) {
568  $sql .= natural_search('p.usage_organize_event', $search_usage_event_organization, 2);
569 }
570 if ($search_accept_conference_suggestions != '' && $search_accept_conference_suggestions >= 0) {
571  $sql .= natural_search('p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
572 }
573 if ($search_accept_booth_suggestions != '' && $search_accept_booth_suggestions >= 0) {
574  $sql .= natural_search('p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
575 }
576 if ($search_price_registration != '') {
577  $sql .= natural_search('p.price_registration', $search_price_registration, 1);
578 }
579 if ($search_price_booth != '') {
580  $sql .= natural_search('p.price_booth', $search_price_booth, 1);
581 }
582 if ($search_login) {
583  $sql .= natural_search(array('u.login', 'u.firstname', 'u.lastname'), $search_login);
584 }
585 // Search for tag/category ($searchCategoryProjectList is an array of ID)
586 $searchCategoryProjectList = $search_category_array;
587 $searchCategoryProjectOperator = 0;
588 if (!empty($searchCategoryProjectList)) {
589  $searchCategoryProjectSqlList = array();
590  $listofcategoryid = '';
591  foreach ($searchCategoryProjectList as $searchCategoryProject) {
592  if (intval($searchCategoryProject) == -2) {
593  $searchCategoryProjectSqlList[] = "NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX."categorie_project as ck WHERE p.rowid = ck.fk_project)";
594  } elseif (intval($searchCategoryProject) > 0) {
595  if ($searchCategoryProjectOperator == 0) {
596  $searchCategoryProjectSqlList[] = " EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX."categorie_project as ck WHERE p.rowid = ck.fk_project AND ck.fk_categorie = ".((int) $searchCategoryProject).")";
597  } else {
598  $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProject);
599  }
600  }
601  }
602  if ($listofcategoryid) {
603  $searchCategoryProjectSqlList[] = " EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX."categorie_project as ck WHERE p.rowid = ck.fk_project AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
604  }
605  if ($searchCategoryProjectOperator == 1) {
606  if (!empty($searchCategoryProjectSqlList)) {
607  $sql .= " AND (".implode(' OR ', $searchCategoryProjectSqlList).")";
608  }
609  } else {
610  if (!empty($searchCategoryProjectSqlList)) {
611  $sql .= " AND (".implode(' AND ', $searchCategoryProjectSqlList).")";
612  }
613  }
614 }
615 $searchCategoryCustomerSqlList = array();
616 if ($searchCategoryCustomerOperator == 1) {
617  $existsCategoryCustomerList = array();
618  foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
619  if (intval($searchCategoryCustomer) == -2) {
620  $sqlCategoryCustomerNotExists = " NOT EXISTS (";
621  $sqlCategoryCustomerNotExists .= " SELECT cat_cus.fk_soc";
622  $sqlCategoryCustomerNotExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
623  $sqlCategoryCustomerNotExists .= " WHERE cat_cus.fk_soc = p.fk_soc";
624  $sqlCategoryCustomerNotExists .= " )";
625  $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
626  } elseif (intval($searchCategoryCustomer) > 0) {
627  $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
628  }
629  }
630  if (!empty($existsCategoryCustomerList)) {
631  $sqlCategoryCustomerExists = " EXISTS (";
632  $sqlCategoryCustomerExists .= " SELECT cat_cus.fk_soc";
633  $sqlCategoryCustomerExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
634  $sqlCategoryCustomerExists .= " WHERE cat_cus.fk_soc = p.fk_soc";
635  $sqlCategoryCustomerExists .= " AND cat_cus.fk_categorie IN (".$db->sanitize(implode(',', $existsCategoryCustomerList)).")";
636  $sqlCategoryCustomerExists .= " )";
637  $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
638  }
639  if (!empty($searchCategoryCustomerSqlList)) {
640  $sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
641  }
642 } else {
643  foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
644  if (intval($searchCategoryCustomer) == -2) {
645  $sqlCategoryCustomerNotExists = " NOT EXISTS (";
646  $sqlCategoryCustomerNotExists .= " SELECT cat_cus.fk_soc";
647  $sqlCategoryCustomerNotExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
648  $sqlCategoryCustomerNotExists .= " WHERE cat_cus.fk_soc = p.fk_soc";
649  $sqlCategoryCustomerNotExists .= " )";
650  $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
651  } elseif (intval($searchCategoryCustomer) > 0) {
652  $searchCategoryCustomerSqlList[] = "p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix()."categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).")";
653  }
654  }
655  if (!empty($searchCategoryCustomerSqlList)) {
656  $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
657  }
658 }
659 // Add where from extra fields
660 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
661 // Add where from hooks
662 $parameters = array();
663 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
664 $sql .= $hookmanager->resPrint;
665 $sql .= $db->order($sortfield, $sortorder);
666 
667 // Count total nb of records
668 $nbtotalofrecords = '';
669 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
670  $resql = $db->query($sql);
671  $nbtotalofrecords = $db->num_rows($resql);
672  if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
673  $page = 0;
674  $offset = 0;
675  }
676 }
677 // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
678 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
679  $num = $nbtotalofrecords;
680 } else {
681  if (!empty($limit)) {
682  $sql .= $db->plimit($limit + 1, $offset);
683  }
684 
685  $resql = $db->query($sql);
686  if (!$resql) {
687  dol_print_error($db);
688  exit;
689  }
690 
691  $num = $db->num_rows($resql);
692 }
693 
694 // Direct jump if only one record found
695 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
696  $obj = $db->fetch_object($resql);
697  header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$obj->id);
698  exit;
699 }
700 
701 
702 // Output page
703 // --------------------------------------------------------------------
704 
705 dol_syslog("list allowed project", LOG_DEBUG);
706 
707 llxHeader('', $title, $help_url);
708 
709 $arrayofselected = is_array($toselect) ? $toselect : array();
710 
711 $param = '';
712 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
713  $param .= '&contextpage='.urlencode($contextpage);
714 }
715 if ($limit > 0 && $limit != $conf->liste_limit) {
716  $param .= '&limit='.urlencode($limit);
717 }
718 if ($search_all != '') {
719  $param .= '&search_all='.urlencode($search_all);
720 }
721 if ($search_sday) {
722  $param .= '&search_sday='.urlencode($search_sday);
723 }
724 if ($search_smonth) {
725  $param .= '&search_smonth='.urlencode($search_smonth);
726 }
727 if ($search_syear) {
728  $param .= '&search_syear='.urlencode($search_syear);
729 }
730 if ($search_eday) {
731  $param .= '&search_eday='.urlencode($search_eday);
732 }
733 if ($search_emonth) {
734  $param .= '&search_emonth='.urlencode($search_emonth);
735 }
736 if ($search_eyear) {
737  $param .= '&search_eyear='.urlencode($search_eyear);
738 }
739 if ($search_date_start_startmonth) {
740  $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth);
741 }
742 if ($search_date_start_startyear) {
743  $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear);
744 }
745 if ($search_date_start_startday) {
746  $param .= '&search_date_start_startday='.urlencode($search_date_start_startday);
747 }
748 if ($search_date_start_start) {
749  $param .= '&search_date_start_start='.urlencode($search_date_start_start);
750 }
751 if ($search_date_start_endmonth) {
752  $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth);
753 }
754 if ($search_date_start_endyear) {
755  $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear);
756 }
757 if ($search_date_start_endday) {
758  $param .= '&search_date_start_endday='.urlencode($search_date_start_endday);
759 }
760 if ($search_date_start_end) {
761  $param .= '&search_date_start_end='.urlencode($search_date_start_end);
762 }
763 if ($search_date_end_startmonth) {
764  $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
765 }
766 if ($search_date_end_startyear) {
767  $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear);
768 }
769 if ($search_date_end_startday) {
770  $param .= '&search_date_end_startday='.urlencode($search_date_end_startday);
771 }
772 if ($search_date_end_start) {
773  $param .= '&search_date_end_start='.urlencode($search_date_end_start);
774 }
775 if ($search_date_end_endmonth) {
776  $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
777 }
778 if ($search_date_end_endyear) {
779  $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear);
780 }
781 if ($search_date_end_endday) {
782  $param .= '&search_date_end_endday='.urlencode($search_date_end_endday);
783 }
784 if ($search_date_end_end) {
785  $param .= '&search_date_end_end=' . urlencode($search_date_end_end);
786 }
787 if ($socid) {
788  $param .= '&socid='.urlencode($socid);
789 }
790 if (!empty($search_categ)) {
791  $param .= '&search_categ='.urlencode($search_categ);
792 }
793 if ($search_ref != '') {
794  $param .= '&search_ref='.urlencode($search_ref);
795 }
796 if ($search_label != '') {
797  $param .= '&search_label='.urlencode($search_label);
798 }
799 if ($search_societe != '') {
800  $param .= '&search_societe='.urlencode($search_societe);
801 }
802 if ($search_societe_alias != '') {
803  $param .= '&search_societe_alias='.urlencode($search_societe_alias);
804 }
805 if ($search_status >= 0) {
806  $param .= '&search_status='.urlencode($search_status);
807 }
808 if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'openedopp', 'notopenedopp', 'none'))) {
809  $param .= '&search_opp_status='.urlencode($search_opp_status);
810 }
811 if ($search_opp_percent != '') {
812  $param .= '&search_opp_percent='.urlencode($search_opp_percent);
813 }
814 if ($search_public != '') {
815  $param .= '&search_public='.urlencode($search_public);
816 }
817 if ($search_project_user > 0) {
818  $param .= '&search_project_user='.urlencode($search_project_user);
819 }
820 if ($search_project_contact != '') {
821  $param .= '&search_project_user='.urlencode($search_project_contact);
822 }
823 if ($search_sale > 0) {
824  $param .= '&search_sale='.urlencode($search_sale);
825 }
826 if ($search_opp_amount != '') {
827  $param .= '&search_opp_amount='.urlencode($search_opp_amount);
828 }
829 if ($search_budget_amount != '') {
830  $param .= '&search_budget_amount='.urlencode($search_budget_amount);
831 }
832 if ($search_usage_task != '') {
833  $param .= '&search_usage_task='.urlencode($search_usage_task);
834 }
835 if ($search_usage_bill_time != '') {
836  $param .= '&search_usage_opportunity='.urlencode($search_usage_bill_time);
837 }
838 if ($search_usage_event_organization != '') {
839  $param .= '&search_usage_event_organization='.urlencode($search_usage_event_organization);
840 }
841 if ($search_accept_conference_suggestions != '') {
842  $param .= '&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
843 }
844 if ($search_accept_booth_suggestions != '') {
845  $param .= '&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
846 }
847 if ($search_price_registration != '') {
848  $param .= '&search_price_registration='.urlencode($search_price_registration);
849 }
850 if ($search_price_booth != '') {
851  $param .= '&search_price_booth='.urlencode($search_price_booth);
852 }
853 if ($search_login) {
854  $param .= '&search_login='.urlencode($search_login);
855 }
856 if ($optioncss != '') {
857  $param .= '&optioncss='.urlencode($optioncss);
858 }
859 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
860  $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
861 }
862 // Add $param from extra fields
863 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
864 
865 // List of mass actions available
866 $arrayofmassactions = array(
867  'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
868  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
869  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
870 );
871 //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
872 if ($user->rights->projet->creer) {
873  $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close");
874  $arrayofmassactions['preaffectuser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AffectUser");
875 }
876 if ($user->rights->projet->supprimer) {
877  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
878 }
879 if (isModEnabled('category') && $user->rights->projet->creer) {
880  $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
881 }
882 if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preaffectuser'))) {
883  $arrayofmassactions = array();
884 }
885 
886 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
887 
888 $url = DOL_URL_ROOT.'/projet/card.php?action=create';
889 if (!empty($socid)) {
890  $url .= '&socid='.$socid;
891 }
892 if ($search_usage_event_organization == 1) {
893  $url .= '&usage_organize_event=1';
894 }
895 $newcardbutton = dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url, '', $user->rights->projet->creer);
896 
897 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
898 if ($optioncss != '') {
899  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
900 }
901 print '<input type="hidden" name="token" value="'.newToken().'">';
902 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
903 print '<input type="hidden" name="action" value="list">';
904 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
905 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
906 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
907 
908 // Show description of content
909 $texthelp = '';
910 if ($search_project_user == $user->id) {
911  $texthelp .= $langs->trans("MyProjectsDesc");
912 } else {
913  if ($user->rights->projet->all->lire && !$socid) {
914  $texthelp .= $langs->trans("ProjectsDesc");
915  } else {
916  $texthelp .= $langs->trans("ProjectsPublicDesc");
917  }
918 }
919 
920 print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1);
921 
922 
923 $topicmail = "Information";
924 $modelmail = "project";
925 $objecttmp = new Project($db);
926 $trackid = 'proj'.$object->id;
927 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
928 
929 if ($search_all) {
930  foreach ($fieldstosearchall as $key => $val) {
931  $fieldstosearchall[$key] = $langs->trans($val);
932  }
933  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
934 }
935 
936 $moreforfilter = '';
937 
938 // If the user can view user other than himself
939 $moreforfilter .= '<div class="divsearchfield">';
940 $tmptitle = $langs->trans('ProjectsWithThisUserAsContact');
941 //$includeonly = 'hierarchyme';
942 $includeonly = '';
943 if (empty($user->rights->user->user->lire)) {
944  $includeonly = array($user->id);
945 }
946 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
947 $moreforfilter .= '</div>';
948 
949 $moreforfilter .= '<div class="divsearchfield">';
950 $tmptitle = $langs->trans('ProjectsWithThisContact');
951 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth250 widthcentpercentminusx');
952 $moreforfilter .= '</div>';
953 
954 // If the user can view thirdparties other than his'
955 if ($user->rights->user->user->lire) {
956  $langs->load("commercial");
957  $moreforfilter .= '<div class="divsearchfield">';
958  $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
959  $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx');
960  $moreforfilter .= '</div>';
961 }
962 
963 // Filter on categories
964 if (isModEnabled('categorie') && $user->rights->categorie->lire) {
965  $formcategory = new FormCategory($db);
966  $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array);
967 }
968 // Filter on customer categories
969 if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
970  $moreforfilter .= '<div class="divsearchfield">';
971  $tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort');
972  $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
973  $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER, '', '', 64, 0, 1);
974  $categoriesArr[-2] = '- '.$langs->trans('NotCategorized').' -';
975  $moreforfilter .= Form::multiselectarray('search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0, 'minwidth300', 0, 0, '', 'category', $tmptitle);
976  $moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ? ' checked="checked"' : '').'/>';
977  $moreforfilter .= $form->textwithpicto('', $langs->trans('UseOrOperatorForCategories') . ' : ' . $tmptitle, 1, 'help', '', 0, 2, 'tooltip_cat_cus'); // Tooltip on click
978  $moreforfilter .= '</div>';
979 }
980 
981 if (!empty($moreforfilter)) {
982  print '<div class="liste_titre liste_titre_bydiv centpercent">';
983  print $moreforfilter;
984  $parameters = array();
985  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
986  print $hookmanager->resPrint;
987  print '</div>';
988 }
989 
990 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
991 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
992 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
993 
994 
995 print '<div class="div-table-responsive">';
996 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
997 
998 // Fields title search
999 // --------------------------------------------------------------------
1000 print '<tr class="liste_titre_filter">';
1001 // Action column
1002 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1003  print '<td class="liste_titre maxwidthsearch">';
1004  $searchpicto = $form->showFilterButtons('left');
1005  print $searchpicto;
1006  print '</td>';
1007 }
1008 // Project ref
1009 if (!empty($arrayfields['p.ref']['checked'])) {
1010  print '<td class="liste_titre">';
1011  print '<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="6">';
1012  print '</td>';
1013 }
1014 // Project label
1015 if (!empty($arrayfields['p.title']['checked'])) {
1016  print '<td class="liste_titre">';
1017  print '<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'">';
1018  print '</td>';
1019 }
1020 // Third party
1021 if (!empty($arrayfields['s.nom']['checked'])) {
1022  print '<td class="liste_titre">';
1023  if ($socid > 0) {
1024  $tmpthirdparty = new Societe($db);
1025  $tmpthirdparty->fetch($socid);
1026  $search_societe = $tmpthirdparty->name;
1027  }
1028  print '<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).'">';
1029  print '</td>';
1030 }
1031 
1032 // Alias
1033 if (!empty($arrayfields['s.name_alias']['checked'])) {
1034  print '<td class="liste_titre">';
1035  if ($socid > 0) {
1036  $tmpthirdparty = new Societe($db);
1037  $tmpthirdparty->fetch($socid);
1038  $search_societe_alias = $tmpthirdparty->name_alias;
1039  }
1040  print '<input type="text" class="flat" name="search_societe_alias" size="8" value="'.dol_escape_htmltag($search_societe_alias).'">';
1041  print '</td>';
1042 }
1043 // Sale representative
1044 if (!empty($arrayfields['commercial']['checked'])) {
1045  print '<td class="liste_titre">&nbsp;</td>';
1046 }
1047 // Start date
1048 if (!empty($arrayfields['p.dateo']['checked'])) {
1049  print '<td class="liste_titre center nowraponall">';
1050  /*if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
1051  print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_sday" value="'.dol_escape_htmltag($search_sday).'">';
1052  }
1053  print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_smonth" value="'.dol_escape_htmltag($search_smonth).'">';
1054  print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/
1055  print '<div class="nowrap">';
1056  print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1057  print '</div>';
1058  print '<div class="nowrap">';
1059  print $form->selectDate($search_date_start_end ? $search_date_start_end : -1, 'search_date_start_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1060  print '</div>';
1061  print '</td>';
1062 }
1063 // End date
1064 if (!empty($arrayfields['p.datee']['checked'])) {
1065  print '<td class="liste_titre center nowraponall">';
1066  /*if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
1067  print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_eday" value="'.dol_escape_htmltag($search_eday).'">';
1068  }
1069  print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_emonth" value="'.dol_escape_htmltag($search_emonth).'">';
1070  print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/
1071  print '<div class="nowrap">';
1072  print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1073  print '</div>';
1074  print '<div class="nowrap">';
1075  print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1076  print '</div>';
1077  print '</td>';
1078 }
1079 // Visibility
1080 if (!empty($arrayfields['p.public']['checked'])) {
1081  print '<td class="liste_titre center">';
1082  $array = array(''=>'', 0 => $langs->trans("PrivateProject"), 1 => $langs->trans("SharedProject"));
1083  print $form->selectarray('search_public', $array, $search_public, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth75');
1084  print '</td>';
1085 }
1086 if (!empty($arrayfields['c.assigned']['checked'])) {
1087  print '<td class="liste_titre center">';
1088  print '</td>';
1089 }
1090 // Opp status
1091 if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
1092  print '<td class="liste_titre nowrap center">';
1093  print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth125 nowrapoption', 1, 1);
1094  print '</td>';
1095 }
1096 if (!empty($arrayfields['p.opp_amount']['checked'])) {
1097  print '<td class="liste_titre nowrap right">';
1098  print '<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.'">';
1099  print '</td>';
1100 }
1101 if (!empty($arrayfields['p.opp_percent']['checked'])) {
1102  print '<td class="liste_titre nowrap right">';
1103  print '<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.'">';
1104  print '</td>';
1105 }
1106 if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
1107  print '<td class="liste_titre nowrap right">';
1108  print '</td>';
1109 }
1110 if (!empty($arrayfields['p.budget_amount']['checked'])) {
1111  print '<td class="liste_titre nowrap right">';
1112  print '<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.'">';
1113  print '</td>';
1114 }
1115 if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
1116  print '<td class="liste_titre nowrap right">';
1117  print $form->selectyesno('search_usage_opportunity', $search_usage_opportunity, 1, false, 1);
1118  print '';
1119  print '</td>';
1120 }
1121 if (!empty($arrayfields['p.usage_task']['checked'])) {
1122  print '<td class="liste_titre nowrap right">';
1123  print $form->selectyesno('search_usage_task', $search_usage_task, 1, false, 1);
1124  print '</td>';
1125 }
1126 if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
1127  print '<td class="liste_titre nowrap right">';
1128  print $form->selectyesno('search_usage_bill_time', $search_usage_bill_time, 1, false, 1);
1129  print '</td>';
1130 }
1131 if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
1132  print '<td class="liste_titre nowrap right">';
1133  print $form->selectyesno('search_usage_event_organization', $search_usage_event_organization, 1, false, 1);
1134  print '</td>';
1135 }
1136 if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
1137  print '<td class="liste_titre nowrap right">';
1138  print $form->selectyesno('search_accept_conference_suggestions', $search_accept_conference_suggestions, 1, false, 1);
1139  print '</td>';
1140 }
1141 if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
1142  print '<td class="liste_titre nowrap right">';
1143  print $form->selectyesno('search_accept_booth_suggestions', $search_accept_booth_suggestions, 1, false, 1);
1144  print '</td>';
1145 }
1146 if (!empty($arrayfields['p.price_registration']['checked'])) {
1147  print '<td class="liste_titre nowrap right">';
1148  print '<input type="text" class="flat" name="search_price_registration" size="4" value="'.$search_price_registration.'">';
1149  print '</td>';
1150 }
1151 if (!empty($arrayfields['p.price_booth']['checked'])) {
1152  print '<td class="liste_titre nowrap right">';
1153  print '<input type="text" class="flat" name="search_price_booth" size="4" value="'.$search_price_booth.'">';
1154  print '</td>';
1155 }
1156 if (!empty($arrayfields['u.login']['checked'])) {
1157  // Author
1158  print '<td class="liste_titre" align="center">';
1159  print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
1160  print '</td>';
1161 }
1162 // Extra fields
1163 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1164 
1165 // Fields from hook
1166 $parameters = array('arrayfields'=>$arrayfields);
1167 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1168 print $hookmanager->resPrint;
1169 if (!empty($arrayfields['p.datec']['checked'])) {
1170  // Date creation
1171  print '<td class="liste_titre">';
1172  print '</td>';
1173 }
1174 if (!empty($arrayfields['p.tms']['checked'])) {
1175  // Date modification
1176  print '<td class="liste_titre">';
1177  print '</td>';
1178 }
1179 if (!empty($arrayfields['p.email_msgid']['checked'])) {
1180  // Email msg id
1181  print '<td class="liste_titre">';
1182  print '</td>';
1183 }
1184 if (!empty($arrayfields['p.import_key']['checked'])) {
1185  // Import key
1186  print '<td class="liste_titre">';
1187  print '</td>';
1188 }
1189 if (!empty($arrayfields['p.fk_statut']['checked'])) {
1190  print '<td class="liste_titre nowrap center">';
1191  $arrayofstatus = array();
1192  foreach ($object->statuts_short as $key => $val) {
1193  $arrayofstatus[$key] = $langs->trans($val);
1194  }
1195  $arrayofstatus['99'] = $langs->trans("NotClosed").' ('.$langs->trans('Draft').' + '.$langs->trans('Opened').')';
1196  print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth125 onrightofpage', 1);
1197  print '</td>';
1198 }
1199 // Action column
1200 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1201  print '<td class="liste_titre maxwidthsearch">';
1202  $searchpicto = $form->showFilterButtons();
1203  print $searchpicto;
1204  print '</td>';
1205 }
1206 print '</tr>'."\n";
1207 
1208 print '<tr class="liste_titre">';
1209 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1210  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1211 }
1212 if (!empty($arrayfields['p.ref']['checked'])) {
1213  print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder);
1214 }
1215 if (!empty($arrayfields['p.title']['checked'])) {
1216  print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder);
1217 }
1218 if (!empty($arrayfields['s.nom']['checked'])) {
1219  print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
1220 }
1221 if (!empty($arrayfields['s.name_alias']['checked'])) {
1222  print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder);
1223 }
1224 if (!empty($arrayfields['commercial']['checked'])) {
1225  print_liste_field_titre($arrayfields['commercial']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder, 'tdoverflowmax100imp ');
1226 }
1227 if (!empty($arrayfields['p.dateo']['checked'])) {
1228  print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, '', $sortfield, $sortorder, 'center ');
1229 }
1230 if (!empty($arrayfields['p.datee']['checked'])) {
1231  print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, '', $sortfield, $sortorder, 'center ');
1232 }
1233 if (!empty($arrayfields['p.public']['checked'])) {
1234  print_liste_field_titre($arrayfields['p.public']['label'], $_SERVER["PHP_SELF"], "p.public", "", $param, "", $sortfield, $sortorder, 'center ');
1235 }
1236 if (!empty($arrayfields['c.assigned']['checked'])) {
1237  print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
1238 }
1239 if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
1240  print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center ');
1241 }
1242 if (!empty($arrayfields['p.opp_amount']['checked'])) {
1243  print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
1244 }
1245 if (!empty($arrayfields['p.opp_percent']['checked'])) {
1246  print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER['PHP_SELF'], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
1247 }
1248 if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
1249  print_liste_field_titre($arrayfields['opp_weighted_amount']['label'], $_SERVER['PHP_SELF'], 'opp_weighted_amount', '', $param, '', $sortfield, $sortorder, 'right ');
1250 }
1251 if (!empty($arrayfields['p.budget_amount']['checked'])) {
1252  print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
1253 }
1254 if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
1255  print_liste_field_titre($arrayfields['p.usage_opportunity']['label'], $_SERVER["PHP_SELF"], 'p.usage_opportunity', "", $param, '', $sortfield, $sortorder, 'right ');
1256 }
1257 if (!empty($arrayfields['p.usage_task']['checked'])) {
1258  print_liste_field_titre($arrayfields['p.usage_task']['label'], $_SERVER["PHP_SELF"], 'p.usage_task', "", $param, '', $sortfield, $sortorder, 'right ');
1259 }
1260 if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
1261  print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
1262 }
1263 if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
1264  print_liste_field_titre($arrayfields['p.usage_organize_event']['label'], $_SERVER["PHP_SELF"], 'p.usage_organize_event', "", $param, '', $sortfield, $sortorder, 'right ');
1265 }
1266 if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
1267  print_liste_field_titre($arrayfields['p.accept_conference_suggestions']['label'], $_SERVER["PHP_SELF"], 'p.accept_conference_suggestions', "", $param, '', $sortfield, $sortorder, 'right ');
1268 }
1269 if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
1270  print_liste_field_titre($arrayfields['p.accept_booth_suggestions']['label'], $_SERVER["PHP_SELF"], 'p.accept_booth_suggestions', "", $param, '', $sortfield, $sortorder, 'right ');
1271 }
1272 if (!empty($arrayfields['p.price_registration']['checked'])) {
1273  print_liste_field_titre($arrayfields['p.price_registration']['label'], $_SERVER["PHP_SELF"], 'p.price_registration', "", $param, '', $sortfield, $sortorder, 'right ');
1274 }
1275 if (!empty($arrayfields['p.price_booth']['checked'])) {
1276  print_liste_field_titre($arrayfields['p.price_booth']['label'], $_SERVER["PHP_SELF"], 'p.price_booth', "", $param, '', $sortfield, $sortorder, 'right ');
1277 }
1278 if (!empty($arrayfields['u.login']['checked'])) {
1279  print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
1280 }
1281 // Extra fields
1282 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1283 // Hook fields
1284 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
1285 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
1286 print $hookmanager->resPrint;
1287 if (!empty($arrayfields['p.datec']['checked'])) {
1288  print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1289 }
1290 if (!empty($arrayfields['p.tms']['checked'])) {
1291  print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1292 }
1293 if (!empty($arrayfields['p.email_msgid']['checked'])) {
1294  print_liste_field_titre($arrayfields['p.email_msgid']['label'], $_SERVER["PHP_SELF"], "p.email_msgid", "", $param, '', $sortfield, $sortorder, 'center ');
1295 }
1296 if (!empty($arrayfields['p.import_key']['checked'])) {
1297  print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, '');
1298 }
1299 if (!empty($arrayfields['p.fk_statut']['checked'])) {
1300  print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
1301 }
1302 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1303  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1304 }
1305 print "</tr>\n";
1306 
1307 $userstatic = new User($db);
1308 
1309 $i = 0;
1310 $totalarray = array(
1311  'nbfield' => 0,
1312  'val' => array(),
1313 );
1314 $imaxinloop = ($limit ? min($num, $limit) : $num);
1315 while ($i < $imaxinloop) {
1316  $obj = $db->fetch_object($resql);
1317  if (empty($obj)) {
1318  break; // Should not happen
1319  }
1320 
1321  $object->id = $obj->id;
1322  $object->user_author_id = $obj->fk_user_creat;
1323  $object->public = $obj->public;
1324  $object->ref = $obj->ref;
1325  $object->datee = $db->jdate($obj->date_end);
1326  $object->statut = $obj->status; // deprecated
1327  $object->status = $obj->status;
1328  $object->public = $obj->public;
1329  $object->opp_status = $obj->fk_opp_status;
1330  $object->title = $obj->title;
1331 
1332  $userAccess = $object->restrictedProjectArea($user); // why this ?
1333  if ($userAccess >= 0) {
1334  $companystatic->id = $obj->socid;
1335  $companystatic->name = $obj->name;
1336  $companystatic->name_alias = $obj->alias;
1337  $companystatic->client = $obj->client;
1338  $companystatic->code_client = $obj->code_client;
1339  $companystatic->email = $obj->email;
1340  $companystatic->phone = $obj->phone;
1341  $companystatic->address = $obj->address;
1342  $companystatic->zip = $obj->zip;
1343  $companystatic->town = $obj->town;
1344  $companystatic->country_code = $obj->country_code;
1345 
1346  print '<tr class="oddeven">';
1347 
1348  // Action column
1349  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1350  print '<td class="nowrap center">';
1351  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1352  $selected = 0;
1353  if (in_array($obj->id, $arrayofselected)) {
1354  $selected = 1;
1355  }
1356  print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
1357  }
1358  print '</td>';
1359  if (!$i) {
1360  $totalarray['nbfield']++;
1361  }
1362  }
1363  // Project url
1364  if (!empty($arrayfields['p.ref']['checked'])) {
1365  print '<td class="nowraponall">';
1366  print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':''));
1367  if ($object->hasDelay()) {
1368  print img_warning($langs->trans('Late'));
1369  }
1370  print '</td>';
1371  if (!$i) {
1372  $totalarray['nbfield']++;
1373  }
1374  }
1375  // Title
1376  if (!empty($arrayfields['p.title']['checked'])) {
1377  print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">';
1378  print $obj->title;
1379  print '</td>';
1380  if (!$i) {
1381  $totalarray['nbfield']++;
1382  }
1383  }
1384  // Company
1385  if (!empty($arrayfields['s.nom']['checked'])) {
1386  print '<td class="tdoverflowmax100">';
1387  if ($obj->socid) {
1388  print $companystatic->getNomUrl(1, '', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1389  } else {
1390  print '&nbsp;';
1391  }
1392  print '</td>';
1393  if (!$i) {
1394  $totalarray['nbfield']++;
1395  }
1396  }
1397  // Alias
1398  if (!empty($arrayfields['s.name_alias']['checked'])) {
1399  print '<td class="tdoverflowmax100">';
1400  if ($obj->socid) {
1401  print $companystatic->name_alias;
1402  } else {
1403  print '&nbsp;';
1404  }
1405  print '</td>';
1406  if (!$i) {
1407  $totalarray['nbfield']++;
1408  }
1409  }
1410  // Sales Representatives
1411  if (!empty($arrayfields['commercial']['checked'])) {
1412  print '<td class="tdoverflowmax150">';
1413  if ($obj->socid) {
1414  $companystatic->id = $obj->socid;
1415  $companystatic->name = $obj->name;
1416  $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1417  $nbofsalesrepresentative = count($listsalesrepresentatives);
1418  if ($nbofsalesrepresentative > 6) {
1419  // We print only number
1420  print $nbofsalesrepresentative;
1421  } elseif ($nbofsalesrepresentative > 0) {
1422  $userstatic = new User($db);
1423  $j = 0;
1424  foreach ($listsalesrepresentatives as $val) {
1425  $userstatic->id = $val['id'];
1426  $userstatic->lastname = $val['lastname'];
1427  $userstatic->firstname = $val['firstname'];
1428  $userstatic->email = $val['email'];
1429  $userstatic->statut = $val['statut'];
1430  $userstatic->entity = $val['entity'];
1431  $userstatic->photo = $val['photo'];
1432  $userstatic->login = $val['login'];
1433  $userstatic->office_phone = $val['office_phone'];
1434  $userstatic->office_fax = $val['office_fax'];
1435  $userstatic->user_mobile = $val['user_mobile'];
1436  $userstatic->job = $val['job'];
1437  $userstatic->gender = $val['gender'];
1438  print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
1439  $j++;
1440  if ($j < $nbofsalesrepresentative) {
1441  print ' ';
1442  }
1443  }
1444  }
1445  //else print $langs->trans("NoSalesRepresentativeAffected");
1446  } else {
1447  print '&nbsp;';
1448  }
1449  print '</td>';
1450  if (!$i) {
1451  $totalarray['nbfield']++;
1452  }
1453  }
1454 
1455  // Date start project
1456  if (!empty($arrayfields['p.dateo']['checked'])) {
1457  print '<td class="center">';
1458  print dol_print_date($db->jdate($obj->date_start), 'day');
1459  print '</td>';
1460  if (!$i) {
1461  $totalarray['nbfield']++;
1462  }
1463  }
1464  // Date end project
1465  if (!empty($arrayfields['p.datee']['checked'])) {
1466  print '<td class="center">';
1467  print dol_print_date($db->jdate($obj->date_end), 'day');
1468  print '</td>';
1469  if (!$i) {
1470  $totalarray['nbfield']++;
1471  }
1472  }
1473 
1474  // Visibility
1475  if (!empty($arrayfields['p.public']['checked'])) {
1476  print '<td class="center">';
1477  if ($obj->public) {
1478  print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
1479  //print $langs->trans('SharedProject');
1480  } else {
1481  print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
1482  //print $langs->trans('PrivateProject');
1483  }
1484  print '</td>';
1485  if (!$i) {
1486  $totalarray['nbfield']++;
1487  }
1488  }
1489  // Contacts of project
1490  if (!empty($arrayfields['c.assigned']['checked'])) {
1491  print '<td class="center nowraponall tdoverflowmax200">';
1492  $ifisrt = 1;
1493  foreach (array('internal', 'external') as $source) {
1494  $tab = $object->liste_contact(-1, $source, 0, '', 1);
1495  $numcontact = count($tab);
1496  if (!empty($numcontact)) {
1497  foreach ($tab as $contactproject) {
1498  //var_dump($contacttask);
1499  if ($source == 'internal') {
1500  $c = new User($db);
1501  } else {
1502  $c = new Contact($db);
1503  }
1504  $c->fetch($contactproject['id']);
1505  if (!empty($c->photo)) {
1506  if (get_class($c) == 'User') {
1507  print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
1508  } else {
1509  print $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
1510  }
1511  } else {
1512  if (get_class($c) == 'User') {
1513  print $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
1514  } else {
1515  print $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
1516  }
1517  }
1518  $ifisrt = 0;
1519  }
1520  }
1521  }
1522  print '</td>';
1523  if (!$i) {
1524  $totalarray['nbfield']++;
1525  }
1526  }
1527  // Opp Status
1528  if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
1529  print '<td class="center">';
1530  if ($obj->opp_status_code) {
1531  print $langs->trans("OppStatus".$obj->opp_status_code);
1532  }
1533  print '</td>';
1534  if (!$i) {
1535  $totalarray['nbfield']++;
1536  }
1537  }
1538  // Opp Amount
1539  if (!empty($arrayfields['p.opp_amount']['checked'])) {
1540  print '<td class="right">';
1541  //if ($obj->opp_status_code)
1542  if (strcmp($obj->opp_amount, '')) {
1543  print '<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').'</span>';
1544  if (empty($totalarray['val']['p.opp_amount'])) {
1545  $totalarray['val']['p.opp_amount'] = $obj->opp_amount;
1546  } else {
1547  $totalarray['val']['p.opp_amount'] += $obj->opp_amount;
1548  }
1549  }
1550  print '</td>';
1551  if (!$i) {
1552  $totalarray['nbfield']++;
1553  }
1554  if (!$i) {
1555  $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount';
1556  }
1557  }
1558  // Opp percent
1559  if (!empty($arrayfields['p.opp_percent']['checked'])) {
1560  print '<td class="right">';
1561  if ($obj->opp_percent) {
1562  print price($obj->opp_percent, 1, $langs, 1, 0).'%';
1563  }
1564  print '</td>';
1565  if (!$i) {
1566  $totalarray['nbfield']++;
1567  }
1568  }
1569  // Opp weighted amount
1570  if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
1571  if (!isset($totalarray['val']['opp_weighted_amount'])) {
1572  $totalarray['val']['opp_weighted_amount'] = 0;
1573  }
1574  print '<td align="right">';
1575  if ($obj->opp_weighted_amount) {
1576  print '<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').'</span>';
1577  if (empty($totalarray['val']['opp_weighted_amount'])) {
1578  $totalarray['val']['opp_weighted_amount'] = $obj->opp_weighted_amount;
1579  } else {
1580  $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
1581  }
1582  }
1583  print '</td>';
1584  if (!$i) {
1585  $totalarray['nbfield']++;
1586  }
1587  if (!$i) {
1588  $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
1589  }
1590  }
1591  // Budget
1592  if (!empty($arrayfields['p.budget_amount']['checked'])) {
1593  print '<td class="right">';
1594  if ($obj->budget_amount != '') {
1595  print '<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).'</span>';
1596  if (empty($totalarray['val']['p.budget_amount'])) {
1597  $totalarray['val']['p.budget_amount'] = $obj->budget_amount;
1598  } else {
1599  $totalarray['val']['p.budget_amount'] += $obj->budget_amount;
1600  }
1601  }
1602  print '</td>';
1603  if (!$i) {
1604  $totalarray['nbfield']++;
1605  }
1606  if (!$i) {
1607  $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount';
1608  }
1609  }
1610  // Usage opportunity
1611  if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
1612  print '<td class="right">';
1613  if ($obj->usage_opportunity) {
1614  print yn($obj->usage_opportunity);
1615  }
1616  print '</td>';
1617  if (!$i) {
1618  $totalarray['nbfield']++;
1619  }
1620  }
1621  // Usage task
1622  if (!empty($arrayfields['p.usage_task']['checked'])) {
1623  print '<td class="right">';
1624  if ($obj->usage_task) {
1625  print yn($obj->usage_task);
1626  }
1627  print '</td>';
1628  if (!$i) {
1629  $totalarray['nbfield']++;
1630  }
1631  }
1632  // Bill time
1633  if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
1634  print '<td class="right">';
1635  if ($obj->usage_bill_time) {
1636  print yn($obj->usage_bill_time);
1637  }
1638  print '</td>';
1639  if (!$i) {
1640  $totalarray['nbfield']++;
1641  }
1642  }
1643  // Event Organization
1644  if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
1645  print '<td class="right">';
1646  if ($obj->usage_organize_event) {
1647  print yn($obj->usage_organize_event);
1648  }
1649  print '</td>';
1650  if (!$i) {
1651  $totalarray['nbfield']++;
1652  }
1653  }
1654  // Allow unknown people to suggest conferences
1655  if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
1656  print '<td class="right">';
1657  if ($obj->accept_conference_suggestions) {
1658  print yn($obj->accept_conference_suggestions);
1659  }
1660  print '</td>';
1661  if (!$i) {
1662  $totalarray['nbfield']++;
1663  }
1664  }
1665  // Allow unknown people to suggest booth
1666  if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
1667  print '<td class="right">';
1668  if ($obj->accept_booth_suggestions) {
1669  print yn($obj->accept_booth_suggestions);
1670  }
1671  print '</td>';
1672  if (!$i) {
1673  $totalarray['nbfield']++;
1674  }
1675  }
1676  // Price of registration
1677  if (!empty($arrayfields['p.price_registration']['checked'])) {
1678  print '<td class="right">';
1679  if ($obj->price_registration != '') {
1680  print '<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).'</span>';
1681  $totalarray['val']['p.price_registration'] += $obj->price_registration;
1682  }
1683  print '</td>';
1684  if (!$i) {
1685  $totalarray['nbfield']++;
1686  }
1687  if (!$i) {
1688  $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration';
1689  }
1690  }
1691  // Price of booth
1692  if (!empty($arrayfields['p.price_booth']['checked'])) {
1693  print '<td class="right">';
1694  if ($obj->price_booth != '') {
1695  print '<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).'</span>';
1696  $totalarray['val']['p.price_booth'] += $obj->price_booth;
1697  }
1698  print '</td>';
1699  if (!$i) {
1700  $totalarray['nbfield']++;
1701  }
1702  if (!$i) {
1703  $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth';
1704  }
1705  }
1706  // Author
1707  $userstatic->id = $obj->fk_user_creat;
1708  $userstatic->login = $obj->login;
1709  $userstatic->lastname = $obj->lastname;
1710  $userstatic->firstname = $obj->firstname;
1711  $userstatic->email = $obj->user_email;
1712  $userstatic->statut = $obj->user_statut;
1713  $userstatic->entity = $obj->entity;
1714  $userstatic->photo = $obj->photo;
1715  $userstatic->office_phone = $obj->office_phone;
1716  $userstatic->office_fax = $obj->office_fax;
1717  $userstatic->user_mobile = $obj->user_mobile;
1718  $userstatic->job = $obj->job;
1719  $userstatic->gender = $obj->gender;
1720 
1721  if (!empty($arrayfields['u.login']['checked'])) {
1722  print '<td class="center tdoverflowmax150">';
1723  if ($userstatic->id) {
1724  print $userstatic->getNomUrl(-1);
1725  } else {
1726  print '&nbsp;';
1727  }
1728  print "</td>\n";
1729  if (!$i) {
1730  $totalarray['nbfield']++;
1731  }
1732  }
1733  // Extra fields
1734  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1735  // Fields from hook
1736  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1737  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1738  print $hookmanager->resPrint;
1739  // Date creation
1740  if (!empty($arrayfields['p.datec']['checked'])) {
1741  print '<td class="center nowraponall">';
1742  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1743  print '</td>';
1744  if (!$i) {
1745  $totalarray['nbfield']++;
1746  }
1747  }
1748  // Date modification
1749  if (!empty($arrayfields['p.tms']['checked'])) {
1750  print '<td class="center nowraponall">';
1751  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1752  print '</td>';
1753  if (!$i) {
1754  $totalarray['nbfield']++;
1755  }
1756  }
1757  // Email MsgID
1758  if (!empty($arrayfields['p.email_msgid']['checked'])) {
1759  print '<td class="center">';
1760  print $obj->email_msgid;
1761  print '</td>';
1762  if (!$i) $totalarray['nbfield']++;
1763  }
1764  // Import key
1765  if (!empty($arrayfields['p.import_key']['checked'])) {
1766  print '<td class="right">'.dol_escape_htmltag($obj->import_key).'</td>';
1767  if (!$i) {
1768  $totalarray['nbfield']++;
1769  }
1770  }
1771  // Status
1772  if (!empty($arrayfields['p.fk_statut']['checked'])) {
1773  print '<td class="center">'.$object->getLibStatut(5).'</td>';
1774  if (!$i) {
1775  $totalarray['nbfield']++;
1776  }
1777  }
1778  // Action column
1779  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1780  print '<td class="nowrap center">';
1781  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1782  $selected = 0;
1783  if (in_array($obj->id, $arrayofselected)) {
1784  $selected = 1;
1785  }
1786  print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
1787  }
1788  print '</td>';
1789  if (!$i) {
1790  $totalarray['nbfield']++;
1791  }
1792  }
1793 
1794  print "</tr>\n";
1795  }
1796 
1797  $i++;
1798 }
1799 
1800 // Show total line
1801 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1802 
1803 // If no record found
1804 if ($num == 0) {
1805  $colspan = 1;
1806  foreach ($arrayfields as $key => $val) {
1807  if (!empty($val['checked'])) {
1808  $colspan++;
1809  }
1810  }
1811  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1812 }
1813 
1814 $db->free($resql);
1815 
1816 $parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql);
1817 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1818 print $hookmanager->resPrint;
1819 
1820 print "</table>\n";
1821 print '</div>';
1822 
1823 print "</form>\n";
1824 
1825 // End of page
1826 llxFooter();
1827 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
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 contact/addresses.
Class to manage standard extra fields.
Class to manage forms for categories.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1)
Show a multiselect form from an array.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage building of HTML components.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage tasks.
Definition: task.class.php:38
Class to manage Dolibarr users.
Definition: user.class.php:45
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
Definition: date.lib.php:358
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.