29require
"../../main.inc.php";
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37$langs->loadLangs(array(
'projects',
'users',
'companies'));
39$action =
GETPOST(
'action',
'aZ09');
40$massaction =
GETPOST(
'massaction',
'alpha');
41$show_files =
GETPOST(
'show_files',
'int');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$toselect =
GETPOST(
'toselect',
'array');
44$optioncss =
GETPOST(
'optioncss',
'aZ09');
49$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
50$search_categ =
GETPOST(
"search_categ",
'int');
52$search_projectstatus =
GETPOST(
'search_projectstatus');
53if (!isset($search_projectstatus) || $search_projectstatus ===
'') {
54 if ($search_all !=
'') {
55 $search_projectstatus = -1;
57 $search_projectstatus = 1;
61$search_project_ref =
GETPOST(
'search_project_ref');
62$search_project_title =
GETPOST(
'search_project_title');
63$search_task_ref =
GETPOST(
'search_task_ref');
64$search_task_label =
GETPOST(
'search_task_label');
65$search_task_description =
GETPOST(
'search_task_description');
66$search_task_ref_parent =
GETPOST(
'search_task_ref_parent');
67$search_project_user =
GETPOST(
'search_project_user',
'int');
68$search_task_user =
GETPOST(
'search_task_user',
'int');
69$search_task_progress =
GETPOST(
'search_task_progress');
70$search_task_budget_amount =
GETPOST(
'search_task_budget_amount');
71$search_societe =
GETPOST(
'search_societe');
72$search_societe_alias =
GETPOST(
'search_societe_alias');
73$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
74$searchCategoryCustomerOperator = 0;
75if (GETPOSTISSET(
'formfilteraction')) {
76 $searchCategoryCustomerOperator =
GETPOST(
'search_category_customer_operator',
'int');
77} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
78 $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
80$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
82$mine =
GETPOST(
'mode',
'alpha') ==
'mine' ? 1 : 0;
84 $search_task_user = $user->id;
89$search_date_startday =
GETPOST(
'search_date_startday',
'int');
90$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
91$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
92$search_date_endday =
GETPOST(
'search_date_endday',
'int');
93$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
94$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
95$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
96$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
97$search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
98$search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
99$search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
100$search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
101$search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
102$search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
103$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
104$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
107$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'tasklist';
110$object =
new Task($db);
111$hookmanager->initHooks(array(
'tasklist'));
115$extrafields->fetch_name_optionals_label($object->table_element);
116$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
121if (!$user->hasRight(
'projet',
'lire')) {
125$diroutputmassaction = $conf->project->dir_output.
'/tasks/temp/massgeneration/'.$user->id;
127$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
128$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
129$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
130$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
131if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
135$offset = $limit * $page;
136$pageprev = $page - 1;
137$pagenext = $page + 1;
139 $sortfield =
'p.ref';
146$fieldstosearchall = array(
149 't.description'=>
"Description",
150 't.note_public'=>
"NotePublic",
152if (empty($user->socid)) {
153 $fieldstosearchall[
't.note_private'] =
"NotePrivate";
157 't.fk_task_parent'=>array(
'label'=>
"RefTaskParent",
'checked'=>0,
'position'=>70),
158 't.ref'=>array(
'label'=>
"RefTask",
'checked'=>1,
'position'=>80),
159 't.label'=>array(
'label'=>
"LabelTask",
'checked'=>1,
'position'=>80),
160 't.description'=>array(
'label'=>
"Description",
'checked'=>0,
'position'=>80),
161 't.dateo'=>array(
'label'=>
"DateStart",
'checked'=>1,
'position'=>100),
162 't.datee'=>array(
'label'=>
"Deadline",
'checked'=>1,
'position'=>101),
163 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'position'=>151),
164 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'position'=>152),
165 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'csslist'=>
'tdoverflowmax125',
'position'=>200),
166 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>0,
'csslist'=>
'tdoverflowmax125',
'position'=>201),
167 'p.fk_statut'=>array(
'label'=>
"ProjectStatus",
'checked'=>1,
'position'=>205),
168 't.planned_workload'=>array(
'label'=>
"PlannedWorkload",
'checked'=>1,
'position'=>302),
169 't.duration_effective'=>array(
'label'=>
"TimeSpent",
'checked'=>1,
'position'=>303),
170 't.progress_calculated'=>array(
'label'=>
"ProgressCalculated",
'checked'=>1,
'position'=>304),
171 't.progress'=>array(
'label'=>
"ProgressDeclared",
'checked'=>1,
'position'=>305),
172 't.progress_summary'=>array(
'label'=>
"TaskProgressSummary",
'checked'=>1,
'position'=>306),
173 't.budget_amount'=>array(
'label'=>
"Budget",
'checked'=>0,
'position'=>307),
174 't.tobill'=>array(
'label'=>
"TimeToBill",
'checked'=>0,
'position'=>310),
175 't.billed'=>array(
'label'=>
"TimeBilled",
'checked'=>0,
'position'=>311),
176 't.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
177 't.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>501),
181include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
186$permissiontoread = $user->hasRight(
'projet',
'lire');
187$permissiontocreate = $user->hasRight(
'projet',
'creer');
188$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
197if (
GETPOST(
'cancel',
'alpha')) {
201if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
205$parameters = array(
'socid'=>$socid);
206$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
211if (empty($reshook)) {
213 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
216 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
219 $search_projectstatus = -1;
220 $search_project_ref =
"";
221 $search_societe =
"";
222 $search_societe_alias =
"";
223 $search_project_title =
"";
224 $search_task_ref =
"";
225 $search_task_label =
"";
226 $search_task_description =
"";
227 $search_task_ref_parent =
"";
228 $search_task_progress =
"";
229 $search_task_budget_amount =
"";
230 $search_task_user = -1;
231 $search_project_user = -1;
232 $search_date_startday =
'';
233 $search_date_startmonth =
'';
234 $search_date_startyear =
'';
235 $search_date_endday =
'';
236 $search_date_endmonth =
'';
237 $search_date_endyear =
'';
238 $search_date_start =
'';
239 $search_date_end =
'';
240 $search_datelimit_startday =
'';
241 $search_datelimit_startmonth =
'';
242 $search_datelimit_startyear =
'';
243 $search_datelimit_endday =
'';
244 $search_datelimit_endmonth =
'';
245 $search_datelimit_endyear =
'';
246 $search_datelimit_start =
'';
247 $search_datelimit_end =
'';
249 $searchCategoryCustomerList = array();
250 $search_array_options = array();
254 $objectclass =
'Task';
255 $objectlabel =
'Tasks';
256 $uploaddir = $conf->project->dir_output.
'/tasks';
257 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
260if (empty($search_projectstatus) && $search_projectstatus ==
'') {
261 $search_projectstatus = 1;
271$form =
new Form($db);
274$projectstatic =
new Project($db);
275$puser =
new User($db);
276$tuser =
new User($db);
280$title = $langs->trans(
"Activities");
281$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
285if ($search_project_user > 0) {
286 $puser->fetch($search_project_user);
288if ($search_task_user > 0) {
289 $tuser->fetch($search_task_user);
293$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
294$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
298 $projectstatic->fetch($id);
299 $projectstatic->fetch_thirdparty();
303if (empty($user->rights->projet->all->lire)) {
304 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
309$listofprojectcontacttype = array();
310$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
311$sql .=
" WHERE ctc.element = '".$db->escape($projectstatic->element).
"'";
312$sql .=
" AND ctc.source = 'internal'";
313$resql = $db->query($sql);
315 while ($obj = $db->fetch_object($resql)) {
316 $listofprojectcontacttype[$obj->rowid] = $obj->code;
321if (count($listofprojectcontacttype) == 0) {
322 $listofprojectcontacttype[0] =
'0';
325$listoftaskcontacttype = array();
326$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
327$sql .=
" WHERE ctc.element = '".$db->escape($object->element).
"'";
328$sql .=
" AND ctc.source = 'internal'";
329$resql = $db->query($sql);
331 while ($obj = $db->fetch_object($resql)) {
332 $listoftaskcontacttype[$obj->rowid] = $obj->code;
337if (count($listoftaskcontacttype) == 0) {
338 $listoftaskcontacttype[0] =
'0';
343$distinct =
'DISTINCT';
344$sql =
"SELECT ".$distinct.
" p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.usage_bill_time,";
345$sql .=
" s.nom as name, s.name_alias as alias, s.rowid as socid,";
346$sql .=
" t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,";
347$sql .=
" t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut,";
348$sql .=
" t.description, t.fk_task_parent";
349$sql .=
" ,t.budget_amount";
351if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
352 $sql .=
" , SUM(tt.element_duration * ".$db->ifsql(
"invoice_id IS NULL",
"1",
"0").
") as tobill, SUM(tt.element_duration * ".$db->ifsql(
"invoice_id IS NULL",
"0",
"1").
") as billed";
355if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
356 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
357 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
361$parameters = array();
362$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
363$sql .= $hookmanager->resPrint;
364$sql = preg_replace(
'/,\s*$/',
'', $sql);
368$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
369$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
370$sql .=
", ".MAIN_DB_PREFIX.
"projet_task as t";
371if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
372 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_time as tt ON (tt.fk_element = t.rowid AND tt.elementtype = 'task')";
374if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
375 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
377if ($search_project_user > 0) {
378 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
380if ($search_task_user > 0) {
381 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ect";
383$sql .=
" WHERE t.fk_projet = p.rowid";
384$sql .=
" AND p.entity IN (".getEntity(
'project').
')';
385if (empty($user->rights->projet->all->lire)) {
386 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId :
'0').
")";
388if (is_object($projectstatic) && $projectstatic->id > 0) {
389 $sql .=
" AND p.rowid = ".((int) $projectstatic->id);
393 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
395if ($search_project_ref) {
398if ($search_project_title) {
401if ($search_task_ref) {
404if ($search_task_label) {
407if ($search_task_description) {
408 $sql .=
natural_search(
't.description', $search_task_description);
410if ($search_task_ref_parent) {
411 $sql .=
' AND t.fk_task_parent IN (SELECT ipt.rowid FROM '.MAIN_DB_PREFIX.
'projet_task as ipt WHERE '.
natural_search(
'ipt.ref', $search_task_ref_parent, 0, 1).
')';
413if ($search_task_progress) {
416if ($search_task_budget_amount) {
417 $sql .=
natural_search(
't.budget_amount', $search_task_budget_amount, 1);
419if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
420 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
422 if ($search_societe) {
425 if ($search_societe_alias) {
429if ($search_date_start) {
430 $sql .=
" AND t.dateo >= '".$db->idate($search_date_start).
"'";
432if ($search_date_end) {
433 $sql .=
" AND t.dateo <= '".$db->idate($search_date_end).
"'";
435if ($search_datelimit_start) {
436 $sql .=
" AND t.datee >= '".$db->idate($search_datelimit_start).
"'";
438if ($search_datelimit_end) {
439 $sql .=
" AND t.datee <= '".$db->idate($search_datelimit_end).
"'";
442 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
444if ($search_projectstatus >= 0) {
445 if ($search_projectstatus == 99) {
446 $sql .=
" AND p.fk_statut <> 2";
448 $sql .=
" AND p.fk_statut = ".((int) $search_projectstatus);
451if ($search_project_user > 0) {
452 $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);
454if ($search_task_user > 0) {
455 $sql .=
" AND ect.fk_c_type_contact IN (".$db->sanitize(join(
',', array_keys($listoftaskcontacttype))).
") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".((int) $search_task_user);
458$searchCategoryProjectList = array($search_categ);
459$searchCategoryProjectOperator = 0;
460if (!empty($searchCategoryProjectList)) {
461 $searchCategoryProjectSqlList = array();
462 $listofcategoryid =
'';
463 foreach ($searchCategoryProjectList as $searchCategoryProject) {
464 if (intval($searchCategoryProject) == -2) {
465 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
466 } elseif (intval($searchCategoryProject) > 0) {
467 if ($searchCategoryProjectOperator == 0) {
468 $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).
")";
470 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
474 if ($listofcategoryid) {
475 $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).
"))";
477 if ($searchCategoryProjectOperator == 1) {
478 if (!empty($searchCategoryProjectSqlList)) {
479 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
482 if (!empty($searchCategoryProjectSqlList)) {
483 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
487$searchCategoryCustomerSqlList = array();
488if ($searchCategoryCustomerOperator == 1) {
489 $existsCategoryCustomerList = array();
490 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
491 if (intval($searchCategoryCustomer) == -2) {
492 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
493 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
494 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
495 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
496 $sqlCategoryCustomerNotExists .=
" )";
497 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
498 } elseif (intval($searchCategoryCustomer) > 0) {
499 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
502 if (!empty($existsCategoryCustomerList)) {
503 $sqlCategoryCustomerExists =
" EXISTS (";
504 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
505 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
506 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
507 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
508 $sqlCategoryCustomerExists .=
" )";
509 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
511 if (!empty($searchCategoryCustomerSqlList)) {
512 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
515 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
516 if (intval($searchCategoryCustomer) == -2) {
517 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
518 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
519 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
520 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
521 $sqlCategoryCustomerNotExists .=
" )";
522 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
523 } elseif (intval($searchCategoryCustomer) > 0) {
524 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
527 if (!empty($searchCategoryCustomerSqlList)) {
528 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
532include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
534$parameters = array();
535$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
536$sql .= $hookmanager->resPrint;
537if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
538 $sql .=
" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
539 $sql .=
" s.nom, s.rowid,";
540 $sql .=
" t.datec, t.dateo, t.datee, t.tms,";
541 $sql .=
" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut";
543 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
544 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
545 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
551$nbtotalofrecords =
'';
554 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
555 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
556 $resql = $db->query($sqlforcount);
558 $objforcount = $db->fetch_object($resql);
559 $nbtotalofrecords = $objforcount->nbtotalofrecords;
564 if (($page * $limit) > $nbtotalofrecords) {
572$sql .= $db->order($sortfield, $sortorder);
574 $sql .= $db->plimit($limit + 1, $offset);
577$resql = $db->query($sql);
583$num = $db->num_rows($resql);
587if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
588 $obj = $db->fetch_object($resql);
590 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$id.
'&withproject=1');
598llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
600$arrayofselected = is_array($toselect) ? $toselect : array();
604 $param .=
'&mode='.urlencode($mode);
606if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
607 $param .=
'&contextpage='.urlencode($contextpage);
609if ($limit > 0 && $limit != $conf->liste_limit) {
610 $param .=
'&limit='.((int) $limit);
612if ($search_date_startday) {
613 $param .=
'&search_date_startday='.urlencode($search_date_startday);
615if ($search_date_startmonth) {
616 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
618if ($search_date_startyear) {
619 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
621if ($search_date_endday) {
622 $param .=
'&search_date_endday='.urlencode($search_date_endday);
624if ($search_date_endmonth) {
625 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
627if ($search_date_endyear) {
628 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
630if ($search_datelimit_startday) {
631 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
633if ($search_datelimit_startmonth) {
634 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
636if ($search_datelimit_startyear) {
637 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
639if ($search_datelimit_endday) {
640 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
642if ($search_datelimit_endmonth) {
643 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
645if ($search_datelimit_endyear) {
646 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
648if ($search_task_budget_amount) {
649 $param .=
'&search_task_budget_amount='.urlencode($search_task_budget_amount);
652 $param .=
'&socid='.urlencode($socid);
654if ($search_all !=
'') {
655 $param .=
'&search_all='.urlencode($search_all);
657if ($search_project_ref !=
'') {
658 $param .=
'&search_project_ref='.urlencode($search_project_ref);
660if ($search_project_title !=
'') {
661 $param .=
'&search_project_title='.urlencode($search_project_title);
663if ($search_task_ref !=
'') {
664 $param .=
'&search_task_ref='.urlencode($search_task_ref);
666if ($search_task_label !=
'') {
667 $param .=
'&search_task_label='.urlencode($search_task_label);
669if ($search_task_description !=
'') {
670 $param .=
'&search_task_description='.urlencode($search_task_description);
672if ($search_task_ref_parent !=
'') {
673 $param .=
'&search_task_ref_parent='.urlencode($search_task_ref_parent);
675if ($search_task_progress !=
'') {
676 $param .=
'&search_task_progress='.urlencode($search_task_progress);
678if ($search_societe !=
'') {
679 $param .=
'&search_societe='.urlencode($search_societe);
681if ($search_societe !=
'') {
682 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
684if ($search_projectstatus !=
'') {
685 $param .=
'&search_projectstatus='.urlencode($search_projectstatus);
687if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'none'))) {
688 $param .=
'&search_opp_status='.urlencode($search_opp_status);
690if ($search_project_user !=
'') {
691 $param .=
'&search_project_user='.urlencode($search_project_user);
693if ($search_task_user > 0) {
694 $param .=
'&search_task_user='.urlencode($search_task_user);
696if ($optioncss !=
'') {
697 $param .=
'&optioncss='.urlencode($optioncss);
699foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
700 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
703include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
705$parameters = array();
706$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
707$param .= $hookmanager->resPrint;
710$arrayofmassactions = array(
715if (!empty($permissiontodelete)) {
716 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
718if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
719 $arrayofmassactions = array();
721$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
723print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
724if ($optioncss !=
'') {
725 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
727print
'<input type="hidden" name="token" value="'.newToken().
'">';
728print
'<input type="hidden" name="action" value="list">';
729print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
730print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
731print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
732print
'<input type="hidden" name="page" value="'.$page.
'">';
734 print
'<input type="hidden" name="type" value="'.$type.
'">';
736print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
737print
'<input type="hidden" name="page_y" value="">';
738print
'<input type="hidden" name="mode" value="'.$mode.
'">';
743$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'));
744$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'));
745$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?action=create',
'', $permissiontocreate);
750if ($search_task_user == $user->id) {
751 $texthelp .= $langs->trans(
"MyTasksDesc");
753 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
754 $texthelp .= $langs->trans(
"TasksOnProjectsDesc");
756 $texthelp .= $langs->trans(
"TasksOnProjectsPublicDesc");
760print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
762$topicmail =
"Information";
764$objecttmp =
new Task($db);
765$trackid =
'tas'.$object->id;
766include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
770 foreach ($fieldstosearchall as $key => $val) {
771 $fieldstosearchall[$key] = $langs->trans($val);
772 $setupstring .= $key.
"=".$val.
";";
774 print
'<!-- Search done like if TASK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
775 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
781if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
782 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
783 $moreforfilter .=
'<div class="divsearchfield">';
784 $tmptitle = $langs->trans(
'ProjectCategories');
785 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', $search_categ,
'search_categ', 1, $tmptitle,
'maxwidth300');
786 $moreforfilter .=
'</div>';
790$moreforfilter .=
'<div class="divsearchfield">';
791$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
793if (empty($user->rights->user->user->lire)) {
794 $includeonly = array($user->id);
796$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
797$moreforfilter .=
'</div>';
800$moreforfilter .=
'<div class="divsearchfield">';
801$tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
803if (empty($user->rights->user->user->lire)) {
804 $includeonly = array($user->id);
806$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_task_user,
'search_task_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
807$moreforfilter .=
'</div>';
810if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_TASK_LIST) && isModEnabled(
"categorie") && $user->hasRight(
'categorie',
'lire')) {
811 $moreforfilter .=
'<div class="divsearchfield">';
812 $tmptitle = $langs->transnoentities(
'CustomersProspectsCategoriesShort');
813 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
814 $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 1);
815 $categoriesArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
816 $moreforfilter .=
Form::multiselectarray(
'search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0,
'minwidth300', 0, 0,
'',
'category', $tmptitle);
817 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ?
' checked="checked"' :
'').
'/>';
818 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_cus');
819 $moreforfilter .=
'</div>';
822if (!empty($moreforfilter)) {
823 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
824 print $moreforfilter;
825 $parameters = array();
826 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
827 print $hookmanager->resPrint;
831$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
832$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
833$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
835print
'<div class="div-table-responsive">';
836print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
840print
'<tr class="liste_titre_filter">';
843 print
'<td class="liste_titre center maxwidthsearch">';
844 $searchpicto = $form->showFilterButtons(
'left');
848if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
849 print
'<td class="liste_titre">';
850 print
'<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).
'" size="4">';
853if (!empty($arrayfields[
't.ref'][
'checked'])) {
854 print
'<td class="liste_titre">';
855 print
'<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'" size="4">';
858if (!empty($arrayfields[
't.label'][
'checked'])) {
859 print
'<td class="liste_titre">';
860 print
'<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'" size="8">';
864if (!empty($arrayfields[
't.description'][
'checked'])) {
865 print
'<td class="liste_titre">';
866 print
'<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).
'" size="8">';
870if (!empty($arrayfields[
't.dateo'][
'checked'])) {
871 print
'<td class="liste_titre center">';
872 print
'<div class="nowrap">';
873 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
875 print
'<div class="nowrap">';
876 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
881if (!empty($arrayfields[
't.datee'][
'checked'])) {
882 print
'<td class="liste_titre center">';
883 print
'<div class="nowrap">';
884 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
886 print
'<div class="nowrap">';
887 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
893if (!empty($arrayfields[
'p.ref'][
'checked'])) {
894 print
'<td class="liste_titre">';
895 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'" size="4">';
898if (!empty($arrayfields[
'p.title'][
'checked'])) {
899 print
'<td class="liste_titre">';
900 print
'<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.
'" size="6">';
903if (!empty($arrayfields[
's.nom'][
'checked'])) {
904 print
'<td class="liste_titre">';
905 print
'<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'" size="4">';
908if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
909 print
'<td class="liste_titre">';
910 print
'<input type="text" class="flat" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'" size="4">';
913if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
914 print
'<td class="liste_titre center">';
915 $arrayofstatus = array();
916 foreach ($projectstatic->statuts_short as $key => $val) {
917 $arrayofstatus[$key] = $langs->trans($val);
919 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
'+'.$langs->trans(
'Opened').
')';
920 print $form->selectarray(
'search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
923if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
924 print
'<td class="liste_titre"></td>';
926if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
927 print
'<td class="liste_titre"></td>';
929if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
930 print
'<td class="liste_titre"></td>';
932if (!empty($arrayfields[
't.progress'][
'checked'])) {
933 print
'<td class="liste_titre center">';
934 print
'<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.
'" size="4">';
938if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
939 print
'<td class="liste_titre"></td>';
942if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
943 print
'<td class="liste_titre center">';
944 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
948if (!empty($arrayfields[
't.tobill'][
'checked'])) {
949 print
'<td class="liste_titre"></td>';
951if (!empty($arrayfields[
't.billed'][
'checked'])) {
952 print
'<td class="liste_titre"></td>';
955include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
957$parameters = array(
'arrayfields'=>$arrayfields);
958$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
959print $hookmanager->resPrint;
960if (!empty($arrayfields[
't.datec'][
'checked'])) {
962 print
'<td class="liste_titre">';
965if (!empty($arrayfields[
't.tms'][
'checked'])) {
967 print
'<td class="liste_titre">';
972 print
'<td class="liste_titre center maxwidthsearch">';
973 $searchpicto = $form->showFilterButtons();
982 't.planned_workload' => 0,
983 't.duration_effective' => 0,
985 't.budget_amount' => 0,
987 'totalplannedworkload' => 0,
988 'totaldurationeffective' => 0,
989 'totaldurationdeclared' => 0,
990 'totaltobillfield' => 0,
991 'totalbilledfield' => 0,
992 'totalbudget_amountfield' => 0,
993 'totalbudgetamount' => 0,
1000print
'<tr class="liste_titre">';
1003 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1004 $totalarray[
'nbfield']++;
1006if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1007 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
1008 $totalarray[
'nbfield']++;
1010if (!empty($arrayfields[
't.ref'][
'checked'])) {
1011 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
1012 $totalarray[
'nbfield']++;
1014if (!empty($arrayfields[
't.label'][
'checked'])) {
1015 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
1016 $totalarray[
'nbfield']++;
1018if (!empty($arrayfields[
't.description'][
'checked'])) {
1019 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
1020 $totalarray[
'nbfield']++;
1022if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1023 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1024 $totalarray[
'nbfield']++;
1026if (!empty($arrayfields[
't.datee'][
'checked'])) {
1027 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1028 $totalarray[
'nbfield']++;
1030if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1031 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1032 $totalarray[
'nbfield']++;
1034if (!empty($arrayfields[
'p.title'][
'checked'])) {
1035 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1036 $totalarray[
'nbfield']++;
1038if (!empty($arrayfields[
's.nom'][
'checked'])) {
1039 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1040 $totalarray[
'nbfield']++;
1042if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1043 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1044 $totalarray[
'nbfield']++;
1046if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1047 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1048 $totalarray[
'nbfield']++;
1050if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1051 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
1052 $totalarray[
'nbfield']++;
1054if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1055 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
1056 $totalarray[
'nbfield']++;
1058if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1059 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
1060 $totalarray[
'nbfield']++;
1062if (!empty($arrayfields[
't.progress'][
'checked'])) {
1063 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1064 $totalarray[
'nbfield']++;
1066if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1067 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1068 $totalarray[
'nbfield']++;
1070if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1071 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
1072 $totalarray[
'nbfield']++;
1074if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1075 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1076 $totalarray[
'nbfield']++;
1078if (!empty($arrayfields[
't.billed'][
'checked'])) {
1079 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1080 $totalarray[
'nbfield']++;
1083include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1086 'arrayfields' => $arrayfields,
1088 'sortfield' => $sortfield,
1089 'sortorder' => $sortorder,
1090 'totalarray' => &$totalarray,
1092$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1093print $hookmanager->resPrint;
1094if (!empty($arrayfields[
't.datec'][
'checked'])) {
1095 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1096 $totalarray[
'nbfield']++;
1098if (!empty($arrayfields[
't.tms'][
'checked'])) {
1099 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1100 $totalarray[
'nbfield']++;
1104 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1105 $totalarray[
'nbfield']++;
1109$plannedworkloadoutputformat =
'allhourmin';
1110$timespentoutputformat =
'allhourmin';
1111if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
1112 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
1114if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
1115 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
1121$savnbfield = $totalarray[
'nbfield'];
1122$totalarray = array();
1123$totalarray[
'nbfield'] = 0;
1124$imaxinloop = ($limit ? min($num, $limit) : $num);
1125while ($i < $imaxinloop) {
1126 $obj = $db->fetch_object($resql);
1132 $object->id = $obj->id;
1133 $object->ref = $obj->ref;
1134 $object->label = $obj->label;
1135 $object->description = $obj->description;
1136 $object->fk_statut = $obj->fk_statut;
1137 $object->progress = $obj->progress;
1138 $object->budget_amount = $obj->budget_amount;
1139 $object->date_start = $db->jdate($obj->date_start);
1140 $object->date_end = $db->jdate($obj->date_end);
1141 $object->planned_workload = $obj->planned_workload;
1142 $object->duration_effective = $obj->duration_effective;
1143 $object->fk_task_parent = $obj->fk_task_parent;
1145 $projectstatic->id = $obj->projectid;
1146 $projectstatic->ref = $obj->projectref;
1147 $projectstatic->title = $obj->projecttitle;
1148 $projectstatic->public = $obj->public;
1149 $projectstatic->statut = $obj->projectstatus;
1150 $projectstatic->datee = $db->jdate($obj->projectdatee);
1153 $socstatic->id = $obj->socid;
1154 $socstatic->name = $obj->name;
1155 $socstatic->name_alias = $obj->alias;
1157 if ($mode ==
'kanban') {
1159 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1160 print
'<div class="box-flex-container kanban">';
1163 if ($massactionbutton || $massaction) {
1165 if (in_array($object->id, $arrayofselected)) {
1170 $arraydata = array();
1171 $arraydata[
'projectlink'] = $projectstatic->getNomUrl(1);
1172 $arraydata[
'selected'] = in_array($object->id, $arrayofselected);
1174 print $object->getKanbanView(
'', $arraydata);
1175 if ($i == ($imaxinloop - 1)) {
1180 $userAccess = $projectstatic->restrictedProjectArea($user);
1181 if ($userAccess >= 0) {
1184 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1188 print
'<td class="nowrap center">';
1189 if ($massactionbutton || $massaction) {
1191 if (in_array($object->id, $arrayofselected)) {
1194 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1198 $totalarray[
'nbfield']++;
1202 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1203 print
'<td class="nowraponall">';
1204 if (!empty($object->fk_task_parent)) {
1205 $object_parent =
new Task($db);
1206 $result = $object_parent->fetch($object->fk_task_parent);
1210 print $object_parent->getNomUrl(1,
'withproject');
1211 if ($object_parent->hasDelay()) {
1218 $totalarray[
'nbfield']++;
1222 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1223 print
'<td class="nowraponall">';
1224 print $object->getNomUrl(1,
'withproject');
1225 if ($object->hasDelay()) {
1230 $totalarray[
'nbfield']++;
1234 if (!empty($arrayfields[
't.label'][
'checked'])) {
1235 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($object->label).
'">';
1239 $totalarray[
'nbfield']++;
1243 if (!empty($arrayfields[
't.description'][
'checked'])) {
1248 $totalarray[
'nbfield']++;
1253 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1254 print
'<td class="center">';
1258 $totalarray[
'nbfield']++;
1262 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1263 print
'<td class="center">';
1267 $totalarray[
'nbfield']++;
1271 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1272 print
'<td class="nowraponall tdoverflowmax150">';
1273 print $projectstatic->getNomUrl(1,
'task');
1274 if ($projectstatic->hasDelay()) {
1279 $totalarray[
'nbfield']++;
1283 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1284 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->projecttitle).
'">';
1288 $totalarray[
'nbfield']++;
1292 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1293 print
'<td class="tdoverflowmax125">';
1295 print $socstatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1301 $totalarray[
'nbfield']++;
1305 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1308 $name_alias = $socstatic->name_alias;
1310 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($name_alias).
'">';
1314 $totalarray[
'nbfield']++;
1318 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1319 print
'<td class="center">';
1320 print $projectstatic->getLibStatut(1);
1323 $totalarray[
'nbfield']++;
1328 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1329 print
'<td class="center">';
1332 if ($obj->planned_workload !=
'') {
1340 $totalarray[
'nbfield']++;
1343 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.planned_workload';
1345 if (!isset($totalarray[
'val'][
'planned_workload'])) {
1346 $totalarray[
'val'][
't.planned_workload'] = 0;
1348 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1350 $totalarray[
'totalplannedworkloadfield'] = $totalarray[
'nbfield'];
1352 if (!isset($totalarray[
'totalplannedworkload'])) {
1353 $totalarray[
'totalplannedworkload'] = 0;
1355 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1358 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1359 $showlineingray = 0; $showproject = 1;
1360 print
'<td class="center">';
1361 if ($showlineingray) {
1364 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1366 if ($obj->duration_effective) {
1371 if ($showlineingray) {
1378 $totalarray[
'nbfield']++;
1381 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.duration_effective';
1383 if (!isset($totalarray[
'val'][
't.duration_effective'])) {
1384 $totalarray[
'val'][
't.duration_effective'] = 0;
1386 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1388 $totalarray[
'totaldurationeffectivefield'] = $totalarray[
'nbfield'];
1390 if (!isset($totalarray[
'totaldurationeffective'])) {
1391 $totalarray[
'totaldurationeffective'] = 0;
1393 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1396 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1397 print
'<td class="center">';
1398 if ($obj->planned_workload || $obj->duration_effective) {
1399 if ($obj->planned_workload) {
1400 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1402 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1407 $totalarray[
'nbfield']++;
1410 $totalarray[
'totalprogress_calculatedfield'] = $totalarray[
'nbfield'];
1414 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1415 print
'<td class="center">';
1416 if ($obj->progress !=
'') {
1421 $totalarray[
'nbfield']++;
1424 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.progress';
1426 if (!isset($totalarray[
'val'][
't.progress'])) {
1427 $totalarray[
'val'][
't.progress'] = 0;
1429 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1431 $totalarray[
'totalprogress_declaredfield'] = $totalarray[
'nbfield'];
1433 if (!isset($totalarray[
'totaldurationdeclared'])) {
1434 $totalarray[
'totaldurationdeclared'] = 0;
1436 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1439 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1440 print
'<td class="center">';
1441 if ($obj->progress !=
'' && $obj->duration_effective) {
1446 $totalarray[
'nbfield']++;
1449 $totalarray[
'totalprogress_summary'] = $totalarray[
'nbfield'];
1453 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1454 print
'<td class="center">';
1455 if ($object->budget_amount) {
1456 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1460 $totalarray[
'nbfield']++;
1463 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.budget_amount';
1465 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1467 $totalarray[
'totalbudget_amountfield'] = $totalarray[
'nbfield'];
1469 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1472 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1473 print
'<td class="center">';
1474 if ($obj->usage_bill_time) {
1476 $totalarray[
'val'][
't.tobill'] += $obj->tobill;
1477 $totalarray[
'totaltobill'] += $obj->tobill;
1479 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1483 $totalarray[
'nbfield']++;
1486 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.tobill';
1489 $totalarray[
'totaltobillfield'] = $totalarray[
'nbfield'];
1493 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1494 print
'<td class="center">';
1495 if ($obj->usage_bill_time) {
1497 $totalarray[
'val'][
't.billed'] += $obj->billed;
1498 $totalarray[
'totalbilled'] += $obj->billed;
1500 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1504 $totalarray[
'nbfield']++;
1507 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.billed';
1510 $totalarray[
'totalbilledfield'] = $totalarray[
'nbfield'];
1514 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1516 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1517 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1518 print $hookmanager->resPrint;
1520 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1521 print
'<td class="center">';
1522 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1525 $totalarray[
'nbfield']++;
1529 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1530 print
'<td class="center">';
1531 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1534 $totalarray[
'nbfield']++;
1545 print
'<td class="nowrap center">';
1546 if ($massactionbutton || $massaction) {
1548 if (in_array($object->id, $arrayofselected)) {
1551 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1555 $totalarray[
'nbfield']++;
1567if (!empty($totalarray[
'totalizable']) && is_array($totalarray[
'totalizable'])) {
1568 foreach ($totalarray[
'totalizable'] as $keytotalizable => $valtotalizable) {
1569 $totalarray[
'pos'][$valtotalizable[
'pos']] = $keytotalizable;
1570 $totalarray[
'val'][$keytotalizable] = $valtotalizable[
'total'];
1574if (isset($totalarray[
'totaldurationeffectivefield']) || isset($totalarray[
'totalplannedworkloadfield']) || isset($totalarray[
'totalprogress_calculatedfield'])
1575 || isset($totalarray[
'totaltobill']) || isset($totalarray[
'totalbilled']) || isset($totalarray[
'totalbudget'])) {
1576 print
'<tr class="liste_total">';
1578 while ($i < $totalarray[
'nbfield']) {
1581 if ($num < $limit && empty($offset)) {
1582 print
'<td class="left">'.$langs->trans(
"Total").
'</td>';
1584 print
'<td class="left">'.$langs->trans(
"Totalforthispage").
'</td>';
1586 } elseif (isset($totalarray[
'totalplannedworkloadfield']) && $totalarray[
'totalplannedworkloadfield'] == $i) {
1587 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1588 } elseif (isset($totalarray[
'totaldurationeffectivefield']) && $totalarray[
'totaldurationeffectivefield'] == $i) {
1589 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1590 } elseif (isset($totalarray[
'totalprogress_calculatedfield']) && $totalarray[
'totalprogress_calculatedfield'] == $i) {
1591 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationeffective'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1592 } elseif (isset($totalarray[
'totalprogress_declaredfield']) && $totalarray[
'totalprogress_declaredfield'] == $i) {
1593 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationdeclared'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1594 } elseif (isset($totalarray[
'totaltobillfield']) && $totalarray[
'totaltobillfield'] == $i) {
1595 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1596 } elseif (isset($totalarray[
'totalbilledfield']) && $totalarray[
'totalbilledfield'] == $i) {
1597 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1598 } elseif (isset($totalarray[
'totalbudget_amountfield']) && $totalarray[
'totalbudget_amountfield'] == $i) {
1599 print
'<td class="center">'.price($totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).
'</td>';
1600 } elseif (!empty($totalarray[
'pos'][$i])) {
1601 print
'<td class="right">';
1602 if (isset($totalarray[
'type']) && $totalarray[
'type'][$i] ==
'duration') {
1603 print (!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ?
convertSecondToTime($totalarray[
'val'][$totalarray[
'pos'][$i]],
'allhourmin') : 0);
1605 print
price(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]])?$totalarray[
'val'][$totalarray[
'pos'][$i]]:0);
1617$parameters = array(
'arrayfields'=>$arrayfields,
'sql' => $sql);
1618$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1619print $hookmanager->resPrint;
1621print
'</table>'.
"\n";
1624print
'</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.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
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.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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...
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...
getTaskProgressView($task, $label=true, $progressNumber=true, $hideOnProgressNull=false, $spaced=false)
getTaskProgressBadge($task, $label='', $tooltip='')
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.