diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 3f848999e46..fefbdd88b7c 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -21,16 +21,19 @@
*/
/**
- \file htdocs/compta/index.php
- \ingroup compta
- \brief Page accueil zone comptabilité
- \version $Revision$
+ \file htdocs/compta/index.php
+ \ingroup compta
+ \brief Page accueil zone comptabilité
+ \version $Revision$
*/
require("./pre.inc.php");
$user->getrights(); // On a besoin des permissions sur plusieurs modules
+if (!$user->rights->compta->general->lire)
+ accessforbidden();
+
$langs->load("compta");
$langs->load("bills");
@@ -38,8 +41,8 @@ $langs->load("bills");
$socidp='';
if ($user->societe_id > 0)
{
- $action = '';
- $socidp = $user->societe_id;
+ $action = '';
+ $socidp = $user->societe_id;
}
@@ -52,22 +55,22 @@ llxHeader("",$langs->trans("AccountancyTreasuryArea"));
if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark')
{
-$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id;
-if (! $db->query($sql) )
-{
- dolibarr_print_error($db);
-}
-$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
-if (! $db->query($sql) )
-{
- dolibarr_print_error($db);
-}
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id;
+ if (! $db->query($sql) )
+ {
+ dolibarr_print_error($db);
+ }
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
+ if (! $db->query($sql) )
+ {
+ dolibarr_print_error($db);
+ }
}
if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
{
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=".$_GET["bid"];
- $result = $db->query($sql);
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=".$_GET["bid"];
+ $result = $db->query($sql);
}
@@ -85,16 +88,17 @@ print '
';
/*
* Zone recherche facture
*/
-if ($conf->facture->enabled) {
- print ' ";
+if ($conf->facture->enabled)
+{
+ print ' ";
}
@@ -102,53 +106,52 @@ if ($conf->facture->enabled) {
* Factures brouillons
*/
if ($conf->facture->enabled && $user->rights->facture->lire)
-{
-
- $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.idp";
- $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
- $sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
-
- if ($socidp)
+{
+ $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.idp";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
+ $sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
+
+ if ($socidp)
{
- $sql .= " AND f.fk_soc = $socidp";
+ $sql .= " AND f.fk_soc = $socidp";
}
-
- $resql = $db->query($sql);
-
- if ( $resql )
+
+ $resql = $db->query($sql);
+
+ if ( $resql )
{
- $num = $db->num_rows($resql);
- if ($num)
+ $num = $db->num_rows($resql);
+ if ($num)
{
- print '';
- print '';
- print '| '.$langs->trans("DraftBills").' ('.$num.') | ';
- $i = 0;
- $tot_ttc = 0;
- $var = True;
- while ($i < $num && $i < 20)
+ print ' ";
+
+ print '| '.$langs->trans("Total").' | ';
+ print ''.price($tot_ttc).' | ';
+ print ' ';
+
+ print " ";
}
- $db->free($resql);
+ $db->free($resql);
}
- else
+ else
{
- dolibarr_print_error($db);
+ dolibarr_print_error($db);
}
}
|