From 4d39be7b110ff531dc7c112161b1604e195ba6d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Dec 2008 12:16:33 +0000 Subject: [PATCH] Fix: Fix pb in dynamic disabling module feature --- htdocs/boxes.php | 22 +++++++++++++++++-- htdocs/includes/boxes/box_actions.php | 2 +- htdocs/includes/boxes/box_bookmarks.php | 6 ++--- htdocs/includes/boxes/box_commandes.php | 2 +- htdocs/includes/boxes/box_comptes.php | 4 +--- htdocs/includes/boxes/box_external_rss.php | 2 +- htdocs/includes/boxes/box_fournisseurs.php | 4 +--- htdocs/includes/boxes/box_prospect.php | 2 +- htdocs/includes/modules/modAgenda.class.php | 4 ++-- .../includes/modules/modExternalRss.class.php | 18 +++++++-------- htdocs/public/demo/index.php | 6 ++--- 11 files changed, 42 insertions(+), 30 deletions(-) diff --git a/htdocs/boxes.php b/htdocs/boxes.php index 98f2e04c0da..abb4213fd3c 100644 --- a/htdocs/boxes.php +++ b/htdocs/boxes.php @@ -90,7 +90,16 @@ class InfoBox $box->position=$obj->position; $box->box_order=$obj->box_order; $box->fk_user=$obj->fk_user; - $boxes[]=$box; + $enabled=true; + if ($box->depends && sizeof($box->depends) > 0) + { + foreach($box->depends as $module) + { +// print $module.'
'; + if (empty($conf->$module->enabled)) $enabled=false; + } + } + if ($enabled) $boxes[]=$box; $j++; } } @@ -128,7 +137,16 @@ class InfoBox $box->position=$obj->position; $box->box_order=$obj->box_order; $box->fk_user=$obj->fk_user; - $boxes[]=$box; + $enabled=true; + if ($box->depends && sizeof($box->depends) > 0) + { + foreach($box->depends as $module) + { +// print $module.'
'; + if (empty($conf->$module->enabled)) $enabled=false; + } + } + if ($enabled) $boxes[]=$box; $j++; } } diff --git a/htdocs/includes/boxes/box_actions.php b/htdocs/includes/boxes/box_actions.php index 42f6287453e..18ae2164b47 100644 --- a/htdocs/includes/boxes/box_actions.php +++ b/htdocs/includes/boxes/box_actions.php @@ -34,7 +34,7 @@ class box_actions extends ModeleBoxes { var $boxcode="lastactions"; var $boximg="object_action"; var $boxlabel; - var $depends = array("action"); + var $depends = array("agenda"); var $db; var $param; diff --git a/htdocs/includes/boxes/box_bookmarks.php b/htdocs/includes/boxes/box_bookmarks.php index f7d9af2c331..cc1b8fb8580 100644 --- a/htdocs/includes/boxes/box_bookmarks.php +++ b/htdocs/includes/boxes/box_bookmarks.php @@ -14,15 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/includes/boxes/box_bookmarks.php \ingroup 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 $boximg="object_bookmark"; var $boxlabel; - var $depends = array(); + var $depends = array("bookmark"); var $db; var $param; diff --git a/htdocs/includes/boxes/box_commandes.php b/htdocs/includes/boxes/box_commandes.php index 34969e67be7..621192b9f8f 100644 --- a/htdocs/includes/boxes/box_commandes.php +++ b/htdocs/includes/boxes/box_commandes.php @@ -33,7 +33,7 @@ class box_commandes extends ModeleBoxes { var $boxcode="lastcustomerorders"; var $boximg="object_order"; var $boxlabel; - var $depends = array("commercial"); + var $depends = array("commandes"); var $db; var $param; diff --git a/htdocs/includes/boxes/box_comptes.php b/htdocs/includes/boxes/box_comptes.php index 330375fd092..4cfabe23061 100644 --- a/htdocs/includes/boxes/box_comptes.php +++ b/htdocs/includes/boxes/box_comptes.php @@ -15,15 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/includes/boxes/box_comptes.php \ingroup banque \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"); diff --git a/htdocs/includes/boxes/box_external_rss.php b/htdocs/includes/boxes/box_external_rss.php index a473496d727..b45e1be015b 100644 --- a/htdocs/includes/boxes/box_external_rss.php +++ b/htdocs/includes/boxes/box_external_rss.php @@ -35,7 +35,7 @@ class box_external_rss extends ModeleBoxes { var $boxcode="lastrssinfos"; var $boximg="object_rss"; var $boxlabel; - var $depends = array(); + var $depends = array("externalrss"); var $db; var $param; diff --git a/htdocs/includes/boxes/box_fournisseurs.php b/htdocs/includes/boxes/box_fournisseurs.php index 4e4adc8db11..220b1e542fe 100644 --- a/htdocs/includes/boxes/box_fournisseurs.php +++ b/htdocs/includes/boxes/box_fournisseurs.php @@ -15,15 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/includes/boxes/box_fournisseurs.php \ingroup 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"); diff --git a/htdocs/includes/boxes/box_prospect.php b/htdocs/includes/boxes/box_prospect.php index aa88619af70..dd8d1e899fe 100644 --- a/htdocs/includes/boxes/box_prospect.php +++ b/htdocs/includes/boxes/box_prospect.php @@ -35,7 +35,7 @@ class box_prospect extends ModeleBoxes { var $boxcode="lastprospects"; var $boximg="object_company"; var $boxlabel; - var $depends = array("commercial"); + var $depends = array("societe"); var $db; var $param; diff --git a/htdocs/includes/modules/modAgenda.class.php b/htdocs/includes/modules/modAgenda.class.php index 45b4ed9ed9a..11c3743b89a 100644 --- a/htdocs/includes/modules/modAgenda.class.php +++ b/htdocs/includes/modules/modAgenda.class.php @@ -71,8 +71,8 @@ class modAgenda extends DolibarrModules //------------- $this->config_page_url = array("agenda.php"); - // Dependances - //------------ + // Dependancies + //------------- $this->depends = array(); $this->requiredby = array(); $this->langfiles = array("companies"); diff --git a/htdocs/includes/modules/modExternalRss.class.php b/htdocs/includes/modules/modExternalRss.class.php index 7e0bddff658..be90aefd7cd 100644 --- a/htdocs/includes/modules/modExternalRss.class.php +++ b/htdocs/includes/modules/modExternalRss.class.php @@ -15,18 +15,18 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 - \ingroup externalrss - \brief Fichier de description et activation du module externalrss + * \defgroup externalrss Module externalrss + * \brief Module pour inclure des informations externes RSS + * \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"); diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index e2b1aac6be3..9149ce60429 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -37,13 +37,13 @@ $demoprofiles=array( 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'), 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', - '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', 'disablemodules'=>'adherent,boutique,bookmark,don,prelevement,produit,stock'), 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', 'disablemodules'=>'adherent,boutique,bookmark,cashdesk,don'), );