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/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40$mode =
GETPOST(
'mode',
'alpha');
41$mine = ($mode ==
'mine' ? 1 : 0);
46include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
47if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
57$langs->loadlangs(array(
'users',
'projects'));
73$userstatic =
new User($db);
74$companystatic =
new Societe($db);
75$contactstatic =
new Contact($db);
78$arrayofcss = array(
'/includes/jsgantt/jsgantt.css');
80if (!empty($conf->use_javascript_ajax)) {
82 '/includes/jsgantt/jsgantt.js',
83 '/projet/jsgantt_language.js.php?lang='.$langs->defaultlang
88$title = $langs->trans(
"Gantt");
92$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
94llxHeader(
"", $title, $help_url,
'', 0, 0, $arrayofjs, $arrayofcss);
96if (($id > 0 && is_numeric($id)) || !empty($ref)) {
99 $userWrite =
$object->restrictedProjectArea($user,
'write');
108 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
114 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
115 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
116 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
117 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
119 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
122 $morehtmlref =
'<div class="refidno">';
124 $morehtmlref .=
$object->title;
126 if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
127 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
129 $morehtmlref .=
'</div>';
132 if (!$user->hasRight(
'projet',
'all',
'lire')) {
133 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
134 $object->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
137 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
140 print
'<div class="fichecenter">';
141 print
'<div class="fichehalfleft">';
142 print
'<div class="underbanner clearboth"></div>';
144 print
'<table class="border tableforfield centpercent">';
148 print
'<tr><td class="tdtop">';
149 print $langs->trans(
"Usage");
153 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
154 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
155 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
159 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
160 $htmltext = $langs->trans(
"ProjectFollowTasks");
161 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
165 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"' :
'')).
'"> ';
166 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
167 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
170 if (isModEnabled(
'eventorganization')) {
171 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"' :
'')).
'"> ';
172 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
173 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
179 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
181 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
182 print $langs->trans(
'SharedProject');
184 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
185 print $langs->trans(
'PrivateProject');
190 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
191 if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
192 print
price(
$object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
197 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
199 print($start ? $start :
'?');
202 print($end ? $end :
'?');
210 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
215 print
'<div class="fichehalfright">';
216 print
'<div class="underbanner clearboth"></div>';
218 print
'<table class="border tableforfield centpercent">';
221 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
222 print nl2br(
$object->description);
226 if (isModEnabled(
'category')) {
227 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
228 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
237 print
'<div class="clearboth"></div>';
245$linktocreatetaskParam = array();
246$linktocreatetaskUserRight =
false;
247if ($user->hasRight(
'projet',
'all',
'creer') || $user->hasRight(
'projet',
'creer')) {
248 if (
$object->public || $userWrite > 0) {
249 $linktocreatetaskUserRight =
true;
251 $linktocreatetaskParam[
'attr'][
'title'] = $langs->trans(
"NotOwnerOfProject");
255$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);
257$linktotasks =
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/tasks.php?id='.
$object->id,
'', 1, array(
'morecss' =>
'reposition'));
258$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'));
261print
load_fiche_titre($title, $linktotasks.
' '.$linktocreatetask,
'projecttask');
267$tasksarray = $task->getTasksArray(0, 0, (
$object->id ?
$object->id : $id), $socid, 0);
274if (count($tasksarray) > 0) {
277 $dateformat = $langs->trans(
"FormatDateShortJQuery");
278 $datehourformat = $langs->trans(
"FormatDateShortJQuery").
' '.$langs->trans(
"FormatHourShortJQuery");
279 $array_contacts = array();
281 $task_dependencies = array();
283 foreach ($tasksarray as $key => $val) {
284 $task->fetch($val->id,
'');
286 $idparent = ($val->fk_task_parent ? $val->fk_task_parent :
'-'.$val->fk_project);
288 $tasks[$taskcursor][
'task_id'] = $val->id;
289 $tasks[$taskcursor][
'task_alternate_id'] = ($taskcursor + 1);
290 $tasks[$taskcursor][
'task_project_id'] = $val->fk_project;
291 $tasks[$taskcursor][
'task_parent'] = $idparent;
293 $tasks[$taskcursor][
'task_is_group'] = 0;
294 $tasks[$taskcursor][
'task_css'] =
'gtaskblue';
295 $tasks[$taskcursor][
'task_position'] = $val->rang;
296 $tasks[$taskcursor][
'task_planned_workload'] = $val->planned_workload;
298 if ($val->fk_task_parent != 0 && $task->hasChildren() > 0) {
299 $tasks[$taskcursor][
'task_is_group'] = 1;
300 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
302 } elseif ($task->hasChildren() > 0) {
303 $tasks[$taskcursor][
'task_is_group'] = 1;
305 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
308 $tasks[$taskcursor][
'task_milestone'] =
'0';
309 $tasks[$taskcursor][
'task_percent_complete'] = $val->progress;
312 $tasks[$taskcursor][
'task_name'] = $val->ref.
' - '.$val->label;
313 $tasks[$taskcursor][
'task_start_date'] = $val->date_start;
314 $tasks[$taskcursor][
'task_end_date'] = $val->date_end;
315 $tasks[$taskcursor][
'task_color'] =
'b4d1ea';
317 $idofusers = $task->getListContactId(
'internal');
318 $idofcontacts = $task->getListContactId(
'external');
320 if (count($idofusers) > 0) {
321 $s .= $langs->trans(
"Internals").
': ';
323 foreach ($idofusers as $valid) {
324 $userstatic->fetch($valid);
328 $s .= $userstatic->login;
333 if (count($idofcontacts) > 0) {
337 $s .= $langs->trans(
"Externals").
': ';
339 $contactidfound = array();
340 foreach ($idofcontacts as $valid) {
341 if (empty($contactidfound[$valid])) {
342 $res = $contactstatic->fetch($valid);
347 $s .= $contactstatic->getFullName($langs);
348 $contactidfound[$valid] = 1;
357 $tasks[$taskcursor][
'task_resources'] = $s;
359 $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(
"Contacts").
'</a>';
362 $tasks[$taskcursor][
'note'] = $task->note_public;
367 foreach ($tasks as $tmpkey => $tmptask) {
368 foreach ($tasks as $tmptask2) {
369 if ($tmptask2[
'task_id'] == $tmptask[
'task_parent']) {
370 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tmptask2[
'task_alternate_id'];
374 if (empty($tasks[$tmpkey][
'task_parent_alternate_id'])) {
375 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tasks[$tmpkey][
'task_parent'];
381 if (!empty($conf->use_javascript_ajax)) {
385 $dateformatinput =
'yyyy-mm-dd';
387 $dateformatinput2 =
'standard';
391 $moreforfilter =
'<div class="liste_titre liste_titre_bydiv centpercent">';
393 $moreforfilter .=
'<div class="divsearchfield">';
396 $moreforfilter .=
' ';
397 $moreforfilter .=
'</div>';
399 $moreforfilter .=
'</div>';
401 print $moreforfilter;
403 print
'<div class="div-table-responsive">';
405 print
'<div id="tabs" class="gantt" style="width: 80vw;">'.
"\n";
406 include_once DOL_DOCUMENT_ROOT.
'/projet/ganttchart.inc.php';
411 $langs->load(
"admin");
412 print $langs->trans(
"AvailableOnlyIfJavascriptAndAjaxNotDisabled");
415 print
'<div class="opacitymedium">'.$langs->trans(
"NoTasks").
'</div>';
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.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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=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 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.