From f875baf13844b0da5a00d790be4e530ef7754f0d Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Thu, 8 Nov 2012 14:56:47 +0000 Subject: [PATCH] [-] BO : fixed bug #PSCFV-5105 - Internal server error 500 on fields names translation --- .../admin/AdminTranslationsController.php | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 987d1b8a0..7adc4110b 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -1839,17 +1839,21 @@ class AdminTranslationsControllerCore extends AdminController foreach ($files_by_directory['php'] as $dir => $files) foreach ($files as $file) { - if (!preg_match('/\.php$/', $file) || $file == 'index.php') + $exclude_files = array('index.php', 'Autoload.php', 'StockManagerInterface.php', + 'TaxManagerInterface.php', 'WebserviceOutputInterface.php', 'WebserviceSpecificManagementInterface.php'); + + if (!preg_match('/\.php$/', $file) || in_array($file, $exclude_files)) continue; - include_once($dir.$file); - $prefix_key = substr($file, 0, -4); - if (!class_exists($prefix_key)) - continue; - if (!is_subclass_of($prefix_key, 'ObjectModel')) - continue; - $class_array[$prefix_key] = call_user_func(array($prefix_key, 'getValidationRules'), $prefix_key); - } + $class_name = substr($file, 0, -4); + + if (!class_exists($class_name, false)) + Autoload::getInstance()->load($class_name); + + if (!is_subclass_of($class_name.'Core', 'ObjectModel')) + continue; + $class_array[$class_name] = call_user_func(array($class_name, 'getValidationRules'), $class_name); + } foreach ($class_array as $prefix_key => $rules) { if (isset($rules['validate']))