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 = $_REQUEST[
'mode'] ==
'mine' ? 1 : 0;
38 $withproject =
GETPOST(
'withproject',
'int');
39 $project_ref =
GETPOST(
'project_ref',
'alpha');
47 $object =
new Task($db);
48 $projectstatic =
new Project($db);
50 if ($id > 0 || !empty($ref))
52 if ($object->fetch($id, $ref) > 0)
54 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
55 $projectstatic->fetch($object->fk_project);
56 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
57 if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
59 $object->project = clone $projectstatic;
67 if (!empty($project_ref) && !empty($withproject))
69 if ($projectstatic->fetch(0, $project_ref) > 0)
71 $tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
72 if (count($tasksarray) > 0)
74 $id = $tasksarray[0]->id;
77 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
82 $permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->creer);
89 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
98 $form =
new Form($db);
99 $userstatic =
new User($db);
105 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
107 if (!empty($withproject))
112 print dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
114 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
117 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
119 $morehtmlref =
'<div class="refidno">';
121 $morehtmlref .= $projectstatic->title;
123 if ($projectstatic->thirdparty->id > 0)
125 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$projectstatic->thirdparty->getNomUrl(1,
'project');
127 $morehtmlref .=
'</div>';
130 if (!$user->rights->projet->all->lire)
132 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
133 $projectstatic->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
136 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
138 print '<div class="fichecenter">';
139 print '<div class="fichehalfleft">';
140 print '<div class="underbanner clearboth"></div>';
142 print '<table class="border tableforfield centpercent">';
145 print '<tr><td class="tdtop">';
146 print $langs->trans(
"Usage");
149 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
151 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
152 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
153 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
156 if (empty($conf->global->PROJECT_HIDE_TASKS))
158 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
159 $htmltext = $langs->trans(
"ProjectFollowTasks");
160 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
163 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
165 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"' :
'')).
'"> ';
166 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
167 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
173 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
174 if ($projectstatic->public)
print $langs->trans(
'SharedProject');
175 else print $langs->trans(
'PrivateProject');
179 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
181 print ($start ? $start :
'?');
184 print ($end ? $end :
'?');
189 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
190 if (strcmp($projectstatic->budget_amount,
''))
print price($projectstatic->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
200 print '<div class="fichehalfright">';
201 print '<div class="ficheaddleft">';
202 print '<div class="underbanner clearboth"></div>';
204 print '<table class="border centpercent tableforfield">';
207 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
208 print nl2br($projectstatic->description);
212 if ($conf->categorie->enabled) {
213 print '<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
214 print $form->showCategories($projectstatic->id,
'project', 1);
224 print '<div class="clearboth"></div>';
235 $param = (
GETPOST(
'withproject') ?
'&withproject=1' :
'');
236 $linkback =
GETPOST(
'withproject') ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'">'.$langs->trans(
"BackToList").
'</a>' :
'';
238 if (!
GETPOST(
'withproject') || empty($projectstatic->id))
240 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
241 $object->next_prev_filter =
" fk_projet in (".$projectsListId.
")";
242 }
else $object->next_prev_filter =
" fk_projet = ".$projectstatic->id;
247 if (empty($withproject))
249 $morehtmlref .=
'<div class="refidno">';
250 $morehtmlref .= $langs->trans(
"Project").
': ';
251 $morehtmlref .= $projectstatic->getNomUrl(1);
252 $morehtmlref .=
'<br>';
255 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
256 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
257 $morehtmlref .=
'</div>';
260 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
262 print '<div class="fichecenter">';
264 print '<div class="underbanner clearboth"></div>';
266 $cssclass =
'titlefield';
268 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
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...
Class to manage projects.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
task_prepare_head($object)
Prepare array with list of tabs.