Skip to content

Commit

Permalink
Dashboard tab report should not be seen in report generator
Browse files Browse the repository at this point in the history
  • Loading branch information
plessbd committed Sep 10, 2020
1 parent 4216230 commit 0a3e183
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions html/controllers/report_builder/enum_templates.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?php

try {

$user = \xd_security\getLoggedInUser();

$templates = XDReportManager::enumerateReportTemplates($user->getRoles());

$returnData['status'] = 'success';
$returnData['success'] = true;
$returnData['templates'] = $templates;
$returnData['count'] = count($templates);

\xd_controller\returnJSON($returnData);
try {
$user = \xd_security\getLoggedInUser();

}
catch (SessionExpiredException $see) {
// TODO: Refactor generic catch block below to handle specific exceptions,
// which would allow this block to be removed.
throw $see;
}
catch (Exception $e) {
$templates = XDReportManager::enumerateReportTemplates($user->getRoles());

\xd_response\presentError($e->getMessage());

}

?>
// We do not want to show the "Dashboard Tab Reports"
foreach($templates as $key => $value){
if ($value['name'] === 'Dashboard Tab Report') {
unset($templates[$key]);
}
}

$returnData['status'] = 'success';
$returnData['success'] = true;
$returnData['templates'] = $templates;
$returnData['count'] = count($templates);

\xd_controller\returnJSON($returnData);

} catch (SessionExpiredException $see) {
// TODO: Refactor generic catch block below to handle specific exceptions,
// which would allow this block to be removed.
throw $see;
} catch (Exception $e) {
\xd_response\presentError($e->getMessage());
}

0 comments on commit 0a3e183

Please sign in to comment.