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');
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');
190if (!$permissiontoread) {
199if (
GETPOST(
'cancel',
'alpha')) {
203if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
207$parameters = array(
'socid'=>$socid);
208$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
213if (empty($reshook)) {
215 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
218 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
221 $search_projectstatus = -1;
222 $search_project_ref =
"";
223 $search_societe =
"";
224 $search_societe_alias =
"";
225 $search_project_title =
"";
226 $search_task_ref =
"";
227 $search_task_label =
"";
228 $search_task_description =
"";
229 $search_task_ref_parent =
"";
230 $search_task_progress =
"";
231 $search_task_budget_amount =
"";
232 $search_task_user = -1;
233 $search_project_user = -1;
234 $search_date_startday =
'';
235 $search_date_startmonth =
'';
236 $search_date_startyear =
'';
237 $search_date_endday =
'';
238 $search_date_endmonth =
'';
239 $search_date_endyear =
'';
240 $search_date_start =
'';
241 $search_date_end =
'';
242 $search_datelimit_startday =
'';
243 $search_datelimit_startmonth =
'';
244 $search_datelimit_startyear =
'';
245 $search_datelimit_endday =
'';
246 $search_datelimit_endmonth =
'';
247 $search_datelimit_endyear =
'';
248 $search_datelimit_start =
'';
249 $search_datelimit_end =
'';
251 $searchCategoryCustomerList = array();
252 $search_array_options = array();
256 $objectclass =
'Task';
257 $objectlabel =
'Tasks';
258 $uploaddir = $conf->project->dir_output.
'/tasks';
259 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
262if (empty($search_projectstatus) && $search_projectstatus ==
'') {
263 $search_projectstatus = 1;
273$form =
new Form($db);
276$projectstatic =
new Project($db);
277$puser =
new User($db);
278$tuser =
new User($db);
282$title = $langs->trans(
"Activities");
283$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
287if ($search_project_user > 0) {
288 $puser->fetch($search_project_user);
290if ($search_task_user > 0) {
291 $tuser->fetch($search_task_user);
295$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
296$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
300 $projectstatic->fetch($id);
301 $projectstatic->fetch_thirdparty();
305if (!$user->hasRight(
'projet',
'all',
'lire')) {
306 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
311$listofprojectcontacttype = array();
312$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
313$sql .=
" WHERE ctc.element = '".$db->escape($projectstatic->element).
"'";
314$sql .=
" AND ctc.source = 'internal'";
315$resql = $db->query($sql);
317 while ($obj = $db->fetch_object($resql)) {
318 $listofprojectcontacttype[$obj->rowid] = $obj->code;
323if (count($listofprojectcontacttype) == 0) {
324 $listofprojectcontacttype[0] =
'0';
327$listoftaskcontacttype = array();
328$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
329$sql .=
" WHERE ctc.element = '".$db->escape($object->element).
"'";
330$sql .=
" AND ctc.source = 'internal'";
331$resql = $db->query($sql);
333 while ($obj = $db->fetch_object($resql)) {
334 $listoftaskcontacttype[$obj->rowid] = $obj->code;
339if (count($listoftaskcontacttype) == 0) {
340 $listoftaskcontacttype[0] =
'0';
345$distinct =
'DISTINCT';
346$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,";
347$sql .=
" s.nom as name, s.name_alias as alias, s.rowid as socid,";
348$sql .=
" t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,";
349$sql .=
" t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut,";
350$sql .=
" t.description, t.fk_task_parent";
351$sql .=
" ,t.budget_amount";
353if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
354 $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";
357if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
358 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
359 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
363$parameters = array();
364$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
365$sql .= $hookmanager->resPrint;
366$sql = preg_replace(
'/,\s*$/',
'', $sql);
370$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
371$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
372$sql .=
", ".MAIN_DB_PREFIX.
"projet_task as t";
373if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
374 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_time as tt ON (tt.fk_element = t.rowid AND tt.elementtype = 'task')";
376if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
377 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
379if ($search_project_user > 0) {
380 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
382if ($search_task_user > 0) {
383 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ect";
385$sql .=
" WHERE t.fk_projet = p.rowid";
386$sql .=
" AND p.entity IN (".getEntity(
'project').
')';
387if (!$user->hasRight(
'projet',
'all',
'lire')) {
388 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId :
'0').
")";
390if (is_object($projectstatic) && $projectstatic->id > 0) {
391 $sql .=
" AND p.rowid = ".((int) $projectstatic->id);
395 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
397if ($search_project_ref) {
400if ($search_project_title) {
403if ($search_task_ref) {
406if ($search_task_label) {
409if ($search_task_description) {
410 $sql .=
natural_search(
't.description', $search_task_description);
412if ($search_task_ref_parent) {
413 $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).
')';
415if ($search_task_progress) {
418if ($search_task_budget_amount) {
419 $sql .=
natural_search(
't.budget_amount', $search_task_budget_amount, 1);
421if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
422 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
424 if ($search_societe) {
427 if ($search_societe_alias) {
431if ($search_date_start) {
432 $sql .=
" AND t.dateo >= '".$db->idate($search_date_start).
"'";
434if ($search_date_end) {
435 $sql .=
" AND t.dateo <= '".$db->idate($search_date_end).
"'";
437if ($search_datelimit_start) {
438 $sql .=
" AND t.datee >= '".$db->idate($search_datelimit_start).
"'";
440if ($search_datelimit_end) {
441 $sql .=
" AND t.datee <= '".$db->idate($search_datelimit_end).
"'";
444 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
446if ($search_projectstatus >= 0) {
447 if ($search_projectstatus == 99) {
448 $sql .=
" AND p.fk_statut <> 2";
450 $sql .=
" AND p.fk_statut = ".((int) $search_projectstatus);
453if ($search_project_user > 0) {
454 $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);
456if ($search_task_user > 0) {
457 $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);
460$searchCategoryProjectList = array($search_categ);
461$searchCategoryProjectOperator = 0;
462if (!empty($searchCategoryProjectList)) {
463 $searchCategoryProjectSqlList = array();
464 $listofcategoryid =
'';
465 foreach ($searchCategoryProjectList as $searchCategoryProject) {
466 if (intval($searchCategoryProject) == -2) {
467 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
468 } elseif (intval($searchCategoryProject) > 0) {
469 if ($searchCategoryProjectOperator == 0) {
470 $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).
")";
472 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
476 if ($listofcategoryid) {
477 $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).
"))";
479 if ($searchCategoryProjectOperator == 1) {
480 if (!empty($searchCategoryProjectSqlList)) {
481 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
484 if (!empty($searchCategoryProjectSqlList)) {
485 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
489$searchCategoryCustomerSqlList = array();
490if ($searchCategoryCustomerOperator == 1) {
491 $existsCategoryCustomerList = array();
492 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
493 if (intval($searchCategoryCustomer) == -2) {
494 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
495 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
496 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
497 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
498 $sqlCategoryCustomerNotExists .=
" )";
499 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
500 } elseif (intval($searchCategoryCustomer) > 0) {
501 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
504 if (!empty($existsCategoryCustomerList)) {
505 $sqlCategoryCustomerExists =
" EXISTS (";
506 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
507 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
508 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
509 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
510 $sqlCategoryCustomerExists .=
" )";
511 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
513 if (!empty($searchCategoryCustomerSqlList)) {
514 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
517 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
518 if (intval($searchCategoryCustomer) == -2) {
519 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
520 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
521 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
522 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
523 $sqlCategoryCustomerNotExists .=
" )";
524 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
525 } elseif (intval($searchCategoryCustomer) > 0) {
526 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
529 if (!empty($searchCategoryCustomerSqlList)) {
530 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
534include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
536$parameters = array();
537$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
538$sql .= $hookmanager->resPrint;
539if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
540 $sql .=
" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
541 $sql .=
" s.nom, s.rowid,";
542 $sql .=
" t.datec, t.dateo, t.datee, t.tms,";
543 $sql .=
" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut";
545 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
546 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
547 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
553$nbtotalofrecords =
'';
556 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
557 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
558 $resql = $db->query($sqlforcount);
560 $objforcount = $db->fetch_object($resql);
561 $nbtotalofrecords = $objforcount->nbtotalofrecords;
566 if (($page * $limit) > $nbtotalofrecords) {
574$sql .= $db->order($sortfield, $sortorder);
576 $sql .= $db->plimit($limit + 1, $offset);
579$resql = $db->query($sql);
585$num = $db->num_rows($resql);
589if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
590 $obj = $db->fetch_object($resql);
592 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$id.
'&withproject=1');
600llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
602$arrayofselected = is_array($toselect) ? $toselect : array();
606 $param .=
'&mode='.urlencode($mode);
608if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
609 $param .=
'&contextpage='.urlencode($contextpage);
611if ($limit > 0 && $limit != $conf->liste_limit) {
612 $param .=
'&limit='.((int) $limit);
614if ($search_date_startday) {
615 $param .=
'&search_date_startday='.urlencode($search_date_startday);
617if ($search_date_startmonth) {
618 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
620if ($search_date_startyear) {
621 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
623if ($search_date_endday) {
624 $param .=
'&search_date_endday='.urlencode($search_date_endday);
626if ($search_date_endmonth) {
627 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
629if ($search_date_endyear) {
630 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
632if ($search_datelimit_startday) {
633 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
635if ($search_datelimit_startmonth) {
636 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
638if ($search_datelimit_startyear) {
639 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
641if ($search_datelimit_endday) {
642 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
644if ($search_datelimit_endmonth) {
645 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
647if ($search_datelimit_endyear) {
648 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
650if ($search_task_budget_amount) {
651 $param .=
'&search_task_budget_amount='.urlencode($search_task_budget_amount);
654 $param .=
'&socid='.urlencode($socid);
656if ($search_all !=
'') {
657 $param .=
'&search_all='.urlencode($search_all);
659if ($search_project_ref !=
'') {
660 $param .=
'&search_project_ref='.urlencode($search_project_ref);
662if ($search_project_title !=
'') {
663 $param .=
'&search_project_title='.urlencode($search_project_title);
665if ($search_task_ref !=
'') {
666 $param .=
'&search_task_ref='.urlencode($search_task_ref);
668if ($search_task_label !=
'') {
669 $param .=
'&search_task_label='.urlencode($search_task_label);
671if ($search_task_description !=
'') {
672 $param .=
'&search_task_description='.urlencode($search_task_description);
674if ($search_task_ref_parent !=
'') {
675 $param .=
'&search_task_ref_parent='.urlencode($search_task_ref_parent);
677if ($search_task_progress !=
'') {
678 $param .=
'&search_task_progress='.urlencode($search_task_progress);
680if ($search_societe !=
'') {
681 $param .=
'&search_societe='.urlencode($search_societe);
683if ($search_societe !=
'') {
684 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
686if ($search_projectstatus !=
'') {
687 $param .=
'&search_projectstatus='.urlencode($search_projectstatus);
689if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'none'))) {
690 $param .=
'&search_opp_status='.urlencode($search_opp_status);
692if ($search_project_user !=
'') {
693 $param .=
'&search_project_user='.urlencode($search_project_user);
695if ($search_task_user > 0) {
696 $param .=
'&search_task_user='.urlencode($search_task_user);
698if ($optioncss !=
'') {
699 $param .=
'&optioncss='.urlencode($optioncss);
701foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
702 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
705include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
707$parameters = array(
'param' => &$param);
708$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
709$param .= $hookmanager->resPrint;
712$arrayofmassactions = array(
717if (!empty($permissiontodelete)) {
718 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
720if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
721 $arrayofmassactions = array();
723$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
725print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
726if ($optioncss !=
'') {
727 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
729print
'<input type="hidden" name="token" value="'.newToken().
'">';
730print
'<input type="hidden" name="action" value="list">';
731print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
732print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
733print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
734print
'<input type="hidden" name="page" value="'.$page.
'">';
736 print
'<input type="hidden" name="type" value="'.$type.
'">';
738print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
739print
'<input type="hidden" name="page_y" value="">';
740print
'<input type="hidden" name="mode" value="'.$mode.
'">';
745$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'));
746$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'));
748$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?action=create',
'', $permissiontocreate);
753if ($search_task_user == $user->id) {
754 $texthelp .= $langs->trans(
"MyTasksDesc");
756 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
757 $texthelp .= $langs->trans(
"TasksOnProjectsDesc");
759 $texthelp .= $langs->trans(
"TasksOnProjectsPublicDesc");
763print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
765$topicmail =
"Information";
767$objecttmp =
new Task($db);
768$trackid =
'tas'.$object->id;
769include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
773 foreach ($fieldstosearchall as $key => $val) {
774 $fieldstosearchall[$key] = $langs->trans($val);
775 $setupstring .= $key.
"=".$val.
";";
777 print
'<!-- Search done like if TASK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
778 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
784if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
785 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
786 $moreforfilter .=
'<div class="divsearchfield">';
787 $tmptitle = $langs->trans(
'ProjectCategories');
788 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', $search_categ,
'search_categ', 1, $tmptitle,
'maxwidth300');
789 $moreforfilter .=
'</div>';
793$moreforfilter .=
'<div class="divsearchfield">';
794$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
796if (!$user->hasRight(
'user',
'user',
'lire')) {
797 $includeonly = array($user->id);
799$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');
800$moreforfilter .=
'</div>';
803$moreforfilter .=
'<div class="divsearchfield">';
804$tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
806if (!$user->hasRight(
'user',
'user',
'lire')) {
807 $includeonly = array($user->id);
809$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_task_user,
'search_task_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
810$moreforfilter .=
'</div>';
813if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_CUSTOMER_ON_TASK_LIST') && isModEnabled(
"categorie") && $user->hasRight(
'categorie',
'lire')) {
814 $moreforfilter .=
'<div class="divsearchfield">';
815 $tmptitle = $langs->transnoentities(
'CustomersProspectsCategoriesShort');
816 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
817 $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 1);
818 $categoriesArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
819 $moreforfilter .=
Form::multiselectarray(
'search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0,
'minwidth300', 0, 0,
'',
'category', $tmptitle);
820 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ?
' checked="checked"' :
'').
'/>';
821 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_cus');
822 $moreforfilter .=
'</div>';
825if (!empty($moreforfilter)) {
826 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
827 print $moreforfilter;
828 $parameters = array();
829 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
830 print $hookmanager->resPrint;
834$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
835$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
836$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
838print
'<div class="div-table-responsive">';
839print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
843print
'<tr class="liste_titre_filter">';
846 print
'<td class="liste_titre center maxwidthsearch">';
847 $searchpicto = $form->showFilterButtons(
'left');
851if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
852 print
'<td class="liste_titre">';
853 print
'<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).
'" size="4">';
856if (!empty($arrayfields[
't.ref'][
'checked'])) {
857 print
'<td class="liste_titre">';
858 print
'<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'" size="4">';
861if (!empty($arrayfields[
't.label'][
'checked'])) {
862 print
'<td class="liste_titre">';
863 print
'<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'" size="8">';
867if (!empty($arrayfields[
't.description'][
'checked'])) {
868 print
'<td class="liste_titre">';
869 print
'<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).
'" size="8">';
873if (!empty($arrayfields[
't.dateo'][
'checked'])) {
874 print
'<td class="liste_titre center">';
875 print
'<div class="nowrapfordate">';
876 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
878 print
'<div class="nowrapfordate">';
879 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
884if (!empty($arrayfields[
't.datee'][
'checked'])) {
885 print
'<td class="liste_titre center">';
886 print
'<div class="nowrapfordate">';
887 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
889 print
'<div class="nowrapfordate">';
890 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
896if (!empty($arrayfields[
'p.ref'][
'checked'])) {
897 print
'<td class="liste_titre">';
898 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'" size="4">';
901if (!empty($arrayfields[
'p.title'][
'checked'])) {
902 print
'<td class="liste_titre">';
903 print
'<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.
'" size="6">';
906if (!empty($arrayfields[
's.nom'][
'checked'])) {
907 print
'<td class="liste_titre">';
908 print
'<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'" size="4">';
911if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
912 print
'<td class="liste_titre">';
913 print
'<input type="text" class="flat" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'" size="4">';
916if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
917 print
'<td class="liste_titre center">';
918 $arrayofstatus = array();
919 foreach ($projectstatic->labelStatusShort as $key => $val) {
920 $arrayofstatus[$key] = $langs->trans($val);
922 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
'+'.$langs->trans(
'Opened').
')';
923 print $form->selectarray(
'search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
926if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
927 print
'<td class="liste_titre"></td>';
929if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
930 print
'<td class="liste_titre"></td>';
932if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
933 print
'<td class="liste_titre"></td>';
935if (!empty($arrayfields[
't.progress'][
'checked'])) {
936 print
'<td class="liste_titre center">';
937 print
'<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.
'" size="4">';
941if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
942 print
'<td class="liste_titre"></td>';
945if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
946 print
'<td class="liste_titre center">';
947 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
951if (!empty($arrayfields[
't.tobill'][
'checked'])) {
952 print
'<td class="liste_titre"></td>';
954if (!empty($arrayfields[
't.billed'][
'checked'])) {
955 print
'<td class="liste_titre"></td>';
958include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
960$parameters = array(
'arrayfields'=>$arrayfields);
961$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
962print $hookmanager->resPrint;
963if (!empty($arrayfields[
't.datec'][
'checked'])) {
965 print
'<td class="liste_titre">';
968if (!empty($arrayfields[
't.tms'][
'checked'])) {
970 print
'<td class="liste_titre">';
975 print
'<td class="liste_titre center maxwidthsearch">';
976 $searchpicto = $form->showFilterButtons();
985 't.planned_workload' => 0,
986 't.duration_effective' => 0,
988 't.budget_amount' => 0,
990 'totalplannedworkload' => 0,
991 'totaldurationeffective' => 0,
992 'totaldurationdeclared' => 0,
993 'totaltobillfield' => 0,
994 'totalbilledfield' => 0,
995 'totalbudget_amountfield' => 0,
996 'totalbudgetamount' => 0,
1003print
'<tr class="liste_titre">';
1006 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1007 $totalarray[
'nbfield']++;
1009if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1010 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
1011 $totalarray[
'nbfield']++;
1013if (!empty($arrayfields[
't.ref'][
'checked'])) {
1014 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
1015 $totalarray[
'nbfield']++;
1017if (!empty($arrayfields[
't.label'][
'checked'])) {
1018 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
1019 $totalarray[
'nbfield']++;
1021if (!empty($arrayfields[
't.description'][
'checked'])) {
1022 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
1023 $totalarray[
'nbfield']++;
1025if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1026 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1027 $totalarray[
'nbfield']++;
1029if (!empty($arrayfields[
't.datee'][
'checked'])) {
1030 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1031 $totalarray[
'nbfield']++;
1033if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1034 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1035 $totalarray[
'nbfield']++;
1037if (!empty($arrayfields[
'p.title'][
'checked'])) {
1038 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1039 $totalarray[
'nbfield']++;
1041if (!empty($arrayfields[
's.nom'][
'checked'])) {
1042 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1043 $totalarray[
'nbfield']++;
1045if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1046 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1047 $totalarray[
'nbfield']++;
1049if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1050 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1051 $totalarray[
'nbfield']++;
1053if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1054 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
1055 $totalarray[
'nbfield']++;
1057if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1058 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
1059 $totalarray[
'nbfield']++;
1061if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1062 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
1063 $totalarray[
'nbfield']++;
1065if (!empty($arrayfields[
't.progress'][
'checked'])) {
1066 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1067 $totalarray[
'nbfield']++;
1069if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1070 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1071 $totalarray[
'nbfield']++;
1073if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1074 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
1075 $totalarray[
'nbfield']++;
1077if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1078 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1079 $totalarray[
'nbfield']++;
1081if (!empty($arrayfields[
't.billed'][
'checked'])) {
1082 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1083 $totalarray[
'nbfield']++;
1086include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1089 'arrayfields' => $arrayfields,
1091 'sortfield' => $sortfield,
1092 'sortorder' => $sortorder,
1093 'totalarray' => &$totalarray,
1095$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1096print $hookmanager->resPrint;
1097if (!empty($arrayfields[
't.datec'][
'checked'])) {
1098 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1099 $totalarray[
'nbfield']++;
1101if (!empty($arrayfields[
't.tms'][
'checked'])) {
1102 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1103 $totalarray[
'nbfield']++;
1107 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1108 $totalarray[
'nbfield']++;
1112$plannedworkloadoutputformat =
'allhourmin';
1113$timespentoutputformat =
'allhourmin';
1115 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
1118 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
1124$savnbfield = $totalarray[
'nbfield'];
1125$totalarray = array();
1126$totalarray[
'nbfield'] = 0;
1127$imaxinloop = ($limit ? min($num, $limit) : $num);
1128while ($i < $imaxinloop) {
1129 $obj = $db->fetch_object($resql);
1135 $object->id = $obj->id;
1136 $object->ref = $obj->ref;
1137 $object->label = $obj->label;
1138 $object->description = $obj->description;
1139 $object->fk_statut = $obj->fk_statut;
1140 $object->progress = $obj->progress;
1141 $object->budget_amount = $obj->budget_amount;
1142 $object->date_start = $db->jdate($obj->date_start);
1143 $object->date_end = $db->jdate($obj->date_end);
1144 $object->planned_workload = $obj->planned_workload;
1145 $object->duration_effective = $obj->duration_effective;
1146 $object->fk_task_parent = $obj->fk_task_parent;
1148 $projectstatic->id = $obj->projectid;
1149 $projectstatic->ref = $obj->projectref;
1150 $projectstatic->title = $obj->projecttitle;
1151 $projectstatic->public = $obj->public;
1152 $projectstatic->statut = $obj->projectstatus;
1153 $projectstatic->datee = $db->jdate($obj->projectdatee);
1156 $socstatic->id = $obj->socid;
1157 $socstatic->name = $obj->name;
1158 $socstatic->name_alias = $obj->alias;
1160 if ($mode ==
'kanban') {
1162 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1163 print
'<div class="box-flex-container kanban">';
1166 if ($massactionbutton || $massaction) {
1168 if (in_array($object->id, $arrayofselected)) {
1173 $arraydata = array();
1174 $arraydata[
'projectlink'] = $projectstatic->getNomUrl(1);
1175 $arraydata[
'selected'] = in_array($object->id, $arrayofselected);
1177 print $object->getKanbanView(
'', $arraydata);
1178 if ($i == ($imaxinloop - 1)) {
1183 $userAccess = $projectstatic->restrictedProjectArea($user);
1184 if ($userAccess >= 0) {
1187 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1191 print
'<td class="nowrap center">';
1192 if ($massactionbutton || $massaction) {
1194 if (in_array($object->id, $arrayofselected)) {
1197 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1201 $totalarray[
'nbfield']++;
1205 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1206 print
'<td class="nowraponall">';
1207 if (!empty($object->fk_task_parent)) {
1208 $object_parent =
new Task($db);
1209 $result = $object_parent->fetch($object->fk_task_parent);
1213 print $object_parent->getNomUrl(1,
'withproject');
1214 if ($object_parent->hasDelay()) {
1221 $totalarray[
'nbfield']++;
1225 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1226 print
'<td class="nowraponall">';
1227 print $object->getNomUrl(1,
'withproject');
1228 if ($object->hasDelay()) {
1233 $totalarray[
'nbfield']++;
1237 if (!empty($arrayfields[
't.label'][
'checked'])) {
1238 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($object->label).
'">';
1242 $totalarray[
'nbfield']++;
1246 if (!empty($arrayfields[
't.description'][
'checked'])) {
1251 $totalarray[
'nbfield']++;
1256 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1257 print
'<td class="center">';
1261 $totalarray[
'nbfield']++;
1265 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1266 print
'<td class="center">';
1270 $totalarray[
'nbfield']++;
1274 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1275 print
'<td class="nowraponall tdoverflowmax150">';
1276 print $projectstatic->getNomUrl(1,
'task');
1277 if ($projectstatic->hasDelay()) {
1282 $totalarray[
'nbfield']++;
1286 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1287 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->projecttitle).
'">';
1291 $totalarray[
'nbfield']++;
1295 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1296 print
'<td class="tdoverflowmax125">';
1298 print $socstatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1304 $totalarray[
'nbfield']++;
1308 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1311 $name_alias = $socstatic->name_alias;
1313 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($name_alias).
'">';
1317 $totalarray[
'nbfield']++;
1321 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1322 print
'<td class="center">';
1323 print $projectstatic->getLibStatut(1);
1326 $totalarray[
'nbfield']++;
1331 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1332 print
'<td class="center">';
1335 if ($obj->planned_workload !=
'') {
1343 $totalarray[
'nbfield']++;
1346 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.planned_workload';
1348 if (!isset($totalarray[
'val'][
'planned_workload'])) {
1349 $totalarray[
'val'][
't.planned_workload'] = 0;
1351 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1353 $totalarray[
'totalplannedworkloadfield'] = $totalarray[
'nbfield'];
1355 if (!isset($totalarray[
'totalplannedworkload'])) {
1356 $totalarray[
'totalplannedworkload'] = 0;
1358 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1361 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1362 $showlineingray = 0;
1364 print
'<td class="center">';
1365 if ($showlineingray) {
1368 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1370 if ($obj->duration_effective) {
1375 if ($showlineingray) {
1382 $totalarray[
'nbfield']++;
1385 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.duration_effective';
1387 if (!isset($totalarray[
'val'][
't.duration_effective'])) {
1388 $totalarray[
'val'][
't.duration_effective'] = 0;
1390 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1392 $totalarray[
'totaldurationeffectivefield'] = $totalarray[
'nbfield'];
1394 if (!isset($totalarray[
'totaldurationeffective'])) {
1395 $totalarray[
'totaldurationeffective'] = 0;
1397 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1400 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1401 print
'<td class="center">';
1402 if ($obj->planned_workload || $obj->duration_effective) {
1403 if ($obj->planned_workload) {
1404 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1406 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1411 $totalarray[
'nbfield']++;
1414 $totalarray[
'totalprogress_calculatedfield'] = $totalarray[
'nbfield'];
1418 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1419 print
'<td class="center">';
1420 if ($obj->progress !=
'') {
1425 $totalarray[
'nbfield']++;
1428 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.progress';
1430 if (!isset($totalarray[
'val'][
't.progress'])) {
1431 $totalarray[
'val'][
't.progress'] = 0;
1433 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1435 $totalarray[
'totalprogress_declaredfield'] = $totalarray[
'nbfield'];
1437 if (!isset($totalarray[
'totaldurationdeclared'])) {
1438 $totalarray[
'totaldurationdeclared'] = 0;
1440 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1443 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1444 print
'<td class="center">';
1445 if ($obj->progress !=
'' && $obj->duration_effective) {
1450 $totalarray[
'nbfield']++;
1453 $totalarray[
'totalprogress_summary'] = $totalarray[
'nbfield'];
1457 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1458 print
'<td class="center">';
1459 if ($object->budget_amount) {
1460 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1464 $totalarray[
'nbfield']++;
1467 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.budget_amount';
1469 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1471 $totalarray[
'totalbudget_amountfield'] = $totalarray[
'nbfield'];
1473 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1476 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1477 print
'<td class="center">';
1478 if ($obj->usage_bill_time) {
1480 $totalarray[
'val'][
't.tobill'] += $obj->tobill;
1481 $totalarray[
'totaltobill'] += $obj->tobill;
1483 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1487 $totalarray[
'nbfield']++;
1490 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.tobill';
1493 $totalarray[
'totaltobillfield'] = $totalarray[
'nbfield'];
1497 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1498 print
'<td class="center">';
1499 if ($obj->usage_bill_time) {
1501 $totalarray[
'val'][
't.billed'] += $obj->billed;
1502 $totalarray[
'totalbilled'] += $obj->billed;
1504 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1508 $totalarray[
'nbfield']++;
1511 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.billed';
1514 $totalarray[
'totalbilledfield'] = $totalarray[
'nbfield'];
1518 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1520 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1521 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1522 print $hookmanager->resPrint;
1524 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1525 print
'<td class="center">';
1526 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1529 $totalarray[
'nbfield']++;
1533 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1534 print
'<td class="center">';
1535 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1538 $totalarray[
'nbfield']++;
1549 print
'<td class="nowrap center">';
1550 if ($massactionbutton || $massaction) {
1552 if (in_array($object->id, $arrayofselected)) {
1555 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1559 $totalarray[
'nbfield']++;
1571if (!empty($totalarray[
'totalizable']) && is_array($totalarray[
'totalizable'])) {
1572 foreach ($totalarray[
'totalizable'] as $keytotalizable => $valtotalizable) {
1573 $totalarray[
'pos'][$valtotalizable[
'pos']] = $keytotalizable;
1574 $totalarray[
'val'][$keytotalizable] = $valtotalizable[
'total'];
1578if (isset($totalarray[
'totaldurationeffectivefield']) || isset($totalarray[
'totalplannedworkloadfield']) || isset($totalarray[
'totalprogress_calculatedfield'])
1579 || isset($totalarray[
'totaltobill']) || isset($totalarray[
'totalbilled']) || isset($totalarray[
'totalbudget'])) {
1580 print
'<tr class="liste_total">';
1582 while ($i < $totalarray[
'nbfield']) {
1585 if ($num < $limit && empty($offset)) {
1586 print
'<td class="left">'.$langs->trans(
"Total").
'</td>';
1588 print
'<td class="left">'.$langs->trans(
"Totalforthispage").
'</td>';
1590 } elseif (isset($totalarray[
'totalplannedworkloadfield']) && $totalarray[
'totalplannedworkloadfield'] == $i) {
1591 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1592 } elseif (isset($totalarray[
'totaldurationeffectivefield']) && $totalarray[
'totaldurationeffectivefield'] == $i) {
1593 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1594 } elseif (isset($totalarray[
'totalprogress_calculatedfield']) && $totalarray[
'totalprogress_calculatedfield'] == $i) {
1595 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationeffective'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1596 } elseif (isset($totalarray[
'totalprogress_declaredfield']) && $totalarray[
'totalprogress_declaredfield'] == $i) {
1597 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationdeclared'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1598 } elseif (isset($totalarray[
'totaltobillfield']) && $totalarray[
'totaltobillfield'] == $i) {
1599 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1600 } elseif (isset($totalarray[
'totalbilledfield']) && $totalarray[
'totalbilledfield'] == $i) {
1601 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1602 } elseif (isset($totalarray[
'totalbudget_amountfield']) && $totalarray[
'totalbudget_amountfield'] == $i) {
1603 print
'<td class="center">'.price($totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).
'</td>';
1604 } elseif (!empty($totalarray[
'pos'][$i])) {
1605 print
'<td class="right">';
1606 if (isset($totalarray[
'type']) && $totalarray[
'type'][$i] ==
'duration') {
1607 print(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ?
convertSecondToTime($totalarray[
'val'][$totalarray[
'pos'][$i]],
'allhourmin') : 0);
1609 print
price(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ? $totalarray[
'val'][$totalarray[
'pos'][$i]] : 0);
1621$parameters = array(
'arrayfields'=>$arrayfields,
'sql' => $sql);
1622$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1623print $hookmanager->resPrint;
1625print
'</table>'.
"\n";
1628print
'</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 a 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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
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.