From 4e5eb408a347bb806e06b3aaea5ecfef6ec24921 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2009 20:06:48 +0000 Subject: [PATCH] Fix: Use wrong value of constant if multientity is used. --- htdocs/adherents/cotisations.php | 2 +- htdocs/comm/addpropal.php | 4 ++-- htdocs/comm/prospect/fiche.php | 2 +- htdocs/fichinter/fiche.php | 4 ++-- htdocs/propal.class.php | 15 +++++++++------ 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index befea39d5b2..df7d3c9cf63 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -66,7 +66,7 @@ if (! $user->rights->adherent->cotisation->lire) // Insertion de la cotisation dans le compte banquaire if ($allowinsertbankafter && $_POST["action"] == '2bank' && $_POST["rowid"] !='') { - if (defined("ADHERENT_BANK_USE") && $conf->global->ADHERENT_BANK_USE) + if ($conf->global->ADHERENT_BANK_USE) { if (! $_POST["accountid"]) { diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 3d68ed36893..1af80a52fb6 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -29,9 +29,9 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); require_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php'); -if (defined("PROPALE_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php")) +if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php"); + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php"); } if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php'); diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 98916bb9173..b5e5a9722c0 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -265,7 +265,7 @@ if ($socid > 0) print ''.$langs->trans("AddAction").''; } - if ($conf->propal->enabled && defined("MAIN_MODULE_PROPALE") && MAIN_MODULE_PROPALE && $user->rights->propale->creer) + if ($conf->propal->enabled && $user->rights->propale->creer) { print ''.$langs->trans("AddProp").''; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 3b277f9f68a..bd2905dc3d4 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -36,9 +36,9 @@ if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); require_once(DOL_DOCUMENT_ROOT."/project.class.php"); } -if (defined("FICHEINTER_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/mod_".FICHEINTER_ADDON.".php")) +if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.".php")) { - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/mod_".FICHEINTER_ADDON.".php"); + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.".php"); } $langs->load("companies"); diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index a9af33a243d..30b3eeb8b64 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -726,10 +726,13 @@ class Propal extends CommonObject $object->id=0; $object->statut=0; - if (defined("PROPALE_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php")) + if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php"); + $this->error='ErrorSetupNotComplete'; + return -1; } + + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php"); $obj = $conf->global->PROPALE_ADDON; $modPropale = new $obj; $numpr = $modPropale->getNextValue($soc,$object); @@ -2009,17 +2012,17 @@ class Propal extends CommonObject */ function getNextNumRef($soc) { - global $db, $langs; + global $conf, $db, $langs; $langs->load("propal"); $dir = DOL_DOCUMENT_ROOT . "/includes/modules/propale/"; - if (defined("PROPALE_ADDON") && PROPALE_ADDON) + if (! empty($conf->global->PROPALE_ADDON)) { - $file = PROPALE_ADDON.".php"; + $file = $conf->global->PROPALE_ADDON.".php"; // Chargement de la classe de numerotation - $classname = PROPALE_ADDON; + $classname = $conf->global->PROPALE_ADDON; require_once($dir.$file); $obj = new $classname();