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