28 require
"../../main.inc.php";
29 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 $langs->loadLangs(array(
'projects',
'users',
'companies'));
38 $action =
GETPOST(
'action',
'aZ09');
39 $massaction =
GETPOST(
'massaction',
'alpha');
40 $show_files =
GETPOST(
'show_files',
'int');
41 $confirm =
GETPOST(
'confirm',
'alpha');
42 $toselect =
GETPOST(
'toselect',
'array');
43 $optioncss =
GETPOST(
'optioncss',
'aZ09');
48 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
49 $search_categ =
GETPOST(
"search_categ",
'alpha');
51 $search_projectstatus =
GETPOST(
'search_projectstatus');
52 if (!isset($search_projectstatus) || $search_projectstatus ===
'') {
53 if ($search_all !=
'') {
54 $search_projectstatus = -1;
56 $search_projectstatus = 1;
60 $search_project_ref =
GETPOST(
'search_project_ref');
61 $search_project_title =
GETPOST(
'search_project_title');
62 $search_task_ref =
GETPOST(
'search_task_ref');
63 $search_task_label =
GETPOST(
'search_task_label');
64 $search_task_description =
GETPOST(
'search_task_description');
65 $search_task_ref_parent =
GETPOST(
'search_task_ref_parent');
66 $search_project_user =
GETPOST(
'search_project_user',
'int');
67 $search_task_user =
GETPOST(
'search_task_user',
'int');
68 $search_task_progress =
GETPOST(
'search_task_progress');
69 $search_task_budget_amount =
GETPOST(
'search_task_budget_amount');
70 $search_societe =
GETPOST(
'search_societe');
71 $search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
73 $mine =
GETPOST(
'mode',
'alpha') ==
'mine' ? 1 : 0;
75 $search_task_user = $user->id;
80 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
81 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
82 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
83 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
84 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
85 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
86 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
87 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
88 $search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
89 $search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
90 $search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
91 $search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
92 $search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
93 $search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
94 $search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
95 $search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
98 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'tasklist';
101 $object =
new Task($db);
102 $hookmanager->initHooks(array(
'tasklist'));
106 $extrafields->fetch_name_optionals_label($object->table_element);
107 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
112 if (!$user->rights->projet->lire) {
116 $diroutputmassaction = $conf->project->dir_output.
'/tasks/temp/massgeneration/'.$user->id;
118 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
119 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
120 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
122 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
126 $offset = $limit * $page;
127 $pageprev = $page - 1;
128 $pagenext = $page + 1;
130 $sortfield =
'p.ref';
137 $fieldstosearchall = array(
140 't.description'=>
"Description",
141 't.note_public'=>
"NotePublic",
143 if (empty($user->socid)) {
144 $fieldstosearchall[
't.note_private'] =
"NotePrivate";
147 $arrayfields = array(
148 't.fk_task_parent'=>array(
'label'=>
"RefTaskParent",
'checked'=>0,
'position'=>70),
149 't.ref'=>array(
'label'=>
"RefTask",
'checked'=>1,
'position'=>80),
150 't.label'=>array(
'label'=>
"LabelTask",
'checked'=>1,
'position'=>80),
151 't.description'=>array(
'label'=>
"Description",
'checked'=>0,
'position'=>80),
152 't.dateo'=>array(
'label'=>
"DateStart",
'checked'=>1,
'position'=>100),
153 't.datee'=>array(
'label'=>
"Deadline",
'checked'=>1,
'position'=>101),
154 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1),
155 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0),
156 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>0),
157 'p.fk_statut'=>array(
'label'=>
"ProjectStatus",
'checked'=>1),
158 't.planned_workload'=>array(
'label'=>
"PlannedWorkload",
'checked'=>1,
'position'=>102),
159 't.duration_effective'=>array(
'label'=>
"TimeSpent",
'checked'=>1,
'position'=>103),
160 't.progress_calculated'=>array(
'label'=>
"ProgressCalculated",
'checked'=>1,
'position'=>104),
161 't.progress'=>array(
'label'=>
"ProgressDeclared",
'checked'=>1,
'position'=>105),
162 't.progress_summary'=>array(
'label'=>
"TaskProgressSummary",
'checked'=>1,
'position'=>106),
163 't.budget_amount'=>array(
'label'=>
"Budget",
'checked'=>0,
'position'=>107),
164 't.tobill'=>array(
'label'=>
"TimeToBill",
'checked'=>0,
'position'=>110),
165 't.billed'=>array(
'label'=>
"TimeBilled",
'checked'=>0,
'position'=>111),
166 't.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
167 't.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
171 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
176 $permissiontoread = $user->rights->projet->lire;
177 $permissiontodelete = $user->rights->projet->supprimer;
184 if (
GETPOST(
'cancel',
'alpha')) {
188 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
192 $parameters = array(
'socid'=>$socid);
193 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
198 if (empty($reshook)) {
200 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
203 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
206 $search_projectstatus = -1;
207 $search_project_ref =
"";
208 $search_project_title =
"";
209 $search_task_ref =
"";
210 $search_task_label =
"";
211 $search_task_description =
"";
212 $search_task_ref_parent =
"";
213 $search_task_progress =
"";
214 $search_task_budget_amount =
"";
215 $search_task_user = -1;
216 $search_project_user = -1;
217 $search_date_startday =
'';
218 $search_date_startmonth =
'';
219 $search_date_startyear =
'';
220 $search_date_endday =
'';
221 $search_date_endmonth =
'';
222 $search_date_endyear =
'';
223 $search_date_start =
'';
224 $search_date_end =
'';
225 $search_datelimit_startday =
'';
226 $search_datelimit_startmonth =
'';
227 $search_datelimit_startyear =
'';
228 $search_datelimit_endday =
'';
229 $search_datelimit_endmonth =
'';
230 $search_datelimit_endyear =
'';
231 $search_datelimit_start =
'';
232 $search_datelimit_end =
'';
234 $search_array_options = array();
238 $objectclass =
'Task';
239 $objectlabel =
'Tasks';
240 $uploaddir = $conf->project->dir_output.
'/tasks';
241 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
244 if (empty($search_projectstatus) && $search_projectstatus ==
'') {
245 $search_projectstatus = 1;
259 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
265 $projectstatic =
new Project($db);
266 $puser =
new User($db);
267 $tuser =
new User($db);
268 if ($search_project_user > 0) {
269 $puser->fetch($search_project_user);
271 if ($search_task_user > 0) {
272 $tuser->fetch($search_task_user);
276 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
277 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
280 $title = $langs->trans(
"Activities");
284 $projectstatic->fetch($id);
285 $projectstatic->fetch_thirdparty();
289 if (empty($user->rights->projet->all->lire)) {
290 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
295 $listofprojectcontacttype = array();
296 $sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
297 $sql .=
" WHERE ctc.element = '".$db->escape($projectstatic->element).
"'";
298 $sql .=
" AND ctc.source = 'internal'";
299 $resql = $db->query($sql);
301 while ($obj = $db->fetch_object(
$resql)) {
302 $listofprojectcontacttype[$obj->rowid] = $obj->code;
307 if (count($listofprojectcontacttype) == 0) {
308 $listofprojectcontacttype[0] =
'0';
311 $listoftaskcontacttype = array();
312 $sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
313 $sql .=
" WHERE ctc.element = '".$db->escape($object->element).
"'";
314 $sql .=
" AND ctc.source = 'internal'";
315 $resql = $db->query($sql);
317 while ($obj = $db->fetch_object(
$resql)) {
318 $listoftaskcontacttype[$obj->rowid] = $obj->code;
323 if (count($listoftaskcontacttype) == 0) {
324 $listoftaskcontacttype[0] =
'0';
327 $distinct =
'DISTINCT';
328 $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,";
329 $sql .=
" s.nom as name, s.rowid as socid,";
330 $sql .=
" t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,";
331 $sql .=
" t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut, ";
332 $sql .=
" t.description, t.fk_task_parent";
333 $sql .=
" ,t.budget_amount";
335 if ($search_categ > 0) {
336 $sql .=
", cs.fk_categorie, cs.fk_project";
339 if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
340 $sql .=
" , SUM(tt.task_duration * ".$db->ifsql(
"invoice_id IS NULL",
"1",
"0").
") as tobill, SUM(tt.task_duration * ".$db->ifsql(
"invoice_id IS NULL",
"0",
"1").
") as billed";
343 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
344 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
345 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
349 $parameters = array();
350 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
351 $sql .= $hookmanager->resPrint;
352 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
353 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
355 if ($search_categ > 0) {
356 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_project as cs ON p.rowid = cs.fk_project";
358 $sql .=
", ".MAIN_DB_PREFIX.
"projet_task as t";
359 if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
360 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet_task_time as tt ON tt.fk_task = t.rowid";
362 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
363 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
365 if ($search_project_user > 0) {
366 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
368 if ($search_task_user > 0) {
369 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ect";
371 $sql .=
" WHERE t.fk_projet = p.rowid";
372 $sql .=
" AND p.entity IN (".getEntity(
'project').
')';
373 if (empty($user->rights->projet->all->lire)) {
374 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId :
'0').
")";
376 if (is_object($projectstatic) && $projectstatic->id > 0) {
377 $sql .=
" AND p.rowid = ".((int) $projectstatic->id);
381 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
383 if ($search_categ > 0) {
384 $sql .=
" AND cs.fk_categorie = ".((int) $search_categ);
386 if ($search_categ == -2) {
387 $sql .=
" AND cs.fk_categorie IS NULL";
389 if ($search_project_ref) {
392 if ($search_project_title) {
395 if ($search_task_ref) {
398 if ($search_task_label) {
401 if ($search_task_description) {
402 $sql .=
natural_search(
't.description', $search_task_description);
404 if ($search_task_ref_parent) {
405 $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).
')';
407 if ($search_task_progress) {
410 if ($search_task_budget_amount) {
411 $sql .=
natural_search(
't.budget_amount', $search_task_budget_amount, 1);
413 if ($search_societe) {
416 if ($search_date_start) {
417 $sql .=
" AND t.dateo >= '".$db->idate($search_date_start).
"'";
419 if ($search_date_end) {
420 $sql .=
" AND t.dateo <= '".$db->idate($search_date_end).
"'";
422 if ($search_datelimit_start) {
423 $sql .=
" AND t.datee >= '".$db->idate($search_datelimit_start).
"'";
425 if ($search_datelimit_end) {
426 $sql .=
" AND t.datee <= '".$db->idate($search_datelimit_end).
"'";
429 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
431 if ($search_projectstatus >= 0) {
432 if ($search_projectstatus == 99) {
433 $sql .=
" AND p.fk_statut <> 2";
435 $sql .=
" AND p.fk_statut = ".((int) $search_projectstatus);
438 if ($search_project_user > 0) {
439 $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);
441 if ($search_task_user > 0) {
442 $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);
445 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
447 $parameters = array();
448 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
449 $sql .= $hookmanager->resPrint;
450 if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
451 $sql .=
" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
452 $sql .=
" s.nom, s.rowid,";
453 $sql .=
" t.datec, t.dateo, t.datee, t.tms,";
454 $sql .=
" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut";
455 if ($search_categ > 0) {
456 $sql .=
", cs.fk_categorie, cs.fk_project";
459 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
460 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
461 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
465 $sql .= $db->order($sortfield, $sortorder);
467 $nbtotalofrecords =
'';
468 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
469 $result = $db->query($sql);
470 $nbtotalofrecords = $db->num_rows($result);
471 if (($page * $limit) > $nbtotalofrecords) {
477 $sql .= $db->plimit($limit + 1, $offset);
479 dol_syslog(
"list allowed project", LOG_DEBUG);
481 $resql = $db->query($sql);
487 $num = $db->num_rows(
$resql);
491 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
492 $obj = $db->fetch_object(
$resql);
494 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$id.
'&withproject=1');
504 $arrayofselected = is_array($toselect) ? $toselect : array();
507 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
508 $param .=
'&contextpage='.urlencode($contextpage);
510 if ($limit > 0 && $limit != $conf->liste_limit) {
511 $param .=
'&limit='.urlencode($limit);
513 if ($search_date_startday) {
514 $param .=
'&search_date_startday='.urlencode($search_date_startday);
516 if ($search_date_startmonth) {
517 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
519 if ($search_date_startyear) {
520 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
522 if ($search_date_endday) {
523 $param .=
'&search_date_endday='.urlencode($search_date_endday);
525 if ($search_date_endmonth) {
526 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
528 if ($search_date_endyear) {
529 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
531 if ($search_datelimit_startday) {
532 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
534 if ($search_datelimit_startmonth) {
535 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
537 if ($search_datelimit_startyear) {
538 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
540 if ($search_datelimit_endday) {
541 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
543 if ($search_datelimit_endmonth) {
544 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
546 if ($search_datelimit_endyear) {
547 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
549 if ($search_task_budget_amount) {
550 $param .=
'&search_task_budget_amount='.urlencode($search_task_budget_amount);
553 $param .=
'&socid='.urlencode($socid);
555 if ($search_all !=
'') {
556 $param .=
'&search_all='.urlencode($search_all);
558 if ($search_project_ref !=
'') {
559 $param .=
'&search_project_ref='.urlencode($search_project_ref);
561 if ($search_project_title !=
'') {
562 $param .=
'&search_project_title='.urlencode($search_project_title);
564 if ($search_task_ref !=
'') {
565 $param .=
'&search_task_ref='.urlencode($search_task_ref);
567 if ($search_task_label !=
'') {
568 $param .=
'&search_task_label='.urlencode($search_task_label);
570 if ($search_task_description !=
'') {
571 $param .=
'&search_task_description='.urlencode($search_task_description);
573 if ($search_task_ref_parent !=
'') {
574 $param .=
'&search_task_ref_parent='.urlencode($search_task_ref_parent);
576 if ($search_task_progress !=
'') {
577 $param .=
'&search_task_progress='.urlencode($search_task_progress);
579 if ($search_societe !=
'') {
580 $param .=
'&search_societe='.urlencode($search_societe);
582 if ($search_projectstatus !=
'') {
583 $param .=
'&search_projectstatus='.urlencode($search_projectstatus);
585 if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'none'))) {
586 $param .=
'&search_opp_status='.urlencode($search_opp_status);
588 if ($search_project_user !=
'') {
589 $param .=
'&search_project_user='.urlencode($search_project_user);
591 if ($search_task_user > 0) {
592 $param .=
'&search_task_user='.urlencode($search_task_user);
594 if ($optioncss !=
'') {
595 $param .=
'&optioncss='.urlencode($optioncss);
598 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
600 $parameters = array();
601 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
602 $param .= $hookmanager->resPrint;
605 $arrayofmassactions = array(
610 if ($permissiontodelete) {
611 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
613 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
614 $arrayofmassactions = array();
616 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
618 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?action=create',
'', $user->rights->projet->creer);
620 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
621 if ($optioncss !=
'') {
622 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
624 print
'<input type="hidden" name="token" value="'.newToken().
'">';
625 print
'<input type="hidden" name="action" value="list">';
626 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
627 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
628 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
630 print
'<input type="hidden" name="type" value="'.$type.
'">';
632 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
636 if ($search_task_user == $user->id) {
637 $texthelp .= $langs->trans(
"MyTasksDesc");
639 if ($user->rights->projet->all->lire && !$socid) {
640 $texthelp .= $langs->trans(
"TasksOnProjectsDesc");
642 $texthelp .= $langs->trans(
"TasksOnProjectsPublicDesc");
646 print_barre_liste(
$form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
648 $topicmail =
"Information";
650 $objecttmp =
new Task($db);
651 $trackid =
'tas'.$object->id;
652 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
655 foreach ($fieldstosearchall as $key => $val) {
656 $fieldstosearchall[$key] = $langs->trans($val);
658 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
664 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
665 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
666 $moreforfilter .=
'<div class="divsearchfield">';
667 $tmptitle = $langs->trans(
'ProjectCategories');
668 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', $search_categ,
'search_categ', 0, $tmptitle,
'maxwidth300');
669 $moreforfilter .=
'</div>';
673 $moreforfilter .=
'<div class="divsearchfield">';
674 $tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
676 if (empty($user->rights->user->user->lire)) {
677 $includeonly = array($user->id);
679 $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');
680 $moreforfilter .=
'</div>';
683 $moreforfilter .=
'<div class="divsearchfield">';
684 $tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
686 if (empty($user->rights->user->user->lire)) {
687 $includeonly = array($user->id);
689 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_task_user,
'search_task_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
690 $moreforfilter .=
'</div>';
692 if (!empty($moreforfilter)) {
693 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
694 print $moreforfilter;
695 $parameters = array();
696 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
697 print $hookmanager->resPrint;
701 if ($massactionbutton) {
702 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
705 print
'<div class="div-table-responsive">';
706 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
710 print
'<tr class="liste_titre_filter">';
711 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
712 print
'<td class="liste_titre">';
713 print
'<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).
'" size="4">';
716 if (!empty($arrayfields[
't.ref'][
'checked'])) {
717 print
'<td class="liste_titre">';
718 print
'<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'" size="4">';
721 if (!empty($arrayfields[
't.label'][
'checked'])) {
722 print
'<td class="liste_titre">';
723 print
'<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'" size="8">';
727 if (!empty($arrayfields[
't.description'][
'checked'])) {
728 print
'<td class="liste_titre">';
729 print
'<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).
'" size="8">';
733 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
734 print
'<td class="liste_titre center">';
735 print
'<div class="nowrap">';
736 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
738 print
'<div class="nowrap">';
739 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
744 if (!empty($arrayfields[
't.datee'][
'checked'])) {
745 print
'<td class="liste_titre center">';
746 print
'<div class="nowrap">';
747 print
$form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
749 print
'<div class="nowrap">';
750 print
$form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
756 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
757 print
'<td class="liste_titre">';
758 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'" size="4">';
761 if (!empty($arrayfields[
'p.title'][
'checked'])) {
762 print
'<td class="liste_titre">';
763 print
'<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.
'" size="6">';
766 if (!empty($arrayfields[
's.nom'][
'checked'])) {
767 print
'<td class="liste_titre">';
768 print
'<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'" size="4">';
771 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
772 print
'<td class="liste_titre center">';
773 $arrayofstatus = array();
774 foreach ($projectstatic->statuts_short as $key => $val) {
775 $arrayofstatus[$key] = $langs->trans($val);
777 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
'+'.$langs->trans(
'Opened').
')';
778 print
$form->selectarray(
'search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
781 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
782 print
'<td class="liste_titre"></td>';
784 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
785 print
'<td class="liste_titre"></td>';
787 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
788 print
'<td class="liste_titre"></td>';
790 if (!empty($arrayfields[
't.progress'][
'checked'])) {
791 print
'<td class="liste_titre center">';
792 print
'<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.
'" size="4">';
796 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
797 print
'<td class="liste_titre"></td>';
800 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
801 print
'<td class="liste_titre center">';
802 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
806 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
807 print
'<td class="liste_titre"></td>';
809 if (!empty($arrayfields[
't.billed'][
'checked'])) {
810 print
'<td class="liste_titre"></td>';
813 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
815 $parameters = array(
'arrayfields'=>$arrayfields);
816 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
817 print $hookmanager->resPrint;
818 if (!empty($arrayfields[
't.datec'][
'checked'])) {
820 print
'<td class="liste_titre">';
823 if (!empty($arrayfields[
't.tms'][
'checked'])) {
825 print
'<td class="liste_titre">';
829 print
'<td class="liste_titre maxwidthsearch">';
830 $searchpicto =
$form->showFilterButtons();
838 't.planned_workload' => 0,
839 't.duration_effective' => 0,
841 't.budget_amount' => 0,
843 'totalplannedworkload' => 0,
844 'totaldurationeffective' => 0,
845 'totaldurationdeclared' => 0,
846 'totaltobillfield' => 0,
847 'totalbilledfield' => 0,
848 'totalbudget_amountfield' => 0,
849 'totalbudgetamount' => 0,
856 print
'<tr class="liste_titre">';
857 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
858 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
859 $totalarray[
'nbfield']++;
861 if (!empty($arrayfields[
't.ref'][
'checked'])) {
862 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
863 $totalarray[
'nbfield']++;
865 if (!empty($arrayfields[
't.label'][
'checked'])) {
866 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
867 $totalarray[
'nbfield']++;
869 if (!empty($arrayfields[
't.description'][
'checked'])) {
870 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
871 $totalarray[
'nbfield']++;
873 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
874 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
875 $totalarray[
'nbfield']++;
877 if (!empty($arrayfields[
't.datee'][
'checked'])) {
878 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
879 $totalarray[
'nbfield']++;
881 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
882 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
883 $totalarray[
'nbfield']++;
885 if (!empty($arrayfields[
'p.title'][
'checked'])) {
886 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
887 $totalarray[
'nbfield']++;
889 if (!empty($arrayfields[
's.nom'][
'checked'])) {
890 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
891 $totalarray[
'nbfield']++;
893 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
894 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
895 $totalarray[
'nbfield']++;
897 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
898 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
899 $totalarray[
'nbfield']++;
901 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
902 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
903 $totalarray[
'nbfield']++;
905 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
906 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
907 $totalarray[
'nbfield']++;
909 if (!empty($arrayfields[
't.progress'][
'checked'])) {
910 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
911 $totalarray[
'nbfield']++;
913 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
914 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
915 $totalarray[
'nbfield']++;
917 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
918 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
919 $totalarray[
'nbfield']++;
921 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
922 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
923 $totalarray[
'nbfield']++;
925 if (!empty($arrayfields[
't.billed'][
'checked'])) {
926 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
927 $totalarray[
'nbfield']++;
930 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
933 'arrayfields' => $arrayfields,
935 'sortfield' => $sortfield,
936 'sortorder' => $sortorder,
937 'totalarray' => &$totalarray,
939 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
940 print $hookmanager->resPrint;
941 if (!empty($arrayfields[
't.datec'][
'checked'])) {
942 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
943 $totalarray[
'nbfield']++;
945 if (!empty($arrayfields[
't.tms'][
'checked'])) {
946 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
947 $totalarray[
'nbfield']++;
949 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
950 $totalarray[
'nbfield']++;
953 $plannedworkloadoutputformat =
'allhourmin';
954 $timespentoutputformat =
'allhourmin';
955 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
956 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
958 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
959 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
965 $savnbfield = $totalarray[
'nbfield'];
966 $totalarray[
'nbfield'] = 0;
967 $imaxinloop = ($limit ? min($num, $limit) : $num);
968 while ($i < $imaxinloop) {
969 $obj = $db->fetch_object(
$resql);
975 $object->id = $obj->id;
976 $object->ref = $obj->ref;
977 $object->label = $obj->label;
978 $object->description = $obj->description;
979 $object->fk_statut = $obj->fk_statut;
980 $object->progress = $obj->progress;
981 $object->budget_amount = $obj->budget_amount;
982 $object->date_start = $db->jdate($obj->date_start);
983 $object->date_end = $db->jdate($obj->date_end);
984 $object->planned_workload = $obj->planned_workload;
985 $object->duration_effective = $obj->duration_effective;
986 $object->fk_task_parent = $obj->fk_task_parent;
988 $projectstatic->id = $obj->projectid;
989 $projectstatic->ref = $obj->projectref;
990 $projectstatic->title = $obj->projecttitle;
991 $projectstatic->public = $obj->public;
992 $projectstatic->statut = $obj->projectstatus;
993 $projectstatic->datee = $db->jdate($obj->projectdatee);
995 if ($mode ==
'kanban') {
997 print
'<tr><td colspan="'.$savnbfield.
'">';
998 print
'<div class="box-flex-container">';
1001 print $object->getKanbanView(
'');
1002 if ($i == ($imaxinloop - 1)) {
1007 $userAccess = $projectstatic->restrictedProjectArea($user);
1008 if ($userAccess >= 0) {
1009 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1012 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1013 print
'<td class="nowraponall">';
1014 if (!empty($object->fk_task_parent)) {
1015 $object_parent =
new Task($db);
1016 $result = $object_parent->fetch($object->fk_task_parent);
1020 print $object_parent->getNomUrl(1,
'withproject');
1021 if ($object_parent->hasDelay()) {
1028 $totalarray[
'nbfield']++;
1032 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1033 print
'<td class="nowraponall">';
1034 print $object->getNomUrl(1,
'withproject');
1035 if ($object->hasDelay()) {
1040 $totalarray[
'nbfield']++;
1044 if (!empty($arrayfields[
't.label'][
'checked'])) {
1045 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($object->label).
'">';
1049 $totalarray[
'nbfield']++;
1053 if (!empty($arrayfields[
't.description'][
'checked'])) {
1058 $totalarray[
'nbfield']++;
1062 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1063 print
'<td class="center">';
1067 $totalarray[
'nbfield']++;
1071 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1072 print
'<td class="center">';
1076 $totalarray[
'nbfield']++;
1080 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1081 print
'<td class="nowraponall tdoverflowmax150">';
1082 print $projectstatic->getNomUrl(1,
'task');
1083 if ($projectstatic->hasDelay()) {
1088 $totalarray[
'nbfield']++;
1092 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1094 print
dol_trunc($obj->projecttitle, 80);
1097 $totalarray[
'nbfield']++;
1101 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1104 $socstatic->id = $obj->socid;
1105 $socstatic->name = $obj->name;
1106 print $socstatic->getNomUrl(1);
1112 $totalarray[
'nbfield']++;
1116 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1117 print
'<td class="center">';
1118 print $projectstatic->getLibStatut(1);
1121 $totalarray[
'nbfield']++;
1126 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1127 print
'<td class="center">';
1130 if ($obj->planned_workload !=
'') {
1138 $totalarray[
'nbfield']++;
1141 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.planned_workload';
1143 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1145 $totalarray[
'totalplannedworkloadfield'] = $totalarray[
'nbfield'];
1147 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1150 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1151 $showlineingray = 0; $showproject = 1;
1152 print
'<td class="center">';
1153 if ($showlineingray) {
1156 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1158 if ($obj->duration_effective) {
1163 if ($showlineingray) {
1170 $totalarray[
'nbfield']++;
1173 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.duration_effective';
1175 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1177 $totalarray[
'totaldurationeffectivefield'] = $totalarray[
'nbfield'];
1179 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1182 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1183 print
'<td class="center">';
1184 if ($obj->planned_workload || $obj->duration_effective) {
1185 if ($obj->planned_workload) {
1186 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1188 print
$form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1193 $totalarray[
'nbfield']++;
1196 $totalarray[
'totalprogress_calculatedfield'] = $totalarray[
'nbfield'];
1200 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1201 print
'<td class="center">';
1202 if ($obj->progress !=
'') {
1207 $totalarray[
'nbfield']++;
1210 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.progress';
1212 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1214 $totalarray[
'totalprogress_declaredfield'] = $totalarray[
'nbfield'];
1216 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1219 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1220 print
'<td class="center">';
1221 if ($obj->progress !=
'' && $obj->duration_effective) {
1226 $totalarray[
'nbfield']++;
1229 $totalarray[
'totalprogress_summary'] = $totalarray[
'nbfield'];
1233 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1234 print
'<td class="center">';
1235 if ($object->budget_amount) {
1236 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1240 $totalarray[
'nbfield']++;
1243 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.budget_amount';
1245 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1247 $totalarray[
'totalbudget_amountfield'] = $totalarray[
'nbfield'];
1249 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1252 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1253 print
'<td class="center">';
1254 if ($obj->usage_bill_time) {
1256 $totalarray[
'val'][
't.tobill'] += $obj->tobill;
1257 $totalarray[
'totaltobill'] += $obj->tobill;
1259 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1263 $totalarray[
'nbfield']++;
1266 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.tobill';
1269 $totalarray[
'totaltobillfield'] = $totalarray[
'nbfield'];
1273 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1274 print
'<td class="center">';
1275 if ($obj->usage_bill_time) {
1277 $totalarray[
'val'][
't.billed'] += $obj->billed;
1278 $totalarray[
'totalbilled'] += $obj->billed;
1280 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1284 $totalarray[
'nbfield']++;
1287 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.billed';
1290 $totalarray[
'totalbilledfield'] = $totalarray[
'nbfield'];
1294 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1296 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1297 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1298 print $hookmanager->resPrint;
1300 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1301 print
'<td class="center">';
1302 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1305 $totalarray[
'nbfield']++;
1309 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1310 print
'<td class="center">';
1311 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1314 $totalarray[
'nbfield']++;
1324 print
'<td class="nowrap center">';
1325 if ($massactionbutton || $massaction) {
1327 if (in_array($object->id, $arrayofselected)) {
1330 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1334 $totalarray[
'nbfield']++;
1345 if (isset($totalarray[
'totaldurationeffectivefield']) || isset($totalarray[
'totalplannedworkloadfield']) || isset($totalarray[
'totalprogress_calculatedfield'])
1346 || isset($totalarray[
'totaltobill']) || isset($totalarray[
'totalbilled']) || isset($totalarray[
'totalbudget'])) {
1347 print
'<tr class="liste_total">';
1349 while ($i < $totalarray[
'nbfield']) {
1352 if ($num < $limit && empty($offset)) {
1353 print
'<td class="left">'.$langs->trans(
"Total").
'</td>';
1355 print
'<td class="left">'.$langs->trans(
"Totalforthispage").
'</td>';
1357 } elseif ($totalarray[
'totalplannedworkloadfield'] == $i) {
1358 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1359 } elseif ($totalarray[
'totaldurationeffectivefield'] == $i) {
1360 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1361 } elseif ($totalarray[
'totalprogress_calculatedfield'] == $i) {
1362 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationeffective'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1363 } elseif ($totalarray[
'totalprogress_declaredfield'] == $i) {
1364 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationdeclared'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1365 } elseif ($totalarray[
'totaltobillfield'] == $i) {
1366 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1367 } elseif ($totalarray[
'totalbilledfield'] == $i) {
1368 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1369 } elseif ($totalarray[
'totalbudget_amountfield'] == $i) {
1370 print
'<td class="center">'.price($totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).
'</td>';
1380 $parameters = array(
'arrayfields'=>$arrayfields,
'sql' => $sql);
1381 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1382 print $hookmanager->resPrint;
1384 print
'</table>'.
"\n";
1385 print
'</div>'.
"\n";
1387 print
'</form>'.
"\n";