27require
"../../main.inc.php";
28require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
39$langs->loadLangs(array(
'projects',
'companies'));
43$ref =
GETPOST(
"ref",
'alpha', 1);
44$objectref =
GETPOST(
"taskref",
'alpha');
45$action =
GETPOST(
'action',
'aZ09');
46$confirm =
GETPOST(
'confirm',
'alpha');
48$project_ref =
GETPOST(
'project_ref',
'alpha');
52$hookmanager->initHooks(array(
'projecttaskcommentcard',
'globalcard'));
56$projectstatic =
new Project($db);
59$extrafields->fetch_name_optionals_label(
$object->table_element);
62include DOL_DOCUMENT_ROOT.
'/core/actions_comments.inc.php';
65if (!empty($project_ref) && !empty($withproject)) {
66 if ($projectstatic->fetch(
'', $project_ref) > 0) {
67 $objectsarray =
$object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
68 if (count($objectsarray) > 0) {
69 $id = $objectsarray[0]->id;
71 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
92llxHeader(
'', $langs->trans(
"CommentPage"));
98if ($id > 0 || !empty($ref)) {
99 if (
$object->fetch($id, $ref) > 0) {
100 $result =
$object->fetch_optionals();
102 $result =
$object->fetchComments();
107 $result = $projectstatic->fetch(
$object->fk_project);
108 if (!empty($projectstatic->socid)) {
109 $projectstatic->fetch_thirdparty();
111 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
112 $projectstatic->fetchComments();
115 $object->project = clone $projectstatic;
117 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
119 if (!empty($withproject)) {
123 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
125 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
129 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
131 $morehtmlref =
'<div class="refidno">';
133 $morehtmlref .= $projectstatic->title;
135 if ($projectstatic->thirdparty->id > 0) {
136 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
138 $morehtmlref .=
'</div>';
141 if (!$user->hasRight(
'projet',
'all',
'lire')) {
142 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
143 $projectstatic->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
146 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
148 print
'<div class="fichecenter">';
149 print
'<div class="fichehalfleft">';
150 print
'<div class="underbanner clearboth"></div>';
152 print
'<table class="border centpercent">';
156 print
'<tr><td class="tdtop">';
157 print $langs->trans(
"Usage");
161 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
162 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
163 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
167 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
168 $htmltext = $langs->trans(
"ProjectFollowTasks");
169 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
173 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"' :
'')).
'"> ';
174 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
175 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
178 if (isModEnabled(
'eventorganization')) {
179 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"' :
'')).
'"> ';
180 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
181 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
187 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
188 if ($projectstatic->public) {
189 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
190 print $langs->trans(
'SharedProject');
192 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
193 print $langs->trans(
'PrivateProject');
200 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
201 $code =
dol_getIdFromCode($db, $projectstatic->opp_status,
'c_lead_status',
'rowid',
'code');
203 print $langs->trans(
"OppStatus".$code);
208 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
209 if (strcmp($projectstatic->opp_percent,
'')) {
210 print
price($projectstatic->opp_percent, 0, $langs, 1, 0).
' %';
215 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
216 if (strcmp($projectstatic->opp_amount,
'')) {
217 print
price($projectstatic->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
218 if (strcmp($projectstatic->opp_percent,
'')) {
219 print
' <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"OpportunityWeightedAmountShort").
'</span>: <span class="amount">'.
price($projectstatic->opp_amount * $projectstatic->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).
'</span></span>';
226 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
227 if (strcmp($projectstatic->budget_amount,
'')) {
228 print
price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
233 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
235 print($start ? $start :
'?');
238 print($end ? $end :
'?');
239 if ($projectstatic->hasDelay()) {
251 print
'<div class="fichehalfright">';
252 print
'<div class="underbanner clearboth"></div>';
254 print
'<table class="border centpercent">';
257 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
258 print nl2br($projectstatic->description);
262 if (isModEnabled(
'category')) {
263 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
264 print $form->showCategories($projectstatic->id,
'project', 1);
273 print
'<div class="clearboth"></div>';
285 $param = ($withproject ?
'&withproject=1' :
'');
286 $linkback = $withproject ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'&restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>' :
'';
288 print
dol_get_fiche_head($head,
'task_comment', $langs->trans(
"Task"), -1,
'projecttask');
290 if ($action ==
'delete') {
291 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
GETPOSTINT(
"id").
'&withproject='.$withproject, $langs->trans(
"DeleteATask"), $langs->trans(
"ConfirmDeleteATask"),
"confirm_delete");
294 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
295 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
296 $object->next_prev_filter =
"fk_projet IN (".$db->sanitize($projectsListId).
")";
298 $object->next_prev_filter =
"fk_projet = ".((int) $projectstatic->id);
304 if (empty($withproject)) {
305 $morehtmlref .=
'<div class="refidno">';
306 $morehtmlref .= $langs->trans(
"Project").
': ';
307 $morehtmlref .= $projectstatic->getNomUrl(1);
308 $morehtmlref .=
'<br>';
311 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
312 if (!empty($projectstatic->thirdparty)) {
313 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
315 $morehtmlref .=
'</div>';
318 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
320 print
'<div class="fichecenter">';
322 print
'<div class="underbanner clearboth"></div>';
323 print
'<table class="border centpercent">';
326 print
'<td class="titlefield">'.$langs->trans(
"NbComments").
'</td><td>';
327 print
$object->getNbComments();
332 $parameters = array(
'socid'=>$socid);
333 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
343 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_comment.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.