26 require
"../main.inc.php";
27 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34 if ($conf->categorie->enabled) { require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.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');
47 $taskref =
GETPOST(
'taskref',
'alpha');
50 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
51 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) { $page = 0; }
55 $offset = $limit * $page;
56 $pageprev = $page - 1;
57 $pagenext = $page + 1;
59 $backtopage =
GETPOST(
'backtopage',
'alpha');
60 $cancel =
GETPOST(
'cancel',
'alpha');
62 $search_user_id =
GETPOST(
'search_user_id',
'int');
63 $search_taskref =
GETPOST(
'search_taskref');
64 $search_tasklabel =
GETPOST(
'search_tasklabel');
65 $search_taskdescription =
GETPOST(
'search_taskdescription');
66 $search_dtstartday =
GETPOST(
'search_dtstartday');
67 $search_dtstartmonth =
GETPOST(
'search_dtstartmonth');
68 $search_dtstartyear =
GETPOST(
'search_dtstartyear');
69 $search_dtendday =
GETPOST(
'search_dtendday');
70 $search_dtendmonth =
GETPOST(
'search_dtendmonth');
71 $search_dtendyear =
GETPOST(
'search_dtendyear');
72 $search_planedworkload =
GETPOST(
'search_planedworkload');
73 $search_timespend =
GETPOST(
'search_timespend');
74 $search_progresscalc =
GETPOST(
'search_progresscalc');
75 $search_progressdeclare =
GETPOST(
'search_progressdeclare');
77 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'projecttasklist';
82 $taskstatic =
new Task($db);
85 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
86 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
88 if ($id > 0 || !empty($ref))
91 $extrafields->fetch_name_optionals_label($object->table_element);
93 $extrafields->fetch_name_optionals_label($taskstatic->table_element);
94 $search_array_options = $extrafields->getOptionalsFromPost($taskstatic->table_element,
'',
'search_');
98 if (!$sortfield) { reset($object->fields); $sortfield=
"t.".key($object->fields); }
99 if (!$sortorder) $sortorder =
"ASC";
107 $diroutputmassaction = $conf->projet->dir_output.
'/tasks/temp/massgeneration/'.$user->id;
110 $hookmanager->initHooks(array(
'projecttaskscard',
'globalcard'));
112 $progress =
GETPOST(
'progress',
'int');
113 $label =
GETPOST(
'label',
'alpha');
114 $description =
GETPOST(
'description',
'restricthtml');
115 $planned_workloadhour = (
GETPOST(
'planned_workloadhour',
'int') ?
GETPOST(
'planned_workloadhour',
'int') : 0);
116 $planned_workloadmin = (
GETPOST(
'planned_workloadmin',
'int') ?
GETPOST(
'planned_workloadmin',
'int') : 0);
117 $planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60;
120 $arrayfields = array(
121 't.ref'=>array(
'label'=>$langs->trans(
"RefTask"),
'checked'=>1,
'position'=>1),
122 't.label'=>array(
'label'=>$langs->trans(
"LabelTask"),
'checked'=>1,
'position'=>2),
123 't.description'=>array(
'label'=>$langs->trans(
"Description"),
'checked'=>0,
'position'=>3),
124 't.dateo'=>array(
'label'=>$langs->trans(
"DateStart"),
'checked'=>1,
'position'=>4),
125 't.datee'=>array(
'label'=>$langs->trans(
"Deadline"),
'checked'=>1,
'position'=>5),
126 't.planned_workload'=>array(
'label'=>$langs->trans(
"PlannedWorkload"),
'checked'=>1,
'position'=>6),
127 't.duration_effective'=>array(
'label'=>$langs->trans(
"TimeSpent"),
'checked'=>1,
'position'=>7),
128 't.progress_calculated'=>array(
'label'=>$langs->trans(
"ProgressCalculated"),
'checked'=>1,
'position'=>8),
129 't.progress'=>array(
'label'=>$langs->trans(
"ProgressDeclared"),
'checked'=>1,
'position'=>9),
130 't.progress_summary'=>array(
'label'=>$langs->trans(
"TaskProgressSummary"),
'checked'=>1,
'position'=>10),
132 if ($object->usage_bill_time) {
133 $arrayfields[
't.tobill'] = array(
'label'=>$langs->trans(
"TimeToBill"),
'checked'=>0,
'position'=>11);
134 $arrayfields[
't.billed'] = array(
'label'=>$langs->trans(
"TimeBilled"),
'checked'=>0,
'position'=>12);
138 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
142 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
149 $parameters = array(
'id'=>$id);
150 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
151 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
156 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
159 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
161 $search_user_id =
"";
162 $search_taskref =
'';
163 $search_tasklabel =
'';
164 $search_dtstartday =
'';
165 $search_dtstartmonth =
'';
166 $search_dtstartyear =
'';
167 $search_dtendday =
'';
168 $search_dtendmonth =
'';
169 $search_dtendyear =
'';
170 $search_planedworkload =
'';
171 $search_timespend =
'';
172 $search_progresscalc =
'';
173 $search_progressdeclare =
'';
175 $search_array_options = array();
179 $objectclass =
'Task';
180 $objectlabel =
'Tasks';
181 $permissiontoread = $user->rights->projet->lire;
182 $permissiontodelete = $user->rights->projet->supprimer;
183 $uploaddir = $conf->projet->dir_output.
'/tasks';
184 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
187 $morewherefilterarray = array();
189 if (!empty($search_taskref)) {
190 $morewherefilterarray[] =
natural_search(
't.ref', $search_taskref, 0, 1);
193 if (!empty($search_tasklabel)) {
194 $morewherefilterarray[] =
natural_search(
't.label', $search_tasklabel, 0, 1);
197 $moresql =
dolSqlDateFilter(
't.dateo', $search_dtstartday, $search_dtstartmonth, $search_dtstartyear, 1);
198 if ($moresql) $morewherefilterarray[] = $moresql;
200 $moresql =
dolSqlDateFilter(
't.datee', $search_dtendday, $search_dtendmonth, $search_dtendyear, 1);
201 if ($moresql) $morewherefilterarray[] = $moresql;
203 if (!empty($search_planedworkload)) {
204 $morewherefilterarray[] =
natural_search(
't.planned_workload', $search_planedworkload, 1, 1);
207 if (!empty($search_timespend)) {
208 $morewherefilterarray[] =
natural_search(
't.duration_effective', $search_timespend, 1, 1);
211 if (!empty($search_progresscalc)) {
212 $filterprogresscalc =
'if '.natural_search(
'round(100 * $line->duration / $line->planned_workload,2)', $search_progresscalc, 1, 1).
'{return 1;} else {return 0;}';
214 $filterprogresscalc =
'';
217 if (!empty($search_progressdeclare)) {
218 $morewherefilterarray[] =
natural_search(
't.progress', $search_progressdeclare, 1, 1);
221 $morewherefilter =
'';
222 if (count($morewherefilterarray) > 0) {
223 $morewherefilter =
' AND '.implode(
' AND ', $morewherefilterarray);
226 if ($action ==
'createtask' && $user->rights->projet->creer)
233 $date_start =
dol_mktime(
GETPOST(
'dateohour',
'int'),
GETPOST(
'dateomin',
'int'), 0,
GETPOST(
'dateomonth',
'int'),
GETPOST(
'dateoday',
'int'),
GETPOST(
'dateoyear',
'int'));
234 $date_end =
dol_mktime(
GETPOST(
'dateehour',
'int'),
GETPOST(
'dateemin',
'int'), 0,
GETPOST(
'dateemonth',
'int'),
GETPOST(
'dateeday',
'int'),
GETPOST(
'dateeyear',
'int'));
240 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")), null,
'errors');
246 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")), null,
'errors');
249 } elseif (empty($_POST[
'task_parent']))
251 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ChildOfProjectTask")), null,
'errors');
258 $tmparray = explode(
'_',
GETPOST(
'task_parent'));
259 $projectid = $tmparray[0];
260 if (empty($projectid)) $projectid = $id;
261 $task_parent = $tmparray[1];
262 if (empty($task_parent)) $task_parent = 0;
264 $task =
new Task($db);
266 $task->fk_project = $projectid;
267 $task->ref = $taskref;
268 $task->label = $label;
269 $task->description = $description;
270 $task->planned_workload = $planned_workload;
271 $task->fk_task_parent = $task_parent;
273 $task->date_start = $date_start;
274 $task->date_end = $date_end;
275 $task->progress = $progress;
278 $ret = $extrafields->setOptionalsFromPost(null, $task);
280 $taskid = $task->create($user);
284 $result = $task->add_contact($_POST[
"userid"],
'TASKEXECUTIVE',
'internal');
286 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
288 $langs->load(
"projects");
290 $duplicate_code_error =
true;
301 if (!empty($backtopage))
303 header(
"Location: ".$backtopage);
305 } elseif (empty($projectid))
307 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/list.php'.(empty($mode) ?
'' :
'?mode='.$mode));
313 if (!empty($backtopage))
315 header(
"Location: ".$backtopage);
317 } elseif (empty($id))
320 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/list.php'.(empty($mode) ?
'' :
'?mode='.$mode));
332 $form =
new Form($db);
335 $projectstatic =
new Project($db);
336 $taskstatic =
new Task($db);
337 $userstatic =
new User($db);
339 $title = $langs->trans(
"Project").
' - '.$langs->trans(
"Tasks").
' - '.$object->ref.
' '.$object->name;
340 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"Tasks");
341 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
346 if ($id > 0 || !empty($ref))
348 $object->fetch($id, $ref);
349 $object->fetch_thirdparty();
350 $res = $object->fetch_optionals();
354 $userWrite = $object->restrictedProjectArea($user,
'write');
362 print dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
364 $param =
'&id='.$object->id;
365 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
366 if ($search_user_id) $param .=
'&search_user_id='.urlencode($search_user_id);
367 if ($search_taskref) $param .=
'&search_taskref='.urlencode($search_taskref);
368 if ($search_tasklabel) $param .=
'&search_tasklabel='.urlencode($search_tasklabel);
369 if ($search_taskdescription) $param .=
'&search_taskdescription='.urlencode($search_taskdescription);
370 if ($search_dtstartday) $param .=
'&search_dtstartday='.urlencode($search_dtstartday);
371 if ($search_dtstartmonth) $param .=
'&search_dtstartmonth='.urlencode($search_dtstartmonth);
372 if ($search_dtstartyear) $param .=
'&search_dtstartyear='.urlencode($search_dtstartyear);
373 if ($search_dtendday) $param .=
'&search_dtendday='.urlencode($search_dtendday);
374 if ($search_dtendmonth) $param .=
'&search_dtendmonth='.urlencode($search_dtendmonth);
375 if ($search_dtendyear) $param .=
'&search_dtendyear='.urlencode($search_dtendyear);
376 if ($search_planedworkload) $param .=
'&search_planedworkload='.urlencode($search_planedworkload);
377 if ($search_timespend) $param .=
'&search_timespend='.urlencode($search_timespend);
378 if ($search_progresscalc) $param .=
'&search_progresscalc='.urlencode($search_progresscalc);
379 if ($search_progressdeclare) $param .=
'&search_progressdeclare='.urlencode($search_progressdeclare);
380 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
382 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
386 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
388 $morehtmlref =
'<div class="refidno">';
390 $morehtmlref .= $object->title;
392 if ($object->thirdparty->id > 0)
394 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1,
'project');
396 $morehtmlref .=
'</div>';
399 if (!$user->rights->projet->all->lire)
401 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
402 $object->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
405 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
407 print '<div class="fichecenter">';
408 print '<div class="fichehalfleft">';
409 print '<div class="underbanner clearboth"></div>';
411 print '<table class="border tableforfield" width="100%">';
414 print '<tr><td class="tdtop">';
415 print $langs->trans(
"Usage");
418 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
420 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
421 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
422 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
425 if (empty($conf->global->PROJECT_HIDE_TASKS))
427 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
428 $htmltext = $langs->trans(
"ProjectFollowTasks");
429 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
432 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
434 print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
435 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
436 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
442 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
443 if ($object->public)
print $langs->trans(
'SharedProject');
444 else print $langs->trans(
'PrivateProject');
448 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
450 print ($start ? $start :
'?');
453 print ($end ? $end :
'?');
458 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
459 if (strcmp($object->budget_amount,
''))
print price($object->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
464 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
469 print '<div class="fichehalfright">';
470 print '<div class="ficheaddleft">';
471 print '<div class="underbanner clearboth"></div>';
473 print '<table class="border tableforfield" width="100%">';
476 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
477 print nl2br($object->description);
481 if ($conf->categorie->enabled) {
482 print '<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td>';
483 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
493 print '<div class="clearboth"></div>';
500 if ($action ==
'create' && $user->rights->projet->creer && (empty($object->thirdparty->id) || $userWrite > 0))
502 if ($id > 0 || !empty($ref))
print '<br>';
507 print '<div class="warning">';
508 $langs->load(
"errors");
509 print $langs->trans(
"WarningProjectClosed");
514 print '<div class="warning">';
515 $langs->load(
"errors");
516 print $langs->trans(
"WarningProjectDraft");
520 print '<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
521 print '<input type="hidden" name="token" value="'.newToken().
'">';
522 print '<input type="hidden" name="action" value="createtask">';
523 print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
524 if (!empty($object->id))
print '<input type="hidden" name="id" value="'.$object->id.
'">';
528 print '<table class="border centpercent">';
531 $obj = empty($conf->global->PROJECT_TASK_ADDON) ?
'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
532 if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT.
"/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.
".php"))
534 require_once DOL_DOCUMENT_ROOT.
"/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.
'.php';
536 $defaultref = $modTask->getNextValue($object->thirdparty, null);
539 if (is_numeric($defaultref) && $defaultref <= 0) $defaultref =
'';
542 print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Ref").
'</span></td><td>';
543 if (empty($duplicate_code_error))
549 print '<input type="hidden" name="taskref" value="'.(GETPOSTISSET(
"ref") ?
GETPOST(
"ref",
'alpha') : $defaultref).
'">';
552 print '<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td>';
553 print '<input type="text" name="label" autofocus class="minwidth500 maxwidthonsmartphone" value="'.$label.
'">';
557 print '<tr><td class="fieldrequired">'.$langs->trans(
"ChildOfProjectTask").
'</td><td>';
559 $formother->selectProjectTasks(
GETPOST(
'task_parent'), $projectid ? $projectid : $object->id,
'task_parent', 0, 0, 1, 1, 0,
'0,1',
'maxwidth500');
562 print '<tr><td>'.$langs->trans(
"AffectedTo").
'</td><td>';
563 $contactsofproject = (!empty($object->id) ? $object->getListContactId(
'internal') :
'');
564 if (is_array($contactsofproject) && count($contactsofproject))
566 print $form->select_dolusers($user->id,
'userid', 0,
'', 0,
'', $contactsofproject, 0, 0, 0,
'', 0,
'',
'maxwidth300');
568 print $langs->trans(
"NoUserAssignedToTheProject");
573 print '<tr><td>'.$langs->trans(
"DateStart").
'</td><td>';
574 print $form->selectDate(($date_start ? $date_start :
''),
'dateo', 1, 1, 0,
'', 1, 1);
578 print '<tr><td>'.$langs->trans(
"DateEnd").
'</td><td>';
579 print $form->selectDate(($date_end ? $date_end : -1),
'datee', -1, 1, 0,
'', 1, 1);
583 print '<tr><td>'.$langs->trans(
"PlannedWorkload").
'</td><td>';
584 print $form->select_duration(
'planned_workload', $planned_workload ? $planned_workload : 0, 0,
'text');
588 print '<tr><td>'.$langs->trans(
"ProgressDeclared").
'</td><td colspan="3">';
589 print $formother->select_percent($progress,
'progress', 0, 5, 0, 100, 1);
593 print '<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
595 print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_4.
'">'.$description.
'</textarea>';
599 $parameters = array();
600 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $taskstatic, $action);
601 print $hookmanager->resPrint;
603 if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element][
'label']))
605 print $taskstatic->showOptionals($extrafields,
'edit');
612 print '<div class="center">';
613 print '<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
614 print ' ';
615 print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
619 } elseif ($id > 0 || !empty($ref)) {
620 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
629 $linktocreatetaskParam = array();
630 $linktocreatetaskUserRight =
false;
631 if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
632 if ($object->public || $userWrite > 0) {
633 $linktocreatetaskUserRight =
true;
635 $linktocreatetaskParam[
'attr'][
'title'] = $langs->trans(
"NotOwnerOfProject");
639 $linktocreatetask =
dolGetButtonTitle($langs->trans(
'AddTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?action=create'.$param.
'&backtopage='.urlencode(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id),
'', $linktocreatetaskUserRight, $linktocreatetaskParam);
641 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'">';
642 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
643 print '<input type="hidden" name="token" value="'.newToken().
'">';
644 print '<input type="hidden" name="action" value="list">';
645 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
646 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
647 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
648 print '<input type="hidden" name="page" value="'.$page.
'">';
649 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
651 $title = $langs->trans(
"ListOfTasks");
652 $linktotasks =
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.
'/projet/tasks.php?id='.$object->id,
'', 1, array(
'morecss'=>
'reposition btnTitleSelected'));
653 $linktotasks .=
dolGetButtonTitle($langs->trans(
'ViewGantt'),
'',
'fa fa-stream imgforviewmode', DOL_URL_ROOT.
'/projet/ganttview.php?id='.$object->id.
'&withproject=1',
'', 1, array(
'morecss'=>
'reposition marginleftonly'));
660 $filteronthirdpartyid = $socid;
661 $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0,
'', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options);
664 $tmpuser =
new User($db);
665 if ($search_user_id > 0) $tmpuser->fetch($search_user_id);
667 $tasksrole = ($tmpuser->id > 0 ? $taskstatic->getUserRolesForProjectsOrTasks(0, $tmpuser, $object->id, 0) :
'');
671 if (!empty($conf->use_javascript_ajax))
673 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
678 if (count($tasksarray) > 0)
680 $moreforfilter .=
'<div class="divsearchfield">';
681 $moreforfilter .= $langs->trans(
"TasksAssignedTo").
': ';
682 $moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id :
'',
'search_user_id', 1);
683 $moreforfilter .=
'</div>';
687 print '<div class="liste_titre liste_titre_bydiv centpercent">';
688 print $moreforfilter;
692 print '<div class="div-table-responsive">';
693 print '<table id="tablelines" class="tagtable nobottom liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
696 print '<tr class="liste_titre_filter">';
698 if (!empty($arrayfields[
't.ref'][
'checked'])) {
699 print
'<td class="liste_titre">';
700 print
'<input class="flat searchstring maxwidth50" type="text" name="search_taskref" value="'.dol_escape_htmltag($search_taskref).
'">';
704 if (!empty($arrayfields[
't.label'][
'checked'])) {
705 print
'<td class="liste_titre">';
706 print
'<input class="flat searchstring maxwidth100" type="text" name="search_tasklabel" value="'.dol_escape_htmltag($search_tasklabel).
'">';
710 if (!empty($arrayfields[
't.description'][
'checked'])) {
711 print
'<td class="liste_titre">';
712 print
'<input class="flat searchstring maxwidth100" type="text" name="search_taskdescription" value="'.dol_escape_htmltag($search_taskdescription).
'">';
716 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
717 print
'<td class="liste_titre center">';
718 print
'<span class="nowraponall"><input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtstartday" value="'.$search_dtstartday.
'">';
719 print
'<input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtstartmonth" value="'.$search_dtstartmonth.
'"></span>';
720 $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1,
'search_dtstartyear', 1, 20, 5);
724 if (!empty($arrayfields[
't.datee'][
'checked'])) {
725 print
'<td class="liste_titre center">';
726 print
'<span class="nowraponall"><input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtendday" value="'.$search_dtendday.
'">';
727 print
'<input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtendmonth" value="'.$search_dtendmonth.
'"></span>';
728 $formother->select_year($search_dtendyear ? $search_dtendyear : -1,
'search_dtendyear', 1, 20, 5);
732 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
733 print
'<td class="liste_titre right">';
734 print
'<input class="flat" type="text" size="4" name="search_planedworkload" value="'.$search_planedworkload.
'">';
738 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
739 print
'<td class="liste_titre right">';
740 print
'<input class="flat" type="text" size="4" name="search_timespend" value="'.$search_timespend.
'">';
744 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
745 print
'<td class="liste_titre right">';
746 print
'<input class="flat" type="text" size="4" name="search_progresscalc" value="'.$search_progresscalc.
'">';
750 if (!empty($arrayfields[
't.progress'][
'checked'])) {
751 print
'<td class="liste_titre right">';
752 print
'<input class="flat" type="text" size="4" name="search_progressdeclare" value="'.$search_progressdeclare.
'">';
757 print
'<td class="liste_titre right"></td>';
759 if ($object->usage_bill_time)
761 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
762 print
'<td class="liste_titre right">';
766 if (!empty($arrayfields[
't.billed'][
'checked'])) {
767 print
'<td class="liste_titre right">';
772 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print
'<td class="liste_titre"></td>';
774 $extrafieldsobjectkey = $taskstatic->table_element;
775 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
778 print
'<td class="liste_titre maxwidthsearch">';
779 $searchpicto = $form->showFilterButtons();
784 print
'<tr class="liste_titre nodrag nodrop">';
786 if (!empty($arrayfields[
't.ref'][
'checked']))
print_liste_field_titre($arrayfields[
't.ref'][
'label'],
$_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'');
787 if (!empty($arrayfields[
't.label'][
'checked']))
print_liste_field_titre($arrayfields[
't.label'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'');
788 if (!empty($arrayfields[
't.description'][
'checked']))
print_liste_field_titre($arrayfields[
't.description'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'');
789 if (!empty($arrayfields[
't.dateo'][
'checked']))
print_liste_field_titre($arrayfields[
't.dateo'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ');
790 if (!empty($arrayfields[
't.datee'][
'checked']))
print_liste_field_titre($arrayfields[
't.datee'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ');
791 if (!empty($arrayfields[
't.planned_workload'][
'checked']))
print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ',
'', 1);
792 if (!empty($arrayfields[
't.duration_effective'][
'checked']))
print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ',
'', 1);
793 if (!empty($arrayfields[
't.progress_calculated'][
'checked']))
print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ',
'', 1);
794 if (!empty($arrayfields[
't.progress'][
'checked']))
print_liste_field_titre($arrayfields[
't.progress'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ',
'', 1);
795 if (!empty($arrayfields[
't.progress_summary'][
'checked']))
print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center ',
'', 1);
796 if ($object->usage_bill_time)
798 if (!empty($arrayfields[
't.tobill'][
'checked']))
print_liste_field_titre($arrayfields[
't.tobill'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ');
799 if (!empty($arrayfields[
't.billed'][
'checked']))
print_liste_field_titre($arrayfields[
't.billed'][
'label'],
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ');
801 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
print_liste_field_titre(
"TaskRessourceLinks",
$_SERVER[
"PHP_SELF"],
'',
'', $param, $sortfield, $sortorder);
803 $disablesortlink = 1;
804 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
806 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
807 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
808 print $hookmanager->resPrint;
812 if (count($tasksarray) > 0)
816 $nboftaskshown =
projectLinesa($j, 0, $tasksarray, $level,
true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields);
819 if ($object->usage_bill_time) $colspan += 2;
820 print
'<tr class="oddeven nobottom"><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoTasks").
'</span></td></tr>';
831 if (!empty($user->rights->projet->all->lire))
833 if ($search_user_id == $user->id)
835 if ($nboftaskshown < count($tasksrole))
837 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
841 if ($nboftaskshown < count($tasksarray) && !
GETPOST(
'search_user_id',
'int'))
843 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
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.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
Clean corrupted tree (orphelins linked to a not existing parent), record linked to themself and child...
const STATUS_CLOSED
Closed status.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId= '', $addordertick=0, $projectidfortotallink=0, $filterprogresscalc= '', $showbilltime=0, $arrayfields=array())
Show task lines with a particular parent.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an 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...
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
print
Draft customers invoices.
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_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
const STATUS_DRAFT
Draft status.