diff --git a/Classes/Controller/LogController.php b/Classes/Controller/LogController.php index 76fc5c5..427fa1f 100644 --- a/Classes/Controller/LogController.php +++ b/Classes/Controller/LogController.php @@ -850,6 +850,12 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa elseif ($extAddress['gender'] == 'm') $gender = 2; elseif ($extAddress['gender'] == 'v') $gender = 3; $log->setGender($gender); + } elseif ($this->settings['newsletterExtension'] == 'mail' && $this->settings['table'] == 'fe_users' && $extAddress['mail_salutation']) { + $gender = 0; + if ($extAddress['mail_salutation'] == $this->settings['gender']['mrs']) $gender = 1; + elseif ($extAddress['mail_salutation'] == $this->settings['gender']['mr']) $gender = 2; + elseif ($extAddress['mail_salutation'] == $this->settings['gender']['divers']) $gender = 3; + $log->setGender($gender); } } } else { @@ -1188,7 +1194,8 @@ public function verifyUnsubscribeAction(): ResponseInterface */ protected function deleteThisUser($uid) { - if ($this->settings['table'] == 'tt_address') { + if ($this->settings['table'] == 'tt_address' || + ($this->settings['table'] == 'fe_users' && $this->settings['newsletterExtension'] == 'mail')) { if ($this->settings['categoryOrGroup']) { $dmail_cats = str_replace(' ', '', $this->settings['categoryOrGroup']); $dmCatArr = explode(',', $dmail_cats); @@ -1198,7 +1205,13 @@ protected function deleteThisUser($uid) } else { $dmCatArr = []; } - $this->logRepository->deleteExternalUser($uid, $this->settings['deleteMode'], $dmCatArr, $this->settings['table']); + $this->logRepository->deleteExternalUser( + $uid, + $this->settings['deleteMode'], + $dmCatArr, + $this->settings['table'], + $this->settings['newsletterExtension'] + ); } /** diff --git a/Classes/Domain/Repository/LogRepository.php b/Classes/Domain/Repository/LogRepository.php index 55a56a3..f9c9bbc 100644 --- a/Classes/Domain/Repository/LogRepository.php +++ b/Classes/Domain/Repository/LogRepository.php @@ -411,11 +411,12 @@ function updateInFeUsers($address, $tableUid, $extension) /** * deleteExternalUser: delete user * @param integer $uid tt_address oder fe_users uid - * @param integer $mode Löschen-Modus: 1: update, 2: löschen + * @param integer $mode Löschen-Modus: 1: update, 2: löschen, 3: nur Kategorien/Gruppen entfernen * @param array $dmCatArr sys_category categories * @param string $table tt_address or fe_users + * @param string $extension luxletter or mail */ - function deleteExternalUser($uid, $mode, $dmCatArr = [], $table = 'tt_address') + function deleteExternalUser($uid, $mode, $dmCatArr = [], $table = 'tt_address', $extension) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); if ($mode == 2) { @@ -425,17 +426,37 @@ function deleteExternalUser($uid, $mode, $dmCatArr = [], $table = 'tt_address') $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) ) ->executeStatement(); - } else { + } elseif ($mode != 3) { $queryBuilder ->update($table) ->where( $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) ) - ->set('deleted', '1') + ->set('deleted', 1) ->set('tstamp', time()) ->executeStatement(); + } elseif ($mode == 3 && $table == 'fe_users') { + if ($extension == 'luxletter') { + $queryBuilder + ->update($table) + ->where( + $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) + ) + ->set('usergroup', '') + ->set('tstamp', time()) + ->executeStatement(); + } elseif ($extension == 'mail') { + $queryBuilder + ->update($table) + ->where( + $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) + ) + ->set('mail_active', 0) + ->set('tstamp', time()) + ->executeStatement(); + } } - if (($table == 'tt_address') && is_array($dmCatArr) && count($dmCatArr)>0) { + if (is_array($dmCatArr) && count($dmCatArr)>0) { $this->deleteInMm($uid, $table); } } diff --git a/Configuration/FlexForms/flexform_pi1.xml b/Configuration/FlexForms/flexform_pi1.xml index e9036a7..47c017e 100644 --- a/Configuration/FlexForms/flexform_pi1.xml +++ b/Configuration/FlexForms/flexform_pi1.xml @@ -355,6 +355,10 @@ LLL:EXT:fp_newsletter/Resources/Private/Language/locallang_be.xlf:settings.deleteMode.2 2 + + LLL:EXT:fp_newsletter/Resources/Private/Language/locallang_be.xlf:settings.deleteMode.3 + 3 + diff --git a/Documentation/ChangeLog/Index.rst b/Documentation/ChangeLog/Index.rst index 1e90972..b85b6c9 100644 --- a/Documentation/ChangeLog/Index.rst +++ b/Documentation/ChangeLog/Index.rst @@ -150,4 +150,9 @@ Version 6.0.0: Version 6.1.0: - Compatibility to TYPO3 11.5 added again. -- Bugfix: language added to the links in the email. \ No newline at end of file +- Bugfix: language added to the links in the email. + +Version 6.2.0: +- fe_users can now be used with the extension luxletter or mail. +- deleteMode 3 added: delete only categories (Mail) or user-group (Luxletter). +- new setting: newsletterExtension (mail or luxletter). \ No newline at end of file diff --git a/Documentation/Configuration/Index.rst b/Documentation/Configuration/Index.rst index 6cd07d3..9d4d0f6 100644 --- a/Documentation/Configuration/Index.rst +++ b/Documentation/Configuration/Index.rst @@ -48,7 +48,7 @@ editUid integer Page, where a user can edit his su gdprUid integer Page with the GDPR text 1 daysExpire integer The link expires after X days 2 searchPidMode integer Search in tt_address: 0: only in the 1. folder; 1: in all folders° 0 -deleteMode integer 1: set deletion flag; 2: delete entry 1 +deleteMode integer 1: set deletion flag; 2: delete entry; 3: remove only the cat./group 1 languageMode integer 0: uses -1 if L>0; 1: uses the sys_language_uid from pages 0 categoryMode integer 0: allow only categories/groups specified in categoryOrGroup; 1: all 1 categoryOrderBy string category order by: title, sorting or uid title @@ -198,6 +198,11 @@ The categories are as hidden-field in the template. You could add checkboxes and the hidden-field if you need a more flexible solution. Note: this setting is used for groups of fe_users too! If you use fe_users, here you can set the fe_groups. +That works only with the extension Luxletter. If newsletterExtension=mail is set, user groups are ignored. +Therefore only categories are used. + +Note: if deleteMode=3 is set, only categories set in categoryOrGroup will be removed. And the flag mail_active will be +set to 0, if newsletterExtension=mail is set. Changing the labels ^^^^^^^^^^^^^^^^^^^ diff --git a/Documentation/Localization.de_DE/ChangeLog/Index.rst b/Documentation/Localization.de_DE/ChangeLog/Index.rst index d2c5110..524436f 100644 --- a/Documentation/Localization.de_DE/ChangeLog/Index.rst +++ b/Documentation/Localization.de_DE/ChangeLog/Index.rst @@ -148,4 +148,9 @@ Version 6.0.0: Version 6.1.0: - Kompatibilität zu TYPO3 11.5 erneut hinzugefügt. -- Bugfix: Sprache zu den Links in den E-Mails hinzugefügt. \ No newline at end of file +- Bugfix: Sprache zu den Links in den E-Mails hinzugefügt. + +Version 6.2.0: +- fe_users kann nun mit der Extension Luxletter oder Mail benutzt werden. +- deleteMode 3 hinzugefügt: lösche nur Kategorien (Mail) oder Benutzergruppe (Luxletter). +- Neue Einstellungsmöglichkeit: newsletterExtension (mail oder luxletter). \ No newline at end of file diff --git a/Documentation/Localization.de_DE/Configuration/Index.rst b/Documentation/Localization.de_DE/Configuration/Index.rst index 46e1305..370ed26 100644 --- a/Documentation/Localization.de_DE/Configuration/Index.rst +++ b/Documentation/Localization.de_DE/Configuration/Index.rst @@ -48,7 +48,7 @@ editUid integer Seite, auf der man seit Abonnement gdprUid integer Seite mit den DSGVO-Texten 1 daysExpire integer Der Verifikations-Link wird ungültig nach X Tagen 2 searchPidMode integer Suche in tt_address: 0: nur im 1. Ordner; 1: in allen Ordners° 0 -deleteMode integer 1: setze delete-Flag; 2: lösche endgültig 1 +deleteMode integer 1: setze delete-Flag; 2: lösche endgültig; 3: lösche nur Kat./Gruppe 1 languageMode integer 0: setzt -1 wenn L>0; 1: benutzte die sys_language_uid von pages 0 categoryMode integer 0: nur angegebene Kategorien bei Edit erlauben; 1: alle 1 unsubscribeMode integer 0: Sofort-Abmeldung durch Link aus Luxletter; 1: zeige Abmeldeform 0 @@ -192,7 +192,11 @@ Es werden dann 2 Einträge in sys_category_record_mm gemacht und in tt_address w Die Kategorien werden als hidden-Feld ins Template eingefügt. Wenn man eine flexiblere Lösung will, könnte man z.B. Checkboxes per jQuery auswerten und die angeklickten Kategorien ins hidden-Feld kopieren. -Genau so kann man auch Gruppen für fe_users angeben. +Genau so kann man auch Gruppen für fe_users angeben. Das gilt nur für die Extension Luxletter. +Wenn newsletterExtension=mail gesetzt ist, werden keine Benutzer-Gruppen beachtet. Dann werden nur Kategorien benutzt. + +Beachte: wenn deleteMode=3 gesetzt ist, werden nur die Kategorien entfernt, die unter categoryOrGroup angegeben sind. +Und das Feld mail_active wird auf 0 gesetzt, wenn newsletterExtension=mail gesetzt ist. Ändern der Labels ^^^^^^^^^^^^^^^^^ diff --git a/README.md b/README.md index fe3a4db..95005db 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # fp_newsletter -version 6.1.1 +version 6.2.0 The TYPO3 extension fp_newsletter is designed to provide a newsletter subscription and unsubscription service for the -table tt_address which can be used by the extension mail OR for the table fe_users which can be used by luxletter. +table tt_address which can be used by the extension mail OR for the table fe_users which can be used by luxletter or mail. Furthermore, it is designed to be compatible with the GDPR. A log is written about every action in a separate table. Old log entries can be deleted by a scheduler task. Supports Google reCaptcha v3 or a mathematical captcha. @@ -41,4 +41,6 @@ Version 6.1.0: - Bugfix: language added to the links in the email. Version 6.2.0: -- fe_users can now be used with the extension luxletter or mail. \ No newline at end of file +- fe_users can now be used with the extension luxletter or mail. +- deleteMode 3 added: delete only categories (Mail) or user-group (Luxletter). +- new setting: newsletterExtension (mail or luxletter). \ No newline at end of file diff --git a/Resources/Private/Language/de.locallang_be.xlf b/Resources/Private/Language/de.locallang_be.xlf index cfb5f9e..2654565 100644 --- a/Resources/Private/Language/de.locallang_be.xlf +++ b/Resources/Private/Language/de.locallang_be.xlf @@ -159,6 +159,10 @@ delete entry lösche den Eintrag endgültig + + delete only cat./group + lösche nur die Kategorien (Mail) oder die Benutzergruppe (Luxletter) + Language mode Sprachmodus diff --git a/Resources/Private/Language/fr.locallang_be.xlf b/Resources/Private/Language/fr.locallang_be.xlf index bed585e..fcf0a83 100644 --- a/Resources/Private/Language/fr.locallang_be.xlf +++ b/Resources/Private/Language/fr.locallang_be.xlf @@ -159,6 +159,10 @@ delete entry Suppression physique + + delete only cat/group + Supprimer uniquement les catégories (Mail) ou le groupe d'utilisateurs (Luxletter) + Language mode Mode de localisation diff --git a/Resources/Private/Language/it.locallang_be.xlf b/Resources/Private/Language/it.locallang_be.xlf index bc54d29..e459d01 100644 --- a/Resources/Private/Language/it.locallang_be.xlf +++ b/Resources/Private/Language/it.locallang_be.xlf @@ -159,6 +159,10 @@ delete entry eliminare la voce + + delete only cat./group + eliminare solo le categorie (Mail) o il gruppo utenti (Luxletter) + Language mode Modalità lingua diff --git a/Resources/Private/Language/locallang_be.xlf b/Resources/Private/Language/locallang_be.xlf index 4b94a1d..e53cf63 100644 --- a/Resources/Private/Language/locallang_be.xlf +++ b/Resources/Private/Language/locallang_be.xlf @@ -120,6 +120,9 @@ delete entry + + delete only categories (mail) or user-group (luxletter) + Language mode diff --git a/ext_emconf.php b/ext_emconf.php index 9080bee..712f423 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -18,7 +18,7 @@ 'author_company' => 'fixpunkt für digitales GmbH', 'state' => 'stable', 'clearCacheOnLoad' => 0, - 'version' => '6.1.1', + 'version' => '6.2.0', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-12.4.99'