Fix: use generic array for all parts

This commit is contained in:
Regis Houssin 2012-03-01 13:57:31 +08:00
parent 7c4e908639
commit f3cb926c3c
7 changed files with 21 additions and 22 deletions

View File

@ -73,7 +73,7 @@ if ($action == 'specimen')
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),$conf->commande_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php",0);
@ -223,6 +223,8 @@ if ($action == 'set_COMMANDE_FREE_TEXT')
* View
*/
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
llxHeader();
$form=new Form($db);
@ -251,8 +253,6 @@ print "</tr>\n";
clearstatcache();
$dirmodels=array_merge(array('/'),$conf->commande_modules);
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/commande/");
@ -384,8 +384,6 @@ print "</tr>\n";
clearstatcache();
$dirmodels=array_merge(array('/'),$conf->commande_modules);
$var=true;
foreach ($dirmodels as $reldir)
{

View File

@ -72,7 +72,7 @@ if ($action == 'specimen')
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),$conf->facture_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php",0);
@ -291,7 +291,7 @@ if ($action == 'setforcedate')
* View
*/
$dirmodels=array_merge(array('/'),$conf->facture_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
llxHeader("",$langs->trans("BillsSetup"),'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura');

View File

@ -71,7 +71,7 @@ if ($action == 'specimen')
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),$conf->propale_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php");
@ -257,6 +257,8 @@ else if ($action == 'setmod')
* Affiche page
*/
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
llxHeader('',$langs->trans("PropalSetup"));
$form=new Form($db);
@ -283,8 +285,6 @@ print '</tr>'."\n";
clearstatcache();
$dirmodels=array_merge(array('/'),$conf->propale_modules);
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/propale/");
@ -416,8 +416,6 @@ print "</tr>\n";
clearstatcache();
$dirmodels=array_merge(array('/'),$conf->propale_modules);
$var=true;
foreach ($dirmodels as $reldir)
{

View File

@ -52,9 +52,10 @@ class Conf
public $smart_menu;
public $modules = array(); // List of activated modules
public $sms_engine_modules = array();
public $modules_parts = array(); // List of modules parts
// TODO Remove all thoose tabs with one generic
public $sms_engine_modules = array();
public $css_modules = array();
public $tabs_modules = array();
public $triggers_modules = array();
@ -164,15 +165,16 @@ class Conf
{
$modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]);
$varname = $partname.'_modules';
if (! is_array($this->$varname)) { $this->$varname = array(); }
$varname = $partname.'_modules'; // TODO deprecated
if (! is_array($this->$varname)) { $this->$varname = array(); } // TODO deprecated
if (! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$arrValue = @unserialize($value);
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
else if (in_array($partname,array('login','menus','triggers'))) $value = '/'.$modulename.'/core/'.$partname.'/';
else if (in_array($partname,array('facture','commande','propale'))) $value = '/'.$modulename.'/';
else if (in_array($partname,array('models','facture','commande','propale'))) $value = '/'.$modulename.'/';
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/';
//print 'xxx'.$varname.' '.$value.'<br>';
$this->$varname = array_merge($this->$varname, array($modulename => $value));
$this->$varname = array_merge($this->$varname, array($modulename => $value)); // TODO deprecated
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value));
}
// If this is a module constant (must be at end)
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
@ -202,6 +204,7 @@ class Conf
$db->free($resql);
}
//var_dump($this->modules);
//var_dump($this->modules_parts);
// Clean some variables
if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php";

View File

@ -183,7 +183,7 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),$conf->commande_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
foreach(array('doc','pdf') as $prefix)

View File

@ -181,7 +181,7 @@ function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),$conf->facture_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
foreach(array('doc','pdf') as $prefix)

View File

@ -184,7 +184,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),$conf->propale_modules);
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
foreach(array('doc','pdf') as $prefix)