dolibarr 22.0.5
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 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
12 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
13 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
14 * Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 */
29
36// Load Dolibarr environment
37require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
44if (isModEnabled('category')) {
45 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
46 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
47}
48
57// Load translation files required by the page
58$langs->loadLangs(array('projects', 'companies', 'commercial'));
59if (isModEnabled('eventorganization') && $conf->eventorganization->enabled) {
60 $langs->loadLangs(array('eventorganization'));
61}
62
63$action = GETPOST('action', 'aZ09');
64$massaction = GETPOST('massaction', 'alpha');
65$show_files = GETPOSTINT('show_files');
66$confirm = GETPOST('confirm', 'alpha');
67$toselect = GETPOST('toselect', 'array');
68$optioncss = GETPOST('optioncss', 'alpha');
69$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projectlist';
70$mode = GETPOST('mode', 'alpha');
71$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'. Must be a field into $object->fields
72
73$title = $langs->trans("Projects");
74
75// Security check
76$socid = GETPOSTINT('socid');
77//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 assignment.
78if ($socid > 0) {
79 $soc = new Societe($db);
80 $soc->fetch($socid);
81 $title .= ' (<a href="list.php">'.$soc->name.'</a>)';
82}
83if (!$user->hasRight('projet', 'lire')) {
85}
86
87$diroutputmassaction = $conf->project->dir_output.'/temp/massgeneration/'.$user->id;
88
89$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
90$sortfield = GETPOST('sortfield', 'aZ09comma');
91$sortorder = GETPOST('sortorder', 'aZ09comma');
92$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
93if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
94 // If $page is not defined, or '' or -1 or if we click on clear filters
95 $page = 0;
96}
97if (!$sortfield) {
98 $sortfield = "p.ref";
99}
100if (!$sortorder) {
101 $sortorder = "ASC";
102}
103$offset = $limit * $page;
104$pageprev = $page - 1;
105$pagenext = $page + 1;
106
107$search_all = GETPOST('search_all', 'alphanohtml');
108$search_entity = GETPOSTINT('search_entity');
109$search_id = GETPOST("search_id", 'alpha');
110$search_ref = GETPOST("search_ref", 'alpha');
111$search_label = GETPOST("search_label", 'alpha');
112$search_societe = GETPOST("search_societe", 'alpha');
113$search_societe_alias = GETPOST("search_societe_alias", 'alpha');
114$search_societe_country = GETPOST("search_societe_country", 'alpha');
115$search_opp_status = GETPOST("search_opp_status", 'alpha');
116$search_opp_percent = GETPOST("search_opp_percent", 'alpha');
117$search_opp_amount = GETPOST("search_opp_amount", 'alpha');
118$search_budget_amount = GETPOST("search_budget_amount", 'alpha');
119$search_public = GETPOST("search_public", 'intcomma');
120$search_project_user = GETPOSTINT('search_project_user');
121$search_project_contact = GETPOSTINT('search_project_contact');
122$search_sale = GETPOSTINT('search_sale');
123$search_usage_opportunity = GETPOST('search_usage_opportunity', 'intcomma');
124$search_usage_task = GETPOST('search_usage_task', 'intcomma');
125$search_usage_bill_time = GETPOST('search_usage_bill_time', 'intcomma');
126$search_usage_event_organization = GETPOST('search_usage_event_organization', 'intcomma');
127$search_accept_conference_suggestions = GETPOST('search_accept_conference_suggestions', 'intcomma');
128$search_accept_booth_suggestions = GETPOST('search_accept_booth_suggestions', 'intcomma');
129$search_price_registration = GETPOST("search_price_registration", 'alpha');
130$search_price_booth = GETPOST("search_price_booth", 'alpha');
131$search_login = GETPOST('search_login', 'alpha');
132$search_import_key = GETPOST('search_import_key', 'alpha');
133$searchCategoryCustomerOperator = 0;
134if (GETPOSTISSET('formfilteraction')) {
135 $searchCategoryCustomerOperator = GETPOSTINT('search_category_customer_operator');
136} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) {
137 $searchCategoryCustomerOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT');
138}
139$searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array');
140$search_omitChildren = 0;
141if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) {
142 $search_omitChildren = GETPOST('search_omitChildren', 'alpha') == 'on' ? 1 : 0;
143}
144
145
146$mine = ((GETPOST('mode') == 'mine') ? 1 : 0);
147if ($mine) {
148 $search_project_user = $user->id;
149 $mine = 0;
150}
151
152$search_sday = GETPOSTINT('search_sday');
153$search_smonth = GETPOSTINT('search_smonth');
154$search_syear = GETPOSTINT('search_syear');
155$search_eday = GETPOSTINT('search_eday');
156$search_emonth = GETPOSTINT('search_emonth');
157$search_eyear = GETPOSTINT('search_eyear');
158
159$search_date_start_startmonth = GETPOSTINT('search_date_start_startmonth');
160$search_date_start_startyear = GETPOSTINT('search_date_start_startyear');
161$search_date_start_startday = GETPOSTINT('search_date_start_startday');
162$search_date_start_start = GETPOSTDATE('search_date_start_start'); // Use tzserver
163$search_date_start_endmonth = GETPOSTINT('search_date_start_endmonth');
164$search_date_start_endyear = GETPOSTINT('search_date_start_endyear');
165$search_date_start_endday = GETPOSTINT('search_date_start_endday');
166$search_date_start_end = GETPOSTDATE('search_date_start_end', 'end'); // Use tzserver
167
168$search_date_end_startmonth = GETPOSTINT('search_date_end_startmonth');
169$search_date_end_startyear = GETPOSTINT('search_date_end_startyear');
170$search_date_end_startday = GETPOSTINT('search_date_end_startday');
171$search_date_end_start = GETPOSTDATE('search_date_end_start'); // Use tzserver
172$search_date_end_endmonth = GETPOSTINT('search_date_end_endmonth');
173$search_date_end_endyear = GETPOSTINT('search_date_end_endyear');
174$search_date_end_endday = GETPOSTINT('search_date_end_endday');
175$search_date_end_end = GETPOSTDATE('search_date_end_end', 'end'); ; // Use tzserver
176
177$search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth');
178$search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear');
179$search_date_creation_startday = GETPOSTINT('search_date_creation_startday');
180$search_date_creation_start = GETPOSTDATE('search_date_creation_start'); // Use tzserver
181$search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth');
182$search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear');
183$search_date_creation_endday = GETPOSTINT('search_date_creation_endday');
184$search_date_creation_end = GETPOSTDATE('search_date_creation_end', 'end'); // Use tzserver
185
186$search_date_modif_startmonth = GETPOSTINT('search_date_modif_startmonth');
187$search_date_modif_startyear = GETPOSTINT('search_date_modif_startyear');
188$search_date_modif_startday = GETPOSTINT('search_date_modif_startday');
189$search_date_modif_start = GETPOSTDATE('search_date_modif_start'); // Use tzserver
190$search_date_modif_endmonth = GETPOSTINT('search_date_modif_endmonth');
191$search_date_modif_endyear = GETPOSTINT('search_date_modif_endyear');
192$search_date_modif_endday = GETPOSTINT('search_date_modif_endday');
193$search_date_modif_end = GETPOSTDATE('search_date_modif_end', 'end'); // Use tzserver
194
195$search_category_array = array();
196
197if (isModEnabled('category')) {
198 $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array");
199}
200
201if (GETPOSTISARRAY('search_status') || GETPOST('search_status_multiselect')) {
202 $search_status = implode(',', GETPOST('search_status', 'array:intcomma'));
203} else {
204 $search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : (GETPOSTISSET('search_all') ? '' : '0,1'));
205}
206
207$search_option = GETPOST('search_option', 'alpha');
208if ($search_option == 'late') {
209 $search_status = '1';
210}
211// Initialize technical objects
212$object = new Project($db);
213$hookmanager->initHooks(array('projectlist'));
214$extrafields = new ExtraFields($db);
215
216// Fetch optionals attributes and labels
217$extrafields->fetch_name_optionals_label($object->table_element);
218
219$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
220
221$fieldstosearchall = array();
222// List of fields to search into when doing a "search in all"
223foreach ($object->fields as $key => $val) {
224 if (empty($val['searchall'])) {
225 continue;
226 }
227
228 // Don't allow search in private notes for external users when doing "search in all"
229 if (!empty($user->socid) && $key == "note_private") {
230 continue;
231 }
232
233 $fieldstosearchall['p.'.$key] = $val['label'];
234}
235
236// Add name object fields to "search in all"
237$fieldstosearchall['s.nom'] = "ThirdPartyName";
238$fieldstosearchall['s.name_alias'] = "AliasNameShort";
239$fieldstosearchall['s.code_client'] = "CustomerCode";
240
241// Definition of array of fields for columns
242$tableprefix = 'p';
243$arrayfields = array();
244foreach ($object->fields as $key => $val) {
245 // If $val['visible']==0, then we never show the field
246 if (!empty($val['visible'])) {
247 $visible = (int) dol_eval((string) $val['visible'], 1);
248 $arrayfields[$tableprefix.'.'.$key] = array(
249 'label' => $val['label'],
250 'checked' => (($visible < 0) ? '0' : '1'),
251 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
252 'position' => $val['position'],
253 'help' => isset($val['help']) ? $val['help'] : ''
254 );
255 }
256}
257// Extra fields
258include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
259
260// Add non object fields to fields for list
261$arrayfields['s.nom'] = array('label' => "ThirdParty", 'checked' => '1', 'position' => 21, 'enabled' => (!isModEnabled('societe') ? '0' : '1'));
262$arrayfields['s.name_alias'] = array('label' => "AliasNameShort", 'checked' => '0', 'position' => 22);
263$arrayfields['co.country_code'] = array('label' => "Country", 'checked' => '-1', 'position' => 23);
264$arrayfields['commercial'] = array('label' => "SaleRepresentativesOfThirdParty", 'checked' => '0', 'position' => 25);
265$arrayfields['c.assigned'] = array('label' => "AssignedTo", 'checked' => '1', 'position' => 120);
266$arrayfields['opp_weighted_amount'] = array('label' => 'OpportunityWeightedAmountShort', 'checked' => '0', 'enabled' => (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES') ? '0' : '1'), 'position' => 106);
267$arrayfields['u.login'] = array('label' => "Author", 'checked' => '-1', 'position' => 165);
268// Force some fields according to search_usage filter...
269//if (GETPOST('search_usage_opportunity')) {
270//$arrayfields['p.usage_opportunity']['visible'] = 1; // Not required, filter on search_opp_status is enough
271//$arrayfields['p.usage_opportunity']['checked'] = 1; // Not required, filter on search_opp_status is enough
272//}
273if (GETPOST('search_usage_event_organization')) {
274 if (array_key_exists('p.fk_opp_status', $arrayfields)) {
275 $arrayfields['p.fk_opp_status']['enabled'] = '0';
276 }
277 if (array_key_exists('p.fk_opp_amount', $arrayfields)) {
278 $arrayfields['p.opp_amount']['enabled'] = '0';
279 }
280 if (array_key_exists('p.fk_opp_percent', $arrayfields)) {
281 $arrayfields['p.opp_percent']['enabled'] = '0';
282 }
283 $arrayfields['opp_weighted_amount']['enabled'] = '0';
284 if (array_key_exists('p.usage_organize_event', $arrayfields)) {
285 $arrayfields['p.usage_organize_event']['visible'] = '1';
286 $arrayfields['p.usage_organize_event']['checked'] = '1';
287 }
288}
289$arrayfields['p.fk_project']['enabled'] = '0';
290
291// Force this field to be visible
292if ($contextpage == 'lead') {
293 if (array_key_exists('p.fk_opp_status', $arrayfields)) {
294 $arrayfields['p.fk_opp_status']['enabled'] = '1';
295 $arrayfields['p.fk_opp_status']['visible'] = '1';
296 }
297}
298
299
300$object->fields = dol_sort_array($object->fields, 'position');
301$arrayfields = dol_sort_array($arrayfields, 'position');
302
303// Set $groupbyvalues with array of all possible dictionary values (even if no data for this value exists).
304// TODO Move this into a inc file
305$groupbyvalues = array();
306$groupofcollpasedvalues = array();
307$groupbyold = null;
308if ($mode == 'kanbangroupby' && $groupby) {
309 $groupbyfield = preg_replace('/[a-z]+\./', '', $groupby);
310 if (!empty($object->fields[$groupbyfield]['alias'])) {
311 $groupbyfield = $object->fields[$groupbyfield]['alias'];
312 }
313 if (!in_array(preg_replace('/[a-z]+\./', '', $groupby), array_keys($object->fields))) {
314 $groupby = '';
315 } else {
316 if (!empty($object->fields[$groupby]['arrayofkeyval'])) {
317 $groupbyvalues = $object->fields[$groupby]['arrayofkeyval'];
318 } elseif (!empty($object->fields[preg_replace('/[a-z]\./', '', $groupby)]['arrayofkeyval'])) {
319 $groupbyvalues = $object->fields[preg_replace('/[a-z]\./', '', $groupby)]['arrayofkeyval'];
320 } else {
321 // var_dump($object->fields[$groupby]['type']);
322 // If type is 'integer:Object:classpath', for example "integer:CLeadStatus:core/class/cleadstatus.class.php"
323 // TODO
324 // $groupbyvalues = ...
325
326 $sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label, cls.position";
327 $sql .= " FROM ".MAIN_DB_PREFIX."c_lead_status as cls";
328 $sql .= " WHERE active = 1";
329 //$sql .= " AND cls.code <> 'LOST'";
330 //$sql .= " AND cls.code <> 'WON'";
331 $sql .= $db->order('cls.position,cls.rowid', 'ASC'); // Must use the same order key than the key in $groupby
332 $resql = $db->query($sql);
333 if ($resql) {
334 $num = $db->num_rows($resql);
335
336 $i = 1;
337 while ($i < ($num + 1)) { // $num + 1 because we added the undefined entry so we start with $i=1;
338 $objp = $db->fetch_object($resql);
339 $groupbyvalues[$i] = array('id' => (string) $objp->rowid, 'label' => $objp->label);
340 // If this is a group code that need to be collapsed
341 if ($objp->code == 'WON') {
342 $groupofcollpasedvalues[$i] = array('id' => (string) $objp->rowid, 'label' => $objp->label);
343 } elseif ($objp->code == 'LOST') {
344 $groupofcollpasedvalues[$i] = array('id' => (string) $objp->rowid, 'label' => $objp->label);
345 }
346
347 $i++;
348 }
349 }
350 }
351 /*var_dump($groupbyvalues);
352 var_dump($groupofcollpasedvalues);
353 */
354 }
355
356 // Add a filter on the group by if not yet included first
357 $groupbystringforsql = $groupby;
358 // Special case
359 if ($groupby == 'p.fk_opp_status') {
360 $groupbystringforsql = 'cls.position,p.fk_opp_status';
361 }
362
363 if ($groupbystringforsql && !preg_match('/^'.preg_quote($db->sanitize($groupbystringforsql), '/').'/', $sortfield)) {
364 $sortfield = $db->sanitize($groupbystringforsql).($sortfield ? ",".$sortfield : "");
365 $sortorder = "ASC".($sortfield ? ",".$sortorder : "");
366 }
367}
368
369
370/*
371 * Actions
372 */
373
374$error = 0;
375if (GETPOST('cancel', 'alpha')) {
376 $action = 'list';
377 $massaction = '';
378}
379if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
380 $massaction = '';
381}
382
383$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
384$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
385if ($reshook < 0) {
386 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
387}
388
389if (empty($reshook)) {
390 // Selection of new fields
391 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
392
393 // Purge search criteria
394 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
395 $search_all = '';
396 $search_id = "";
397 $search_ref = "";
398 $search_label = "";
399 $search_societe = "";
400 $search_societe_alias = '';
401 $search_societe_country = '';
402 $search_status = -1;
403 $search_option = '';
404 $search_opp_status = -1;
405 $search_opp_amount = '';
406 $search_opp_percent = '';
407 $search_budget_amount = '';
408 $search_public = "";
409 $search_sale = "";
410 $search_project_user = '';
411 $search_project_contact = '';
412 $search_sday = "";
413 $search_smonth = "";
414 $search_syear = "";
415 $search_eday = "";
416 $search_emonth = "";
417 $search_eyear = "";
418 $search_date_start_startmonth = "";
419 $search_date_start_startyear = "";
420 $search_date_start_startday = "";
421 $search_date_start_start = "";
422 $search_date_start_endmonth = "";
423 $search_date_start_endyear = "";
424 $search_date_start_endday = "";
425 $search_date_start_end = "";
426 $search_date_end_startmonth = "";
427 $search_date_end_startyear = "";
428 $search_date_end_startday = "";
429 $search_date_end_start = "";
430 $search_date_end_endmonth = "";
431 $search_date_end_endyear = "";
432 $search_date_end_endday = "";
433 $search_date_end_end = "";
434 $search_date_creation_startmonth = "";
435 $search_date_creation_startyear = "";
436 $search_date_creation_startday = "";
437 $search_date_creation_start = "";
438 $search_date_creation_endmonth = "";
439 $search_date_creation_endyear = "";
440 $search_date_creation_endday = "";
441 $search_date_creation_end = "";
442 $search_date_modif_startmonth = "";
443 $search_date_modif_startyear = "";
444 $search_date_modif_startday = "";
445 $search_date_modif_start = "";
446 $search_date_modif_endmonth = "";
447 $search_date_modif_endyear = "";
448 $search_date_modif_endday = "";
449 $search_date_modif_end = "";
450 $search_usage_opportunity = '';
451 $search_usage_task = '';
452 $search_usage_bill_time = '';
453 $search_usage_event_organization = '';
454 $search_accept_conference_suggestions = '';
455 $search_accept_booth_suggestions = '';
456 $search_price_registration = '';
457 $search_price_booth = '';
458 $search_login = '';
459 $search_import_key = '';
460 $search_entity = '';
461 $toselect = array();
462 $search_array_options = array();
463 $search_category_array = array();
464 }
465
466
467 // Mass actions
468 $objectclass = 'Project';
469 $objectlabel = 'Project';
470 $permissiontoread = $user->hasRight('projet', 'lire');
471 $permissiontodelete = $user->hasRight('projet', 'supprimer');
472 $permissiontoadd = $user->hasRight('projet', 'creer');
473 $uploaddir = $conf->project->dir_output;
474
475 global $error;
476 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
477
478 // Close records
479 if (!$error && $massaction == 'close' && $user->hasRight('projet', 'creer')) {
480 $db->begin();
481
482 $objecttmp = new $objectclass($db);
483 $nbok = 0;
484 foreach ($toselect as $toselectid) {
485 $result = $objecttmp->fetch($toselectid);
486 if ($result > 0) {
487 $userWrite = $object->restrictedProjectArea($user, 'write');
488 if ($userWrite > 0 && $objecttmp->statut == 1) {
489 $result = $objecttmp->setClose($user);
490 if ($result <= 0) {
491 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
492 $error++;
493 break;
494 } else {
495 $nbok++;
496 }
497 } elseif ($userWrite <= 0) {
498 setEventMessages($langs->trans("DontHavePermissionForCloseProject", $objecttmp->ref), null, 'warnings');
499 } else {
500 setEventMessages($langs->trans("DontHaveTheValidateStatus", $objecttmp->ref), null, 'warnings');
501 }
502 } else {
503 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
504 $error++;
505 break;
506 }
507 }
508
509 if (!$error) {
510 setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs');
511 $db->commit();
512 } else {
513 $db->rollback();
514 }
515 }
516}
517
518
519/*
520 * View
521 */
522
523unset($_SESSION['pageforbacktolist']['project']);
524
525$form = new Form($db);
526$formcompany = new FormCompany($db);
527$companystatic = new Societe($db);
528$taskstatic = new Task($db);
529$formother = new FormOther($db);
530$formproject = new FormProjets($db);
531$userstatic = new User($db);
532
533$now = dol_now();
534
535$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
536$title = $langs->trans("LeadsOrProjects");
537if (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
538 $title = $langs->trans("Projects");
539}
540if (getDolGlobalInt('PROJECT_USE_OPPORTUNITIES') == 2) { // 2 = leads only
541 $title = $langs->trans("Leads");
542}
543$morejs = array();
544$morecss = array();
545
546
547// Get list of project id allowed to user (in a string list separated by comma)
548$projectsListId = '';
549if (!$user->hasRight('projet', 'all', 'lire')) {
550 $projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
551}
552
553// Get id of types of contacts for projects (This list never contains a lot of elements)
554$listofprojectcontacttype = array();
555$listofprojectcontacttypeexternal = array();
556$sql = "SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
557$sql .= " WHERE ctc.element = '".$db->escape($object->element)."'";
558$resql = $db->query($sql);
559if ($resql) {
560 while ($obj = $db->fetch_object($resql)) {
561 if ($obj->source == 'internal') {
562 $listofprojectcontacttype[$obj->rowid] = $obj->code;
563 } else {
564 $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
565 }
566 }
567} else {
568 dol_print_error($db);
569}
570if (count($listofprojectcontacttype) == 0) {
571 $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
572}
573if (count($listofprojectcontacttypeexternal) == 0) {
574 $listofprojectcontacttypeexternal[0] = '0'; // To avoid sql syntax error if not found
575}
576
577$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
578$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
579
580// Build and execute select
581// --------------------------------------------------------------------
582$sql = "SELECT";
583$sql .= " p.rowid as id, p.ref, p.title, p.fk_statut as status, cls.position, ";
584$sql .= $db->ifsql("p.fk_opp_status IS NULL", "0", "p.fk_opp_status")." as fk_opp_status, p.public, p.fk_user_creat,";
585$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_modification, p.budget_amount,";
586$sql .= " p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
587$sql .= " p.email_msgid, p.import_key,";
588$sql .= " p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,";
589$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,";
590$sql .= " country.code as country_code,";
591$sql .= " cls.code as opp_status_code,";
592$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';
593// Add fields from extrafields
594if (!empty($extrafields->attributes[$object->table_element]['label'])) {
595 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
596 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
597 }
598}
599// Add fields from hooks
600$parameters = array();
601$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
602$sql .= $hookmanager->resPrint;
603$sql = preg_replace('/,\s*$/', '', $sql);
604
605$sqlfields = $sql; // $sql fields to remove for count total
606
607$sql .= " FROM ".$db->prefix().$object->table_element." as p";
608if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
609 $sql .= " LEFT JOIN ".$db->prefix().$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
610}
611$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
612$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on country.rowid = s.fk_pays";
613$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
614$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON p.fk_user_creat = u.rowid';
615// We'll need this table joined to the select in order to filter by sale
616// No check is done on company permission because readability is managed by public status of project and assignment.
617//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";
618// Add table from hooks
619$parameters = array();
620$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
621$sql .= $hookmanager->resPrint;
622if ($search_entity > 0) {
623 $sql .= " WHERE p.entity = ".((int) $search_entity);
624} else {
625 $sql .= " WHERE p.entity IN (".getEntity('project').')';
626}
627if (!$user->hasRight('projet', 'all', 'lire')) {
628 $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
629}
630// No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser
631if ($socid > 0) {
632 $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)
633}
634if ($search_id) {
635 $sql .= natural_search('p.rowid', $search_id, 1);
636}
637if ($search_ref) {
638 $sql .= natural_search('p.ref', $search_ref);
639}
640if ($search_label) {
641 $sql .= natural_search('p.title', $search_label);
642}
643if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
644 $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
645} else {
646 if ($search_societe) {
647 $sql .= natural_search('s.nom', $search_societe);
648 }
649 if ($search_societe_alias) {
650 $sql .= natural_search('s.name_alias', $search_societe_alias);
651 }
652}
653if ($search_societe_country) {
654 $sql .= natural_search('country.code', $search_societe_country);
655}
656if ($search_opp_amount) {
657 $sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
658}
659if ($search_opp_percent) {
660 $sql .= natural_search('p.opp_percent', $search_opp_percent, 1);
661}
662$sql .= dolSqlDateFilter('p.dateo', $search_sday, $search_smonth, $search_syear);
663$sql .= dolSqlDateFilter('p.datee', $search_eday, $search_emonth, $search_eyear);
664
665if ($search_date_start_start) {
666 $sql .= " AND p.dateo >= '".$db->idate($search_date_start_start)."'";
667}
668if ($search_date_start_end) {
669 $sql .= " AND p.dateo <= '".$db->idate($search_date_start_end)."'";
670}
671
672if ($search_date_end_start) {
673 $sql .= " AND p.datee >= '".$db->idate($search_date_end_start)."'";
674}
675if ($search_date_end_end) {
676 $sql .= " AND p.datee <= '".$db->idate($search_date_end_end)."'";
677}
678
679if ($search_date_creation_start) {
680 $sql .= " AND p.datec >= '".$db->idate($search_date_creation_start)."'";
681}
682if ($search_date_creation_end) {
683 $sql .= " AND p.datec <= '".$db->idate($search_date_creation_end)."'";
684}
685
686if ($search_date_modif_start) {
687 $sql .= " AND p.tms >= '".$db->idate($search_date_modif_start)."'";
688}
689if ($search_date_modif_end) {
690 $sql .= " AND p.tms <= '".$db->idate($search_date_modif_end)."'";
691}
692
693if ($search_all) {
694 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
695}
696if ($search_status != '' && $search_status != '-1') {
697 if ($search_status == 99) {
698 $sql .= " AND p.fk_statut IN (0,1)";
699 } else {
700 $sql .= " AND p.fk_statut IN (".$db->sanitize($db->escape($search_status)).")";
701 }
702}
703if ($search_option == 'late') {
704 $sql .= " AND p.datee < '".$db->idate(dol_now() - $conf->project->warning_delay)."'";
705}
706if ($search_opp_status) {
707 if (is_numeric($search_opp_status) && $search_opp_status > 0) {
708 $sql .= " AND p.fk_opp_status = ".((int) $search_opp_status);
709 }
710 if ($search_opp_status == 'all') {
711 $sql .= " AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
712 }
713 if ($search_opp_status == 'openedopp') {
714 $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'))";
715 }
716 if ($search_opp_status == 'notopenedopp') {
717 $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'))";
718 }
719 if ($search_opp_status == 'none') {
720 $sql .= " AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
721 }
722}
723if ($search_public != '') {
724 $sql .= " AND p.public = ".((int) $search_public);
725}
726// No check is done on company permission because readability is managed by public status of project and assignment.
727//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))";
728// Search on sale representative
729if ($search_sale && $search_sale != '-1') {
730 if ($search_sale == -2) {
731 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix()."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
732 } elseif ($search_sale > 0) {
733 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".$db->prefix()."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
734 }
735}
736if ($search_project_user > 0) {
737 $sql .= " AND EXISTS (SELECT ecp.rowid FROM ".MAIN_DB_PREFIX."element_contact as ecp WHERE ecp.fk_c_type_contact IN (".$db->sanitize(implode(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user).")";
738}
739if ($search_project_contact > 0) {
740 $sql .= " AND EXISTS (SELECT ecp_contact.rowid FROM ".MAIN_DB_PREFIX."element_contact as ecp_contact WHERE ecp_contact.fk_c_type_contact IN (".$db->sanitize(implode(',', array_keys($listofprojectcontacttypeexternal))).") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact).")";
741}
742if ($search_opp_amount != '') {
743 $sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
744}
745if ($search_budget_amount != '') {
746 $sql .= natural_search('p.budget_amount', $search_budget_amount, 1);
747}
748if ($search_usage_opportunity != '' && $search_usage_opportunity >= 0) {
749 $sql .= natural_search('p.usage_opportunity', $search_usage_opportunity, 2);
750}
751if ($search_usage_task != '' && $search_usage_task >= 0) {
752 $sql .= natural_search('p.usage_task', $search_usage_task, 2);
753}
754if ($search_usage_bill_time != '' && $search_usage_bill_time >= 0) {
755 $sql .= natural_search('p.usage_bill_time', $search_usage_bill_time, 2);
756}
757if ($search_usage_event_organization != '' && $search_usage_event_organization >= 0) {
758 $sql .= natural_search('p.usage_organize_event', $search_usage_event_organization, 2);
759}
760if ($search_accept_conference_suggestions != '' && $search_accept_conference_suggestions >= 0) {
761 $sql .= natural_search('p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
762}
763if ($search_accept_booth_suggestions != '' && $search_accept_booth_suggestions >= 0) {
764 $sql .= natural_search('p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
765}
766if ($search_price_registration != '') {
767 $sql .= natural_search('p.price_registration', $search_price_registration, 1);
768}
769if ($search_price_booth != '') {
770 $sql .= natural_search('p.price_booth', $search_price_booth, 1);
771}
772if ($search_login) {
773 $sql .= natural_search(array('u.login', 'u.firstname', 'u.lastname'), $search_login);
774}
775if ($search_import_key) {
776 $sql .= natural_search(array('p.import_key'), $search_import_key);
777}
778if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) {
779 if ($search_omitChildren == 1) {
780 $sql .= " AND p.fk_project IS NULL";
781 }
782}
783
784// Search for tag/category ($searchCategoryProjectList is an array of ID)
785$searchCategoryProjectList = $search_category_array;
786$searchCategoryProjectOperator = 0;
787if (!empty($searchCategoryProjectList)) {
788 $searchCategoryProjectSqlList = array();
789 $listofcategoryid = '';
790 foreach ($searchCategoryProjectList as $searchCategoryProject) {
791 if (intval($searchCategoryProject) == -2) {
792 $searchCategoryProjectSqlList[] = "NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX."categorie_project as ck WHERE p.rowid = ck.fk_project)";
793 } elseif (intval($searchCategoryProject) > 0) {
794 if ($searchCategoryProjectOperator == 0) {
795 $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).")";
796 } else {
797 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProject);
798 }
799 }
800 }
801 if ($listofcategoryid) {
802 $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)."))";
803 }
804 if ($searchCategoryProjectOperator == 1) {
805 if (!empty($searchCategoryProjectSqlList)) {
806 $sql .= " AND (".implode(' OR ', $searchCategoryProjectSqlList).")";
807 }
808 } else {
809 if (!empty($searchCategoryProjectSqlList)) {
810 $sql .= " AND (".implode(' AND ', $searchCategoryProjectSqlList).")";
811 }
812 }
813}
814$searchCategoryCustomerSqlList = array();
815if ($searchCategoryCustomerOperator == 1) {
816 $existsCategoryCustomerList = array();
817 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
818 if (intval($searchCategoryCustomer) == -2) {
819 $sqlCategoryCustomerNotExists = " NOT EXISTS (";
820 $sqlCategoryCustomerNotExists .= " SELECT cat_cus.fk_soc";
821 $sqlCategoryCustomerNotExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
822 $sqlCategoryCustomerNotExists .= " WHERE cat_cus.fk_soc = p.fk_soc";
823 $sqlCategoryCustomerNotExists .= " )";
824 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
825 } elseif (intval($searchCategoryCustomer) > 0) {
826 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
827 }
828 }
829 if (!empty($existsCategoryCustomerList)) {
830 $sqlCategoryCustomerExists = " EXISTS (";
831 $sqlCategoryCustomerExists .= " SELECT cat_cus.fk_soc";
832 $sqlCategoryCustomerExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
833 $sqlCategoryCustomerExists .= " WHERE cat_cus.fk_soc = p.fk_soc";
834 $sqlCategoryCustomerExists .= " AND cat_cus.fk_categorie IN (".$db->sanitize(implode(',', $existsCategoryCustomerList)).")";
835 $sqlCategoryCustomerExists .= " )";
836 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
837 }
838 if (!empty($searchCategoryCustomerSqlList)) {
839 $sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
840 }
841} else {
842 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
843 if (intval($searchCategoryCustomer) == -2) {
844 $sqlCategoryCustomerNotExists = " NOT EXISTS (";
845 $sqlCategoryCustomerNotExists .= " SELECT cat_cus.fk_soc";
846 $sqlCategoryCustomerNotExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
847 $sqlCategoryCustomerNotExists .= " WHERE cat_cus.fk_soc = p.fk_soc";
848 $sqlCategoryCustomerNotExists .= " )";
849 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
850 } elseif (intval($searchCategoryCustomer) > 0) {
851 $searchCategoryCustomerSqlList[] = "p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix()."categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).")";
852 }
853 }
854 if (!empty($searchCategoryCustomerSqlList)) {
855 $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
856 }
857}
858// Add where from extra fields
859include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
860// Add where from hooks
861$parameters = array();
862$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
863$sql .= $hookmanager->resPrint;
864//print $sql;
865
866// Count total nb of records
867$nbtotalofrecords = '';
868if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
869 /* The fast and low memory method to get and count full list converts the sql into a sql count */
870 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
871 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
872 $resql = $db->query($sqlforcount);
873 if ($resql) {
874 $objforcount = $db->fetch_object($resql);
875 $nbtotalofrecords = $objforcount->nbtotalofrecords;
876 } else {
877 dol_print_error($db);
878 }
879
880 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
881 $page = 0;
882 $offset = 0;
883 }
884 $db->free($resql);
885}
886
887// Complete request and execute it with limit
888$sql .= $db->order($sortfield, $sortorder);
889if ($limit) {
890 $sql .= $db->plimit($limit + 1, $offset);
891}
892//print $sql;
893
894$resql = $db->query($sql);
895if (!$resql) {
896 dol_print_error($db);
897 exit;
898}
899
900$num = $db->num_rows($resql);
901
902// Direct jump if only one record found
903if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
904 $obj = $db->fetch_object($resql);
905 header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$obj->id);
906 exit;
907}
908
909
910// Output page
911// --------------------------------------------------------------------
912
913llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-project page-list bodyforlist');
914
915$arrayofselected = is_array($toselect) ? $toselect : array();
916
917$param = '';
918if (!empty($mode)) {
919 $param .= '&mode='.urlencode($mode);
920}
921if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
922 $param .= '&contextpage='.urlencode($contextpage);
923}
924if ($limit > 0 && $limit != $conf->liste_limit) {
925 $param .= '&limit='.((int) $limit);
926}
927if ($optioncss != '') {
928 $param .= '&optioncss='.urlencode($optioncss);
929}
930if ($search_all != '') {
931 $param .= '&search_all='.urlencode($search_all);
932}
933if ($search_entity != '') {
934 $param .= '&search_entity='.((int) $search_entity);
935}
936if ($groupby != '') {
937 $param .= '&groupby='.urlencode($groupby);
938}
939
940if ($socid) {
941 $param .= '&socid='.urlencode((string) $socid);
942}
943if ($search_sday) {
944 $param .= '&search_sday='.urlencode((string) ($search_sday));
945}
946if ($search_smonth) {
947 $param .= '&search_smonth='.urlencode((string) ($search_smonth));
948}
949if ($search_syear) {
950 $param .= '&search_syear='.urlencode((string) ($search_syear));
951}
952if ($search_eday) {
953 $param .= '&search_eday='.urlencode((string) ($search_eday));
954}
955if ($search_emonth) {
956 $param .= '&search_emonth='.urlencode((string) ($search_emonth));
957}
958if ($search_eyear) {
959 $param .= '&search_eyear='.urlencode((string) ($search_eyear));
960}
961if ($search_date_start_startmonth) {
962 $param .= '&search_date_start_startmonth='.urlencode((string) ($search_date_start_startmonth));
963}
964if ($search_date_start_startyear) {
965 $param .= '&search_date_start_startyear='.urlencode((string) ($search_date_start_startyear));
966}
967if ($search_date_start_startday) {
968 $param .= '&search_date_start_startday='.urlencode((string) ($search_date_start_startday));
969}
970if ($search_date_start_start) {
971 $param .= '&search_date_start_start='.urlencode((string) $search_date_start_start);
972}
973if ($search_date_start_endmonth) {
974 $param .= '&search_date_start_endmonth='.urlencode((string) ($search_date_start_endmonth));
975}
976if ($search_date_start_endyear) {
977 $param .= '&search_date_start_endyear='.urlencode((string) ($search_date_start_endyear));
978}
979if ($search_date_start_endday) {
980 $param .= '&search_date_start_endday='.urlencode((string) ($search_date_start_endday));
981}
982if ($search_date_start_end) {
983 $param .= '&search_date_start_end='.urlencode($search_date_start_end);
984}
985if ($search_date_end_startmonth) {
986 $param .= '&search_date_end_startmonth='.urlencode((string) ($search_date_end_startmonth));
987}
988if ($search_date_end_startyear) {
989 $param .= '&search_date_end_startyear='.urlencode((string) ($search_date_end_startyear));
990}
991if ($search_date_end_startday) {
992 $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday));
993}
994if ($search_date_end_start) {
995 $param .= '&search_date_end_start='.urlencode((string) $search_date_end_start);
996}
997if ($search_date_end_endmonth) {
998 $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth));
999}
1000if ($search_date_end_endyear) {
1001 $param .= '&search_date_end_endyear='.urlencode((string) ($search_date_end_endyear));
1002}
1003if ($search_date_end_endday) {
1004 $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday));
1005}
1006if ($search_date_end_end) {
1007 $param .= '&search_date_end_end=' . urlencode((string) $search_date_end_end);
1008}
1009if ($search_date_creation_startmonth) {
1010 $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth));
1011}
1012if ($search_date_creation_startyear) {
1013 $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear));
1014}
1015if ($search_date_creation_startday) {
1016 $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday));
1017}
1018if ($search_date_creation_start) {
1019 $param .= '&search_date_creation_start='.urlencode((string) $search_date_creation_start);
1020}
1021if ($search_date_creation_endmonth) {
1022 $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth));
1023}
1024if ($search_date_creation_endyear) {
1025 $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear));
1026}
1027if ($search_date_creation_endday) {
1028 $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday));
1029}
1030if ($search_date_creation_end) {
1031 $param .= '&search_date_creation_end='.urlencode($search_date_creation_end);
1032}
1033if ($search_date_modif_startmonth) {
1034 $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth));
1035}
1036if ($search_date_modif_startyear) {
1037 $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear));
1038}
1039if ($search_date_modif_startday) {
1040 $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday));
1041}
1042if ($search_date_modif_start) {
1043 $param .= '&search_date_modif_start='.urlencode((string) $search_date_modif_start);
1044}
1045if ($search_date_modif_endmonth) {
1046 $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth));
1047}
1048if ($search_date_modif_endyear) {
1049 $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear));
1050}
1051if ($search_date_modif_endday) {
1052 $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday));
1053}
1054if ($search_date_modif_end) {
1055 $param .= '&search_date_modif_end=' . urlencode((string) $search_date_modif_end);
1056}
1057if (!empty($search_category_array)) {
1058 foreach ($search_category_array as $tmpval) {
1059 $param .= '&search_categegory_project_list[]='.urlencode($tmpval);
1060 }
1061}
1062if ($search_id != '') {
1063 $param .= '&search_id='.urlencode($search_id);
1064}
1065if ($search_ref != '') {
1066 $param .= '&search_ref='.urlencode($search_ref);
1067}
1068if ($search_label != '') {
1069 $param .= '&search_label='.urlencode($search_label);
1070}
1071if ($search_societe != '') {
1072 $param .= '&search_societe='.urlencode($search_societe);
1073}
1074if ($search_societe_alias != '') {
1075 $param .= '&search_societe_alias='.urlencode($search_societe_alias);
1076}
1077if ($search_societe_country != '') {
1078 $param .= '&search_societe_country='.urlencode($search_societe_country);
1079}
1080if ($search_status != '' && $search_status != '-1') {
1081 $param .= "&search_status=".urlencode($search_status);
1082}
1083if ($search_option) {
1084 $param .= "&search_option=".urlencode($search_option);
1085}
1086if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'openedopp', 'notopenedopp', 'none'))) {
1087 $param .= '&search_opp_status='.urlencode($search_opp_status);
1088}
1089if ($search_opp_percent != '') {
1090 $param .= '&search_opp_percent='.urlencode($search_opp_percent);
1091}
1092if ($search_public != '') {
1093 $param .= '&search_public='.urlencode($search_public);
1094}
1095if ($search_project_user > 0) {
1096 $param .= '&search_project_user='.urlencode((string) $search_project_user);
1097}
1098if ($search_project_contact > 0) {
1099 $param .= '&search_project_contact='.urlencode((string) ($search_project_contact));
1100}
1101if ($search_sale > 0) {
1102 $param .= '&search_sale='.urlencode((string) ($search_sale));
1103}
1104if ($search_opp_amount != '') {
1105 $param .= '&search_opp_amount='.urlencode($search_opp_amount);
1106}
1107if ($search_budget_amount != '') {
1108 $param .= '&search_budget_amount='.urlencode($search_budget_amount);
1109}
1110if ($search_usage_task != '') {
1111 $param .= '&search_usage_task='.urlencode($search_usage_task);
1112}
1113if ($search_usage_bill_time != '') {
1114 $param .= '&search_usage_opportunity='.urlencode($search_usage_bill_time);
1115}
1116if ($search_usage_event_organization != '') {
1117 $param .= '&search_usage_event_organization='.urlencode($search_usage_event_organization);
1118}
1119if ($search_accept_conference_suggestions != '') {
1120 $param .= '&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
1121}
1122if ($search_accept_booth_suggestions != '') {
1123 $param .= '&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
1124}
1125if ($search_price_registration != '') {
1126 $param .= '&search_price_registration='.urlencode($search_price_registration);
1127}
1128if ($search_price_booth != '') {
1129 $param .= '&search_price_booth='.urlencode($search_price_booth);
1130}
1131if ($search_login) {
1132 $param .= '&search_login='.urlencode($search_login);
1133}
1134if ($search_import_key) {
1135 $param .= '&search_import_key='.urlencode($search_import_key);
1136}
1137foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1138 $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1139}
1140// Add $param from extra fields
1141include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1142
1143// Add $param from hooks
1144$parameters = array('param' => &$param);
1145$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1146$param .= $hookmanager->resPrint;
1147
1148// List of mass actions available
1149$arrayofmassactions = array(
1150 'validate' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
1151 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
1152 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
1153 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
1154);
1155//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
1156if ($user->hasRight('projet', 'creer')) {
1157 $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close");
1158 $arrayofmassactions['preaffectuser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AffectUser");
1159}
1160if ($user->hasRight('projet', 'supprimer')) {
1161 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
1162}
1163if (isModEnabled('category') && $user->hasRight('projet', 'creer')) {
1164 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
1165}
1166if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preaffectuser'))) {
1167 $arrayofmassactions = array();
1168}
1169
1170$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1171
1172$url = DOL_URL_ROOT.'/projet/card.php?action=create';
1173if (!empty($socid)) {
1174 $url .= '&socid='.$socid;
1175}
1176if ($search_usage_event_organization == 1) {
1177 $url .= '&usage_organize_event=1';
1178 if (((int) $search_usage_opportunity) < 1) {
1179 $url .= '&usage_opportunity=0';
1180 }
1181}
1182
1183$newcardbutton = '';
1184$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
1185$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
1186if ($contextpage == 'lead') {
1187 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanbanGroupBy'), '', 'fa fa-grip-vertical imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanbangroupby&groupby=p.fk_opp_status'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'kanbangroupby' ? 2 : 1), array('morecss' => 'reposition'));
1188}
1189$newcardbutton .= dolGetButtonTitleSeparator();
1190$newcardbutton .= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('projet', 'creer'));
1191
1192print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
1193if ($optioncss != '') {
1194 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1195}
1196print '<input type="hidden" name="token" value="'.newToken().'">';
1197print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1198print '<input type="hidden" name="action" value="list">';
1199print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1200print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1201print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
1202print '<input type="hidden" name="mode" value="'.$mode.'">';
1203print '<input type="hidden" name="groupby" value="'.$groupby.'">';
1204
1205// Show description of content
1206$htmltooltip = '';
1207if ($search_project_user == $user->id) {
1208 $htmltooltip .= $langs->trans("MyProjectsDesc");
1209} else {
1210 if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
1211 $htmltooltip .= $langs->trans("ProjectsDesc");
1212 } else {
1213 $htmltooltip .= $langs->trans("ProjectsPublicDesc");
1214 }
1215}
1216
1217print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1);
1218
1219
1220$topicmail = "Information";
1221$modelmail = "project";
1222$objecttmp = new Project($db);
1223$trackid = 'proj'.$object->id;
1224include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1225
1226if ($search_all) {
1227 foreach ($fieldstosearchall as $key => $val) {
1228 $fieldstosearchall[$key] = $langs->trans($val);
1229 }
1230 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
1231}
1232
1233$moreforfilter = '';
1234
1235// If the user can view user other than himself
1236$moreforfilter .= '<div class="divsearchfield">';
1237$tmptitle = $langs->trans('ProjectsWithThisUserAsContact');
1238//$includeonly = 'hierarchyme';
1239$includeonly = '';
1240if (!$user->hasRight('user', 'user', 'lire')) {
1241 $includeonly = array($user->id);
1242}
1243$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, null, 0, $includeonly, '', '0', 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx');
1244$moreforfilter .= '</div>';
1245
1246$moreforfilter .= '<div class="divsearchfield">';
1247$tmptitle = $langs->trans('ProjectsWithThisContact');
1248$moreforfilter .= img_picto($tmptitle, 'contact', 'class="pictofixedwidth"').$form->select_contact(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth300 widthcentpercentminusx');
1249
1250$moreforfilter .= '</div>';
1251
1252// If the user can view thirdparties other than his'
1253if ($user->hasRight('user', 'user', 'lire')) {
1254 $langs->load("commercial");
1255 $moreforfilter .= '<div class="divsearchfield">';
1256 $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
1257 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth300 widthcentpercentminusx');
1258 $moreforfilter .= '</div>';
1259}
1260
1261// Filter on categories
1262if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
1263 $formcategory = new FormCategory($db);
1264 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp minwidth300 widthcentpercentminusx');
1265}
1266
1267// Filter on customer categories
1268if (getDolGlobalString('MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST') && isModEnabled("category") && $user->hasRight('categorie', 'lire')) {
1269 $formcategory = new FormCategory($db);
1270 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList, 'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
1271}
1272
1273// alert on late date
1274$moreforfilter .= '<div class="divsearchfield">';
1275$moreforfilter .= '<label for="search_option" title="'.$langs->trans("Late").'">'.$langs->trans('Alert').' </label><input type="checkbox" id="search_option" name="search_option" value="late"'.($search_option == 'late' ? ' checked' : '').'>';
1276$moreforfilter .= '</div>';
1277
1278if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) {
1279 //Checkbox for omitting child projects filter
1280 $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"' : '').'"> ';
1281}
1282
1283if (!empty($moreforfilter)) {
1284 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1285 print $moreforfilter;
1286 $parameters = array();
1287 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1288 print $hookmanager->resPrint;
1289 print '</div>';
1290}
1291
1292$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1293$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1294$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
1295$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1296
1297
1298print '<div class="div-table-responsive">';
1299print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1300
1301// Fields title search
1302// --------------------------------------------------------------------
1303print '<tr class="liste_titre_filter">';
1304// Action column
1305if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1306 print '<td class="liste_titre maxwidthsearch">';
1307 $searchpicto = $form->showFilterButtons('left');
1308 print $searchpicto;
1309 print '</td>';
1310}
1311// Project ID
1312if (!empty($arrayfields['p.rowid']['checked'])) {
1313 print '<td class="liste_titre">';
1314 print '<input type="text" class="flat width50" name="search_id" value="'.dol_escape_htmltag($search_id).'">';
1315 print '</td>';
1316}
1317// Project ref
1318if (!empty($arrayfields['p.ref']['checked'])) {
1319 print '<td class="liste_titre">';
1320 print '<input type="text" class="flat width75" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
1321 print '</td>';
1322}
1323// Project label
1324if (!empty($arrayfields['p.title']['checked'])) {
1325 print '<td class="liste_titre">';
1326 print '<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'">';
1327 print '</td>';
1328}
1329// Third party
1330if (!empty($arrayfields['s.nom']['checked'])) {
1331 print '<td class="liste_titre">';
1332 if ($socid > 0) {
1333 $tmpthirdparty = new Societe($db);
1334 $tmpthirdparty->fetch($socid);
1335 $search_societe = $tmpthirdparty->name;
1336 }
1337 print '<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag((string) $search_societe).'">';
1338 print '</td>';
1339}
1340
1341// Alias
1342if (!empty($arrayfields['s.name_alias']['checked'])) {
1343 print '<td class="liste_titre">';
1344 if ($socid > 0) {
1345 $tmpthirdparty = new Societe($db);
1346 $tmpthirdparty->fetch($socid);
1347 $search_societe_alias = $tmpthirdparty->name_alias;
1348 }
1349 print '<input type="text" class="flat" name="search_societe_alias" size="8" value="'.dol_escape_htmltag($search_societe_alias).'">';
1350 print '</td>';
1351}
1352// Country of thirdparty
1353if (!empty($arrayfields['co.country_code']['checked'])) {
1354 print '<td class="liste_titre">';
1355 print '<input type="text" class="flat width50" name="search_societe_country" value="'.dol_escape_htmltag($search_societe_country).'">';
1356 print '</td>';
1357}
1358// Sale representative
1359if (!empty($arrayfields['commercial']['checked'])) {
1360 print '<td class="liste_titre">&nbsp;</td>';
1361}
1362// Start date
1363if (!empty($arrayfields['p.dateo']['checked'])) {
1364 print '<td class="liste_titre center">';
1365 print '<div class="nowrapfordate">';
1366 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'));
1367 print '</div>';
1368 print '<div class="nowrapfordate">';
1369 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'));
1370 print '</div>';
1371 print '</td>';
1372}
1373// End date
1374if (!empty($arrayfields['p.datee']['checked'])) {
1375 print '<td class="liste_titre center">';
1376 print '<div class="nowrapfordate">';
1377 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'));
1378 print '</div>';
1379 print '<div class="nowrapfordate">';
1380 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'));
1381 print '</div>';
1382 print '</td>';
1383}
1384// Visibility
1385if (!empty($arrayfields['p.public']['checked'])) {
1386 print '<td class="liste_titre center">';
1387 $array = array('' => '', 0 => $langs->trans("PrivateProject"), 1 => $langs->trans("SharedProject"));
1388 print $form->selectarray('search_public', $array, $search_public, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth75');
1389 print '</td>';
1390}
1391if (!empty($arrayfields['c.assigned']['checked'])) {
1392 print '<td class="liste_titre center">';
1393 print '</td>';
1394}
1395// Opp status
1396if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
1397 print '<td class="liste_titre nowrap center">';
1398 print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth125 nowrapoption', 1, 1);
1399 print '</td>';
1400}
1401if (!empty($arrayfields['p.opp_amount']['checked'])) {
1402 print '<td class="liste_titre nowrap right">';
1403 print '<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.'">';
1404 print '</td>';
1405}
1406if (!empty($arrayfields['p.opp_percent']['checked'])) {
1407 print '<td class="liste_titre nowrap right">';
1408 print '<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.'">';
1409 print '</td>';
1410}
1411if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
1412 print '<td class="liste_titre nowrap right">';
1413 print '</td>';
1414}
1415if (!empty($arrayfields['p.budget_amount']['checked'])) {
1416 print '<td class="liste_titre nowrap right">';
1417 print '<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.'">';
1418 print '</td>';
1419}
1420if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
1421 print '<td class="liste_titre nowrap">';
1422 print $form->selectyesno('search_usage_opportunity', $search_usage_opportunity, 1, false, 1, 1);
1423 print '';
1424 print '</td>';
1425}
1426if (!empty($arrayfields['p.usage_task']['checked'])) {
1427 print '<td class="liste_titre nowrap">';
1428 print $form->selectyesno('search_usage_task', $search_usage_task, 1, false, 1, 1);
1429 print '</td>';
1430}
1431if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
1432 print '<td class="liste_titre nowrap">';
1433 print $form->selectyesno('search_usage_bill_time', $search_usage_bill_time, 1, false, 1, 1);
1434 print '</td>';
1435}
1436if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
1437 print '<td class="liste_titre nowrap">';
1438 print $form->selectyesno('search_usage_event_organization', $search_usage_event_organization, 1, false, 1, 1);
1439 print '</td>';
1440}
1441if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
1442 print '<td class="liste_titre nowrap">';
1443 print $form->selectyesno('search_accept_conference_suggestions', $search_accept_conference_suggestions, 1, false, 1, 1);
1444 print '</td>';
1445}
1446if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
1447 print '<td class="liste_titre nowrap">';
1448 print $form->selectyesno('search_accept_booth_suggestions', $search_accept_booth_suggestions, 1, false, 1, 1);
1449 print '</td>';
1450}
1451if (!empty($arrayfields['p.price_registration']['checked'])) {
1452 print '<td class="liste_titre nowrap right">';
1453 print '<input type="text" class="flat" name="search_price_registration" size="4" value="'.dol_escape_htmltag($search_price_registration).'">';
1454 print '</td>';
1455}
1456if (!empty($arrayfields['p.price_booth']['checked'])) {
1457 print '<td class="liste_titre nowrap right">';
1458 print '<input type="text" class="flat" name="search_price_booth" size="4" value="'.dol_escape_htmltag($search_price_booth).'">';
1459 print '</td>';
1460}
1461if (!empty($arrayfields['u.login']['checked'])) {
1462 // Author
1463 print '<td class="liste_titre" align="center">';
1464 print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
1465 print '</td>';
1466}
1467// Extra fields
1468include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1469
1470// Fields from hook
1471$parameters = array('arrayfields' => $arrayfields);
1472$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1473print $hookmanager->resPrint;
1474// Creation date
1475if (!empty($arrayfields['p.datec']['checked'])) {
1476 print '<td class="liste_titre center">';
1477 print '<div class="nowrapfordate">';
1478 print $form->selectDate($search_date_creation_start ? $search_date_creation_start : -1, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1479 print '</div>';
1480 print '<div class="nowrapfordate">';
1481 print $form->selectDate($search_date_creation_end ? $search_date_creation_end : -1, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1482 print '</div>';
1483 print '</td>';
1484}
1485// Modification date
1486if (!empty($arrayfields['p.tms']['checked'])) {
1487 print '<td class="liste_titre center">';
1488 print '<div class="nowrapfordate">';
1489 print $form->selectDate($search_date_modif_start ? $search_date_modif_start : -1, 'search_date_modif_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1490 print '</div>';
1491 print '<div class="nowrapfordate">';
1492 print $form->selectDate($search_date_modif_end ? $search_date_modif_end : -1, 'search_date_modif_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1493 print '</div>';
1494 print '</td>';
1495}
1496if (!empty($arrayfields['p.email_msgid']['checked'])) {
1497 // Email msg id
1498 print '<td class="liste_titre">';
1499 print '</td>';
1500}
1501if (!empty($arrayfields['p.import_key']['checked'])) {
1502 // Import key
1503 print '<td class="liste_titre">';
1504 print '<input class="flat width75" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1505 print '</td>';
1506}
1507if (!empty($arrayfields['p.fk_statut']['checked'])) {
1508 print '<td class="liste_titre center parentonrightofpage">';
1509 $formproject->selectProjectsStatus($search_status, 1, 'search_status');
1510 print '</td>';
1511}
1512// Action column
1513if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1514 print '<td class="liste_titre maxwidthsearch">';
1515 $searchpicto = $form->showFilterButtons();
1516 print $searchpicto;
1517 print '</td>';
1518}
1519print '</tr>'."\n";
1520
1521$totalarray = array();
1522$totalarray['nbfield'] = 0;
1523
1524// Fields title label
1525// --------------------------------------------------------------------
1526print '<tr class="liste_titre">';
1527if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1528 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1529 $totalarray['nbfield']++;
1530}
1531if (!empty($arrayfields['p.rowid']['checked'])) {
1532 print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder);
1533 $totalarray['nbfield']++;
1534}
1535if (!empty($arrayfields['p.ref']['checked'])) {
1536 print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder);
1537 $totalarray['nbfield']++;
1538}
1539if (!empty($arrayfields['p.title']['checked'])) {
1540 print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder);
1541 $totalarray['nbfield']++;
1542}
1543if (!empty($arrayfields['s.nom']['checked'])) {
1544 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
1545 $totalarray['nbfield']++;
1546}
1547if (!empty($arrayfields['s.name_alias']['checked'])) {
1548 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1549 print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder);
1550 $totalarray['nbfield']++;
1551}
1552if (!empty($arrayfields['co.country_code']['checked'])) {
1553 print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "country.code", "", $param, "", $sortfield, $sortorder, 'center ');
1554 $totalarray['nbfield']++;
1555}
1556if (!empty($arrayfields['commercial']['checked'])) {
1557 print_liste_field_titre($arrayfields['commercial']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder, 'tdoverflowmax100imp ');
1558 $totalarray['nbfield']++;
1559}
1560if (!empty($arrayfields['p.dateo']['checked'])) {
1561 print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, '', $sortfield, $sortorder, 'center ');
1562 $totalarray['nbfield']++;
1563}
1564if (!empty($arrayfields['p.datee']['checked'])) {
1565 print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, '', $sortfield, $sortorder, 'center ');
1566 $totalarray['nbfield']++;
1567}
1568if (!empty($arrayfields['p.public']['checked'])) {
1569 print_liste_field_titre($arrayfields['p.public']['label'], $_SERVER["PHP_SELF"], "p.public", "", $param, "", $sortfield, $sortorder, 'center ');
1570 $totalarray['nbfield']++;
1571}
1572if (!empty($arrayfields['c.assigned']['checked'])) {
1573 print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
1574 $totalarray['nbfield']++;
1575}
1576if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
1577 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1578 print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center ');
1579 $totalarray['nbfield']++;
1580}
1581if (!empty($arrayfields['p.opp_amount']['checked'])) {
1582 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1583 print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
1584 $totalarray['nbfield']++;
1585}
1586if (!empty($arrayfields['p.opp_percent']['checked'])) {
1587 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1588 print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER['PHP_SELF'], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
1589 $totalarray['nbfield']++;
1590}
1591if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
1592 print_liste_field_titre($arrayfields['opp_weighted_amount']['label'], $_SERVER['PHP_SELF'], 'opp_weighted_amount', '', $param, '', $sortfield, $sortorder, 'right ');
1593 $totalarray['nbfield']++;
1594}
1595if (!empty($arrayfields['p.budget_amount']['checked'])) {
1596 print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
1597 $totalarray['nbfield']++;
1598}
1599if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
1600 print_liste_field_titre($arrayfields['p.usage_opportunity']['label'], $_SERVER["PHP_SELF"], 'p.usage_opportunity', "", $param, '', $sortfield, $sortorder, '');
1601 $totalarray['nbfield']++;
1602}
1603if (!empty($arrayfields['p.usage_task']['checked'])) {
1604 print_liste_field_titre($arrayfields['p.usage_task']['label'], $_SERVER["PHP_SELF"], 'p.usage_task', "", $param, '', $sortfield, $sortorder, '');
1605 $totalarray['nbfield']++;
1606}
1607if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
1608 print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, '');
1609 $totalarray['nbfield']++;
1610}
1611if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
1612 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1613 print_liste_field_titre($arrayfields['p.usage_organize_event']['label'], $_SERVER["PHP_SELF"], 'p.usage_organize_event', "", $param, '', $sortfield, $sortorder, '');
1614 $totalarray['nbfield']++;
1615}
1616if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
1617 print_liste_field_titre($arrayfields['p.accept_conference_suggestions']['label'], $_SERVER["PHP_SELF"], 'p.accept_conference_suggestions', "", $param, '', $sortfield, $sortorder, '');
1618 $totalarray['nbfield']++;
1619}
1620if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
1621 print_liste_field_titre($arrayfields['p.accept_booth_suggestions']['label'], $_SERVER["PHP_SELF"], 'p.accept_booth_suggestions', "", $param, '', $sortfield, $sortorder, '');
1622 $totalarray['nbfield']++;
1623}
1624if (!empty($arrayfields['p.price_registration']['checked'])) {
1625 print_liste_field_titre($arrayfields['p.price_registration']['label'], $_SERVER["PHP_SELF"], 'p.price_registration', "", $param, '', $sortfield, $sortorder, 'right ');
1626 $totalarray['nbfield']++;
1627}
1628if (!empty($arrayfields['p.price_booth']['checked'])) {
1629 print_liste_field_titre($arrayfields['p.price_booth']['label'], $_SERVER["PHP_SELF"], 'p.price_booth', "", $param, '', $sortfield, $sortorder, 'right ');
1630 $totalarray['nbfield']++;
1631}
1632if (!empty($arrayfields['u.login']['checked'])) {
1633 print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
1634 $totalarray['nbfield']++;
1635}
1636// Extra fields
1637include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1638// Hook fields
1639$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
1640$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1641print $hookmanager->resPrint;
1642if (!empty($arrayfields['p.datec']['checked'])) {
1643 print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1644 $totalarray['nbfield']++;
1645}
1646if (!empty($arrayfields['p.tms']['checked'])) {
1647 print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1648 $totalarray['nbfield']++;
1649}
1650if (!empty($arrayfields['p.email_msgid']['checked'])) {
1651 print_liste_field_titre($arrayfields['p.email_msgid']['label'], $_SERVER["PHP_SELF"], "p.email_msgid", "", $param, '', $sortfield, $sortorder, 'center ');
1652 $totalarray['nbfield']++;
1653}
1654if (!empty($arrayfields['p.import_key']['checked'])) {
1655 print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, '');
1656 $totalarray['nbfield']++;
1657}
1658if (!empty($arrayfields['p.fk_statut']['checked'])) {
1659 print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
1660 $totalarray['nbfield']++;
1661}
1662// Action column
1663if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1664 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1665 $totalarray['nbfield']++;
1666}
1667print '</tr>'."\n";
1668
1669
1670$i = 0;
1671$savnbfield = $totalarray['nbfield'];
1672$totalarray = array(
1673 'nbfield' => 0,
1674 'val' => array()
1675);
1676$imaxinloop = ($limit ? min($num, $limit) : $num);
1677while ($i < $imaxinloop) {
1678 $obj = $db->fetch_object($resql);
1679 if (empty($obj)) {
1680 break; // Should not happen
1681 }
1682
1683 // Thirdparty
1684 $companystatic->id = $obj->socid;
1685 $companystatic->name = $obj->name;
1686 $companystatic->name_alias = $obj->alias;
1687 $companystatic->client = $obj->client;
1688 $companystatic->code_client = $obj->code_client;
1689 $companystatic->email = $obj->email;
1690 $companystatic->phone = $obj->phone;
1691 $companystatic->address = $obj->address;
1692 $companystatic->zip = $obj->zip;
1693 $companystatic->town = $obj->town;
1694 $companystatic->country_code = $obj->country_code;
1695
1696 // Project
1697 $object->id = $obj->id;
1698 $object->ref = $obj->ref;
1699 $object->title = $obj->title;
1700 $object->fk_opp_status = $obj->fk_opp_status;
1701 $object->user_author_id = $obj->fk_user_creat;
1702 $object->date_creation = $db->jdate($obj->date_creation);
1703 $object->date_start = $db->jdate($obj->date_start);
1704 $object->date_end = $db->jdate($obj->date_end);
1705 $object->status = $obj->status;
1706 $object->public = $obj->public;
1707 $object->opp_percent = $obj->opp_percent;
1708 $object->opp_status = $obj->fk_opp_status;
1709 $object->opp_status_code = $obj->opp_status_code;
1710 $object->opp_amount = !empty($obj->opp_amount) ? $obj->opp_amount : "";
1711 $object->opp_weighted_amount = $obj->opp_weighted_amount;
1712 $object->budget_amount = $obj->budget_amount;
1713 $object->usage_opportunity = $obj->usage_opportunity;
1714 $object->usage_task = $obj->usage_task;
1715 $object->usage_bill_time = $obj->usage_bill_time;
1716 $object->usage_organize_event = $obj->usage_organize_event;
1717 $object->email_msgid = $obj->email_msgid;
1718 $object->import_key = $obj->import_key;
1719 $object->thirdparty = $companystatic;
1720
1721 //$userAccess = $object->restrictedProjectArea($user); // disabled, permission on project must be done by the select
1722
1723 $stringassignedusers = '';
1724
1725 if (!empty($arrayfields['c.assigned']['checked'])) {
1726 $ifisrt = 1;
1727 foreach (array('internal', 'external') as $source) {
1728 $tab = $object->liste_contact(-1, $source, 0, '', 1);
1729 $numcontact = count($tab);
1730 if (!empty($numcontact)) {
1731 foreach ($tab as $contactproject) {
1732 //var_dump($contacttask);
1733 if ($source == 'internal') {
1734 if (!empty($conf->cache['user'][$contactproject['id']])) {
1735 $c = $conf->cache['user'][$contactproject['id']];
1736 } else {
1737 $c = new User($db);
1738 $c->fetch($contactproject['id']);
1739 $conf->cache['user'][$contactproject['id']] = $c;
1740 }
1741 } else {
1742 if (!empty($conf->cache['contact'][$contactproject['id']])) {
1743 $c = $conf->cache['contact'][$contactproject['id']];
1744 } else {
1745 $c = new Contact($db);
1746 $c->fetch($contactproject['id']);
1747 $conf->cache['contact'][$contactproject['id']] = $c;
1748 }
1749 }
1750 if (get_class($c) == 'User') {
1751 $stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, 24, 1, '', 'valignmiddle'.($ifisrt ? '' : ' notfirst'));
1752 } else {
1753 $stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, -1, 0, 'valignmiddle'.($ifisrt ? '' : ' notfirst'));
1754 }
1755 $ifisrt = 0;
1756 }
1757 }
1758 }
1759 }
1760
1761 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
1762 if ($i == 0) {
1763 print '<tr class="trkanban'.(empty($groupby) ? '' : ' trkanbangroupby').'"><td colspan="'.$savnbfield.'">';
1764 }
1765
1766 $groupbyvalue = 'unset';
1767 $groupbyfield = 'unsetfield';
1768 //var_dump($groupbyvalues);
1769
1770 if (!empty($groupby)) {
1771 $groupbyfield = preg_replace('/^[a-z]+\./', '', $groupby);
1772 // $groupbyold will be the value after the first pass to find break on the next pass.
1773 //var_dump("groupby=$groupby groupbyvalue=$groupbyvalue groupbyfield=$groupbyfield");
1774
1775 if (is_null($groupbyold)) {
1776 print '<div class="box-flex-container-columns kanban">'; // Start div for all kanban columns
1777 }
1778 // Start kanban column
1779 if (is_null($obj->$groupbyfield)) {
1780 $groupbyvalue = 'undefined';
1781 // We found a null value, we add an undefined value in dictionary of values $groupbyvalues
1782 $groupbyvalues[0] = array('id' => '0', 'label' => 'Undefined');
1783 } else {
1784 $groupbyvalue = $obj->$groupbyfield;
1785 }
1786
1787 if ($groupbyold !== $groupbyvalue) { // We found a break on a new column
1788 if (!is_null($groupbyold)) {
1789 print '</div>'; // We need a new kanban column - end box-flex-container
1790 }
1791
1792 $indexofgroupbyvalue = null;
1793
1794 // We show column that we must show before the first current record
1795 //var_dump("groupbyold=".$groupbyold.", current record to show has group value groupbyvalue=".$groupbyvalue);
1796 foreach ($groupbyvalues as $tmpcursor => $tmpgroupbyvalue) { // $tmpcursor is a i index like 0, 1, 2, ...
1797 // Is $tmpcursor a key before, equal or after the $groupbyvalue into the $groupbyvalues
1798 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
1799 if ($tmpgroupbyvalue2['id'] == $groupbyvalue) { // We found the index of $groupbyvalue
1800 $indexofgroupbyvalue = $tmpcursor2;
1801 break;
1802 }
1803 }
1804 //var_dump('indexofgroupbyvalue='.$indexofgroupbyvalue);
1805
1806 if (!is_null($groupbyold)) {
1807 $indexofgroupbyold = null;
1808 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
1809 if ($tmpgroupbyvalue2['id'] == $groupbyold) { // We found the index of $groupbyold
1810 $indexofgroupbyold = $tmpcursor2;
1811 break;
1812 }
1813 }
1814 //var_dump('indexofgroupbyold='.$indexofgroupbyold);
1815
1816 if ($tmpcursor <= $indexofgroupbyold) {
1817 continue;
1818 }
1819 }
1820 if ($tmpcursor >= $indexofgroupbyvalue) { // We reach the column to show, so we stop
1821 continue;
1822 }
1823
1824 // We found a possible column with no value, we output the empty column
1825 print '<!-- empty column before column of fetched value --><div class="box-flex-container-column kanban column';
1826 if (array_key_exists($tmpcursor, $groupofcollpasedvalues)) {
1827 print ' kanbancollapsed';
1828 }
1829 print '" data-groupbyid="'.preg_replace('/[^a-z0-9]/', '', $tmpgroupbyvalue['id']).'" data-groupbyfield="'.$groupbyfield.'">';
1830 print '<div class="kanbanlabel">'.$langs->trans($tmpgroupbyvalue['label']).'</div>';
1831 print '</div>'; // Start and end the new column
1832 }
1833
1834 print '<!-- start column for value --><div class="box-flex-container-column kanban column" data-groupbyid="'.preg_replace('/[^a-z0-9]/i', '', $groupbyvalue).'" data-groupbyfield="'.$groupbyfield.'">'; // Start new column
1835 print '<div class="kanbanlabel">'.$langs->trans((is_null($indexofgroupbyvalue) || empty($groupbyvalues[$indexofgroupbyvalue]['label'])) ? 'Undefined' : $groupbyvalues[$indexofgroupbyvalue]['label']).'</div>';
1836 }
1837 $groupbyold = $groupbyvalue;
1838 } elseif ($i == 0) {
1839 print '<div class="box-flex-container kanban">';
1840 }
1841
1842 // Output Kanban
1843 $selected = -1;
1844 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1845 $selected = 0;
1846 if (in_array($object->id, $arrayofselected)) {
1847 $selected = 1;
1848 }
1849 }
1850 $arrayofdata = array('assignedusers' => $stringassignedusers, 'thirdparty' => $companystatic, 'selected' => $selected, 'mode' => $mode);
1851
1852 print $object->getKanbanView('', $arrayofdata, ($groupby ? 'small' : ''));
1853
1854 // if no more elements to show
1855 if ($i == ($imaxinloop - 1)) {
1856 // Close kanban column
1857 if (!empty($groupby)) {
1858 print '</div>'; // end box-flex-container
1859
1860 // We show column that we must show after the last current record
1861 //var_dump("groupbyold=".$groupbyold.", current record to show has group value groupbyvalue=".$groupbyvalue);
1862 foreach ($groupbyvalues as $tmpcursor => $tmpgroupbyvalue) {
1863 // Is $tmpcursor a key before, equal or after the $groupbyvalue into the $groupbyvalues
1864 $indexofgroupbyvalue = null;
1865 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
1866 if ($tmpgroupbyvalue2['id'] == $groupbyvalue) { // We found the index of $groupbyvalue
1867 $indexofgroupbyvalue = $tmpcursor2;
1868 break;
1869 }
1870 }
1871 //var_dump('indexofgroupbyvalue='.$indexofgroupbyvalue);
1872
1873 if (!is_null($groupbyold)) {
1874 $indexofgroupbyold = null;
1875 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
1876 if ($tmpgroupbyvalue2['id'] == $groupbyold) { // We found the index of $groupbyold
1877 $indexofgroupbyold = $tmpcursor2;
1878 break;
1879 }
1880 }
1881 //var_dump('indexofgroupbyold='.$indexofgroupbyold);
1882 }
1883
1884 //var_dump("tmpcursor=".$tmpcursor." groupbyold=".$groupbyold." groupbyvalue=".$groupbyvalue);
1885 if ($tmpcursor <= $indexofgroupbyvalue) {
1886 continue;
1887 }
1888 // We found a possible column with no value, we output the empty column
1889 print '<!-- empty column after column of fetched value --><div class="box-flex-container-column kanban column';
1890 if (array_key_exists($tmpcursor, $groupofcollpasedvalues)) {
1891 print ' kanbancollapsed';
1892 }
1893 print '" data-groupbyid="'.preg_replace('/[^a-z0-9]/', '', $tmpgroupbyvalue['id']).'" data-groupbyfield="'.$groupbyfield.'">';
1894 print '<div class="kanbanlabel">'.$langs->trans(empty($tmpgroupbyvalue['label']) ? 'Undefined' : $tmpgroupbyvalue['label']).'</div>';
1895 print '</div>'; // Start and end the new column
1896 }
1897 print '</div>'; // end box-flex-container-columns
1898 } else {
1899 print '</div>'; // end box-flex-container
1900 }
1901
1902 print '</td></tr>';
1903 }
1904 } else {
1905 // Author
1906 $userstatic->id = $obj->fk_user_creat;
1907 $userstatic->login = $obj->login;
1908 $userstatic->lastname = $obj->lastname;
1909 $userstatic->firstname = $obj->firstname;
1910 $userstatic->email = $obj->user_email;
1911 $userstatic->status = $obj->user_statut;
1912 $userstatic->entity = $obj->entity;
1913 $userstatic->photo = $obj->photo;
1914 $userstatic->office_phone = $obj->office_phone;
1915 $userstatic->office_fax = $obj->office_fax;
1916 $userstatic->user_mobile = $obj->user_mobile;
1917 $userstatic->job = $obj->job;
1918 $userstatic->gender = $obj->gender;
1919
1920 // Show here line of result
1921 $j = 0;
1922 print '<tr data-rowid="'.$object->id.'" class="oddeven '.((getDolGlobalInt('MAIN_FINISHED_LINES_OPACITY') == 1 && $object->status > 1) ? 'opacitymedium' : '').'">';
1923 // Action column
1924 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1925 print '<td class="nowrap center">';
1926 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1927 $selected = 0;
1928 if (in_array($object->id, $arrayofselected)) {
1929 $selected = 1;
1930 }
1931 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1932 }
1933 print '</td>';
1934 if (!$i) {
1935 $totalarray['nbfield']++;
1936 }
1937 }
1938 // Project ID
1939 if (!empty($arrayfields['p.rowid']['checked'])) {
1940 print '<td class="nowraponall">';
1941 print $object->id;
1942 print '</td>';
1943 if (!$i) {
1944 $totalarray['nbfield']++;
1945 }
1946 }
1947 // Project ref url
1948 if (!empty($arrayfields['p.ref']['checked'])) {
1949 print '<td class="nowraponall tdoverflowmax200">';
1950 print $object->getNomUrl(1, (!empty(GETPOSTINT('search_usage_event_organization')) ? 'eventorganization' : ''));
1951 if ($object->hasDelay()) {
1952 print img_warning($langs->trans('Late'));
1953 }
1954 print '</td>';
1955 if (!$i) {
1956 $totalarray['nbfield']++;
1957 }
1958 }
1959 // Title
1960 if (!empty($arrayfields['p.title']['checked'])) {
1961 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">';
1962 print dol_escape_htmltag($obj->title);
1963 print '</td>';
1964 if (!$i) {
1965 $totalarray['nbfield']++;
1966 }
1967 }
1968 // Company
1969 if (!empty($arrayfields['s.nom']['checked'])) {
1970 print '<td class="tdoverflowmax125">';
1971 if ($obj->socid) {
1972 print $companystatic->getNomUrl(1, '', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1973 } else {
1974 print '&nbsp;';
1975 }
1976 print '</td>';
1977 if (!$i) {
1978 $totalarray['nbfield']++;
1979 }
1980 }
1981 // Alias
1982 if (!empty($arrayfields['s.name_alias']['checked'])) {
1983 print '<td class="tdoverflowmax100">';
1984 if ($obj->socid) {
1985 print $companystatic->name_alias;
1986 } else {
1987 print '&nbsp;';
1988 }
1989 print '</td>';
1990 if (!$i) {
1991 $totalarray['nbfield']++;
1992 }
1993 }
1994 // Country code
1995 if (!empty($arrayfields['co.country_code']['checked'])) {
1996 print '<td class="tdoverflowmax125 center">';
1997 print $obj->country_code;
1998 print '</td>';
1999 if (!$i) {
2000 $totalarray['nbfield']++;
2001 }
2002 }
2003 // Sales Representatives
2004 if (!empty($arrayfields['commercial']['checked'])) {
2005 print '<td class="tdoverflowmax150">';
2006 if ($obj->socid) {
2007 $companystatic->id = $obj->socid;
2008 $companystatic->name = $obj->name;
2009 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2010 $nbofsalesrepresentative = count($listsalesrepresentatives);
2011 if ($nbofsalesrepresentative > 6) {
2012 // We print only number
2013 print $nbofsalesrepresentative;
2014 } elseif ($nbofsalesrepresentative > 0) {
2015 $userstatic = new User($db);
2016 $j = 0;
2017 foreach ($listsalesrepresentatives as $val) {
2018 $userstatic->id = $val['id'];
2019 $userstatic->lastname = $val['lastname'];
2020 $userstatic->firstname = $val['firstname'];
2021 $userstatic->email = $val['email'];
2022 $userstatic->status = $val['statut'];
2023 $userstatic->entity = $val['entity'];
2024 $userstatic->photo = $val['photo'];
2025 $userstatic->login = $val['login'];
2026 $userstatic->office_phone = $val['office_phone'];
2027 $userstatic->office_fax = $val['office_fax'];
2028 $userstatic->user_mobile = $val['user_mobile'];
2029 $userstatic->job = $val['job'];
2030 $userstatic->gender = $val['gender'];
2031 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2032 $j++;
2033 if ($j < $nbofsalesrepresentative) {
2034 print ' ';
2035 }
2036 }
2037 }
2038 //else print $langs->trans("NoSalesRepresentativeAffected");
2039 } else {
2040 print '&nbsp;';
2041 }
2042 print '</td>';
2043 if (!$i) {
2044 $totalarray['nbfield']++;
2045 }
2046 }
2047
2048 // Date start project
2049 if (!empty($arrayfields['p.dateo']['checked'])) {
2050 print '<td class="center">';
2051 print dol_print_date($db->jdate($obj->date_start), 'day');
2052 print '</td>';
2053 if (!$i) {
2054 $totalarray['nbfield']++;
2055 }
2056 }
2057 // Date end project
2058 if (!empty($arrayfields['p.datee']['checked'])) {
2059 print '<td class="center">';
2060 print dol_print_date($db->jdate($obj->date_end), 'day');
2061 print '</td>';
2062 if (!$i) {
2063 $totalarray['nbfield']++;
2064 }
2065 }
2066
2067 // Visibility
2068 if (!empty($arrayfields['p.public']['checked'])) {
2069 print '<td class="center">';
2070 if ($obj->public) {
2071 print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
2072 //print $langs->trans('SharedProject');
2073 } else {
2074 print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
2075 //print $langs->trans('PrivateProject');
2076 }
2077 print '</td>';
2078 if (!$i) {
2079 $totalarray['nbfield']++;
2080 }
2081 }
2082 // Assigned contacts of project
2083 if (!empty($arrayfields['c.assigned']['checked'])) {
2084 print '<td class="center nowraponall tdoverflowmax200">';
2085 print $stringassignedusers;
2086 print '</td>';
2087 if (!$i) {
2088 $totalarray['nbfield']++;
2089 }
2090 }
2091 // Opp Status
2092 if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
2093 $s = '';
2094 if ($obj->opp_status_code) {
2095 $s = $langs->trans("OppStatus".$obj->opp_status_code);
2096 if (empty($arrayfields['p.opp_percent']['checked']) && $obj->opp_percent) {
2097 $s .= ' ('.dol_escape_htmltag(price2num($obj->opp_percent, 1)).'%)';
2098 }
2099 }
2100 print '<td class="center tdoverflowmax150" title="'.$s.'">';
2101 print $s;
2102 print '</td>';
2103 if (!$i) {
2104 $totalarray['nbfield']++;
2105 }
2106 }
2107 // Opp Amount
2108 if (!empty($arrayfields['p.opp_amount']['checked'])) {
2109 print '<td class="right">';
2110 //if ($obj->opp_status_code)
2111 if (isset($obj->opp_amount) && strcmp($obj->opp_amount, '')) {
2112 print '<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').'</span>';
2113 if (!isset($totalarray['val']['p.opp_amount'])) {
2114 $totalarray['val']['p.opp_amount'] = $obj->opp_amount;
2115 } else {
2116 $totalarray['val']['p.opp_amount'] += $obj->opp_amount;
2117 }
2118 }
2119 print '</td>';
2120 if (!$i) {
2121 $totalarray['nbfield']++;
2122 }
2123 if (!$i) {
2124 $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount';
2125 }
2126 }
2127 // Opp percent
2128 if (!empty($arrayfields['p.opp_percent']['checked'])) {
2129 print '<td class="right">';
2130 if ($obj->opp_percent) {
2131 print price($obj->opp_percent, 1, $langs, 1, 0).'%';
2132 }
2133 print '</td>';
2134 if (!$i) {
2135 $totalarray['nbfield']++;
2136 }
2137 }
2138 // Opp weighted amount
2139 if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
2140 if (!isset($totalarray['val']['opp_weighted_amount'])) {
2141 $totalarray['val']['opp_weighted_amount'] = 0;
2142 }
2143 print '<td align="right">';
2144 if ($obj->opp_weighted_amount) {
2145 print '<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').'</span>';
2146 $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
2147 }
2148 print '</td>';
2149 if (!$i) {
2150 $totalarray['nbfield']++;
2151 $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
2152 }
2153 }
2154 // Budget
2155 if (!empty($arrayfields['p.budget_amount']['checked'])) {
2156 print '<td class="right">';
2157 if ($obj->budget_amount != '') {
2158 print '<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).'</span>';
2159 if (!isset($totalarray['val']['p.budget_amount'])) {
2160 $totalarray['val']['p.budget_amount'] = $obj->budget_amount;
2161 } else {
2162 $totalarray['val']['p.budget_amount'] += $obj->budget_amount;
2163 }
2164 }
2165 print '</td>';
2166 if (!$i) {
2167 $totalarray['nbfield']++;
2168 $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount';
2169 }
2170 }
2171 // Usage opportunity
2172 if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
2173 print '<td class="center">';
2174 if ($obj->usage_opportunity) {
2175 print yn($obj->usage_opportunity, 4);
2176 }
2177 print '</td>';
2178 if (!$i) {
2179 $totalarray['nbfield']++;
2180 }
2181 }
2182 // Usage task
2183 if (!empty($arrayfields['p.usage_task']['checked'])) {
2184 print '<td class="center">';
2185 if ($obj->usage_task) {
2186 print yn($obj->usage_task, 4);
2187 }
2188 print '</td>';
2189 if (!$i) {
2190 $totalarray['nbfield']++;
2191 }
2192 }
2193 // Usage bill time
2194 if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
2195 print '<td class="center">';
2196 if ($obj->usage_bill_time) {
2197 print yn($obj->usage_bill_time, 4);
2198 }
2199 print '</td>';
2200 if (!$i) {
2201 $totalarray['nbfield']++;
2202 }
2203 }
2204 // Usage event organization
2205 if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
2206 print '<td class="center">';
2207 if ($obj->usage_organize_event) {
2208 print yn($obj->usage_organize_event, 4);
2209 }
2210 print '</td>';
2211 if (!$i) {
2212 $totalarray['nbfield']++;
2213 }
2214 }
2215 // Allow unknown people to suggest conferences
2216 if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
2217 print '<td class="center">';
2218 if ($obj->accept_conference_suggestions) {
2219 print yn($obj->accept_conference_suggestions);
2220 }
2221 print '</td>';
2222 if (!$i) {
2223 $totalarray['nbfield']++;
2224 }
2225 }
2226 // Allow unknown people to suggest booth
2227 if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
2228 print '<td class="">';
2229 if ($obj->accept_booth_suggestions) {
2230 print yn($obj->accept_booth_suggestions);
2231 }
2232 print '</td>';
2233 if (!$i) {
2234 $totalarray['nbfield']++;
2235 }
2236 }
2237 // Price of registration
2238 if (!empty($arrayfields['p.price_registration']['checked'])) {
2239 print '<td class="right">';
2240 if ($obj->price_registration != '') {
2241 print '<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).'</span>';
2242 $totalarray['val']['p.price_registration'] += $obj->price_registration;
2243 }
2244 print '</td>';
2245 if (!$i) {
2246 $totalarray['nbfield']++;
2247 }
2248 if (!$i) {
2249 $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration';
2250 }
2251 }
2252 // Price of booth
2253 if (!empty($arrayfields['p.price_booth']['checked'])) {
2254 print '<td class="right">';
2255 if ($obj->price_booth != '') {
2256 print '<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).'</span>';
2257 $totalarray['val']['p.price_booth'] += $obj->price_booth;
2258 }
2259 print '</td>';
2260 if (!$i) {
2261 $totalarray['nbfield']++;
2262 }
2263 if (!$i) {
2264 $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth';
2265 }
2266 }
2267 // Author
2268 if (!empty($arrayfields['u.login']['checked'])) {
2269 print '<td class="center tdoverflowmax150">';
2270 if ($userstatic->id) {
2271 print $userstatic->getNomUrl(-1);
2272 }
2273 print "</td>\n";
2274 if (!$i) {
2275 $totalarray['nbfield']++;
2276 }
2277 }
2278 // Extra fields
2279 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2280 // Fields from hook
2281 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2282 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2283 print $hookmanager->resPrint;
2284 // Date creation
2285 if (!empty($arrayfields['p.datec']['checked'])) {
2286 print '<td class="center nowraponall">';
2287 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2288 print '</td>';
2289 if (!$i) {
2290 $totalarray['nbfield']++;
2291 }
2292 }
2293 // Date modification
2294 if (!empty($arrayfields['p.tms']['checked'])) {
2295 print '<td class="center nowraponall">';
2296 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2297 print '</td>';
2298 if (!$i) {
2299 $totalarray['nbfield']++;
2300 }
2301 }
2302 // Email MsgID
2303 if (!empty($arrayfields['p.email_msgid']['checked'])) {
2304 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->email_msgid).'">';
2305 print dol_escape_htmltag($obj->email_msgid);
2306 print '</td>';
2307 if (!$i) {
2308 $totalarray['nbfield']++;
2309 }
2310 }
2311 // Import key
2312 if (!empty($arrayfields['p.import_key']['checked'])) {
2313 print '<td class="right">'.dol_escape_htmltag($obj->import_key).'</td>';
2314 if (!$i) {
2315 $totalarray['nbfield']++;
2316 }
2317 }
2318 // Status
2319 if (!empty($arrayfields['p.fk_statut']['checked'])) {
2320 print '<td class="center">'.$object->getLibStatut(5).'</td>';
2321 if (!$i) {
2322 $totalarray['nbfield']++;
2323 }
2324 }
2325 // Action column
2326 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2327 print '<td class="nowrap center">';
2328 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
2329 $selected = 0;
2330 if (in_array($object->id, $arrayofselected)) {
2331 $selected = 1;
2332 }
2333 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
2334 }
2335 print '</td>';
2336 if (!$i) {
2337 $totalarray['nbfield']++;
2338 }
2339 }
2340
2341 print '</tr>'."\n";
2342 }
2343
2344 $i++;
2345}
2346
2347// Show total line
2348include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2349
2350// If no record found
2351if ($num == 0) {
2352 $colspan = 1;
2353 foreach ($arrayfields as $key => $val) {
2354 if (!empty($val['checked'])) {
2355 $colspan++;
2356 }
2357 }
2358 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
2359}
2360
2361$db->free($resql);
2362
2363$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2364$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2365print $hookmanager->resPrint;
2366
2367print '</table>'."\n";
2368print '</div>'."\n";
2369
2370print '</form>'."\n";
2371
2372if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
2373 $hidegeneratedfilelistifempty = 1;
2374 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
2375 $hidegeneratedfilelistifempty = 0;
2376 }
2377
2378 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
2379 $formfile = new FormFile($db);
2380
2381 // Show list of available documents
2382 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
2383 $urlsource .= str_replace('&amp;', '&', $param);
2384
2385 $filedir = $diroutputmassaction;
2386 $genallowed = $permissiontoread;
2387 $delallowed = $permissiontoadd;
2388
2389 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
2390}
2391
2392// End of page
2393llxFooter();
2394$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
$totalarray
Definition export.php:1206
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
$c
Definition line.php:331
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 offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class 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:382
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.