26require
"../../main.inc.php";
27require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35require_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) :
'');
51$hookmanager->initHooks(array(
'projecttaskcommentcard',
'globalcard'));
53$object =
new Task($db);
55$projectstatic =
new Project($db);
58$extrafields->fetch_name_optionals_label($object->table_element);
61include DOL_DOCUMENT_ROOT.
'/core/actions_comments.inc.php';
64if (!empty($project_ref) && !empty($withproject)) {
65 if ($projectstatic->fetch(
'', $project_ref) > 0) {
66 $objectsarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
67 if (count($objectsarray) > 0) {
68 $id = $objectsarray[0]->id;
70 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
77 $object->fetch($id, $ref);
83restrictedArea($user,
'projet', $object->fk_project,
'projet&project');
91llxHeader(
'', $langs->trans(
"CommentPage"));
97if ($id > 0 || !empty($ref)) {
98 if ($object->fetch($id, $ref) > 0) {
99 $result = $object->fetch_optionals();
101 $result = $object->fetchComments();
106 $result = $projectstatic->fetch($object->fk_project);
107 if (!empty($projectstatic->socid)) {
108 $projectstatic->fetch_thirdparty();
110 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
111 $projectstatic->fetchComments();
114 $object->project = clone $projectstatic;
116 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
118 if (!empty($withproject)) {
122 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
124 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
128 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
130 $morehtmlref =
'<div class="refidno">';
132 $morehtmlref .= $projectstatic->title;
134 if ($projectstatic->thirdparty->id > 0) {
135 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
137 $morehtmlref .=
'</div>';
140 if (empty($user->rights->projet->all->lire)) {
141 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
142 $projectstatic->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
145 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
147 print
'<div class="fichecenter">';
148 print
'<div class="fichehalfleft">';
149 print
'<div class="underbanner clearboth"></div>';
151 print
'<table class="border centpercent">';
154 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
155 print
'<tr><td class="tdtop">';
156 print $langs->trans(
"Usage");
159 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
160 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
161 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
162 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
165 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
166 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
167 $htmltext = $langs->trans(
"ProjectFollowTasks");
168 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
171 if (empty($conf->global->PROJECT_HIDE_TASKS) && !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);
177 if (isModEnabled(
'eventorganization')) {
178 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"' :
'')).
'"> ';
179 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
180 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
186 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
187 if ($projectstatic->public) {
188 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
189 print $langs->trans(
'SharedProject');
191 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
192 print $langs->trans(
'PrivateProject');
197 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
199 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
200 $code =
dol_getIdFromCode($db, $projectstatic->opp_status,
'c_lead_status',
'rowid',
'code');
202 print $langs->trans(
"OppStatus".$code);
207 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
208 if (strcmp($projectstatic->opp_percent,
'')) {
209 print
price($projectstatic->opp_percent, 0, $langs, 1, 0).
' %';
214 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
215 if (strcmp($projectstatic->opp_amount,
'')) {
216 print
price($projectstatic->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
217 if (strcmp($projectstatic->opp_percent,
'')) {
218 print
' <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"Weighted").
'</span>: <span class="amount">'.
price($projectstatic->opp_amount * $projectstatic->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).
'</span></span>';
225 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
226 if (strcmp($projectstatic->budget_amount,
'')) {
227 print
price($projectstatic->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
232 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
234 print ($start ? $start :
'?');
237 print ($end ? $end :
'?');
238 if ($projectstatic->hasDelay()) {
250 print
'<div class="fichehalfright">';
251 print
'<div class="underbanner clearboth"></div>';
253 print
'<table class="border centpercent">';
256 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
257 print nl2br($projectstatic->description);
261 if (isModEnabled(
'categorie')) {
262 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
263 print $form->showCategories($projectstatic->id,
'project', 1);
272 print
'<div class="clearboth"></div>';
284 $param = ($withproject ?
'&withproject=1' :
'');
285 $linkback = $withproject ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'&restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>' :
'';
287 print
dol_get_fiche_head($head,
'task_comment', $langs->trans(
"Task"), -1,
'projecttask');
289 if ($action ==
'delete') {
290 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
GETPOST(
"id",
"int").
'&withproject='.$withproject, $langs->trans(
"DeleteATask"), $langs->trans(
"ConfirmDeleteATask"),
"confirm_delete");
293 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
294 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
295 $object->next_prev_filter =
"fk_projet IN (".$db->sanitize($projectsListId).
")";
297 $object->next_prev_filter =
"fk_projet = ".((int) $projectstatic->id);
303 if (empty($withproject)) {
304 $morehtmlref .=
'<div class="refidno">';
305 $morehtmlref .= $langs->trans(
"Project").
': ';
306 $morehtmlref .= $projectstatic->getNomUrl(1);
307 $morehtmlref .=
'<br>';
310 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
311 if (!empty($projectstatic->thirdparty)) {
312 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
314 $morehtmlref .=
'</div>';
317 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
319 print
'<div class="fichecenter">';
321 print
'<div class="underbanner clearboth"></div>';
322 print
'<table class="border centpercent">';
325 print
'<td class="titlefield">'.$langs->trans(
"NbComments").
'</td><td>';
326 print $object->getNbComments();
331 $parameters = array(
'socid'=>$socid);
332 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
342 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_comment.tpl.php';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage projects.
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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, $mode=0)
Check permissions of a user to show a page and an object.