From 7683f0f85e07514e13eea2bfa4e6abee4c80823e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jan 2009 13:20:26 +0000 Subject: [PATCH] Removed PHP warnings with E_ALL level --- htdocs/admin/index.php | 8 ++- htdocs/admin/modules.php | 70 ++++++++++--------- htdocs/admin/pre.inc.php | 8 +-- .../modules/modComptabiliteExpert.class.php | 3 +- htdocs/includes/modules/modProduit.class.php | 6 +- htdocs/master.inc.php | 2 +- 6 files changed, 50 insertions(+), 47 deletions(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 167bd8ac8b2..a7b7b1512ea 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,9 +31,11 @@ $langs->load("companies"); if (!$user->admin) accessforbidden(); +$mesg=''; + /* - * Affichage page + * View */ llxHeader(); @@ -46,7 +48,7 @@ print_fiche_titre($langs->trans("SetupArea"),'','setup'); print "
"; print '
Dolibarr logo

'; -if ($message) print $message.'
'; +if ($mesg) print $mesg.'
'; print "
"; print $langs->trans("SetupDescription1")."
"; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 297d5799ab4..c4e89d7f51e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /** * \file htdocs/admin/modules.php * \brief Page de configuration et activation des modules @@ -39,7 +39,7 @@ if (!$user->admin) * Actions */ -if ($_GET["action"] == 'set' && $user->admin) +if (isset($_GET["action"]) && $_GET["action"] == 'set' && $user->admin) { $result=Activate($_GET["value"]); $mesg=''; @@ -48,7 +48,7 @@ if ($_GET["action"] == 'set' && $user->admin) exit; } -if ($_GET["action"] == 'reset' && $user->admin) +if (isset($_GET["action"]) && $_GET["action"] == 'reset' && $user->admin) { $result=UnActivate($_GET["value"]); $mesg=''; @@ -70,21 +70,21 @@ function Activate($value,$withdeps=1) $modName = $value; $ret=''; - + // Activation du module if ($modName) { $file = $modName . ".class.php"; - + // Loop on each directory foreach ($conf->dol_document_root as $dol_document_root) { $found=@include_once($dol_document_root."/includes/modules/".$file); if ($found) break; } - + $objMod = new $modName($db); - + // Test si version PHP ok $verphp=versionphparray(); $vermin=$objMod->phpmin; @@ -92,7 +92,7 @@ function Activate($value,$withdeps=1) { return $langs->trans("ErrorModuleRequirePHPVersion",versiontostring($vermin)); } - + // Test si version Dolibarr ok $verdol=versiondolibarrarray(); $vermin=$objMod->need_dolibarr_version; @@ -112,7 +112,7 @@ function Activate($value,$withdeps=1) { Activate($objMod->depends[$i]); } - + // Desactivation des modules qui entrent en conflit for ($i = 0; $i < sizeof($objMod->conflictwith); $i++) { @@ -147,7 +147,7 @@ function UnActivate($value,$requiredby=1) { $found=@include_once($dol_document_root."/includes/modules/".$file); if ($found) break; - } + } if ($found) { @@ -204,7 +204,7 @@ foreach ($conf->dol_document_root as $dirroot) // Load modules attributes in arrays (name, numero, orders) from dir directory //print $dir."\n
"; $handle=opendir($dir); - if ($handle) + if ($handle) { while (($file = readdir($handle))!==false) { @@ -212,12 +212,12 @@ foreach ($conf->dol_document_root as $dirroot) if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') { $modName = substr($file, 0, strlen($file) - 10); - + if ($modName) { include_once($dir.$file); $objMod = new $modName($db); - + if ($objMod->numero > 0) { $j = $objMod->numero; @@ -226,26 +226,27 @@ foreach ($conf->dol_document_root as $dirroot) { $j = 1000 + $i; } - + $modulequalified=1; - + // We discard modules that does not respect constraint on menu handlers - if ($objMod->needleftmenu && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0; - if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0; - + if (! empty($objMod->needleftmenu) && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0; + if (! empty($objMod->needtopmenu) && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0; + // We discard modules according to features level (PS: if module is activated we always show it) $const_name = 'MAIN_MODULE_'.strtoupper(eregi_replace('^mod','',get_class($objMod))); if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; - + if ($modulequalified) { $modules[$i] = $objMod; $filename[$i]= $modName; $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module //print "x".$modName." ".$orders[$i]."\n
"; - $categ[$objMod->special]++; // Array of all different modules categories - $dirmod[$i] = $dirroot; + if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories + else $categ[$objMod->special]=1; + $dirmod[$i] = $dirroot; $j++; $i++; } @@ -272,7 +273,7 @@ print "
\n"; $h = 0; $categidx=0; -if ($categ[$categidx]) +if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; $head[$h][1] = $langs->trans("ModulesCommon"); @@ -281,7 +282,7 @@ if ($categ[$categidx]) } $categidx=1; -if ($categ[$categidx]) +if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; $head[$h][1] = $langs->trans("ModulesInterfaces"); @@ -290,7 +291,7 @@ if ($categ[$categidx]) } $categidx=2; -if ($categ[$categidx]) +if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; $head[$h][1] = $langs->trans("ModulesOther"); @@ -299,7 +300,7 @@ if ($categ[$categidx]) } $categidx=3; -if ($categ[$categidx]) +if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; $head[$h][1] = $langs->trans("ModulesJob"); @@ -327,7 +328,8 @@ print "\n"; // Affichage liste modules -$var=True; +$var=true; +$oldfamily=''; $familylib=array( 'base'=>$langs->trans("ModuleFamilyBase"), @@ -351,14 +353,14 @@ foreach ($orders as $key => $value) $const_name = 'MAIN_MODULE_'.strtoupper(eregi_replace('^mod','',get_class($objMod))); // Load all lang files of module - if (is_array($objMod->langfiles)) + if (isset($objMod->langfiles) && is_array($objMod->langfiles)) { foreach($objMod->langfiles as $domain) { $langs->load($domain); } } - + // Print a separator if we change family if ($oldfamily && $family!=$oldfamily && $atleastoneforfamily) { print "\n \n\n"; @@ -387,7 +389,7 @@ foreach ($orders as $key => $value) } print "\n"; print ' '; - print $objMod->picto?img_object('',$objMod->picto):img_object('','generic'); + print ! empty($objMod->picto)?img_object('',$objMod->picto):img_object('','generic'); print ''.$objMod->getName(); print "\n "; print nl2br($objMod->getDesc()); @@ -397,7 +399,7 @@ foreach ($orders as $key => $value) // print $objMod->getDbVersion(); print "\n "; - if ($conf->global->$const_name) + if (! empty($conf->global->$const_name)) { print img_tick(); } @@ -408,13 +410,13 @@ foreach ($orders as $key => $value) print "\n "; - if ($conf->global->$const_name) + if (! empty($conf->global->$const_name)) { // Module actif - if ($objMod->always_enabled) print $langs->trans("Required"); + if (! empty($objMod->always_enabled)) print $langs->trans("Required"); else print "numero."&action=reset&value=" . $modName . "&mode=" . $mode . "\">" . $langs->trans("Disable") . "\n"; - if ($objMod->config_page_url) + if (! empty($objMod->config_page_url)) { if (is_array($objMod->config_page_url)) { @@ -450,7 +452,7 @@ foreach ($orders as $key => $value) } else { - if ($objMod->always_enabled) + if (! empty($objMod->always_enabled)) { // Ne devrait pas arriver. } diff --git a/htdocs/admin/pre.inc.php b/htdocs/admin/pre.inc.php index e2eb0648d68..81dcc72c1a2 100644 --- a/htdocs/admin/pre.inc.php +++ b/htdocs/admin/pre.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Simon Tosser * * This program is free software; you can redistribute it and/or modify @@ -35,10 +35,10 @@ function llxHeader($head = '', $title='', $help_url='') { global $conf, $user, $langs; - top_menu($head, $title, $target); + top_menu($head, $title, ''); $menuarray=array(); - + //if ($conf->left_menu == 'rodolphe.php') //{ $langs->load("admin"); @@ -60,7 +60,7 @@ function llxHeader($head = '', $title='', $help_url='') $menu->add(DOL_URL_ROOT."/admin/tools/", $langs->trans("Tools")); $varmenuarray=$menu->liste; //} - + left_menu($varmenuarray, $help_url); } diff --git a/htdocs/includes/modules/modComptabiliteExpert.class.php b/htdocs/includes/modules/modComptabiliteExpert.class.php index f015cdff003..3345715c827 100644 --- a/htdocs/includes/modules/modComptabiliteExpert.class.php +++ b/htdocs/includes/modules/modComptabiliteExpert.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * @@ -81,7 +81,6 @@ class modComptabiliteExpert extends DolibarrModules $this->dirs[0] = $conf->comptaexpert->dir_output; $this->dirs[1] = $conf->comptaexpert->dir_output."/rapport"; $this->dirs[2] = $conf->comptaexpert->dir_output."/export"; - $this->dirs[3] = $conf->comptaexpert->dir_images; // Boites $this->boxes = array(); diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php index 03e6df262cf..e5532ebf4cf 100644 --- a/htdocs/includes/modules/modProduit.class.php +++ b/htdocs/includes/modules/modProduit.class.php @@ -60,7 +60,7 @@ class modProduit extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; - + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto='product'; @@ -152,7 +152,7 @@ class modProduit extends DolibarrModules $r=0; $r++; - $this->import_code[$r]=$this->id.'_'.$r; + $this->import_code[$r]=$this->rights_class.'_'.$r; $this->import_label[$r]="ProductsOrServices"; // Translation key $this->import_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.envente'=>"OnSell",'p.duration'=>"Duration"); $this->import_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>'product','p.envente'=>"product",'p.duration'=>"product"); @@ -161,7 +161,7 @@ class modProduit extends DolibarrModules if($conf->global->PRODUIT_MULTIPRICES) { $this->import_multiprices[$r]=array(); - + for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) { $this->import_multiprices[$r][$i]["price_ht"] = "SellingPriceHT ".$i; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index f18dd8c688d..80cc00d1a39 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -57,8 +57,8 @@ else } // Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL) -//error_reporting(E_ALL); error_reporting(E_ALL ^ E_NOTICE); +error_reporting(E_ALL); // Include configuration