Fix: Pb with multicompany. If a project is not linked to a company, it was invisible.
This commit is contained in:
parent
e138474d08
commit
ee36b2ea43
@ -71,7 +71,7 @@ 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.= " 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 (!$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";
|
||||
@ -295,7 +295,7 @@ else
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
/* Affichage de la liste des projets de l'année */
|
||||
/* Affichage de la liste des projets de l'ann<EFBFBD>e */
|
||||
print '<br /><table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
|
||||
|
||||
@ -57,15 +57,12 @@ print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet as p";
|
||||
//$sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; // pourquoi est-ce que c'était en commentaire ? => Si on laisse ce lien, les projet sans taches se retrouvent invisibles
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$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 sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id;
|
||||
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;
|
||||
$sql.= " GROUP BY p.rowid";
|
||||
|
||||
@ -105,14 +102,12 @@ print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$s
|
||||
print '<td align="right">'.$langs->trans("NbOfProjects").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, count(p.rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql = "SELECT count(p.rowid) as nb, 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";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " GROUP BY s.nom";
|
||||
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||
@ -126,11 +121,20 @@ if ( $resql )
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row( $resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$row[1].'">'.img_object($langs->trans("ShowCompany"),"company")." ".$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
if ($obj->socid)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company")." ".$obj->nom.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Public");
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">'.$obj->nb.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
@ -77,7 +77,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX
|
||||
$sql.= ")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on p.fk_user_resp = u.rowid";
|
||||
$sql.= " WHERE s.entity = ".$conf->entity;
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
@ -84,6 +84,7 @@ ALTER TABLE llx_dolibarr_modules ADD COLUMN entity integer DEFAULT 1 NOT NULL AF
|
||||
ALTER TABLE llx_bank_categ ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
|
||||
ALTER TABLE llx_bordereau_cheque ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER number;
|
||||
ALTER TABLE llx_prelevement_bons ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
|
||||
ALTER TABLE llx_projet ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
|
||||
|
||||
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
|
||||
ALTER TABLE llx_user_param DROP INDEX fk_user;
|
||||
@ -108,6 +109,7 @@ ALTER TABLE llx_livraison DROP INDEX idx_livraison_uk_ref;
|
||||
ALTER TABLE llx_fichinter DROP INDEX ref;
|
||||
ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY;
|
||||
ALTER TABLE llx_prelevement_bons DROP INDEX ref;
|
||||
ALTER TABLE llx_projet DROP INDEX ref;
|
||||
|
||||
ALTER TABLE llx_rights_def ADD PRIMARY KEY (id, entity);
|
||||
ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity);
|
||||
@ -134,6 +136,11 @@ ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity);
|
||||
ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity);
|
||||
ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, entity);
|
||||
ALTER TABLE llx_prelevement_bons ADD UNIQUE INDEX uk_prelevement_bons_ref (ref, entity);
|
||||
ALTER TABLE llx_projet ADD UNIQUE INDEX uk_projet_ref (ref, entity);
|
||||
|
||||
ALTER TABLE llx_projet ADD INDEX idx_projet_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_projet ADD CONSTRAINT fk_projet_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
|
||||
|
||||
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_USER' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_POPUP_CALENDAR' AND entity=1;
|
||||
|
||||
27
mysql/tables/llx_projet.key.sql
Normal file
27
mysql/tables/llx_projet.key.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_projet ADD UNIQUE INDEX uk_projet_ref (ref, entity);
|
||||
|
||||
ALTER TABLE llx_projet ADD INDEX idx_projet_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_projet ADD CONSTRAINT fk_projet_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
|
||||
@ -26,11 +26,9 @@ create table llx_projet
|
||||
tms timestamp,
|
||||
dateo date, -- date d'ouverture du projet
|
||||
ref varchar(50),
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
title varchar(255),
|
||||
fk_user_resp integer, -- responsable du projet
|
||||
fk_user_creat integer, -- createur du projet
|
||||
note text,
|
||||
|
||||
UNIQUE INDEX(ref)
|
||||
|
||||
note text
|
||||
)type=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user