Commit f21669f9 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[BUGFIX] Adds error message if no configuration is available

parent c287f307
......@@ -13,6 +13,9 @@ namespace TYPO3\Election\Controller;
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\Election\Domain\Repository\ElectionCircularRepository;
use TYPO3\Election\Domain\Repository\ElectorImportRepository;
......@@ -40,16 +43,37 @@ class BeDashboardController extends AbstractBeController
'elections' => $this->electionRepository->findAll(),
]
);
if ($this->backendUserHasUserGroup($this->configuration->getElectionManagerGroup())) {
$this->view->assign(
'electorImports',
$this->objectManager->get(ElectorImportRepository::class)->findAll()
if ($this->configuration) {
$electionManagerGroup = $this->configuration->getElectionManagerGroup();
}
else {
$this->addFlashMessage(
LocalizationUtility::translate('view.be.dashboard.index.no_configuration_msg_body', $this->extensionName),
LocalizationUtility::translate('view.be.dashboard.index.no_configuration_msg_title', $this->extensionName),
AbstractMessage::ERROR
);
$this->view->assign(
'electionCirculars',
$this->objectManager->get(ElectionCircularRepository::class)->findAll()
}
if ($electionManagerGroup) {
if ($this->backendUserHasUserGroup()) {
$this->view->assign(
'electorImports',
$this->objectManager->get(ElectorImportRepository::class)->findAll()
);
$this->view->assign(
'electionCirculars',
$this->objectManager->get(ElectionCircularRepository::class)->findAll()
);
}
}
else {
$this->addFlashMessage(
LocalizationUtility::translate('view.be.dashboard.index.no_configuration_msg_body', $this->extensionName),
LocalizationUtility::translate('view.be.dashboard.index.no_electionmanagergroup_msg_body', $this->extensionName),
AbstractMessage::WARNING
);
}
}
/**
......
......@@ -98,6 +98,22 @@
<source>There are no Election Circulars</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_configuration_msg_title">
<source>No configuration is available</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_configuration_msg_body">
<source>Please add a configuration record.</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_electionmanagergroup_msg_title">
<source>No election manager group is set</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_electionmanagergroup_msg_body">
<source>Please add an election group in your configuration.</source>
</trans-unit>
<!-- BE CONFIGURATION-->
<trans-unit id="view.be.configuration.edit.welcome">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment