38require
'../main.inc.php';
46require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
58$langs->loadLangs(array(
'projects',
'companies',
'commercial'));
60 $langs->loadLangs(array(
'eventorganization'));
63$action =
GETPOST(
'action',
'aZ09');
64$massaction =
GETPOST(
'massaction',
'alpha');
66$confirm =
GETPOST(
'confirm',
'alpha');
67$toselect =
GETPOST(
'toselect',
'array:int');
68$optioncss =
GETPOST(
'optioncss',
'alpha');
69$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'projectlist';
70$mode =
GETPOST(
'mode',
'alpha');
71$groupby =
GETPOST(
'groupby',
'aZ09');
73$title = $langs->trans(
"Projects");
76$diroutputmassaction =
$conf->project->dir_output.
'/temp/massgeneration/'.$user->id;
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
82if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
92$offset = $limit * $page;
96$search_all =
GETPOST(
'search_all',
'alphanohtml');
98$search_id =
GETPOST(
"search_id",
'alpha');
99$search_ref =
GETPOST(
"search_ref",
'alpha');
100$search_label =
GETPOST(
"search_label",
'alpha');
101$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
102$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
103$search_societe =
GETPOST(
"search_societe",
'alpha');
104$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
105$search_societe_country =
GETPOST(
"search_societe_country",
'alpha');
106$search_societe_ref_customer =
GETPOST(
"search_societe_ref_customer",
'alpha');
107$search_societe_ref_supplier =
GETPOST(
"search_societe_ref_supplier",
'alpha');
108$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
109$search_opp_percent =
GETPOST(
"search_opp_percent",
'alpha');
110$search_opp_amount =
GETPOST(
"search_opp_amount",
'alpha');
111$search_budget_amount =
GETPOST(
"search_budget_amount",
'alpha');
112$search_parent_ref =
GETPOST(
'search_parent_ref',
'alpha');
113$search_parent_label =
GETPOST(
'search_parent_label',
'alpha');
114$search_public =
GETPOST(
"search_public",
'intcomma');
115$search_project_user =
GETPOSTINT(
'search_project_user');
116$search_project_contact =
GETPOSTINT(
'search_project_contact');
118$search_usage_opportunity =
GETPOST(
'search_usage_opportunity',
'intcomma');
119$search_usage_task =
GETPOST(
'search_usage_task',
'intcomma');
120$search_usage_bill_time =
GETPOST(
'search_usage_bill_time',
'intcomma');
121$search_usage_event_organization =
GETPOST(
'search_usage_event_organization',
'intcomma');
122$search_accept_conference_suggestions =
GETPOST(
'search_accept_conference_suggestions',
'intcomma');
123$search_accept_booth_suggestions =
GETPOST(
'search_accept_booth_suggestions',
'intcomma');
124$search_price_registration =
GETPOST(
"search_price_registration",
'alpha');
125$search_price_booth =
GETPOST(
"search_price_booth",
'alpha');
126$search_login =
GETPOST(
'search_login',
'alpha');
127$search_import_key =
GETPOST(
'search_import_key',
'alpha');
129$searchCategoryUserOperator = 0;
131 $searchCategoryUserOperator =
GETPOSTINT(
'search_category_user_operator');
133 $searchCategoryUserOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_USER_OR_BY_DEFAULT');
136$searchCategoryProjectOperator = 0;
138 $searchCategoryProjectOperator =
GETPOSTINT(
'search_category_project_operator');
140 $searchCategoryProjectOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_PROJECT_OR_BY_DEFAULT');
153$search_omitChildren = 0;
155 $search_omitChildren =
GETPOST(
'search_omitChildren',
'alpha') ==
'on' ? 1 : 0;
159$permissiontoread = 0;
163$mine = ((
GETPOST(
'mode') ==
'mine') ? 1 : 0);
165 $search_project_user = $user->id;
176$search_date_start_startmonth =
GETPOSTINT(
'search_date_start_startmonth');
177$search_date_start_startyear =
GETPOSTINT(
'search_date_start_startyear');
178$search_date_start_startday =
GETPOSTINT(
'search_date_start_startday');
179$search_date_start_start =
GETPOSTDATE(
'search_date_start_start');
180$search_date_start_endmonth =
GETPOSTINT(
'search_date_start_endmonth');
181$search_date_start_endyear =
GETPOSTINT(
'search_date_start_endyear');
182$search_date_start_endday =
GETPOSTINT(
'search_date_start_endday');
183$search_date_start_end =
GETPOSTDATE(
'search_date_start_end',
'end');
185$search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
186$search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
187$search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
188$search_date_end_start =
GETPOSTDATE(
'search_date_end_start');
189$search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
190$search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
191$search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
192$search_date_end_end =
GETPOSTDATE(
'search_date_end_end',
'end');
195$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
196$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
197$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
198$search_date_creation_start =
GETPOSTDATE(
'search_date_creation_start');
199$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
200$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
201$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
202$search_date_creation_end =
GETPOSTDATE(
'search_date_creation_end',
'end');
204$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
205$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
206$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
207$search_date_modif_start =
GETPOSTDATE(
'search_date_modif_start');
208$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
209$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
210$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
211$search_date_modif_end =
GETPOSTDATE(
'search_date_modif_end',
'end');
213$search_category_array = array();
214$search_category_user_array = array();
217 $search_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PROJECT.
"_list",
"array");
218 $search_category_user_array =
GETPOST(
"search_category_".Categorie::TYPE_USER.
"_list",
"array");
222 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
224 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') : (
GETPOSTISSET(
'search_all') ?
'' :
'0,1'));
227$search_option =
GETPOST(
'search_option',
'alpha');
228if ($search_option ==
'late') {
229 $search_status =
'1';
233$hookmanager->initHooks(array(
'projectlist'));
237$extrafields->fetch_name_optionals_label(
$object->table_element);
239$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
241$fieldstosearchall = array();
243foreach (
$object->fields as $key => $val) {
244 if (empty($val[
'searchall'])) {
249 if (!empty($user->socid) && $key ==
"note_private") {
253 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
257$fieldstosearchall[
's.nom'] =
"ThirdPartyName";
258$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
259$fieldstosearchall[
's.code_client'] =
"CustomerCode";
263$arrayfields = array();
264foreach (
$object->fields as $key => $val) {
266 if (!empty($val[
'visible'])) {
267 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
268 $arrayfields[$tableprefix.
'.'.$key] = array(
269 'label' => $val[
'label'],
270 'checked' => (($visible < 0) ?
'0' :
'1'),
271 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
272 'position' => $val[
'position'],
273 'help' => isset($val[
'help']) ? $val[
'help'] :
''
278include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
281$arrayfields[
's.nom'] = array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 21,
'enabled' => (!
isModEnabled(
'societe') ?
'0' :
'1'));
282$arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'checked' =>
'0',
'position' => 22);
283$arrayfields[
's.code_client'] = array(
'label' =>
"RefCustomer",
'checked' =>
'0',
'position' => 23);
284$arrayfields[
's.code_fournisseur'] = array(
'label' =>
"RefSupplier",
'checked' =>
'0',
'position' => 24);
285$arrayfields[
'co.country_code'] = array(
'label' =>
"Country",
'checked' =>
'-1',
'position' => 25);
286$arrayfields[
'commercial'] = array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 26);
287$arrayfields[
'c.assigned'] = array(
'label' =>
"AssignedTo",
'checked' =>
'1',
'position' => 120);
288$arrayfields[
'opp_weighted_amount'] = array(
'label' =>
'OpportunityWeightedAmountShort',
'checked' =>
'0',
'enabled' => (!
getDolGlobalString(
'PROJECT_USE_OPPORTUNITIES') ?
'0' :
'1'),
'position' => 106);
289$arrayfields[
'u.login'] = array(
'label' =>
"Author",
'checked' =>
'-1',
'position' => 165);
290$arrayfields[
'p.note_public'] = array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 170,
'enabled' => (
string) (
int) (!
getDolGlobalString(
'MAIN_LIST_HIDE_PUBLIC_NOTES')));
291$arrayfields[
'p.note_private'] = array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 171,
'enabled' => (
string) (
int) (!
getDolGlobalString(
'MAIN_LIST_HIDE_PRIVATE_NOTES')));
297if (
GETPOST(
'search_usage_event_organization')) {
298 if (array_key_exists(
'p.fk_opp_status', $arrayfields)) {
299 $arrayfields[
'p.fk_opp_status'][
'enabled'] =
'0';
301 if (array_key_exists(
'p.fk_opp_amount', $arrayfields)) {
302 $arrayfields[
'p.opp_amount'][
'enabled'] =
'0';
304 if (array_key_exists(
'p.fk_opp_percent', $arrayfields)) {
305 $arrayfields[
'p.opp_percent'][
'enabled'] =
'0';
307 $arrayfields[
'opp_weighted_amount'][
'enabled'] =
'0';
308 if (array_key_exists(
'p.usage_organize_event', $arrayfields)) {
309 $arrayfields[
'p.usage_organize_event'][
'visible'] =
'1';
310 $arrayfields[
'p.usage_organize_event'][
'checked'] =
'1';
315if ($contextpage ==
'lead') {
316 if (array_key_exists(
'p.fk_opp_status', $arrayfields)) {
317 $arrayfields[
'p.fk_opp_status'][
'enabled'] =
'1';
318 $arrayfields[
'p.fk_opp_status'][
'visible'] =
'1';
323$parameters = array(
'arrayfields' => &$arrayfields);
324$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
331$groupbyvalues = array();
332$groupofcollpasedvalues = array();
334if ($mode ==
'kanbangroupby' && $groupby) {
335 $groupbyfield = preg_replace(
'/[a-z]+\./',
'', $groupby);
336 if (!empty(
$object->fields[$groupbyfield][
'alias'])) {
337 $groupbyfield =
$object->fields[$groupbyfield][
'alias'];
339 if (!in_array(preg_replace(
'/[a-z]+\./',
'', $groupby), array_keys(
$object->fields))) {
342 if (!empty(
$object->fields[$groupby][
'arrayofkeyval'])) {
343 $groupbyvalues =
$object->fields[$groupby][
'arrayofkeyval'];
344 } elseif (!empty(
$object->fields[preg_replace(
'/[a-z]\./',
'', $groupby)][
'arrayofkeyval'])) {
345 $groupbyvalues =
$object->fields[preg_replace(
'/[a-z]\./',
'', $groupby)][
'arrayofkeyval'];
352 $sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label, cls.position";
353 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
354 $sql .=
" WHERE active = 1";
357 $sql .= $db->order(
'cls.position,cls.rowid',
'ASC');
358 $resql = $db->query($sql);
360 $num = $db->num_rows($resql);
363 while ($i < ($num + 1)) {
364 $objp = $db->fetch_object($resql);
366 $labeloppstatus = ($langs->transnoentitiesnoconv(
"OppStatus".$objp->code) !=
"OppStatus".$objp->code ? $langs->transnoentitiesnoconv(
"OppStatus".$objp->code) : $objp->label);
367 $groupbyvalues[$i] = array(
'id' => (
string) $objp->rowid,
'label' => $labeloppstatus);
369 if ($objp->code ==
'WON') {
370 $groupofcollpasedvalues[$i] = array(
'id' => (
string) $objp->rowid,
'label' => $labeloppstatus);
371 } elseif ($objp->code ==
'LOST') {
372 $groupofcollpasedvalues[$i] = array(
'id' => (
string) $objp->rowid,
'label' => $labeloppstatus);
385 $groupbystringforsql = $groupby;
387 if ($groupby ==
'p.fk_opp_status') {
388 $groupbystringforsql =
'cls.position,p.fk_opp_status';
391 if ($groupbystringforsql && !preg_match(
'/^'.preg_quote($db->sanitize($groupbystringforsql),
'/').
'/', $sortfield)) {
392 $sortfield = $db->sanitize($groupbystringforsql).($sortfield ?
",".$sortfield :
"");
393 $sortorder =
"ASC".($sortfield ?
",".$sortorder :
"");
403 $title .=
' (<a href="list.php">'.$soc->name.
'</a>)';
406if (!$user->hasRight(
'project',
'read')) {
416if (
GETPOST(
'cancel',
'alpha')) {
420if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
424$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
425$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
427 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
430if (empty($reshook)) {
432 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
435 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
440 $search_note_public =
'';
441 $search_note_private =
'';
442 $search_societe =
"";
443 $search_societe_ref_customer =
"";
444 $search_societe_ref_supplier =
"";
445 $search_societe_alias =
'';
446 $search_societe_country =
'';
449 $search_opp_status = -1;
450 $search_opp_amount =
'';
451 $search_opp_percent =
'';
452 $search_budget_amount =
'';
453 $search_parent_ref =
'';
454 $search_parent_label =
'';
457 $search_project_user =
'';
458 $search_project_contact =
'';
465 $search_date_start_startmonth =
"";
466 $search_date_start_startyear =
"";
467 $search_date_start_startday =
"";
468 $search_date_start_start =
"";
469 $search_date_start_endmonth =
"";
470 $search_date_start_endyear =
"";
471 $search_date_start_endday =
"";
472 $search_date_start_end =
"";
473 $search_date_end_startmonth =
"";
474 $search_date_end_startyear =
"";
475 $search_date_end_startday =
"";
476 $search_date_end_start =
"";
477 $search_date_end_endmonth =
"";
478 $search_date_end_endyear =
"";
479 $search_date_end_endday =
"";
480 $search_date_end_end =
"";
481 $search_date_creation_startmonth =
"";
482 $search_date_creation_startyear =
"";
483 $search_date_creation_startday =
"";
484 $search_date_creation_start =
"";
485 $search_date_creation_endmonth =
"";
486 $search_date_creation_endyear =
"";
487 $search_date_creation_endday =
"";
488 $search_date_creation_end =
"";
489 $search_date_modif_startmonth =
"";
490 $search_date_modif_startyear =
"";
491 $search_date_modif_startday =
"";
492 $search_date_modif_start =
"";
493 $search_date_modif_endmonth =
"";
494 $search_date_modif_endyear =
"";
495 $search_date_modif_endday =
"";
496 $search_date_modif_end =
"";
497 $search_usage_opportunity =
'';
498 $search_usage_task =
'';
499 $search_usage_bill_time =
'';
500 $search_usage_event_organization =
'';
501 $search_accept_conference_suggestions =
'';
502 $search_accept_booth_suggestions =
'';
503 $search_price_registration =
'';
504 $search_price_booth =
'';
506 $search_import_key =
'';
509 $search_array_options = array();
510 $search_category_array = array();
511 $search_category_user_array = array();
516 $objectclass =
'Project';
517 $objectlabel =
'Project';
518 $permissiontoread = $user->hasRight(
'projet',
'lire');
519 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
520 $permissiontoadd = $user->hasRight(
'projet',
'creer');
521 $uploaddir =
$conf->project->dir_output;
524 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
527 if (!$error && $massaction ==
'close' && $user->hasRight(
'projet',
'creer')) {
530 $objecttmp =
new $objectclass($db);
532 foreach ($toselect as $toselectid) {
533 $result = $objecttmp->fetch($toselectid);
535 $userWrite =
$object->restrictedProjectArea($user,
'write');
536 if ($userWrite > 0 && $objecttmp->statut == 1) {
537 $result = $objecttmp->setClose($user);
539 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
545 } elseif ($userWrite <= 0) {
546 setEventMessages($langs->trans(
"DontHavePermissionForCloseProject", $objecttmp->ref),
null,
'warnings');
548 setEventMessages($langs->trans(
"DontHaveTheValidateStatus", $objecttmp->ref),
null,
'warnings');
551 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
558 setEventMessages($langs->trans(
"RecordsClosed", $nbok),
null,
'mesgs');
571unset($_SESSION[
'pageforbacktolist'][
'project']);
573$form =
new Form($db);
575$companystatic =
new Societe($db);
576$taskstatic =
new Task($db);
579$userstatic =
new User($db);
583$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
584$title = $langs->trans(
"LeadsOrProjects");
586 $title = $langs->trans(
"Projects");
589 $title = $langs->trans(
"Leads");
597if (!$user->hasRight(
'projet',
'all',
'lire')) {
598 $projectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
602$listofprojectcontacttype = array();
603$listofprojectcontacttypeexternal = array();
604$sql =
"SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
605$sql .=
" WHERE ctc.element = '".$db->escape(
$object->element).
"'";
606$resql = $db->query($sql);
608 while ($obj = $db->fetch_object($resql)) {
609 if ($obj->source ==
'internal') {
610 $listofprojectcontacttype[$obj->rowid] = $obj->code;
612 $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
616 dol_print_error($db);
618if (count($listofprojectcontacttype) == 0) {
619 $listofprojectcontacttype[0] =
'0';
621if (count($listofprojectcontacttypeexternal) == 0) {
622 $listofprojectcontacttypeexternal[0] =
'0';
625$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
626$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
631$sql .=
" p.rowid as id, p.ref, p.title, p.fk_statut as status, cls.position, p.fk_project, ";
632$sql .= $db->ifsql(
"p.fk_opp_status IS NULL",
"0",
"p.fk_opp_status").
" as fk_opp_status, p.public, p.fk_user_creat,";
633$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,";
634$sql .=
" p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
635$sql .=
" p.email_msgid, p.import_key,";
636$sql .=
" p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,";
637$sql .=
" p.note_public, p.note_private,";
638$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, s.code_fournisseur,";
639$sql .=
" country.code as country_code,";
640$sql .=
" cls.code as opp_status_code,";
641$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';
643if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
644 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
645 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
649$parameters = array();
650$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
651$sql .= $hookmanager->resPrint;
652$sql = preg_replace(
'/,\s*$/',
'', $sql);
656$sql .=
" FROM ".$db->prefix().$object->table_element.
" as p";
657if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
658 $sql .=
" LEFT JOIN ".$db->prefix().$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
660$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
661$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on country.rowid = s.fk_pays";
662$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_lead_status as cls on p.fk_opp_status = cls.rowid";
663$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON p.fk_user_creat = u.rowid';
664$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.$object->table_element.
' AS pa ON p.fk_project = pa.rowid';
669$parameters = array();
670$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
671$sql .= $hookmanager->resPrint;
672if ($search_entity > 0) {
673 $sql .=
" WHERE p.entity = ".((int) $search_entity);
675 $sql .=
" WHERE p.entity IN (".getEntity(
'project').
')';
677if (!$user->hasRight(
'projet',
'all',
'lire')) {
678 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
682 $sql .=
" AND (p.fk_soc = ".((int) $socid).
")";
693if ($search_note_public !=
'') {
696if ($search_note_private !=
'') {
699if ($search_parent_ref) {
702if ($search_parent_label) {
705if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
706 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
708 if ($search_societe) {
711 if ($search_societe_alias) {
715if ($search_societe_ref_customer) {
716 $sql .=
natural_search(
's.code_client', $search_societe_ref_customer);
718if ($search_societe_ref_supplier) {
719 $sql .=
natural_search(
's.code_fournisseur', $search_societe_ref_supplier);
721if ($search_societe_country) {
724if ($search_opp_amount) {
727if ($search_opp_percent) {
730$sql .=
dolSqlDateFilter(
'p.dateo', $search_sday, $search_smonth, $search_syear);
731$sql .=
dolSqlDateFilter(
'p.datee', $search_eday, $search_emonth, $search_eyear);
733if ($search_date_start_start) {
734 $sql .=
" AND p.dateo >= '".$db->idate($search_date_start_start).
"'";
736if ($search_date_start_end) {
737 $sql .=
" AND p.dateo <= '".$db->idate($search_date_start_end).
"'";
740if ($search_date_end_start) {
741 $sql .=
" AND p.datee >= '".$db->idate($search_date_end_start).
"'";
743if ($search_date_end_end) {
744 $sql .=
" AND p.datee <= '".$db->idate($search_date_end_end).
"'";
747if ($search_date_creation_start) {
748 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
750if ($search_date_creation_end) {
751 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
754if ($search_date_modif_start) {
755 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
757if ($search_date_modif_end) {
758 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
762 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
764if ($search_status !=
'' && $search_status !=
'-1') {
765 if ($search_status == 99) {
766 $sql .=
" AND p.fk_statut IN (0,1)";
768 $sql .=
" AND p.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
771if ($search_option ==
'late') {
772 $sql .=
" AND p.datee < '".$db->idate(
dol_now() -
$conf->project->warning_delay).
"'";
774if ($search_opp_status) {
775 if (is_numeric($search_opp_status) && $search_opp_status > 0) {
776 $sql .=
" AND p.fk_opp_status = ".((int) $search_opp_status);
778 if ($search_opp_status ==
'all') {
779 $sql .=
" AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
781 if ($search_opp_status ==
'openedopp') {
782 $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'))";
784 if ($search_opp_status ==
'notopenedopp') {
785 $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'))";
787 if ($search_opp_status ==
'none') {
788 $sql .=
" AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
791if ($search_public !=
'') {
792 $sql .=
" AND p.public = ".((int) $search_public);
797if ($search_sale && $search_sale !=
'-1') {
798 if ($search_sale == -2) {
799 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
800 } elseif ($search_sale > 0) {
801 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
804if ($search_project_user > 0) {
805 $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).
")";
807if ($search_project_contact > 0) {
808 $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).
")";
810if ($search_opp_amount !=
'') {
813if ($search_budget_amount !=
'') {
814 $sql .=
natural_search(
'p.budget_amount', $search_budget_amount, 1);
816if ($search_usage_opportunity !=
'' && $search_usage_opportunity >= 0) {
817 $sql .=
natural_search(
'p.usage_opportunity', $search_usage_opportunity, 2);
819if ($search_usage_task !=
'' && $search_usage_task >= 0) {
822if ($search_usage_bill_time !=
'' && $search_usage_bill_time >= 0) {
823 $sql .=
natural_search(
'p.usage_bill_time', $search_usage_bill_time, 2);
825if ($search_usage_event_organization !=
'' && $search_usage_event_organization >= 0) {
826 $sql .=
natural_search(
'p.usage_organize_event', $search_usage_event_organization, 2);
828if ($search_accept_conference_suggestions !=
'' && $search_accept_conference_suggestions >= 0) {
829 $sql .=
natural_search(
'p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
831if ($search_accept_booth_suggestions !=
'' && $search_accept_booth_suggestions >= 0) {
832 $sql .=
natural_search(
'p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
834if ($search_price_registration !=
'') {
835 $sql .=
natural_search(
'p.price_registration', $search_price_registration, 1);
837if ($search_price_booth !=
'') {
841 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
843if ($search_import_key) {
844 $sql .=
natural_search(array(
'p.import_key'), $search_import_key);
847 if ($search_omitChildren == 1) {
848 $sql .=
" AND p.fk_project IS NULL";
853$searchCategoryUserList = $search_category_user_array;
854if (!empty($searchCategoryUserList)) {
855 $searchCategoryUserSqlList = array();
856 $listofcategoryid =
'';
857 foreach ($searchCategoryUserList as $searchCategoryUser) {
858 if (intval($searchCategoryUser) == -2) {
859 $searchCategoryUserSqlList[] =
"NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user)";
860 } elseif (intval($searchCategoryUser) > 0) {
861 if ($searchCategoryUserOperator == 0) {
862 $searchCategoryUserSqlList[] =
" EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).
")";
864 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryUser);
868 if ($listofcategoryid) {
869 $searchCategoryUserSqlList[] =
" EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_User AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
871 if ($searchCategoryUserOperator == 1) {
872 if (!empty($searchCategoryUserSqlList)) {
873 $sql .=
" AND (".implode(
' OR ', $searchCategoryUserSqlList).
")";
876 if (!empty($searchCategoryUserSqlList)) {
877 $sql .=
" AND (".implode(
' AND ', $searchCategoryUserSqlList).
")";
883$searchCategoryProjectList = $search_category_array;
884if (!empty($searchCategoryProjectList)) {
885 $searchCategoryProjectSqlList = array();
886 $listofcategoryid =
'';
887 foreach ($searchCategoryProjectList as $searchCategoryProject) {
888 if (intval($searchCategoryProject) == -2) {
889 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
890 } elseif (intval($searchCategoryProject) > 0) {
891 if ($searchCategoryProjectOperator == 0) {
892 $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).
")";
894 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
898 if ($listofcategoryid) {
899 $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).
"))";
901 if ($searchCategoryProjectOperator == 1) {
902 if (!empty($searchCategoryProjectSqlList)) {
903 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
906 if (!empty($searchCategoryProjectSqlList)) {
907 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
961include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
963$parameters = array();
964$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
965$sql .= $hookmanager->resPrint;
969$nbtotalofrecords =
'';
972 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
973 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
974 $resql = $db->query($sqlforcount);
976 $objforcount = $db->fetch_object($resql);
977 $nbtotalofrecords = $objforcount->nbtotalofrecords;
979 dol_print_error($db);
982 if (($page * $limit) > (
int) $nbtotalofrecords) {
990$sql .= $db->order($sortfield, $sortorder);
992 $sql .= $db->plimit($limit + 1, $offset);
996$resql = $db->query($sql);
998 dol_print_error($db);
1002$num = $db->num_rows($resql);
1005if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
1006 $obj = $db->fetch_object($resql);
1007 header(
"Location: ".DOL_URL_ROOT.
'/projet/card.php?id='.$obj->id);
1015$arrayofselected = is_array($toselect) ? $toselect : array();
1019 $param .=
'&mode='.urlencode($mode);
1021if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1022 $param .=
'&contextpage='.urlencode($contextpage);
1024if ($limit > 0 && $limit !=
$conf->liste_limit) {
1025 $param .=
'&limit='.((int) $limit);
1027if ($optioncss !=
'') {
1028 $param .=
'&optioncss='.urlencode($optioncss);
1030if ($search_all !=
'') {
1031 $param .=
'&search_all='.urlencode($search_all);
1033if ($search_entity !=
'') {
1034 $param .=
'&search_entity='.((int) $search_entity);
1036if ($groupby !=
'') {
1037 $param .=
'&groupby='.urlencode($groupby);
1040if ($search_parent_ref !=
'') {
1041 $param .=
'&search_parent_ref='.urlencode($search_parent_ref);
1043if ($search_parent_label !=
'') {
1044 $param .=
'&search_parent_label='.urlencode($search_parent_label);
1048 $param .=
'&socid='.urlencode((
string) $socid);
1051 $param .=
'&search_sday='.urlencode((
string) ($search_sday));
1053if ($search_smonth) {
1054 $param .=
'&search_smonth='.urlencode((
string) ($search_smonth));
1057 $param .=
'&search_syear='.urlencode((
string) ($search_syear));
1060 $param .=
'&search_eday='.urlencode((
string) ($search_eday));
1062if ($search_emonth) {
1063 $param .=
'&search_emonth='.urlencode((
string) ($search_emonth));
1066 $param .=
'&search_eyear='.urlencode((
string) ($search_eyear));
1068if ($search_date_start_startmonth) {
1069 $param .=
'&search_date_start_startmonth='.urlencode((
string) ($search_date_start_startmonth));
1071if ($search_date_start_startyear) {
1072 $param .=
'&search_date_start_startyear='.urlencode((
string) ($search_date_start_startyear));
1074if ($search_date_start_startday) {
1075 $param .=
'&search_date_start_startday='.urlencode((
string) ($search_date_start_startday));
1077if ($search_date_start_start) {
1078 $param .=
'&search_date_start_start='.urlencode((
string) $search_date_start_start);
1080if ($search_date_start_endmonth) {
1081 $param .=
'&search_date_start_endmonth='.urlencode((
string) ($search_date_start_endmonth));
1083if ($search_date_start_endyear) {
1084 $param .=
'&search_date_start_endyear='.urlencode((
string) ($search_date_start_endyear));
1086if ($search_date_start_endday) {
1087 $param .=
'&search_date_start_endday='.urlencode((
string) ($search_date_start_endday));
1089if ($search_date_start_end) {
1090 $param .=
'&search_date_start_end='.urlencode($search_date_start_end);
1092if ($search_date_end_startmonth) {
1093 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
1095if ($search_date_end_startyear) {
1096 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
1098if ($search_date_end_startday) {
1099 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
1101if ($search_date_end_start) {
1102 $param .=
'&search_date_end_start='.urlencode((
string) $search_date_end_start);
1104if ($search_date_end_endmonth) {
1105 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
1107if ($search_date_end_endyear) {
1108 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
1110if ($search_date_end_endday) {
1111 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
1113if ($search_date_end_end) {
1114 $param .=
'&search_date_end_end=' . urlencode((
string) $search_date_end_end);
1116if ($search_date_creation_startmonth) {
1117 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1119if ($search_date_creation_startyear) {
1120 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1122if ($search_date_creation_startday) {
1123 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1125if ($search_date_creation_start) {
1126 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1128if ($search_date_creation_endmonth) {
1129 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1131if ($search_date_creation_endyear) {
1132 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1134if ($search_date_creation_endday) {
1135 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1137if ($search_date_creation_end) {
1138 $param .=
'&search_date_creation_end='.urlencode($search_date_creation_end);
1140if ($search_date_modif_startmonth) {
1141 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1143if ($search_date_modif_startyear) {
1144 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1146if ($search_date_modif_startday) {
1147 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1149if ($search_date_modif_start) {
1150 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1152if ($search_date_modif_endmonth) {
1153 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1155if ($search_date_modif_endyear) {
1156 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1158if ($search_date_modif_endday) {
1159 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1161if ($search_date_modif_end) {
1162 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1164if (!empty($search_category_user_array)) {
1165 if ($searchCategoryUserOperator) {
1166 $param .=
'&search_category_user_operator='.((int) $searchCategoryUserOperator);
1168 foreach ($search_category_user_array as $tmpval) {
1169 $param .=
'&search_category_user_list[]='.urlencode($tmpval);
1172if (!empty($search_category_array)) {
1173 if ($searchCategoryProjectOperator) {
1174 $param .=
'&search_category_project_operator='.((int) $searchCategoryProjectOperator);
1176 foreach ($search_category_array as $tmpval) {
1177 $param .=
'&search_category_project_list[]='.urlencode($tmpval);
1180if (!empty($searchCategoryCustomerList)) {
1181 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1182 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1185if ($search_id !=
'') {
1186 $param .=
'&search_id='.urlencode($search_id);
1188if ($search_ref !=
'') {
1189 $param .=
'&search_ref='.urlencode($search_ref);
1191if ($search_label !=
'') {
1192 $param .=
'&search_label='.urlencode($search_label);
1194if ($search_note_public !=
'') {
1195 $param .=
'&search_note_public='.urlencode($search_note_public);
1197if ($search_note_private !=
'') {
1198 $param .=
'&search_note_private='.urlencode($search_note_private);
1200if ($search_societe !=
'') {
1201 $param .=
'&search_societe='.urlencode($search_societe);
1203if ($search_societe_alias !=
'') {
1204 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
1206if ($search_societe_country !=
'') {
1207 $param .=
'&search_societe_country='.urlencode($search_societe_country);
1209if ($search_societe_ref_customer !=
'') {
1210 $param .=
'&search_societe_ref_customer='.urlencode($search_societe_ref_customer);
1212if ($search_societe_ref_supplier !=
'') {
1213 $param .=
'&search_societe_ref_supplier='.urlencode($search_societe_ref_supplier);
1215if ($search_status !=
'' && $search_status !=
'-1') {
1216 $param .=
"&search_status=".urlencode($search_status);
1218if ($search_option) {
1219 $param .=
"&search_option=".urlencode($search_option);
1221if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'openedopp',
'notopenedopp',
'none'))) {
1222 $param .=
'&search_opp_status='.urlencode($search_opp_status);
1224if ($search_opp_percent !=
'') {
1225 $param .=
'&search_opp_percent='.urlencode($search_opp_percent);
1227if ($search_public !=
'') {
1228 $param .=
'&search_public='.urlencode($search_public);
1230if ($search_project_user > 0) {
1231 $param .=
'&search_project_user='.urlencode((
string) $search_project_user);
1233if ($search_project_contact > 0) {
1234 $param .=
'&search_project_contact='.urlencode((
string) ($search_project_contact));
1236if ($search_sale > 0) {
1237 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1239if ($search_opp_amount !=
'') {
1240 $param .=
'&search_opp_amount='.urlencode($search_opp_amount);
1242if ($search_budget_amount !=
'') {
1243 $param .=
'&search_budget_amount='.urlencode($search_budget_amount);
1245if ($search_usage_opportunity !=
'') {
1246 $param .=
'&search_usage_opportunity='.urlencode($search_usage_opportunity);
1248if ($search_usage_task !=
'') {
1249 $param .=
'&search_usage_task='.urlencode($search_usage_task);
1251if ($search_usage_bill_time !=
'') {
1252 $param .=
'&search_usage_bill_time='.urlencode($search_usage_bill_time);
1254if ($search_usage_event_organization !=
'') {
1255 $param .=
'&search_usage_event_organization='.urlencode($search_usage_event_organization);
1257if ($search_accept_conference_suggestions !=
'') {
1258 $param .=
'&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
1260if ($search_accept_booth_suggestions !=
'') {
1261 $param .=
'&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
1263if ($search_price_registration !=
'') {
1264 $param .=
'&search_price_registration='.urlencode($search_price_registration);
1266if ($search_price_booth !=
'') {
1267 $param .=
'&search_price_booth='.urlencode($search_price_booth);
1270 $param .=
'&search_login='.urlencode($search_login);
1272if ($search_import_key) {
1273 $param .=
'&search_import_key='.urlencode($search_import_key);
1275if ($search_omitChildren) {
1276 $param .=
'&search_omitChildren=on';
1279include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1282$parameters = array(
'param' => &$param);
1283$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1284$param .= $hookmanager->resPrint;
1288$filterSearchSubmitted =
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha');
1289$filterResetSubmitted =
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha');
1290if ($_SERVER[
'REQUEST_METHOD'] ===
'POST' && ($filterSearchSubmitted || $filterResetSubmitted)) {
1291 $redirectUrl =
dolBuildUrl($_SERVER[
'PHP_SELF'], array(
1292 'formfilteraction' =>
'list',
1293 'sortfield' => $sortfield,
1294 'sortorder' => $sortorder,
1296 $redirectUrl .= $param;
1297 if ($filterResetSubmitted && $search_status == -1) {
1298 $redirectUrl .=
'&search_status=-1';
1300 header(
'Location: '.$redirectUrl,
true, 303);
1304llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-project page-list bodyforlist');
1307$arrayofmassactions = array(
1308 'validate' => img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1309 'generate_doc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1314if ($user->hasRight(
'projet',
'creer')) {
1315 $arrayofmassactions[
'close'] = img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Close");
1316 $arrayofmassactions[
'preaffectuser'] = img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AffectUser");
1318if ($user->hasRight(
'projet',
'supprimer')) {
1319 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1321if (
isModEnabled(
'category') && $user->hasRight(
'projet',
'creer')) {
1322 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1324if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preaffectuser'))) {
1325 $arrayofmassactions = array();
1328$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1330$url = DOL_URL_ROOT.
'/projet/card.php?action=create';
1331if (!empty($socid)) {
1332 $url .=
'&socid='.$socid;
1334if ($search_usage_event_organization == 1) {
1335 $url .=
'&usage_organize_event=1';
1336 if (((
int) $search_usage_opportunity) < 1) {
1337 $url .=
'&usage_opportunity=0';
1342$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
1343$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
1344if ($contextpage ==
'lead') {
1345 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanbanGroupBy'),
'',
'fa fa-grip-vertical imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanbangroupby&groupby=p.fk_opp_status'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'kanbangroupby' ? 2 : 1), array(
'morecss' =>
'reposition'));
1347$newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/projet/stats/index.php?mode=statistics&contextpage='.$contextpage.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
1349$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewProject'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'projet',
'creer'));
1351print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
1352if ($optioncss !=
'') {
1353 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1355print
'<input type="hidden" name="token" value="'.newToken().
'">';
1356print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1357print
'<input type="hidden" name="action" value="list">';
1358print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1359print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1360print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1361print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1362print
'<input type="hidden" name="groupby" value="'.$groupby.
'">';
1366if ($search_project_user == $user->id) {
1367 $htmltooltip .= $langs->trans(
"MyProjectsDesc");
1369 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
1370 $htmltooltip .= $langs->trans(
"ProjectsDesc");
1372 $htmltooltip .= $langs->trans(
"ProjectsPublicDesc");
1376print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1379$topicmail =
"Information";
1380$modelmail =
"project";
1382$trackid =
'proj'.$object->id;
1383include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1386 foreach ($fieldstosearchall as $key => $val) {
1387 $fieldstosearchall[$key] = $langs->trans($val);
1389 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1395$moreforfilter .=
'<div class="divsearchfield">';
1396$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
1399if (!$user->hasRight(
'user',
'user',
'lire')) {
1400 $includeonly = array($user->id);
1402$moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle, null, 0, $includeonly,
'',
'0', 0, 0,
'', 0,
'',
'maxwidth300 widthcentpercentminusx');
1403$moreforfilter .=
'</div>';
1406if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1407 $langs->load(
"categories");
1409 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_USER, $search_category_user_array,
'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->transnoentitiesnoconv(
"UsersCategoryShort"));
1413$moreforfilter .=
'<div class="divsearchfield">';
1414$tmptitle = $langs->trans(
'ProjectsWithThisContact');
1415$moreforfilter .= img_picto($tmptitle,
'contact',
'class="pictofixedwidth"').$form->select_contact(0, $search_project_contact ? $search_project_contact :
'',
'search_project_contact', $tmptitle,
'',
'', 0,
'maxwidth300 widthcentpercentminusx');
1417$moreforfilter .=
'</div>';
1421if ($user->hasRight(
'user',
'user',
'lire')) {
1422 $langs->load(
"commercial");
1423 $moreforfilter .=
'<div class="divsearchfield">';
1424 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1425 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1426 $moreforfilter .=
'</div>';
1430if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1432 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array,
'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->transnoentitiesnoconv(
"ProjectsCategoryShort"));
1438 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth200imp minwidth200 widthcentpercentminusx', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
1442$moreforfilter .=
'<div class="divsearchfield">';
1443$moreforfilter .=
'<label for="search_option" title="'.$langs->trans(
"Late").
'">'.$langs->trans(
'Alert').
' </label><input type="checkbox" id="search_option" name="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1444$moreforfilter .=
'</div>';
1448 $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"' :
'').
'"> ';
1451if (!empty($moreforfilter)) {
1452 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1453 print $moreforfilter;
1454 $parameters = array();
1455 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1456 print $hookmanager->resPrint;
1460$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1461$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1462$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
1463$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1466print
'<div class="div-table-responsive">';
1467print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1472print
'<tr class="liste_titre_filter">';
1474if (
$conf->main_checkbox_left_column) {
1475 print
'<td class="liste_titre center maxwidthsearch" id="action_column_left">';
1476 $searchpicto = $form->showFilterButtons(
'left');
1481if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1482 print
'<td class="liste_titre" id="search_id">';
1483 print
'<input type="text" class="flat width50" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1487if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1488 print
'<td class="liste_titre" id="search_ref">';
1489 print
'<input type="text" class="flat width75" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1493if (!empty($arrayfields[
'p.title'][
'checked'])) {
1494 print
'<td class="liste_titre" id="search_label">';
1495 print
'<input type="text" class="flat width100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
1500if (!empty($arrayfields[
'p.fk_project'][
'checked'])) {
1501 print
'<td class="liste_titre" id="parent_project">';
1502 print
'<div class="nowrap">';
1503 $ref_placeholder = $langs->trans(
'Ref');
1504 print
'<input id="search_parent_ref" placeholder="'.$ref_placeholder.
'" type="text" class="flat width75" name="search_parent_ref" value="'.
dol_escape_htmltag($search_parent_ref).
'">';
1506 print
'<div class="nowrap">';
1507 $label_placeholder = $langs->trans(
'Label');
1508 print
'<input id="search_parent_label" placeholder="'.$label_placeholder.
'" type="text" class="flat width75" name="search_parent_label" value="'.
dol_escape_htmltag($search_parent_label).
'">';
1514if (!empty($arrayfields[
's.nom'][
'checked'])) {
1515 print
'<td class="liste_titre" id="search_societe">';
1517 $tmpthirdparty =
new Societe($db);
1518 $tmpthirdparty->fetch($socid);
1519 $search_societe = $tmpthirdparty->name;
1521 print
'<input type="text" class="flat width100" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'">';
1526if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1527 print
'<td class="liste_titre" id="search_societe_alias">';
1529 $tmpthirdparty =
new Societe($db);
1530 $tmpthirdparty->fetch($socid);
1531 $search_societe_alias = $tmpthirdparty->name_alias;
1533 print
'<input type="text" class="flat width100" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1538if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1539 print
'<td class="liste_titre" id="search_societe_ref_customer">';
1540 print
'<input type="text" class="flat width75" name="search_societe_ref_customer" value="'.dol_escape_htmltag($search_societe_ref_customer).
'">';
1544if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1545 print
'<td class="liste_titre" id="search_societe_ref_supplier">';
1546 print
'<input type="text" class="flat width75" name="search_societe_ref_supplier" value="'.dol_escape_htmltag($search_societe_ref_supplier).
'">';
1551if (!empty($arrayfields[
'co.country_code'][
'checked'])) {
1552 print
'<td class="liste_titre" id="search_societe_country">';
1553 print
'<input type="text" class="flat width50" name="search_societe_country" value="'.dol_escape_htmltag($search_societe_country).
'">';
1557if (!empty($arrayfields[
'commercial'][
'checked'])) {
1558 print
'<td class="liste_titre" id="sale_representative"> </td>';
1561if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1562 print
'<td class="liste_titre center" id="search_date_start">';
1563 print
'<div class="nowrapfordate">';
1564 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'));
1566 print
'<div class="nowrapfordate">';
1567 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'));
1572if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1573 print
'<td class="liste_titre center" id="search_date_end">';
1574 print
'<div class="nowrapfordate">';
1575 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'));
1577 print
'<div class="nowrapfordate">';
1578 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'));
1583if (!empty($arrayfields[
'p.public'][
'checked'])) {
1584 print
'<td class="liste_titre center">';
1585 $array = array(
'' =>
'', 0 => $langs->trans(
"PrivateProject"), 1 => $langs->trans(
"SharedProject"));
1586 print $form->selectarray(
'search_public', $array, $search_public, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1589if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1590 print
'<td class="liste_titre center">';
1594if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1595 print
'<td class="liste_titre nowrap center">';
1596 print $formproject->selectOpportunityStatus(
'search_opp_status', $search_opp_status, 1, 1, 1, 0,
'maxwidth125 nowrapoption', 1, 1);
1599if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1600 print
'<td class="liste_titre nowrap right" id="search_opp_amount">';
1601 print
'<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.
'">';
1604if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1605 print
'<td class="liste_titre nowrap right" id="search_opp_percent">';
1606 print
'<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.
'">';
1609if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1610 print
'<td class="liste_titre nowrap right">';
1613if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1614 print
'<td class="liste_titre nowrap right" id="search_budget_amount">';
1615 print
'<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.
'">';
1618if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1619 print
'<td class="liste_titre nowrap">';
1620 print $form->selectyesno(
'search_usage_opportunity', $search_usage_opportunity, 1,
false, 1, 1);
1624if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1625 print
'<td class="liste_titre nowrap">';
1626 print $form->selectyesno(
'search_usage_task', $search_usage_task, 1,
false, 1, 1);
1629if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1630 print
'<td class="liste_titre nowrap">';
1631 print $form->selectyesno(
'search_usage_bill_time', $search_usage_bill_time, 1,
false, 1, 1);
1634if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1635 print
'<td class="liste_titre nowrap">';
1636 print $form->selectyesno(
'search_usage_event_organization', $search_usage_event_organization, 1,
false, 1, 1);
1639if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1640 print
'<td class="liste_titre nowrap">';
1641 print $form->selectyesno(
'search_accept_conference_suggestions', $search_accept_conference_suggestions, 1,
false, 1, 1);
1644if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1645 print
'<td class="liste_titre nowrap">';
1646 print $form->selectyesno(
'search_accept_booth_suggestions', $search_accept_booth_suggestions, 1,
false, 1, 1);
1649if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1650 print
'<td class="liste_titre nowrap right" id="search_price_registration">';
1651 print
'<input type="text" class="flat" name="search_price_registration" size="4" value="'.dol_escape_htmltag($search_price_registration).
'">';
1654if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1655 print
'<td class="liste_titre nowrap right" id="search_price_booth">';
1656 print
'<input type="text" class="flat" name="search_price_booth" size="4" value="'.dol_escape_htmltag($search_price_booth).
'">';
1659if (!empty($arrayfields[
'u.login'][
'checked'])) {
1661 print
'<td class="liste_titre" align="center" id="search_login">';
1662 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1665if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1666 print
'<td class="liste_titre">';
1667 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1670if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1671 print
'<td class="liste_titre">';
1672 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1676include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1679$parameters = array(
'arrayfields' => $arrayfields);
1680$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1681print $hookmanager->resPrint;
1683if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1684 print
'<td class="liste_titre center" id="search_date_creation">';
1685 print
'<div class="nowrapfordate">';
1686 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'));
1688 print
'<div class="nowrapfordate">';
1689 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'));
1694if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1695 print
'<td class="liste_titre center" id="search_date_modif">';
1696 print
'<div class="nowrapfordate">';
1697 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'));
1699 print
'<div class="nowrapfordate">';
1700 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'));
1704if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1706 print
'<td class="liste_titre">';
1709if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1711 print
'<td class="liste_titre" id="search_import_key">';
1712 print
'<input class="flat width75" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1716if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1717 print
'<td class="liste_titre center parentonrightofpage">';
1718 $formproject->selectProjectsStatus($search_status, 1,
'search_status');
1722if (!
$conf->main_checkbox_left_column) {
1723 print
'<td class="liste_titre maxwidthsearch" id="action_column_right">';
1724 $searchpicto = $form->showFilterButtons();
1730$totalarray = array();
1731$totalarray[
'nbfield'] = 0;
1735print
'<tr class="liste_titre">';
1736if (
$conf->main_checkbox_left_column) {
1737 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1738 $totalarray[
'nbfield']++;
1740if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1741 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1742 $totalarray[
'nbfield']++;
1744if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1745 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1746 $totalarray[
'nbfield']++;
1748if (!empty($arrayfields[
'p.title'][
'checked'])) {
1749 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1750 $totalarray[
'nbfield']++;
1752if (!empty($arrayfields[
'p.fk_project'][
'checked'])) {
1753 print_liste_field_titre($arrayfields[
'p.fk_project'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_project",
"", $param,
"", $sortfield, $sortorder);
1754 $totalarray[
'nbfield']++;
1756if (!empty($arrayfields[
's.nom'][
'checked'])) {
1757 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1758 $totalarray[
'nbfield']++;
1760if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1762 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1763 $totalarray[
'nbfield']++;
1765if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1766 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
"", $sortfield, $sortorder);
1767 $totalarray[
'nbfield']++;
1769if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1770 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
"", $sortfield, $sortorder);
1771 $totalarray[
'nbfield']++;
1773if (!empty($arrayfields[
'co.country_code'][
'checked'])) {
1774 print_liste_field_titre($arrayfields[
'co.country_code'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1775 $totalarray[
'nbfield']++;
1777if (!empty($arrayfields[
'commercial'][
'checked'])) {
1778 print_liste_field_titre($arrayfields[
'commercial'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder,
'tdoverflowmax100imp ');
1779 $totalarray[
'nbfield']++;
1781if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1782 print_liste_field_titre($arrayfields[
'p.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"p.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1783 $totalarray[
'nbfield']++;
1785if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1786 print_liste_field_titre($arrayfields[
'p.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1787 $totalarray[
'nbfield']++;
1789if (!empty($arrayfields[
'p.public'][
'checked'])) {
1790 print_liste_field_titre($arrayfields[
'p.public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.public",
"", $param,
"", $sortfield, $sortorder,
'center ');
1791 $totalarray[
'nbfield']++;
1793if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1794 print_liste_field_titre($arrayfields[
'c.assigned'][
'label'], $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ',
'');
1795 $totalarray[
'nbfield']++;
1797if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1799 print_liste_field_titre($arrayfields[
'p.fk_opp_status'][
'label'], $_SERVER[
"PHP_SELF"],
'p.fk_opp_status',
"", $param,
'', $sortfield, $sortorder,
'center ');
1800 $totalarray[
'nbfield']++;
1802if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1804 print_liste_field_titre($arrayfields[
'p.opp_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.opp_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1805 $totalarray[
'nbfield']++;
1807if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1809 print_liste_field_titre($arrayfields[
'p.opp_percent'][
'label'], $_SERVER[
'PHP_SELF'],
'p.opp_percent',
"", $param,
'', $sortfield, $sortorder,
'right ');
1810 $totalarray[
'nbfield']++;
1812if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1813 print_liste_field_titre($arrayfields[
'opp_weighted_amount'][
'label'], $_SERVER[
'PHP_SELF'],
'opp_weighted_amount',
'', $param,
'', $sortfield, $sortorder,
'right ');
1814 $totalarray[
'nbfield']++;
1816if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1817 print_liste_field_titre($arrayfields[
'p.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.budget_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1818 $totalarray[
'nbfield']++;
1820if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1821 print_liste_field_titre($arrayfields[
'p.usage_opportunity'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_opportunity',
"", $param,
'', $sortfield, $sortorder,
'');
1822 $totalarray[
'nbfield']++;
1824if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1825 print_liste_field_titre($arrayfields[
'p.usage_task'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_task',
"", $param,
'', $sortfield, $sortorder,
'');
1826 $totalarray[
'nbfield']++;
1828if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1829 print_liste_field_titre($arrayfields[
'p.usage_bill_time'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_bill_time',
"", $param,
'', $sortfield, $sortorder,
'');
1830 $totalarray[
'nbfield']++;
1832if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1834 print_liste_field_titre($arrayfields[
'p.usage_organize_event'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_organize_event',
"", $param,
'', $sortfield, $sortorder,
'');
1835 $totalarray[
'nbfield']++;
1837if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1838 print_liste_field_titre($arrayfields[
'p.accept_conference_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_conference_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1839 $totalarray[
'nbfield']++;
1841if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1842 print_liste_field_titre($arrayfields[
'p.accept_booth_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_booth_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1843 $totalarray[
'nbfield']++;
1845if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1846 print_liste_field_titre($arrayfields[
'p.price_registration'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_registration',
"", $param,
'', $sortfield, $sortorder,
'right ');
1847 $totalarray[
'nbfield']++;
1849if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1850 print_liste_field_titre($arrayfields[
'p.price_booth'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_booth',
"", $param,
'', $sortfield, $sortorder,
'right ');
1851 $totalarray[
'nbfield']++;
1853if (!empty($arrayfields[
'u.login'][
'checked'])) {
1854 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1855 $totalarray[
'nbfield']++;
1857if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1858 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1859 $totalarray[
'nbfield']++;
1861if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1862 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1863 $totalarray[
'nbfield']++;
1866include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1868$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1869$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1870print $hookmanager->resPrint;
1871if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1872 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1873 $totalarray[
'nbfield']++;
1875if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1876 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1877 $totalarray[
'nbfield']++;
1879if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1880 print_liste_field_titre($arrayfields[
'p.email_msgid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email_msgid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1881 $totalarray[
'nbfield']++;
1883if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1884 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'');
1885 $totalarray[
'nbfield']++;
1887if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1888 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1889 $totalarray[
'nbfield']++;
1892if (!
$conf->main_checkbox_left_column) {
1893 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1894 $totalarray[
'nbfield']++;
1896print
'</tr></thead>'.
"\n";
1900$savnbfield = $totalarray[
'nbfield'];
1905$imaxinloop = ($limit ? min($num, $limit) : $num);
1906while ($i < $imaxinloop) {
1907 $obj = $db->fetch_object($resql);
1913 $companystatic->id = $obj->socid;
1914 $companystatic->name = $obj->name;
1915 $companystatic->name_alias = $obj->alias;
1916 $companystatic->client = $obj->client;
1917 $companystatic->code_client = $obj->code_client;
1918 $companystatic->code_fournisseur = $obj->code_fournisseur;
1919 $companystatic->email = $obj->email;
1920 $companystatic->phone = $obj->phone;
1921 $companystatic->address = $obj->address;
1922 $companystatic->zip = $obj->zip;
1923 $companystatic->town = $obj->town;
1924 $companystatic->country_code = $obj->country_code;
1930 $object->fk_project = $obj->fk_project;
1931 $object->fk_opp_status = $obj->fk_opp_status;
1932 $object->user_author_id = $obj->fk_user_creat;
1933 $object->date_creation = $db->jdate($obj->date_creation);
1934 $object->date_start = $db->jdate($obj->date_start);
1935 $object->date_end = $db->jdate($obj->date_end);
1936 $object->status = $obj->status;
1937 $object->public = $obj->public;
1938 $object->opp_percent = $obj->opp_percent;
1939 $object->opp_status = $obj->fk_opp_status;
1940 $object->opp_status_code = $obj->opp_status_code;
1941 $object->opp_amount = !empty($obj->opp_amount) ? $obj->opp_amount :
"";
1942 $object->opp_weighted_amount = $obj->opp_weighted_amount;
1943 $object->budget_amount = $obj->budget_amount;
1944 $object->usage_opportunity = $obj->usage_opportunity;
1945 $object->usage_task = $obj->usage_task;
1946 $object->usage_bill_time = $obj->usage_bill_time;
1947 $object->usage_organize_event = $obj->usage_organize_event;
1948 $object->email_msgid = $obj->email_msgid;
1949 $object->import_key = $obj->import_key;
1950 $object->note_public = $obj->note_public;
1951 $object->note_private = $obj->note_private;
1952 $object->thirdparty = $companystatic;
1956 $stringassignedusers =
'';
1958 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1960 foreach (array(
'internal',
'external') as $source) {
1961 $tab =
$object->liste_contact(-1, $source, 0,
'', 1);
1962 $numcontact = count($tab);
1963 if (!empty($numcontact)) {
1964 foreach ($tab as $contactproject) {
1966 if ($source ==
'internal') {
1967 if (!empty(
$conf->cache[
'user'][$contactproject[
'id']])) {
1968 $c =
$conf->cache[
'user'][$contactproject[
'id']];
1971 $c->fetch($contactproject[
'id']);
1972 $conf->cache[
'user'][$contactproject[
'id']] =
$c;
1975 if (!empty(
$conf->cache[
'contact'][$contactproject[
'id']])) {
1976 $c =
$conf->cache[
'contact'][$contactproject[
'id']];
1979 $c->fetch($contactproject[
'id']);
1980 $conf->cache[
'contact'][$contactproject[
'id']] =
$c;
1983 if (get_class(
$c) ==
'User') {
1984 $stringassignedusers .=
$c->getNomUrl(-2,
'', 0, 0, 24, 1,
'',
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1986 $stringassignedusers .=
$c->getNomUrl(-2,
'', 0, 0, -1, 0,
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1994 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
1996 print
'<tr class="trkanban'.(empty($groupby) ?
'' :
' trkanbangroupby').
'"><td colspan="'.$savnbfield.
'">';
1999 $groupbyvalue =
'unset';
2000 $groupbyfield =
'unsetfield';
2003 if (!empty($groupby)) {
2004 $groupbyfield = preg_replace(
'/^[a-z]+\./',
'', $groupby);
2008 if (is_null($groupbyold)) {
2009 print
'<div class="box-flex-container-columns kanban">';
2012 if (is_null($obj->$groupbyfield)) {
2013 $groupbyvalue =
'undefined';
2015 $groupbyvalues[0] = array(
'id' =>
'0',
'label' =>
'Undefined');
2017 $groupbyvalue = $obj->$groupbyfield;
2020 if ($groupbyold !== $groupbyvalue) {
2021 if (!is_null($groupbyold)) {
2025 $indexofgroupbyvalue =
null;
2029 foreach ($groupbyvalues as $tmpcursor => $tmpgroupbyvalue) {
2031 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
2032 if ($tmpgroupbyvalue2[
'id'] == $groupbyvalue) {
2033 $indexofgroupbyvalue = $tmpcursor2;
2039 if (!is_null($groupbyold)) {
2040 $indexofgroupbyold =
null;
2041 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
2042 if ($tmpgroupbyvalue2[
'id'] == $groupbyold) {
2043 $indexofgroupbyold = $tmpcursor2;
2049 if ($tmpcursor <= $indexofgroupbyold) {
2053 if ($tmpcursor >= $indexofgroupbyvalue) {
2058 print
'<!-- empty column before column of fetched value --><div class="box-flex-container-column kanban column';
2059 if (array_key_exists($tmpcursor, $groupofcollpasedvalues)) {
2060 print
' kanbancollapsed';
2062 print
'" data-groupbyid="'.preg_replace(
'/[^a-z0-9]/',
'', $tmpgroupbyvalue[
'id']).
'" data-groupbyfield="'.$groupbyfield.
'">';
2063 print
'<div class="kanbanlabel">'.$langs->trans($tmpgroupbyvalue[
'label']).
'</div>';
2067 print
'<!-- start column for value --><div class="box-flex-container-column kanban column" data-groupbyid="'.preg_replace(
'/[^a-z0-9]/i',
'', $groupbyvalue).
'" data-groupbyfield="'.$groupbyfield.
'">';
2068 print
'<div class="kanbanlabel">'.$langs->trans((is_null($indexofgroupbyvalue) || empty($groupbyvalues[$indexofgroupbyvalue][
'label'])) ?
'Undefined' : $groupbyvalues[$indexofgroupbyvalue][
'label']).
'</div>';
2070 $groupbyold = $groupbyvalue;
2071 } elseif ($i == 0) {
2072 print
'<div class="box-flex-container kanban">';
2077 if ($massactionbutton || $massaction) {
2079 if (in_array(
$object->id, $arrayofselected)) {
2083 $arrayofdata = array(
'assignedusers' => $stringassignedusers,
'thirdparty' => $companystatic,
'selected' => $selected,
'mode' => $mode);
2085 print
$object->getKanbanView(
'', $arrayofdata, ($groupby ?
'small' :
''));
2088 if ($i == ($imaxinloop - 1)) {
2090 if (!empty($groupby)) {
2095 foreach ($groupbyvalues as $tmpcursor => $tmpgroupbyvalue) {
2097 $indexofgroupbyvalue =
null;
2098 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
2099 if ($tmpgroupbyvalue2[
'id'] == $groupbyvalue) {
2100 $indexofgroupbyvalue = $tmpcursor2;
2106 if (!is_null($groupbyold)) {
2107 $indexofgroupbyold =
null;
2108 foreach ($groupbyvalues as $tmpcursor2 => $tmpgroupbyvalue2) {
2109 if ($tmpgroupbyvalue2[
'id'] == $groupbyold) {
2110 $indexofgroupbyold = $tmpcursor2;
2118 if ($tmpcursor <= $indexofgroupbyvalue) {
2122 print
'<!-- empty column after column of fetched value --><div class="box-flex-container-column kanban column';
2123 if (array_key_exists($tmpcursor, $groupofcollpasedvalues)) {
2124 print
' kanbancollapsed';
2126 print
'" data-groupbyid="'.preg_replace(
'/[^a-z0-9]/',
'', $tmpgroupbyvalue[
'id']).
'" data-groupbyfield="'.$groupbyfield.
'">';
2127 print
'<div class="kanbanlabel">'.$langs->trans(empty($tmpgroupbyvalue[
'label']) ?
'Undefined' : $tmpgroupbyvalue[
'label']).
'</div>';
2139 $userstatic->id = $obj->fk_user_creat;
2140 $userstatic->login = $obj->login;
2141 $userstatic->lastname = $obj->lastname;
2142 $userstatic->firstname = $obj->firstname;
2143 $userstatic->email = $obj->user_email;
2144 $userstatic->status = $obj->user_statut;
2145 $userstatic->entity = $obj->entity;
2146 $userstatic->photo = $obj->photo;
2147 $userstatic->office_phone = $obj->office_phone;
2148 $userstatic->office_fax = $obj->office_fax;
2149 $userstatic->user_mobile = $obj->user_mobile;
2150 $userstatic->job = $obj->job;
2151 $userstatic->gender = $obj->gender;
2155 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 &&
$object->status > 1) ?
'opacitymedium' :
'').
'">';
2157 if (
$conf->main_checkbox_left_column) {
2158 print
'<td class="nowrap center">';
2159 if ($massactionbutton || $massaction) {
2161 if (in_array(
$object->id, $arrayofselected)) {
2164 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2168 $totalarray[
'nbfield']++;
2172 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
2173 print
'<td class="nowraponall">';
2177 $totalarray[
'nbfield']++;
2181 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2182 print
'<td class="nowraponall tdoverflowmax200">';
2183 print
$object->getNomUrl(1, (!empty(
GETPOSTINT(
'search_usage_event_organization')) ?
'eventorganization' :
''), 0,
'',
' - ', 0, -1,
'',
'', 1);
2185 print img_warning($langs->trans(
'Late'));
2189 $totalarray[
'nbfield']++;
2193 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2194 print
'<td class="" title="'.dolPrintHTMLForAttribute($obj->title).
'">';
2195 print
'<div class="twolinesmax-normallineheight minwidth200onall">';
2196 print
'<span class="spantitle">';
2197 print dolPrintHTML($obj->title);
2202 $totalarray[
'nbfield']++;
2206 if (!empty($arrayfields[
'p.fk_project'][
'checked'])) {
2207 print
'<td class="nowraponall">';
2209 $parent_object =
new Project($db);
2210 $parent_result = $parent_object->fetch(
$object->fk_project);
2211 if ($parent_result > 0) {
2212 $accessallowed =
checkUserAccessToObject($user, array(
'projet'), $parent_object,
'projet&project',
'',
'',
'rowid',
'');
2213 if ($accessallowed) {
2214 print $parent_object->getNomUrl(-1);
2216 $parent_url = DOL_URL_ROOT.
'/projet/card.php?id='.
$object->fk_project;
2217 print
'<a href="'.$parent_url.
'">';
2218 print img_picto(
'',
'warning',
'class="pictofixedwidth error"');
2219 print
'<del title="You do not have access to see parent project">ACCESS DENIED!</del>';
2220 print img_picto(
'',
'warning',
'class="pictofixedwidth error"');
2224 print((
int)
$object->fk_project);
2230 $totalarray[
'nbfield']++;
2235 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2236 print
'<td class="tdoverflowmax125">';
2238 print $companystatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2244 $totalarray[
'nbfield']++;
2248 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2249 print
'<td class="tdoverflowmax100">';
2251 print
'<span class="spantitle">';
2252 print $companystatic->name_alias;
2257 $totalarray[
'nbfield']++;
2261 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2262 print
'<td class="tdoverflowmax100">';
2264 print $companystatic->code_client;
2268 $totalarray[
'nbfield']++;
2272 if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
2273 print
'<td class="tdoverflowmax100">';
2275 print $companystatic->code_fournisseur;
2279 $totalarray[
'nbfield']++;
2283 if (!empty($arrayfields[
'co.country_code'][
'checked'])) {
2284 print
'<td class="tdoverflowmax125 center">';
2285 print $obj->country_code;
2288 $totalarray[
'nbfield']++;
2292 if (!empty($arrayfields[
'commercial'][
'checked'])) {
2293 print
'<td class="tdoverflowmax150">';
2295 $PROJECT_MAX_SALES_TO_SHOW_IN_LIST =
getDolGlobalInt(
'PROJECT_MAX_SALES_TO_SHOW_IN_LIST', 5);
2296 $companystatic->id = $obj->socid;
2297 $companystatic->name = $obj->name;
2298 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2299 $nbofsalesrepresentative = count($listsalesrepresentatives);
2300 if ($nbofsalesrepresentative > $PROJECT_MAX_SALES_TO_SHOW_IN_LIST) {
2302 print $nbofsalesrepresentative;
2303 } elseif ($nbofsalesrepresentative > 0) {
2304 $userstatic =
new User($db);
2306 foreach ($listsalesrepresentatives as $val) {
2307 $userstatic->id = $val[
'id'];
2308 $userstatic->lastname = $val[
'lastname'];
2309 $userstatic->firstname = $val[
'firstname'];
2310 $userstatic->email = $val[
'email'];
2311 $userstatic->status = $val[
'statut'];
2312 $userstatic->entity = $val[
'entity'];
2313 $userstatic->photo = $val[
'photo'];
2314 $userstatic->login = $val[
'login'];
2315 $userstatic->office_phone = $val[
'office_phone'];
2316 $userstatic->office_fax = $val[
'office_fax'];
2317 $userstatic->user_mobile = $val[
'user_mobile'];
2318 $userstatic->job = $val[
'job'];
2319 $userstatic->gender = $val[
'gender'];
2320 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2322 if ($j < $nbofsalesrepresentative) {
2333 $totalarray[
'nbfield']++;
2338 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
2339 print
'<td class="center">';
2343 $totalarray[
'nbfield']++;
2347 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
2348 print
'<td class="center">';
2352 $totalarray[
'nbfield']++;
2357 if (!empty($arrayfields[
'p.public'][
'checked'])) {
2358 print
'<td class="center">';
2360 print img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
2363 print img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
2368 $totalarray[
'nbfield']++;
2372 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
2373 print
'<td class="center nowraponall tdoverflowmax150">';
2374 print $stringassignedusers;
2377 $totalarray[
'nbfield']++;
2381 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
2383 if ($obj->opp_status_code) {
2384 $s = $langs->trans(
"OppStatus".$obj->opp_status_code);
2385 if (empty($arrayfields[
'p.opp_percent'][
'checked']) && $obj->opp_percent) {
2386 $s .=
' ('.dol_escape_htmltag(
price2num($obj->opp_percent, 1)).
'%)';
2389 print
'<td class="center tdoverflowmax150" title="'.dolPrintHTMLForAttribute($s).
'">';
2391 print
'<span class="badge badge-oppstatus">';
2392 print dolPrintHTML($s);
2397 $totalarray[
'nbfield']++;
2401 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
2402 print
'<td class="right">';
2404 if (isset($obj->opp_amount) && strcmp($obj->opp_amount,
'')) {
2405 print
'<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
2406 if (!isset($totalarray[
'val'][
'p.opp_amount'])) {
2407 $totalarray[
'val'][
'p.opp_amount'] = $obj->opp_amount;
2409 $totalarray[
'val'][
'p.opp_amount'] += $obj->opp_amount;
2414 $totalarray[
'nbfield']++;
2417 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.opp_amount';
2421 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
2422 print
'<td class="right">';
2423 if ($obj->opp_percent) {
2424 print
price($obj->opp_percent, 1, $langs, 1, 0).
'%';
2428 $totalarray[
'nbfield']++;
2432 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
2433 if (!isset($totalarray[
'val'][
'opp_weighted_amount'])) {
2434 $totalarray[
'val'][
'opp_weighted_amount'] = 0;
2436 print
'<td align="right">';
2437 if ($obj->opp_weighted_amount) {
2438 print
'<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
2439 $totalarray[
'val'][
'opp_weighted_amount'] += $obj->opp_weighted_amount;
2443 $totalarray[
'nbfield']++;
2444 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'opp_weighted_amount';
2448 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
2449 print
'<td class="right">';
2450 if ($obj->budget_amount !=
'') {
2451 print
'<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).
'</span>';
2452 if (!isset($totalarray[
'val'][
'p.budget_amount'])) {
2453 $totalarray[
'val'][
'p.budget_amount'] = $obj->budget_amount;
2455 $totalarray[
'val'][
'p.budget_amount'] += $obj->budget_amount;
2460 $totalarray[
'nbfield']++;
2461 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.budget_amount';
2465 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
2466 print
'<td class="center">';
2467 if ($obj->usage_opportunity) {
2468 print yn($obj->usage_opportunity, 4);
2472 $totalarray[
'nbfield']++;
2476 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
2477 print
'<td class="center">';
2478 if ($obj->usage_task) {
2479 print yn($obj->usage_task, 4);
2483 $totalarray[
'nbfield']++;
2487 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
2488 print
'<td class="center">';
2489 if ($obj->usage_bill_time) {
2490 print yn($obj->usage_bill_time, 4);
2494 $totalarray[
'nbfield']++;
2498 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
2499 print
'<td class="center">';
2500 if ($obj->usage_organize_event) {
2501 print yn($obj->usage_organize_event, 4);
2505 $totalarray[
'nbfield']++;
2509 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
2510 print
'<td class="center">';
2511 if ($obj->accept_conference_suggestions) {
2512 print yn($obj->accept_conference_suggestions);
2516 $totalarray[
'nbfield']++;
2520 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
2521 print
'<td class="">';
2522 if ($obj->accept_booth_suggestions) {
2523 print yn($obj->accept_booth_suggestions);
2527 $totalarray[
'nbfield']++;
2531 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
2532 print
'<td class="right">';
2533 if ($obj->price_registration !=
'') {
2534 print
'<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).
'</span>';
2535 $totalarray[
'val'][
'p.price_registration'] += $obj->price_registration;
2539 $totalarray[
'nbfield']++;
2542 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_registration';
2546 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
2547 print
'<td class="right">';
2548 if ($obj->price_booth !=
'') {
2549 print
'<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).
'</span>';
2550 $totalarray[
'val'][
'p.price_booth'] += $obj->price_booth;
2554 $totalarray[
'nbfield']++;
2557 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_booth';
2561 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2562 print
'<td class="center tdoverflowmax150">';
2563 if ($userstatic->id) {
2564 print $userstatic->getNomUrl(-1);
2568 $totalarray[
'nbfield']++;
2572 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2573 print
'<td class="flat maxwidth250imp">';
2574 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2577 $totalarray[
'nbfield']++;
2581 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2582 print
'<td class="flat maxwidth250imp">';
2583 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2586 $totalarray[
'nbfield']++;
2590 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2592 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2593 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2594 print $hookmanager->resPrint;
2596 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2597 print
'<td class="center nowraponall">';
2598 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2601 $totalarray[
'nbfield']++;
2605 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2606 print
'<td class="center nowraponall">';
2607 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2610 $totalarray[
'nbfield']++;
2614 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
2615 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->email_msgid).
'">';
2619 $totalarray[
'nbfield']++;
2623 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2624 print
'<td class="right">'.dol_escape_htmltag($obj->import_key).
'</td>';
2626 $totalarray[
'nbfield']++;
2630 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2631 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
2633 $totalarray[
'nbfield']++;
2637 if (!
$conf->main_checkbox_left_column) {
2638 print
'<td class="nowrap center">';
2639 if ($massactionbutton || $massaction) {
2641 if (in_array(
$object->id, $arrayofselected)) {
2644 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2648 $totalarray[
'nbfield']++;
2659include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2664 foreach ($arrayfields as $key => $val) {
2665 if (!empty($val[
'checked'])) {
2669 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2674$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2675$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2676print $hookmanager->resPrint;
2678print
'</table>'.
"\n";
2681print
'</form>'.
"\n";
2683if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2684 $hidegeneratedfilelistifempty = 1;
2685 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2686 $hidegeneratedfilelistifempty = 0;
2689 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2693 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2694 $urlsource .= str_replace(
'&',
'&', $param);
2696 $filedir = $diroutputmassaction;
2697 $genallowed = $permissiontoread;
2698 $delallowed = $permissiontoadd;
2700 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
checkUserAccessToObject($user, array $featuresarray, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='rowid', $parenttableforentity='')
Check that access by a given user to an object is ok.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.