From 828bf22670b0178b58ef60791f2ddf530c643be1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 2 May 2009 15:01:20 +0000 Subject: [PATCH] Fix: bad link --- htdocs/comm/index.php | 9 ++++--- htdocs/comm/prospect/fiche.php | 10 ++++--- htdocs/comm/prospect/index.php | 48 ++++++++++++++++++---------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index c84a4c517a0..8c970094d8e 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -144,7 +144,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_statut = 0"; $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 s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; @@ -209,7 +209,7 @@ if ($conf->commande->enabled && $user->rights->commande->lire) if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.fk_statut = 0"; - $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND c.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND c.fk_soc = ".$socid; @@ -280,7 +280,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) $sql.= ", ".MAIN_DB_PREFIX."propal 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.= " AND p.entity = ".$conf->entity; //$sql.= " AND p.fk_statut > 1"; 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; @@ -425,6 +425,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // \todo A REF if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND s.entity = ".$conf->entity; + //$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_product = p.rowid"; 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; @@ -475,7 +476,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) $sql.= ", ".MAIN_DB_PREFIX."propal 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.= " AND p.entity = ".$conf->entity; $sql.= " AND p.fk_statut = 1"; 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; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index f8a2c3d72b2..cecf2711f02 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2005-2008 Regis Houssin + * Copyright (C) 2005-2009 Regis Houssin * * 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 @@ -176,8 +176,12 @@ if ($socid > 0) $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; $sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite,"; $sql.= " c.label as statut, c.id as statutid"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; - $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", ".MAIN_DB_PREFIX."propal as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_propalst as c"; + $sql.= " WHERE p.fk_soc = s.rowid"; + $sql.= " AND p.fk_statut = c.id"; + $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND s.rowid = ".$societe->id; $sql.= " ORDER BY p.datep DESC"; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index b5c9abdab4e..05db92d4902 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -69,12 +69,13 @@ if ($conf->propal->enabled) */ $sql = "SELECT count(*) as cc, st.libelle, st.id"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st "; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE s.fk_stcomm = st.id AND s.client=2"; +$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st "; +if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= " WHERE s.fk_stcomm = st.id"; +$sql.= " AND s.client = 2"; $sql.= " AND s.entity = ".$conf->entity; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY st.id"; $sql.= " ORDER BY st.id"; @@ -111,12 +112,13 @@ if ($resql) if ($conf->propal->enabled && $user->rights->propale->lire) { $sql = "SELECT p.rowid, p.ref, p.price, s.nom"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE p.fk_statut = 0 and p.fk_soc = s.rowid"; - $sql.= " AND s.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE p.fk_statut = 0"; + $sql.= " AND p.fk_soc = s.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $resql=$db->query($sql); if ($resql) @@ -169,13 +171,16 @@ if ($conf->agenda->enabled) show_array_actions_to_do(10); if ($conf->propal->enabled && $user->rights->propale->lire) { $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.total as total_ttc, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id AND p.fk_statut = 1"; - $sql.= " AND s.entity = ".$conf->entity; - 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.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", ".MAIN_DB_PREFIX."propal as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_propalst as c"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE p.fk_soc = s.rowid"; + $sql.= " AND p.fk_statut = c.id"; + $sql.= " AND p.fk_statut = 1"; + $sql.= " AND p.entity = ".$conf->entity; + 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.= " ORDER BY p.rowid DESC"; $sql.= $db->plimit(5, 0); @@ -223,12 +228,11 @@ if ($conf->propal->enabled && $user->rights->propale->lire) * */ $sql = "SELECT s.nom, s.rowid"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fk_stcomm = 1"; $sql.= " AND s.entity = ".$conf->entity; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY s.tms ASC"; $sql.= $db->plimit(15, 0); @@ -247,7 +251,7 @@ if ( $db->query($sql) ) { $obj = $db->fetch_object(); $var=!$var; - print "rowid."\">"; + print "rowid."\">"; print img_object($langs->trans("ShowCompany"),"company"); print ' '.$obj->nom.''; $i++;