Skip to content

Commit

Permalink
expose fix field mapping bc break
Browse files Browse the repository at this point in the history
  • Loading branch information
aynsix committed Jun 4, 2024
1 parent 288d490 commit dd6cb0f
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,9 @@ public function getDataboxesFieldAction(PhraseaApplication $app, Request $reques
}

$exposeMappingName = $this->getExposeMappingName('field');
$fields = [];
$fieldMapping = [];

try {
$clientAnnotationProfile = $this->getClientAnnotationProfile($exposeClient, $exposeName, $profile);

Expand Down Expand Up @@ -1216,12 +1219,23 @@ private function getFields($actualFieldsList)
$fieldFromProfile = [];
foreach ($actualFieldsList as $key => $value) {
$t = explode('_', $key);

$oldFieldMapping = false;
if (count($t) == 2) {
$id = $key;
} else {
$oldFieldMapping = true;
$t = explode('_', $value);
$id = $value;
}

$databox = $this->getApplicationBox()->get_databox($t[0]);
$viewName = $t[0]. ':::' .$databox->get_viewname();
$name = $databox->get_meta_structure()->get_element($t[1])->get_label($this->app['locale']);

$fieldFromProfile[$viewName][$t[1]]['id'] = $key;
$fieldFromProfile[$viewName][$t[1]]['name'] = $databox->get_meta_structure()->get_element($t[1])->get_label($this->app['locale']);
$fieldFromProfile[$viewName][$t[1]]['exposeSideName'] = $value;
$fieldFromProfile[$viewName][$t[1]]['id'] = $id;
$fieldFromProfile[$viewName][$t[1]]['name'] = $name;
$fieldFromProfile[$viewName][$t[1]]['exposeSideName'] = ($oldFieldMapping) ? $name : $value;
$fieldFromProfile[$viewName][$t[1]]['checked'] = true;
}

Expand All @@ -1233,7 +1247,7 @@ private function getFields($actualFieldsList)
continue;
}
// get databoxID_metaID for the checkbox name
$fields[$viewName][$meta->get_id()]['id'] = $databox->get_sbas_id().'_'.$meta->get_id();
$fields[$viewName][$meta->get_id()]['id'] = $databox->get_sbas_id().'_'.$meta->get_id();
$fields[$viewName][$meta->get_id()]['name'] = $meta->get_label($this->app['locale']);
$fields[$viewName][$meta->get_id()]['exposeSideName'] = $meta->get_label($this->app['locale']);;
}
Expand Down

0 comments on commit dd6cb0f

Please sign in to comment.