Fix: Fix pb in dynamic disabling module feature

This commit is contained in:
Laurent Destailleur 2008-12-05 12:16:33 +00:00
parent 5eb51bbc0d
commit 4d39be7b11
11 changed files with 42 additions and 30 deletions

View File

@ -90,7 +90,16 @@ class InfoBox
$box->position=$obj->position; $box->position=$obj->position;
$box->box_order=$obj->box_order; $box->box_order=$obj->box_order;
$box->fk_user=$obj->fk_user; $box->fk_user=$obj->fk_user;
$boxes[]=$box; $enabled=true;
if ($box->depends && sizeof($box->depends) > 0)
{
foreach($box->depends as $module)
{
// print $module.'<br>';
if (empty($conf->$module->enabled)) $enabled=false;
}
}
if ($enabled) $boxes[]=$box;
$j++; $j++;
} }
} }
@ -128,7 +137,16 @@ class InfoBox
$box->position=$obj->position; $box->position=$obj->position;
$box->box_order=$obj->box_order; $box->box_order=$obj->box_order;
$box->fk_user=$obj->fk_user; $box->fk_user=$obj->fk_user;
$boxes[]=$box; $enabled=true;
if ($box->depends && sizeof($box->depends) > 0)
{
foreach($box->depends as $module)
{
// print $module.'<br>';
if (empty($conf->$module->enabled)) $enabled=false;
}
}
if ($enabled) $boxes[]=$box;
$j++; $j++;
} }
} }

View File

@ -34,7 +34,7 @@ class box_actions extends ModeleBoxes {
var $boxcode="lastactions"; var $boxcode="lastactions";
var $boximg="object_action"; var $boximg="object_action";
var $boxlabel; var $boxlabel;
var $depends = array("action"); var $depends = array("agenda");
var $db; var $db;
var $param; var $param;

View File

@ -14,15 +14,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/includes/boxes/box_bookmarks.php \file htdocs/includes/boxes/box_bookmarks.php
\ingroup bookmark \ingroup bookmark
\brief Module de génération de l'affichage de la box bookmark \brief Module de génération de l'affichage de la box bookmark
\version $Id$
*/ */
@ -34,7 +32,7 @@ class box_bookmarks extends ModeleBoxes {
var $boxcode="bookmarks"; var $boxcode="bookmarks";
var $boximg="object_bookmark"; var $boximg="object_bookmark";
var $boxlabel; var $boxlabel;
var $depends = array(); var $depends = array("bookmark");
var $db; var $db;
var $param; var $param;

View File

@ -33,7 +33,7 @@ class box_commandes extends ModeleBoxes {
var $boxcode="lastcustomerorders"; var $boxcode="lastcustomerorders";
var $boximg="object_order"; var $boximg="object_order";
var $boxlabel; var $boxlabel;
var $depends = array("commercial"); var $depends = array("commandes");
var $db; var $db;
var $param; var $param;

View File

@ -15,15 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/includes/boxes/box_comptes.php \file htdocs/includes/boxes/box_comptes.php
\ingroup banque \ingroup banque
\brief Module de génération de l'affichage de la box comptes \brief Module de génération de l'affichage de la box comptes
\version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");

View File

@ -35,7 +35,7 @@ class box_external_rss extends ModeleBoxes {
var $boxcode="lastrssinfos"; var $boxcode="lastrssinfos";
var $boximg="object_rss"; var $boximg="object_rss";
var $boxlabel; var $boxlabel;
var $depends = array(); var $depends = array("externalrss");
var $db; var $db;
var $param; var $param;

View File

@ -15,15 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/includes/boxes/box_fournisseurs.php \file htdocs/includes/boxes/box_fournisseurs.php
\ingroup fournisseurs \ingroup fournisseurs
\brief Module de génération de l'affichage de la box fournisseurs \brief Module de génération de l'affichage de la box fournisseurs
\version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");

View File

@ -35,7 +35,7 @@ class box_prospect extends ModeleBoxes {
var $boxcode="lastprospects"; var $boxcode="lastprospects";
var $boximg="object_company"; var $boximg="object_company";
var $boxlabel; var $boxlabel;
var $depends = array("commercial"); var $depends = array("societe");
var $db; var $db;
var $param; var $param;

View File

@ -71,8 +71,8 @@ class modAgenda extends DolibarrModules
//------------- //-------------
$this->config_page_url = array("agenda.php"); $this->config_page_url = array("agenda.php");
// Dependances // Dependancies
//------------ //-------------
$this->depends = array(); $this->depends = array();
$this->requiredby = array(); $this->requiredby = array();
$this->langfiles = array("companies"); $this->langfiles = array("companies");

View File

@ -15,18 +15,18 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/** \defgroup externalrss Module externalrss
\brief Module pour inclure des informations externes RSS
*/ */
/** /**
\file htdocs/includes/modules/modExternalRss.class.php * \defgroup externalrss Module externalrss
\ingroup externalrss * \brief Module pour inclure des informations externes RSS
\brief Fichier de description et activation du module externalrss * \version $Id$
*/
/**
* \file htdocs/includes/modules/modExternalRss.class.php
* \ingroup externalrss
* \brief Fichier de description et activation du module externalrss
*/ */
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");

View File

@ -37,13 +37,13 @@ $demoprofiles=array(
array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation',
'disablemodules'=>'banque,barcode,bookmark,boutique,cashdesk,commercial,commande,comptabilite,contrat,expedition,facture,fournisseur,prelevement,produit,projet,service,societe,stock,tax'), 'disablemodules'=>'banque,barcode,bookmark,boutique,cashdesk,commercial,commande,comptabilite,contrat,expedition,facture,fournisseur,prelevement,produit,projet,service,societe,stock,tax'),
array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2',
'disablemodules'=>'barcode,boutique,bookmark,cashdesk,commercial,contrat,facture,commande,fournisseur,prelevement,produit,projet,service,societe,stock'), 'disablemodules'=>'barcode,boutique,bookmark,cashdesk,commercial,contrat,expedition,facture,commande,fournisseur,prelevement,produit,projet,service,societe,stock'),
array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly',
'disablemodules'=>'adherent,barcode,boutique,bookmark,cashdesk,don,prelevement,produit,projet,stock'), 'disablemodules'=>'adherent,barcode,boutique,bookmark,cashdesk,don,expedition,prelevement,projet,stock'),
array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk',
'disablemodules'=>'adherent,boutique,bookmark,don,prelevement,produit,stock'), 'disablemodules'=>'adherent,boutique,bookmark,don,prelevement,produit,stock'),
array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
'disablemodules'=>'adherent,boutique,bookmark,cashdesk,don,prelevement,produit,stock'), 'disablemodules'=>'adherent,boutique,bookmark,cashdesk,don,prelevement,service'),
array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll', array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll',
'disablemodules'=>'adherent,boutique,bookmark,cashdesk,don'), 'disablemodules'=>'adherent,boutique,bookmark,cashdesk,don'),
); );