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((
int)
$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;
136 $progresstouse =
GETPOST(
'progress');
137 if ($progresstouse !==
'' && $progresstouse >= 0) {
138 if ($progresstouse ==
'100') {
139 $object->status = $object::STATUS_CLOSED;
140 } elseif ($progresstouse !=
'0' &&
$object->status != $object::STATUS_CLOSED) {
141 $object->status = $object::STATUS_ONGOING;
146 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
152 $result =
$object->update($user);
165if ($action ==
'confirm_merge' && $confirm ==
'yes' && $user->hasRight(
'projet',
'creer')) {
167 $task_origin =
new Task($db);
169 if ($task_origin_id <= 0) {
170 $langs->load(
'errors');
171 setEventMessages($langs->trans(
'ErrorTaskIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginTask')),
null,
'errors');
173 if (!$error && $task_origin->fetch($task_origin_id) < 1) {
174 setEventMessages($langs->trans(
'ErrorRecordNotFound'),
null,
'errors');
178 $result =
$object->mergeTask($task_origin_id);
183 setEventMessages($langs->trans(
'TaskMergeSuccess'),
null,
'mesgs');
189if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'projet',
'creer')) {
191 $clone_prog =
GETPOST(
'clone_prog') ? 1 : 0;
192 $clone_time =
GETPOST(
'clone_time') ? 1 : 0;
193 $clone_affectation =
GETPOST(
'clone_affectation') ? 1 : 0;
194 $clone_change_dt =
GETPOST(
'clone_change_dt') ? 1 : 0;
195 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
196 $clone_file =
GETPOST(
'clone_file') ? 1 : 0;
197 $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);
202 $newobject =
new Task($db);
203 $newobject->fetch($result);
204 $newobject->fetch_optionals();
205 $newobject->fetch_thirdparty();
211if ($action ==
'confirm_delete' && $confirm ==
"yes" && $user->hasRight(
'projet',
'supprimer')) {
212 $result = $projectstatic->fetch(
$object->fk_project);
213 $projectstatic->fetch_thirdparty();
217 if (
$object->delete($user) > 0) {
218 header(
'Location: '.DOL_URL_ROOT.
'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ?
'&withproject=1' :
''));
226if ($action ==
'confirm_close' && $confirm ==
"yes" && $user->hasRight(
'projet',
'creer')) {
227 $result = $projectstatic->fetch(
$object->fk_project);
228 $projectstatic->fetch_thirdparty();
238if (!empty($project_ref) && !empty($withproject)) {
239 if ($projectstatic->fetch(0, $project_ref) > 0) {
240 $tasksarray =
$object->getTasksArray(
null,
null, $projectstatic->id, $socid, 0);
241 if (count($tasksarray) > 0) {
242 $id = $tasksarray[0]->id;
244 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
250if ($action ==
'builddoc' && $user->hasRight(
'projet',
'creer')) {
256 $outputlangs = $langs;
257 if (
GETPOST(
'lang_id',
'aZ09')) {
259 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
261 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs);
269if ($action ==
'remove_file' && $user->hasRight(
'projet',
'creer')) {
270 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
272 $langs->load(
"other");
278 setEventMessages($langs->trans(
"FileWasRemoved",
GETPOST(
'file')),
null,
'mesgs');
280 setEventMessages($langs->trans(
"ErrorFailToDeleteFile",
GETPOST(
'file')),
null,
'errors');
285if ($action ==
'reopen' && $user->hasRight(
'projet',
'creer')) {
288 setEventMessages($langs->trans(
"TaskBackToDraft"),
null,
'mesgs');
296if ($action ==
'valid' && $user->hasRight(
'projet',
'creer')) {
299 setEventMessages($langs->trans(
"TaskValidated"),
null,
'mesgs');
311$form =
new Form($db);
317if (!empty($withproject)) {
318 $title .=
' | ' . $langs->trans(
"Project") . (!empty($projectstatic->ref) ?
': '.$projectstatic->ref :
'') ;
322llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-task');
325if ($id > 0 || !empty($ref)) {
326 $res =
$object->fetch_optionals();
331 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
332 $projectstatic->fetchComments();
334 if (!empty($projectstatic->socid)) {
335 $projectstatic->fetch_thirdparty();
338 $object->project = clone $projectstatic;
342 if (!empty($withproject)) {
346 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'), 0,
'',
'');
348 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
352 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
354 $morehtmlref =
'<div class="refidno">';
356 $morehtmlref .= $projectstatic->title;
358 if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
359 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
361 $morehtmlref .=
'</div>';
364 if (!$user->hasRight(
'projet',
'all',
'lire')) {
365 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
366 $projectstatic->next_prev_filter =
"rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
369 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
371 print
'<div class="fichecenter">';
372 print
'<div class="fichehalfleft">';
373 print
'<div class="underbanner clearboth"></div>';
375 print
'<table class="border tableforfield centpercent">';
379 print
'<tr><td class="tdtop">';
380 print $langs->trans(
"Usage");
384 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
385 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
386 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
390 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
391 $htmltext = $langs->trans(
"ProjectFollowTasks");
392 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
396 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"' :
'')).
'"> ';
397 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
398 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
402 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"' :
'')).
'"> ';
403 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
404 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
410 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
411 if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount,
'')) {
412 print
'<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
417 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
419 print($start ? $start :
'?');
422 print($end ? $end :
'?');
423 if ($projectstatic->hasDelay()) {
424 print img_warning(
"Late");
429 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
430 if ($projectstatic->public) {
431 print img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
432 print $langs->trans(
'SharedProject');
434 print img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
435 print $langs->trans(
'PrivateProject');
443 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
450 print
'<div class="fichehalfright">';
451 print
'<div class="underbanner clearboth"></div>';
453 print
'<table class="border tableforfield centpercent">';
457 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
458 print $form->showCategories($projectstatic->id,
'project', 1);
463 print
'<tr><td class="titlefield'.($projectstatic->description ?
' noborderbottom' :
'').
'" colspan="2">'.$langs->trans(
"Description").
'</td></tr>';
464 if ($projectstatic->description) {
465 print
'<tr><td class="nottitleforfield" colspan="2">';
466 print
'<div class="longmessagecut">';
467 print dolPrintHTML($projectstatic->description);
477 print
'<div class="clearboth"></div>';
492 if ($action ==
'edit' && $user->hasRight(
'projet',
'creer')) {
493 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
494 print
'<input type="hidden" name="token" value="'.newToken().
'">';
495 print
'<input type="hidden" name="action" value="update">';
496 print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
497 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
499 print
dol_get_fiche_head($head,
'task_task', $langs->trans(
"Task"), 0,
'projecttask', 0,
'',
'');
501 $param = (
GETPOST(
'withproject') ?
'&withproject=1' :
'');
502 $linkback =
GETPOST(
'withproject') ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'">'.$langs->trans(
"BackToList").
'</a>' :
'';
504 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
505 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
506 $object->next_prev_filter =
"fk_projet:IN:".$db->sanitize($projectsListId);
508 $object->next_prev_filter =
"fk_projet:=:".((int) $projectstatic->id);
511 print
'<table class="border centpercent">';
514 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
515 print
'<td><input class="minwidth100" name="taskref" value="'.dolPrintHTMLForAttribute(
$object->ref).
'"></td></tr>';
518 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
519 print
'<td><input class="minwidth500" name="label" value="'.dolPrintHTMLForAttribute(
$object->label).
'"></td></tr>';
522 if (empty($withproject)) {
523 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
524 print $projectstatic->getNomUrl(1);
528 print
'<td>'.$langs->trans(
"ThirdParty").
'</td><td>';
529 if (!empty($projectstatic->thirdparty->id)) {
530 print $projectstatic->thirdparty->getNomUrl(1);
538 print
'<tr><td>'.$langs->trans(
"ChildOfProjectTask").
'</td><td>';
539 print img_picto(
'',
'projecttask');
540 $formother->selectProjectTasks(
$object->fk_task_parent, $projectstatic->id,
'task_parent', ($user->admin ? 0 : 1), 0, 0, 0,
$object->id,
'',
'minwidth100 widthcentpercentminusxx maxwidth500');
544 print
'<tr><td>'.$langs->trans(
"DateStart").
'</td><td>';
545 print $form->selectDate(
$object->date_start,
'date_start', 1, 1, 0,
'', 1, 0);
549 print
'<tr><td>'.$langs->trans(
"Deadline").
'</td><td>';
550 print $form->selectDate(
$object->date_end ?
$object->date_end : -1,
'date_end', 1, 1, 0,
'', 1, 0);
554 print
'<tr><td>'.$langs->trans(
"PlannedWorkload").
'</td><td>';
555 print $form->select_duration(
'planned_workload',
$object->planned_workload, 0,
'text');
559 print
'<tr><td>'.$langs->trans(
"ProgressDeclared").
'</td><td>';
560 print $formother->select_percent(
$object->progress,
'progress', 0, 5, 0, 100, 1);
564 print
'<tr><td>'.$langs->trans(
"Billable").
'</td><td>';
565 print $form->selectyesno(
'billable',
$object->billable);
570 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
574 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
576 $doleditor =
new DolEditor(
'description',
$object->description,
'', 80,
'dolibarr_details',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), $nbrows,
'90%');
577 print $doleditor->Create();
582 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
583 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>';
587 $parameters = array();
588 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
589 print $hookmanager->resPrint;
590 if (empty($reshook)) {
591 print
$object->showOptionals($extrafields,
'edit');
598 print $form->buttonsSaveCancel(
"Modify");
605 $param = ($withproject ?
'&withproject=1' :
'');
606 $linkback = $withproject ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'&restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>' :
'';
608 print
dol_get_fiche_head($head,
'task_task', $langs->trans(
"Task"), -1,
'projecttask', 0,
'',
'reposition', 0,
'', 1);
610 if ($action ==
'clone') {
611 $formquestion = array(
612 'text' => $langs->trans(
"ConfirmClone"),
614 0 => array(
'type' =>
'checkbox',
'name' =>
'clone_change_dt',
'label' => $langs->trans(
"CloneChanges"),
'value' =>
true),
615 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_affectation',
'label' => $langs->trans(
"CloneAffectation"),
'value' =>
true),
616 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_prog',
'label' => $langs->trans(
"CloneProgression"),
'value' =>
true),
617 3 => array(
'type' =>
'checkbox',
'name' =>
'clone_time',
'label' => $langs->trans(
"CloneTimes"),
'value' =>
true),
618 4 => array(
'type' =>
'checkbox',
'name' =>
'clone_file',
'label' => $langs->trans(
"CloneFile"),
'value' =>
true),
621 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneTask"),
"confirm_clone", $formquestion,
'', 1, 0, 600);
624 if ($action ==
'close') {
625 $formquestion = array(
626 'text' => $langs->trans(
"ConfirmClosed"),
628 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"ToClose"), $langs->trans(
"ConfirmCloseTask"),
"confirm_close", $formquestion,
'', 1, 0, 600);
632 if ($action ==
'merge') {
633 $formquestion = array(
635 'name' =>
'task_origin',
636 'label' => $langs->trans(
'MergeOriginTask'),
638 'value' => $formproject->selectTasks(-1, 0,
'task_origin', 24, 0, $langs->trans(
'SelectTask'), 0, 0, 0,
'maxwidth500 minwidth200',
'',
'',
null, 1)
641 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);
644 if ($action ==
'delete') {
645 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
GETPOSTINT(
"id").
'&withproject='.$withproject, $langs->trans(
"DeleteATask"), $langs->trans(
"ConfirmDeleteATask"),
"confirm_delete");
648 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
649 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
650 $object->next_prev_filter =
"fk_projet:IN:".$db->sanitize($projectsListId);
652 $object->next_prev_filter =
"fk_projet:=:".((int) $projectstatic->id);
658 if (empty($withproject)) {
659 $morehtmlref .=
'<div class="refidno">';
660 $morehtmlref .= $langs->trans(
"Project").
': ';
661 $morehtmlref .= $projectstatic->getNomUrl(1);
662 $morehtmlref .=
'<br>';
665 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
666 if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
667 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
669 $morehtmlref .=
'</div>';
672 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
674 print
'<div class="fichecenter">';
675 print
'<div class="fichehalfleft">';
677 print
'<div class="underbanner clearboth"></div>';
678 print
'<table class="border centpercent tableforfield">';
681 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"ChildOfTask").
'</td><td>';
682 if (
$object->fk_task_parent > 0) {
683 $tasktmp =
new Task($db);
684 $tasktmp->fetch(
$object->fk_task_parent);
685 print $tasktmp->getNomUrl(1);
690 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"Deadline").
'</td><td colspan="3">';
692 print($start ? $start :
'?');
695 print($end ? $end :
'?');
697 print img_warning(
"Late");
702 print
'<tr><td>'.$langs->trans(
"PlannedWorkload").
'</td><td colspan="3">';
703 if (
$object->planned_workload !=
'') {
709 print
'<td class="tdtop">'.$langs->trans(
"Description").
'</td><td colspan="3">';
716 print
'<div class="fichehalfright">';
718 print
'<div class="underbanner clearboth"></div>';
719 print
'<table class="border centpercent tableforfield">';
722 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"ProgressDeclared").
'</td><td colspan="3">';
729 print
'<tr><td>'.$langs->trans(
"ProgressCalculated").
'</td><td colspan="3">';
730 if (
$object->planned_workload !=
'') {
731 $tmparray =
$object->getSummaryOfTimeSpent();
732 if ($tmparray[
'total_duration'] > 0 && !empty(
$object->planned_workload)) {
733 print round($tmparray[
'total_duration'] /
$object->planned_workload * 100, 2).
' %';
738 print
'<span class="opacitymedium">'.$langs->trans(
"WorkloadNotDefined").
'</span>';
743 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
744 if (!is_null(
$object->budget_amount) && strcmp((
string)
$object->budget_amount,
'')) {
745 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
750 print
'<tr><td>'.$langs->trans(
"Billable").
'</td><td>';
751 print
'<span>'.($object->billable ? $langs->trans(
'Yes') : $langs->trans(
'No')).
'</span>';
757 $parameters = array(
'socid' => $socid);
758 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
765 print
'<div class="clearboth"></div>';
771 if ($action !=
'edit') {
776 print
'<div class="tabsAction">';
778 $parameters = array();
779 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
781 if (empty($reshook)) {
783 if ($user->hasRight(
'projet',
'creer')) {
784 if (
$object->status == $object::STATUS_VALIDATED ||
$object->status == $object::STATUS_ONGOING) {
785 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>';
786 } elseif (
$object->status == $object::STATUS_DRAFT) {
787 print
'<a class="butAction reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'&withproject='.((int) $withproject).
'">'.$langs->trans(
'Validate').
'</a>';
788 } elseif (
$object->status == $object::STATUS_CLOSED) {
790 print
'<a class="butAction reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().
'&withproject='.((int) $withproject).
'">'.$langs->trans(
'ReOpen').
'</a>';
793 print
'<a class="butAction reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'&withproject='.((int) $withproject).
'">'.$langs->trans(
'Modify').
'</a>';
796 if (
$object->status != $object::STATUS_CLOSED) {
797 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>';
800 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')));
802 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>';
804 print
'<a class="butActionRefused classfortooltip reposition" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
'Modify').
'</a>';
808 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
809 if ($permissiontodelete) {
811 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";
813 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')));
816 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";
822 print
'<div class="fichecenter"><div class="fichehalfleft">';
823 print
'<a name="builddoc"></a>';
829 $filedir =
$conf->project->multidir_output[
$object->entity ??
$conf->entity].
"/".$subdir;
830 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
831 $genallowed = ($user->hasRight(
'projet',
'lire'));
832 $delallowed = ($user->hasRight(
'projet',
'creer'));
834 print $formfile->showdocuments(
'project_task', $subdir, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
837 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'project_task'), 1);
838 $linktoelem = $tmparray[
'linktoelem'];
839 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
840 print $htmltoenteralink;
842 $compatibleImportElementsList = array();
843 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
845 print
'</div><div class="fichehalfright">';
848 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
850 $formactions->showactions($object,
'project_task', 0, 1,
'', 10,
'withproject='.$withproject);
852 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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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, $currencycode='')
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.