29require
"../../main.inc.php";
37require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
48$langs->loadlangs(array(
'projects',
'companies'));
50$action =
GETPOST(
'action',
'aZ09');
51$confirm =
GETPOST(
'confirm',
'alpha');
58$ref =
GETPOST(
"ref",
'alpha', 1);
59$taskref =
GETPOST(
"taskref",
'alpha');
61$project_ref =
GETPOST(
'project_ref',
'alpha');
62$planned_workload = ((
GETPOST(
'planned_workloadhour') !=
'' ||
GETPOST(
'planned_workloadmin') !=
'') ? (
GETPOSTINT(
'planned_workloadhour') > 0 ?
GETPOSTINT(
'planned_workloadhour') * 3600 : 0) + (
GETPOSTINT(
'planned_workloadmin') > 0 ?
GETPOSTINT(
'planned_workloadmin') * 60 : 0) :
'');
63$mode =
GETPOST(
'mode',
'alpha');
66$hookmanager->initHooks(array(
'projecttaskcard',
'globalcard'));
70$projectstatic =
new Project($db);
73$extrafields->fetch_name_optionals_label(
$object->table_element);
75$parameters = array(
'id' => $id);
76$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
78 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
82 $ret =
$object->fetch($id, $ref);
84 $projectstatic->fetch(
$object->fk_project);
101if ($action ==
'update' && !
GETPOST(
"cancel") && $user->hasRight(
'projet',
'creer')) {
102 if (empty($taskref)) {
104 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
108 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
113 $tmparray = explode(
'_',
GETPOST(
'task_parent'));
114 $task_parent = $tmparray[1];
115 if (empty($task_parent)) {
126 $object->fk_task_parent = $task_parent;
127 $object->planned_workload = $planned_workload;
133 if (
GETPOST(
'progress') ==
'100') {
134 $object->status = $object::STATUS_CLOSED;
135 } elseif (
GETPOST(
'progress') !=
'0') {
136 $object->status = $object::STATUS_ONGOING;
140 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
146 $result =
$object->update($user);
159if ($action ==
'confirm_merge' && $confirm ==
'yes' && $user->hasRight(
'projet',
'creer')) {
161 $task_origin =
new Task($db);
163 if ($task_origin_id <= 0) {
164 $langs->load(
'errors');
165 setEventMessages($langs->trans(
'ErrorTaskIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginTask')),
null,
'errors');
167 if (!$error && $task_origin->fetch($task_origin_id) < 1) {
168 setEventMessages($langs->trans(
'ErrorRecordNotFound'),
null,
'errors');
172 $result =
$object->mergeTask($task_origin_id);
177 setEventMessages($langs->trans(
'TaskMergeSuccess'),
null,
'mesgs');
183if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'projet',
'creer')) {
185 $clone_prog =
GETPOST(
'clone_prog') ? 1 : 0;
186 $clone_time =
GETPOST(
'clone_time') ? 1 : 0;
187 $clone_affectation =
GETPOST(
'clone_affectation') ? 1 : 0;
188 $clone_change_dt =
GETPOST(
'clone_change_dt') ? 1 : 0;
189 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
190 $clone_file =
GETPOST(
'clone_file') ? 1 : 0;
191 $result =
$object->createFromClone($user,
$object->id,
$object->fk_project,
$object->fk_task_parent, $clone_change_dt, $clone_affectation, $clone_time, $clone_file, $clone_notes, $clone_prog);
196 $newobject =
new Task($db);
197 $newobject->fetch($result);
198 $newobject->fetch_optionals();
199 $newobject->fetch_thirdparty();
205if ($action ==
'confirm_delete' && $confirm ==
"yes" && $user->hasRight(
'projet',
'supprimer')) {
206 $result = $projectstatic->fetch(
$object->fk_project);
207 $projectstatic->fetch_thirdparty();
211 if (
$object->delete($user) > 0) {
212 header(
'Location: '.DOL_URL_ROOT.
'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ?
'&withproject=1' :
''));
220if ($action ==
'confirm_close' && $confirm ==
"yes" && $user->hasRight(
'projet',
'creer')) {
221 $result = $projectstatic->fetch(
$object->fk_project);
222 $projectstatic->fetch_thirdparty();
232if (!empty($project_ref) && !empty($withproject)) {
233 if ($projectstatic->fetch(0, $project_ref) > 0) {
234 $tasksarray =
$object->getTasksArray(
null,
null, $projectstatic->id, $socid, 0);
235 if (count($tasksarray) > 0) {
236 $id = $tasksarray[0]->id;
238 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
244if ($action ==
'builddoc' && $user->hasRight(
'projet',
'creer')) {
250 $outputlangs = $langs;
251 if (
GETPOST(
'lang_id',
'aZ09')) {
253 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
255 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs);
263if ($action ==
'remove_file' && $user->hasRight(
'projet',
'creer')) {
264 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
266 $langs->load(
"other");
272 setEventMessages($langs->trans(
"FileWasRemoved",
GETPOST(
'file')),
null,
'mesgs');
274 setEventMessages($langs->trans(
"ErrorFailToDeleteFile",
GETPOST(
'file')),
null,
'errors');
279if ($action ==
'reopen' && $user->hasRight(
'projet',
'creer')) {
282 setEventMessages($langs->trans(
"TaskBackToDraft"),
null,
'mesgs');
290if ($action ==
'valid' && $user->hasRight(
'projet',
'creer')) {
293 setEventMessages($langs->trans(
"TaskValidated"),
null,
'mesgs');
305$form =
new Form($db);
311if (!empty($withproject)) {
312 $title .=
' | ' . $langs->trans(
"Project") . (!empty($projectstatic->ref) ?
': '.$projectstatic->ref :
'') ;
316llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-task');
319if ($id > 0 || !empty($ref)) {
320 $res =
$object->fetch_optionals();
325 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
326 $projectstatic->fetchComments();
328 if (!empty($projectstatic->socid)) {
329 $projectstatic->fetch_thirdparty();
332 $object->project = clone $projectstatic;
336 if (!empty($withproject)) {
340 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'), 0,
'',
'');
342 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
346 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
348 $morehtmlref =
'<div class="refidno">';
350 $morehtmlref .= $projectstatic->title;
352 if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
353 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
355 $morehtmlref .=
'</div>';
358 if (!$user->hasRight(
'projet',
'all',
'lire')) {
359 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
360 $projectstatic->next_prev_filter =
"rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
363 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
365 print
'<div class="fichecenter">';
366 print
'<div class="fichehalfleft">';
367 print
'<div class="underbanner clearboth"></div>';
369 print
'<table class="border tableforfield centpercent">';
373 print
'<tr><td class="tdtop">';
374 print $langs->trans(
"Usage");
378 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
379 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
380 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
384 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
385 $htmltext = $langs->trans(
"ProjectFollowTasks");
386 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
390 print
'<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
391 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
392 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
396 print
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_organize_event ?
' checked="checked"' :
'')).
'"> ';
397 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
398 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
404 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
405 if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount,
'')) {
406 print
'<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
411 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
413 print($start ? $start :
'?');
416 print($end ? $end :
'?');
417 if ($projectstatic->hasDelay()) {
418 print img_warning(
"Late");
423 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
424 if ($projectstatic->public) {
425 print img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
426 print $langs->trans(
'SharedProject');
428 print img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
429 print $langs->trans(
'PrivateProject');
437 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
444 print
'<div class="fichehalfright">';
445 print
'<div class="underbanner clearboth"></div>';
447 print
'<table class="border tableforfield centpercent">';
451 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
452 print $form->showCategories($projectstatic->id,
'project', 1);
457 print
'<tr><td class="titlefield'.($projectstatic->description ?
' noborderbottom' :
'').
'" colspan="2">'.$langs->trans(
"Description").
'</td></tr>';
458 if ($projectstatic->description) {
459 print
'<tr><td class="nottitleforfield" colspan="2">';
460 print
'<div class="longmessagecut">';
461 print dolPrintHTML($projectstatic->description);
471 print
'<div class="clearboth"></div>';
486 if ($action ==
'edit' && $user->hasRight(
'projet',
'creer')) {
487 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
488 print
'<input type="hidden" name="token" value="'.newToken().
'">';
489 print
'<input type="hidden" name="action" value="update">';
490 print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
491 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
493 print
dol_get_fiche_head($head,
'task_task', $langs->trans(
"Task"), 0,
'projecttask', 0,
'',
'');
495 $param = (
GETPOST(
'withproject') ?
'&withproject=1' :
'');
496 $linkback =
GETPOST(
'withproject') ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'">'.$langs->trans(
"BackToList").
'</a>' :
'';
498 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
499 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
500 $object->next_prev_filter =
"fk_projet:IN:".$db->sanitize($projectsListId);
502 $object->next_prev_filter =
"fk_projet:=:".((int) $projectstatic->id);
505 print
'<table class="border centpercent">';
508 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
509 print
'<td><input class="minwidth100" name="taskref" value="'.$object->ref.
'"></td></tr>';
512 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
513 print
'<td><input class="minwidth500" name="label" value="'.$object->label.
'"></td></tr>';
516 if (empty($withproject)) {
517 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
518 print $projectstatic->getNomUrl(1);
522 print
'<td>'.$langs->trans(
"ThirdParty").
'</td><td>';
523 if (!empty($projectstatic->thirdparty->id)) {
524 print $projectstatic->thirdparty->getNomUrl(1);
532 print
'<tr><td>'.$langs->trans(
"ChildOfProjectTask").
'</td><td>';
533 print img_picto(
'',
'projecttask');
534 $formother->selectProjectTasks(
$object->fk_task_parent, $projectstatic->id,
'task_parent', ($user->admin ? 0 : 1), 0, 0, 0,
$object->id,
'',
'minwidth100 widthcentpercentminusxx maxwidth500');
538 print
'<tr><td>'.$langs->trans(
"DateStart").
'</td><td>';
539 print $form->selectDate(
$object->date_start,
'date_start', 1, 1, 0,
'', 1, 0);
543 print
'<tr><td>'.$langs->trans(
"Deadline").
'</td><td>';
544 print $form->selectDate(
$object->date_end ?
$object->date_end : -1,
'date_end', 1, 1, 0,
'', 1, 0);
548 print
'<tr><td>'.$langs->trans(
"PlannedWorkload").
'</td><td>';
549 print $form->select_duration(
'planned_workload',
$object->planned_workload, 0,
'text');
553 print
'<tr><td>'.$langs->trans(
"ProgressDeclared").
'</td><td>';
554 print $formother->select_percent(
$object->progress,
'progress', 0, 5, 0, 100, 1);
558 print
'<tr><td>'.$langs->trans(
"Billable").
'</td><td>';
559 print $form->selectyesno(
'billable',
$object->billable);
564 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
568 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
570 $doleditor =
new DolEditor(
'description',
$object->description,
'', 80,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), $nbrows,
'90%');
571 print $doleditor->Create();
576 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
577 print
'<td><input class="width75" type="text" name="budget_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
price2num(
$object->budget_amount)).
'"></td>';
581 $parameters = array();
582 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
583 print $hookmanager->resPrint;
584 if (empty($reshook)) {
585 print
$object->showOptionals($extrafields,
'edit');
592 print $form->buttonsSaveCancel(
"Modify");
599 $param = ($withproject ?
'&withproject=1' :
'');
600 $linkback = $withproject ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'&restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>' :
'';
602 print
dol_get_fiche_head($head,
'task_task', $langs->trans(
"Task"), -1,
'projecttask', 0,
'',
'reposition', 0,
'', 1);
604 if ($action ==
'clone') {
605 $formquestion = array(
606 'text' => $langs->trans(
"ConfirmClone"),
608 0 => array(
'type' =>
'checkbox',
'name' =>
'clone_change_dt',
'label' => $langs->trans(
"CloneChanges"),
'value' =>
true),
609 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_affectation',
'label' => $langs->trans(
"CloneAffectation"),
'value' =>
true),
610 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_prog',
'label' => $langs->trans(
"CloneProgression"),
'value' =>
true),
611 3 => array(
'type' =>
'checkbox',
'name' =>
'clone_time',
'label' => $langs->trans(
"CloneTimes"),
'value' =>
true),
612 4 => array(
'type' =>
'checkbox',
'name' =>
'clone_file',
'label' => $langs->trans(
"CloneFile"),
'value' =>
true),
615 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneTask"),
"confirm_clone", $formquestion,
'', 1, 0, 600);
618 if ($action ==
'close') {
619 $formquestion = array(
620 'text' => $langs->trans(
"ConfirmClosed"),
622 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"ToClose"), $langs->trans(
"ConfirmCloseTask"),
"confirm_close", $formquestion,
'', 1, 0, 600);
626 if ($action ==
'merge') {
627 $formquestion = array(
629 'name' =>
'task_origin',
630 'label' => $langs->trans(
'MergeOriginTask'),
632 'value' => $formproject->selectTasks(-1, 0,
'task_origin', 24, 0, $langs->trans(
'SelectTask'), 0, 0, 0,
'maxwidth500 minwidth200',
'',
'',
null, 1)
635 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id.(GETPOST(
'withproject') ?
"&withproject=1" :
""), $langs->trans(
"MergeTasks"), $langs->trans(
"ConfirmMergeTasks"),
"confirm_merge", $formquestion,
'yes', 1, 250);
638 if ($action ==
'delete') {
639 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
GETPOSTINT(
"id").
'&withproject='.$withproject, $langs->trans(
"DeleteATask"), $langs->trans(
"ConfirmDeleteATask"),
"confirm_delete");
642 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
643 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
644 $object->next_prev_filter =
"fk_projet:IN:".$db->sanitize($projectsListId);
646 $object->next_prev_filter =
"fk_projet:=:".((int) $projectstatic->id);
652 if (empty($withproject)) {
653 $morehtmlref .=
'<div class="refidno">';
654 $morehtmlref .= $langs->trans(
"Project").
': ';
655 $morehtmlref .= $projectstatic->getNomUrl(1);
656 $morehtmlref .=
'<br>';
659 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
660 if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
661 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
663 $morehtmlref .=
'</div>';
666 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
668 print
'<div class="fichecenter">';
669 print
'<div class="fichehalfleft">';
671 print
'<div class="underbanner clearboth"></div>';
672 print
'<table class="border centpercent tableforfield">';
675 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"ChildOfTask").
'</td><td>';
676 if (
$object->fk_task_parent > 0) {
677 $tasktmp =
new Task($db);
678 $tasktmp->fetch(
$object->fk_task_parent);
679 print $tasktmp->getNomUrl(1);
684 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"Deadline").
'</td><td colspan="3">';
686 print($start ? $start :
'?');
689 print($end ? $end :
'?');
691 print img_warning(
"Late");
696 print
'<tr><td>'.$langs->trans(
"PlannedWorkload").
'</td><td colspan="3">';
697 if (
$object->planned_workload !=
'') {
703 print
'<td class="tdtop">'.$langs->trans(
"Description").
'</td><td colspan="3">';
710 print
'<div class="fichehalfright">';
712 print
'<div class="underbanner clearboth"></div>';
713 print
'<table class="border centpercent tableforfield">';
716 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"ProgressDeclared").
'</td><td colspan="3">';
723 print
'<tr><td>'.$langs->trans(
"ProgressCalculated").
'</td><td colspan="3">';
724 if (
$object->planned_workload !=
'') {
725 $tmparray =
$object->getSummaryOfTimeSpent();
726 if ($tmparray[
'total_duration'] > 0 && !empty(
$object->planned_workload)) {
727 print round($tmparray[
'total_duration'] /
$object->planned_workload * 100, 2).
' %';
732 print
'<span class="opacitymedium">'.$langs->trans(
"WorkloadNotDefined").
'</span>';
737 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
738 if (!is_null(
$object->budget_amount) && strcmp((
string)
$object->budget_amount,
'')) {
739 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
744 print
'<tr><td>'.$langs->trans(
"Billable").
'</td><td>';
745 print
'<span>'.($object->billable ? $langs->trans(
'Yes') : $langs->trans(
'No')).
'</span>';
751 $parameters = array(
'socid' => $socid);
752 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
759 print
'<div class="clearboth"></div>';
765 if ($action !=
'edit') {
770 print
'<div class="tabsAction">';
772 $parameters = array();
773 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
775 if (empty($reshook)) {
777 if ($user->hasRight(
'projet',
'creer')) {
778 if (
$object->status == $object::STATUS_VALIDATED ||
$object->status == $object::STATUS_ONGOING) {
779 print
'<a class="butAction classfortooltip reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().
'&withproject='.((int) $withproject).
'" title="'.$langs->trans(
"SetToDraft").
'">'.$langs->trans(
'SetToDraft').
'</a>';
780 } elseif (
$object->status == $object::STATUS_DRAFT) {
781 print
'<a class="butAction reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'&withproject='.((int) $withproject).
'">'.$langs->trans(
'Validate').
'</a>';
782 } elseif (
$object->status == $object::STATUS_CLOSED) {
784 print
'<a class="butAction reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().
'&withproject='.((int) $withproject).
'">'.$langs->trans(
'ReOpen').
'</a>';
787 print
'<a class="butAction reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'&withproject='.((int) $withproject).
'">'.$langs->trans(
'Modify').
'</a>';
790 if (
$object->status != $object::STATUS_CLOSED) {
791 print
'<a class="butAction classfortooltip reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_close&confirm=yes&token='.
newToken().
'&withproject='.((int) $withproject).
'" title="'.$langs->trans(
"Close").
'">'.$langs->trans(
'Close').
'</a>';
794 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=clone&token='.
newToken().
'&withproject='.((
int) $withproject),
'',
true, array(
'attr' => array(
'class' =>
'reposition')));
796 print
'<a class="butActionDelete classfortooltip reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=merge&token='.
newToken().
'&withproject='.((int) $withproject).
'" title="'.$langs->trans(
"MergeTasks").
'">'.$langs->trans(
'Merge').
'</a>';
798 print
'<a class="butActionRefused classfortooltip reposition" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
'Modify').
'</a>';
802 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
803 if ($permissiontodelete) {
805 print dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'&withproject='.((
int) $withproject),
'delete', $permissiontodelete, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
807 print dolGetButtonAction($langs->trans(
"TaskHasChild"), $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'&withproject='.((
int) $withproject),
'delete', -1, array(
'attr' => array(
'class' =>
'reposition')));
810 print dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'&withproject='.((
int) $withproject),
'delete', $permissiontodelete, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
816 print
'<div class="fichecenter"><div class="fichehalfleft">';
817 print
'<a name="builddoc"></a>';
823 $filedir =
$conf->project->multidir_output[
$object->entity ??
$conf->entity].
"/".$subdir;
824 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
825 $genallowed = ($user->hasRight(
'projet',
'lire'));
826 $delallowed = ($user->hasRight(
'projet',
'creer'));
828 print $formfile->showdocuments(
'project_task', $subdir, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
831 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'project_task'), 1);
832 $linktoelem = $tmparray[
'linktoelem'];
833 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
834 print $htmltoenteralink;
836 $compatibleImportElementsList = array();
837 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
839 print
'</div><div class="fichehalfright">';
842 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
844 $formactions->showactions($object,
'project_task', 0, 1,
'', 10,
'withproject='.$withproject);
846 print
'</div></div>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class to manage projects.
const STATUS_VALIDATED
Validated status (To do).
const STATUS_DRAFT
Draft status.
const STATUS_CLOSED
Finished status.
Class to manage translations.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
task_prepare_head($object)
Prepare array with list of tabs.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.