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/lib/date.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39$mode =
GETPOST(
'mode',
'alpha');
40$mine = ($mode ==
'mine' ? 1 : 0);
45include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
46if (
getDolGlobalString(
'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);
77$arrayofcss = array(
'/includes/jsgantt/jsgantt.css');
79if (!empty($conf->use_javascript_ajax)) {
81 '/includes/jsgantt/jsgantt.js',
82 '/projet/jsgantt_language.js.php?lang='.$langs->defaultlang
87$title = $langs->trans(
"Gantt");
88if (
getDolGlobalString(
'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";
93llxHeader(
"", $title, $help_url,
'', 0, 0, $arrayofjs, $arrayofcss);
95if (($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 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
114 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
115 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
116 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
118 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
121 $morehtmlref =
'<div class="refidno">';
123 $morehtmlref .= $object->title;
125 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
126 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
128 $morehtmlref .=
'</div>';
131 if (!$user->hasRight(
'projet',
'all',
'lire')) {
132 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
133 $object->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
136 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
139 print
'<div class="fichecenter">';
140 print
'<div class="fichehalfleft">';
141 print
'<div class="underbanner clearboth"></div>';
143 print
'<table class="border tableforfield centpercent">';
147 print
'<tr><td class="tdtop">';
148 print $langs->trans(
"Usage");
152 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
153 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
154 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
158 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
159 $htmltext = $langs->trans(
"ProjectFollowTasks");
160 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
164 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"' :
'')).
'"> ';
165 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
166 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
169 if (isModEnabled(
'eventorganization')) {
170 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"' :
'')).
'"> ';
171 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
172 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
178 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
179 if ($object->public) {
180 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
181 print $langs->trans(
'SharedProject');
183 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
184 print $langs->trans(
'PrivateProject');
189 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
190 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
191 print
price($object->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
196 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
198 print($start ? $start :
'?');
201 print($end ? $end :
'?');
202 if ($object->hasDelay()) {
209 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
214 print
'<div class="fichehalfright">';
215 print
'<div class="underbanner clearboth"></div>';
217 print
'<table class="border tableforfield centpercent">';
220 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
221 print nl2br($object->description);
225 if (isModEnabled(
'categorie')) {
226 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
227 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
236 print
'<div class="clearboth"></div>';
244$linktocreatetaskParam = array();
245$linktocreatetaskUserRight =
false;
246if ($user->hasRight(
'projet',
'all',
'creer') || $user->hasRight(
'projet',
'creer')) {
247 if ($object->public || $userWrite > 0) {
248 $linktocreatetaskUserRight =
true;
250 $linktocreatetaskParam[
'attr'][
'title'] = $langs->trans(
"NotOwnerOfProject");
254$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);
256$linktotasks =
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/tasks.php?id='.$object->id,
'', 1, array(
'morecss'=>
'reposition'));
257$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'));
260print
load_fiche_titre($title, $linktotasks.
' '.$linktocreatetask,
'projecttask');
266$tasksarray = $task->getTasksArray(0, 0, ($object->id ? $object->id : $id), $socid, 0);
273if (count($tasksarray) > 0) {
276 $dateformat = $langs->trans(
"FormatDateShortJQuery");
277 $datehourformat = $langs->trans(
"FormatDateShortJQuery").
' '.$langs->trans(
"FormatHourShortJQuery");
278 $array_contacts = array();
280 $task_dependencies = array();
282 foreach ($tasksarray as $key => $val) {
283 $task->fetch($val->id,
'');
285 $idparent = ($val->fk_task_parent ? $val->fk_task_parent :
'-'.$val->fk_project);
287 $tasks[$taskcursor][
'task_id'] = $val->id;
288 $tasks[$taskcursor][
'task_alternate_id'] = ($taskcursor + 1);
289 $tasks[$taskcursor][
'task_project_id'] = $val->fk_project;
290 $tasks[$taskcursor][
'task_parent'] = $idparent;
292 $tasks[$taskcursor][
'task_is_group'] = 0;
293 $tasks[$taskcursor][
'task_css'] =
'gtaskblue';
294 $tasks[$taskcursor][
'task_position'] = $val->rang;
295 $tasks[$taskcursor][
'task_planned_workload'] = $val->planned_workload;
297 if ($val->fk_task_parent != 0 && $task->hasChildren() > 0) {
298 $tasks[$taskcursor][
'task_is_group'] = 1;
299 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
301 } elseif ($task->hasChildren() > 0) {
302 $tasks[$taskcursor][
'task_is_group'] = 1;
304 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
307 $tasks[$taskcursor][
'task_milestone'] =
'0';
308 $tasks[$taskcursor][
'task_percent_complete'] = $val->progress;
311 $tasks[$taskcursor][
'task_name'] = $val->ref.
' - '.$val->label;
312 $tasks[$taskcursor][
'task_start_date'] = $val->date_start;
313 $tasks[$taskcursor][
'task_end_date'] = $val->date_end;
314 $tasks[$taskcursor][
'task_color'] =
'b4d1ea';
316 $idofusers = $task->getListContactId(
'internal');
317 $idofcontacts = $task->getListContactId(
'external');
319 if (count($idofusers) > 0) {
320 $s .= $langs->trans(
"Internals").
': ';
322 foreach ($idofusers as $valid) {
323 $userstatic->fetch($valid);
327 $s .= $userstatic->login;
332 if (count($idofcontacts) > 0) {
336 $s .= $langs->trans(
"Externals").
': ';
338 $contactidfound = array();
339 foreach ($idofcontacts as $valid) {
340 if (empty($contactidfound[$valid])) {
341 $res = $contactstatic->fetch($valid);
346 $s .= $contactstatic->getFullName($langs);
347 $contactidfound[$valid] = 1;
356 $tasks[$taskcursor][
'task_resources'] = $s;
358 $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>';
361 $tasks[$taskcursor][
'note'] = $task->note_public;
366 foreach ($tasks as $tmpkey => $tmptask) {
367 foreach ($tasks as $tmptask2) {
368 if ($tmptask2[
'task_id'] == $tmptask[
'task_parent']) {
369 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tmptask2[
'task_alternate_id'];
373 if (empty($tasks[$tmpkey][
'task_parent_alternate_id'])) {
374 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tasks[$tmpkey][
'task_parent'];
380 if (!empty($conf->use_javascript_ajax)) {
384 $dateformatinput =
'yyyy-mm-dd';
386 $dateformatinput2 =
'standard';
390 $moreforfilter =
'<div class="liste_titre liste_titre_bydiv centpercent">';
392 $moreforfilter .=
'<div class="divsearchfield">';
395 $moreforfilter .=
' ';
396 $moreforfilter .=
'</div>';
398 $moreforfilter .=
'</div>';
400 print $moreforfilter;
402 print
'<div class="div-table-responsive">';
404 print
'<div id="tabs" class="gantt" style="width: 80vw;">'.
"\n";
405 include_once DOL_DOCUMENT_ROOT.
'/projet/ganttchart.inc.php';
410 $langs->load(
"admin");
411 print $langs->trans(
"AvailableOnlyIfJavascriptAndAjaxNotDisabled");
414 print
'<div class="opacitymedium">'.$langs->trans(
"NoTasks").
'</div>';
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.
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.
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.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.