From f855014575e70be5ba9852bace3dc6e675b6725c Mon Sep 17 00:00:00 2001 From: Oliver Eglseder Date: Thu, 11 Aug 2022 13:39:06 +0200 Subject: [PATCH 1/5] [BUGFIX] Support multi-language setups Resolves: https://projekte.in2code.de/issues/51570 Resolves: #3 --- Classes/Controller/ConditionController.php | 3 +- .../ConditionContainerRepository.php | 3 +- ...x_powermailcond_domain_model_condition.php | 70 +++++++-------- ...ilcond_domain_model_conditioncontainer.php | 59 +++++++------ .../tx_powermailcond_domain_model_rule.php | 61 +++++++++++-- composer.json | 2 +- ext_tables.sql | 86 +++++-------------- 7 files changed, 145 insertions(+), 139 deletions(-) diff --git a/Classes/Controller/ConditionController.php b/Classes/Controller/ConditionController.php index 41f7039..8c983d7 100644 --- a/Classes/Controller/ConditionController.php +++ b/Classes/Controller/ConditionController.php @@ -88,7 +88,8 @@ public function buildConditionAction(): ResponseInterface } $arguments = []; - $conditionContainer = $this->conditionContainerRepository->findOneByForm($form); + // Use the forms non-localized UID, because the field is l10n_mode exclude + $conditionContainer = $this->conditionContainerRepository->findOneByForm($form->getUid()); if (null !== $conditionContainer) { $arguments = $conditionContainer->applyConditions($form, $powermailArguments); $this->typoscriptFrontendController->fe_user->setAndSaveSessionData('tx_powermail_cond', $arguments); diff --git a/Classes/Domain/Repository/ConditionContainerRepository.php b/Classes/Domain/Repository/ConditionContainerRepository.php index ab0f8a4..2bb5579 100644 --- a/Classes/Domain/Repository/ConditionContainerRepository.php +++ b/Classes/Domain/Repository/ConditionContainerRepository.php @@ -4,13 +4,12 @@ namespace In2code\PowermailCond\Domain\Repository; -use In2code\Powermail\Domain\Model\Form; use In2code\PowermailCond\Domain\Model\ConditionContainer; use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings; use TYPO3\CMS\Extbase\Persistence\Repository; /** - * @method ConditionContainer|null findOneByForm(Form $form) + * @method ConditionContainer|null findOneByForm(int $form) */ class ConditionContainerRepository extends Repository { diff --git a/Configuration/TCA/tx_powermailcond_domain_model_condition.php b/Configuration/TCA/tx_powermailcond_domain_model_condition.php index 31fc2ae..509516a 100644 --- a/Configuration/TCA/tx_powermailcond_domain_model_condition.php +++ b/Configuration/TCA/tx_powermailcond_domain_model_condition.php @@ -12,6 +12,9 @@ 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', + 'transOrigDiffSourceField' => 'l18n_diffsource', + 'versioningWS' => false, 'sortby' => 'sorting', 'delete' => 'deleted', 'enablecolumns' => [ @@ -22,50 +25,44 @@ 'iconfile' => 'EXT:powermail_cond/Resources/Public/Icons/tx_powermailcond_domain_model_condition.gif', 'hideTable' => 1, ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,conditioncontainer,title,target_field,actions,filter_select_field,rules,conjunction', - ], 'types' => [ '1' => [ - 'showitem' => 'conditioncontainer, title, target_field, actions, filter_select_field, conjunction, rules', + 'showitem' => ' + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, title, target_field, actions, filter_select_field, conjunction, rules, + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, --palette--;;language + ', ], ], 'palettes' => [ - '1' => [], + 'language' => [ + 'showitem' => ' + sys_language_uid;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sys_language_uid_formlabel, + l18n_parent + ', + ], ], 'columns' => [ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', 'config' => [ - 'type' => 'select', - 'special' => 'languages', - 'renderType' => 'selectSingle', - - 'foreign_table' => 'sys_language', - 'foreign_table_where' => 'ORDER BY sys_language.title', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, + 'type' => 'language', ], ], 'l18n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:LGL.l18n_parent', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['', 0], + [ + '', + 0, + ], ], 'foreign_table' => 'tx_powermailcond_domain_model_condition', - 'foreign_table_where' => 'AND tx_powermailcond_domain_model_condition.pid=###CURRENT_PID### AND tx_powermailcond_domain_model_condition.sys_language_uid IN (-1,0)', + 'foreign_table_where' => 'AND {#tx_powermailcond_domain_model_condition}.{#pid}=###CURRENT_PID### AND {#tx_powermailcond_domain_model_condition}.{#sys_language_uid} IN (-1,0)', 'default' => 0, ], ], @@ -105,7 +102,6 @@ 'default' => 0, ], ], - 'title' => [ 'exclude' => true, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.title', @@ -116,7 +112,7 @@ ], ], 'rules' => [ - 'exclude' => true, + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.rules', 'config' => [ 'type' => 'inline', @@ -125,17 +121,20 @@ 'foreign_field' => 'conditions', 'maxitems' => 99, 'appearance' => [ - 'collapseAll' => 1, 'expandSingle' => 1, 'useSortable' => 1, 'newRecordLinkAddTitle' => 1, - 'newRecordLinkPosition' => 'both', + 'levelLinksPosition' => 'top', + 'showSynchronizationLink' => 0, + 'showAllLocalizationLink' => 1, + 'showPossibleLocalizationRecords' => 1 ], - 'default' => 0, ], ], 'conjunction' => [ - 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.conjunction', 'config' => [ 'type' => 'select', @@ -158,7 +157,9 @@ ], ], 'target_field' => [ - 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.targetField', 'config' => [ 'type' => 'select', @@ -180,7 +181,9 @@ ], ], 'actions' => [ - 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.action', 'config' => [ 'type' => 'select', @@ -213,8 +216,7 @@ ], ], 'conditioncontainer' => [ - 'l10n_mode' => 'exclude', - 'exclude' => true, + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.conditioncontainer', 'config' => [ 'type' => 'select', @@ -223,7 +225,7 @@ ['', 0], ], 'foreign_table' => 'tx_powermailcond_domain_model_conditioncontainer', - 'foreign_table_where' => 'AND tx_powermailcond_domain_model_conditioncontainer.pid=###CURRENT_PID### AND tx_powermailcond_domain_model_conditioncontainer.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)', + 'foreign_table_where' => 'AND {#tx_powermailcond_domain_model_conditioncontainer}.{#pid}=###CURRENT_PID### AND {#tx_powermailcond_domain_model_conditioncontainer}.{#sys_language_uid} IN (-1,###REC_FIELD_sys_language_uid###)', 'default' => 0, ], ], diff --git a/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php b/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php index 3295fc7..23386f2 100644 --- a/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php +++ b/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php @@ -10,6 +10,9 @@ 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', + 'transOrigDiffSourceField' => 'l18n_diffsource', + 'versioningWS' => false, 'sortby' => 'sorting', 'delete' => 'deleted', 'enablecolumns' => [ @@ -19,47 +22,44 @@ ], 'iconfile' => 'EXT:powermail_cond/Resources/Public/Icons/tx_powermailcond_domain_model_condition.gif', ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,title,form,conditions', - ], 'types' => [ - '1' => ['showitem' => 'title, form, conditions, note'], + '1' => [ + 'showitem' => ' + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, title, form, conditions, note, + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, --palette--;;language + ', + ], ], 'palettes' => [ - '1' => [], + 'language' => [ + 'showitem' => ' + sys_language_uid;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sys_language_uid_formlabel, + l18n_parent + ', + ], ], 'columns' => [ 'sys_language_uid' => [ 'exclude' => true, - 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:LGL.language', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', 'config' => [ - 'type' => 'select', - 'special' => 'languages', - 'renderType' => 'selectSingle', - 'foreign_table' => 'sys_language', - 'foreign_table_where' => 'ORDER BY sys_language.title', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, + 'type' => 'language', ], ], 'l18n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:LGL.l18n_parent', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['', 0], + [ + '', + 0, + ], ], 'foreign_table' => 'tx_powermailcond_domain_model_conditioncontainer', - 'foreign_table_where' => 'AND tx_powermailcond_domain_model_conditioncontainer.pid=###CURRENT_PID### AND tx_powermailcond_domain_model_conditioncontainer.sys_language_uid IN (-1,0)', + 'foreign_table_where' => 'AND {#tx_powermailcond_domain_model_conditioncontainer}.{#pid}=###CURRENT_PID### AND {#tx_powermailcond_domain_model_conditioncontainer}.{#sys_language_uid} IN (-1,0)', 'default' => 0, ], ], @@ -116,7 +116,9 @@ ], ], 'form' => [ - 'exclude' => true, + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditioncontainer.form', 'onChange' => 'reload', 'config' => [ @@ -141,7 +143,7 @@ ], 'conditions' => [ 'displayCond' => 'FIELD:form:>:0', - 'exclude' => true, + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditioncontainer.conditions', 'config' => [ 'type' => 'inline', @@ -150,13 +152,14 @@ 'foreign_field' => 'conditioncontainer', 'maxitems' => 99, 'appearance' => [ - 'collapseAll' => 1, 'expandSingle' => 1, 'useSortable' => 1, 'newRecordLinkAddTitle' => 1, - 'newRecordLinkPosition' => 'both', + 'levelLinksPosition' => 'top', + 'showSynchronizationLink' => 0, + 'showAllLocalizationLink' => 1, + 'showPossibleLocalizationRecords' => 1 ], - 'default' => 0, ], ], ], diff --git a/Configuration/TCA/tx_powermailcond_domain_model_rule.php b/Configuration/TCA/tx_powermailcond_domain_model_rule.php index 418d2e2..9661b55 100644 --- a/Configuration/TCA/tx_powermailcond_domain_model_rule.php +++ b/Configuration/TCA/tx_powermailcond_domain_model_rule.php @@ -11,24 +11,66 @@ 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', + 'transOrigDiffSourceField' => 'l18n_diffsource', + 'versioningWS' => false, 'sortby' => 'sorting', 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', ], 'iconfile' => 'EXT:powermail_cond/Resources/Public/Icons/tx_powermailcond_domain_model_rule.gif', 'hideTable' => 1, ], - 'interface' => [ - 'showRecordFieldList' => 'hidden,conditions,title,start_field,ops,cond_string,equal_field', - ], 'types' => [ - '0' => ['showitem' => 'conditions,title,start_field,ops,cond_string,equal_field'], + '1' => [ + 'showitem' => ' + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, conditions,title,start_field,ops,cond_string,equal_field, + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, --palette--;;language + ', + ], ], 'palettes' => [ - '1' => [], + 'language' => [ + 'showitem' => ' + sys_language_uid;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sys_language_uid_formlabel, + l18n_parent + ', + ], ], 'columns' => [ + 'sys_language_uid' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'language', + ], + ], + 'l18n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + [ + '', + 0, + ], + ], + 'foreign_table' => 'tx_powermailcond_domain_model_rule', + 'foreign_table_where' => 'AND {#tx_powermailcond_domain_model_rule}.{#pid}=###CURRENT_PID### AND {#tx_powermailcond_domain_model_rule}.{#sys_language_uid} IN (-1,0)', + 'default' => 0, + ], + ], + 'l18n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], 'hidden' => [ 'exclude' => true, 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:LGL.hidden', @@ -47,6 +89,8 @@ ], ], 'start_field' => [ + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', 'exclude' => true, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_rules.startField', 'config' => [ @@ -68,6 +112,8 @@ ], ], 'ops' => [ + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly', 'exclude' => true, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_rules.operator', 'onChange' => 'reload', @@ -181,8 +227,7 @@ 'displayCond' => 'FIELD:ops:IN:8,9', ], 'conditions' => [ - 'l10n_mode' => 'exclude', - 'exclude' => true, + 'exclude' => false, 'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_rules.condition', 'config' => [ 'type' => 'select', @@ -191,7 +236,7 @@ ['', 0], ], 'foreign_table' => 'tx_powermailcond_domain_model_condition', - 'foreign_table_where' => 'AND tx_powermailcond_domain_model_condition.pid=###CURRENT_PID### AND tx_powermailcond_domain_model_condition.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)', + 'foreign_table_where' => 'AND {#tx_powermailcond_domain_model_condition}.{#pid}=###CURRENT_PID### AND {#tx_powermailcond_domain_model_condition}.{#sys_language_uid} IN (-1,###REC_FIELD_sys_language_uid###)', 'default' => 0, ], ], diff --git a/composer.json b/composer.json index 00738ab..866575b 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "ext-json": "*", "ext-pdo": "*", "in2code/powermail": "^9.0", - "typo3/cms-core": "^11.5" + "typo3/cms-core": "^11.5.15 || ^11.5 <11.5.14" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.3", diff --git a/ext_tables.sql b/ext_tables.sql index 8b11a67..24e9182 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -1,81 +1,37 @@ CREATE TABLE tx_powermailcond_domain_model_conditioncontainer ( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - tstamp int(11) DEFAULT '0' NOT NULL, - crdate int(11) DEFAULT '0' NOT NULL, - cruser_id int(11) DEFAULT '0' NOT NULL, - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l18n_parent int(11) DEFAULT '0' NOT NULL, - l18n_diffsource mediumblob, - sorting int(10) DEFAULT '0' NOT NULL, - deleted tinyint(4) DEFAULT '0' NOT NULL, - hidden tinyint(4) DEFAULT '0' NOT NULL, - starttime int(11) DEFAULT '0' NOT NULL, - endtime int(11) DEFAULT '0' NOT NULL, + conditions int(11) unsigned DEFAULT '0' NOT NULL, + note tinyint(4) unsigned DEFAULT '0' NOT NULL, - conditions int(11) DEFAULT '0' NOT NULL, - note tinyint(4) DEFAULT '0' NOT NULL, - - title tinytext NOT NULL, - form int(11) DEFAULT '0' NOT NULL, - - PRIMARY KEY (uid), - KEY parent (pid) + title tinytext NOT NULL, + form int(11) unsigned DEFAULT '0' NOT NULL ); CREATE TABLE tx_powermailcond_domain_model_condition ( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - tstamp int(11) DEFAULT '0' NOT NULL, - crdate int(11) DEFAULT '0' NOT NULL, - cruser_id int(11) DEFAULT '0' NOT NULL, - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l18n_parent int(11) DEFAULT '0' NOT NULL, - l18n_diffsource mediumblob, - sorting int(10) DEFAULT '0' NOT NULL, - deleted tinyint(4) DEFAULT '0' NOT NULL, - hidden tinyint(4) DEFAULT '0' NOT NULL, - starttime int(11) DEFAULT '0' NOT NULL, - endtime int(11) DEFAULT '0' NOT NULL, + conditioncontainer int(11) unsigned DEFAULT '0' NOT NULL, + rules int(11) unsigned DEFAULT '0' NOT NULL, - rules int(11) DEFAULT '0' NOT NULL, - conditioncontainer int(11) DEFAULT '0' NOT NULL, + title tinytext NOT NULL, + target_field tinytext NOT NULL, + actions tinytext NOT NULL, + conjunction tinytext NOT NULL, - title tinytext NOT NULL, - target_field tinytext NOT NULL, - actions tinytext NOT NULL, - conjunction tinytext NOT NULL, - - PRIMARY KEY (uid), - KEY parent (pid), - KEY conditioncontainer (conditioncontainer), - KEY target_field (target_field(20)) + key conditioncontainer (conditioncontainer), + key target_field (target_field(20)) ); CREATE TABLE tx_powermailcond_domain_model_rule ( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - tstamp int(11) DEFAULT '0' NOT NULL, - crdate int(11) DEFAULT '0' NOT NULL, - cruser_id int(11) DEFAULT '0' NOT NULL, - sorting int(10) DEFAULT '0' NOT NULL, - deleted tinyint(4) DEFAULT '0' NOT NULL, - hidden tinyint(4) DEFAULT '0' NOT NULL, - - conditions int(11) DEFAULT '0' NOT NULL, + conditions int(11) unsigned DEFAULT '0' NOT NULL, - title tinytext NOT NULL, - start_field int(11) DEFAULT '0' NOT NULL, - ops int(11) DEFAULT '0' NOT NULL, - cond_string text NOT NULL, - equal_field int(11) DEFAULT '0' NOT NULL, + title tinytext NOT NULL, + start_field int(11) unsigned DEFAULT '0' NOT NULL, + ops int(11) unsigned DEFAULT '0' NOT NULL, + cond_string text NOT NULL, + equal_field int(11) unsigned DEFAULT '0' NOT NULL, - PRIMARY KEY (uid), - KEY parent (pid), - KEY conditions (conditions), - KEY start_field (start_field), - KEY equal_field (equal_field) + key conditions (conditions), + key start_field (start_field), + key equal_field (equal_field) ); From 69b415be234b6e1a84060887d1b71ab2024ad387 Mon Sep 17 00:00:00 2001 From: Stefan Busemann Date: Tue, 16 Aug 2022 08:06:39 +0200 Subject: [PATCH 2/5] [TASK] Add php fix command --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 866575b..3a0bc4a 100644 --- a/composer.json +++ b/composer.json @@ -75,6 +75,7 @@ "[ -L .Build/Web/typo3conf/ext/powermail_cond ] || ln -snvf ../../../../. .Build/Web/typo3conf/ext/powermail_cond" ], "test:php:cs": "php-cs-fixer fix --dry-run --config=.project/tests/.php-cs-fixer.php --diff", + "test:php:csfix": "php-cs-fixer fix --config=.project/tests/.php-cs-fixer.php --diff", "test:php:lint": "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l", "test:ts:lint": "typoscript-lint -c .project/tests/typoscript-lint.yml --fail-on-warnings" } From bef976994671619afe26e163c613894b56f6725a Mon Sep 17 00:00:00 2001 From: Stefan Busemann Date: Tue, 16 Aug 2022 08:07:21 +0200 Subject: [PATCH 3/5] [BUGFIX] to make php-cs-fixer happy --- Classes/Controller/ConditionController.php | 2 +- Classes/Domain/Model/Condition.php | 8 ++++---- .../TCA/tx_powermailcond_domain_model_condition.php | 2 +- .../tx_powermailcond_domain_model_conditioncontainer.php | 2 +- ext_emconf.php | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Classes/Controller/ConditionController.php b/Classes/Controller/ConditionController.php index 8c983d7..4506483 100644 --- a/Classes/Controller/ConditionController.php +++ b/Classes/Controller/ConditionController.php @@ -90,7 +90,7 @@ public function buildConditionAction(): ResponseInterface $arguments = []; // Use the forms non-localized UID, because the field is l10n_mode exclude $conditionContainer = $this->conditionContainerRepository->findOneByForm($form->getUid()); - if (null !== $conditionContainer) { + if ($conditionContainer !== null) { $arguments = $conditionContainer->applyConditions($form, $powermailArguments); $this->typoscriptFrontendController->fe_user->setAndSaveSessionData('tx_powermail_cond', $arguments); unset($arguments['backup'], $arguments['field']); diff --git a/Classes/Domain/Model/Condition.php b/Classes/Domain/Model/Condition.php index 1115511..b74bcf9 100644 --- a/Classes/Domain/Model/Condition.php +++ b/Classes/Domain/Model/Condition.php @@ -109,7 +109,7 @@ public function getTargetField() /** @var Field $field */ return $fieldRepository->findByUid((int)$targetField); } - if (false !== stripos($targetField, 'fieldset:')) { + if (stripos($targetField, 'fieldset:') !== false) { $pageRepository = GeneralUtility::makeInstance(PageRepository::class); /** @var Page $page */ $uid = substr($targetField, 9); @@ -271,13 +271,13 @@ protected function applyOnField( $conditionUid; // Backup field value if field gets hidden - if (self::ACTION_HIDE_STRING === $action) { + if ($action === self::ACTION_HIDE_STRING) { $arguments[self::INDEX_BACKUP][$formUid][$pageUid][$fieldMarker] = $field->getText(); $field->setText(''); } if ( - self::ACTION_UN_HIDE_STRING === $action + $action === self::ACTION_UN_HIDE_STRING && isset($arguments[self::INDEX_BACKUP][$formUid][$pageUid][$fieldMarker]) ) { // fill field with backup'd value if field gets enabled again @@ -314,7 +314,7 @@ protected function applyOnPage(int $formUid, Page $page, array $arguments, strin public function applies(Form $form): bool { // If conjunction is or set $isOr to TRUE - $isOr = self::CONJUNCTION_OR === $this->conjunction; + $isOr = $this->conjunction === self::CONJUNCTION_OR; /** @var Rule $rule */ foreach ($this->rules as $rule) { diff --git a/Configuration/TCA/tx_powermailcond_domain_model_condition.php b/Configuration/TCA/tx_powermailcond_domain_model_condition.php index 509516a..f4d1875 100644 --- a/Configuration/TCA/tx_powermailcond_domain_model_condition.php +++ b/Configuration/TCA/tx_powermailcond_domain_model_condition.php @@ -127,7 +127,7 @@ 'levelLinksPosition' => 'top', 'showSynchronizationLink' => 0, 'showAllLocalizationLink' => 1, - 'showPossibleLocalizationRecords' => 1 + 'showPossibleLocalizationRecords' => 1, ], ], ], diff --git a/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php b/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php index 23386f2..d7f8d76 100644 --- a/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php +++ b/Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php @@ -158,7 +158,7 @@ 'levelLinksPosition' => 'top', 'showSynchronizationLink' => 0, 'showAllLocalizationLink' => 1, - 'showPossibleLocalizationRecords' => 1 + 'showPossibleLocalizationRecords' => 1, ], ], ], diff --git a/ext_emconf.php b/ext_emconf.php index ef1879e..b0cb69e 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,4 +1,5 @@ 'Powermail Conditions', 'description' => 'Add conditions (via AJAX) to powermail forms for fields and pages', From 328c3c778093cf186a86d30dd3c4cb7d112f5099 Mon Sep 17 00:00:00 2001 From: Stefan Busemann Date: Tue, 16 Aug 2022 08:11:39 +0200 Subject: [PATCH 4/5] [TASK] update ext_emconf resolved #41 --- ext_emconf.php | 2 +- readme.md | 63 +++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/ext_emconf.php b/ext_emconf.php index b0cb69e..7b43b1f 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,7 +4,7 @@ 'title' => 'Powermail Conditions', 'description' => 'Add conditions (via AJAX) to powermail forms for fields and pages', 'category' => 'plugin', - 'version' => '9.0.3', + 'version' => '9.0.4-dev', 'state' => 'stable', 'author' => 'Alex Kellner', 'author_email' => 'alexander.kellner@in2code.de', diff --git a/readme.md b/readme.md index 1f150e5..f9e2d32 100644 --- a/readme.md +++ b/readme.md @@ -46,37 +46,38 @@ routeEnhancers: ## Changelog -| Version | Date | State | Description | -|---------|------------|---------|----------------------------------------------------------------------------------------------------------------------| -| 9.0.3 | 2022-07-05 | Bugfix | Fix ext_emconf.php for TER upload via REST API (another change) | -| 9.0.2 | 2022-07-05 | Bugfix | Fix ext_emconf.php for TER upload via REST API | -| 9.0.1 | 2022-07-04 | Bugfix | Fix page fieldset conditions not being applied correctly | -| 9.0.0 | 2022-02-23 | Feature | Support for TYPO3 11 and Powermail 9 | -| 8.2.2 | 2021-11-22 | Bugfix | Reverted type change for field condition.target_field and updated index configuration for this field | -| 8.2.1 | 2021-11-22 | Bugfix | Use integer field for condition.target_field | -| 8.2.0 | 2021-11-22 | Task | Add mysql indices, hide children tables in list view, add code linting tests | -| 8.1.1 | 2021-08-04 | Task | Simplify TCA to also fix the start/endtime bug in TYPO3 (last regression) | -| 8.1.0 | 2021-03-18 | Feature | Add TER autodeployment, add extension key to composer.json, small doc fix | -| 8.0.3 | 2020-04-30 | Bugfix | Enforce content-type in TypoScript | -| 8.0.2 | 2020-04-30 | Bugfix | Also support checkboxes (array values) in powermail 8 | -| 8.0.1 | 2020-04-29 | Task | Add useless dependency to TYPO3 for TER upload | -| 8.0.0 | 2020-04-29 | Task | Update extension for powermail 8 and TYPO3 10.4 | -| 7.0.0 | 2018-11-16 | Task | Update dependencies for powermail 7 | -| 6.1.0 | 2018-10-21 | Task | Remove deprecation warnings in TYPO3 9.5 | -| 6.0.0 | 2018-10-16 | Task | Support powermail 6.1 | -| 5.0.0 | 2018-05-24 | Task | Support powermail 6.0 | -| 4.1.1 | 2018-03-28 | Bugfix | Prevent exceptions in log | -| 4.1.0 | 2018-01-29 | Task | Remove dependencies for TYPO3 7.6 | -| 4.0.0 | 2018-01-15 | Task | Update dependencies for powermail 5.0 | -| 3.5.2 | 2017-12-05 | Bugfix | Turn of ConditionAwareValitor on fields without page relations | -| 3.5.1 | 2017-12-13 | Bugfix | Prevent exceptions in backend for MySQL strict mode | -| 3.5.0 | 2017-11-13 | Task | Update dependencies for powermail 4.x | -| 3.4.0 | 2017-08-14 | Feature | Allow all fieldtypes for target, add JS compression | -| 3.3.4 | 2017-07-25 | Bugfix | Reduce unneeded calls in frontend | -| 3.3.3 | 2017-06-12 | Bugfix | Small change for MySQL strict mode | -| 3.3.2 | 2017-05-20 | Bugfix | TCA update for TYPO3 8.7 | -| 3.3.1 | 2017-04-25 | Bugfix | Fix package name in composer.json | -| 3.3.0 | 2017-04-23 | Task | Move ext to github, make it fit for TYPO3 8.7 LTS | +| Version | Date | State | Description | +|---------|------------|---------|------------------------------------------------------------------------------------------------------| +| 9.0.4 | 2022-nn-nn | Bugfix | Allow multilanguage conditions | +| 9.0.3 | 2022-07-05 | Bugfix | Fix ext_emconf.php for TER upload via REST API (another change) | +| 9.0.2 | 2022-07-05 | Bugfix | Fix ext_emconf.php for TER upload via REST API | +| 9.0.1 | 2022-07-04 | Bugfix | Fix page fieldset conditions not being applied correctly | +| 9.0.0 | 2022-02-23 | Feature | Support for TYPO3 11 and Powermail 9 | +| 8.2.2 | 2021-11-22 | Bugfix | Reverted type change for field condition.target_field and updated index configuration for this field | +| 8.2.1 | 2021-11-22 | Bugfix | Use integer field for condition.target_field | +| 8.2.0 | 2021-11-22 | Task | Add mysql indices, hide children tables in list view, add code linting tests | +| 8.1.1 | 2021-08-04 | Task | Simplify TCA to also fix the start/endtime bug in TYPO3 (last regression) | +| 8.1.0 | 2021-03-18 | Feature | Add TER autodeployment, add extension key to composer.json, small doc fix | +| 8.0.3 | 2020-04-30 | Bugfix | Enforce content-type in TypoScript | +| 8.0.2 | 2020-04-30 | Bugfix | Also support checkboxes (array values) in powermail 8 | +| 8.0.1 | 2020-04-29 | Task | Add useless dependency to TYPO3 for TER upload | +| 8.0.0 | 2020-04-29 | Task | Update extension for powermail 8 and TYPO3 10.4 | +| 7.0.0 | 2018-11-16 | Task | Update dependencies for powermail 7 | +| 6.1.0 | 2018-10-21 | Task | Remove deprecation warnings in TYPO3 9.5 | +| 6.0.0 | 2018-10-16 | Task | Support powermail 6.1 | +| 5.0.0 | 2018-05-24 | Task | Support powermail 6.0 | +| 4.1.1 | 2018-03-28 | Bugfix | Prevent exceptions in log | +| 4.1.0 | 2018-01-29 | Task | Remove dependencies for TYPO3 7.6 | +| 4.0.0 | 2018-01-15 | Task | Update dependencies for powermail 5.0 | +| 3.5.2 | 2017-12-05 | Bugfix | Turn of ConditionAwareValitor on fields without page relations | +| 3.5.1 | 2017-12-13 | Bugfix | Prevent exceptions in backend for MySQL strict mode | +| 3.5.0 | 2017-11-13 | Task | Update dependencies for powermail 4.x | +| 3.4.0 | 2017-08-14 | Feature | Allow all fieldtypes for target, add JS compression | +| 3.3.4 | 2017-07-25 | Bugfix | Reduce unneeded calls in frontend | +| 3.3.3 | 2017-06-12 | Bugfix | Small change for MySQL strict mode | +| 3.3.2 | 2017-05-20 | Bugfix | TCA update for TYPO3 8.7 | +| 3.3.1 | 2017-04-25 | Bugfix | Fix package name in composer.json | +| 3.3.0 | 2017-04-23 | Task | Move ext to github, make it fit for TYPO3 8.7 LTS | ## More to come soon? From 8f5072b51f91e52cc85f7093310a0934b224f308 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Thu, 22 Sep 2022 18:16:56 +0200 Subject: [PATCH 5/5] [TASK] Release preparations --- ext_emconf.php | 2 +- readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext_emconf.php b/ext_emconf.php index 7b43b1f..4e12568 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,7 +4,7 @@ 'title' => 'Powermail Conditions', 'description' => 'Add conditions (via AJAX) to powermail forms for fields and pages', 'category' => 'plugin', - 'version' => '9.0.4-dev', + 'version' => '9.0.4', 'state' => 'stable', 'author' => 'Alex Kellner', 'author_email' => 'alexander.kellner@in2code.de', diff --git a/readme.md b/readme.md index f9e2d32..d02c68c 100644 --- a/readme.md +++ b/readme.md @@ -48,7 +48,7 @@ routeEnhancers: | Version | Date | State | Description | |---------|------------|---------|------------------------------------------------------------------------------------------------------| -| 9.0.4 | 2022-nn-nn | Bugfix | Allow multilanguage conditions | +| 9.0.4 | 2022-10-10 | Bugfix | Allow multilanguage conditions | | 9.0.3 | 2022-07-05 | Bugfix | Fix ext_emconf.php for TER upload via REST API (another change) | | 9.0.2 | 2022-07-05 | Bugfix | Fix ext_emconf.php for TER upload via REST API | | 9.0.1 | 2022-07-04 | Bugfix | Fix page fieldset conditions not being applied correctly |