Skip to content

Commit aa5f940

Browse files
author
Adnan Zelkanovic
committed
[FEATURE] show a flash error, when sic_address gets updated and domain properties have already been saved. In this case the generate process has to be run again.
1 parent bc53b40 commit aa5f940

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

Classes/Controller/AbstractController.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?php
22
namespace SICOR\SicAddress\Controller;
33

4-
class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
4+
use TYPO3\CMS\Core\Messaging\AbstractMessage;
5+
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
56
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
67

8+
class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
9+
{
710

811
/**
912
* Returns translation for given key (and extension)
@@ -16,6 +19,24 @@ protected function translate($key, $extension = 'sic_address') {
1619
return LocalizationUtility::translate($key, $extension );
1720
}
1821

22+
/**
23+
* @param ViewInterface $view
24+
*/
25+
public function initializeView(ViewInterface $view)
26+
{
27+
parent::initializeView($view); // TODO: Change the autogenerated stub
28+
29+
if(! in_array($this->request->getControllerActionName(), array('create', 'update'))) {
30+
31+
$updateOrFirstInstall = \file_exists(PATH_typo3conf . 'ext/sic_address/PLEASE_GENERATE');
32+
if($updateOrFirstInstall && $this->domainPropertyRepository && $this->domainPropertyRepository->countAll()) {
33+
$this->addFlashMessage(
34+
$this->translate('label_update_message'),
35+
$this->translate('label_update_title'),
36+
AbstractMessage::ERROR
37+
);
38+
}
39+
}
1940
}
2041

2142
}

Classes/Controller/ModuleController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public function createAction()
285285

286286
$this->updateExtension();
287287
$this->view->assign("errorMessages", $errorMessages);
288+
289+
if(empty($errorMessages)) @unlink(PATH_typo3conf . 'ext/sic_address/PLEASE_GENERATE');
288290
}
289291

290292

PLEASE_GENERATE

Whitespace-only changes.

Resources/Private/Language/de.locallang.xlf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
<file datatype="plaintext" original="messages" date="2016-06-22T13:49:32Z" target-language="de" product-name="sic_address">
44
<header/>
55
<body>
6+
<trans-unit id="label_update_title">
7+
<target>sic_address wurde aktualisiert !</target>
8+
</trans-unit>
9+
<trans-unit id="label_update_message">
10+
<target>Der Generierungsprozess muss erneut durchgeführt werden!</target>
11+
</trans-unit>
612
<trans-unit id="tx_sicaddress_domain_model_address_title">
713
<target>Adressen</target>
814
</trans-unit>

Resources/Private/Language/locallang.xlf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
<file source-language="en" datatype="plaintext" original="messages" date="2016-06-22T13:49:32Z" product-name="sic_address">
44
<header/>
55
<body>
6+
<trans-unit id="label_update_title">
7+
<source>sic_address has been updated !</source>
8+
</trans-unit>
9+
<trans-unit id="label_update_message">
10+
<source>Generation process must be run again!</source>
11+
</trans-unit>
612
<trans-unit id="tx_sicaddress_domain_model_address_title">
713
<source>Addresses</source>
814
</trans-unit>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

22
<div class="tx-sic-address">
3+
<f:flashMessages />
34
<f:render section="main" />
45
</div>

0 commit comments

Comments
 (0)