33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
41if (isModEnabled(
'categorie')) {
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
47$langs->loadLangs(array(
'projects',
'companies',
'commercial'));
48if (isModEnabled(
'eventorganization') && $conf->eventorganization->enabled) {
49 $langs->loadLangs(array(
'eventorganization'));
52$action =
GETPOST(
'action',
'aZ09');
53$massaction =
GETPOST(
'massaction',
'alpha');
54$show_files =
GETPOST(
'show_files',
'int');
55$confirm =
GETPOST(
'confirm',
'alpha');
56$toselect =
GETPOST(
'toselect',
'array');
57$optioncss =
GETPOST(
'optioncss',
'alpha');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'projectlist';
59$mode =
GETPOST(
'mode',
'alpha');
62$title = $langs->trans(
"Projects");
65$socid =
GETPOST(
'socid',
'int');
70 $title .=
' (<a href="list.php">'.$soc->name.
'</a>)';
72if (!$user->rights->projet->lire) {
76$diroutputmassaction = $conf->project->dir_output.
'/temp/massgeneration/'.$user->id;
78$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
81$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
82if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
92$offset = $limit * $page;
96$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
97$search_ref =
GETPOST(
"search_ref",
'alpha');
98$search_label =
GETPOST(
"search_label",
'alpha');
99$search_societe =
GETPOST(
"search_societe",
'alpha');
100$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
101$search_status =
GETPOST(
"search_status",
'int');
102$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
103$search_opp_percent =
GETPOST(
"search_opp_percent",
'alpha');
104$search_opp_amount =
GETPOST(
"search_opp_amount",
'alpha');
105$search_budget_amount =
GETPOST(
"search_budget_amount",
'alpha');
106$search_public =
GETPOST(
"search_public",
'int');
107$search_project_user =
GETPOST(
'search_project_user',
'int');
108$search_project_contact =
GETPOST(
'search_project_contact',
'int');
109$search_sale =
GETPOST(
'search_sale',
'int');
110$search_usage_opportunity =
GETPOST(
'search_usage_opportunity',
'int');
111$search_usage_task =
GETPOST(
'search_usage_task',
'int');
112$search_usage_bill_time =
GETPOST(
'search_usage_bill_time',
'int');
113$search_usage_event_organization =
GETPOST(
'search_usage_event_organization',
'int');
114$search_accept_conference_suggestions =
GETPOST(
'search_accept_conference_suggestions',
'int');
115$search_accept_booth_suggestions =
GETPOST(
'search_accept_booth_suggestions',
'int');
116$search_price_registration =
GETPOST(
"search_price_registration",
'alpha');
117$search_price_booth =
GETPOST(
"search_price_booth",
'alpha');
118$search_login =
GETPOST(
'search_login',
'alpha');
119$search_import_key =
GETPOST(
'search_import_key',
'alpha');
120$searchCategoryCustomerOperator = 0;
121if (GETPOSTISSET(
'formfilteraction')) {
122 $searchCategoryCustomerOperator =
GETPOST(
'search_category_customer_operator',
'int');
123} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
124 $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
126$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
128 $search_omitChildren =
GETPOST(
'search_omitChildren',
'alpha') ==
'on' ? 1 : 0;
132$mine = ((
GETPOST(
'mode') ==
'mine') ? 1 : 0);
134 $search_project_user = $user->id; $mine = 0;
137$search_sday =
GETPOST(
'search_sday',
'int');
138$search_smonth =
GETPOST(
'search_smonth',
'int');
139$search_syear =
GETPOST(
'search_syear',
'int');
140$search_eday =
GETPOST(
'search_eday',
'int');
141$search_emonth =
GETPOST(
'search_emonth',
'int');
142$search_eyear =
GETPOST(
'search_eyear',
'int');
144$search_date_start_startmonth =
GETPOST(
'search_date_start_startmonth',
'int');
145$search_date_start_startyear =
GETPOST(
'search_date_start_startyear',
'int');
146$search_date_start_startday =
GETPOST(
'search_date_start_startday',
'int');
147$search_date_start_start =
dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear);
148$search_date_start_endmonth =
GETPOST(
'search_date_start_endmonth',
'int');
149$search_date_start_endyear =
GETPOST(
'search_date_start_endyear',
'int');
150$search_date_start_endday =
GETPOST(
'search_date_start_endday',
'int');
151$search_date_start_end =
dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear);
153$search_date_end_startmonth =
GETPOST(
'search_date_end_startmonth',
'int');
154$search_date_end_startyear =
GETPOST(
'search_date_end_startyear',
'int');
155$search_date_end_startday =
GETPOST(
'search_date_end_startday',
'int');
156$search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
157$search_date_end_endmonth =
GETPOST(
'search_date_end_endmonth',
'int');
158$search_date_end_endyear =
GETPOST(
'search_date_end_endyear',
'int');
159$search_date_end_endday =
GETPOST(
'search_date_end_endday',
'int');
160$search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
162if (isModEnabled(
'categorie')) {
163 $search_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PROJECT.
"_list",
"array");
166if ($search_status ==
'') {
173$hookmanager->initHooks(array(
'projectlist'));
177$extrafields->fetch_name_optionals_label($object->table_element);
179$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
182$fieldstosearchall = array();
183foreach ($object->fields as $key => $val) {
184 if (empty($val[
'searchall'])) {
189 if (!empty($user->socid) && $key ==
"note_private") {
193 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
197$fieldstosearchall[
's.nom'] =
"ThirdPartyName";
198$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
199$fieldstosearchall[
's.code_client'] =
"CustomerCode";
202$arrayfields = array();
203foreach ($object->fields as $key => $val) {
205 if (!empty($val[
'visible'])) {
206 $visible =
dol_eval($val[
'visible'], 1, 1,
'1');
207 $arrayfields[
'p.'.$key] = array(
208 'label'=>$val[
'label'],
209 'checked'=>(($visible < 0) ? 0 : 1),
210 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
211 'position'=>$val[
'position'],
212 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
217include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
220$arrayfields[
's.nom'] = array(
'label'=>$langs->trans(
"ThirdParty"),
'checked'=>1,
'position'=>21,
'enabled'=>(!isModEnabled(
'societe') ? 0 : 1));
221$arrayfields[
's.name_alias'] = array(
'label'=>
"AliasNameShort",
'checked'=>0,
'position'=>22);
222$arrayfields[
'commercial'] = array(
'label'=>$langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked'=>0,
'position'=>23);
223$arrayfields[
'c.assigned'] = array(
'label'=>$langs->trans(
"AssignedTo"),
'checked'=>1,
'position'=>120);
224$arrayfields[
'opp_weighted_amount'] = array(
'label'=>$langs->trans(
'OpportunityWeightedAmountShort'),
'checked'=>0,
'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1),
'position'=>106);
225$arrayfields[
'u.login'] = array(
'label'=>
"Author",
'checked'=>-1,
'position'=>165);
227if (
GETPOST(
'search_usage_opportunity')) {
231if (
GETPOST(
'search_usage_event_organization')) {
232 $arrayfields[
'p.fk_opp_status'][
'enabled'] = 0;
233 $arrayfields[
'p.opp_amount'][
'enabled'] = 0;
234 $arrayfields[
'p.opp_percent'][
'enabled'] = 0;
235 $arrayfields[
'opp_weighted_amount'][
'enabled'] = 0;
236 $arrayfields[
'p.usage_organize_event'][
'visible'] = 1;
237 $arrayfields[
'p.usage_organize_event'][
'checked'] = 1;
248if (
GETPOST(
'cancel',
'alpha')) {
252if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
256$parameters = array(
'socid'=>$socid);
257$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
262if (empty($reshook)) {
264 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
267 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
271 $search_societe =
"";
272 $search_societe_alias =
'';
274 $search_opp_status = -1;
275 $search_opp_amount =
'';
276 $search_opp_percent =
'';
277 $search_budget_amount =
'';
280 $search_project_user =
'';
281 $search_project_contact =
'';
288 $search_date_start_startmonth =
"";
289 $search_date_start_startyear =
"";
290 $search_date_start_startday =
"";
291 $search_date_start_start =
"";
292 $search_date_start_endmonth =
"";
293 $search_date_start_endyear =
"";
294 $search_date_start_endday =
"";
295 $search_date_start_end =
"";
296 $search_date_end_startmonth =
"";
297 $search_date_end_startyear =
"";
298 $search_date_end_startday =
"";
299 $search_date_end_start =
"";
300 $search_date_end_endmonth =
"";
301 $search_date_end_endyear =
"";
302 $search_date_end_endday =
"";
303 $search_date_end_end =
"";
304 $search_usage_opportunity =
'';
305 $search_usage_task =
'';
306 $search_usage_bill_time =
'';
307 $search_usage_event_organization =
'';
308 $search_accept_conference_suggestions =
'';
309 $search_accept_booth_suggestions =
'';
310 $search_price_registration =
'';
311 $search_price_booth =
'';
313 $search_import_key =
'';
315 $search_array_options = array();
316 $search_category_array = array();
321 $objectclass =
'Project';
322 $objectlabel =
'Project';
323 $permissiontoread = $user->hasRight(
'projet',
'lire');
324 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
325 $permissiontoadd = $user->hasRight(
'projet',
'creer');
326 $uploaddir = $conf->project->dir_output;
327 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
330 if (!$error && $massaction ==
'close' && $user->hasRight(
'projet',
'creer')) {
333 $objecttmp =
new $objectclass($db);
335 foreach ($toselect as $toselectid) {
336 $result = $objecttmp->fetch($toselectid);
338 $userWrite = $object->restrictedProjectArea($user,
'write');
339 if ($userWrite > 0 && $objecttmp->statut == 1) {
340 $result = $objecttmp->setClose($user);
348 } elseif ($userWrite <= 0) {
349 setEventMessages($langs->trans(
"DontHavePermissionForCloseProject", $objecttmp->ref),
null,
'warnings');
351 setEventMessages($langs->trans(
"DontHaveTheValidateStatus", $objecttmp->ref),
null,
'warnings');
378unset($_SESSION[
'pageforbacktolist'][
'project']);
380$form =
new Form($db);
385$companystatic =
new Societe($db);
386$taskstatic =
new Task($db);
389$userstatic =
new User($db);
391$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
392$title = $langs->trans(
"LeadsOrProjects");
393if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
394 $title = $langs->trans(
"Projects");
396if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) {
397 $title = $langs->trans(
"Leads");
405if (empty($user->rights->projet->all->lire)) {
406 $projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
410$listofprojectcontacttype = array();
411$listofprojectcontacttypeexternal = array();
412$sql =
"SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
413$sql .=
" WHERE ctc.element = '".$db->escape($object->element).
"'";
414$resql = $db->query($sql);
416 while ($obj = $db->fetch_object($resql)) {
417 if ($obj->source ==
'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code;
418 else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
423if (count($listofprojectcontacttype) == 0) {
424 $listofprojectcontacttype[0] =
'0';
426if (count($listofprojectcontacttypeexternal) == 0) {
427 $listofprojectcontacttypeexternal[0] =
'0';
430$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
431$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
433$distinct =
'DISTINCT';
434$sql =
"SELECT ".$distinct.
" p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
435$sql .=
" p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,";
436$sql .=
" p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
437$sql .=
" p.email_msgid, p.import_key,";
438$sql .=
" p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,";
439$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,";
440$sql .=
" country.code as country_code,";
441$sql .=
" cls.code as opp_status_code,";
442$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';
444if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
445 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
446 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
450$parameters = array();
451$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
452$sql .= $hookmanager->resPrint;
453$sql = preg_replace(
'/,\s*$/',
'', $sql);
457$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as p";
458if (!empty($extrafields->attributes[$object->table_element][
'label']) &&is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
459 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
461$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
462$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
463$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_lead_status as cls on p.fk_opp_status = cls.rowid";
464$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON p.fk_user_creat = u.rowid';
468if ($search_sale > 0) {
469 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
471if ($search_project_user > 0) {
472 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
474if ($search_project_contact > 0) {
475 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp_contact";
478$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
479$sql .= $hookmanager->resPrint;
481$sql .=
" WHERE p.entity IN (".getEntity(
'project', (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
')';
482if (empty($user->rights->projet->all->lire)) {
483 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
487 $sql .=
" AND (p.fk_soc = ".((int) $socid).
")";
495if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
496 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
498 if ($search_societe) {
501 if ($search_societe_alias) {
505if ($search_opp_amount) {
508if ($search_opp_percent) {
511$sql .=
dolSqlDateFilter(
'p.dateo', $search_sday, $search_smonth, $search_syear);
512$sql .=
dolSqlDateFilter(
'p.datee', $search_eday, $search_emonth, $search_eyear);
514if ($search_date_start_start) {
515 $sql .=
" AND p.dateo >= '".$db->idate($search_date_start_start).
"'";
517if ($search_date_start_end) {
518 $sql .=
" AND p.dateo <= '".$db->idate($search_date_start_end).
"'";
521if ($search_date_end_start) {
522 $sql .=
" AND p.datee >= '".$db->idate($search_date_end_start).
"'";
524if ($search_date_end_end) {
525 $sql .=
" AND p.datee <= '".$db->idate($search_date_end_end).
"'";
529 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
531if ($search_status >= 0) {
532 if ($search_status == 99) {
533 $sql .=
" AND p.fk_statut <> 2";
535 $sql .=
" AND p.fk_statut = ".((int) $search_status);
538if ($search_opp_status) {
539 if (is_numeric($search_opp_status) && $search_opp_status > 0) {
540 $sql .=
" AND p.fk_opp_status = ".((int) $search_opp_status);
542 if ($search_opp_status ==
'all') {
543 $sql .=
" AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)";
545 if ($search_opp_status ==
'openedopp') {
546 $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'))";
548 if ($search_opp_status ==
'notopenedopp') {
549 $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'))";
551 if ($search_opp_status ==
'none') {
552 $sql .=
" AND (p.fk_opp_status IS NULL OR p.fk_opp_status = -1)";
555if ($search_public !=
'') {
556 $sql .=
" AND p.public = ".((int) $search_public);
560if ($search_sale > 0) {
561 $sql .=
" AND sc.fk_user = ".((int) $search_sale);
565if ($search_project_user > 0) {
567 $sql .=
" AND ecp.fk_c_type_contact IN (".$db->sanitize(join(
',', array_keys($listofprojectcontacttype))).
") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
569if ($search_project_contact > 0) {
571 $sql .=
" AND ecp_contact.fk_c_type_contact IN (".$db->sanitize(join(
',', array_keys($listofprojectcontacttypeexternal))).
") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact);
573if ($search_opp_amount !=
'') {
576if ($search_budget_amount !=
'') {
577 $sql .=
natural_search(
'p.budget_amount', $search_budget_amount, 1);
579if ($search_usage_opportunity !=
'' && $search_usage_opportunity >= 0) {
580 $sql .=
natural_search(
'p.usage_opportunity', $search_usage_opportunity, 2);
582if ($search_usage_task !=
'' && $search_usage_task >= 0) {
585if ($search_usage_bill_time !=
'' && $search_usage_bill_time >= 0) {
586 $sql .=
natural_search(
'p.usage_bill_time', $search_usage_bill_time, 2);
588if ($search_usage_event_organization !=
'' && $search_usage_event_organization >= 0) {
589 $sql .=
natural_search(
'p.usage_organize_event', $search_usage_event_organization, 2);
591if ($search_accept_conference_suggestions !=
'' && $search_accept_conference_suggestions >= 0) {
592 $sql .=
natural_search(
'p.accept_conference_suggestions', $search_accept_conference_suggestions, 2);
594if ($search_accept_booth_suggestions !=
'' && $search_accept_booth_suggestions >= 0) {
595 $sql .=
natural_search(
'p.accept_booth_suggestions', $search_accept_booth_suggestions, 2);
597if ($search_price_registration !=
'') {
598 $sql .=
natural_search(
'p.price_registration', $search_price_registration, 1);
600if ($search_price_booth !=
'') {
604 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
606if ($search_import_key) {
607 $sql .=
natural_search(array(
'p.import_key'), $search_import_key);
610 if ($search_omitChildren == 1) {
611 $sql .=
" AND p.fk_project IS NULL";
616$searchCategoryProjectList = $search_category_array;
617$searchCategoryProjectOperator = 0;
618if (!empty($searchCategoryProjectList)) {
619 $searchCategoryProjectSqlList = array();
620 $listofcategoryid =
'';
621 foreach ($searchCategoryProjectList as $searchCategoryProject) {
622 if (intval($searchCategoryProject) == -2) {
623 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
624 } elseif (intval($searchCategoryProject) > 0) {
625 if ($searchCategoryProjectOperator == 0) {
626 $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).
")";
628 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
632 if ($listofcategoryid) {
633 $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).
"))";
635 if ($searchCategoryProjectOperator == 1) {
636 if (!empty($searchCategoryProjectSqlList)) {
637 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
640 if (!empty($searchCategoryProjectSqlList)) {
641 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
645$searchCategoryCustomerSqlList = array();
646if ($searchCategoryCustomerOperator == 1) {
647 $existsCategoryCustomerList = array();
648 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
649 if (intval($searchCategoryCustomer) == -2) {
650 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
651 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
652 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
653 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
654 $sqlCategoryCustomerNotExists .=
" )";
655 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
656 } elseif (intval($searchCategoryCustomer) > 0) {
657 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
660 if (!empty($existsCategoryCustomerList)) {
661 $sqlCategoryCustomerExists =
" EXISTS (";
662 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
663 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
664 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
665 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
666 $sqlCategoryCustomerExists .=
" )";
667 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
669 if (!empty($searchCategoryCustomerSqlList)) {
670 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
673 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
674 if (intval($searchCategoryCustomer) == -2) {
675 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
676 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
677 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
678 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
679 $sqlCategoryCustomerNotExists .=
" )";
680 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
681 } elseif (intval($searchCategoryCustomer) > 0) {
682 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
685 if (!empty($searchCategoryCustomerSqlList)) {
686 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
690include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
692$parameters = array();
693$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
694$sql .= $hookmanager->resPrint;
698$nbtotalofrecords =
'';
701 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
702 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
703 $resql = $db->query($sqlforcount);
705 $objforcount = $db->fetch_object($resql);
706 $nbtotalofrecords = $objforcount->nbtotalofrecords;
711 if (($page * $limit) > $nbtotalofrecords) {
719$sql .= $db->order($sortfield, $sortorder);
721 $sql .= $db->plimit($limit + 1, $offset);
724$resql = $db->query($sql);
730$num = $db->num_rows($resql);
733if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
734 $obj = $db->fetch_object($resql);
735 header(
"Location: ".DOL_URL_ROOT.
'/projet/card.php?id='.$obj->id);
745$arrayofselected = is_array($toselect) ? $toselect : array();
749 $param .=
'&mode='.urlencode($mode);
751if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
752 $param .=
'&contextpage='.urlencode($contextpage);
754if ($limit > 0 && $limit != $conf->liste_limit) {
755 $param .=
'&limit='.((int) $limit);
757if ($search_all !=
'') {
758 $param .=
'&search_all='.urlencode($search_all);
761 $param .=
'&search_sday='.urlencode($search_sday);
764 $param .=
'&search_smonth='.urlencode($search_smonth);
767 $param .=
'&search_syear='.urlencode($search_syear);
770 $param .=
'&search_eday='.urlencode($search_eday);
773 $param .=
'&search_emonth='.urlencode($search_emonth);
776 $param .=
'&search_eyear='.urlencode($search_eyear);
778if ($search_date_start_startmonth) {
779 $param .=
'&search_date_start_startmonth='.urlencode($search_date_start_startmonth);
781if ($search_date_start_startyear) {
782 $param .=
'&search_date_start_startyear='.urlencode($search_date_start_startyear);
784if ($search_date_start_startday) {
785 $param .=
'&search_date_start_startday='.urlencode($search_date_start_startday);
787if ($search_date_start_start) {
788 $param .=
'&search_date_start_start='.urlencode($search_date_start_start);
790if ($search_date_start_endmonth) {
791 $param .=
'&search_date_start_endmonth='.urlencode($search_date_start_endmonth);
793if ($search_date_start_endyear) {
794 $param .=
'&search_date_start_endyear='.urlencode($search_date_start_endyear);
796if ($search_date_start_endday) {
797 $param .=
'&search_date_start_endday='.urlencode($search_date_start_endday);
799if ($search_date_start_end) {
800 $param .=
'&search_date_start_end='.urlencode($search_date_start_end);
802if ($search_date_end_startmonth) {
803 $param .=
'&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
805if ($search_date_end_startyear) {
806 $param .=
'&search_date_end_startyear='.urlencode($search_date_end_startyear);
808if ($search_date_end_startday) {
809 $param .=
'&search_date_end_startday='.urlencode($search_date_end_startday);
811if ($search_date_end_start) {
812 $param .=
'&search_date_end_start='.urlencode($search_date_end_start);
814if ($search_date_end_endmonth) {
815 $param .=
'&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
817if ($search_date_end_endyear) {
818 $param .=
'&search_date_end_endyear='.urlencode($search_date_end_endyear);
820if ($search_date_end_endday) {
821 $param .=
'&search_date_end_endday='.urlencode($search_date_end_endday);
823if ($search_date_end_end) {
824 $param .=
'&search_date_end_end=' . urlencode($search_date_end_end);
827 $param .=
'&socid='.urlencode($socid);
829if (!empty($search_category_array)) {
830 foreach ($search_category_array as $tmpval) {
831 $param .=
'&search_categegory_project_list[]='.urlencode($tmpval);
834if ($search_ref !=
'') {
835 $param .=
'&search_ref='.urlencode($search_ref);
837if ($search_label !=
'') {
838 $param .=
'&search_label='.urlencode($search_label);
840if ($search_societe !=
'') {
841 $param .=
'&search_societe='.urlencode($search_societe);
843if ($search_societe_alias !=
'') {
844 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
846if ($search_status >= 0) {
847 $param .=
'&search_status='.urlencode($search_status);
849if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'openedopp',
'notopenedopp',
'none'))) {
850 $param .=
'&search_opp_status='.urlencode($search_opp_status);
852if ($search_opp_percent !=
'') {
853 $param .=
'&search_opp_percent='.urlencode($search_opp_percent);
855if ($search_public !=
'') {
856 $param .=
'&search_public='.urlencode($search_public);
858if ($search_project_user > 0) {
859 $param .=
'&search_project_user='.urlencode($search_project_user);
861if ($search_project_contact > 0) {
862 $param .=
'&search_project_contact='.urlencode($search_project_contact);
864if ($search_sale > 0) {
865 $param .=
'&search_sale='.urlencode($search_sale);
867if ($search_opp_amount !=
'') {
868 $param .=
'&search_opp_amount='.urlencode($search_opp_amount);
870if ($search_budget_amount !=
'') {
871 $param .=
'&search_budget_amount='.urlencode($search_budget_amount);
873if ($search_usage_task !=
'') {
874 $param .=
'&search_usage_task='.urlencode($search_usage_task);
876if ($search_usage_bill_time !=
'') {
877 $param .=
'&search_usage_opportunity='.urlencode($search_usage_bill_time);
879if ($search_usage_event_organization !=
'') {
880 $param .=
'&search_usage_event_organization='.urlencode($search_usage_event_organization);
882if ($search_accept_conference_suggestions !=
'') {
883 $param .=
'&search_accept_conference_suggestions='.urlencode($search_accept_conference_suggestions);
885if ($search_accept_booth_suggestions !=
'') {
886 $param .=
'&search_accept_booth_suggestions='.urlencode($search_accept_booth_suggestions);
888if ($search_price_registration !=
'') {
889 $param .=
'&search_price_registration='.urlencode($search_price_registration);
891if ($search_price_booth !=
'') {
892 $param .=
'&search_price_booth='.urlencode($search_price_booth);
895 $param .=
'&search_login='.urlencode($search_login);
897if ($search_import_key) {
898 $param .=
'&search_import_key='.urlencode($search_import_key);
900if ($optioncss !=
'') {
901 $param .=
'&optioncss='.urlencode($optioncss);
903foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
904 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
907include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
910$arrayofmassactions = array(
911 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
912 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
917if ($user->hasRight(
'projet',
'creer')) {
918 $arrayofmassactions[
'close'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Close");
919 $arrayofmassactions[
'preaffectuser'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AffectUser");
921if ($user->hasRight(
'projet',
'supprimer')) {
922 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
924if (isModEnabled(
'category') && $user->hasRight(
'projet',
'creer')) {
925 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
927if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preaffectuser'))) {
928 $arrayofmassactions = array();
931$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
933$url = DOL_URL_ROOT.
'/projet/card.php?action=create';
935 $url .=
'&socid='.$socid;
937if ($search_usage_event_organization == 1) {
938 $url .=
'&usage_organize_event=1';
939 if (((
int) $search_usage_opportunity) < 1) {
940 $url .=
'&usage_opportunity=0';
945$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
946$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
947$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewProject'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'projet',
'creer'));
949print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
950if ($optioncss !=
'') {
951 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
953print
'<input type="hidden" name="token" value="'.newToken().
'">';
954print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
955print
'<input type="hidden" name="action" value="list">';
956print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
957print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
958print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
959print
'<input type="hidden" name="mode" value="'.$mode.
'">';
964if ($search_project_user == $user->id) {
965 $texthelp .= $langs->trans(
"MyProjectsDesc");
967 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
968 $texthelp .= $langs->trans(
"ProjectsDesc");
970 $texthelp .= $langs->trans(
"ProjectsPublicDesc");
974print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit, 0, 0, 1);
977$topicmail =
"Information";
978$modelmail =
"project";
980$trackid =
'proj'.$object->id;
981include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
984 foreach ($fieldstosearchall as $key => $val) {
985 $fieldstosearchall[$key] = $langs->trans($val);
987 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
993$moreforfilter .=
'<div class="divsearchfield">';
994$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
997if (empty($user->rights->user->user->lire)) {
998 $includeonly = array($user->id);
1000$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth300 widthcentpercentminusx');
1001$moreforfilter .=
'</div>';
1003$moreforfilter .=
'<div class="divsearchfield">';
1004$tmptitle = $langs->trans(
'ProjectsWithThisContact');
1005$moreforfilter .=
img_picto($tmptitle,
'contact',
'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact :
'',
'search_project_contact', $tmptitle,
'',
'', 0,
'maxwidth300 widthcentpercentminusx');
1006$moreforfilter .=
'</div>';
1009if ($user->rights->user->user->lire) {
1010 $langs->load(
"commercial");
1011 $moreforfilter .=
'<div class="divsearchfield">';
1012 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1013 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1014 $moreforfilter .=
'</div>';
1018if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1020 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array,
'minwidth300imp minwidth300 widthcentpercentminusx');
1023if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST) && isModEnabled(
"categorie") && $user->hasRight(
'categorie',
'lire')) {
1024 $moreforfilter .=
'<div class="divsearchfield">';
1025 $tmptitle = $langs->transnoentities(
'CustomersProspectsCategoriesShort');
1026 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1027 $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 1);
1028 $categoriesArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
1029 $moreforfilter .=
Form::multiselectarray(
'search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0,
'minwidth300im minwidth300 widthcentpercentminusx', 0, 0,
'',
'category', $tmptitle);
1030 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ?
' checked="checked"' :
'').
'/>';
1031 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_cus');
1032 $moreforfilter .=
'</div>';
1037 $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"' :
'').
'"> ';
1040if (!empty($moreforfilter)) {
1041 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1042 print $moreforfilter;
1043 $parameters = array();
1044 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
1045 print $hookmanager->resPrint;
1049$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1050$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1051$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1054print
'<div class="div-table-responsive">';
1055print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1059print
'<tr class="liste_titre_filter">';
1061if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1062 print
'<td class="liste_titre maxwidthsearch">';
1063 $searchpicto = $form->showFilterButtons(
'left');
1068if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1069 print
'<td class="liste_titre">';
1070 print
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'" size="6">';
1074if (!empty($arrayfields[
'p.title'][
'checked'])) {
1075 print
'<td class="liste_titre">';
1076 print
'<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).
'">';
1080if (!empty($arrayfields[
's.nom'][
'checked'])) {
1081 print
'<td class="liste_titre">';
1083 $tmpthirdparty =
new Societe($db);
1084 $tmpthirdparty->fetch($socid);
1085 $search_societe = $tmpthirdparty->name;
1087 print
'<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
1092if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1093 print
'<td class="liste_titre">';
1095 $tmpthirdparty =
new Societe($db);
1096 $tmpthirdparty->fetch($socid);
1097 $search_societe_alias = $tmpthirdparty->name_alias;
1099 print
'<input type="text" class="flat" name="search_societe_alias" size="8" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1103if (!empty($arrayfields[
'commercial'][
'checked'])) {
1104 print
'<td class="liste_titre"> </td>';
1107if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1108 print
'<td class="liste_titre center nowraponall">';
1114 print
'<div class="nowrap">';
1115 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'));
1117 print
'<div class="nowrap">';
1118 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'));
1123if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1124 print
'<td class="liste_titre center nowraponall">';
1130 print
'<div class="nowrap">';
1131 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'));
1133 print
'<div class="nowrap">';
1134 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'));
1139if (!empty($arrayfields[
'p.public'][
'checked'])) {
1140 print
'<td class="liste_titre center">';
1141 $array = array(
''=>
'', 0 => $langs->trans(
"PrivateProject"), 1 => $langs->trans(
"SharedProject"));
1142 print $form->selectarray(
'search_public', $array, $search_public, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1145if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1146 print
'<td class="liste_titre center">';
1150if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1151 print
'<td class="liste_titre nowrap center">';
1152 print $formproject->selectOpportunityStatus(
'search_opp_status', $search_opp_status, 1, 1, 1, 0,
'maxwidth125 nowrapoption', 1, 1);
1155if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1156 print
'<td class="liste_titre nowrap right">';
1157 print
'<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.
'">';
1160if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1161 print
'<td class="liste_titre nowrap right">';
1162 print
'<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.
'">';
1165if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1166 print
'<td class="liste_titre nowrap right">';
1169if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1170 print
'<td class="liste_titre nowrap right">';
1171 print
'<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.
'">';
1174if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1175 print
'<td class="liste_titre nowrap">';
1176 print $form->selectyesno(
'search_usage_opportunity', $search_usage_opportunity, 1,
false, 1, 1);
1180if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1181 print
'<td class="liste_titre nowrap">';
1182 print $form->selectyesno(
'search_usage_task', $search_usage_task, 1,
false, 1, 1);
1185if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1186 print
'<td class="liste_titre nowrap">';
1187 print $form->selectyesno(
'search_usage_bill_time', $search_usage_bill_time, 1,
false, 1, 1);
1190if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1191 print
'<td class="liste_titre nowrap">';
1192 print $form->selectyesno(
'search_usage_event_organization', $search_usage_event_organization, 1,
false, 1, 1);
1195if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1196 print
'<td class="liste_titre nowrap">';
1197 print $form->selectyesno(
'search_accept_conference_suggestions', $search_accept_conference_suggestions, 1,
false, 1, 1);
1200if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1201 print
'<td class="liste_titre nowrap">';
1202 print $form->selectyesno(
'search_accept_booth_suggestions', $search_accept_booth_suggestions, 1,
false, 1, 1);
1205if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1206 print
'<td class="liste_titre nowrap right">';
1207 print
'<input type="text" class="flat" name="search_price_registration" size="4" value="'.dol_escape_htmltag($search_price_registration).
'">';
1210if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1211 print
'<td class="liste_titre nowrap right">';
1212 print
'<input type="text" class="flat" name="search_price_booth" size="4" value="'.dol_escape_htmltag($search_price_booth).
'">';
1215if (!empty($arrayfields[
'u.login'][
'checked'])) {
1217 print
'<td class="liste_titre" align="center">';
1218 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1222include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1225$parameters = array(
'arrayfields'=>$arrayfields);
1226$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1227print $hookmanager->resPrint;
1228if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1230 print
'<td class="liste_titre">';
1233if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1235 print
'<td class="liste_titre">';
1238if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1240 print
'<td class="liste_titre">';
1243if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1246 print
'<input class="flat width75" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1249if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1250 print
'<td class="liste_titre center parentonrightofpage">';
1251 $arrayofstatus = array();
1252 foreach ($object->statuts_short as $key => $val) {
1253 $arrayofstatus[$key] = $langs->trans($val);
1255 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
' + '.$langs->trans(
'Opened').
')';
1256 print $form->selectarray(
'search_status', $arrayofstatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1260if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1261 print
'<td class="liste_titre maxwidthsearch">';
1262 $searchpicto = $form->showFilterButtons();
1268$totalarray = array();
1269$totalarray[
'nbfield'] = 0;
1273print
'<tr class="liste_titre">';
1275 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1276 $totalarray[
'nbfield']++;
1278if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1279 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1280 $totalarray[
'nbfield']++;
1282if (!empty($arrayfields[
'p.title'][
'checked'])) {
1283 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1284 $totalarray[
'nbfield']++;
1286if (!empty($arrayfields[
's.nom'][
'checked'])) {
1287 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1288 $totalarray[
'nbfield']++;
1290if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1291 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1292 $totalarray[
'nbfield']++;
1294if (!empty($arrayfields[
'commercial'][
'checked'])) {
1295 print_liste_field_titre($arrayfields[
'commercial'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder,
'tdoverflowmax100imp ');
1296 $totalarray[
'nbfield']++;
1298if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1299 print_liste_field_titre($arrayfields[
'p.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"p.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1300 $totalarray[
'nbfield']++;
1302if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1303 print_liste_field_titre($arrayfields[
'p.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1304 $totalarray[
'nbfield']++;
1306if (!empty($arrayfields[
'p.public'][
'checked'])) {
1307 print_liste_field_titre($arrayfields[
'p.public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.public",
"", $param,
"", $sortfield, $sortorder,
'center ');
1308 $totalarray[
'nbfield']++;
1310if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1311 print_liste_field_titre($arrayfields[
'c.assigned'][
'label'], $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ',
'');
1312 $totalarray[
'nbfield']++;
1314if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1315 print_liste_field_titre($arrayfields[
'p.fk_opp_status'][
'label'], $_SERVER[
"PHP_SELF"],
'p.fk_opp_status',
"", $param,
'', $sortfield, $sortorder,
'center ');
1316 $totalarray[
'nbfield']++;
1318if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1319 print_liste_field_titre($arrayfields[
'p.opp_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.opp_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1320 $totalarray[
'nbfield']++;
1322if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1323 print_liste_field_titre($arrayfields[
'p.opp_percent'][
'label'], $_SERVER[
'PHP_SELF'],
'p.opp_percent',
"", $param,
'', $sortfield, $sortorder,
'right ');
1324 $totalarray[
'nbfield']++;
1326if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1327 print_liste_field_titre($arrayfields[
'opp_weighted_amount'][
'label'], $_SERVER[
'PHP_SELF'],
'opp_weighted_amount',
'', $param,
'', $sortfield, $sortorder,
'right ');
1328 $totalarray[
'nbfield']++;
1330if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1331 print_liste_field_titre($arrayfields[
'p.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.budget_amount',
"", $param,
'', $sortfield, $sortorder,
'right ');
1332 $totalarray[
'nbfield']++;
1334if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1335 print_liste_field_titre($arrayfields[
'p.usage_opportunity'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_opportunity',
"", $param,
'', $sortfield, $sortorder,
'');
1336 $totalarray[
'nbfield']++;
1338if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1339 print_liste_field_titre($arrayfields[
'p.usage_task'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_task',
"", $param,
'', $sortfield, $sortorder,
'');
1340 $totalarray[
'nbfield']++;
1342if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1343 print_liste_field_titre($arrayfields[
'p.usage_bill_time'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_bill_time',
"", $param,
'', $sortfield, $sortorder,
'');
1344 $totalarray[
'nbfield']++;
1346if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1347 print_liste_field_titre($arrayfields[
'p.usage_organize_event'][
'label'], $_SERVER[
"PHP_SELF"],
'p.usage_organize_event',
"", $param,
'', $sortfield, $sortorder,
'');
1348 $totalarray[
'nbfield']++;
1350if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1351 print_liste_field_titre($arrayfields[
'p.accept_conference_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_conference_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1352 $totalarray[
'nbfield']++;
1354if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1355 print_liste_field_titre($arrayfields[
'p.accept_booth_suggestions'][
'label'], $_SERVER[
"PHP_SELF"],
'p.accept_booth_suggestions',
"", $param,
'', $sortfield, $sortorder,
'');
1356 $totalarray[
'nbfield']++;
1358if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'p.price_registration'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_registration',
"", $param,
'', $sortfield, $sortorder,
'right ');
1360 $totalarray[
'nbfield']++;
1362if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1363 print_liste_field_titre($arrayfields[
'p.price_booth'][
'label'], $_SERVER[
"PHP_SELF"],
'p.price_booth',
"", $param,
'', $sortfield, $sortorder,
'right ');
1364 $totalarray[
'nbfield']++;
1366if (!empty($arrayfields[
'u.login'][
'checked'])) {
1367 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1368 $totalarray[
'nbfield']++;
1371include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1373$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1374$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1375print $hookmanager->resPrint;
1376if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1378 $totalarray[
'nbfield']++;
1380if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1382 $totalarray[
'nbfield']++;
1384if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1385 print_liste_field_titre($arrayfields[
'p.email_msgid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email_msgid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1386 $totalarray[
'nbfield']++;
1388if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1389 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'');
1390 $totalarray[
'nbfield']++;
1392if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1394 $totalarray[
'nbfield']++;
1398 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1399 $totalarray[
'nbfield']++;
1405$savnbfield = $totalarray[
'nbfield'];
1410$imaxinloop = ($limit ? min($num, $limit) : $num);
1411while ($i < $imaxinloop) {
1412 $obj = $db->fetch_object($resql);
1417 $object->id = $obj->id;
1418 $object->ref = $obj->ref;
1419 $object->title = $obj->title;
1420 $object->fk_opp_status = $obj->fk_opp_status;
1421 $object->user_author_id = $obj->fk_user_creat;
1422 $object->date_creation = $db->jdate($obj->date_creation);
1423 $object->date_start = $db->jdate($obj->date_start);
1424 $object->date_end = $db->jdate($obj->date_end);
1425 $object->statut = $obj->status;
1426 $object->status = $obj->status;
1427 $object->public = $obj->public;
1428 $object->opp_percent = $obj->opp_percent;
1429 $object->opp_status = $obj->fk_opp_status;
1430 $object->opp_status_code = $obj->opp_status_code;
1431 $object->opp_amount = !empty($obj->opp_amount) ? $obj->opp_amount :
"";
1432 $object->opp_weighted_amount = $obj->opp_weighted_amount;
1433 $object->budget_amount = $obj->budget_amount;
1434 $object->usage_opportunity = $obj->usage_opportunity;
1435 $object->usage_task = $obj->usage_task;
1436 $object->usage_bill_time = $obj->usage_bill_time;
1437 $object->usage_organize_event = $obj->usage_organize_event;
1438 $object->email_msgid = $obj->email_msgid;
1439 $object->import_key = $obj->import_key;
1445 $companystatic->id = $obj->socid;
1446 $companystatic->name = $obj->name;
1447 $companystatic->name_alias = $obj->alias;
1448 $companystatic->client = $obj->client;
1449 $companystatic->code_client = $obj->code_client;
1450 $companystatic->email = $obj->email;
1451 $companystatic->phone = $obj->phone;
1452 $companystatic->address = $obj->address;
1453 $companystatic->zip = $obj->zip;
1454 $companystatic->town = $obj->town;
1455 $companystatic->country_code = $obj->country_code;
1457 $stringassignedusers =
'';
1459 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1461 foreach (array(
'internal',
'external') as $source) {
1462 $tab = $object->liste_contact(-1, $source, 0,
'', 1);
1463 $numcontact = count($tab);
1464 if (!empty($numcontact)) {
1465 foreach ($tab as $contactproject) {
1467 if ($source ==
'internal') {
1472 $c->fetch($contactproject[
'id']);
1473 if (!empty($c->photo)) {
1474 if (get_class($c) ==
'User') {
1475 $stringassignedusers .= $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'',
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1477 $stringassignedusers .= $c->getNomUrl(-2,
'', 0,
'', -1, 0,
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1480 if (get_class($c) ==
'User') {
1481 $stringassignedusers .= $c->getNomUrl(2,
'', 0, 0, 24, 1,
'',
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1483 $stringassignedusers .= $c->getNomUrl(2,
'', 0,
'', -1, 0,
'valignmiddle'.($ifisrt ?
'' :
' notfirst'));
1492 if ($mode ==
'kanban') {
1494 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1495 print
'<div class="box-flex-container kanban">';
1498 $selected = in_array($object->id, $arrayofselected);
1499 $arrayofdata = array(
'assignedusers' => $stringassignedusers,
'selected' => $selected);
1501 print $object->getKanbanView(
'', $arrayofdata);
1503 if ($i == ($imaxinloop - 1)) {
1509 $userstatic->id = $obj->fk_user_creat;
1510 $userstatic->login = $obj->login;
1511 $userstatic->lastname = $obj->lastname;
1512 $userstatic->firstname = $obj->firstname;
1513 $userstatic->email = $obj->user_email;
1514 $userstatic->statut = $obj->user_statut;
1515 $userstatic->entity = $obj->entity;
1516 $userstatic->photo = $obj->photo;
1517 $userstatic->office_phone = $obj->office_phone;
1518 $userstatic->office_fax = $obj->office_fax;
1519 $userstatic->user_mobile = $obj->user_mobile;
1520 $userstatic->job = $obj->job;
1521 $userstatic->gender = $obj->gender;
1525 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1528 print
'<td class="nowrap center">';
1529 if ($massactionbutton || $massaction) {
1531 if (in_array($object->id, $arrayofselected)) {
1534 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1538 $totalarray[
'nbfield']++;
1542 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1543 print
'<td class="nowraponall tdoverflowmax200">';
1544 print $object->getNomUrl(1, (!empty(
GETPOST(
'search_usage_event_organization',
'int'))?
'eventorganization':
''));
1545 if ($object->hasDelay()) {
1550 $totalarray[
'nbfield']++;
1554 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1555 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).
'">';
1559 $totalarray[
'nbfield']++;
1563 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1564 print
'<td class="tdoverflowmax125">';
1566 print $companystatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1572 $totalarray[
'nbfield']++;
1576 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1577 print
'<td class="tdoverflowmax100">';
1579 print $companystatic->name_alias;
1585 $totalarray[
'nbfield']++;
1589 if (!empty($arrayfields[
'commercial'][
'checked'])) {
1590 print
'<td class="tdoverflowmax150">';
1592 $companystatic->id = $obj->socid;
1593 $companystatic->name = $obj->name;
1594 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1595 $nbofsalesrepresentative = count($listsalesrepresentatives);
1596 if ($nbofsalesrepresentative > 6) {
1598 print $nbofsalesrepresentative;
1599 } elseif ($nbofsalesrepresentative > 0) {
1600 $userstatic =
new User($db);
1602 foreach ($listsalesrepresentatives as $val) {
1603 $userstatic->id = $val[
'id'];
1604 $userstatic->lastname = $val[
'lastname'];
1605 $userstatic->firstname = $val[
'firstname'];
1606 $userstatic->email = $val[
'email'];
1607 $userstatic->statut = $val[
'statut'];
1608 $userstatic->entity = $val[
'entity'];
1609 $userstatic->photo = $val[
'photo'];
1610 $userstatic->login = $val[
'login'];
1611 $userstatic->office_phone = $val[
'office_phone'];
1612 $userstatic->office_fax = $val[
'office_fax'];
1613 $userstatic->user_mobile = $val[
'user_mobile'];
1614 $userstatic->job = $val[
'job'];
1615 $userstatic->gender = $val[
'gender'];
1616 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1618 if ($j < $nbofsalesrepresentative) {
1629 $totalarray[
'nbfield']++;
1634 if (!empty($arrayfields[
'p.dateo'][
'checked'])) {
1635 print
'<td class="center">';
1639 $totalarray[
'nbfield']++;
1643 if (!empty($arrayfields[
'p.datee'][
'checked'])) {
1644 print
'<td class="center">';
1648 $totalarray[
'nbfield']++;
1653 if (!empty($arrayfields[
'p.public'][
'checked'])) {
1654 print
'<td class="center">';
1656 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1659 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1664 $totalarray[
'nbfield']++;
1668 if (!empty($arrayfields[
'c.assigned'][
'checked'])) {
1669 print
'<td class="center nowraponall tdoverflowmax200">';
1670 print $stringassignedusers;
1673 $totalarray[
'nbfield']++;
1677 if (!empty($arrayfields[
'p.fk_opp_status'][
'checked'])) {
1678 print
'<td class="center">';
1679 if ($obj->opp_status_code) {
1680 print $langs->trans(
"OppStatus".$obj->opp_status_code);
1684 $totalarray[
'nbfield']++;
1688 if (!empty($arrayfields[
'p.opp_amount'][
'checked'])) {
1689 print
'<td class="right">';
1691 if (strcmp($obj->opp_amount,
'')) {
1692 print
'<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1693 if (!isset($totalarray[
'val'][
'p.opp_amount'])) {
1694 $totalarray[
'val'][
'p.opp_amount'] = $obj->opp_amount;
1696 $totalarray[
'val'][
'p.opp_amount'] += $obj->opp_amount;
1701 $totalarray[
'nbfield']++;
1704 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.opp_amount';
1708 if (!empty($arrayfields[
'p.opp_percent'][
'checked'])) {
1709 print
'<td class="right">';
1710 if ($obj->opp_percent) {
1711 print
price($obj->opp_percent, 1, $langs, 1, 0).
'%';
1715 $totalarray[
'nbfield']++;
1719 if (!empty($arrayfields[
'opp_weighted_amount'][
'checked'])) {
1720 if (!isset($totalarray[
'val'][
'opp_weighted_amount'])) {
1721 $totalarray[
'val'][
'opp_weighted_amount'] = 0;
1723 print
'<td align="right">';
1724 if ($obj->opp_weighted_amount) {
1725 print
'<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1,
'').
'</span>';
1726 $totalarray[
'val'][
'opp_weighted_amount'] += $obj->opp_weighted_amount;
1730 $totalarray[
'nbfield']++;
1733 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'opp_weighted_amount';
1737 if (!empty($arrayfields[
'p.budget_amount'][
'checked'])) {
1738 print
'<td class="right">';
1739 if ($obj->budget_amount !=
'') {
1740 print
'<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).
'</span>';
1741 if (!isset($totalarray[
'val'][
'p.budget_amount'])) {
1742 $totalarray[
'val'][
'p.budget_amount'] = $obj->budget_amount;
1744 $totalarray[
'val'][
'p.budget_amount'] += $obj->budget_amount;
1749 $totalarray[
'nbfield']++;
1752 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.budget_amount';
1756 if (!empty($arrayfields[
'p.usage_opportunity'][
'checked'])) {
1757 print
'<td class="">';
1758 if ($obj->usage_opportunity) {
1759 print
yn($obj->usage_opportunity);
1763 $totalarray[
'nbfield']++;
1767 if (!empty($arrayfields[
'p.usage_task'][
'checked'])) {
1768 print
'<td class="">';
1769 if ($obj->usage_task) {
1770 print
yn($obj->usage_task);
1774 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
'p.usage_bill_time'][
'checked'])) {
1779 print
'<td class="">';
1780 if ($obj->usage_bill_time) {
1781 print
yn($obj->usage_bill_time);
1785 $totalarray[
'nbfield']++;
1789 if (!empty($arrayfields[
'p.usage_organize_event'][
'checked'])) {
1790 print
'<td class="">';
1791 if ($obj->usage_organize_event) {
1792 print
yn($obj->usage_organize_event);
1796 $totalarray[
'nbfield']++;
1800 if (!empty($arrayfields[
'p.accept_conference_suggestions'][
'checked'])) {
1801 print
'<td class="">';
1802 if ($obj->accept_conference_suggestions) {
1803 print
yn($obj->accept_conference_suggestions);
1807 $totalarray[
'nbfield']++;
1811 if (!empty($arrayfields[
'p.accept_booth_suggestions'][
'checked'])) {
1812 print
'<td class="">';
1813 if ($obj->accept_booth_suggestions) {
1814 print
yn($obj->accept_booth_suggestions);
1818 $totalarray[
'nbfield']++;
1822 if (!empty($arrayfields[
'p.price_registration'][
'checked'])) {
1823 print
'<td class="right">';
1824 if ($obj->price_registration !=
'') {
1825 print
'<span class="amount">'.price($obj->price_registration, 1, $langs, 1, -1, -1).
'</span>';
1826 $totalarray[
'val'][
'p.price_registration'] += $obj->price_registration;
1830 $totalarray[
'nbfield']++;
1833 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_registration';
1837 if (!empty($arrayfields[
'p.price_booth'][
'checked'])) {
1838 print
'<td class="right">';
1839 if ($obj->price_booth !=
'') {
1840 print
'<span class="amount">'.price($obj->price_booth, 1, $langs, 1, -1, -1).
'</span>';
1841 $totalarray[
'val'][
'p.price_booth'] += $obj->price_booth;
1845 $totalarray[
'nbfield']++;
1848 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.price_booth';
1852 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1853 print
'<td class="center tdoverflowmax150">';
1854 if ($userstatic->id) {
1855 print $userstatic->getNomUrl(-1);
1861 $totalarray[
'nbfield']++;
1865 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1867 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1868 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1869 print $hookmanager->resPrint;
1871 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1872 print
'<td class="center nowraponall">';
1873 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1876 $totalarray[
'nbfield']++;
1880 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1881 print
'<td class="center nowraponall">';
1882 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1885 $totalarray[
'nbfield']++;
1889 if (!empty($arrayfields[
'p.email_msgid'][
'checked'])) {
1890 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->email_msgid).
'">';
1894 $totalarray[
'nbfield']++;
1898 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1899 print
'<td class="right">'.dol_escape_htmltag($obj->import_key).
'</td>';
1901 $totalarray[
'nbfield']++;
1905 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1906 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
1908 $totalarray[
'nbfield']++;
1913 print
'<td class="nowrap center">';
1914 if ($massactionbutton || $massaction) {
1916 if (in_array($object->id, $arrayofselected)) {
1919 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1923 $totalarray[
'nbfield']++;
1935include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1940 foreach ($arrayfields as $key => $val) {
1941 if (!empty($val[
'checked'])) {
1945 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1950$parameters = array(
'arrayfields'=>$arrayfields,
'sql' => $sql);
1951$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1952print $hookmanager->resPrint;
1954print
'</table>'.
"\n";
1957print
'</form>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.