Fix: La gestion des permissions sur les boxes n'était pas assurée.
This commit is contained in:
parent
c6da0ff43b
commit
d374e082c9
@ -63,6 +63,8 @@ class box_boutique_livre extends ModeleBoxes {
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastBooks",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastBooks",$max));
|
||||||
|
|
||||||
|
if ($user->rights->boutique->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT l.ref, l.title, l.rowid";
|
$sql = "SELECT l.ref, l.title, l.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
|
$sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
|
||||||
$sql .= " ORDER BY l.date_ajout DESC ";
|
$sql .= " ORDER BY l.date_ajout DESC ";
|
||||||
@ -72,7 +74,7 @@ class box_boutique_livre extends ModeleBoxes {
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
@ -88,6 +90,14 @@ class box_boutique_livre extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,8 @@ class box_clients extends ModeleBoxes {
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomers",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomers",$max));
|
||||||
|
|
||||||
|
if ($user->rights->societe->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT s.nom,s.idp";
|
$sql = "SELECT s.nom,s.idp";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 1";
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
@ -75,7 +77,7 @@ class box_clients extends ModeleBoxes {
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
@ -91,6 +93,14 @@ class box_clients extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,13 +58,13 @@ class box_commandes extends ModeleBoxes {
|
|||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
|
||||||
if ($user->rights->commande->lire)
|
|
||||||
{
|
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerOrders",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerOrders",$max));
|
||||||
|
|
||||||
|
if ($user->rights->commande->lire)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.date_commande")." as dp,p.rowid";
|
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.date_commande")." as dp,p.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p WHERE p.fk_soc = s.idp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p WHERE p.fk_soc = s.idp";
|
||||||
if($user->societe_id)
|
if($user->societe_id)
|
||||||
@ -97,6 +97,13 @@ class box_commandes extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,12 +59,12 @@ class box_factures extends ModeleBoxes {
|
|||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
|
||||||
if ($user->rights->facture->lire)
|
|
||||||
{
|
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerBills",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerBills",$max));
|
||||||
|
|
||||||
|
if ($user->rights->facture->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
|
||||||
if($user->societe_id)
|
if($user->societe_id)
|
||||||
@ -99,6 +99,10 @@ class box_factures extends ModeleBoxes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
|
|||||||
@ -97,6 +97,13 @@ class box_factures_fourn extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,13 +58,13 @@ class box_factures_fourn_imp extends ModeleBoxes {
|
|||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
|
||||||
if ($user->rights->facture->lire)
|
|
||||||
{
|
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedSupplierBills",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedSupplierBills",$max));
|
||||||
|
|
||||||
|
if ($user->rights->facture->lire)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1";
|
||||||
if($user->societe_id)
|
if($user->societe_id)
|
||||||
@ -97,9 +97,16 @@ class box_factures_fourn_imp extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -105,6 +105,10 @@ class box_factures_imp extends ModeleBoxes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
|
|||||||
@ -61,6 +61,8 @@ class box_fournisseurs extends ModeleBoxes {
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max));
|
||||||
|
|
||||||
|
if ($user->rights->societe->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT s.nom,s.idp";
|
$sql = "SELECT s.nom,s.idp";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
@ -90,6 +92,14 @@ class box_fournisseurs extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,8 @@ class box_osc_clients extends ModeleBoxes {
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max));
|
||||||
|
|
||||||
|
if ($user->rights->boutique->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT count(*) as cus FROM ".DB_NAME_OSC.".customers";
|
$sql = "SELECT count(*) as cus FROM ".DB_NAME_OSC.".customers";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -82,6 +84,14 @@ class box_osc_clients extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -93,6 +93,10 @@ class box_produits extends ModeleBoxes {
|
|||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
|
|||||||
@ -59,12 +59,13 @@ class box_propales extends ModeleBoxes {
|
|||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
|
||||||
if ($user->rights->propale->lire)
|
|
||||||
{
|
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals",$max));
|
||||||
|
|
||||||
|
if ($user->rights->propale->lire)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.datep")." as dp,p.rowid";
|
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.datep")." as dp,p.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p WHERE p.fk_soc = s.idp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p WHERE p.fk_soc = s.idp";
|
||||||
if($user->societe_id)
|
if($user->societe_id)
|
||||||
@ -97,7 +98,13 @@ class box_propales extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,8 @@ class box_prospect extends ModeleBoxes {
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProspects",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProspects",$max));
|
||||||
|
|
||||||
|
if ($user->rights->societe->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT s.nom,s.idp";
|
$sql = "SELECT s.nom,s.idp";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 2";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 2";
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
@ -76,7 +78,7 @@ class box_prospect extends ModeleBoxes {
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
@ -94,6 +96,11 @@ class box_prospect extends ModeleBoxes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -62,6 +62,8 @@ class box_services_vendus extends ModeleBoxes {
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max));
|
||||||
|
|
||||||
|
if ($user->rights->produit->lire)
|
||||||
|
{
|
||||||
$sql = "SELECT s.nom, s.idp, p.label, p.fk_product_type, c.rowid";
|
$sql = "SELECT s.nom, s.idp, p.label, p.fk_product_type, c.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."product as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql .= " WHERE s.idp = c.fk_soc AND c.fk_product = p.rowid";
|
$sql .= " WHERE s.idp = c.fk_soc AND c.fk_product = p.rowid";
|
||||||
@ -76,7 +78,7 @@ class box_services_vendus extends ModeleBoxes {
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
@ -96,6 +98,14 @@ class box_services_vendus extends ModeleBoxes {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user