24 require
"../../main.inc.php";
25 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30 $langs->load(
'projects');
32 $action =
GETPOST(
'action',
'aZ09');
33 $confirm =
GETPOST(
'confirm',
'alpha');
34 $mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
38 $withproject =
GETPOST(
'withproject',
'int');
39 $project_ref =
GETPOST(
'project_ref',
'alpha');
44 if (!$user->rights->projet->lire) {
48 $hookmanager->initHooks(array(
'projettasknote'));
51 $object =
new Task($db);
52 $projectstatic =
new Project($db);
54 if ($id > 0 || !empty($ref)) {
55 if ($object->fetch($id, $ref) > 0) {
56 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object,
'fetchComments') && empty($object->comments)) {
57 $object->fetchComments();
59 $projectstatic->fetch($object->fk_project);
60 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
61 $projectstatic->fetchComments();
63 if (!empty($projectstatic->socid)) {
64 $projectstatic->fetch_thirdparty();
67 $object->project = clone $projectstatic;
75 if (!empty($project_ref) && !empty($withproject)) {
76 if ($projectstatic->fetch(0, $project_ref) > 0) {
77 $tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
78 if (count($tasksarray) > 0) {
79 $id = $tasksarray[0]->id;
82 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
87 if ($id > 0 || $ref) {
88 $object->fetch($id, $ref);
92 restrictedArea($user,
'projet', $object->fk_project,
'projet&project');
94 $permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->creer);
101 $reshook = $hookmanager->executeHooks(
'doActions', array(), $object, $action);
105 if (empty($reshook)) {
106 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
117 $userstatic =
new User($db);
121 if ($object->id > 0) {
122 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
124 if (!empty($withproject)) {
128 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
130 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
133 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
135 $morehtmlref =
'<div class="refidno">';
137 $morehtmlref .= $projectstatic->title;
139 if ($projectstatic->thirdparty->id > 0) {
140 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$projectstatic->thirdparty->getNomUrl(1,
'project');
142 $morehtmlref .=
'</div>';
145 if (empty($user->rights->projet->all->lire)) {
146 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
147 $projectstatic->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
150 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
152 print
'<div class="fichecenter">';
153 print
'<div class="fichehalfleft">';
154 print
'<div class="underbanner clearboth"></div>';
156 print
'<table class="border tableforfield centpercent">';
159 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
160 print
'<tr><td class="tdtop">';
161 print $langs->trans(
"Usage");
164 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
165 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
166 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
167 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
170 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
171 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
172 $htmltext = $langs->trans(
"ProjectFollowTasks");
173 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
176 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
177 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"' :
'')).
'"> ';
178 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
179 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
182 if (!empty($conf->eventorganization->enabled)) {
183 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"' :
'')).
'"> ';
184 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
185 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
191 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
192 if ($projectstatic->public) {
193 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
194 print $langs->trans(
'SharedProject');
196 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
197 print $langs->trans(
'PrivateProject');
202 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
204 print ($start ? $start :
'?');
207 print ($end ? $end :
'?');
208 if ($projectstatic->hasDelay()) {
214 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
215 if (strcmp($projectstatic->budget_amount,
'')) {
216 print
price($projectstatic->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
227 print
'<div class="fichehalfright">';
228 print
'<div class="underbanner clearboth"></div>';
230 print
'<table class="border centpercent tableforfield">';
233 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
234 print nl2br($projectstatic->description);
239 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
240 print
$form->showCategories($projectstatic->id,
'project', 1);
249 print
'<div class="clearboth"></div>';
257 print
dol_get_fiche_head($head,
'task_notes', $langs->trans(
'Task'), -1,
'projecttask', 0,
'',
'reposition');
260 $param = (
GETPOST(
'withproject') ?
'&withproject=1' :
'');
261 $linkback =
GETPOST(
'withproject') ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'">'.$langs->trans(
"BackToList").
'</a>' :
'';
263 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
264 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
265 $object->next_prev_filter =
" fk_projet IN (".$db->sanitize($projectsListId).
")";
267 $object->next_prev_filter =
" fk_projet = ".$projectstatic->id;
273 if (empty($withproject)) {
274 $morehtmlref .=
'<div class="refidno">';
275 $morehtmlref .= $langs->trans(
"Project").
': ';
276 $morehtmlref .= $projectstatic->getNomUrl(1);
277 $morehtmlref .=
'<br>';
280 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
281 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
282 $morehtmlref .=
'</div>';
285 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
287 print
'<div class="fichecenter">';
289 print
'<div class="underbanner clearboth"></div>';
291 $cssclass =
'titlefield';
293 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';