diff --git a/ChangeLog b/ChangeLog
index e7f69509f37..e3948a13427 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@ For users:
- New: Default output charset are utf8 into backup tool.
- New: Extra fields support int type.
- New: Add brazilian states.
+- New: Increase usability of module project.
- New: Automtic list of documents in ECM module is ok for customers,
suppliers invoice, orders, customers orders, proposals and social contributions.
- Fix: Can use POS module with several concurrent users.
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b9ef43a31ba..ffd89d84d55 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3246,6 +3246,7 @@ class Form
$base=DOL_URL_ROOT.'/core/';
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\',\''.$langs->defaultlang.'\');">'.img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"').'';
}
+ else $retstring.=''.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').' ';
$retstring.=' '."\n";
$retstring.=' '."\n";
@@ -3628,21 +3629,21 @@ class Form
* Return a HTML area with the reference of object and a navigation bar for a business object
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
*
- * @param object Object to show
- * @param paramid Name of parameter to use to name the id into the URL link
- * @param morehtml More html content to output just before the nav bar
- * @param shownav Show Condition (navigation is shown if value is 1)
- * @param fieldid Nom du champ en base a utiliser pour select next et previous
- * @param fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
- * @param morehtmlref Code html supplementaire a afficher apres ref
- * @param moreparam More param to add in nav link url.
- * @return string Portion HTML avec ref + boutons nav
+ * @param Object $object Object to show
+ * @param int $paramid Name of parameter to use to name the id into the URL link
+ * @param string $morehtml More html content to output just before the nav bar
+ * @param int $shownav Show Condition (navigation is shown if value is 1)
+ * @param int $fieldid Nom du champ en base a utiliser pour select next et previous
+ * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
+ * @param string $morehtmlref Code html supplementaire a afficher apres ref
+ * @param string $moreparam More param to add in nav link url.
+ * @return tring Portion HTML avec ref + boutons nav
*/
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='')
{
$ret='';
- //print "$paramid,$morehtml,$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
+ //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid);
$previous_ref = $object->ref_previous?'ref_previous).$moreparam.'">'.img_previous().' ':'';
$next_ref = $object->ref_next?'ref_next).$moreparam.'">'.img_next().' ':'';
@@ -3653,14 +3654,17 @@ class Form
}
$ret.=$object->$fieldref;
- if ($morehtmlref) {
+ if ($morehtmlref)
+ {
$ret.=' '.$morehtmlref;
}
- if ($morehtml) {
+ if ($morehtml)
+ {
$ret.='
'.$morehtml;
}
- if ($shownav && ($previous_ref || $next_ref)) {
+ if ($shownav && ($previous_ref || $next_ref))
+ {
$ret.=' '.$previous_ref.' ';
$ret.=''.$next_ref;
}
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 913b1cfefc2..c99bc19d97a 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -111,17 +111,17 @@ function task_prepare_head($object)
$h = 0;
$head = array();
- $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'task';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$head[$h][1] = $langs->trans("TaskRessourceLinks");
$head[$h][2] = 'contact';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$head[$h][1] = $langs->trans("TimeSpent");
$head[$h][2] = 'time';
$h++;
@@ -132,7 +132,7 @@ function task_prepare_head($object)
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
- $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
/*$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$listoffiles=dol_dir_list($filesdir,'files',1);
@@ -141,7 +141,7 @@ function task_prepare_head($object)
$head[$h][2] = 'document';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;
@@ -255,118 +255,6 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen
}
-/**
- * Output a task line
- *
- * @param string &$inc ?
- * @param string $parent ?
- * @param Object $lines ?
- * @param int &$level ?
- * @param string &$projectsrole ?
- * @param string &$tasksrole ?
- * @param int $mytask 0 or 1 to enable only if task is a task i am affected to
- * @return $inc
- */
-function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0)
-{
- global $user, $bc, $langs;
- global $form, $projectstatic, $taskstatic;
-
- $lastprojectid=0;
-
- $var=true;
-
- $numlines=count($lines);
- for ($i = 0 ; $i < $numlines ; $i++)
- {
- if ($parent == 0) $level = 0;
-
- if ($lines[$i]->fk_parent == $parent)
- {
- // Break on a new project
- if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
- {
- $var = !$var;
- $lastprojectid=$lines[$i]->fk_project;
- }
-
- print " \n";
-
- // Project
- print "";
- $projectstatic->id=$lines[$i]->fk_project;
- $projectstatic->ref=$lines[$i]->projectref;
- $projectstatic->public=$lines[$i]->public;
- $projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
- print $projectstatic->getNomUrl(1);
- print " ";
-
- // Ref
- print '';
- $taskstatic->id=$lines[$i]->id;
- $taskstatic->ref=$lines[$i]->id;
- print $taskstatic->getNomUrl(1);
- print ' ';
-
- // Label task
- print "";
-
- for ($k = 0 ; $k < $level ; $k++)
- {
- print " ";
- }
- print $lines[$i]->label;
- print " \n";
-
- // Time spent
- print '';
- if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,'all');
- else print '--:--';
- print " \n";
-
- $disabledproject=1;$disabledtask=1;
- //print "x".$lines[$i]->fk_project;
- //var_dump($lines[$i]);
- //var_dump($projectsrole[$lines[$i]->fk_project]);
- // If at least one role for project
- if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
- {
- $disabledproject=0;
- $disabledtask=0;
- }
- // If mytask and no role on task
- if ($mytask && empty($tasksrole[$lines[$i]->id]))
- {
- $disabledtask=1;
- }
-
- print '';
- print $form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
- print ' ';
- print $form->select_duration($lines[$i]->id,'',$disabledtask);
- print ' ';
- if ($disabledtask) print '('.$langs->trans("TaskIsNotAffectedToYou").')';
- if ((! $lines[$i]->public) && $disabledproject) print '('.$langs->trans("YouAreNotContactOfProject").')';
- print ' ';
- print " ";
- print ' ';
-
- print " \n";
- $inc++;
- $level++;
- if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mytask);
- $level--;
- }
- else
- {
- //$level--;
- }
- }
-
- return $inc;
-}
-
-
/**
* Show task lines with a particular parent
*
@@ -379,7 +267,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
* @param int &$taskrole Array of roles of user for each tasks
* @param int $projectsListId List of id of project allowed to user (separated with comma)
*/
-function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='')
+function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='')
{
global $user, $bc, $langs;
global $projectstatic, $taskstatic;
@@ -463,14 +351,14 @@ function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$ta
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->id;
$taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:'');
- print $taskstatic->getNomUrl(1);
+ print $taskstatic->getNomUrl(1,($showproject?'':'withproject'));
}
print '';
// Title of task
print "";
if ($showlineingray) print '';
- else print '';
+ else print ' ';
for ($k = 0 ; $k < $level ; $k++)
{
print " ";
@@ -480,6 +368,16 @@ function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$ta
else print ' ';
print " \n";
+ // Date start
+ print '';
+ print dol_print_date($lines[$i]->date_start,'day');
+ print ' ';
+
+ // Date end
+ print '';
+ print dol_print_date($lines[$i]->date_end,'day');
+ print ' ';
+
// Progress
print '';
print $lines[$i]->progress.' %';
@@ -488,7 +386,7 @@ function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$ta
// Time spent
print ' ';
if ($showlineingray) print '';
- else print '';
+ else print ' ';
if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,'all');
else print '--:--';
if ($showlineingray) print ' ';
@@ -500,7 +398,7 @@ function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$ta
if (! $showlineingray) $inc++;
$level++;
- if ($lines[$i]->id) projectLines($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId);
+ if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId);
$level--;
$total += $lines[$i]->duration;
}
@@ -517,6 +415,8 @@ function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$ta
if ($showproject) print ' ';
print ' ';
print ' ';
+ print ' ';
+ print ' ';
print ''.convertSecondToTime($total).' ';
}
@@ -524,6 +424,133 @@ function projectLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$ta
}
+/**
+ * Output a task line
+ *
+ * @param string &$inc ?
+ * @param string $parent ?
+ * @param Object $lines ?
+ * @param int &$level ?
+ * @param string &$projectsrole ?
+ * @param string &$tasksrole ?
+ * @param int $mytask 0 or 1 to enable only if task is a task i am affected to
+ * @return $inc
+ */
+function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0)
+{
+ global $user, $bc, $langs;
+ global $form, $projectstatic, $taskstatic;
+
+ $lastprojectid=0;
+
+ $var=true;
+
+ $numlines=count($lines);
+ for ($i = 0 ; $i < $numlines ; $i++)
+ {
+ if ($parent == 0) $level = 0;
+
+ if ($lines[$i]->fk_parent == $parent)
+ {
+ // Break on a new project
+ if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
+ {
+ $var = !$var;
+ $lastprojectid=$lines[$i]->fk_project;
+ }
+
+ print "\n";
+
+ // Project
+ print "";
+ $projectstatic->id=$lines[$i]->fk_project;
+ $projectstatic->ref=$lines[$i]->projectref;
+ $projectstatic->public=$lines[$i]->public;
+ $projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
+ print $projectstatic->getNomUrl(1);
+ print " ";
+
+ // Ref
+ print '';
+ $taskstatic->id=$lines[$i]->id;
+ $taskstatic->ref=$lines[$i]->id;
+ print $taskstatic->getNomUrl(1);
+ print ' ';
+
+ // Label task
+ print "";
+ for ($k = 0 ; $k < $level ; $k++)
+ {
+ print " ";
+ }
+ print $lines[$i]->label;
+ print " \n";
+
+ // Date start
+ print '';
+ print dol_print_date($lines[$i]->date_start,'day');
+ print ' ';
+
+ // Date end
+ print '';
+ print dol_print_date($lines[$i]->date_end,'day');
+ print ' ';
+
+ // Progress
+ print '';
+ print $lines[$i]->progress.' %';
+ print ' ';
+
+ // Time spent
+ print '';
+ if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,'all');
+ else print '--:--';
+ print " \n";
+
+ $disabledproject=1;$disabledtask=1;
+ //print "x".$lines[$i]->fk_project;
+ //var_dump($lines[$i]);
+ //var_dump($projectsrole[$lines[$i]->fk_project]);
+ // If at least one role for project
+ if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
+ {
+ $disabledproject=0;
+ $disabledtask=0;
+ }
+ // If mytask and no role on task
+ if ($mytask && empty($tasksrole[$lines[$i]->id]))
+ {
+ $disabledtask=1;
+ }
+
+ print '';
+ $s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
+ $s.=' ';
+ $s.=$form->select_duration($lines[$i]->id,'',$disabledtask);
+ $s.=' ';
+ print $s;
+ print ' ';
+ print '';
+ if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
+ else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
+ print ' ';
+
+ print " \n";
+ $inc++;
+ $level++;
+ if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mytask);
+ $level--;
+ }
+ else
+ {
+ //$level--;
+ }
+ }
+
+ return $inc;
+}
+
+
/**
* Search in task lines with a particular parent if there is a task for a particular user (in taskrole)
*
diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php
index 3c42525e20c..254beb16949 100644
--- a/htdocs/projet/activity/list.php
+++ b/htdocs/projet/activity/list.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2005-2010 Regis Houssin
* Copyright (C) 2010 François Legastelois
*
@@ -32,7 +32,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
$langs->load('projects');
+$action=GETPOST('action');
$mode=GETPOST("mode");
+$id=GETPOST('id');
$mine=0;
if ($mode == 'mine') $mine=1;
@@ -50,7 +52,7 @@ $result = restrictedArea($user, 'projet', $projectid);
* Actions
*/
-if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
+if ($action == 'addtime' && $user->rights->projet->creer)
{
$task = new Task($db);
@@ -83,7 +85,7 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
$task->addTimeSpent($user);
// header to avoid submit twice on back
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$projectid);
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$projectid.($mode?'&mode='.$mode:''));
exit;
}
else
@@ -110,9 +112,9 @@ llxHeader("",$title,"");
//$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
-if ($_GET["id"])
+if ($id)
{
- $project->fetch($_GET["id"]);
+ $project->fetch($id);
$project->societe->fetch($project->societe->id);
}
@@ -133,21 +135,24 @@ dol_htmloutput_mesg($mesg);
print '';
+
llxFooter();
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 317b9cab694..86419a9926f 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -421,7 +421,7 @@ class Task extends CommonObject
$result='';
- $lien = '';
+ $lien = ' ';
$lienfin=' ';
$picto='projecttask';
@@ -784,7 +784,7 @@ class Task extends CommonObject
function updateTimeSpent($user, $notrigger=0)
{
global $conf,$langs;
-
+
$error=0;
$ret = 0;
diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php
index 2b112faa8ef..20617b9f1f6 100644
--- a/htdocs/projet/ganttchart.php
+++ b/htdocs/projet/ganttchart.php
@@ -144,7 +144,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
// Define percent
$percent = $task['task_percent_complete']?$task['task_percent_complete']:0;
// Link
- $link=DOL_URL_ROOT.'/projet/tasks/task.php?id='.$task["task_id"];
+ $link=DOL_URL_ROOT.'/projet/tasks/task.php?withproject=1&id='.$task["task_id"];
// Name
$name=$task['task_name'];
for($i=0; $i < $level; $i++) { $name=' '.$name; }
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index bcb5f12024e..b22deee7ff7 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2005-2010 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -40,8 +40,6 @@ $socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $id);
-$userAccess=0;
-
$langs->load("users");
$langs->load("projects");
@@ -50,11 +48,20 @@ $langs->load("projects");
* Actions
*/
+// None
+
/*
* View
*/
+$form=new Form($db);
+$formother=new FormOther($db);
+$userstatic=new User($db);
+$companystatic=new Societe($db);
+$task = new Task($db);
+$object = new Project($db);
+
$arrayofcss=array('/includes/jsgantt/jsgantt.css');
if (! empty($conf->use_javascript_ajax))
@@ -65,104 +72,95 @@ if (! empty($conf->use_javascript_ajax))
);
}
-$form=new Form($db);
-$formother=new FormOther($db);
-
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
llxHeader("",$langs->trans("Tasks"),$help_url,'',0,0,$arrayofjs,$arrayofcss);
-$task = new Task($db);
-
if ($id > 0 || ! empty($ref))
{
- $project = new Project($db);
- $project->fetch($id,$ref);
- if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
+ $object->fetch($id,$ref);
+ if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id);
// To verify role of users
- $userAccess = $project->restrictedProjectArea($user,'read');
+ //$userAccess = $object->restrictedProjectArea($user,'read');
+ $userWrite = $object->restrictedProjectArea($user,'write');
+ //$userDelete = $object->restrictedProjectArea($user,'delete');
+ //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
+
+
+ $tab='gantt';
+
+ $head=project_prepare_head($object);
+ dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project'));
+
+ $param=($_REQUEST["mode"]=='mine'?'&mode=mine':'');
+
+ print '';
+
+ // Ref
+ print '';
+ print $langs->trans("Ref");
+ print ' ';
+ // Define a complementary filter for search of next/prev ref.
+ $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,1);
+ $object->next_prev_filter=" rowid in (".$objectsListId.")";
+ print $form->showrefnav($object,'ref','',1,'ref','ref','',$param);
+ print ' ';
+
+ print ''.$langs->trans("Label").' '.$object->title.' ';
+
+ print ''.$langs->trans("Company").' ';
+ if (! empty($object->societe->id)) print $object->societe->getNomUrl(1);
+ else print ' ';
+ print ' ';
+ print ' ';
+
+ // Visibility
+ print ''.$langs->trans("Visibility").' ';
+ if ($object->public) print $langs->trans('SharedProject');
+ else print $langs->trans('PrivateProject');
+ print ' ';
+
+ // Statut
+ print ''.$langs->trans("Status").' '.$object->getLibStatut(4).' ';
+
+ print '
';
+
+ print '';
}
-
-$userstatic=new User($db);
-$companystatic=new Societe($db);
-
-$tab='gantt';
-
-$head=project_prepare_head($project);
-dol_fiche_head($head, $tab, $langs->trans("Project"),0,($project->public?'projectpub':'project'));
-
-$param=($_REQUEST["mode"]=='mine'?'&mode=mine':'');
-
-print '';
-
-// Ref
-print '';
-print $langs->trans("Ref");
-print ' ';
-// Define a complementary filter for search of next/prev ref.
-$projectsListId = $project->getProjectsAuthorizedForUser($user,$mine,1);
-$project->next_prev_filter=" rowid in (".$projectsListId.")";
-print $form->showrefnav($project,'ref','',1,'ref','ref','',$param);
-print ' ';
-
-print ''.$langs->trans("Label").' '.$project->title.' ';
-
-print ''.$langs->trans("Company").' ';
-if (! empty($project->societe->id)) print $project->societe->getNomUrl(1);
-else print ' ';
-print ' ';
-print ' ';
-
-// Visibility
-print ''.$langs->trans("Visibility").' ';
-if ($project->public) print $langs->trans('SharedProject');
-else print $langs->trans('PrivateProject');
-print ' ';
-
-// Statut
-print ''.$langs->trans("Status").' '.$project->getLibStatut(4).' ';
-
-print '
';
-
-print '';
-
-
/*
* Actions
*/
-/*
print '';
print ' ';
-*/
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user
// can have a parent that is not affected to him).
-$tasksarray=$task->getTasksArray(0, 0, $project->id, $socid, 0);
+$tasksarray=$task->getTasksArray(0, 0, $object->id, $socid, 0);
// We load also tasks limited to a particular user
-//$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$project->id,0) : '');
+//$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : '');
//var_dump($tasksarray);
//var_dump($tasksrole);
@@ -177,7 +175,6 @@ if (count($tasksarray)>0)
$array_contacts=array();
$tasks=array();
$project_dependencies=array();
- $project_id=$project->id;
$taskcursor=0;
foreach($tasksarray as $key => $val)
{
@@ -221,7 +218,7 @@ if (count($tasksarray)>0)
$i++;
}
}
- if ($s) $tasks[$taskcursor]['task_resources']=''.$langs->trans("List").' ';
+ if ($s) $tasks[$taskcursor]['task_resources']=''.$langs->trans("List").' ';
//print "xxx".$val->id.$tasks[$taskcursor]['task_resources'];
$taskcursor++;
}
@@ -246,7 +243,8 @@ else
print $langs->trans("NoTasks");
}
-$db->close();
llxFooter();
+
+$db->close();
?>
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index 6d193e771eb..dc7a81e7774 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -27,7 +27,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
$langs->load('projects');
-$id = isset($_GET["id"])?$_GET["id"]:'';
+$action=GETPOST('action');
+$id = GETPOST('id');
+$ref= GETPOST('ref');
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
@@ -43,7 +45,7 @@ $result = restrictedArea($user, 'projet', $id);
/* Actions */
/******************************************************************************/
-if ($_POST["action"] == 'update_public' && $user->rights->projet->creer)
+if ($action == 'update_public' && $user->rights->projet->creer)
{
$project = new Project($db);
$project->fetch($_GET['id']);
@@ -62,7 +64,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->projet->creer)
}
}
-if ($_POST['action'] == 'update_private' && $user->rights->projet->creer)
+if ($action == 'update_private' && $user->rights->projet->creer)
{
$project = new Project($db);
$project->fetch($_GET['id']);
@@ -86,22 +88,19 @@ if ($_POST['action'] == 'update_private' && $user->rights->projet->creer)
* View
*/
-llxHeader();
+$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
+llxHeader("",$langs->trans("Tasks"),$help_url);
$form = new Form($db);
-
$userstatic=new User($db);
+$project = new Project($db);
+$now=dol_now();
-$id = $_GET['id'];
-$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
if ($mesg) print $mesg;
- $now=gmmktime();
-
- $project = new Project($db);
if ($project->fetch($id, $ref))
{
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index cf59a29846a..c05bac91f4e 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -111,21 +111,26 @@ if ($action == 'createtask' && $user->rights->projet->creer)
if (! $error)
{
- if (empty($projectid))
+ if (GETPOST('backtopage'))
{
- Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($mode)?'':'?mode='.$mode));
+ Header("Location: ".GETPOST('backtopage'));
exit;
}
- else
+ else if (empty($projectid))
{
- Header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$taskid);
+ Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($mode)?'':'?mode='.$mode));
exit;
}
}
}
else
{
- if (empty($id))
+ if (GETPOST('backtopage'))
+ {
+ Header("Location: ".GETPOST('backtopage'));
+ exit;
+ }
+ else if (empty($id))
{
// We go back on task list
Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($mode)?'':'?mode='.$mode));
@@ -141,6 +146,7 @@ if ($action == 'createtask' && $user->rights->projet->creer)
$form=new Form($db);
$formother=new FormOther($db);
$taskstatic = new Task($db);
+$userstatic=new User($db);
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
llxHeader("",$langs->trans("Tasks"),$help_url);
@@ -155,10 +161,57 @@ if ($id > 0 || ! empty($ref))
$userWrite = $object->restrictedProjectArea($user,'write');
//$userDelete = $object->restrictedProjectArea($user,'delete');
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
+
+
+ $tab=GETPOST('tab')?GETPOST('tab'):'tasks';
+
+ $head=project_prepare_head($object);
+ dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project'));
+
+ $param=($mode=='mine'?'&mode=mine':'');
+
+ print '';
+
+ // Ref
+ print '';
+ print $langs->trans("Ref");
+ print ' ';
+ // Define a complementary filter for search of next/prev ref.
+ if (! $user->rights->projet->all->lire)
+ {
+ $projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
+ $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
+ }
+ print $form->showrefnav($object,'ref','',1,'ref','ref','',$param);
+ print ' ';
+
+ print ''.$langs->trans("Label").' '.$object->title.' ';
+
+ print ''.$langs->trans("Company").' ';
+ if (! empty($object->societe->id)) print $object->societe->getNomUrl(1);
+ else print ' ';
+ print ' ';
+ print ' ';
+
+ // Visibility
+ print ''.$langs->trans("Visibility").' ';
+ if ($object->public) print $langs->trans('SharedProject');
+ else print $langs->trans('PrivateProject');
+ print ' ';
+
+ // Statut
+ print ''.$langs->trans("Status").' '.$object->getLibStatut(4).' ';
+
+ print '
';
+
+ dol_fiche_end();
}
-if ($action == 'create' && $user->rights->projet->creer && (empty($object->societe->id) || $userAccess > 0))
+
+if ($action == 'create' && $user->rights->projet->creer && (empty($object->societe->id) || $userWrite > 0))
{
+ if ($id > 0 || ! empty($ref)) print ' ';
+
print_fiche_titre($langs->trans("NewTask"));
dol_htmloutput_errors($mesg);
@@ -166,6 +219,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
print '