diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index f1d407d3bba..9f03213a16d 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -292,7 +292,7 @@ class FormProjets
}
/**
- * Output a combo list with projects qualified for a third party
+ * Output a combo list with tasks qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id task preselected
@@ -304,9 +304,11 @@ class FormProjets
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param string $morecss More css added to the select component
+ * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
+ * @param string $showproject 'all' = Show project info, ''=Hide project info
* @return int Nbr of project if OK, <0 if KO
*/
- function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty='1', $discard_closed=0, $forcefocus=0, $disabled=0, $morecss='maxwidth500')
+ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty='1', $discard_closed=0, $forcefocus=0, $disabled=0, $morecss='maxwidth500', $projectsListId='', $showproject='all')
{
global $user,$conf,$langs;
@@ -317,11 +319,13 @@ class FormProjets
$hideunselectables = false;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
- $projectsListId = false;
- if (empty($user->rights->projet->all->lire))
+ if (empty($projectsListId))
{
- $projectstatic=new Project($this->db);
- $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
+ if (empty($user->rights->projet->all->lire))
+ {
+ $projectstatic=new Project($this->db);
+ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
+ }
}
// Search all projects
@@ -332,7 +336,7 @@ class FormProjets
$sql.= ', '.MAIN_DB_PREFIX.'projet_task as t';
$sql.= " WHERE p.entity IN (".getEntity('project').")";
$sql.= " AND t.fk_projet = p.rowid";
- if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
+ if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
$sql.= " ORDER BY p.ref, t.ref ASC";
@@ -378,31 +382,38 @@ class FormProjets
continue;
}
- $labeltoshow=dol_trunc($obj->ref,18); // Project ref
- //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
- //else $labeltoshow.=' ('.$langs->trans("Private").')';
- $labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
+ $labeltoshow = '';
- if ($obj->name) $labeltoshow.=' ('.$obj->name.')';
+ if ($showproject == 'all')
+ {
+ $labeltoshow.=dol_trunc($obj->ref,18); // Project ref
+ //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
+ //else $labeltoshow.=' ('.$langs->trans("Private").')';
+ $labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
- $disabled=0;
- if ($obj->fk_statut == 0)
- {
- $disabled=1;
- $labeltoshow.=' - '.$langs->trans("Draft");
- }
- else if ($obj->fk_statut == 2)
- {
- if ($discard_closed == 2) $disabled=1;
- $labeltoshow.=' - '.$langs->trans("Closed");
- }
- else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
- {
- $disabled=1;
- $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
+ if ($obj->name) $labeltoshow.=' ('.$obj->name.')';
+
+ $disabled=0;
+ if ($obj->fk_statut == 0)
+ {
+ $disabled=1;
+ $labeltoshow.=' - '.$langs->trans("Draft");
+ }
+ else if ($obj->fk_statut == 2)
+ {
+ if ($discard_closed == 2) $disabled=1;
+ $labeltoshow.=' - '.$langs->trans("Closed");
+ }
+ else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
+ {
+ $disabled=1;
+ $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
+ }
+ $labeltoshow.=' - ';
}
+
// Label for task
- $labeltoshow.=' - '.$obj->tref.' '.dol_trunc($obj->tlabel,$maxlength);
+ $labeltoshow.=$obj->tref.' '.dol_trunc($obj->tlabel,$maxlength);
if (!empty($selected) && $selected == $obj->rowid)
{
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index c8096559c9c..6e8c12793cc 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1141,10 +1141,10 @@ class Project extends CommonObject
*
* @param User $user User object
* @param int $mode 0=All project I have permission on (assigned to me and public), 1=Projects assigned to me only, 2=Will return list of all projects with no test on contacts
- * @param int $list 0=Return array,1=Return string list
+ * @param int $list 0=Return array, 1=Return string list
* @param int $socid 0=No filter on third party, id of third party
- * @param string $filter additionnal filter on project (statut, ref, ...)
- * @return array or string Array of projects id, or string with projects id separated with ","
+ * @param string $filter additionnal filter on project (statut, ref, ...)
+ * @return array or string Array of projects id, or string with projects id separated with "," if list is 1
*/
function getProjectsAuthorizedForUser($user, $mode=0, $list=0, $socid=0, $filter='')
{
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 11367951976..2eb9bc1e44f 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -455,29 +455,25 @@ else if ($id > 0 || ! empty($ref))
}
}
+ print '
';
- /*
- * Actions
- */
- print '