From a386179f47202f92e7fdf5247ca2f90c10611e49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jul 2013 15:17:36 +0200 Subject: [PATCH] New: Numbering models with a suffix for specific country is visible only if company is from this country. --- htdocs/admin/facture.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index c7a3f04a403..a3bf9259568 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -313,6 +313,10 @@ foreach ($dirmodels as $reldir) $filebis = $file."/".$file.".modules.php"; $classname = "mod_facture_".$file; } + // Check if there is a filter on country + preg_match('/\-(.*)_(.*)$/',$classname,$reg); + if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; + $classname = preg_replace('/\-.*$/','',$classname); if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') { @@ -329,7 +333,7 @@ foreach ($dirmodels as $reldir) { $var = !$var; print ''; - echo preg_replace('/mod_facture_/','',preg_replace('/\.php$/','',$file)); + echo preg_replace('/\-.*$/','',preg_replace('/mod_facture_/','',preg_replace('/\.php$/','',$file))); print "\n"; print $module->info();