28require
"../../main.inc.php";
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
48$langs->loadLangs(array(
'projects',
'companies'));
52$ref =
GETPOST(
"ref",
'alpha', 1);
53$objectref =
GETPOST(
"taskref",
'alpha');
54$action =
GETPOST(
'action',
'aZ09');
55$confirm =
GETPOST(
'confirm',
'alpha');
57$project_ref =
GETPOST(
'project_ref',
'alpha');
59$mode =
GETPOST(
'mode',
'alpha');
62$hookmanager->initHooks(array(
'projecttaskcommentcard',
'globalcard'));
66$projectstatic =
new Project($db);
69$extrafields->fetch_name_optionals_label(
$object->table_element);
72include DOL_DOCUMENT_ROOT.
'/core/actions_comments.inc.php';
77if (!empty($project_ref) && !empty($withproject)) {
78 if ($projectstatic->fetch(0, $project_ref) > 0) {
79 $objectsarray =
$object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
80 if (count($objectsarray) > 0) {
81 $id = $objectsarray[0]->id;
83 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ?
'' :
'&mode='.$mode));
107llxHeader(
'', $langs->trans(
"CommentPage"),
'',
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-task_comment');
109$form =
new Form($db);
113if ($id > 0 || !empty($ref)) {
114 if (
$object->fetch($id, $ref) > 0) {
115 $result =
$object->fetch_optionals();
117 $result =
$object->fetchComments();
122 $result = $projectstatic->fetch(
$object->fk_project);
123 if (!empty($projectstatic->socid)) {
124 $projectstatic->fetch_thirdparty();
126 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
127 $projectstatic->fetchComments();
130 $object->project = clone $projectstatic;
132 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
134 if (!empty($withproject)) {
138 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
140 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
144 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
146 $morehtmlref =
'<div class="refidno">';
148 $morehtmlref .= $projectstatic->title;
150 if ($projectstatic->thirdparty->id > 0) {
151 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
153 $morehtmlref .=
'</div>';
156 if (!$user->hasRight(
'projet',
'all',
'lire')) {
157 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
158 $projectstatic->next_prev_filter =
"rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
161 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
163 print
'<div class="fichecenter">';
164 print
'<div class="fichehalfleft">';
165 print
'<div class="underbanner clearboth"></div>';
167 print
'<table class="border centpercent">';
171 print
'<tr><td class="tdtop">';
172 print $langs->trans(
"Usage");
176 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
177 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
178 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
182 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
183 $htmltext = $langs->trans(
"ProjectFollowTasks");
184 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
188 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"' :
'')).
'"> ';
189 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
190 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
193 if (isModEnabled(
'eventorganization')) {
194 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"' :
'')).
'"> ';
195 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
196 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
202 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
203 if ($projectstatic->public) {
204 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
205 print $langs->trans(
'SharedProject');
207 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
208 print $langs->trans(
'PrivateProject');
215 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
216 $code =
dol_getIdFromCode($db, $projectstatic->opp_status,
'c_lead_status',
'rowid',
'code');
218 print $langs->trans(
"OppStatus".$code);
223 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
224 if (strcmp($projectstatic->opp_percent,
'')) {
225 print
price($projectstatic->opp_percent, 0, $langs, 1, 0).
' %';
230 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
231 if (strcmp($projectstatic->opp_amount,
'')) {
232 print
price($projectstatic->opp_amount, 0, $langs, 1, 0, -1,
$conf->currency);
233 if (strcmp($projectstatic->opp_percent,
'')) {
234 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>';
241 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
242 if (strcmp($projectstatic->budget_amount,
'')) {
243 print
price($projectstatic->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency);
248 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
250 print($start ? $start :
'?');
253 print($end ? $end :
'?');
254 if ($projectstatic->hasDelay()) {
266 print
'<div class="fichehalfright">';
267 print
'<div class="underbanner clearboth"></div>';
269 print
'<table class="border centpercent">';
272 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
273 print nl2br($projectstatic->description);
277 if (isModEnabled(
'category')) {
278 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
279 print $form->showCategories($projectstatic->id,
'project', 1);
288 print
'<div class="clearboth"></div>';
300 $param = ($withproject ?
'&withproject=1' :
'');
301 $linkback = $withproject ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'&restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>' :
'';
303 print
dol_get_fiche_head($head,
'task_comment', $langs->trans(
"Task"), -1,
'projecttask');
305 if ($action ==
'delete') {
306 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
GETPOSTINT(
"id").
'&withproject='.$withproject, $langs->trans(
"DeleteATask"), $langs->trans(
"ConfirmDeleteATask"),
"confirm_delete");
309 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
310 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
311 $object->next_prev_filter =
"fk_projet:IN:(".$db->sanitize($projectsListId).
")";
313 $object->next_prev_filter =
"fk_projet:=:".((int) $projectstatic->id);
319 if (empty($withproject)) {
320 $morehtmlref .=
'<div class="refidno">';
321 $morehtmlref .= $langs->trans(
"Project").
': ';
322 $morehtmlref .= $projectstatic->getNomUrl(1);
323 $morehtmlref .=
'<br>';
326 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
327 if (!empty($projectstatic->thirdparty)) {
328 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
330 $morehtmlref .=
'</div>';
333 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
335 print
'<div class="fichecenter">';
337 print
'<div class="underbanner clearboth"></div>';
338 print
'<table class="border centpercent">';
341 print
'<td class="titlefield">'.$langs->trans(
"NbComments").
'</td><td>';
342 print
$object->getNbComments();
347 $parameters = array(
'socid' => $socid);
348 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
358 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.