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/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 $id =
GETPOST(
'id',
'intcomma');
39 $mode =
GETPOST(
'mode',
'alpha');
40 $mine = ($mode ==
'mine' ? 1 : 0);
45 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
46 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) {
47 $object->fetchComments();
56 $langs->loadlangs(array(
'users',
'projects'));
72 $userstatic =
new User($db);
73 $companystatic =
new Societe($db);
74 $contactstatic =
new Contact($db);
75 $task =
new Task($db);
77 $arrayofcss = array(
'/includes/jsgantt/jsgantt.css');
79 if (!empty($conf->use_javascript_ajax)) {
81 '/includes/jsgantt/jsgantt.js',
82 '/projet/jsgantt_language.js.php?lang='.$langs->defaultlang
87 $title = $langs->trans(
"Gantt");
88 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
89 $title = ($object->ref ? $object->ref.
' '.$object->name.
' - ' :
'').$langs->trans(
"Gantt");
91 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
95 if (($id > 0 && is_numeric($id)) || !empty($ref)) {
98 $userWrite = $object->restrictedProjectArea($user,
'write');
105 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
107 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
113 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
115 $morehtmlref =
'<div class="refidno">';
117 $morehtmlref .= $object->title;
119 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
120 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
122 $morehtmlref .=
'</div>';
125 if (empty($user->rights->projet->all->lire)) {
126 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
127 $object->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
130 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
133 print
'<div class="fichecenter">';
134 print
'<div class="fichehalfleft">';
135 print
'<div class="underbanner clearboth"></div>';
137 print
'<table class="border tableforfield centpercent">';
140 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
141 print
'<tr><td class="tdtop">';
142 print $langs->trans(
"Usage");
145 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
146 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
147 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
148 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
151 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
152 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
153 $htmltext = $langs->trans(
"ProjectFollowTasks");
154 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
157 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
158 print
'<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
159 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
160 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
164 print
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_organize_event ?
' checked="checked"' :
'')).
'"> ';
165 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
166 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
172 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
173 if ($object->public) {
174 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
175 print $langs->trans(
'SharedProject');
177 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
178 print $langs->trans(
'PrivateProject');
183 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
184 if (strcmp($object->budget_amount,
'')) {
185 print
price($object->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
190 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
192 print ($start ? $start :
'?');
195 print ($end ? $end :
'?');
196 if ($object->hasDelay()) {
203 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
208 print
'<div class="fichehalfright">';
209 print
'<div class="underbanner clearboth"></div>';
211 print
'<table class="border tableforfield centpercent">';
214 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
215 print nl2br($object->description);
220 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
221 print
$form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
230 print
'<div class="clearboth"></div>';
238 $linktocreatetaskParam = array();
239 $linktocreatetaskUserRight =
false;
240 if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
241 if ($object->public || $userWrite > 0) {
242 $linktocreatetaskUserRight =
true;
244 $linktocreatetaskParam[
'attr'][
'title'] = $langs->trans(
"NotOwnerOfProject");
248 $linktocreatetask =
dolGetButtonTitle($langs->trans(
'AddTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?id='.$object->id.
'&action=create'.$param.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$object->id),
'', $linktocreatetaskUserRight, $linktocreatetaskParam);
250 $linktotasks =
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/tasks.php?id='.$object->id,
'', 1, array(
'morecss'=>
'reposition'));
251 $linktotasks .=
dolGetButtonTitle($langs->trans(
'ViewGantt'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/ganttview.php?id='.$object->id.
'&withproject=1',
'', 1, array(
'morecss'=>
'reposition marginleftonly btnTitleSelected'));
254 print
load_fiche_titre($title, $linktotasks.
' '.$linktocreatetask,
'projecttask');
260 $tasksarray = $task->getTasksArray(0, 0, ($object->id ? $object->id : $id), $socid, 0);
267 if (count($tasksarray) > 0) {
270 $dateformat = $langs->trans(
"FormatDateShortJQuery");
271 $datehourformat = $langs->trans(
"FormatDateShortJQuery").
' '.$langs->trans(
"FormatHourShortJQuery");
272 $array_contacts = array();
274 $task_dependencies = array();
276 foreach ($tasksarray as $key => $val) {
277 $task->fetch($val->id,
'');
279 $idparent = ($val->fk_parent ? $val->fk_parent :
'-'.$val->fk_project);
281 $tasks[$taskcursor][
'task_id'] = $val->id;
282 $tasks[$taskcursor][
'task_alternate_id'] = ($taskcursor + 1);
283 $tasks[$taskcursor][
'task_project_id'] = $val->fk_project;
284 $tasks[$taskcursor][
'task_parent'] = $idparent;
286 $tasks[$taskcursor][
'task_is_group'] = 0;
287 $tasks[$taskcursor][
'task_css'] =
'gtaskblue';
288 $tasks[$taskcursor][
'task_position'] = $val->rang;
289 $tasks[$taskcursor][
'task_planned_workload'] = $val->planned_workload;
291 if ($val->fk_parent != 0 && $task->hasChildren() > 0) {
292 $tasks[$taskcursor][
'task_is_group'] = 1;
293 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
295 } elseif ($task->hasChildren() > 0) {
296 $tasks[$taskcursor][
'task_is_group'] = 1;
298 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
301 $tasks[$taskcursor][
'task_milestone'] =
'0';
302 $tasks[$taskcursor][
'task_percent_complete'] = $val->progress;
305 $tasks[$taskcursor][
'task_name'] = $val->ref.
' - '.$val->label;
306 $tasks[$taskcursor][
'task_start_date'] = $val->date_start;
307 $tasks[$taskcursor][
'task_end_date'] = $val->date_end;
308 $tasks[$taskcursor][
'task_color'] =
'b4d1ea';
310 $idofusers = $task->getListContactId(
'internal');
311 $idofcontacts = $task->getListContactId(
'external');
313 if (count($idofusers) > 0) {
314 $s .= $langs->trans(
"Internals").
': ';
316 foreach ($idofusers as $valid) {
317 $userstatic->fetch($valid);
321 $s .= $userstatic->login;
326 if (count($idofcontacts) > 0) {
330 $s .= $langs->trans(
"Externals").
': ';
332 $contactidfound = array();
333 foreach ($idofcontacts as $valid) {
334 if (empty($contactidfound[$valid])) {
335 $res = $contactstatic->fetch($valid);
340 $s .= $contactstatic->getFullName($langs);
341 $contactidfound[$valid] = 1;
350 $tasks[$taskcursor][
'task_resources'] = $s;
352 $tasks[$taskcursor][
'task_resources'] =
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$val->id.
'&withproject=1" title="'.
dol_escape_htmltag($s).
'">'.$langs->trans(
"List").
'</a>';
355 $tasks[$taskcursor][
'note'] = $task->note_public;
360 foreach ($tasks as $tmpkey => $tmptask) {
361 foreach ($tasks as $tmptask2) {
362 if ($tmptask2[
'task_id'] == $tmptask[
'task_parent']) {
363 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tmptask2[
'task_alternate_id'];
367 if (empty($tasks[$tmpkey][
'task_parent_alternate_id'])) {
368 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tasks[$tmpkey][
'task_parent'];
374 if (!empty($conf->use_javascript_ajax)) {
378 $dateformatinput =
'yyyy-mm-dd';
380 $dateformatinput2 =
'standard';
384 $moreforfilter =
'<div class="liste_titre liste_titre_bydiv centpercent">';
386 $moreforfilter .=
'<div class="divsearchfield">';
389 $moreforfilter .=
' ';
390 $moreforfilter .=
'</div>';
392 $moreforfilter .=
'</div>';
394 print $moreforfilter;
396 print
'<div class="div-table-responsive">';
398 print
'<div id="tabs" class="gantt" style="width: 80vw;">'.
"\n";
399 include_once DOL_DOCUMENT_ROOT.
'/projet/ganttchart.inc.php';
404 $langs->load(
"admin");
405 print $langs->trans(
"AvailableOnlyIfJavascriptAndAjaxNotDisabled");
408 print
'<div class="opacitymedium">'.$langs->trans(
"NoTasks").
'</div>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
isModEnabled($module)
Is Dolibarr module enabled.
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.