Fix: Pb test sur habilitations des charges et menu banque

This commit is contained in:
Laurent Destailleur 2006-08-16 22:06:10 +00:00
parent ccb131f29e
commit 4c4627b8eb
7 changed files with 58 additions and 19 deletions

View File

@ -56,7 +56,7 @@ function llxHeader($head = "")
while ($i < $numr) while ($i < $numr)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$menu->add(DOL_URL_ROOT."/compta/bank/fiche.php?id=".$objp->rowid, $objp->label); $menu->add(DOL_URL_ROOT."/compta/bank/fiche.php?id=".$objp->rowid,$objp->label,0,$user->rights->banque->lire);
/* /*
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting")); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting"));
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph")); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph"));
@ -67,18 +67,18 @@ function llxHeader($head = "")
} }
$db->free($resql); $db->free($resql);
} }
$menu->add(DOL_URL_ROOT."/compta/bank/index.php",$langs->trans("MenuBankCash")); $menu->add(DOL_URL_ROOT."/compta/bank/index.php",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire);
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/categ.php",$langs->trans("Categories"),1,$user->rights->banque->configurer); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/categ.php",$langs->trans("Categories"),1,$user->rights->banque->configurer);
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/search.php",$langs->trans("SearchTransaction")); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/search.php",$langs->trans("SearchTransaction"),1,$user->rights->banque->lire);
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/budget.php",$langs->trans("ByCategories")); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/budget.php",$langs->trans("ByCategories"),1,$user->rights->banque->lire);
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/bilan.php","Bilan"); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/bilan.php","Bilan",1,$user->rights->banque->lire);
if ($user->rights->banque->modifier) if ($user->rights->banque->modifier)
{ {
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/virement.php",$langs->trans("Virements")); $menu->add_submenu(DOL_URL_ROOT."/compta/bank/virement.php",$langs->trans("Virements"),1,$user->rights->banque->modifier);
} }
if ($conf->global->COMPTA_ONLINE_PAYMENT_BPLC) if ($conf->global->COMPTA_ONLINE_PAYMENT_BPLC)

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,7 +18,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -30,18 +29,18 @@
require("./pre.inc.php"); require("./pre.inc.php");
llxHeader();
$user->getrights('compta'); $user->getrights('compta');
if (!$user->admin && !$user->rights->compta->charges) if (!$user->admin && !$user->rights->tax->charges->lire)
accessforbidden(); accessforbidden();
$year=$_GET["year"]; $year=$_GET["year"];
$filtre=$_GET["filtre"]; $filtre=$_GET["filtre"];
if (! $year) { $year=date("Y", time()); } if (! $year) { $year=date("Y", time()); }
llxHeader();
print_fiche_titre($langs->trans("Charges"),($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"")); print_fiche_titre($langs->trans("Charges"),($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":""));
print "<br>"; print "<br>";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -34,7 +34,7 @@ require(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
$user->getrights('facture'); $user->getrights('facture');
$user->getrights('compta'); $user->getrights('compta');
if (!$user->admin && !$user->rights->compta->charges->lire) if (!$user->admin && ! $user->rights->tax->charges->lire)
accessforbidden(); accessforbidden();

View File

@ -356,12 +356,11 @@ class MenuLeft {
$langs->load("trips"); $langs->load("trips");
$newmenu->add(DOL_URL_ROOT."/compta/deplacement/index.php?leftmenu=deplacement&mainmenu=accountancy", $langs->trans("Trips"), 0, $user->rights->deplacement->lire); $newmenu->add(DOL_URL_ROOT."/compta/deplacement/index.php?leftmenu=deplacement&mainmenu=accountancy", $langs->trans("Trips"), 0, $user->rights->deplacement->lire);
} }
// Charges sociales // Charges sociales
if ($conf->tax->enabled) if ($conf->tax->enabled)
{ {
$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->tax->charges->lire); $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->tax->charges->lire);
if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->tax->charges->creer); if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->tax->charges->lire);
} }
// Charges tva // Charges tva

View File

@ -292,6 +292,7 @@ AmountInCurrency=Amount in %s currency
Example=Example Example=Example
NoExample=No example NoExample=No example
FindBug=Report a bug FindBug=Report a bug
NbOfThirdParties=Number of third parties
NbOfCustomers=Number of customers NbOfCustomers=Number of customers
NbOfLines=Number of lines NbOfLines=Number of lines
NbOfObjects=Number of objects NbOfObjects=Number of objects

View File

@ -292,6 +292,7 @@ AmountInCurrency=Montants exprim
Example=Exemple Example=Exemple
NoExample=Pas d'exemple NoExample=Pas d'exemple
FindBug=Signaler un bug FindBug=Signaler un bug
NbOfThirdParties=Nombre de tiers
NbOfCustomers=Nombre de clients NbOfCustomers=Nombre de clients
NbOfLines=Nombre de lignes NbOfLines=Nombre de lignes
NbOfObjects=Nombre d'objets NbOfObjects=Nombre d'objets

View File

@ -1044,7 +1044,7 @@ class Product
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error().' sql='.$sql;
return -1; return -1;
} }
} }
@ -1084,7 +1084,7 @@ class Product
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error().' sql='.$sql;
return -1; return -1;
} }
} }
@ -1129,6 +1129,45 @@ class Product
} }
} }
/**
* \brief Charge tableau des stats facture pour le produit/service
* \param socid Id societe
* \return array Tableau des stats
*/
function load_stats_facture_fournisseur($socid=0)
{
global $conf;
global $user;
$sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_suppliers, COUNT(DISTINCT f.rowid) as nb,";
$sql.= " COUNT(pd.rowid) as nb_rows, SUM(pd.qty) as qty";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as pd,";
$sql.= " ".MAIN_DB_PREFIX."facture_fourn as f";
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.rowid = pd.fk_facture_fourn AND pd.fk_product = ".$this->id;
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
//$sql.= " AND f.fk_statut != 0";
if ($socid > 0)
{
$sql .= " AND f.fk_soc = $socid";
}
$result = $this->db->query($sql) ;
if ( $result )
{
$obj=$this->db->fetch_object($result);
$this->stats_facture_fournisseur['suppliers']=$obj->nb_suppliers;
$this->stats_facture_fournisseur['nb']=$obj->nb;
$this->stats_facture_fournisseur['rows']=$obj->nb_rows;
$this->stats_facture_fournisseur['qty']=$obj->qty?$obj->qty:0;
return 1;
}
else
{
$this->error=$this->db->error();
return -1;
}
}
/** /**
* \brief Renvoie tableau des stats pour une requete donnée * \brief Renvoie tableau des stats pour une requete donnée