From 880f0cbc74eaa634e4fdbad5c8ed0959fa9363ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Mon, 10 Jun 2024 16:48:28 +0200 Subject: [PATCH] Fix FLEXIAPI-183 Complete the account hooks on the dictionnary actions --- CHANGELOG.md | 1 + .../Controllers/Admin/AccountDictionaryController.php | 10 ++++++++++ .../Api/Admin/AccountDictionaryController.php | 10 +++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d0edd3..c425065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ v1.5 ---- +- Fix FLEXIAPI-183 Complete the account hooks on the dictionnary actions - Fix FLEXIAPI-181 Replace APP_ADMINS_MANAGE_MULTI_DOMAINS with APP_SUPER_ADMINS_SIP_DOMAINS - Fix FLEXIAPI-180 Fix the token and activation flow for the provisioning with token endpoint when the header is missing - Fix FLEXIAPI-179 Add Localization support as a Middleware that handles Accept-Language HTTP header diff --git a/flexiapi/app/Http/Controllers/Admin/AccountDictionaryController.php b/flexiapi/app/Http/Controllers/Admin/AccountDictionaryController.php index 9378806..b87f78c 100644 --- a/flexiapi/app/Http/Controllers/Admin/AccountDictionaryController.php +++ b/flexiapi/app/Http/Controllers/Admin/AccountDictionaryController.php @@ -56,6 +56,11 @@ class AccountDictionaryController extends Controller $account->setDictionaryEntry($request->get('key'), $request->get('value')); + if (function_exists('accountServiceAccountEditedHook')) { + $account->refresh(); + accountServiceAccountEditedHook($request, $account); + } + return redirect()->route('admin.account.dictionary.index', $account->id); } @@ -81,6 +86,11 @@ class AccountDictionaryController extends Controller $entry->value = $request->get('value'); $entry->save(); + if (function_exists('accountServiceAccountEditedHook')) { + $account->refresh(); + accountServiceAccountEditedHook($request, $account); + } + return redirect()->route('admin.account.dictionary.index', $account->id); } diff --git a/flexiapi/app/Http/Controllers/Api/Admin/AccountDictionaryController.php b/flexiapi/app/Http/Controllers/Api/Admin/AccountDictionaryController.php index 3622d64..f5671f1 100644 --- a/flexiapi/app/Http/Controllers/Api/Admin/AccountDictionaryController.php +++ b/flexiapi/app/Http/Controllers/Api/Admin/AccountDictionaryController.php @@ -42,7 +42,15 @@ class AccountDictionaryController extends Controller 'value' => 'required' ]); - return Account::findOrFail($accountId)->setDictionaryEntry($key, $request->get('value')); + $account = Account::findOrFail($accountId); + $result = $account->setDictionaryEntry($key, $request->get('value')); + + if (function_exists('accountServiceAccountEditedHook')) { + $account->refresh(); + accountServiceAccountEditedHook($request, $account); + } + + return $result; } public function destroy(int $accountId, string $key)