diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 535470ef52f..44232681110 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -433,7 +433,7 @@ if ($user->rights->societe->lire)
}
else
{
- print '
| '.$langs->trans("None").' |
';
+ print '| '.$langs->trans("None").' |
';
}
print '
';
}
@@ -493,7 +493,7 @@ if ($user->rights->societe->lire)
}
else
{
- print '| '.$langs->trans("None").' |
';
+ print '| '.$langs->trans("None").' |
';
}
print '
';
}
@@ -511,9 +511,9 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
$sql.= " s.nom, s.rowid as socid,";
$sql.= " p.rowid, p.ref, p.facture, p.fk_statut, p.total_ht, p.total_ttc";
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
- $sql.= " FROM (".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."commande AS p";
- if ($user->rights->commercial->client->voir || $socid) $sql .= ")";
- if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc)";
+ $sql.= " FROM ".MAIN_DB_PREFIX."societe AS s";
+ if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql.= ", ".MAIN_DB_PREFIX."commande AS p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid";
$sql.= " WHERE p.fk_soc = s.rowid";
diff --git a/htdocs/includes/boxes/box_factures_imp.php b/htdocs/includes/boxes/box_factures_imp.php
index 62dfcbc79c0..5d53abd2f8c 100644
--- a/htdocs/includes/boxes/box_factures_imp.php
+++ b/htdocs/includes/boxes/box_factures_imp.php
@@ -78,7 +78,7 @@ class box_factures_imp extends ModeleBoxes {
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE f.fk_soc = s.rowid AND f.paye=0 AND fk_statut = 1";
- if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id)
{
$sql .= " AND s.rowid = ".$user->societe_id;