Fix: Pb with multicompany. If a project is not linked to a company, it was invisible.
This commit is contained in:
parent
ee36b2ea43
commit
4b35e70e8b
@ -473,11 +473,11 @@ class Project extends CommonObject
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as ta";
|
||||
}
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s)";
|
||||
$sql.= ")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as up on p.fk_user_resp = up.rowid";
|
||||
$sql.= " WHERE t.fk_projet = p.rowid";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($this->id) $sql .= " AND t.fk_projet =".$this->id;
|
||||
if (is_object($usert)) $sql .= " AND ta.fk_projet_task = t.rowid AND ta.fk_user = ".$usert->id;
|
||||
if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)";
|
||||
@ -488,17 +488,17 @@ class Project extends CommonObject
|
||||
if (is_object($usert)) // Limit to task affected to a user
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as ta";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s)";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as ta)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s)";
|
||||
$sql.= ")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
|
||||
}
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as up on p.fk_user_resp = up.rowid";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($this->id) $sql .= " AND t.fk_projet =".$this->id;
|
||||
if (is_object($usert)) $sql .= " AND t.fk_projet = p.rowid AND ta.fk_projet_task = t.rowid AND ta.fk_user = ".$usert->id;
|
||||
if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)";
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/projet/activity/myactivity.php
|
||||
\ingroup projet
|
||||
\brief Page activite perso du module projet
|
||||
\version $Id$
|
||||
* \file htdocs/projet/activity/myactivity.php
|
||||
* \ingroup projet
|
||||
* \brief Page activite perso du module projet
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -64,15 +64,14 @@ print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.title, count(t.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||
if ($mode == 'mine') $sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as pta";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as s on s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
$sql.= " WHERE t.fk_projet = p.rowid";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||
if ($mode == 'mine') $sql.=" AND t.rowid = pta.fk_projet_task";
|
||||
if ($mode == 'mine') $sql.=" AND pta.fk_user = ".$user->id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user