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';
project_prepare_head(Project $project, $moreparam= '')
Prepare array with list of tabs.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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 ...
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.