36 require
'../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
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'));
50 if (
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');
63 $title = $langs->trans(
"Projects");
71 $title .=
' (<a href="list.php">'.$soc->name.
'</a>)';
73 if (!$user->hasRight(
'projet',
'lire')) {
77 $diroutputmassaction = $conf->project->dir_output.
'/temp/massgeneration/'.$user->id;
80 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
83 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
93 $offset = $limit * $page;
94 $pageprev = $page - 1;
95 $pagenext = $page + 1;
97 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
98 $search_ref =
GETPOST(
"search_ref",
'alpha');
99 $search_label =
GETPOST(
"search_label",
'alpha');
100 $search_societe =
GETPOST(
"search_societe",
'alpha');
101 $search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
102 $search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
103 $search_opp_percent =
GETPOST(
"search_opp_percent",
'alpha');
104 $search_opp_amount =
GETPOST(
"search_opp_amount",
'alpha');
105 $search_budget_amount =
GETPOST(
"search_budget_amount",
'alpha');
106 $search_public =
GETPOST(
"search_public",
'intcomma');
107 $search_project_user =
GETPOSTINT(
'search_project_user');
108 $search_project_contact =
GETPOSTINT(
'search_project_contact');
110 $search_usage_opportunity =
GETPOST(
'search_usage_opportunity',
'intcomma');
111 $search_usage_task =
GETPOST(
'search_usage_task',
'intcomma');
112 $search_usage_bill_time =
GETPOST(
'search_usage_bill_time',
'intcomma');
113 $search_usage_event_organization =
GETPOST(
'search_usage_event_organization',
'intcomma');
114 $search_accept_conference_suggestions =
GETPOST(
'search_accept_conference_suggestions',
'intcomma');
115 $search_accept_booth_suggestions =
GETPOST(
'search_accept_booth_suggestions',
'intcomma');
116 $search_price_registration =
GETPOST(
"search_price_registration",
'alpha');
117 $search_price_booth =
GETPOST(
"search_price_booth",
'alpha');
118 $search_login =
GETPOST(
'search_login',
'alpha');
119 $search_import_key =
GETPOST(
'search_import_key',
'alpha');
120 $searchCategoryCustomerOperator = 0;
122 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
124 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
126 $searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
128 $search_omitChildren =
GETPOST(
'search_omitChildren',
'alpha') ==
'on' ? 1 : 0;
132 $mine = ((
GETPOST(
'mode') ==
'mine') ? 1 : 0);
134 $search_project_user = $user->id;
145 $search_date_start_startmonth =
GETPOSTINT(
'search_date_start_startmonth');
146 $search_date_start_startyear =
GETPOSTINT(
'search_date_start_startyear');
147 $search_date_start_startday =
GETPOSTINT(
'search_date_start_startday');
148 $search_date_start_start =
dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear);
149 $search_date_start_endmonth =
GETPOSTINT(
'search_date_start_endmonth');
150 $search_date_start_endyear =
GETPOSTINT(
'search_date_start_endyear');
151 $search_date_start_endday =
GETPOSTINT(
'search_date_start_endday');
152 $search_date_start_end =
dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear);
154 $search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
155 $search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
156 $search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
157 $search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
158 $search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
159 $search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
160 $search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
161 $search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
163 $search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
164 $search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
165 $search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
166 $search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
167 $search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
168 $search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
169 $search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
170 $search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
172 $search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
173 $search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
174 $search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
175 $search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
176 $search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
177 $search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
178 $search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
179 $search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
181 $search_category_array = array();
184 $search_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PROJECT.
"_list",
"array");
188 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
190 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
'0,1');
195 $hookmanager->initHooks(array(
'projectlist'));
199 $extrafields->fetch_name_optionals_label(
$object->table_element);
201 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
204 $fieldstosearchall = array();
205 foreach (
$object->fields as $key => $val) {
206 if (empty($val[
'searchall'])) {
211 if (!empty($user->socid) && $key ==
"note_private") {
215 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
219 $fieldstosearchall[
's.nom'] =
"ThirdPartyName";
220 $fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
221 $fieldstosearchall[
's.code_client'] =
"CustomerCode";
224 $arrayfields = array();
225 foreach (
$object->fields as $key => $val) {
227 if (!empty($val[
'visible'])) {
228 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
229 $arrayfields[
'p.'.$key] = array(
230 'label' => $val[
'label'],
231 'checked' => (($visible < 0) ? 0 : 1),
232 'enabled' => (abs($visible) != 3 && (
int)
dol_eval($val[
'enabled'], 1, 1,
'1')),
233 'position' => $val[
'position'],
234 'help' => isset($val[
'help']) ? $val[
'help'] :
''
239 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
242 $arrayfields[
's.nom'] = array(
'label' => $langs->trans(
"ThirdParty"),
'checked' => 1,
'position' => 21,
'enabled' => (!
isModEnabled(
'societe') ? 0 : 1));
243 $arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'checked' => 0,
'position' => 22);
244 $arrayfields[
'commercial'] = array(
'label' => $langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked' => 0,
'position' => 23);
245 $arrayfields[
'c.assigned'] = array(
'label' => $langs->trans(
"AssignedTo"),
'checked' => 1,
'position' => 120);
246 $arrayfields[
'opp_weighted_amount'] = array(
'label' => $langs->trans(
'OpportunityWeightedAmountShort'),
'checked' => 0,
'enabled' => (!
getDolGlobalString(
'PROJECT_USE_OPPORTUNITIES') ? 0 : 1),
'position' => 106);
247 $arrayfields[
'u.login'] = array(
'label' =>
"Author",
'checked' => -1,
'position' => 165);
249 if (
GETPOST(
'search_usage_opportunity')) {
253 if (
GETPOST(
'search_usage_event_organization')) {
254 $arrayfields[
'p.fk_opp_status'][
'enabled'] = 0;
255 $arrayfields[
'p.opp_amount'][
'enabled'] = 0;
256 $arrayfields[
'p.opp_percent'][
'enabled'] = 0;
257 $arrayfields[
'opp_weighted_amount'][
'enabled'] = 0;
258 $arrayfields[
'p.usage_organize_event'][
'visible'] = 1;
259 $arrayfields[
'p.usage_organize_event'][
'checked'] = 1;
261 $arrayfields[
'p.fk_project'][
'enabled'] = 0;
265 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
269 if ($mode ==
'kanban') {
271 $groupbyvalues = array();
272 $groupby =
GETPOST(
'groupby',
'aZ09');
273 $groupbyfield = preg_replace(
'/[a-z]\./',
'', $groupby);
274 if (!empty(
$object->fields[$groupbyfield][
'alias'])) {
275 $groupbyfield =
$object->fields[$groupbyfield][
'alias'];
277 if (!in_array(preg_replace(
'/[a-z]\./',
'', $groupby), array_keys(
$object->fields))) {
280 if (!empty(
$object->fields[$groupby][
'arrayofkeyval'])) {
281 $groupbyvalues =
$object->fields[$groupby][
'arrayofkeyval'];
282 } elseif (!empty(
$object->fields[preg_replace(
'/[a-z]\./',
'', $groupby)][
'arrayofkeyval'])) {
283 $groupbyvalues =
$object->fields[preg_replace(
'/[a-z]\./',
'', $groupby)][
'arrayofkeyval'];
289 $sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label";
290 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
291 $sql .=
" WHERE active = 1";
294 $sql .= $db->order(
'cls.rowid',
'ASC');
295 $resql = $db->query(
$sql);
297 $num = $db->num_rows($resql);
301 $objp = $db->fetch_object($resql);
302 $groupbyvalues[$objp->rowid] = $objp->label;
311 $sortfield = $db->sanitize($groupby).($sortfield ?
",".$sortfield :
"");
312 $sortorder =
"ASC".($sortfield ?
",".$sortorder :
"");
321 if (
GETPOST(
'cancel',
'alpha')) {
325 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
329 $parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
330 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
335 if (empty($reshook)) {
337 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
340 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
344 $search_societe =
"";
345 $search_societe_alias =
'';
347 $search_opp_status = -1;
348 $search_opp_amount =
'';
349 $search_opp_percent =
'';
350 $search_budget_amount =
'';
353 $search_project_user =
'';
354 $search_project_contact =
'';
361 $search_date_start_startmonth =
"";
362 $search_date_start_startyear =
"";
363 $search_date_start_startday =
"";
364 $search_date_start_start =
"";
365 $search_date_start_endmonth =
"";
366 $search_date_start_endyear =
"";
367 $search_date_start_endday =
"";
368 $search_date_start_end =
"";
369 $search_date_end_startmonth =
"";
370 $search_date_end_startyear =
"";
371 $search_date_end_startday =
"";
372 $search_date_end_start =
"";
373 $search_date_end_endmonth =
"";
374 $search_date_end_endyear =
"";
375 $search_date_end_endday =
"";
376 $search_date_end_end =
"";
377 $search_date_creation_startmonth =
"";
378 $search_date_creation_startyear =
"";
379 $search_date_creation_startday =
"";
380 $search_date_creation_start =
"";
381 $search_date_creation_endmonth =
"";
382 $search_date_creation_endyear =
"";
383 $search_date_creation_endday =
"";
384 $search_date_creation_end =
"";
385 $search_date_modif_startmonth =
"";
386 $search_date_modif_startyear =
"";
387 $search_date_modif_startday =
"";
388 $search_date_modif_start =
"";
389 $search_date_modif_endmonth =
"";
390 $search_date_modif_endyear =
"";
391 $search_date_modif_endday =
"";
392 $search_date_modif_end =
"";
393 $search_usage_opportunity =
'';
394 $search_usage_task =
'';
395 $search_usage_bill_time =
'';
396 $search_usage_event_organization =
'';
397 $search_accept_conference_suggestions =
'';
398 $search_accept_booth_suggestions =
'';
399 $search_price_registration =
'';
400 $search_price_booth =
'';
402 $search_import_key =
'';
404 $search_array_options = array();
405 $search_category_array = array();
410 $objectclass =
'Project';
411 $objectlabel =
'Project';
412 $permissiontoread = $user->hasRight(
'projet',
'lire');
413 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
414 $permissiontoadd = $user->hasRight(
'projet',
'creer');
415 $uploaddir = $conf->project->dir_output;
416 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
419 if (!$error && $massaction ==
'close' && $user->hasRight(
'projet',
'creer')) {
422 $objecttmp =
new $objectclass($db);
424 foreach ($toselect as $toselectid) {
425 $result = $objecttmp->fetch($toselectid);
427 $userWrite =
$object->restrictedProjectArea($user,
'write');
428 if ($userWrite > 0 && $objecttmp->statut == 1) {
429 $result = $objecttmp->setClose($user);
437 } elseif ($userWrite <= 0) {
438 setEventMessages($langs->trans(
"DontHavePermissionForCloseProject", $objecttmp->ref),
null,
'warnings');
440 setEventMessages($langs->trans(
"DontHaveTheValidateStatus", $objecttmp->ref),
null,
'warnings');
463 unset($_SESSION[
'pageforbacktolist'][
'project']);
465 $form =
new Form($db);
470 $companystatic =
new Societe($db);
471 $taskstatic =
new Task($db);
474 $userstatic =
new User($db);
476 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
477 $title = $langs->trans(
"LeadsOrProjects");
479 $title = $langs->trans(
"Projects");
482 $title = $langs->trans(
"Leads");
489 $projectsListId =
'';
490 if (!$user->hasRight(
'projet',
'all',
'lire')) {
491 $projectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
495 $listofprojectcontacttype = array();
496 $listofprojectcontacttypeexternal = array();
497 $sql =
"SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
498 $sql .=
" WHERE ctc.element = '".$db->escape(
$object->element).
"'";
499 $resql = $db->query(
$sql);
501 while ($obj = $db->fetch_object($resql)) {
502 if ($obj->source ==
'internal') {
503 $listofprojectcontacttype[$obj->rowid] = $obj->code;
505 $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
511 if (count($listofprojectcontacttype) == 0) {
512 $listofprojectcontacttype[0] =
'0';
514 if (count($listofprojectcontacttypeexternal) == 0) {
515 $listofprojectcontacttypeexternal[0] =
'0';
518 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
519 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
521 $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,";
522 $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,";
523 $sql .=
" p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
524 $sql .=
" p.email_msgid, p.import_key,";
525 $sql .=
" p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,";
526 $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,";
527 $sql .=
" country.code as country_code,";
528 $sql .=
" cls.code as opp_status_code,";
529 $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';
531 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
532 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
533 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
537 $parameters = array();
538 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object);
539 $sql .= $hookmanager->resPrint;
540 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
544 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as p";
545 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
546 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
548 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
549 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on country.rowid = s.fk_pays";
550 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_lead_status as cls on p.fk_opp_status = cls.rowid";
551 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON p.fk_user_creat = u.rowid';
556 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
557 $sql .= $hookmanager->resPrint;
559 $sql .=
" WHERE p.entity IN (".getEntity(
'project', (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
')';
560 if (!$user->hasRight(
'projet',
'all',
'lire')) {
561 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
565 $sql .=
" AND (p.fk_soc = ".((int) $socid).
")";
573 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
576 if ($search_societe) {
579 if ($search_societe_alias) {
583 if ($search_opp_amount) {
586 if ($search_opp_percent) {
592 if ($search_date_start_start) {
593 $sql .=
" AND p.dateo >= '".$db->idate($search_date_start_start).
"'";
595 if ($search_date_start_end) {
596 $sql .=
" AND p.dateo <= '".$db->idate($search_date_start_end).
"'";
599 if ($search_date_end_start) {
600 $sql .=
" AND p.datee >= '".$db->idate($search_date_end_start).
"'";
602 if ($search_date_end_end) {
603 $sql .=
" AND p.datee <= '".$db->idate($search_date_end_end).
"'";
606 if ($search_date_creation_start) {
607 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
609 if ($search_date_creation_end) {
610 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
613 if ($search_date_modif_start) {
614 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
616 if ($search_date_modif_end) {
617 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
623 if ($search_status !=
'' && $search_status !=
'-1') {
624 if ($search_status == 99) {
625 $sql .=
" AND p.fk_statut IN (0,1)";
627 $sql .=
" AND p.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
630 if ($search_opp_status) {
631 if (is_numeric($search_opp_status) && $search_opp_status > 0) {
632 $sql .=
" AND p.fk_opp_status = ".((int) $search_opp_status);
634 if ($search_opp_status ==
'all') {
635 $sql .=
" AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
637 if ($search_opp_status ==
'openedopp') {
638 $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'))";
640 if ($search_opp_status ==
'notopenedopp') {
641 $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'))";
643 if ($search_opp_status ==
'none') {
644 $sql .=
" AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
647 if ($search_public !=
'') {
648 $sql .=
" AND p.public = ".((int) $search_public);
653 if ($search_sale && $search_sale !=
'-1') {
654 if ($search_sale == -2) {
655 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
656 } elseif ($search_sale > 0) {
657 $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).
")";
660 if ($search_project_user > 0) {
661 $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).
")";
663 if ($search_project_contact > 0) {
664 $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).
")";
666 if ($search_opp_amount !=
'') {
669 if ($search_budget_amount !=
'') {
672 if ($search_usage_opportunity !=
'' && $search_usage_opportunity >= 0) {
675 if ($search_usage_task !=
'' && $search_usage_task >= 0) {
678 if ($search_usage_bill_time !=
'' && $search_usage_bill_time >= 0) {
681 if ($search_usage_event_organization !=
'' && $search_usage_event_organization >= 0) {
682 $sql .=
natural_search(
'p.usage_organize_event', $search_usage_event_organization, 2);
684 if ($search_accept_conference_suggestions !=
'' && $search_accept_conference_suggestions >= 0) {
685 $sql .=
natural_search(
'p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
687 if ($search_accept_booth_suggestions !=
'' && $search_accept_booth_suggestions >= 0) {
688 $sql .=
natural_search(
'p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
690 if ($search_price_registration !=
'') {
693 if ($search_price_booth !=
'') {
699 if ($search_import_key) {
703 if ($search_omitChildren == 1) {
704 $sql .=
" AND p.fk_project IS NULL";
709 $searchCategoryProjectList = $search_category_array;
710 $searchCategoryProjectOperator = 0;
711 if (!empty($searchCategoryProjectList)) {
712 $searchCategoryProjectSqlList = array();
713 $listofcategoryid =
'';
714 foreach ($searchCategoryProjectList as $searchCategoryProject) {
715 if (intval($searchCategoryProject) == -2) {
716 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
717 } elseif (intval($searchCategoryProject) > 0) {
718 if ($searchCategoryProjectOperator == 0) {
719 $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).
")";
721 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
725 if ($listofcategoryid) {
726 $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).
"))";
728 if ($searchCategoryProjectOperator == 1) {
729 if (!empty($searchCategoryProjectSqlList)) {
730 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
733 if (!empty($searchCategoryProjectSqlList)) {
734 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
738 $searchCategoryCustomerSqlList = array();
739 if ($searchCategoryCustomerOperator == 1) {
740 $existsCategoryCustomerList = array();
741 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
742 if (intval($searchCategoryCustomer) == -2) {
743 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
744 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
745 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
746 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
747 $sqlCategoryCustomerNotExists .=
" )";
748 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
749 } elseif (intval($searchCategoryCustomer) > 0) {
750 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
753 if (!empty($existsCategoryCustomerList)) {
754 $sqlCategoryCustomerExists =
" EXISTS (";
755 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
756 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
757 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
758 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
759 $sqlCategoryCustomerExists .=
" )";
760 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
762 if (!empty($searchCategoryCustomerSqlList)) {
763 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
766 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
767 if (intval($searchCategoryCustomer) == -2) {
768 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
769 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
770 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
771 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
772 $sqlCategoryCustomerNotExists .=
" )";
773 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
774 } elseif (intval($searchCategoryCustomer) > 0) {
775 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
778 if (!empty($searchCategoryCustomerSqlList)) {
779 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
783 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
785 $parameters = array();
786 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object);
787 $sql .= $hookmanager->resPrint;
791 $nbtotalofrecords =
'';
794 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
795 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
796 $resql = $db->query($sqlforcount);
798 $objforcount = $db->fetch_object($resql);
799 $nbtotalofrecords = $objforcount->nbtotalofrecords;
804 if (($page * $limit) > $nbtotalofrecords) {
812 $sql .= $db->order($sortfield, $sortorder);
814 $sql .= $db->plimit($limit + 1, $offset);
818 $resql = $db->query(
$sql);
824 $num = $db->num_rows($resql);
827 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
828 $obj = $db->fetch_object($resql);
829 header(
"Location: ".DOL_URL_ROOT.
'/projet/card.php?id='.$obj->id);
839 $arrayofselected = is_array($toselect) ? $toselect : array();
843 $param .=
'&mode='.urlencode($mode);
845 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
846 $param .=
'&contextpage='.urlencode($contextpage);
848 if ($limit > 0 && $limit != $conf->liste_limit) {
849 $param .=
'&limit='.((int) $limit);
851 if ($optioncss !=
'') {
852 $param .=
'&optioncss='.urlencode($optioncss);
855 $param .=
'&socid='.urlencode((
string) $socid);
857 if ($search_all !=
'') {
858 $param .=
'&search_all='.urlencode($search_all);
861 $param .=
'&search_sday='.urlencode((
string) ($search_sday));
863 if ($search_smonth) {
864 $param .=
'&search_smonth='.urlencode((
string) ($search_smonth));
867 $param .=
'&search_syear='.urlencode((
string) ($search_syear));
870 $param .=
'&search_eday='.urlencode((
string) ($search_eday));
872 if ($search_emonth) {
873 $param .=
'&search_emonth='.urlencode((
string) ($search_emonth));
876 $param .=
'&search_eyear='.urlencode((
string) ($search_eyear));
878 if ($search_date_start_startmonth) {
879 $param .=
'&search_date_start_startmonth='.urlencode((
string) ($search_date_start_startmonth));
881 if ($search_date_start_startyear) {
882 $param .=
'&search_date_start_startyear='.urlencode((
string) ($search_date_start_startyear));
884 if ($search_date_start_startday) {
885 $param .=
'&search_date_start_startday='.urlencode((
string) ($search_date_start_startday));
887 if ($search_date_start_start) {
888 $param .=
'&search_date_start_start='.urlencode($search_date_start_start);
890 if ($search_date_start_endmonth) {
891 $param .=
'&search_date_start_endmonth='.urlencode((
string) ($search_date_start_endmonth));
893 if ($search_date_start_endyear) {
894 $param .=
'&search_date_start_endyear='.urlencode((
string) ($search_date_start_endyear));
896 if ($search_date_start_endday) {
897 $param .=
'&search_date_start_endday='.urlencode((
string) ($search_date_start_endday));
899 if ($search_date_start_end) {
900 $param .=
'&search_date_start_end='.urlencode($search_date_start_end);
902 if ($search_date_end_startmonth) {
903 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
905 if ($search_date_end_startyear) {
906 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
908 if ($search_date_end_startday) {
909 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
911 if ($search_date_end_start) {
912 $param .=
'&search_date_end_start='.urlencode($search_date_end_start);
914 if ($search_date_end_endmonth) {
915 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
917 if ($search_date_end_endyear) {
918 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
920 if ($search_date_end_endday) {
921 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
923 if ($search_date_end_end) {
924 $param .=
'&search_date_end_end=' . urlencode($search_date_end_end);
926 if ($search_date_creation_startmonth) {
927 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
929 if ($search_date_creation_startyear) {
930 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
932 if ($search_date_creation_startday) {
933 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
935 if ($search_date_creation_start) {
936 $param .=
'&search_date_creation_start='.urlencode($search_date_creation_start);
938 if ($search_date_creation_endmonth) {
939 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
941 if ($search_date_creation_endyear) {
942 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
944 if ($search_date_creation_endday) {
945 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
947 if ($search_date_creation_end) {
948 $param .=
'&search_date_creation_end='.urlencode($search_date_creation_end);
950 if ($search_date_modif_startmonth) {
951 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
953 if ($search_date_modif_startyear) {
954 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
956 if ($search_date_modif_startday) {
957 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
959 if ($search_date_modif_start) {
960 $param .=
'&search_date_modif_start='.urlencode($search_date_modif_start);
962 if ($search_date_modif_endmonth) {
963 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
965 if ($search_date_modif_endyear) {
966 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
968 if ($search_date_modif_endday) {
969 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
971 if ($search_date_modif_end) {
972 $param .=
'&search_date_modif_end=' . urlencode($search_date_modif_end);
974 if (!empty($search_category_array)) {
975 foreach ($search_category_array as $tmpval) {
976 $param .=
'&search_categegory_project_list[]='.urlencode($tmpval);
979 if ($search_ref !=
'') {
980 $param .=
'&search_ref='.urlencode($search_ref);
982 if ($search_label !=
'') {
983 $param .=
'&search_label='.urlencode($search_label);
985 if ($search_societe !=
'') {
986 $param .=
'&search_societe='.urlencode($search_societe);
988 if ($search_societe_alias !=
'') {
989 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
991 if ($search_status !=
'' && $search_status !=
'-1') {
992 $param .=
"&search_status=".urlencode($search_status);
994 if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'openedopp',
'notopenedopp',
'none'))) {
995 $param .=
'&search_opp_status='.urlencode($search_opp_status);
997 if ($search_opp_percent !=
'') {
998 $param .=
'&search_opp_percent='.urlencode($search_opp_percent);
1000 if ($search_public !=
'') {
1001 $param .=
'&search_public='.urlencode($search_public);
1003 if ($search_project_user > 0) {
1004 $param .=
'&search_project_user='.urlencode($search_project_user);
1006 if ($search_project_contact > 0) {
1007 $param .=
'&search_project_contact='.urlencode((
string) ($search_project_contact));
1009 if ($search_sale > 0) {
1010 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1012 if ($search_opp_amount !=
'') {
1013 $param .=
'&search_opp_amount='.urlencode($search_opp_amount);
1015 if ($search_budget_amount !=
'') {
1016 $param .=
'&search_budget_amount='.urlencode($search_budget_amount);
1018 if ($search_usage_task !=
'') {
1019 $param .=
'&search_usage_task='.urlencode($search_usage_task);
1021 if ($search_usage_bill_time !=
'') {
1022 $param .=
'&search_usage_opportunity='.urlencode($search_usage_bill_time);
1024 if ($search_usage_event_organization !=
'') {
1025 $param .=
'&search_usage_event_organization='.urlencode($search_usage_event_organization);
1027 if ($search_accept_conference_suggestions !=
'') {
1028 $param .=
'&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
1030 if ($search_accept_booth_suggestions !=
'') {
1031 $param .=
'&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
1033 if ($search_price_registration !=
'') {
1034 $param .=
'&search_price_registration='.urlencode($search_price_registration);
1036 if ($search_price_booth !=
'') {
1037 $param .=
'&search_price_booth='.urlencode($search_price_booth);
1039 if ($search_login) {
1040 $param .=
'&search_login='.urlencode($search_login);
1042 if ($search_import_key) {
1043 $param .=
'&search_import_key='.urlencode($search_import_key);
1045 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1046 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1049 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1052 $parameters = array(
'param' => &$param);
1053 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
1054 $param .= $hookmanager->resPrint;
1057 $arrayofmassactions = array(
1058 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1059 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1064 if ($user->hasRight(
'projet',
'creer')) {
1065 $arrayofmassactions[
'close'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Close");
1066 $arrayofmassactions[
'preaffectuser'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AffectUser");
1068 if ($user->hasRight(
'projet',
'supprimer')) {
1069 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1071 if (
isModEnabled(
'category') && $user->hasRight(
'projet',
'creer')) {
1072 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1074 if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preaffectuser'))) {
1075 $arrayofmassactions = array();
1078 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1080 $url = DOL_URL_ROOT.
'/projet/card.php?action=create';
1081 if (!empty($socid)) {
1082 $url .=
'&socid='.$socid;
1084 if ($search_usage_event_organization == 1) {
1085 $url .=
'&usage_organize_event=1';
1086 if (((
int) $search_usage_opportunity) < 1) {
1087 $url .=
'&usage_opportunity=0';
1091 $newcardbutton =
'';
1092 $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'));
1093 $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'));
1095 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewProject'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'projet',
'creer'));
1097 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1098 if ($optioncss !=
'') {
1099 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1101 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1102 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1103 print
'<input type="hidden" name="action" value="list">';
1104 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1105 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1106 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1107 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1112 if ($search_project_user == $user->id) {
1113 $texthelp .= $langs->trans(
"MyProjectsDesc");
1115 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
1116 $texthelp .= $langs->trans(
"ProjectsDesc");
1118 $texthelp .= $langs->trans(
"ProjectsPublicDesc");
1122 print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1125 $topicmail =
"Information";
1126 $modelmail =
"project";
1127 $objecttmp =
new Project($db);
1128 $trackid =
'proj'.$object->id;
1129 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1132 foreach ($fieldstosearchall as $key => $val) {
1133 $fieldstosearchall[$key] = $langs->trans($val);
1135 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1138 $moreforfilter =
'';
1141 $moreforfilter .=
'<div class="divsearchfield">';
1142 $tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
1145 if (!$user->hasRight(
'user',
'user',
'lire')) {
1146 $includeonly = array($user->id);
1148 $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');
1149 $moreforfilter .=
'</div>';
1151 $moreforfilter .=
'<div class="divsearchfield">';
1152 $tmptitle = $langs->trans(
'ProjectsWithThisContact');
1153 $moreforfilter .=
img_picto($tmptitle,
'contact',
'class="pictofixedwidth"').$form->select_contact(0, $search_project_contact ? $search_project_contact :
'',
'search_project_contact', $tmptitle,
'',
'', 0,
'maxwidth300 widthcentpercentminusx');
1155 $moreforfilter .=
'</div>';
1158 if ($user->hasRight(
'user',
'user',
'lire')) {
1159 $langs->load(
"commercial");
1160 $moreforfilter .=
'<div class="divsearchfield">';
1161 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1162 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1163 $moreforfilter .=
'</div>';
1167 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1169 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array,
'minwidth300imp minwidth300 widthcentpercentminusx');
1175 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
1180 $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"' :
'').
'"> ';
1183 if (!empty($moreforfilter)) {
1184 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1185 print $moreforfilter;
1186 $parameters = array();
1187 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
1188 print $hookmanager->resPrint;
1192 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1193 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1194 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1195 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1198 print
'<div class="div-table-responsive">';
1199 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1203 print
'<tr class="liste_titre_filter">';
1206 print
'<td class="liste_titre maxwidthsearch">';
1207 $searchpicto = $form->showFilterButtons(
'left');
1212 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1213 print
'<td class="liste_titre">';
1214 print
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'" size="6">';
1218 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1219 print
'<td class="liste_titre">';
1220 print
'<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).
'">';
1224 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1225 print
'<td class="liste_titre">';
1227 $tmpthirdparty =
new Societe($db);
1228 $tmpthirdparty->fetch($socid);
1229 $search_societe = $tmpthirdparty->name;
1231 print
'<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
1236 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1237 print
'<td class="liste_titre">';
1239 $tmpthirdparty =
new Societe($db);
1240 $tmpthirdparty->fetch($socid);
1241 $search_societe_alias = $tmpthirdparty->name_alias;
1243 print
'<input type="text" class="flat" name="search_societe_alias" size="8" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1247 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1248 print
'<td class="liste_titre"> </td>';
1251 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1252 print
'<td class="liste_titre center nowraponall">';
1258 print
'<div class="nowrapfordate">';
1259 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'));
1261 print
'<div class="nowrapfordate">';
1262 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'));
1267 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1268 print
'<td class="liste_titre center nowraponall">';
1274 print
'<div class="nowrapfordate">';
1275 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'));
1277 print
'<div class="nowrapfordate">';
1278 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'));
1283 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1284 print
'<td class="liste_titre center">';
1285 $array = array(
'' =>
'', 0 => $langs->trans(
"PrivateProject"), 1 => $langs->trans(
"SharedProject"));
1286 print $form->selectarray(
'search_public', $array, $search_public, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1289 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1290 print
'<td class="liste_titre center">';
1294 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1295 print
'<td class="liste_titre nowrap center">';
1296 print $formproject->selectOpportunityStatus(
'search_opp_status', $search_opp_status, 1, 1, 1, 0,
'maxwidth125 nowrapoption', 1, 1);
1299 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1300 print
'<td class="liste_titre nowrap right">';
1301 print
'<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.
'">';
1304 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1305 print
'<td class="liste_titre nowrap right">';
1306 print
'<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.
'">';
1309 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1310 print
'<td class="liste_titre nowrap right">';
1313 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1314 print
'<td class="liste_titre nowrap right">';
1315 print
'<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.
'">';
1318 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1319 print
'<td class="liste_titre nowrap">';
1320 print $form->selectyesno(
'search_usage_opportunity', $search_usage_opportunity, 1,
false, 1, 1);
1324 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1325 print
'<td class="liste_titre nowrap">';
1326 print $form->selectyesno(
'search_usage_task', $search_usage_task, 1,
false, 1, 1);
1329 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1330 print
'<td class="liste_titre nowrap">';
1331 print $form->selectyesno(
'search_usage_bill_time', $search_usage_bill_time, 1,
false, 1, 1);
1334 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1335 print
'<td class="liste_titre nowrap">';
1336 print $form->selectyesno(
'search_usage_event_organization', $search_usage_event_organization, 1,
false, 1, 1);
1339 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1340 print
'<td class="liste_titre nowrap">';
1341 print $form->selectyesno(
'search_accept_conference_suggestions', $search_accept_conference_suggestions, 1,
false, 1, 1);
1344 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1345 print
'<td class="liste_titre nowrap">';
1346 print $form->selectyesno(
'search_accept_booth_suggestions', $search_accept_booth_suggestions, 1,
false, 1, 1);
1349 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1350 print
'<td class="liste_titre nowrap right">';
1351 print
'<input type="text" class="flat" name="search_price_registration" size="4" value="'.dol_escape_htmltag($search_price_registration).
'">';
1354 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1355 print
'<td class="liste_titre nowrap right">';
1356 print
'<input type="text" class="flat" name="search_price_booth" size="4" value="'.dol_escape_htmltag($search_price_booth).
'">';
1359 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1361 print
'<td class="liste_titre" align="center">';
1362 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1366 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1369 $parameters = array(
'arrayfields' => $arrayfields);
1370 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1371 print $hookmanager->resPrint;
1373 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1374 print
'<td class="liste_titre center nowraponall">';
1375 print
'<div class="nowrapfordate">';
1376 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'));
1378 print
'<div class="nowrapfordate">';
1379 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'));
1384 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1385 print
'<td class="liste_titre center nowraponall">';
1386 print
'<div class="nowrapfordate">';
1387 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'));
1389 print
'<div class="nowrapfordate">';
1390 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'));
1394 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1396 print
'<td class="liste_titre">';
1399 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1401 print
'<td class="liste_titre">';
1402 print
'<input class="flat width75" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1405 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1406 print
'<td class="liste_titre center parentonrightofpage">';
1407 $formproject->selectProjectsStatus($search_status, 1,
'search_status');
1412 print
'<td class="liste_titre maxwidthsearch">';
1413 $searchpicto = $form->showFilterButtons();
1419 $totalarray = array();
1420 $totalarray[
'nbfield'] = 0;
1424 print
'<tr class="liste_titre">';
1426 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1427 $totalarray[
'nbfield']++;
1429 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1430 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1431 $totalarray[
'nbfield']++;
1433 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1434 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1435 $totalarray[
'nbfield']++;
1437 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1438 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1439 $totalarray[
'nbfield']++;
1441 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1442 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1443 $totalarray[
'nbfield']++;
1445 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1446 print_liste_field_titre($arrayfields[
'commercial'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder,
'tdoverflowmax100imp ');
1447 $totalarray[
'nbfield']++;
1449 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
'p.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"p.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1451 $totalarray[
'nbfield']++;
1453 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1454 print_liste_field_titre($arrayfields[
'p.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1455 $totalarray[
'nbfield']++;
1457 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1458 print_liste_field_titre($arrayfields[
'p.public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.public",
"", $param,
"", $sortfield, $sortorder,
'center ');
1459 $totalarray[
'nbfield']++;
1461 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'c.assigned'][
'label'], $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ',
'');
1463 $totalarray[
'nbfield']++;
1465 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1466 print_liste_field_titre($arrayfields[
'p.fk_opp_status'][
'label'], $_SERVER[
"PHP_SELF"],
'p.fk_opp_status',
"", $param,
'', $sortfield, $sortorder,
'center ');
1467 $totalarray[
'nbfield']++;
1469 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1470 print_liste_field_titre($arrayfields[
'p.opp_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.opp_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1471 $totalarray[
'nbfield']++;
1473 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1474 print_liste_field_titre($arrayfields[
'p.opp_percent'][
'label'], $_SERVER[
'PHP_SELF'],
'p.opp_percent',
"", $param,
'', $sortfield, $sortorder,
'right ');
1475 $totalarray[
'nbfield']++;
1477 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1478 print_liste_field_titre($arrayfields[
'opp_weighted_amount'][
'label'], $_SERVER[
'PHP_SELF'],
'opp_weighted_amount',
'', $param,
'', $sortfield, $sortorder,
'right ');
1479 $totalarray[
'nbfield']++;
1481 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1482 print_liste_field_titre($arrayfields[
'p.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.budget_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1483 $totalarray[
'nbfield']++;
1485 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1486 print_liste_field_titre($arrayfields[
'p.usage_opportunity'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_opportunity',
"", $param,
'', $sortfield, $sortorder,
'');
1487 $totalarray[
'nbfield']++;
1489 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1490 print_liste_field_titre($arrayfields[
'p.usage_task'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_task',
"", $param,
'', $sortfield, $sortorder,
'');
1491 $totalarray[
'nbfield']++;
1493 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1494 print_liste_field_titre($arrayfields[
'p.usage_bill_time'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_bill_time',
"", $param,
'', $sortfield, $sortorder,
'');
1495 $totalarray[
'nbfield']++;
1497 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1498 print_liste_field_titre($arrayfields[
'p.usage_organize_event'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_organize_event',
"", $param,
'', $sortfield, $sortorder,
'');
1499 $totalarray[
'nbfield']++;
1501 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1502 print_liste_field_titre($arrayfields[
'p.accept_conference_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_conference_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1503 $totalarray[
'nbfield']++;
1505 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1506 print_liste_field_titre($arrayfields[
'p.accept_booth_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_booth_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1507 $totalarray[
'nbfield']++;
1509 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1510 print_liste_field_titre($arrayfields[
'p.price_registration'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_registration',
"", $param,
'', $sortfield, $sortorder,
'right ');
1511 $totalarray[
'nbfield']++;
1513 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1514 print_liste_field_titre($arrayfields[
'p.price_booth'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_booth',
"", $param,
'', $sortfield, $sortorder,
'right ');
1515 $totalarray[
'nbfield']++;
1517 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1518 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1519 $totalarray[
'nbfield']++;
1522 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1524 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1525 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
1526 print $hookmanager->resPrint;
1527 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1528 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1529 $totalarray[
'nbfield']++;
1531 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1532 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1533 $totalarray[
'nbfield']++;
1535 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1536 print_liste_field_titre($arrayfields[
'p.email_msgid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email_msgid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1537 $totalarray[
'nbfield']++;
1539 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1540 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'');
1541 $totalarray[
'nbfield']++;
1543 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1544 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1545 $totalarray[
'nbfield']++;
1549 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1550 $totalarray[
'nbfield']++;
1556 $savnbfield = $totalarray[
'nbfield'];
1557 $totalarray = array(
1561 $imaxinloop = ($limit ? min($num, $limit) : $num);
1562 while ($i < $imaxinloop) {
1563 $obj = $db->fetch_object($resql);
1569 $companystatic->id = $obj->socid;
1570 $companystatic->name = $obj->name;
1571 $companystatic->name_alias = $obj->alias;
1572 $companystatic->client = $obj->client;
1573 $companystatic->code_client = $obj->code_client;
1574 $companystatic->email = $obj->email;
1575 $companystatic->phone = $obj->phone;
1576 $companystatic->address = $obj->address;
1577 $companystatic->zip = $obj->zip;
1578 $companystatic->town = $obj->town;
1579 $companystatic->country_code = $obj->country_code;
1585 $object->fk_opp_status = $obj->fk_opp_status;
1586 $object->user_author_id = $obj->fk_user_creat;
1587 $object->date_creation = $db->jdate($obj->date_creation);
1588 $object->date_start = $db->jdate($obj->date_start);
1589 $object->date_end = $db->jdate($obj->date_end);
1590 $object->statut = $obj->status;
1591 $object->status = $obj->status;
1592 $object->public = $obj->public;
1593 $object->opp_percent = $obj->opp_percent;
1594 $object->opp_status = $obj->fk_opp_status;
1595 $object->opp_status_code = $obj->opp_status_code;
1596 $object->opp_amount = !empty($obj->opp_amount) ? $obj->opp_amount :
"";
1597 $object->opp_weighted_amount = $obj->opp_weighted_amount;
1598 $object->budget_amount = $obj->budget_amount;
1599 $object->usage_opportunity = $obj->usage_opportunity;
1600 $object->usage_task = $obj->usage_task;
1601 $object->usage_bill_time = $obj->usage_bill_time;
1602 $object->usage_organize_event = $obj->usage_organize_event;
1603 $object->email_msgid = $obj->email_msgid;
1604 $object->import_key = $obj->import_key;
1605 $object->thirdparty = $companystatic;
1609 $stringassignedusers =
'';
1611 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1613 foreach (array(
'internal',
'external') as $source) {
1614 $tab =
$object->liste_contact(-1, $source, 0,
'', 1);
1615 $numcontact = count($tab);
1616 if (!empty($numcontact)) {
1617 foreach ($tab as $contactproject) {
1619 if ($source ==
'internal') {
1620 if (!empty($conf->cache[
'user'][$contactproject[
'id']])) {
1621 $c = $conf->cache[
'user'][$contactproject[
'id']];
1624 $c->fetch($contactproject[
'id']);
1625 $conf->cache[
'user'][$contactproject[
'id']] = $c;
1628 if (!empty($conf->cache[
'contact'][$contactproject[
'id']])) {
1629 $c = $conf->cache[
'contact'][$contactproject[
'id']];
1632 $c->fetch($contactproject[
'id']);
1633 $conf->cache[
'contact'][$contactproject[
'id']] = $c;
1636 if (get_class($c) ==
'User') {
1637 $stringassignedusers .= $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'',
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1639 $stringassignedusers .= $c->getNomUrl(-2,
'', 0,
'', -1, 0,
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1647 if ($mode ==
'kanban') {
1649 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1652 if (!empty($groupby)) {
1653 if (is_null($groupbyold)) {
1654 print
'<div class="box-flex-container-columns kanban">';
1657 if ($groupbyold !== $obj->$groupbyfield) {
1658 if (!is_null($groupbyold)) {
1665 print
'<div class="box-flex-container-column kanban column" data-html="column_'.preg_replace(
'/[^a-z0-9]/',
'', $obj->$groupbyfield).
'">';
1667 $groupbyold = $obj->$groupbyfield;
1668 } elseif ($i == 0) {
1669 print
'<div class="box-flex-container kanban">';
1674 if ($massactionbutton || $massaction) {
1676 if (in_array(
$object->id, $arrayofselected)) {
1680 $arrayofdata = array(
'assignedusers' => $stringassignedusers,
'thirdparty' => $companystatic,
'selected' => $selected);
1682 print
$object->getKanbanView(
'', $arrayofdata);
1685 if ($i == ($imaxinloop - 1)) {
1687 if (!empty($groupby)) {
1698 $userstatic->id = $obj->fk_user_creat;
1699 $userstatic->login = $obj->login;
1700 $userstatic->lastname = $obj->lastname;
1701 $userstatic->firstname = $obj->firstname;
1702 $userstatic->email = $obj->user_email;
1703 $userstatic->status = $obj->user_statut;
1704 $userstatic->entity = $obj->entity;
1705 $userstatic->photo = $obj->photo;
1706 $userstatic->office_phone = $obj->office_phone;
1707 $userstatic->office_fax = $obj->office_fax;
1708 $userstatic->user_mobile = $obj->user_mobile;
1709 $userstatic->job = $obj->job;
1710 $userstatic->gender = $obj->gender;
1714 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1717 print
'<td class="nowrap center">';
1718 if ($massactionbutton || $massaction) {
1720 if (in_array(
$object->id, $arrayofselected)) {
1723 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1727 $totalarray[
'nbfield']++;
1731 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1732 print
'<td class="nowraponall tdoverflowmax200">';
1733 print
$object->getNomUrl(1, (!empty(
GETPOSTINT(
'search_usage_event_organization')) ?
'eventorganization' :
''));
1739 $totalarray[
'nbfield']++;
1743 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1744 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).
'">';
1748 $totalarray[
'nbfield']++;
1752 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1753 print
'<td class="tdoverflowmax125">';
1755 print $companystatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1761 $totalarray[
'nbfield']++;
1765 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1766 print
'<td class="tdoverflowmax100">';
1768 print $companystatic->name_alias;
1774 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1779 print
'<td class="tdoverflowmax150">';
1781 $companystatic->id = $obj->socid;
1782 $companystatic->name = $obj->name;
1783 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1784 $nbofsalesrepresentative = count($listsalesrepresentatives);
1785 if ($nbofsalesrepresentative > 6) {
1787 print $nbofsalesrepresentative;
1788 } elseif ($nbofsalesrepresentative > 0) {
1789 $userstatic =
new User($db);
1791 foreach ($listsalesrepresentatives as $val) {
1792 $userstatic->id = $val[
'id'];
1793 $userstatic->lastname = $val[
'lastname'];
1794 $userstatic->firstname = $val[
'firstname'];
1795 $userstatic->email = $val[
'email'];
1796 $userstatic->status = $val[
'statut'];
1797 $userstatic->entity = $val[
'entity'];
1798 $userstatic->photo = $val[
'photo'];
1799 $userstatic->login = $val[
'login'];
1800 $userstatic->office_phone = $val[
'office_phone'];
1801 $userstatic->office_fax = $val[
'office_fax'];
1802 $userstatic->user_mobile = $val[
'user_mobile'];
1803 $userstatic->job = $val[
'job'];
1804 $userstatic->gender = $val[
'gender'];
1805 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1807 if ($j < $nbofsalesrepresentative) {
1818 $totalarray[
'nbfield']++;
1823 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1824 print
'<td class="center">';
1828 $totalarray[
'nbfield']++;
1832 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1833 print
'<td class="center">';
1837 $totalarray[
'nbfield']++;
1842 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1843 print
'<td class="center">';
1845 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1848 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1853 $totalarray[
'nbfield']++;
1857 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1858 print
'<td class="center nowraponall tdoverflowmax200">';
1859 print $stringassignedusers;
1862 $totalarray[
'nbfield']++;
1866 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1868 if ($obj->opp_status_code) {
1869 $s = $langs->trans(
"OppStatus".$obj->opp_status_code);
1870 if (empty($arrayfields[
'p.opp_percent'][
'checked']) && $obj->opp_percent) {
1871 $s .=
' ('.dol_escape_htmltag(
price2num($obj->opp_percent, 1)).
'%)';
1874 print
'<td class="center tdoverflowmax150" title="'.$s.
'">';
1878 $totalarray[
'nbfield']++;
1882 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1883 print
'<td class="right">';
1885 if (isset($obj->opp_amount) && strcmp($obj->opp_amount,
'')) {
1886 print
'<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1887 if (!isset($totalarray[
'val'][
'p.opp_amount'])) {
1888 $totalarray[
'val'][
'p.opp_amount'] = $obj->opp_amount;
1890 $totalarray[
'val'][
'p.opp_amount'] += $obj->opp_amount;
1895 $totalarray[
'nbfield']++;
1898 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.opp_amount';
1902 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1903 print
'<td class="right">';
1904 if ($obj->opp_percent) {
1905 print
price($obj->opp_percent, 1, $langs, 1, 0).
'%';
1909 $totalarray[
'nbfield']++;
1913 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1914 if (!isset($totalarray[
'val'][
'opp_weighted_amount'])) {
1915 $totalarray[
'val'][
'opp_weighted_amount'] = 0;
1917 print
'<td align="right">';
1918 if ($obj->opp_weighted_amount) {
1919 print
'<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1920 $totalarray[
'val'][
'opp_weighted_amount'] += $obj->opp_weighted_amount;
1924 $totalarray[
'nbfield']++;
1925 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'opp_weighted_amount';
1929 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1930 print
'<td class="right">';
1931 if ($obj->budget_amount !=
'') {
1932 print
'<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).
'</span>';
1933 if (!isset($totalarray[
'val'][
'p.budget_amount'])) {
1934 $totalarray[
'val'][
'p.budget_amount'] = $obj->budget_amount;
1936 $totalarray[
'val'][
'p.budget_amount'] += $obj->budget_amount;
1941 $totalarray[
'nbfield']++;
1942 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.budget_amount';
1946 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1947 print
'<td class="">';
1948 if ($obj->usage_opportunity) {
1949 print
yn($obj->usage_opportunity);
1953 $totalarray[
'nbfield']++;
1957 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1958 print
'<td class="">';
1959 if ($obj->usage_task) {
1960 print
yn($obj->usage_task);
1964 $totalarray[
'nbfield']++;
1968 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1969 print
'<td class="">';
1970 if ($obj->usage_bill_time) {
1971 print
yn($obj->usage_bill_time);
1975 $totalarray[
'nbfield']++;
1979 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1980 print
'<td class="">';
1981 if ($obj->usage_organize_event) {
1982 print
yn($obj->usage_organize_event);
1986 $totalarray[
'nbfield']++;
1990 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1991 print
'<td class="">';
1992 if ($obj->accept_conference_suggestions) {
1993 print
yn($obj->accept_conference_suggestions);
1997 $totalarray[
'nbfield']++;
2001 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
2002 print
'<td class="">';
2003 if ($obj->accept_booth_suggestions) {
2004 print
yn($obj->accept_booth_suggestions);
2008 $totalarray[
'nbfield']++;
2012 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
2013 print
'<td class="right">';
2014 if ($obj->price_registration !=
'') {
2015 print
'<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).
'</span>';
2016 $totalarray[
'val'][
'p.price_registration'] += $obj->price_registration;
2020 $totalarray[
'nbfield']++;
2023 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_registration';
2027 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
2028 print
'<td class="right">';
2029 if ($obj->price_booth !=
'') {
2030 print
'<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).
'</span>';
2031 $totalarray[
'val'][
'p.price_booth'] += $obj->price_booth;
2035 $totalarray[
'nbfield']++;
2038 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_booth';
2042 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2043 print
'<td class="center tdoverflowmax150">';
2044 if ($userstatic->id) {
2045 print $userstatic->getNomUrl(-1);
2049 $totalarray[
'nbfield']++;
2053 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2055 $parameters = array(
'arrayfields' => $arrayfields,
'object' =>
$object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2056 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
2057 print $hookmanager->resPrint;
2059 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2060 print
'<td class="center nowraponall">';
2061 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2064 $totalarray[
'nbfield']++;
2068 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2069 print
'<td class="center nowraponall">';
2070 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2073 $totalarray[
'nbfield']++;
2077 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
2078 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->email_msgid).
'">';
2082 $totalarray[
'nbfield']++;
2086 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2087 print
'<td class="right">'.dol_escape_htmltag($obj->import_key).
'</td>';
2089 $totalarray[
'nbfield']++;
2093 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2094 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
2096 $totalarray[
'nbfield']++;
2101 print
'<td class="nowrap center">';
2102 if ($massactionbutton || $massaction) {
2104 if (in_array(
$object->id, $arrayofselected)) {
2107 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2111 $totalarray[
'nbfield']++;
2122 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2127 foreach ($arrayfields as $key => $val) {
2128 if (!empty($val[
'checked'])) {
2132 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2137 $parameters = array(
'arrayfields' => $arrayfields,
'sql' =>
$sql);
2138 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
2139 print $hookmanager->resPrint;
2141 print
'</table>'.
"\n";
2142 print
'</div>'.
"\n";
2144 print
'</form>'.
"\n";
2146 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2147 $hidegeneratedfilelistifempty = 1;
2148 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2149 $hidegeneratedfilelistifempty = 0;
2152 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2156 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2157 $urlsource .= str_replace(
'&',
'&', $param);
2159 $filedir = $diroutputmassaction;
2160 $genallowed = $permissiontoread;
2161 $delallowed = $permissiontoadd;
2163 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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.