Module for mailing selection can be in two different root locations

This commit is contained in:
Laurent Destailleur 2008-05-15 17:59:37 +00:00
parent 6b4fc8c6e9
commit b3fb3c684b

View File

@ -32,7 +32,9 @@ if (! $user->rights->mailing->lire || $user->societe_id > 0)
accessforbidden(); accessforbidden();
$dir=DOL_DOCUMENT_ROOT."/includes/modules/mailings"; $dirmod=DOL_DOCUMENT_ROOT."/includes/modules/mailings";
if (defined('DOL_DOCUMENT_ROOT_BIS')) $dirmod2=DOL_DOCUMENT_ROOT_BIS."/includes/modules/mailings";
$mesg = ''; $mesg = '';
@ -59,7 +61,7 @@ if ($_GET["action"] == 'add')
$modulename=$_GET["module"]; $modulename=$_GET["module"];
// Chargement de la classe // Chargement de la classe
$file = $dir."/".$modulename.".modules.php"; $file = $dirmod."/".$modulename.".modules.php";
$classname = "mailing_".$modulename; $classname = "mailing_".$modulename;
require_once($file); require_once($file);
@ -88,7 +90,7 @@ if ($_GET["action"] == 'add')
if ($_GET["action"] == 'clear') if ($_GET["action"] == 'clear')
{ {
// Chargement de la classe // Chargement de la classe
$file = $dir."/modules_mailings.php"; $file = $dirmod."/modules_mailings.php";
$classname = "MailingTargets"; $classname = "MailingTargets";
require_once($file); require_once($file);
@ -106,7 +108,7 @@ if ($_GET["action"] == 'delete')
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$file = $dir."/modules_mailings.php"; $file = $dirmod."/modules_mailings.php";
$classname = "MailingTargets"; $classname = "MailingTargets";
require_once($file); require_once($file);
@ -187,6 +189,12 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
clearstatcache(); clearstatcache();
$listdir=array();
$listdir[]=$dirmod;
if (! empty($dirmod2)) $listdir[]=$dirmod2;
foreach ($listdir as $dir)
{
$handle=opendir($dir); $handle=opendir($dir);
$var=True; $var=True;
@ -273,6 +281,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
} }
} }
closedir($handle); closedir($handle);
}
print '</table>'; print '</table>';
print '<br>'; print '<br>';