Fix test on permission for widgets
This commit is contained in:
parent
ec24f223b5
commit
bf41056c68
@ -44,6 +44,21 @@ class box_actions extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param='')
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->agenda->myactions->read);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
@ -173,8 +188,8 @@ class box_actions extends ModeleBoxes
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
$out='';
|
||||
$out = parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
|
||||
if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
|
||||
{
|
||||
$actioncejour=false;
|
||||
|
||||
@ -51,11 +51,17 @@ class box_activity extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
// FIXME: Pb into some status
|
||||
$this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous comments)
|
||||
$this->enabled=($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
|
||||
|
||||
$this->hidden= ! ((! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|| (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
|| (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,7 +358,7 @@ class box_activity extends ModeleBoxes
|
||||
}
|
||||
|
||||
// list the summary of the propals
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propalstatic=new Propal($db);
|
||||
@ -456,10 +462,10 @@ class box_activity extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,21 @@ class box_bookmarks extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->bookmark->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
@ -136,11 +151,11 @@ class box_bookmarks extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -58,6 +58,8 @@ class box_clients extends ModeleBoxes
|
||||
|
||||
// disable box for such cases
|
||||
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
|
||||
|
||||
$this->hidden = ! ($user->rights->societe->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,11 +160,11 @@ class box_clients extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -44,6 +44,21 @@ class box_commandes extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->commande->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
@ -177,11 +192,11 @@ class box_commandes extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -61,6 +61,8 @@ class box_comptes extends ModeleBoxes
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
|
||||
|
||||
$this->hidden = ! ($user->rights->banque->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,11 +173,11 @@ class box_comptes extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,6 +45,21 @@ class box_contacts extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->societe->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -164,11 +179,11 @@ class box_contacts extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,21 @@ class box_contracts extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->contrat->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
@ -160,11 +175,11 @@ class box_contracts extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -185,11 +185,11 @@ class box_external_rss extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,6 +42,21 @@ class box_factures extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -181,11 +196,11 @@ class box_factures extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,21 @@ class box_factures_fourn extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -190,11 +205,11 @@ class box_factures_fourn extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,6 +42,21 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -181,11 +196,11 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,6 +45,21 @@ class box_factures_imp extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -184,11 +199,11 @@ class box_factures_imp extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,21 @@ class box_ficheinter extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->ficheinter->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
@ -145,11 +160,11 @@ class box_ficheinter extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,21 @@ class box_fournisseurs extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->societe->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -140,11 +155,11 @@ class box_fournisseurs extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -59,7 +59,9 @@ class box_goodcustomers extends ModeleBoxes
|
||||
|
||||
// disable box for such cases
|
||||
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
|
||||
if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database
|
||||
if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database
|
||||
|
||||
$this->hidden = ! ($user->rights->societe->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,11 +162,11 @@ class box_goodcustomers extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,9 +47,11 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden = ! ($user->rights->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +135,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
if (! $mesg)
|
||||
{
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$px1->SetPrecisionY(0);
|
||||
@ -266,11 +268,11 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,9 +47,11 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden = ! ($user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,11 +265,11 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,9 +47,11 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden = ! ($user->rights->commande->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,11 +266,11 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,9 +47,11 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden = ! ($user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,11 +265,11 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,9 +48,15 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $user, $conf;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden = ! (
|
||||
(! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
|
||||
|| (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire))
|
||||
|| (! empty($conf->propal->enabled) && ! empty($user->rights->propale->lire))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,7 +99,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
}
|
||||
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; }
|
||||
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0;
|
||||
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0;
|
||||
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) $showpropalnb=0;
|
||||
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0;
|
||||
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
@ -188,7 +194,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && ! empty($user->rights->propal->lire))
|
||||
if (! empty($conf->propal->enabled) && ! empty($user->rights->propale->lire))
|
||||
{
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showpropalnb)
|
||||
@ -250,7 +256,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire))
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showordernb)
|
||||
{
|
||||
@ -334,7 +340,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb?' checked':'').'> '.$langs->trans("ForCustomersInvoices");
|
||||
$stringtoshow.=' ';
|
||||
}
|
||||
if (! empty($conf->propal->enabled) || ! empty($user->rights->propal->lire))
|
||||
if (! empty($conf->propal->enabled) || ! empty($user->rights->propale->lire))
|
||||
{
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showpropalnb.'"'.($showpropalnb?' checked':'').'> '.$langs->trans("ForProposals");
|
||||
$stringtoshow.=' ';
|
||||
@ -393,11 +399,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,9 +47,11 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->propale->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +89,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->propal->lire)
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
@ -265,11 +267,11 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -60,6 +60,8 @@ class box_members extends ModeleBoxes
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
|
||||
|
||||
$this->hidden=! ($user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,11 +172,11 @@ class box_members extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,6 +45,21 @@ class box_produits extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->produit->lire || $user->rights->service->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -202,11 +217,11 @@ class box_produits extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,6 +47,21 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param='')
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! (($user->rights->produit->lire || $user->rights->service->lire) && $user->rights->stock->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -214,11 +229,11 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,12 +48,14 @@ class box_project extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param='')
|
||||
{
|
||||
global $langs;
|
||||
global $user, $langs;
|
||||
$langs->load("boxes");
|
||||
$langs->load("projects");
|
||||
|
||||
$this->db = $db;
|
||||
$this->boxlabel="Projects";
|
||||
|
||||
$this->hidden=! ($user->rights->projet->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,16 +79,16 @@ class box_project extends ModeleBoxes
|
||||
|
||||
// list the summary of the orders
|
||||
if ($user->rights->projet->lire) {
|
||||
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||
$projectstatic = new Project($this->db);
|
||||
|
||||
|
||||
$socid=$user->societe_id;
|
||||
|
||||
|
||||
// Get list of project id allowed to user (in a string list separated by coma)
|
||||
$projectsListId='';
|
||||
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
|
||||
@ -96,7 +98,7 @@ class box_project extends ModeleBoxes
|
||||
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
|
||||
|
||||
$sql.= " ORDER BY p.datec DESC";
|
||||
//$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -156,7 +158,7 @@ class box_project extends ModeleBoxes
|
||||
}
|
||||
if ($max < $num)
|
||||
{
|
||||
$this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...');
|
||||
$this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -195,11 +197,11 @@ class box_project extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,21 @@ class box_propales extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->propale->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -167,11 +182,11 @@ class box_propales extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -60,6 +60,8 @@ class box_prospect extends ModeleBoxes
|
||||
|
||||
// disable box for such cases
|
||||
if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option
|
||||
|
||||
$this->hidden=! ($user->rights->societe->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,11 +170,11 @@ class box_prospect extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,21 @@ class box_services_contracts extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->service->lire && $user->rights->contrat->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -173,11 +188,11 @@ class box_services_contracts extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,6 +42,21 @@ class box_services_expired extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->contrat->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
@ -84,7 +99,7 @@ class box_services_expired extends ModeleBoxes
|
||||
$i = 0;
|
||||
|
||||
$thirdpartytmp = new Societe($this->db);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$late='';
|
||||
@ -151,11 +166,11 @@ class box_services_expired extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,21 @@ class box_supplier_orders extends ModeleBoxes
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
|
||||
$this->hidden=! ($user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
@ -172,11 +187,11 @@ class box_supplier_orders extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ class box_task extends ModeleBoxes
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -50,11 +51,13 @@ class box_task extends ModeleBoxes
|
||||
*/
|
||||
function __construct($db,$param='')
|
||||
{
|
||||
global $langs;
|
||||
global $user, $langs;
|
||||
$langs->load("boxes");
|
||||
$langs->load("projects");
|
||||
$this->boxlabel="Tasks";
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->projet->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,10 +141,10 @@ class box_task extends ModeleBoxes
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function showBox($head = null, $contents = null, $nooutput=0)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,10 +49,15 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
public $max = 5;
|
||||
|
||||
/**
|
||||
* @var int Status
|
||||
* @var int Condition to have widget enabled
|
||||
*/
|
||||
public $enabled=1;
|
||||
|
||||
/**
|
||||
* @var int Condition to have widget visible (in most cases, permissions)
|
||||
*/
|
||||
public $hidden=0;
|
||||
|
||||
/**
|
||||
* @var int Box definition database ID
|
||||
*/
|
||||
@ -168,29 +173,29 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Standard method to get content of a box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
function outputBox($head = null, $contents = null)
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
|
||||
|
||||
// Trick to get result into a var from a function that makes print instead of return
|
||||
// TODO Replace ob_start with param nooutput=1 into showBox
|
||||
ob_start();
|
||||
$result = $this->showBox($head, $contents);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
|
||||
*
|
||||
@ -203,6 +208,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
|
||||
if (! empty($this->hidden)) return '\n<!-- Box ".get_class($this)." hidden -->\n'; // Nothing done if hidden (for example when user has no permission)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
|
||||
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
|
||||
@ -365,13 +372,13 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
$out = "<!-- Box ".get_class($this)." from cache -->";
|
||||
$out.= dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
|
||||
if ($nooutput) return $out;
|
||||
else print $out;
|
||||
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -320,7 +320,7 @@ class FormOther
|
||||
{
|
||||
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
|
||||
}
|
||||
|
||||
|
||||
// Load list of "categories"
|
||||
$static_categs = new Categorie($this->db);
|
||||
$tab_categs = $static_categs->get_full_arbo($type);
|
||||
@ -621,12 +621,12 @@ class FormOther
|
||||
$b = hexdec($hexb);
|
||||
}
|
||||
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
|
||||
if ($bright > 0.6) $textcolor='000';
|
||||
if ($bright > 0.6) $textcolor='000';
|
||||
}
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$color = colorArrayToHex(colorStringToArray($color,array()),'');
|
||||
|
||||
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $textifnotdefined;
|
||||
}
|
||||
@ -989,7 +989,7 @@ class FormOther
|
||||
* Class 'Form' must be known.
|
||||
*
|
||||
* @param User $user Object User
|
||||
* @param String $areacode Code of area for pages (0=value for Home page)
|
||||
* @param string $areacode Code of area for pages ('0'=value for Home page)
|
||||
* @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlist'=>)
|
||||
*/
|
||||
static function getBoxesArea($user,$areacode)
|
||||
@ -1002,16 +1002,16 @@ class FormOther
|
||||
|
||||
// $boxactivated will be array of boxes enabled into global setup
|
||||
// $boxidactivatedforuser will be array of boxes choosed by user
|
||||
|
||||
|
||||
$selectboxlist='';
|
||||
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,(empty($user->conf->$confuserzone)?null:$user)); // Search boxes of common+user (or common only if user has no specific setup)
|
||||
|
||||
$boxactivated=InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone)?null:$user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup)
|
||||
|
||||
$boxidactivatedforuser=array();
|
||||
foreach($boxactivated as $box)
|
||||
{
|
||||
if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
|
||||
}
|
||||
|
||||
|
||||
// Define selectboxlist
|
||||
$arrayboxtoactivatelabel=array();
|
||||
if (! empty($user->conf->$confuserzone))
|
||||
|
||||
@ -45,9 +45,10 @@ class InfoBox
|
||||
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
|
||||
* @param User|null $user Object user to filter
|
||||
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
|
||||
* @param int $includehidden Include also hidden boxes
|
||||
* @return array Array of boxes
|
||||
*/
|
||||
static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array())
|
||||
static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array(), $includehidden=1)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -72,7 +73,7 @@ class InfoBox
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
|
||||
$sql.= " WHERE d.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -155,7 +156,7 @@ class InfoBox
|
||||
//print '=>'.$boxname.'-enabled='.$enabled.'<br>';
|
||||
|
||||
//print 'xx module='.$module.' enabled='.$enabled;
|
||||
if ($enabled) $boxes[]=$box;
|
||||
if ($enabled && ($includehidden || empty($box->hidden))) $boxes[]=$box;
|
||||
else unset($box);
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user