diff options
Diffstat (limited to 'plugins/ScheduledReports')
-rw-r--r-- | plugins/ScheduledReports/API.php | 10 | ||||
-rw-r--r-- | plugins/ScheduledReports/tests/Integration/ApiTest.php | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/plugins/ScheduledReports/API.php b/plugins/ScheduledReports/API.php index 0b3bd1d5a1..922c97ad39 100644 --- a/plugins/ScheduledReports/API.php +++ b/plugins/ScheduledReports/API.php @@ -125,9 +125,15 @@ class API extends \Piwik\Plugin\API private static function ensureLanguageSetForUser($currentUser) { - $lang = \Piwik\Plugins\LanguagesManager\API::getInstance()->getLanguageForUser($currentUser); + $lang = Request::processRequest('LanguagesManager.getLanguageForUser', [ + 'login' => $currentUser, + ]); + if (empty($lang)) { - \Piwik\Plugins\LanguagesManager\API::getInstance()->setLanguageForUser($currentUser, LanguagesManager::getLanguageCodeForCurrentUser()); + Request::processRequest('LanguagesManager.setLanguageForUser', [ + 'login' => $currentUser, + 'languageCode' => LanguagesManager::getLanguageCodeForCurrentUser(), + ]); } } diff --git a/plugins/ScheduledReports/tests/Integration/ApiTest.php b/plugins/ScheduledReports/tests/Integration/ApiTest.php index 8c3e86ba30..6c3ee22169 100644 --- a/plugins/ScheduledReports/tests/Integration/ApiTest.php +++ b/plugins/ScheduledReports/tests/Integration/ApiTest.php @@ -454,6 +454,7 @@ class ApiTest extends IntegrationTestCase $result->addRowFromSimpleArray(array('label' => 'referrers label', 'nb_visits' => 1)); return $result; case '\Piwik\Plugins\API\API': + case '\Piwik\Plugins\LanguagesManager\API': return $realProxy->call($className, $methodName, $parametersRequest); default: throw new \Exception("Unexpected method $className::$methodName."); |