Fix: La gestion des permissions sur les boxes n'était pas assurée.
This commit is contained in:
parent
c6da0ff43b
commit
d374e082c9
@ -63,30 +63,40 @@ 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));
|
||||||
|
|
||||||
$sql = "SELECT l.ref, l.title, l.rowid";
|
if ($user->rights->boutique->lire)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
|
|
||||||
$sql .= " ORDER BY l.date_ajout DESC ";
|
|
||||||
$sql .= $db->plimit($max, 0);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$sql = "SELECT l.ref, l.title, l.rowid";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
|
||||||
|
$sql .= " ORDER BY l.date_ajout DESC ";
|
||||||
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
$i = 0;
|
$result = $db->query($sql);
|
||||||
|
|
||||||
while ($i < $num)
|
if ($result)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
$i = 0;
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => $objp->title,
|
|
||||||
'url' => DOL_URL_ROOT."/boutique/livre/fiche.php?id=".$objp->rowid);
|
|
||||||
|
|
||||||
$i++;
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
|
'logo' => $this->boximg,
|
||||||
|
'text' => $objp->title,
|
||||||
|
'url' => DOL_URL_ROOT."/boutique/livre/fiche.php?id=".$objp->rowid);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,34 +62,44 @@ 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));
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp";
|
if ($user->rights->societe->lire)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 1";
|
|
||||||
if ($user->societe_id > 0)
|
|
||||||
{
|
{
|
||||||
$sql .= " AND s.idp = $user->societe_id";
|
$sql = "SELECT s.nom,s.idp";
|
||||||
}
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 1";
|
||||||
$sql .= " ORDER BY s.datec DESC ";
|
if ($user->societe_id > 0)
|
||||||
$sql .= $db->plimit($max, 0);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$sql .= " AND s.idp = $user->societe_id";
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => stripslashes($objp->nom),
|
|
||||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
$sql .= " ORDER BY s.datec DESC ";
|
||||||
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
|
'logo' => $this->boximg,
|
||||||
|
'text' => stripslashes($objp->nom),
|
||||||
|
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,12 +58,12 @@ class box_commandes extends ModeleBoxes {
|
|||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerOrders",$max));
|
||||||
|
|
||||||
if ($user->rights->commande->lire)
|
if ($user->rights->commande->lire)
|
||||||
{
|
{
|
||||||
$langs->load("boxes");
|
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerOrders",$max));
|
|
||||||
|
|
||||||
$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";
|
||||||
@ -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;
|
||||||
|
|
||||||
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerBills",$max));
|
||||||
|
|
||||||
if ($user->rights->facture->lire)
|
if ($user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
$langs->load("boxes");
|
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerBills",$max));
|
|
||||||
|
|
||||||
$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,12 +58,12 @@ class box_factures_fourn_imp extends ModeleBoxes {
|
|||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedSupplierBills",$max));
|
||||||
|
|
||||||
if ($user->rights->facture->lire)
|
if ($user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
$langs->load("boxes");
|
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedSupplierBills",$max));
|
|
||||||
|
|
||||||
$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";
|
||||||
@ -97,8 +97,15 @@ 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,34 +61,44 @@ 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));
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp";
|
if ($user->rights->societe->lire)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
|
|
||||||
if ($user->societe_id > 0)
|
|
||||||
{
|
{
|
||||||
$sql .= " AND s.idp = $user->societe_id";
|
$sql = "SELECT s.nom,s.idp";
|
||||||
}
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
|
||||||
$sql .= " ORDER BY s.datec DESC ";
|
if ($user->societe_id > 0)
|
||||||
$sql .= $db->plimit($max, 0);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$sql .= " AND s.idp = $user->societe_id";
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => $objp->nom,
|
|
||||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
$sql .= " ORDER BY s.datec DESC ";
|
||||||
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
|
'logo' => $this->boximg,
|
||||||
|
'text' => $objp->nom,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,25 +62,35 @@ 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));
|
||||||
|
|
||||||
$sql = "SELECT count(*) as cus FROM ".DB_NAME_OSC.".customers";
|
if ($user->rights->boutique->lire)
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$sql = "SELECT count(*) as cus FROM ".DB_NAME_OSC.".customers";
|
||||||
|
|
||||||
$i = 0;
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$num = $db->num_rows();
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'center',
|
$i = 0;
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => $objp->cus,
|
while ($i < $num)
|
||||||
'url' => DOL_URL_ROOT."/boutique/client/index.php");
|
{
|
||||||
$i++;
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'center',
|
||||||
|
'logo' => $this->boximg,
|
||||||
|
'text' => $objp->cus,
|
||||||
|
'url' => DOL_URL_ROOT."/boutique/client/index.php");
|
||||||
|
$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,11 +59,12 @@ class box_propales extends ModeleBoxes {
|
|||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs, $db;
|
||||||
|
|
||||||
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals",$max));
|
||||||
|
|
||||||
if ($user->rights->propale->lire)
|
if ($user->rights->propale->lire)
|
||||||
{
|
{
|
||||||
$langs->load("boxes");
|
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals",$max));
|
|
||||||
|
|
||||||
$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";
|
||||||
@ -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,36 +63,43 @@ 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));
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp";
|
if ($user->rights->societe->lire)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 2";
|
|
||||||
if ($user->societe_id > 0)
|
|
||||||
{
|
{
|
||||||
$sql .= " AND s.idp = $user->societe_id";
|
$sql = "SELECT s.nom,s.idp";
|
||||||
}
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 2";
|
||||||
$sql .= " ORDER BY s.datec DESC ";
|
if ($user->societe_id > 0)
|
||||||
$sql .= $db->plimit($max, 0);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$sql .= " AND s.idp = $user->societe_id";
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => stripslashes($objp->nom),
|
|
||||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?id=".$objp->idp);
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
}
|
$sql .= " ORDER BY s.datec DESC ";
|
||||||
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
|
'logo' => $this->boximg,
|
||||||
|
'text' => stripslashes($objp->nom),
|
||||||
|
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?id=".$objp->idp);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
function showBox()
|
||||||
|
|||||||
@ -62,39 +62,49 @@ 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));
|
||||||
|
|
||||||
$sql = "SELECT s.nom, s.idp, p.label, p.fk_product_type, c.rowid";
|
if ($user->rights->produit->lire)
|
||||||
$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";
|
|
||||||
if($user->societe_id)
|
|
||||||
{
|
{
|
||||||
$sql .= " AND s.idp = $user->societe_id";
|
$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 .= " ORDER BY c.tms DESC ";
|
$sql .= " WHERE s.idp = c.fk_soc AND c.fk_product = p.rowid";
|
||||||
$sql .= $db->plimit($max, 0);
|
if($user->societe_id)
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$sql .= " AND s.idp = $user->societe_id";
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
|
||||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
|
||||||
'text' => $objp->label,
|
|
||||||
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
|
||||||
'text' => $objp->nom,
|
|
||||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
$sql .= " ORDER BY c.tms DESC ";
|
||||||
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
|
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||||
|
'text' => $objp->label,
|
||||||
|
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||||
|
'text' => $objp->nom,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||||
|
|
||||||
|
$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