diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php
index 6a2e6b270..eef0c5824 100644
--- a/Classes/Controller/ModuleController.php
+++ b/Classes/Controller/ModuleController.php
@@ -8,6 +8,8 @@
use In2code\Powermail\Utility\BackendUtility;
use In2code\Powermail\Utility\BasicFileUtility;
use In2code\Powermail\Utility\ConfigurationUtility;
+use In2code\Powermail\Utility\DatabaseUtility;
+use In2code\Powermail\Utility\LocalizationUtility;
use In2code\Powermail\Utility\MailUtility;
use In2code\Powermail\Utility\ReportingUtility;
use In2code\Powermail\Utility\StringUtility;
@@ -62,6 +64,47 @@ public function listAction(): void
);
}
+ /**
+ * Delete all mails and answers if the confirmation checkbox has been checked
+ *
+ * @return void
+ */
+ public function deleteAllMailsBeAction(): void
+ {
+ $args = $this->request->getArguments();
+ if ($args['reallyDelete'] === '1' && $this->id > 0) {
+ $this->deleteAllMails();
+ }
+ $this->forward('list');
+ }
+
+ /**
+ * Delete all mails and answers on the current page
+ *
+ * @return void
+ */
+ protected function deleteAllMails(): void
+ {
+ $queryBuilder = DatabaseUtility::getQueryBuilderForTable(Answer::TABLE_NAME);
+ $queryBuilder->delete(Answer::TABLE_NAME)
+ ->where(
+ $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($this->id))
+ )
+ ->execute();
+
+ $queryBuilder = DatabaseUtility::getQueryBuilderForTable(Answer::TABLE_NAME);
+ $queryBuilder->delete(Mail::TABLE_NAME)
+ ->where(
+ $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($this->id))
+ )
+ ->execute();
+
+ $this->addFlashMessage(
+ LocalizationUtility::translate('BackendDeleteAllMailsFinished'),
+ ''
+ );
+ }
+
/**
* @return void
* @throws InvalidQueryException
diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf
index 8e5cfef11..8a458b151 100644
--- a/Resources/Private/Language/de.locallang.xlf
+++ b/Resources/Private/Language/de.locallang.xlf
@@ -747,6 +747,26 @@
This TYPO3 instance is running in development context. You can use %s in the AdditionalConfiguration.php to enforce powermail to send testmails to this email-address only.Diese TYPO3-Instanz läuft aktuell im Development Context. Mit %s in der AdditionalConfiguration.php kann man powermail anweisen, nur noch an diese Formulare zu senden.
+
+ Cleanup
+ Aufräumen
+
+
+ Delete all mails
+ Alle Mails löschen
+
+
+ All mails and answers on this page have been deleted
+ Alle Mails und Antworten auf dieser Seite wurden gelöscht.
+
+
+ Yes, delete all mails and answers on this page
+ Ja, alle Mails und Antworten auf dieser Seite löschen
+
+
+ Delete all
+ Alle löschen
+ Form OverviewFormular Übersicht
diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf
index ed3cd70b4..7b10926bf 100644
--- a/Resources/Private/Language/locallang.xlf
+++ b/Resources/Private/Language/locallang.xlf
@@ -559,6 +559,21 @@
This TYPO3 instance is running in development context. You can use %s in the AdditionalConfiguration.php to enforce powermail to send testmails to this email-address only.
+
+ Cleanup
+
+
+ Delete all mails
+
+
+ All mails and answers on this page have been deleted
+
+
+ Yes, delete all mails and answers on this page
+
+
+ Delete all
+ Form Overview
diff --git a/Resources/Private/Partials/Module/DeleteAllMails.html b/Resources/Private/Partials/Module/DeleteAllMails.html
new file mode 100644
index 000000000..1549b63d5
--- /dev/null
+++ b/Resources/Private/Partials/Module/DeleteAllMails.html
@@ -0,0 +1,41 @@
+