32 require
'../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38 if (!empty($conf->categorie->enabled)) {
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44 $langs->loadLangs(array(
'projects',
'companies',
'commercial'));
45 if (!empty($conf->eventorganization->enabled) && $conf->eventorganization->enabled) {
46 $langs->loadLangs(array(
'eventorganization'));
49 $action =
GETPOST(
'action',
'aZ09');
50 $massaction =
GETPOST(
'massaction',
'alpha');
51 $show_files =
GETPOST(
'show_files',
'int');
52 $confirm =
GETPOST(
'confirm',
'alpha');
53 $toselect =
GETPOST(
'toselect',
'array');
54 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'projectlist';
56 $title = $langs->trans(
"Projects");
59 $socid =
GETPOST(
'socid',
'int');
64 $title .=
' (<a href="list.php">'.$soc->name.
'</a>)';
66 if (!$user->rights->projet->lire) {
70 $diroutputmassaction = $conf->project->dir_output.
'/temp/massgeneration/'.$user->id;
72 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
73 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
74 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
76 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
86 $offset = $limit * $page;
87 $pageprev = $page - 1;
88 $pagenext = $page + 1;
90 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
91 $search_ref =
GETPOST(
"search_ref",
'alpha');
92 $search_label =
GETPOST(
"search_label",
'alpha');
93 $search_societe =
GETPOST(
"search_societe",
'alpha');
94 $search_status =
GETPOST(
"search_status",
'int');
95 $search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
96 $search_opp_percent =
GETPOST(
"search_opp_percent",
'alpha');
97 $search_opp_amount =
GETPOST(
"search_opp_amount",
'alpha');
98 $search_budget_amount =
GETPOST(
"search_budget_amount",
'alpha');
99 $search_public =
GETPOST(
"search_public",
'int');
100 $search_project_user =
GETPOST(
'search_project_user',
'int');
101 $search_project_contact =
GETPOST(
'search_project_contact',
'int');
102 $search_sale =
GETPOST(
'search_sale',
'int');
103 $search_usage_opportunity =
GETPOST(
'search_usage_opportunity',
'int');
104 $search_usage_task =
GETPOST(
'search_usage_task',
'int');
105 $search_usage_bill_time =
GETPOST(
'search_usage_bill_time',
'int');
106 $search_usage_event_organization =
GETPOST(
'search_usage_event_organization',
'int');
107 $search_accept_conference_suggestions =
GETPOST(
'search_accept_conference_suggestions',
'int');
108 $search_accept_booth_suggestions =
GETPOST(
'search_accept_booth_suggestions',
'int');
109 $search_price_registration =
GETPOST(
"search_price_registration",
'alpha');
110 $search_price_booth =
GETPOST(
"search_price_booth",
'alpha');
111 $optioncss =
GETPOST(
'optioncss',
'alpha');
113 $mine = ((
GETPOST(
'mode') ==
'mine') ? 1 : 0);
115 $search_project_user = $user->id; $mine = 0;
118 $search_sday =
GETPOST(
'search_sday',
'int');
119 $search_smonth =
GETPOST(
'search_smonth',
'int');
120 $search_syear =
GETPOST(
'search_syear',
'int');
121 $search_eday =
GETPOST(
'search_eday',
'int');
122 $search_emonth =
GETPOST(
'search_emonth',
'int');
123 $search_eyear =
GETPOST(
'search_eyear',
'int');
126 $search_date_start_startmonth =
GETPOST(
'search_date_start_startmonth',
'int');
127 $search_date_start_startyear =
GETPOST(
'search_date_start_startyear',
'int');
128 $search_date_start_startday =
GETPOST(
'search_date_start_startday',
'int');
129 $search_date_start_start =
dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear);
130 $search_date_start_endmonth =
GETPOST(
'search_date_start_endmonth',
'int');
131 $search_date_start_endyear =
GETPOST(
'search_date_start_endyear',
'int');
132 $search_date_start_endday =
GETPOST(
'search_date_start_endday',
'int');
133 $search_date_start_end =
dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear);
135 $search_date_end_startmonth =
GETPOST(
'search_date_end_startmonth',
'int');
136 $search_date_end_startyear =
GETPOST(
'search_date_end_startyear',
'int');
137 $search_date_end_startday =
GETPOST(
'search_date_end_startday',
'int');
138 $search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
139 $search_date_end_endmonth =
GETPOST(
'search_date_end_endmonth',
'int');
140 $search_date_end_endyear =
GETPOST(
'search_date_end_endyear',
'int');
141 $search_date_end_endday =
GETPOST(
'search_date_end_endday',
'int');
142 $search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
145 if ($search_status ==
'') {
149 if (!empty($conf->categorie->enabled)) {
150 $search_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PROJECT.
"_list",
"array");
155 $hookmanager->initHooks(array(
'projectlist'));
159 $extrafields->fetch_name_optionals_label($object->table_element);
161 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
164 $fieldstosearchall = array();
165 foreach ($object->fields as $key => $val) {
166 if (empty($val[
'searchall'])) {
171 if (!empty($user->socid) && $key ==
"note_private") {
175 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
179 $fieldstosearchall[
's.nom'] =
"ThirdPartyName";
182 $arrayfields = array();
183 foreach ($object->fields as $key => $val) {
185 if (!empty($val[
'visible'])) {
186 $visible =
dol_eval($val[
'visible'], 1, 1,
'1');
187 $arrayfields[
'p.'.$key] = array(
188 'label'=>$val[
'label'],
189 'checked'=>(($visible < 0) ? 0 : 1),
190 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
191 'position'=>$val[
'position'],
192 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
197 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
200 $arrayfields[
's.nom'] = array(
'label'=>$langs->trans(
"ThirdParty"),
'checked'=>1,
'position'=>21,
'enabled'=>(empty($conf->societe->enabled) ? 0 : 1));
201 $arrayfields[
'commercial'] = array(
'label'=>$langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked'=>0,
'position'=>23);
202 $arrayfields[
'c.assigned'] = array(
'label'=>$langs->trans(
"AssignedTo"),
'checked'=>-1,
'position'=>120);
203 $arrayfields[
'opp_weighted_amount'] = array(
'label'=>$langs->trans(
'OpportunityWeightedAmountShort'),
'checked'=>0,
'position'=> 116,
'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1),
'position'=>106);
205 if (
GETPOST(
'search_usage_opportunity')) {
209 if (
GETPOST(
'search_usage_event_organization')) {
210 $arrayfields[
'p.fk_opp_status'][
'enabled'] = 0;
211 $arrayfields[
'p.opp_amount'][
'enabled'] = 0;
212 $arrayfields[
'p.opp_percent'][
'enabled'] = 0;
213 $arrayfields[
'opp_weighted_amount'][
'enabled'] = 0;
214 $arrayfields[
'p.usage_organize_event'][
'visible'] = 1;
215 $arrayfields[
'p.usage_organize_event'][
'checked'] = 1;
226 if (
GETPOST(
'cancel',
'alpha')) {
230 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
234 $parameters = array(
'socid'=>$socid);
235 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
240 if (empty($reshook)) {
242 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
245 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
249 $search_societe =
"";
251 $search_opp_status = -1;
252 $search_opp_amount =
'';
253 $search_opp_percent =
'';
254 $search_budget_amount =
'';
257 $search_project_user =
'';
258 $search_project_contact =
'';
265 $search_date_start_startmonth =
"";
266 $search_date_start_startyear =
"";
267 $search_date_start_startday =
"";
268 $search_date_start_start =
"";
269 $search_date_start_endmonth =
"";
270 $search_date_start_endyear =
"";
271 $search_date_start_endday =
"";
272 $search_date_start_end =
"";
273 $search_date_end_startmonth =
"";
274 $search_date_end_startyear =
"";
275 $search_date_end_startday =
"";
276 $search_date_end_start =
"";
277 $search_date_end_endmonth =
"";
278 $search_date_end_endyear =
"";
279 $search_date_end_endday =
"";
280 $search_date_end_end =
"";
281 $search_usage_opportunity =
'';
282 $search_usage_task =
'';
283 $search_usage_bill_time =
'';
284 $search_usage_event_organization =
'';
285 $search_accept_conference_suggestions =
'';
286 $search_accept_booth_suggestions =
'';
287 $search_price_registration =
'';
288 $search_price_booth =
'';
290 $search_array_options = array();
291 $search_category_array = array();
296 $objectclass =
'Project';
297 $objectlabel =
'Project';
298 $permissiontoread = $user->rights->projet->lire;
299 $permissiontodelete = $user->rights->projet->supprimer;
300 $permissiontoadd = $user->rights->projet->creer;
301 $uploaddir = $conf->project->dir_output;
302 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
305 if (!$error && $massaction ==
'close' && $user->rights->projet->creer) {
308 $objecttmp =
new $objectclass($db);
310 foreach ($toselect as $toselectid) {
311 $result = $objecttmp->fetch($toselectid);
313 $userWrite = $object->restrictedProjectArea($user,
'write');
314 if ($userWrite > 0 && $objecttmp->statut == 1) {
315 $result = $objecttmp->setClose($user);
323 } elseif ($userWrite <= 0) {
324 setEventMessages($langs->trans(
"DontHavePermissionForCloseProject", $objecttmp->ref),
null,
'warnings');
326 setEventMessages($langs->trans(
"DontHaveTheValidateStatus", $objecttmp->ref),
null,
'warnings');
355 $companystatic =
new Societe($db);
359 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
360 $title = $langs->trans(
"LeadsOrProjects");
361 if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
362 $title = $langs->trans(
"Projects");
364 if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) {
365 $title = $langs->trans(
"Leads");
372 $projectsListId =
'';
373 if (empty($user->rights->projet->all->lire)) {
374 $projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
378 $listofprojectcontacttype = array();
379 $listofprojectcontacttypeexternal = array();
380 $sql =
"SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
381 $sql .=
" WHERE ctc.element = '".$db->escape($object->element).
"'";
382 $resql = $db->query($sql);
384 while ($obj = $db->fetch_object(
$resql)) {
385 if ($obj->source ==
'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code;
386 else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
391 if (count($listofprojectcontacttype) == 0) {
392 $listofprojectcontacttype[0] =
'0';
394 if (count($listofprojectcontacttypeexternal) == 0) {
395 $listofprojectcontacttypeexternal[0] =
'0';
398 $distinct =
'DISTINCT';
399 $sql =
"SELECT ".$distinct.
" p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
400 $sql .=
" p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,";
401 $sql .=
" p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
402 $sql .=
" p.email_msgid,";
403 $sql .=
" accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth,";
404 $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,";
405 $sql .=
" country.code as country_code,";
406 $sql .=
" cls.code as opp_status_code";
408 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
409 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
410 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
414 $parameters = array();
415 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
416 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
417 $sql = preg_replace(
'/,\s*$/',
'', $sql);
418 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as p";
419 if (!empty($conf->categorie->enabled)) {
422 if (!empty($extrafields->attributes[$object->table_element][
'label']) &&is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
423 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
425 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
426 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
427 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_lead_status as cls on p.fk_opp_status = cls.rowid";
431 if ($search_sale > 0) {
432 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
434 if ($search_project_user > 0) {
435 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
437 if ($search_project_contact > 0) {
438 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp_contact";
440 $sql .=
" WHERE p.entity IN (".getEntity(
'project').
')';
441 if (!empty($conf->categorie->enabled)) {
444 if (empty($user->rights->projet->all->lire)) {
445 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
449 $sql .=
" AND (p.fk_soc = ".((int) $socid).
")";
457 if ($search_societe) {
460 if ($search_opp_amount) {
463 if ($search_opp_percent) {
466 $sql .=
dolSqlDateFilter(
'p.dateo', $search_sday, $search_smonth, $search_syear);
467 $sql .=
dolSqlDateFilter(
'p.datee', $search_eday, $search_emonth, $search_eyear);
470 if ($search_date_start_start) {
471 $sql .=
" AND p.dateo >= '".$db->idate($search_date_start_start).
"'";
473 if ($search_date_start_end) {
474 $sql .=
" AND p.dateo <= '".$db->idate($search_date_start_end).
"'";
477 if ($search_date_end_start) {
478 $sql .=
" AND p.datee >= '".$db->idate($search_date_end_start).
"'";
480 if ($search_date_end_end) {
481 $sql .=
" AND p.datee <= '".$db->idate($search_date_end_end).
"'";
485 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
487 if ($search_status >= 0) {
488 if ($search_status == 99) {
489 $sql .=
" AND p.fk_statut <> 2";
491 $sql .=
" AND p.fk_statut = ".((int) $search_status);
494 if ($search_opp_status) {
495 if (is_numeric($search_opp_status) && $search_opp_status > 0) {
496 $sql .=
" AND p.fk_opp_status = ".((int) $search_opp_status);
498 if ($search_opp_status ==
'all') {
499 $sql .=
" AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
501 if ($search_opp_status ==
'openedopp') {
502 $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'))";
504 if ($search_opp_status ==
'notopenedopp') {
505 $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'))";
507 if ($search_opp_status ==
'none') {
508 $sql .=
" AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
511 if ($search_public !=
'') {
512 $sql .=
" AND p.public = ".((int) $search_public);
516 if ($search_sale > 0) {
517 $sql .=
" AND sc.fk_user = ".((int) $search_sale);
521 if ($search_project_user > 0) {
522 $sql .=
" AND ecp.fk_c_type_contact IN (".$db->sanitize(join(
',', array_keys($listofprojectcontacttype))).
") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
524 if ($search_project_contact > 0) {
525 $sql .=
" AND ecp_contact.fk_c_type_contact IN (".$db->sanitize(join(
',', array_keys($listofprojectcontacttypeexternal))).
") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact);
527 if ($search_opp_amount !=
'') {
530 if ($search_budget_amount !=
'') {
531 $sql .=
natural_search(
'p.budget_amount', $search_budget_amount, 1);
533 if ($search_usage_opportunity !=
'' && $search_usage_opportunity >= 0) {
534 $sql .=
natural_search(
'p.usage_opportunity', $search_usage_opportunity, 2);
536 if ($search_usage_task !=
'' && $search_usage_task >= 0) {
539 if ($search_usage_bill_time !=
'' && $search_usage_bill_time >= 0) {
540 $sql .=
natural_search(
'p.usage_bill_time', $search_usage_bill_time, 2);
542 if ($search_usage_event_organization !=
'' && $search_usage_event_organization >= 0) {
543 $sql .=
natural_search(
'p.usage_organize_event', $search_usage_event_organization, 2);
545 if ($search_accept_conference_suggestions !=
'' && $search_accept_conference_suggestions >= 0) {
546 $sql .=
natural_search(
'p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
548 if ($search_accept_booth_suggestions !=
'' && $search_accept_booth_suggestions >= 0) {
549 $sql .=
natural_search(
'p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
551 if ($search_price_registration !=
'') {
552 $sql .=
natural_search(
'p.price_registration', $search_price_registration, 1);
554 if ($search_price_booth !=
'') {
558 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
560 $parameters = array();
561 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
562 $sql .= $hookmanager->resPrint;
563 $sql .= $db->order($sortfield, $sortorder);
566 $nbtotalofrecords =
'';
567 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
568 $resql = $db->query($sql);
569 $nbtotalofrecords = $db->num_rows(
$resql);
570 if (($page * $limit) > $nbtotalofrecords) {
576 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
577 $num = $nbtotalofrecords;
579 if (!empty($limit)) {
580 $sql .= $db->plimit($limit + 1, $offset);
583 $resql = $db->query($sql);
589 $num = $db->num_rows(
$resql);
593 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
594 $obj = $db->fetch_object(
$resql);
595 header(
"Location: ".DOL_URL_ROOT.
'/projet/card.php?id='.$obj->id);
603 dol_syslog(
"list allowed project", LOG_DEBUG);
607 $arrayofselected = is_array($toselect) ? $toselect : array();
610 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
611 $param .=
'&contextpage='.urlencode($contextpage);
613 if ($limit > 0 && $limit != $conf->liste_limit) {
614 $param .=
'&limit='.urlencode($limit);
616 if ($search_all !=
'') {
617 $param .=
'&search_all='.urlencode($search_all);
620 $param .=
'&search_sday='.urlencode($search_sday);
622 if ($search_smonth) {
623 $param .=
'&search_smonth='.urlencode($search_smonth);
626 $param .=
'&search_syear='.urlencode($search_syear);
629 $param .=
'&search_eday='.urlencode($search_eday);
631 if ($search_emonth) {
632 $param .=
'&search_emonth='.urlencode($search_emonth);
635 $param .=
'&search_eyear='.urlencode($search_eyear);
637 if ($search_date_start_startmonth) {
638 $param .=
'&search_date_start_startmonth='.urlencode($search_date_start_startmonth);
640 if ($search_date_start_startyear) {
641 $param .=
'&search_date_start_startyear='.urlencode($search_date_start_startyear);
643 if ($search_date_start_startday) {
644 $param .=
'&search_date_start_startday='.urlencode($search_date_start_startday);
646 if ($search_date_start_start) {
647 $param .=
'&search_date_start_start='.urlencode($search_date_start_start);
649 if ($search_date_start_endmonth) {
650 $param .=
'&search_date_start_endmonth='.urlencode($search_date_start_endmonth);
652 if ($search_date_start_endyear) {
653 $param .=
'&search_date_start_endyear='.urlencode($search_date_start_endyear);
655 if ($search_date_start_endday) {
656 $param .=
'&search_date_start_endday='.urlencode($search_date_start_endday);
658 if ($search_date_start_end) {
659 $param .=
'&search_date_start_end='.urlencode($search_date_start_end);
661 if ($search_date_end_startmonth) {
662 $param .=
'&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
664 if ($search_date_end_startyear) {
665 $param .=
'&search_date_end_startyear='.urlencode($search_date_end_startyear);
667 if ($search_date_end_startday) {
668 $param .=
'&search_date_end_startday='.urlencode($search_date_end_startday);
670 if ($search_date_end_start) {
671 $param .=
'&search_date_end_start='.urlencode($search_date_end_start);
673 if ($search_date_end_endmonth) {
674 $param .=
'&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
676 if ($search_date_end_endyear) {
677 $param .=
'&search_date_end_endyear='.urlencode($search_date_end_endyear);
679 if ($search_date_end_endday) {
680 $param .=
'&search_date_end_endday='.urlencode($search_date_end_endday);
682 if ($search_date_end_end) {
683 $param .=
'&search_date_end_end=' . urlencode($search_date_end_end);
686 $param .=
'&socid='.urlencode($socid);
688 if (!empty($search_categ)) {
689 $param .=
'&search_categ='.urlencode($search_categ);
691 if ($search_ref !=
'') {
692 $param .=
'&search_ref='.urlencode($search_ref);
694 if ($search_label !=
'') {
695 $param .=
'&search_label='.urlencode($search_label);
697 if ($search_societe !=
'') {
698 $param .=
'&search_societe='.urlencode($search_societe);
700 if ($search_status >= 0) {
701 $param .=
'&search_status='.urlencode($search_status);
703 if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'openedopp',
'notopenedopp',
'none'))) {
704 $param .=
'&search_opp_status='.urlencode($search_opp_status);
706 if ($search_opp_percent !=
'') {
707 $param .=
'&search_opp_percent='.urlencode($search_opp_percent);
709 if ($search_public !=
'') {
710 $param .=
'&search_public='.urlencode($search_public);
712 if ($search_project_user > 0) {
713 $param .=
'&search_project_user='.urlencode($search_project_user);
715 if ($search_project_contact !=
'') {
716 $param .=
'&search_project_user='.urlencode($search_project_contact);
718 if ($search_sale > 0) {
719 $param .=
'&search_sale='.urlencode($search_sale);
721 if ($search_opp_amount !=
'') {
722 $param .=
'&search_opp_amount='.urlencode($search_opp_amount);
724 if ($search_budget_amount !=
'') {
725 $param .=
'&search_budget_amount='.urlencode($search_budget_amount);
727 if ($search_usage_task !=
'') {
728 $param .=
'&search_usage_task='.urlencode($search_usage_task);
730 if ($search_usage_bill_time !=
'') {
731 $param .=
'&search_usage_opportunity='.urlencode($search_usage_bill_time);
733 if ($search_usage_event_organization !=
'') {
734 $param .=
'&search_usage_event_organization='.urlencode($search_usage_event_organization);
736 if ($search_accept_conference_suggestions !=
'') {
737 $param .=
'&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
739 if ($search_accept_booth_suggestions !=
'') {
740 $param .=
'&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
742 if ($search_price_registration !=
'') {
743 $param .=
'&search_price_registration='.urlencode($search_price_registration);
745 if ($search_price_booth !=
'') {
746 $param .=
'&search_price_booth='.urlencode($search_price_booth);
748 if ($optioncss !=
'') {
749 $param .=
'&optioncss='.urlencode($optioncss);
752 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
755 $arrayofmassactions = array(
756 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
761 if ($user->rights->projet->creer) {
762 $arrayofmassactions[
'close'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Close");
764 if ($user->rights->projet->supprimer) {
765 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
767 if (
isModEnabled(
'category') && $user->rights->projet->creer) {
768 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
770 if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
771 $arrayofmassactions = array();
774 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
776 $url = DOL_URL_ROOT.
'/projet/card.php?action=create';
777 if (!empty($socid)) {
778 $url .=
'&socid='.$socid;
780 if ($search_usage_event_organization == 1) {
781 $url .=
'&usage_organize_event=1';
783 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewProject'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->projet->creer);
785 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
786 if ($optioncss !=
'') {
787 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
789 print
'<input type="hidden" name="token" value="'.newToken().
'">';
790 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
791 print
'<input type="hidden" name="action" value="list">';
792 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
793 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
794 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
798 if ($search_project_user == $user->id) {
799 $texthelp .= $langs->trans(
"MyProjectsDesc");
801 if ($user->rights->projet->all->lire && !$socid) {
802 $texthelp .= $langs->trans(
"ProjectsDesc");
804 $texthelp .= $langs->trans(
"ProjectsPublicDesc");
808 print_barre_liste(
$form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit, 0, 0, 1);
811 $topicmail =
"Information";
812 $modelmail =
"project";
814 $trackid =
'proj'.$object->id;
815 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
818 foreach ($fieldstosearchall as $key => $val) {
819 $fieldstosearchall[$key] = $langs->trans($val);
821 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
827 $moreforfilter .=
'<div class="divsearchfield">';
828 $tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
831 if (empty($user->rights->user->user->lire)) {
832 $includeonly = array($user->id);
834 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
835 $moreforfilter .=
'</div>';
837 $moreforfilter .=
'<div class="divsearchfield">';
838 $tmptitle = $langs->trans(
'ProjectsWithThisContact');
839 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact :
'',
'search_project_contact', $tmptitle,
'',
'', 0,
'maxwidth250 widthcentpercentminusx');
840 $moreforfilter .=
'</div>';
843 if ($user->rights->user->user->lire) {
844 $langs->load(
"commercial");
845 $moreforfilter .=
'<div class="divsearchfield">';
846 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
847 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
848 $moreforfilter .=
'</div>';
852 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
854 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array);
857 if (!empty($moreforfilter)) {
858 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
859 print $moreforfilter;
860 $parameters = array();
861 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
862 print $hookmanager->resPrint;
866 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
867 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
868 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
871 print
'<div class="div-table-responsive">';
872 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
876 print
'<tr class="liste_titre">';
878 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
879 print
'<td class="liste_titre maxwidthsearch">';
880 $searchpicto =
$form->showFilterButtons(
'left');
885 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
886 print
'<td class="liste_titre">';
887 print
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'" size="6">';
891 if (!empty($arrayfields[
'p.title'][
'checked'])) {
892 print
'<td class="liste_titre">';
893 print
'<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).
'">';
897 if (!empty($arrayfields[
's.nom'][
'checked'])) {
898 print
'<td class="liste_titre">';
900 $tmpthirdparty =
new Societe($db);
901 $tmpthirdparty->fetch($socid);
902 $search_societe = $tmpthirdparty->name;
904 print
'<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
908 if (!empty($arrayfields[
'commercial'][
'checked'])) {
909 print
'<td class="liste_titre"> </td>';
912 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
913 print
'<td class="liste_titre center nowraponall">';
919 print
'<div class="nowrap">';
920 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'));
922 print
'<div class="nowrap">';
923 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'));
928 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
929 print
'<td class="liste_titre center nowraponall">';
935 print
'<div class="nowrap">';
936 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'));
938 print
'<div class="nowrap">';
939 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'));
943 if (!empty($arrayfields[
'p.public'][
'checked'])) {
944 print
'<td class="liste_titre center">';
945 $array = array(
''=>
'', 0 => $langs->trans(
"PrivateProject"), 1 => $langs->trans(
"SharedProject"));
946 print
$form->selectarray(
'search_public', $array, $search_public);
949 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
950 print
'<td class="liste_titre center">';
954 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
955 print
'<td class="liste_titre nowrap center">';
956 print $formproject->selectOpportunityStatus(
'search_opp_status', $search_opp_status, 1, 0, 1, 0,
'maxwidth100 nowrapoption', 1, 0);
959 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
960 print
'<td class="liste_titre nowrap right">';
961 print
'<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.
'">';
964 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
965 print
'<td class="liste_titre nowrap right">';
966 print
'<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.
'">';
969 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
970 print
'<td class="liste_titre nowrap right">';
973 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
974 print
'<td class="liste_titre nowrap right">';
975 print
'<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.
'">';
978 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
979 print
'<td class="liste_titre nowrap right">';
980 print
$form->selectyesno(
'search_usage_opportunity', $search_usage_opportunity, 1,
false, 1);
984 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
985 print
'<td class="liste_titre nowrap right">';
986 print
$form->selectyesno(
'search_usage_task', $search_usage_task, 1,
false, 1);
989 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
990 print
'<td class="liste_titre nowrap right">';
991 print
$form->selectyesno(
'search_usage_bill_time', $search_usage_bill_time, 1,
false, 1);
994 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
995 print
'<td class="liste_titre nowrap right">';
996 print
$form->selectyesno(
'search_usage_event_organization', $search_usage_event_organization, 1,
false, 1);
999 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1000 print
'<td class="liste_titre nowrap right">';
1001 print
$form->selectyesno(
'search_accept_conference_suggestions', $search_accept_conference_suggestions, 1,
false, 1);
1004 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1005 print
'<td class="liste_titre nowrap right">';
1006 print
$form->selectyesno(
'search_accept_booth_suggestions', $search_accept_booth_suggestions, 1,
false, 1);
1009 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1010 print
'<td class="liste_titre nowrap right">';
1011 print
'<input type="text" class="flat" name="search_price_registration" size="4" value="'.$search_price_registration.
'">';
1014 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1015 print
'<td class="liste_titre nowrap right">';
1016 print
'<input type="text" class="flat" name="search_price_booth" size="4" value="'.$search_price_booth.
'">';
1020 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1023 $parameters = array(
'arrayfields'=>$arrayfields);
1024 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1025 print $hookmanager->resPrint;
1026 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1028 print
'<td class="liste_titre">';
1031 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1033 print
'<td class="liste_titre">';
1036 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1038 print
'<td class="liste_titre">';
1041 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1042 print
'<td class="liste_titre nowrap right">';
1043 $arrayofstatus = array();
1044 foreach ($object->statuts_short as $key => $val) {
1045 $arrayofstatus[$key] = $langs->trans($val);
1047 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
' + '.$langs->trans(
'Opened').
')';
1048 print
$form->selectarray(
'search_status', $arrayofstatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75imp maxwidth125 selectarrowonleft');
1053 print
'<td class="liste_titre maxwidthsearch">';
1054 $searchpicto =
$form->showFilterButtons();
1060 print
'<tr class="liste_titre">';
1061 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1062 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1064 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1065 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1067 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1068 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1070 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1071 print_liste_field_titre($arrayfields[
'commercial'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder,
'tdoverflowmax100imp ');
1073 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1074 print_liste_field_titre($arrayfields[
'p.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"p.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1076 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1077 print_liste_field_titre($arrayfields[
'p.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1079 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1080 print_liste_field_titre($arrayfields[
'p.public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.public",
"", $param,
"", $sortfield, $sortorder,
'center ');
1082 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1083 print_liste_field_titre($arrayfields[
'c.assigned'][
'label'], $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ',
'');
1085 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1086 print_liste_field_titre($arrayfields[
'p.fk_opp_status'][
'label'], $_SERVER[
"PHP_SELF"],
'p.fk_opp_status',
"", $param,
'', $sortfield, $sortorder,
'center ');
1088 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1089 print_liste_field_titre($arrayfields[
'p.opp_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.opp_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1091 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1092 print_liste_field_titre($arrayfields[
'p.opp_percent'][
'label'], $_SERVER[
'PHP_SELF'],
'p.opp_percent',
"", $param,
'', $sortfield, $sortorder,
'right ');
1094 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1095 print_liste_field_titre($arrayfields[
'opp_weighted_amount'][
'label'], $_SERVER[
'PHP_SELF'],
'opp_weighted_amount',
'', $param,
'', $sortfield, $sortorder,
'right ');
1097 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1098 print_liste_field_titre($arrayfields[
'p.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.budget_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1100 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1101 print_liste_field_titre($arrayfields[
'p.usage_opportunity'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_opportunity',
"", $param,
'', $sortfield, $sortorder,
'right ');
1103 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1104 print_liste_field_titre($arrayfields[
'p.usage_task'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_task',
"", $param,
'', $sortfield, $sortorder,
'right ');
1106 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1107 print_liste_field_titre($arrayfields[
'p.usage_bill_time'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_bill_time',
"", $param,
'', $sortfield, $sortorder,
'right ');
1109 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1110 print_liste_field_titre($arrayfields[
'p.usage_organize_event'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_organize_event',
"", $param,
'', $sortfield, $sortorder,
'right ');
1112 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1113 print_liste_field_titre($arrayfields[
'p.accept_conference_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_conference_suggestions',
"", $param,
'', $sortfield, $sortorder,
'right ');
1115 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1116 print_liste_field_titre($arrayfields[
'p.accept_booth_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_booth_suggestions',
"", $param,
'', $sortfield, $sortorder,
'right ');
1118 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1119 print_liste_field_titre($arrayfields[
'p.price_registration'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_registration',
"", $param,
'', $sortfield, $sortorder,
'right ');
1121 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1122 print_liste_field_titre($arrayfields[
'p.price_booth'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_booth',
"", $param,
'', $sortfield, $sortorder,
'right ');
1125 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1127 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1128 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1129 print $hookmanager->resPrint;
1130 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1131 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1133 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1134 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1136 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1137 print_liste_field_titre($arrayfields[
'p.email_msgid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email_msgid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1139 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1140 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
1142 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1146 $totalarray = array(
1150 $imaxinloop = ($limit ? min($num, $limit) : $num);
1151 while ($i < $imaxinloop) {
1152 $obj = $db->fetch_object(
$resql);
1157 $object->id = $obj->id;
1158 $object->user_author_id = $obj->fk_user_creat;
1159 $object->public = $obj->public;
1160 $object->ref = $obj->ref;
1161 $object->datee = $db->jdate($obj->date_end);
1162 $object->statut = $obj->status;
1163 $object->status = $obj->status;
1164 $object->public = $obj->public;
1165 $object->opp_status = $obj->fk_opp_status;
1166 $object->title = $obj->title;
1168 $userAccess = $object->restrictedProjectArea($user);
1169 if ($userAccess >= 0) {
1170 $companystatic->id = $obj->socid;
1171 $companystatic->name = $obj->name;
1172 $companystatic->name_alias = $obj->alias;
1173 $companystatic->client = $obj->client;
1174 $companystatic->code_client = $obj->code_client;
1175 $companystatic->email = $obj->email;
1176 $companystatic->phone = $obj->phone;
1177 $companystatic->address = $obj->address;
1178 $companystatic->zip = $obj->zip;
1179 $companystatic->town = $obj->town;
1180 $companystatic->country_code = $obj->country_code;
1182 print
'<tr class="oddeven">';
1185 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1186 print
'<td class="nowraponall">';
1187 print $object->getNomUrl(1, (!empty(
GETPOST(
'search_usage_event_organization',
'int'))?
'eventorganization':
''));
1188 if ($object->hasDelay()) {
1193 $totalarray[
'nbfield']++;
1197 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1198 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).
'">';
1202 $totalarray[
'nbfield']++;
1206 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1207 print
'<td class="tdoverflowmax100">';
1209 print $companystatic->getNomUrl(1);
1215 $totalarray[
'nbfield']++;
1219 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1222 $companystatic->id = $obj->socid;
1223 $companystatic->name = $obj->name;
1224 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1225 $nbofsalesrepresentative = count($listsalesrepresentatives);
1226 if ($nbofsalesrepresentative > 6) {
1228 print $nbofsalesrepresentative;
1229 } elseif ($nbofsalesrepresentative > 0) {
1230 $userstatic =
new User($db);
1232 foreach ($listsalesrepresentatives as $val) {
1233 $userstatic->id = $val[
'id'];
1234 $userstatic->lastname = $val[
'lastname'];
1235 $userstatic->firstname = $val[
'firstname'];
1236 $userstatic->email = $val[
'email'];
1237 $userstatic->statut = $val[
'statut'];
1238 $userstatic->entity = $val[
'entity'];
1239 $userstatic->photo = $val[
'photo'];
1240 $userstatic->login = $val[
'login'];
1241 $userstatic->office_phone = $val[
'office_phone'];
1242 $userstatic->office_fax = $val[
'office_fax'];
1243 $userstatic->user_mobile = $val[
'user_mobile'];
1244 $userstatic->job = $val[
'job'];
1245 $userstatic->gender = $val[
'gender'];
1246 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1248 if ($j < $nbofsalesrepresentative) {
1259 $totalarray[
'nbfield']++;
1263 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1264 print
'<td class="center">';
1268 $totalarray[
'nbfield']++;
1272 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1273 print
'<td class="center">';
1277 $totalarray[
'nbfield']++;
1281 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1282 print
'<td class="center">';
1284 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1287 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1292 $totalarray[
'nbfield']++;
1296 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1297 print
'<td class="center">';
1299 foreach (array(
'internal',
'external') as $source) {
1300 $tab = $object->liste_contact(-1, $source);
1301 $numcontact = count($tab);
1302 if (!empty($numcontact)) {
1303 foreach ($tab as $contactproject) {
1305 if ($source ==
'internal') {
1310 $c->fetch($contactproject[
'id']);
1311 if (!empty($c->photo)) {
1312 if (get_class($c) ==
'User') {
1313 print $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
1315 print $c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
1318 if (get_class($c) ==
'User') {
1319 print $c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
1321 print $c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
1331 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1332 print
'<td class="center">';
1333 if ($obj->opp_status_code) {
1334 print $langs->trans(
"OppStatus".$obj->opp_status_code);
1338 $totalarray[
'nbfield']++;
1342 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1343 print
'<td class="right">';
1345 if (strcmp($obj->opp_amount,
'')) {
1346 print
'<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1347 $totalarray[
'val'][
'p.opp_amount'] += $obj->opp_amount;
1351 $totalarray[
'nbfield']++;
1354 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.opp_amount';
1358 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1359 print
'<td class="right">';
1360 if ($obj->opp_percent) {
1361 print
price($obj->opp_percent, 1, $langs, 1, 0).
'%';
1365 $totalarray[
'nbfield']++;
1369 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1370 if (!isset($totalarray[
'val'][
'opp_weighted_amount'])) {
1371 $totalarray[
'val'][
'opp_weighted_amount'] = 0;
1373 print
'<td align="right">';
1374 if ($obj->opp_weighted_amount) {
1375 print
'<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1376 $totalarray[
'val'][
'opp_weighted_amount'] += $obj->opp_weighted_amount;
1380 $totalarray[
'nbfield']++;
1383 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'opp_weighted_amount';
1387 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1388 print
'<td class="right">';
1389 if ($obj->budget_amount !=
'') {
1390 print
'<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).
'</span>';
1391 $totalarray[
'val'][
'p.budget_amount'] += $obj->budget_amount;
1395 $totalarray[
'nbfield']++;
1398 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.budget_amount';
1402 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1403 print
'<td class="right">';
1404 if ($obj->usage_opportunity) {
1405 print
yn($obj->usage_opportunity);
1409 $totalarray[
'nbfield']++;
1413 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1414 print
'<td class="right">';
1415 if ($obj->usage_task) {
1416 print
yn($obj->usage_task);
1420 $totalarray[
'nbfield']++;
1424 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1425 print
'<td class="right">';
1426 if ($obj->usage_bill_time) {
1427 print
yn($obj->usage_bill_time);
1431 $totalarray[
'nbfield']++;
1435 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1436 print
'<td class="right">';
1437 if ($obj->usage_organize_event) {
1438 print
yn($obj->usage_organize_event);
1442 $totalarray[
'nbfield']++;
1446 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1447 print
'<td class="right">';
1448 if ($obj->accept_conference_suggestions) {
1449 print
yn($obj->accept_conference_suggestions);
1453 $totalarray[
'nbfield']++;
1457 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1458 print
'<td class="right">';
1459 if ($obj->accept_booth_suggestions) {
1460 print
yn($obj->accept_booth_suggestions);
1464 $totalarray[
'nbfield']++;
1468 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1469 print
'<td class="right">';
1470 if ($obj->price_registration !=
'') {
1471 print
'<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).
'</span>';
1472 $totalarray[
'val'][
'p.price_registration'] += $obj->price_registration;
1476 $totalarray[
'nbfield']++;
1479 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_registration';
1483 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1484 print
'<td class="right">';
1485 if ($obj->price_booth !=
'') {
1486 print
'<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).
'</span>';
1487 $totalarray[
'val'][
'p.price_booth'] += $obj->price_booth;
1491 $totalarray[
'nbfield']++;
1494 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_booth';
1498 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1500 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1501 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1502 print $hookmanager->resPrint;
1504 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1505 print
'<td class="center nowraponall">';
1506 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1509 $totalarray[
'nbfield']++;
1513 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1514 print
'<td class="center nowraponall">';
1515 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1518 $totalarray[
'nbfield']++;
1522 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1523 print
'<td class="center">';
1524 print $obj->email_msgid;
1526 if (!$i) $totalarray[
'nbfield']++;
1529 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1530 print
'<td class="right">'.$object->getLibStatut(5).
'</td>';
1532 $totalarray[
'nbfield']++;
1536 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1537 print
'<td class="nowrap center">';
1538 if ($massactionbutton || $massaction) {
1540 if (in_array($object->id, $arrayofselected)) {
1543 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1548 $totalarray[
'nbfield']++;
1558 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1563 foreach ($arrayfields as $key => $val) {
1564 if (!empty($val[
'checked'])) {
1568 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1573 $parameters = array(
'arrayfields'=>$arrayfields,
'sql' => $sql);
1574 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1575 print $hookmanager->resPrint;