diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 3cc4ded371b87af2600b3bb1899121bd82752e62..5b1833ae50e7ce3d862606fee5973133cd42439b 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -503,7 +503,9 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ' WHERE c.fk_soc = s.rowid'; + // Which invoice to show + /* if ($viewstatut <> '') { if ($viewstatut < 4 && $viewstatut > -2) @@ -524,6 +526,9 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected } } + */ + $sql.= " AND c.fk_statut in (1, 2) AND c.facture = 0"; + $sql.= ' AND s.entity = '.$conf->entity; if ($socid) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;