Fix: add function to sort project authorized for a user
This commit is contained in:
parent
e6b06fd6b4
commit
9854b5ab53
@ -44,10 +44,18 @@ if ($user->societe_id > 0)
|
||||
$socstatic=new Societe($db);
|
||||
$projectstatic=new Project($db);
|
||||
|
||||
$projectsIdArray=array();
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
$projectsListArray = $projectstatic->getProjectsAuthorizedForUser($user,$mine);
|
||||
foreach ($projectsListArray as $key => $value)
|
||||
{
|
||||
$projectsIdArray[] = $key;
|
||||
}
|
||||
|
||||
llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
||||
|
||||
$text=$langs->trans("Projects");
|
||||
if ($_REQUEST["mode"]=='mine') $text=$langs->trans("MyProjects");
|
||||
if ($mine) $text=$langs->trans("MyProjects");
|
||||
print_fiche_titre($text);
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
@ -64,6 +72,7 @@ $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public,
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($mine) $sql.= " AND p.rowid IN (".(!empty($projectsIdArray) ? implode(',',$projectsIdArray) : 0).")";
|
||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY p.title, p.rowid";
|
||||
|
||||
@ -108,14 +117,6 @@ print "</table>";
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
|
||||
$projectsIdArray=array();
|
||||
$mine = $_GET['mode']=='mine'?1:0;
|
||||
$projectsListArray = $projectstatic->getProjectsAuthorizedForUser($user,$mine);
|
||||
foreach ($projectsListArray as $key => $value)
|
||||
{
|
||||
$projectsIdArray[] = $key;
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield,$sortorder);
|
||||
|
||||
@ -68,12 +68,21 @@ llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:
|
||||
$projectstatic = new Project($db);
|
||||
$socstatic = new Societe($db);
|
||||
|
||||
$projectsIdArray=array();
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
$projectsListArray = $projectstatic->getProjectsAuthorizedForUser($user,$mine);
|
||||
foreach ($projectsListArray as $key => $value)
|
||||
{
|
||||
$projectsIdArray[] = $key;
|
||||
}
|
||||
|
||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat";
|
||||
$sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end";
|
||||
$sql.= ", s.nom, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($mine) $sql.= " AND p.rowid IN (".(!empty($projectsIdArray) ? implode(',',$projectsIdArray) : 0).")";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
if ($_GET["search_ref"])
|
||||
@ -98,7 +107,7 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$text=$langs->trans("Projects");
|
||||
if ($_REQUEST["mode"]=='mine') $text=$langs->trans('MyProjects');
|
||||
if ($mine) $text=$langs->trans('MyProjects');
|
||||
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user