From fb98f23fbfdc0486557e634f16467a88b6ac819e Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Mon, 6 Jan 2020 15:07:29 +0100 Subject: [PATCH] FEAT #12635 TIME 0:10 get communication means --- src/app/contact/controllers/ContactController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index 3f1bbc4381e..16060ba9902 100755 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -232,7 +232,7 @@ class ContactController 'addressCountry' => $rawContact['address_country'], 'email' => $rawContact['email'], 'phone' => $rawContact['phone'], - 'communicationMeans' => !empty($rawContact['communication_means']) ? json_decode($rawContact['communication_means']) : null, + 'communicationMeans' => null, 'notes' => $rawContact['notes'], 'creator' => $rawContact['creator'], 'creatorLabel' => UserModel::getLabelledUserById(['id' => $rawContact['creator']]), @@ -251,6 +251,10 @@ class ContactController 'abbreviation' => $civilities[$rawContact['civility']]['abbreviation'] ]; } + if (!empty($rawContact['communication_means'])) { + $communicationMeans = json_decode($rawContact['communication_means'], true); + $contact['communicationMeans'] = $communicationMeans['url'] ?? $communicationMeans['email']; + } $filling = ContactController::getFillingRate(['contactId' => $rawContact['id']]); $contact['fillingRate'] = empty($filling) ? null : $filling; -- GitLab