36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
43if (isModEnabled(
'category')) {
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
49$langs->loadLangs(array(
'projects',
'companies',
'commercial'));
50if (isModEnabled(
'eventorganization') && $conf->eventorganization->enabled) {
51 $langs->loadLangs(array(
'eventorganization'));
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$toselect =
GETPOST(
'toselect',
'array');
59$optioncss =
GETPOST(
'optioncss',
'alpha');
60$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'projectlist';
61$mode =
GETPOST(
'mode',
'alpha');
62$groupby =
GETPOST(
'groupby',
'aZ09');
64$title = $langs->trans(
"Projects");
72 $title .=
' (<a href="list.php">'.$soc->name.
'</a>)';
74if (!$user->hasRight(
'projet',
'lire')) {
78$diroutputmassaction = $conf->project->dir_output.
'/temp/massgeneration/'.$user->id;
81$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
82$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
84if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
94$offset = $limit * $page;
98$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
99$search_ref =
GETPOST(
"search_ref",
'alpha');
100$search_label =
GETPOST(
"search_label",
'alpha');
101$search_societe =
GETPOST(
"search_societe",
'alpha');
102$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
103$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
104$search_opp_percent =
GETPOST(
"search_opp_percent",
'alpha');
105$search_opp_amount =
GETPOST(
"search_opp_amount",
'alpha');
106$search_budget_amount =
GETPOST(
"search_budget_amount",
'alpha');
107$search_public =
GETPOST(
"search_public",
'intcomma');
108$search_project_user =
GETPOSTINT(
'search_project_user');
109$search_project_contact =
GETPOSTINT(
'search_project_contact');
111$search_usage_opportunity =
GETPOST(
'search_usage_opportunity',
'intcomma');
112$search_usage_task =
GETPOST(
'search_usage_task',
'intcomma');
113$search_usage_bill_time =
GETPOST(
'search_usage_bill_time',
'intcomma');
114$search_usage_event_organization =
GETPOST(
'search_usage_event_organization',
'intcomma');
115$search_accept_conference_suggestions =
GETPOST(
'search_accept_conference_suggestions',
'intcomma');
116$search_accept_booth_suggestions =
GETPOST(
'search_accept_booth_suggestions',
'intcomma');
117$search_price_registration =
GETPOST(
"search_price_registration",
'alpha');
118$search_price_booth =
GETPOST(
"search_price_booth",
'alpha');
119$search_login =
GETPOST(
'search_login',
'alpha');
120$search_import_key =
GETPOST(
'search_import_key',
'alpha');
121$searchCategoryCustomerOperator = 0;
122if (GETPOSTISSET(
'formfilteraction')) {
123 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
125 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
127$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
129 $search_omitChildren =
GETPOST(
'search_omitChildren',
'alpha') ==
'on' ? 1 : 0;
133$mine = ((
GETPOST(
'mode') ==
'mine') ? 1 : 0);
135 $search_project_user = $user->id;
146$search_date_start_startmonth =
GETPOSTINT(
'search_date_start_startmonth');
147$search_date_start_startyear =
GETPOSTINT(
'search_date_start_startyear');
148$search_date_start_startday =
GETPOSTINT(
'search_date_start_startday');
149$search_date_start_start =
dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear);
150$search_date_start_endmonth =
GETPOSTINT(
'search_date_start_endmonth');
151$search_date_start_endyear =
GETPOSTINT(
'search_date_start_endyear');
152$search_date_start_endday =
GETPOSTINT(
'search_date_start_endday');
153$search_date_start_end =
dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear);
155$search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
156$search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
157$search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
158$search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
159$search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
160$search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
161$search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
162$search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
164$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
165$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
166$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
167$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
168$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
169$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
170$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
171$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
173$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
174$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
175$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
176$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
177$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
178$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
179$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
180$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
182$search_category_array = array();
184if (isModEnabled(
'category')) {
185 $search_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PROJECT.
"_list",
"array");
189 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
191 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
'0,1');
196$hookmanager->initHooks(array(
'projectlist'));
200$extrafields->fetch_name_optionals_label(
$object->table_element);
202$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
205$fieldstosearchall = array();
206foreach (
$object->fields as $key => $val) {
207 if (empty($val[
'searchall'])) {
212 if (!empty($user->socid) && $key ==
"note_private") {
216 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
220$fieldstosearchall[
's.nom'] =
"ThirdPartyName";
221$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
222$fieldstosearchall[
's.code_client'] =
"CustomerCode";
225$arrayfields = array();
226foreach (
$object->fields as $key => $val) {
228 if (!empty($val[
'visible'])) {
229 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
230 $arrayfields[
'p.'.$key] = array(
231 'label' => $val[
'label'],
232 'checked' => (($visible < 0) ? 0 : 1),
233 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
234 'position' => $val[
'position'],
235 'help' => isset($val[
'help']) ? $val[
'help'] :
''
240include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
243$arrayfields[
's.nom'] = array(
'label' => $langs->trans(
"ThirdParty"),
'checked' => 1,
'position' => 21,
'enabled' => (!isModEnabled(
'societe') ? 0 : 1));
244$arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'checked' => 0,
'position' => 22);
245$arrayfields[
'commercial'] = array(
'label' => $langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked' => 0,
'position' => 23);
246$arrayfields[
'c.assigned'] = array(
'label' => $langs->trans(
"AssignedTo"),
'checked' => 1,
'position' => 120);
247$arrayfields[
'opp_weighted_amount'] = array(
'label' => $langs->trans(
'OpportunityWeightedAmountShort'),
'checked' => 0,
'enabled' => (!
getDolGlobalString(
'PROJECT_USE_OPPORTUNITIES') ? 0 : 1),
'position' => 106);
248$arrayfields[
'u.login'] = array(
'label' =>
"Author",
'checked' => -1,
'position' => 165);
250if (
GETPOST(
'search_usage_opportunity')) {
254if (
GETPOST(
'search_usage_event_organization')) {
255 $arrayfields[
'p.fk_opp_status'][
'enabled'] = 0;
256 $arrayfields[
'p.opp_amount'][
'enabled'] = 0;
257 $arrayfields[
'p.opp_percent'][
'enabled'] = 0;
258 $arrayfields[
'opp_weighted_amount'][
'enabled'] = 0;
259 $arrayfields[
'p.usage_organize_event'][
'visible'] = 1;
260 $arrayfields[
'p.usage_organize_event'][
'checked'] = 1;
262$arrayfields[
'p.fk_project'][
'enabled'] = 0;
266'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
270$groupbyvalues = array();
271$groupofcollpasedvalues = array();
272if ($mode ==
'kanban' && $groupby) {
274 $groupbyfield = preg_replace(
'/[a-z]\./',
'', $groupby);
275 if (!empty(
$object->fields[$groupbyfield][
'alias'])) {
276 $groupbyfield =
$object->fields[$groupbyfield][
'alias'];
278 if (!in_array(preg_replace(
'/[a-z]\./',
'', $groupby), array_keys(
$object->fields))) {
281 if (!empty(
$object->fields[$groupby][
'arrayofkeyval'])) {
282 $groupbyvalues =
$object->fields[$groupby][
'arrayofkeyval'];
283 } elseif (!empty(
$object->fields[preg_replace(
'/[a-z]\./',
'', $groupby)][
'arrayofkeyval'])) {
284 $groupbyvalues =
$object->fields[preg_replace(
'/[a-z]\./',
'', $groupby)][
'arrayofkeyval'];
291 $sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label";
292 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
293 $sql .=
" WHERE active = 1";
296 $sql .= $db->order(
'cls.rowid',
'ASC');
297 $resql = $db->query($sql);
299 $num = $db->num_rows($resql);
303 $objp = $db->fetch_object($resql);
304 $groupbyvalues[$objp->rowid] = $objp->label;
309 $groupofcollpasedvalues = array(6,7);
314 if ($groupby && !preg_match(
'/^'.preg_quote($db->sanitize($groupby),
'/').
'/', $sortfield)) {
316 $sortfield = $db->sanitize($groupby).($sortfield ?
",".$sortfield :
"");
317 $sortorder =
"ASC".($sortfield ?
",".$sortorder :
"");
326if (
GETPOST(
'cancel',
'alpha')) {
330if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
334$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
335$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
340if (empty($reshook)) {
342 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
345 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
349 $search_societe =
"";
350 $search_societe_alias =
'';
352 $search_opp_status = -1;
353 $search_opp_amount =
'';
354 $search_opp_percent =
'';
355 $search_budget_amount =
'';
358 $search_project_user =
'';
359 $search_project_contact =
'';
366 $search_date_start_startmonth =
"";
367 $search_date_start_startyear =
"";
368 $search_date_start_startday =
"";
369 $search_date_start_start =
"";
370 $search_date_start_endmonth =
"";
371 $search_date_start_endyear =
"";
372 $search_date_start_endday =
"";
373 $search_date_start_end =
"";
374 $search_date_end_startmonth =
"";
375 $search_date_end_startyear =
"";
376 $search_date_end_startday =
"";
377 $search_date_end_start =
"";
378 $search_date_end_endmonth =
"";
379 $search_date_end_endyear =
"";
380 $search_date_end_endday =
"";
381 $search_date_end_end =
"";
382 $search_date_creation_startmonth =
"";
383 $search_date_creation_startyear =
"";
384 $search_date_creation_startday =
"";
385 $search_date_creation_start =
"";
386 $search_date_creation_endmonth =
"";
387 $search_date_creation_endyear =
"";
388 $search_date_creation_endday =
"";
389 $search_date_creation_end =
"";
390 $search_date_modif_startmonth =
"";
391 $search_date_modif_startyear =
"";
392 $search_date_modif_startday =
"";
393 $search_date_modif_start =
"";
394 $search_date_modif_endmonth =
"";
395 $search_date_modif_endyear =
"";
396 $search_date_modif_endday =
"";
397 $search_date_modif_end =
"";
398 $search_usage_opportunity =
'';
399 $search_usage_task =
'';
400 $search_usage_bill_time =
'';
401 $search_usage_event_organization =
'';
402 $search_accept_conference_suggestions =
'';
403 $search_accept_booth_suggestions =
'';
404 $search_price_registration =
'';
405 $search_price_booth =
'';
407 $search_import_key =
'';
409 $search_array_options = array();
410 $search_category_array = array();
415 $objectclass =
'Project';
416 $objectlabel =
'Project';
417 $permissiontoread = $user->hasRight(
'projet',
'lire');
418 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
419 $permissiontoadd = $user->hasRight(
'projet',
'creer');
420 $uploaddir = $conf->project->dir_output;
421 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
424 if (!$error && $massaction ==
'close' && $user->hasRight(
'projet',
'creer')) {
427 $objecttmp =
new $objectclass($db);
429 foreach ($toselect as $toselectid) {
430 $result = $objecttmp->fetch($toselectid);
432 $userWrite =
$object->restrictedProjectArea($user,
'write');
433 if ($userWrite > 0 && $objecttmp->statut == 1) {
434 $result = $objecttmp->setClose($user);
442 } elseif ($userWrite <= 0) {
443 setEventMessages($langs->trans(
"DontHavePermissionForCloseProject", $objecttmp->ref),
null,
'warnings');
445 setEventMessages($langs->trans(
"DontHaveTheValidateStatus", $objecttmp->ref),
null,
'warnings');
468unset($_SESSION[
'pageforbacktolist'][
'project']);
470$form =
new Form($db);
475$companystatic =
new Societe($db);
476$taskstatic =
new Task($db);
479$userstatic =
new User($db);
481$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
482$title = $langs->trans(
"LeadsOrProjects");
484 $title = $langs->trans(
"Projects");
487 $title = $langs->trans(
"Leads");
495if (!$user->hasRight(
'projet',
'all',
'lire')) {
496 $projectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
500$listofprojectcontacttype = array();
501$listofprojectcontacttypeexternal = array();
502$sql =
"SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
503$sql .=
" WHERE ctc.element = '".$db->escape(
$object->element).
"'";
504$resql = $db->query($sql);
506 while ($obj = $db->fetch_object($resql)) {
507 if ($obj->source ==
'internal') {
508 $listofprojectcontacttype[$obj->rowid] = $obj->code;
510 $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
516if (count($listofprojectcontacttype) == 0) {
517 $listofprojectcontacttype[0] =
'0';
519if (count($listofprojectcontacttypeexternal) == 0) {
520 $listofprojectcontacttypeexternal[0] =
'0';
523$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
524$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
526$sql =
"SELECT p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
527$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,";
528$sql .=
" p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
529$sql .=
" p.email_msgid, p.import_key,";
530$sql .=
" p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,";
531$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,";
532$sql .=
" country.code as country_code,";
533$sql .=
" cls.code as opp_status_code,";
534$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';
536if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
537 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
538 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
542$parameters = array();
543$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
544$sql .= $hookmanager->resPrint;
545$sql = preg_replace(
'/,\s*$/',
'', $sql);
549$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as p";
550if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
551 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
553$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
554$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on country.rowid = s.fk_pays";
555$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_lead_status as cls on p.fk_opp_status = cls.rowid";
556$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON p.fk_user_creat = u.rowid';
561$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
562$sql .= $hookmanager->resPrint;
564$sql .=
" WHERE p.entity IN (".getEntity(
'project', (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
')';
565if (!$user->hasRight(
'projet',
'all',
'lire')) {
566 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
570 $sql .=
" AND (p.fk_soc = ".((int) $socid).
")";
578if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
579 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
581 if ($search_societe) {
584 if ($search_societe_alias) {
588if ($search_opp_amount) {
591if ($search_opp_percent) {
594$sql .=
dolSqlDateFilter(
'p.dateo', $search_sday, $search_smonth, $search_syear);
595$sql .=
dolSqlDateFilter(
'p.datee', $search_eday, $search_emonth, $search_eyear);
597if ($search_date_start_start) {
598 $sql .=
" AND p.dateo >= '".$db->idate($search_date_start_start).
"'";
600if ($search_date_start_end) {
601 $sql .=
" AND p.dateo <= '".$db->idate($search_date_start_end).
"'";
604if ($search_date_end_start) {
605 $sql .=
" AND p.datee >= '".$db->idate($search_date_end_start).
"'";
607if ($search_date_end_end) {
608 $sql .=
" AND p.datee <= '".$db->idate($search_date_end_end).
"'";
611if ($search_date_creation_start) {
612 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
614if ($search_date_creation_end) {
615 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
618if ($search_date_modif_start) {
619 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
621if ($search_date_modif_end) {
622 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
626 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
628if ($search_status !=
'' && $search_status !=
'-1') {
629 if ($search_status == 99) {
630 $sql .=
" AND p.fk_statut IN (0,1)";
632 $sql .=
" AND p.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
635if ($search_opp_status) {
636 if (is_numeric($search_opp_status) && $search_opp_status > 0) {
637 $sql .=
" AND p.fk_opp_status = ".((int) $search_opp_status);
639 if ($search_opp_status ==
'all') {
640 $sql .=
" AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
642 if ($search_opp_status ==
'openedopp') {
643 $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'))";
645 if ($search_opp_status ==
'notopenedopp') {
646 $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'))";
648 if ($search_opp_status ==
'none') {
649 $sql .=
" AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
652if ($search_public !=
'') {
653 $sql .=
" AND p.public = ".((int) $search_public);
658if ($search_sale && $search_sale !=
'-1') {
659 if ($search_sale == -2) {
660 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
661 } elseif ($search_sale > 0) {
662 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
665if ($search_project_user > 0) {
666 $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).
")";
668if ($search_project_contact > 0) {
669 $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).
")";
671if ($search_opp_amount !=
'') {
674if ($search_budget_amount !=
'') {
675 $sql .=
natural_search(
'p.budget_amount', $search_budget_amount, 1);
677if ($search_usage_opportunity !=
'' && $search_usage_opportunity >= 0) {
678 $sql .=
natural_search(
'p.usage_opportunity', $search_usage_opportunity, 2);
680if ($search_usage_task !=
'' && $search_usage_task >= 0) {
683if ($search_usage_bill_time !=
'' && $search_usage_bill_time >= 0) {
684 $sql .=
natural_search(
'p.usage_bill_time', $search_usage_bill_time, 2);
686if ($search_usage_event_organization !=
'' && $search_usage_event_organization >= 0) {
687 $sql .=
natural_search(
'p.usage_organize_event', $search_usage_event_organization, 2);
689if ($search_accept_conference_suggestions !=
'' && $search_accept_conference_suggestions >= 0) {
690 $sql .=
natural_search(
'p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
692if ($search_accept_booth_suggestions !=
'' && $search_accept_booth_suggestions >= 0) {
693 $sql .=
natural_search(
'p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
695if ($search_price_registration !=
'') {
696 $sql .=
natural_search(
'p.price_registration', $search_price_registration, 1);
698if ($search_price_booth !=
'') {
702 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
704if ($search_import_key) {
705 $sql .=
natural_search(array(
'p.import_key'), $search_import_key);
708 if ($search_omitChildren == 1) {
709 $sql .=
" AND p.fk_project IS NULL";
714$searchCategoryProjectList = $search_category_array;
715$searchCategoryProjectOperator = 0;
716if (!empty($searchCategoryProjectList)) {
717 $searchCategoryProjectSqlList = array();
718 $listofcategoryid =
'';
719 foreach ($searchCategoryProjectList as $searchCategoryProject) {
720 if (intval($searchCategoryProject) == -2) {
721 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
722 } elseif (intval($searchCategoryProject) > 0) {
723 if ($searchCategoryProjectOperator == 0) {
724 $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).
")";
726 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
730 if ($listofcategoryid) {
731 $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).
"))";
733 if ($searchCategoryProjectOperator == 1) {
734 if (!empty($searchCategoryProjectSqlList)) {
735 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
738 if (!empty($searchCategoryProjectSqlList)) {
739 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
743$searchCategoryCustomerSqlList = array();
744if ($searchCategoryCustomerOperator == 1) {
745 $existsCategoryCustomerList = array();
746 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
747 if (intval($searchCategoryCustomer) == -2) {
748 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
749 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
750 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
751 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
752 $sqlCategoryCustomerNotExists .=
" )";
753 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
754 } elseif (intval($searchCategoryCustomer) > 0) {
755 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
758 if (!empty($existsCategoryCustomerList)) {
759 $sqlCategoryCustomerExists =
" EXISTS (";
760 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
761 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
762 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
763 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
764 $sqlCategoryCustomerExists .=
" )";
765 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
767 if (!empty($searchCategoryCustomerSqlList)) {
768 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
771 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
772 if (intval($searchCategoryCustomer) == -2) {
773 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
774 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
775 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
776 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
777 $sqlCategoryCustomerNotExists .=
" )";
778 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
779 } elseif (intval($searchCategoryCustomer) > 0) {
780 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
783 if (!empty($searchCategoryCustomerSqlList)) {
784 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
788include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
790$parameters = array();
791$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
792$sql .= $hookmanager->resPrint;
796$nbtotalofrecords =
'';
799 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
800 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
801 $resql = $db->query($sqlforcount);
803 $objforcount = $db->fetch_object($resql);
804 $nbtotalofrecords = $objforcount->nbtotalofrecords;
809 if (($page * $limit) > $nbtotalofrecords) {
817$sql .= $db->order($sortfield, $sortorder);
819 $sql .= $db->plimit($limit + 1, $offset);
823$resql = $db->query($sql);
829$num = $db->num_rows($resql);
832if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
833 $obj = $db->fetch_object($resql);
834 header(
"Location: ".DOL_URL_ROOT.
'/projet/card.php?id='.$obj->id);
842llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
844$arrayofselected = is_array($toselect) ? $toselect : array();
848 $param .=
'&mode='.urlencode($mode);
850if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
851 $param .=
'&contextpage='.urlencode($contextpage);
853if ($limit > 0 && $limit != $conf->liste_limit) {
854 $param .=
'&limit='.((int) $limit);
856if ($optioncss !=
'') {
857 $param .=
'&optioncss='.urlencode($optioncss);
860 $param .=
'&groupby='.urlencode($groupby);
864 $param .=
'&socid='.urlencode((
string) $socid);
866if ($search_all !=
'') {
867 $param .=
'&search_all='.urlencode($search_all);
870 $param .=
'&search_sday='.urlencode((
string) ($search_sday));
873 $param .=
'&search_smonth='.urlencode((
string) ($search_smonth));
876 $param .=
'&search_syear='.urlencode((
string) ($search_syear));
879 $param .=
'&search_eday='.urlencode((
string) ($search_eday));
882 $param .=
'&search_emonth='.urlencode((
string) ($search_emonth));
885 $param .=
'&search_eyear='.urlencode((
string) ($search_eyear));
887if ($search_date_start_startmonth) {
888 $param .=
'&search_date_start_startmonth='.urlencode((
string) ($search_date_start_startmonth));
890if ($search_date_start_startyear) {
891 $param .=
'&search_date_start_startyear='.urlencode((
string) ($search_date_start_startyear));
893if ($search_date_start_startday) {
894 $param .=
'&search_date_start_startday='.urlencode((
string) ($search_date_start_startday));
896if ($search_date_start_start) {
897 $param .=
'&search_date_start_start='.urlencode($search_date_start_start);
899if ($search_date_start_endmonth) {
900 $param .=
'&search_date_start_endmonth='.urlencode((
string) ($search_date_start_endmonth));
902if ($search_date_start_endyear) {
903 $param .=
'&search_date_start_endyear='.urlencode((
string) ($search_date_start_endyear));
905if ($search_date_start_endday) {
906 $param .=
'&search_date_start_endday='.urlencode((
string) ($search_date_start_endday));
908if ($search_date_start_end) {
909 $param .=
'&search_date_start_end='.urlencode($search_date_start_end);
911if ($search_date_end_startmonth) {
912 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
914if ($search_date_end_startyear) {
915 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
917if ($search_date_end_startday) {
918 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
920if ($search_date_end_start) {
921 $param .=
'&search_date_end_start='.urlencode($search_date_end_start);
923if ($search_date_end_endmonth) {
924 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
926if ($search_date_end_endyear) {
927 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
929if ($search_date_end_endday) {
930 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
932if ($search_date_end_end) {
933 $param .=
'&search_date_end_end=' . urlencode($search_date_end_end);
935if ($search_date_creation_startmonth) {
936 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
938if ($search_date_creation_startyear) {
939 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
941if ($search_date_creation_startday) {
942 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
944if ($search_date_creation_start) {
945 $param .=
'&search_date_creation_start='.urlencode($search_date_creation_start);
947if ($search_date_creation_endmonth) {
948 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
950if ($search_date_creation_endyear) {
951 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
953if ($search_date_creation_endday) {
954 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
956if ($search_date_creation_end) {
957 $param .=
'&search_date_creation_end='.urlencode($search_date_creation_end);
959if ($search_date_modif_startmonth) {
960 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
962if ($search_date_modif_startyear) {
963 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
965if ($search_date_modif_startday) {
966 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
968if ($search_date_modif_start) {
969 $param .=
'&search_date_modif_start='.urlencode($search_date_modif_start);
971if ($search_date_modif_endmonth) {
972 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
974if ($search_date_modif_endyear) {
975 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
977if ($search_date_modif_endday) {
978 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
980if ($search_date_modif_end) {
981 $param .=
'&search_date_modif_end=' . urlencode($search_date_modif_end);
983if (!empty($search_category_array)) {
984 foreach ($search_category_array as $tmpval) {
985 $param .=
'&search_categegory_project_list[]='.urlencode($tmpval);
988if ($search_ref !=
'') {
989 $param .=
'&search_ref='.urlencode($search_ref);
991if ($search_label !=
'') {
992 $param .=
'&search_label='.urlencode($search_label);
994if ($search_societe !=
'') {
995 $param .=
'&search_societe='.urlencode($search_societe);
997if ($search_societe_alias !=
'') {
998 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
1000if ($search_status !=
'' && $search_status !=
'-1') {
1001 $param .=
"&search_status=".urlencode($search_status);
1003if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'openedopp',
'notopenedopp',
'none'))) {
1004 $param .=
'&search_opp_status='.urlencode($search_opp_status);
1006if ($search_opp_percent !=
'') {
1007 $param .=
'&search_opp_percent='.urlencode($search_opp_percent);
1009if ($search_public !=
'') {
1010 $param .=
'&search_public='.urlencode($search_public);
1012if ($search_project_user > 0) {
1013 $param .=
'&search_project_user='.urlencode($search_project_user);
1015if ($search_project_contact > 0) {
1016 $param .=
'&search_project_contact='.urlencode((
string) ($search_project_contact));
1018if ($search_sale > 0) {
1019 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1021if ($search_opp_amount !=
'') {
1022 $param .=
'&search_opp_amount='.urlencode($search_opp_amount);
1024if ($search_budget_amount !=
'') {
1025 $param .=
'&search_budget_amount='.urlencode($search_budget_amount);
1027if ($search_usage_task !=
'') {
1028 $param .=
'&search_usage_task='.urlencode($search_usage_task);
1030if ($search_usage_bill_time !=
'') {
1031 $param .=
'&search_usage_opportunity='.urlencode($search_usage_bill_time);
1033if ($search_usage_event_organization !=
'') {
1034 $param .=
'&search_usage_event_organization='.urlencode($search_usage_event_organization);
1036if ($search_accept_conference_suggestions !=
'') {
1037 $param .=
'&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
1039if ($search_accept_booth_suggestions !=
'') {
1040 $param .=
'&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
1042if ($search_price_registration !=
'') {
1043 $param .=
'&search_price_registration='.urlencode($search_price_registration);
1045if ($search_price_booth !=
'') {
1046 $param .=
'&search_price_booth='.urlencode($search_price_booth);
1049 $param .=
'&search_login='.urlencode($search_login);
1051if ($search_import_key) {
1052 $param .=
'&search_import_key='.urlencode($search_import_key);
1054foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1055 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1058include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1061$parameters = array(
'param' => &$param);
1062$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1063$param .= $hookmanager->resPrint;
1066$arrayofmassactions = array(
1067 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1068 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1073if ($user->hasRight(
'projet',
'creer')) {
1074 $arrayofmassactions[
'close'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Close");
1075 $arrayofmassactions[
'preaffectuser'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AffectUser");
1077if ($user->hasRight(
'projet',
'supprimer')) {
1078 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1080if (isModEnabled(
'category') && $user->hasRight(
'projet',
'creer')) {
1081 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1083if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preaffectuser'))) {
1084 $arrayofmassactions = array();
1087$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1089$url = DOL_URL_ROOT.
'/projet/card.php?action=create';
1090if (!empty($socid)) {
1091 $url .=
'&socid='.$socid;
1093if ($search_usage_event_organization == 1) {
1094 $url .=
'&usage_organize_event=1';
1095 if (((
int) $search_usage_opportunity) < 1) {
1096 $url .=
'&usage_opportunity=0';
1101$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
1102$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
1104$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewProject'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'projet',
'creer'));
1106print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1107if ($optioncss !=
'') {
1108 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1110print
'<input type="hidden" name="token" value="'.newToken().
'">';
1111print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1112print
'<input type="hidden" name="action" value="list">';
1113print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1114print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1115print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1116print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1117print
'<input type="hidden" name="groupby" value="'.$groupby.
'">';
1121if ($search_project_user == $user->id) {
1122 $texthelp .= $langs->trans(
"MyProjectsDesc");
1124 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
1125 $texthelp .= $langs->trans(
"ProjectsDesc");
1127 $texthelp .= $langs->trans(
"ProjectsPublicDesc");
1131print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1134$topicmail =
"Information";
1135$modelmail =
"project";
1137$trackid =
'proj'.$object->id;
1138include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1141 foreach ($fieldstosearchall as $key => $val) {
1142 $fieldstosearchall[$key] = $langs->trans($val);
1144 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1150$moreforfilter .=
'<div class="divsearchfield">';
1151$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
1154if (!$user->hasRight(
'user',
'user',
'lire')) {
1155 $includeonly = array($user->id);
1157$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth300 widthcentpercentminusx');
1158$moreforfilter .=
'</div>';
1160$moreforfilter .=
'<div class="divsearchfield">';
1161$tmptitle = $langs->trans(
'ProjectsWithThisContact');
1162$moreforfilter .=
img_picto($tmptitle,
'contact',
'class="pictofixedwidth"').$form->select_contact(0, $search_project_contact ? $search_project_contact :
'',
'search_project_contact', $tmptitle,
'',
'', 0,
'maxwidth300 widthcentpercentminusx');
1164$moreforfilter .=
'</div>';
1167if ($user->hasRight(
'user',
'user',
'lire')) {
1168 $langs->load(
"commercial");
1169 $moreforfilter .=
'<div class="divsearchfield">';
1170 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1171 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1172 $moreforfilter .=
'</div>';
1176if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1178 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array,
'minwidth300imp minwidth300 widthcentpercentminusx');
1182if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST') && isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
1184 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
1189 $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"' :
'').
'"> ';
1192if (!empty($moreforfilter)) {
1193 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1194 print $moreforfilter;
1195 $parameters = array();
1196 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
1197 print $hookmanager->resPrint;
1201$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1202$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1203$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1204$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1207print
'<div class="div-table-responsive">';
1208print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1212print
'<tr class="liste_titre_filter">';
1215 print
'<td class="liste_titre maxwidthsearch">';
1216 $searchpicto = $form->showFilterButtons(
'left');
1221if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1222 print
'<td class="liste_titre">';
1223 print
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'" size="6">';
1227if (!empty($arrayfields[
'p.title'][
'checked'])) {
1228 print
'<td class="liste_titre">';
1229 print
'<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).
'">';
1233if (!empty($arrayfields[
's.nom'][
'checked'])) {
1234 print
'<td class="liste_titre">';
1236 $tmpthirdparty =
new Societe($db);
1237 $tmpthirdparty->fetch($socid);
1238 $search_societe = $tmpthirdparty->name;
1240 print
'<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
1245if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1246 print
'<td class="liste_titre">';
1248 $tmpthirdparty =
new Societe($db);
1249 $tmpthirdparty->fetch($socid);
1250 $search_societe_alias = $tmpthirdparty->name_alias;
1252 print
'<input type="text" class="flat" name="search_societe_alias" size="8" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1256if (!empty($arrayfields[
'commercial'][
'checked'])) {
1257 print
'<td class="liste_titre"> </td>';
1260if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1261 print
'<td class="liste_titre center">';
1262 print
'<div class="nowrapfordate">';
1263 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'));
1265 print
'<div class="nowrapfordate">';
1266 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'));
1271if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1272 print
'<td class="liste_titre center">';
1273 print
'<div class="nowrapfordate">';
1274 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'));
1276 print
'<div class="nowrapfordate">';
1277 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'));
1282if (!empty($arrayfields[
'p.public'][
'checked'])) {
1283 print
'<td class="liste_titre center">';
1284 $array = array(
'' =>
'', 0 => $langs->trans(
"PrivateProject"), 1 => $langs->trans(
"SharedProject"));
1285 print $form->selectarray(
'search_public', $array, $search_public, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1288if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1289 print
'<td class="liste_titre center">';
1293if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1294 print
'<td class="liste_titre nowrap center">';
1295 print $formproject->selectOpportunityStatus(
'search_opp_status', $search_opp_status, 1, 1, 1, 0,
'maxwidth125 nowrapoption', 1, 1);
1298if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1299 print
'<td class="liste_titre nowrap right">';
1300 print
'<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.
'">';
1303if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1304 print
'<td class="liste_titre nowrap right">';
1305 print
'<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.
'">';
1308if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1309 print
'<td class="liste_titre nowrap right">';
1312if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1313 print
'<td class="liste_titre nowrap right">';
1314 print
'<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.
'">';
1317if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1318 print
'<td class="liste_titre nowrap">';
1319 print $form->selectyesno(
'search_usage_opportunity', $search_usage_opportunity, 1,
false, 1, 1);
1323if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1324 print
'<td class="liste_titre nowrap">';
1325 print $form->selectyesno(
'search_usage_task', $search_usage_task, 1,
false, 1, 1);
1328if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1329 print
'<td class="liste_titre nowrap">';
1330 print $form->selectyesno(
'search_usage_bill_time', $search_usage_bill_time, 1,
false, 1, 1);
1333if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1334 print
'<td class="liste_titre nowrap">';
1335 print $form->selectyesno(
'search_usage_event_organization', $search_usage_event_organization, 1,
false, 1, 1);
1338if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1339 print
'<td class="liste_titre nowrap">';
1340 print $form->selectyesno(
'search_accept_conference_suggestions', $search_accept_conference_suggestions, 1,
false, 1, 1);
1343if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1344 print
'<td class="liste_titre nowrap">';
1345 print $form->selectyesno(
'search_accept_booth_suggestions', $search_accept_booth_suggestions, 1,
false, 1, 1);
1348if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1349 print
'<td class="liste_titre nowrap right">';
1350 print
'<input type="text" class="flat" name="search_price_registration" size="4" value="'.dol_escape_htmltag($search_price_registration).
'">';
1353if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1354 print
'<td class="liste_titre nowrap right">';
1355 print
'<input type="text" class="flat" name="search_price_booth" size="4" value="'.dol_escape_htmltag($search_price_booth).
'">';
1358if (!empty($arrayfields[
'u.login'][
'checked'])) {
1360 print
'<td class="liste_titre" align="center">';
1361 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1365include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1368$parameters = array(
'arrayfields' => $arrayfields);
1369$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1370print $hookmanager->resPrint;
1372if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1373 print
'<td class="liste_titre center">';
1374 print
'<div class="nowrapfordate">';
1375 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'));
1377 print
'<div class="nowrapfordate">';
1378 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'));
1383if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1384 print
'<td class="liste_titre center">';
1385 print
'<div class="nowrapfordate">';
1386 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'));
1388 print
'<div class="nowrapfordate">';
1389 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'));
1393if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1395 print
'<td class="liste_titre">';
1398if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1400 print
'<td class="liste_titre">';
1401 print
'<input class="flat width75" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1404if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1405 print
'<td class="liste_titre center parentonrightofpage">';
1406 $formproject->selectProjectsStatus($search_status, 1,
'search_status');
1411 print
'<td class="liste_titre maxwidthsearch">';
1412 $searchpicto = $form->showFilterButtons();
1418$totalarray = array();
1419$totalarray[
'nbfield'] = 0;
1423print
'<tr class="liste_titre">';
1425 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1426 $totalarray[
'nbfield']++;
1428if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1429 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1430 $totalarray[
'nbfield']++;
1432if (!empty($arrayfields[
'p.title'][
'checked'])) {
1433 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1434 $totalarray[
'nbfield']++;
1436if (!empty($arrayfields[
's.nom'][
'checked'])) {
1437 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1438 $totalarray[
'nbfield']++;
1440if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1441 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1442 $totalarray[
'nbfield']++;
1444if (!empty($arrayfields[
'commercial'][
'checked'])) {
1445 print_liste_field_titre($arrayfields[
'commercial'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder,
'tdoverflowmax100imp ');
1446 $totalarray[
'nbfield']++;
1448if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1449 print_liste_field_titre($arrayfields[
'p.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"p.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1450 $totalarray[
'nbfield']++;
1452if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1453 print_liste_field_titre($arrayfields[
'p.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1454 $totalarray[
'nbfield']++;
1456if (!empty($arrayfields[
'p.public'][
'checked'])) {
1457 print_liste_field_titre($arrayfields[
'p.public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.public",
"", $param,
"", $sortfield, $sortorder,
'center ');
1458 $totalarray[
'nbfield']++;
1460if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1461 print_liste_field_titre($arrayfields[
'c.assigned'][
'label'], $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ',
'');
1462 $totalarray[
'nbfield']++;
1464if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1465 print_liste_field_titre($arrayfields[
'p.fk_opp_status'][
'label'], $_SERVER[
"PHP_SELF"],
'p.fk_opp_status',
"", $param,
'', $sortfield, $sortorder,
'center ');
1466 $totalarray[
'nbfield']++;
1468if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1469 print_liste_field_titre($arrayfields[
'p.opp_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.opp_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1470 $totalarray[
'nbfield']++;
1472if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1473 print_liste_field_titre($arrayfields[
'p.opp_percent'][
'label'], $_SERVER[
'PHP_SELF'],
'p.opp_percent',
"", $param,
'', $sortfield, $sortorder,
'right ');
1474 $totalarray[
'nbfield']++;
1476if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1477 print_liste_field_titre($arrayfields[
'opp_weighted_amount'][
'label'], $_SERVER[
'PHP_SELF'],
'opp_weighted_amount',
'', $param,
'', $sortfield, $sortorder,
'right ');
1478 $totalarray[
'nbfield']++;
1480if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1481 print_liste_field_titre($arrayfields[
'p.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.budget_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1482 $totalarray[
'nbfield']++;
1484if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1485 print_liste_field_titre($arrayfields[
'p.usage_opportunity'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_opportunity',
"", $param,
'', $sortfield, $sortorder,
'');
1486 $totalarray[
'nbfield']++;
1488if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1489 print_liste_field_titre($arrayfields[
'p.usage_task'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_task',
"", $param,
'', $sortfield, $sortorder,
'');
1490 $totalarray[
'nbfield']++;
1492if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1493 print_liste_field_titre($arrayfields[
'p.usage_bill_time'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_bill_time',
"", $param,
'', $sortfield, $sortorder,
'');
1494 $totalarray[
'nbfield']++;
1496if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1497 print_liste_field_titre($arrayfields[
'p.usage_organize_event'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_organize_event',
"", $param,
'', $sortfield, $sortorder,
'');
1498 $totalarray[
'nbfield']++;
1500if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1501 print_liste_field_titre($arrayfields[
'p.accept_conference_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_conference_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1502 $totalarray[
'nbfield']++;
1504if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1505 print_liste_field_titre($arrayfields[
'p.accept_booth_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_booth_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1506 $totalarray[
'nbfield']++;
1508if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1509 print_liste_field_titre($arrayfields[
'p.price_registration'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_registration',
"", $param,
'', $sortfield, $sortorder,
'right ');
1510 $totalarray[
'nbfield']++;
1512if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1513 print_liste_field_titre($arrayfields[
'p.price_booth'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_booth',
"", $param,
'', $sortfield, $sortorder,
'right ');
1514 $totalarray[
'nbfield']++;
1516if (!empty($arrayfields[
'u.login'][
'checked'])) {
1517 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1518 $totalarray[
'nbfield']++;
1521include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1523$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1524$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1525print $hookmanager->resPrint;
1526if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1527 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1528 $totalarray[
'nbfield']++;
1530if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1531 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1532 $totalarray[
'nbfield']++;
1534if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1535 print_liste_field_titre($arrayfields[
'p.email_msgid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email_msgid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1536 $totalarray[
'nbfield']++;
1538if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1539 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'');
1540 $totalarray[
'nbfield']++;
1542if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1543 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1544 $totalarray[
'nbfield']++;
1548 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1549 $totalarray[
'nbfield']++;
1555$savnbfield = $totalarray[
'nbfield'];
1560$imaxinloop = ($limit ? min($num, $limit) : $num);
1561while ($i < $imaxinloop) {
1562 $obj = $db->fetch_object($resql);
1568 $companystatic->id = $obj->socid;
1569 $companystatic->name = $obj->name;
1570 $companystatic->name_alias = $obj->alias;
1571 $companystatic->client = $obj->client;
1572 $companystatic->code_client = $obj->code_client;
1573 $companystatic->email = $obj->email;
1574 $companystatic->phone = $obj->phone;
1575 $companystatic->address = $obj->address;
1576 $companystatic->zip = $obj->zip;
1577 $companystatic->town = $obj->town;
1578 $companystatic->country_code = $obj->country_code;
1584 $object->fk_opp_status = $obj->fk_opp_status;
1585 $object->user_author_id = $obj->fk_user_creat;
1586 $object->date_creation = $db->jdate($obj->date_creation);
1587 $object->date_start = $db->jdate($obj->date_start);
1588 $object->date_end = $db->jdate($obj->date_end);
1589 $object->statut = $obj->status;
1590 $object->status = $obj->status;
1591 $object->public = $obj->public;
1592 $object->opp_percent = $obj->opp_percent;
1593 $object->opp_status = $obj->fk_opp_status;
1594 $object->opp_status_code = $obj->opp_status_code;
1595 $object->opp_amount = !empty($obj->opp_amount) ? $obj->opp_amount :
"";
1596 $object->opp_weighted_amount = $obj->opp_weighted_amount;
1597 $object->budget_amount = $obj->budget_amount;
1598 $object->usage_opportunity = $obj->usage_opportunity;
1599 $object->usage_task = $obj->usage_task;
1600 $object->usage_bill_time = $obj->usage_bill_time;
1601 $object->usage_organize_event = $obj->usage_organize_event;
1602 $object->email_msgid = $obj->email_msgid;
1603 $object->import_key = $obj->import_key;
1604 $object->thirdparty = $companystatic;
1608 $stringassignedusers =
'';
1610 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1612 foreach (array(
'internal',
'external') as $source) {
1613 $tab =
$object->liste_contact(-1, $source, 0,
'', 1);
1614 $numcontact = count($tab);
1615 if (!empty($numcontact)) {
1616 foreach ($tab as $contactproject) {
1618 if ($source ==
'internal') {
1619 if (!empty($conf->cache[
'user'][$contactproject[
'id']])) {
1620 $c = $conf->cache[
'user'][$contactproject[
'id']];
1623 $c->fetch($contactproject[
'id']);
1624 $conf->cache[
'user'][$contactproject[
'id']] = $c;
1627 if (!empty($conf->cache[
'contact'][$contactproject[
'id']])) {
1628 $c = $conf->cache[
'contact'][$contactproject[
'id']];
1631 $c->fetch($contactproject[
'id']);
1632 $conf->cache[
'contact'][$contactproject[
'id']] = $c;
1635 if (get_class($c) ==
'User') {
1636 $stringassignedusers .= $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'',
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1638 $stringassignedusers .= $c->getNomUrl(-2,
'', 0,
'', -1, 0,
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1646 if ($mode ==
'kanban') {
1648 print
'<tr class="trkanban'.(empty($groupby) ?
'' :
' trkanbangroupby').
'"><td colspan="'.$savnbfield.
'">';
1651 if (!empty($groupby)) {
1652 if (is_null($groupbyold)) {
1653 print
'<div class="box-flex-container-columns kanban">';
1656 if (is_null($obj->$groupbyfield)) {
1657 $groupbyvalue =
'undefined';
1659 $groupbyvalue = $obj->$groupbyfield;
1661 if ($groupbyold !== $groupbyvalue) {
1662 if (!is_null($groupbyold)) {
1665 foreach ($groupbyvalues as $tmpcursor => $tmpgroupbyvalue) {
1667 if (!is_null($groupbyold) && ($tmpcursor <= $groupbyold)) {
continue; }
1668 if ($tmpcursor >= $groupbyvalue) {
continue; }
1670 print
'<div class="box-flex-container-column kanban column';
1671 if (in_array($tmpcursor, $groupofcollpasedvalues)) {
1672 print
' kanbancollapsed';
1674 print
'" data-groupbyid="'.preg_replace(
'/[^a-z0-9]/',
'', $tmpcursor).
'">';
1675 print
'<div class="kanbanlabel">'.$langs->trans($tmpgroupbyvalue).
'</div>';
1678 print
'<div class="box-flex-container-column kanban column" data-groupbyid="'.preg_replace(
'/[^a-z0-9]/',
'', $groupbyvalue).
'">';
1679 print
'<div class="kanbanlabel">'.$langs->trans(empty($groupbyvalues[$groupbyvalue]) ?
'Undefined' : $groupbyvalues[$groupbyvalue]).
'</div>';
1681 $groupbyold = $groupbyvalue;
1682 } elseif ($i == 0) {
1683 print
'<div class="box-flex-container kanban">';
1688 if ($massactionbutton || $massaction) {
1690 if (in_array(
$object->id, $arrayofselected)) {
1694 $arrayofdata = array(
'assignedusers' => $stringassignedusers,
'thirdparty' => $companystatic,
'selected' => $selected);
1696 print
$object->getKanbanView(
'', $arrayofdata, ($groupby ?
'small' :
''));
1699 if ($i == ($imaxinloop - 1)) {
1701 if (!empty($groupby)) {
1703 foreach ($groupbyvalues as $tmpcursor => $tmpgroupbyvalue) {
1705 if ($tmpcursor <= $groupbyvalue) {
continue; }
1707 print
'<div class="box-flex-container-column kanban column';
1708 if (in_array($tmpcursor, $groupofcollpasedvalues)) {
1709 print
' kanbancollapsed';
1711 print
'" data-groupbyid="'.preg_replace(
'/[^a-z0-9]/',
'', $tmpcursor).
'">';
1712 print
'<div class="kanbanlabel">'.$langs->trans(empty($tmpgroupbyvalue) ?
'Undefined' : $tmpgroupbyvalue).
'</div>';
1724 $userstatic->id = $obj->fk_user_creat;
1725 $userstatic->login = $obj->login;
1726 $userstatic->lastname = $obj->lastname;
1727 $userstatic->firstname = $obj->firstname;
1728 $userstatic->email = $obj->user_email;
1729 $userstatic->status = $obj->user_statut;
1730 $userstatic->entity = $obj->entity;
1731 $userstatic->photo = $obj->photo;
1732 $userstatic->office_phone = $obj->office_phone;
1733 $userstatic->office_fax = $obj->office_fax;
1734 $userstatic->user_mobile = $obj->user_mobile;
1735 $userstatic->job = $obj->job;
1736 $userstatic->gender = $obj->gender;
1740 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1743 print
'<td class="nowrap center">';
1744 if ($massactionbutton || $massaction) {
1746 if (in_array(
$object->id, $arrayofselected)) {
1749 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1753 $totalarray[
'nbfield']++;
1757 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1758 print
'<td class="nowraponall tdoverflowmax200">';
1759 print
$object->getNomUrl(1, (!empty(
GETPOSTINT(
'search_usage_event_organization')) ?
'eventorganization' :
''));
1765 $totalarray[
'nbfield']++;
1769 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1770 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).
'">';
1774 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1779 print
'<td class="tdoverflowmax125">';
1781 print $companystatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1787 $totalarray[
'nbfield']++;
1791 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1792 print
'<td class="tdoverflowmax100">';
1794 print $companystatic->name_alias;
1800 $totalarray[
'nbfield']++;
1804 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1805 print
'<td class="tdoverflowmax150">';
1807 $companystatic->id = $obj->socid;
1808 $companystatic->name = $obj->name;
1809 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1810 $nbofsalesrepresentative = count($listsalesrepresentatives);
1811 if ($nbofsalesrepresentative > 6) {
1813 print $nbofsalesrepresentative;
1814 } elseif ($nbofsalesrepresentative > 0) {
1815 $userstatic =
new User($db);
1817 foreach ($listsalesrepresentatives as $val) {
1818 $userstatic->id = $val[
'id'];
1819 $userstatic->lastname = $val[
'lastname'];
1820 $userstatic->firstname = $val[
'firstname'];
1821 $userstatic->email = $val[
'email'];
1822 $userstatic->status = $val[
'statut'];
1823 $userstatic->entity = $val[
'entity'];
1824 $userstatic->photo = $val[
'photo'];
1825 $userstatic->login = $val[
'login'];
1826 $userstatic->office_phone = $val[
'office_phone'];
1827 $userstatic->office_fax = $val[
'office_fax'];
1828 $userstatic->user_mobile = $val[
'user_mobile'];
1829 $userstatic->job = $val[
'job'];
1830 $userstatic->gender = $val[
'gender'];
1831 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1833 if ($j < $nbofsalesrepresentative) {
1844 $totalarray[
'nbfield']++;
1849 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1850 print
'<td class="center">';
1854 $totalarray[
'nbfield']++;
1858 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1859 print
'<td class="center">';
1863 $totalarray[
'nbfield']++;
1868 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1869 print
'<td class="center">';
1871 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1874 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1879 $totalarray[
'nbfield']++;
1883 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1884 print
'<td class="center nowraponall tdoverflowmax200">';
1885 print $stringassignedusers;
1888 $totalarray[
'nbfield']++;
1892 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1894 if ($obj->opp_status_code) {
1895 $s = $langs->trans(
"OppStatus".$obj->opp_status_code);
1896 if (empty($arrayfields[
'p.opp_percent'][
'checked']) && $obj->opp_percent) {
1897 $s .=
' ('.dol_escape_htmltag(
price2num($obj->opp_percent, 1)).
'%)';
1900 print
'<td class="center tdoverflowmax150" title="'.$s.
'">';
1904 $totalarray[
'nbfield']++;
1908 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1909 print
'<td class="right">';
1911 if (isset($obj->opp_amount) && strcmp($obj->opp_amount,
'')) {
1912 print
'<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1913 if (!isset($totalarray[
'val'][
'p.opp_amount'])) {
1914 $totalarray[
'val'][
'p.opp_amount'] = $obj->opp_amount;
1916 $totalarray[
'val'][
'p.opp_amount'] += $obj->opp_amount;
1921 $totalarray[
'nbfield']++;
1924 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.opp_amount';
1928 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1929 print
'<td class="right">';
1930 if ($obj->opp_percent) {
1931 print
price($obj->opp_percent, 1, $langs, 1, 0).
'%';
1935 $totalarray[
'nbfield']++;
1939 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1940 if (!isset($totalarray[
'val'][
'opp_weighted_amount'])) {
1941 $totalarray[
'val'][
'opp_weighted_amount'] = 0;
1943 print
'<td align="right">';
1944 if ($obj->opp_weighted_amount) {
1945 print
'<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1946 $totalarray[
'val'][
'opp_weighted_amount'] += $obj->opp_weighted_amount;
1950 $totalarray[
'nbfield']++;
1951 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'opp_weighted_amount';
1955 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1956 print
'<td class="right">';
1957 if ($obj->budget_amount !=
'') {
1958 print
'<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).
'</span>';
1959 if (!isset($totalarray[
'val'][
'p.budget_amount'])) {
1960 $totalarray[
'val'][
'p.budget_amount'] = $obj->budget_amount;
1962 $totalarray[
'val'][
'p.budget_amount'] += $obj->budget_amount;
1967 $totalarray[
'nbfield']++;
1968 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.budget_amount';
1972 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1973 print
'<td class="">';
1974 if ($obj->usage_opportunity) {
1975 print
yn($obj->usage_opportunity);
1979 $totalarray[
'nbfield']++;
1983 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1984 print
'<td class="">';
1985 if ($obj->usage_task) {
1986 print
yn($obj->usage_task);
1990 $totalarray[
'nbfield']++;
1994 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1995 print
'<td class="">';
1996 if ($obj->usage_bill_time) {
1997 print
yn($obj->usage_bill_time);
2001 $totalarray[
'nbfield']++;
2005 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
2006 print
'<td class="">';
2007 if ($obj->usage_organize_event) {
2008 print
yn($obj->usage_organize_event);
2012 $totalarray[
'nbfield']++;
2016 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
2017 print
'<td class="">';
2018 if ($obj->accept_conference_suggestions) {
2019 print
yn($obj->accept_conference_suggestions);
2023 $totalarray[
'nbfield']++;
2027 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
2028 print
'<td class="">';
2029 if ($obj->accept_booth_suggestions) {
2030 print
yn($obj->accept_booth_suggestions);
2034 $totalarray[
'nbfield']++;
2038 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
2039 print
'<td class="right">';
2040 if ($obj->price_registration !=
'') {
2041 print
'<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).
'</span>';
2042 $totalarray[
'val'][
'p.price_registration'] += $obj->price_registration;
2046 $totalarray[
'nbfield']++;
2049 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_registration';
2053 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
2054 print
'<td class="right">';
2055 if ($obj->price_booth !=
'') {
2056 print
'<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).
'</span>';
2057 $totalarray[
'val'][
'p.price_booth'] += $obj->price_booth;
2061 $totalarray[
'nbfield']++;
2064 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_booth';
2068 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2069 print
'<td class="center tdoverflowmax150">';
2070 if ($userstatic->id) {
2071 print $userstatic->getNomUrl(-1);
2075 $totalarray[
'nbfield']++;
2079 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2081 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2082 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2083 print $hookmanager->resPrint;
2085 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2086 print
'<td class="center nowraponall">';
2087 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2090 $totalarray[
'nbfield']++;
2094 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2095 print
'<td class="center nowraponall">';
2096 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2099 $totalarray[
'nbfield']++;
2103 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
2104 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->email_msgid).
'">';
2108 $totalarray[
'nbfield']++;
2112 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2113 print
'<td class="right">'.dol_escape_htmltag($obj->import_key).
'</td>';
2115 $totalarray[
'nbfield']++;
2119 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2120 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
2122 $totalarray[
'nbfield']++;
2127 print
'<td class="nowrap center">';
2128 if ($massactionbutton || $massaction) {
2130 if (in_array(
$object->id, $arrayofselected)) {
2133 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2137 $totalarray[
'nbfield']++;
2148include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2153 foreach ($arrayfields as $key => $val) {
2154 if (!empty($val[
'checked'])) {
2158 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2163$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2164$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2165print $hookmanager->resPrint;
2167print
'</table>'.
"\n";
2170print
'</form>'.
"\n";
2172if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2173 $hidegeneratedfilelistifempty = 1;
2174 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2175 $hidegeneratedfilelistifempty = 0;
2178 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2182 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2183 $urlsource .= str_replace(
'&',
'&', $param);
2185 $filedir = $diroutputmassaction;
2186 $genallowed = $permissiontoread;
2187 $delallowed = $permissiontoadd;
2189 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
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).
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.