fix: decode json ref and geographical_area properties in /noticelists/view/[noticelist_id] endpoint

pull/7455/head
Luciano Righetti 2021-05-31 14:43:12 +02:00
parent d57fb4bc95
commit 5e2259f00d
2 changed files with 5 additions and 1 deletions

View File

@ -171,6 +171,10 @@ class NoticelistsController extends AppController
if (empty($noticelist)) {
throw new NotFoundException('Noticelist not found.');
}
$noticelist['Noticelist']['ref'] = json_decode($noticelist['Noticelist']['ref']);
$noticelist['Noticelist']['geographical_area'] = json_decode($noticelist['Noticelist']['geographical_area']);
if ($this->_isRest()) {
$noticelist['Noticelist']['NoticelistEntry'] = $noticelist['NoticelistEntry'];
return $this->RestResponse->viewData($noticelist, $this->response->type());

View File

@ -5,7 +5,7 @@
$fields = array();
foreach ($field_names as $field_name) {
if ($field_name == 'ref' || $field_name == 'geographical_area') {
$value = json_decode($noticelist['Noticelist'][$field_name]);
$value = $noticelist['Noticelist'][$field_name];
foreach ($value as $k => $v) {
if ($field_name == 'ref') {
$value[$k] = '<a href="' . h($v) . '">' . h($v) . '</a>';