diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index 3f1bbc4381ef45fa1fa279a623dd1e586a53340e..16060ba9902d8402e8dffa7c646611ff26000e6a 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;