diff --git a/htdocs/compta/fiche.php3 b/htdocs/compta/fiche.php3 index 3e220b18a3e..09e36ad6954 100644 --- a/htdocs/compta/fiche.php3 +++ b/htdocs/compta/fiche.php3 @@ -189,7 +189,8 @@ if ($socid > 0) print 'Commercial'; print "idp\">Documents"; print "idp&action=add\">[Bookmark]"; - print "[idp\">".translate("Facture")."]"; + if ($user->rights->facture->creer) + print "[idp\">".translate("Facture")."]"; print "idp\">Notes"; print "[idp&action=edit\">Editer]"; } @@ -231,48 +232,50 @@ if ($socid > 0) /* * Factures */ - print ""; - $var=!$var; - $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; - $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC"; - if ( $db->query($sql) ) + if ($user->rights->facture->lire) { - $num = $db->num_rows(); $i = 0; - if ($num > 0) + print "
"; + $var=!$var; + $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; + $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC"; + if ( $db->query($sql) ) { - print ""; - print ""; + $num = $db->num_rows(); $i = 0; + if ($num > 0) + { + print ""; + print ""; + } + + while ($i < $num && $i < 5) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + if ($objp->df > 0 ) + { + print "\n"; + } + else + { + print "\n"; + } + print "\n"; + $paye[1] = "payée"; + $paye[0] = "non payée"; + print "\n"; + print "\n"; + $i++; + } + $db->free(); } - - while ($i < $num && $i < 5) + else { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - if ($objp->df > 0 ) - { - print "\n"; - } - else - { - print "\n"; - } - print "\n"; - $paye[1] = "payée"; - $paye[0] = "non payée"; - print "\n"; - print "\n"; - $i++; + print $db->error(); } - $db->free(); + print "
idp\">liste des factures ($num)
idp\">liste des factures ($num)
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!".number_format($objp->amount, 2, ',', ' ')."".$paye[$objp->paye]."
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!".number_format($objp->amount, 2, ',', ' ')."".$paye[$objp->paye]."
"; } - else - { - print $db->error(); - } - print ""; - /* diff --git a/htdocs/pre.inc.php3 b/htdocs/pre.inc.php3 index 44c26bf3ced..2bbaa7190a6 100644 --- a/htdocs/pre.inc.php3 +++ b/htdocs/pre.inc.php3 @@ -51,14 +51,16 @@ function llxHeader($head = "") { $menu->add_submenu(DOL_URL_ROOT."/comm/clients.php3", "Clients"); - $menu->add_submenu(DOL_URL_ROOT."/comm/propal.php3", "Propales"); + if ($user->rights->propale->lire) + $menu->add_submenu(DOL_URL_ROOT."/comm/propal.php3", "Propales"); } if ($conf->compta->enabled ) { $menu->add(DOL_URL_ROOT."/compta/", "Comptabilité"); - $menu->add_submenu(DOL_URL_ROOT."/compta/facture.php3", "Factures"); + if ($user->rights->facture->lire) + $menu->add_submenu(DOL_URL_ROOT."/compta/facture.php3", "Factures"); } if ($conf->fichinter->enabled )