From 10096109645752845c834428140ae250de063140 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 17 Apr 2011 07:23:37 +0000 Subject: [PATCH] Fix: possibility to use an alternative path --- htdocs/admin/commande.php | 301 ++++++++++++++++++++------------------ htdocs/admin/propale.php | 6 +- 2 files changed, 161 insertions(+), 146 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 12c691374de..1a1c511f048 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -1,10 +1,10 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Andre Cianfarani - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -188,7 +188,6 @@ if ($_POST["action"] == 'set_use_customer_contact_as_recipient') llxHeader(); -$dir = "../includes/modules/commande/"; $html=new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; @@ -215,79 +214,86 @@ print "\n"; clearstatcache(); -$dir = "../includes/modules/commande/"; -$handle = opendir($dir); -if (is_resource($handle)) +foreach ($conf->file->dol_document_root as $dirroot) { - $var=true; + $dir = $dirroot . "/includes/modules/commande/"; - while (($file = readdir($handle))!==false) + if (is_dir($dir)) { - if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php') + $handle = opendir($dir); + if (is_resource($handle)) { - $file = substr($file, 0, dol_strlen($file)-4); + $var=true; - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php"); - - $module = new $file; - - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - - if ($module->isEnabled()) + while (($file = readdir($handle))!==false) { - $var=!$var; - print ''.$module->nom."\n"; - print $module->info(); - print ''; - - // Examples - print ''.$module->getExample()."\n"; - - print ''; - if ($conf->global->COMMANDE_ADDON == "$file") + if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - print img_picto($langs->trans("Activated"),'on'); - } - else - { - print ''; - print img_picto($langs->trans("Disabled"),'off'); - print ''; - } - print ''; - - $commande=new Commande($db); - $commande->initAsSpecimen(); - - // Info - $htmltooltip=''; - $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; - $nextval=$module->getNextValue($mysoc,$commande); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) + $file = substr($file, 0, dol_strlen($file)-4); + + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php"); + + $module = new $file; + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; + $var=!$var; + print ''.$module->nom."\n"; + print $module->info(); + print ''; + + // Examples + print ''.$module->getExample()."\n"; + + print ''; + if ($conf->global->COMMANDE_ADDON == "$file") + { + print img_picto($langs->trans("Activated"),'on'); + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'off'); + print ''; + } + print ''; + + $commande=new Commande($db); + $commande->initAsSpecimen(); + + // Info + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $facture->type=0; + $nextval=$module->getNextValue($mysoc,$commande); + if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval + { + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) + { + $htmltooltip.=$nextval.'
'; + } + else + { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + print $html->textwithpicto('',$htmltooltip,1,0); + print ''; + + print ''; } } - - print ''; - print $html->textwithpicto('',$htmltooltip,1,0); - print ''; - - print ''; } + closedir($handle); } } - closedir($handle); } print '
'; @@ -322,7 +328,6 @@ else dol_print_error($db); } -$dir = "../includes/modules/commande/"; print "\n"; print "\n"; @@ -336,89 +341,97 @@ print "\n"; clearstatcache(); -$handle=opendir($dir); - -$var=true; -if (is_resource($handle)) +foreach ($conf->file->dol_document_root as $dirroot) { - while (($file = readdir($handle))!==false) - { - if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') - { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); + $dir = $dirroot . "/includes/modules/commande/"; - $var=!$var; - print "\n \n \n"; - - // Activated - print ""; - - // Defaut - print "'; - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); - $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - //$htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); - //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); - $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); - - print ''; - print ''; - - print "\n"; - } - } - closedir($handle); + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + $var=true; + while (($file = readdir($handle))!==false) + { + if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + $var=!$var; + print "\n \n \n"; + + // Activated + print ""; + + // Defaut + print "'; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + //$htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); + //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + print ''; + print ''; + + print "\n"; + } + } + closedir($handle); + } + } } + print '
"; - print "$name"; - print "\n"; - require_once($dir.$file); - $module = new $classname($db); - print $module->description; - print "\n"; - if (in_array($name, $def)) - { - if ($conf->global->COMMANDE_ADDON_PDF != "$name") - { - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Activated"),'on'); - print ''; - } - else - { - print img_picto($langs->trans("Activated"),'on'); - } - } - else - { - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Disabled"),'off'); - print ''; - } - print ""; - if ($conf->global->COMMANDE_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Yes"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("No"),'off'); - print ''; - } - print ''; - print $html->textwithpicto('',$htmltooltip,1,0); - print ''; - print ''.img_object($langs->trans("Preview"),'order').''; - print '
"; + print "$name"; + print "\n"; + require_once($dir.$file); + $module = new $classname($db); + print $module->description; + print "\n"; + if (in_array($name, $def)) + { + if ($conf->global->COMMANDE_ADDON_PDF != "$name") + { + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Activated"),'on'); + print ''; + } + else + { + print img_picto($langs->trans("Activated"),'on'); + } + } + else + { + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Disabled"),'off'); + print ''; + } + print ""; + if ($conf->global->COMMANDE_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Yes"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("No"),'off'); + print ''; + } + print ''; + print $html->textwithpicto('',$htmltooltip,1,0); + print ''; + print ''.img_object($langs->trans("Preview"),'order').''; + print '
'; //Autres Options diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index 25ae4d608c4..c2fae944830 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -215,7 +215,6 @@ print ''."\n"; clearstatcache(); -$var=true; foreach ($conf->file->dol_document_root as $dirroot) { $dir = $dirroot . "/includes/modules/propale/"; @@ -225,6 +224,8 @@ foreach ($conf->file->dol_document_root as $dirroot) $handle = opendir($dir); if (is_resource($handle)) { + $var=true; + while (($file = readdir($handle))!==false) { if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -340,13 +341,14 @@ print "\n"; clearstatcache(); -$var=true; foreach ($conf->file->dol_document_root as $dirroot) { $dir = $dirroot . "/includes/modules/propale/"; if (is_dir($dir)) { + $var=true; + $handle=opendir($dir); if (is_resource($handle)) {