26 require
"../../main.inc.php";
27 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
38 $langs->loadLangs(array(
'projects',
'companies'));
41 $idcomment =
GETPOST(
'idcomment',
'int');
42 $ref =
GETPOST(
"ref",
'alpha', 1);
43 $objectref =
GETPOST(
"taskref",
'alpha');
44 $action =
GETPOST(
'action',
'aZ09');
45 $confirm =
GETPOST(
'confirm',
'alpha');
46 $withproject =
GETPOST(
'withproject',
'int');
47 $project_ref =
GETPOST(
'project_ref',
'alpha');
48 $planned_workload = ((
GETPOST(
'planned_workloadhour',
'int') !=
'' ||
GETPOST(
'planned_workloadmin',
'int') !=
'') ? (
GETPOST(
'planned_workloadhour',
'int') > 0 ?
GETPOST(
'planned_workloadhour',
'int') * 3600 : 0) + (
GETPOST(
'planned_workloadmin',
'int') > 0 ?
GETPOST(
'planned_workloadmin',
'int') * 60 : 0) :
'');
56 $hookmanager->initHooks(array(
'projecttaskcommentcard',
'globalcard'));
58 $object =
new Task($db);
60 $projectstatic =
new Project($db);
63 $extrafields->fetch_name_optionals_label($object->table_element);
66 include DOL_DOCUMENT_ROOT.
'/core/actions_comments.inc.php';
69 if (!empty($project_ref) && !empty($withproject))
71 if ($projectstatic->fetch(
'', $project_ref) > 0)
73 $objectsarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
74 if (count($objectsarray) > 0)
76 $id = $objectsarray[0]->id;
78 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
88 llxHeader(
'', $langs->trans(
"CommentPage"));
90 $form =
new Form($db);
94 if ($id > 0 || !empty($ref))
96 if ($object->fetch($id, $ref) > 0)
98 $result = $object->fetch_optionals();
100 $result = $object->fetchComments();
105 $result = $projectstatic->fetch($object->fk_project);
106 if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
107 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
109 $object->project = clone $projectstatic;
111 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
113 if (!empty($withproject))
118 print dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
120 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
124 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
126 $morehtmlref =
'<div class="refidno">';
128 $morehtmlref .= $projectstatic->title;
130 if ($projectstatic->thirdparty->id > 0)
132 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$projectstatic->thirdparty->getNomUrl(1,
'project');
134 $morehtmlref .=
'</div>';
137 if (!$user->rights->projet->all->lire)
139 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
140 $projectstatic->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
143 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
145 print '<div class="fichecenter">';
146 print '<div class="fichehalfleft">';
147 print '<div class="underbanner clearboth"></div>';
149 print '<table class="border centpercent">';
152 print '<tr><td class="tdtop">';
153 print $langs->trans(
"Usage");
156 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
158 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
159 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
160 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
163 if (empty($conf->global->PROJECT_HIDE_TASKS))
165 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
166 $htmltext = $langs->trans(
"ProjectFollowTasks");
167 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
170 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
172 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"' :
'')).
'"> ';
173 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
174 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
180 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
181 if ($projectstatic->public)
print $langs->trans(
'SharedProject');
182 else print $langs->trans(
'PrivateProject');
186 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity))
189 print '<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
190 $code =
dol_getIdFromCode($db, $projectstatic->opp_status,
'c_lead_status',
'rowid',
'code');
191 if ($code)
print $langs->trans(
"OppStatus".$code);
195 print '<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
196 if (strcmp($object->opp_percent,
''))
print price($projectstatic->opp_percent, 0, $langs, 1, 0).
' %';
200 print '<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
205 if (strcmp($projectstatic->opp_amount,
''))
print price($projectstatic->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
210 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
212 print ($start ? $start :
'?');
215 print ($end ? $end :
'?');
220 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
221 if (strcmp($projectstatic->budget_amount,
''))
print price($projectstatic->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
231 print '<div class="fichehalfright">';
232 print '<div class="ficheaddleft">';
233 print '<div class="underbanner clearboth"></div>';
235 print '<table class="border centpercent">';
238 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
239 print nl2br($projectstatic->description);
243 if ($conf->categorie->enabled) {
244 print '<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
245 print $form->showCategories($projectstatic->id,
'project', 1);
255 print '<div class="clearboth"></div>';
267 $param = ($withproject ?
'&withproject=1' :
'');
268 $linkback = $withproject ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'&restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>' :
'';
272 if ($action ==
'delete')
274 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$_GET[
"id"].
'&withproject='.$withproject, $langs->trans(
"DeleteATask"), $langs->trans(
"ConfirmDeleteATask"),
"confirm_delete");
277 if (!
GETPOST(
'withproject') || empty($projectstatic->id))
279 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
280 $object->next_prev_filter =
" fk_projet in (".$projectsListId.
")";
281 }
else $object->next_prev_filter =
" fk_projet = ".$projectstatic->id;
286 if (empty($withproject))
288 $morehtmlref .=
'<div class="refidno">';
289 $morehtmlref .= $langs->trans(
"Project").
': ';
290 $morehtmlref .= $projectstatic->getNomUrl(1);
291 $morehtmlref .=
'<br>';
294 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
295 if (!empty($projectstatic->thirdparty)) {
296 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
298 $morehtmlref .=
'</div>';
301 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
303 print '<div class="fichecenter">';
305 print '<div class="underbanner clearboth"></div>';
306 print '<table class="border centpercent">';
309 print '<td class="titlefield">'.$langs->trans(
"NbComments").
'</td><td>';
310 print $object->getNbComments();
315 $parameters = array(
'socid'=>$socid);
316 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
326 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_comment.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
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 ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
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_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.