Skip to content

Commit

Permalink
Merge branch 'release/9.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeldesu committed Oct 10, 2022
2 parents f770a7c + 8f5072b commit dc1cee8
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 176 deletions.
5 changes: 3 additions & 2 deletions Classes/Controller/ConditionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ public function buildConditionAction(): ResponseInterface
}

$arguments = [];
$conditionContainer = $this->conditionContainerRepository->findOneByForm($form);
if (null !== $conditionContainer) {
// Use the forms non-localized UID, because the field is l10n_mode exclude
$conditionContainer = $this->conditionContainerRepository->findOneByForm($form->getUid());
if ($conditionContainer !== null) {
$arguments = $conditionContainer->applyConditions($form, $powermailArguments);
$this->typoscriptFrontendController->fe_user->setAndSaveSessionData('tx_powermail_cond', $arguments);
unset($arguments['backup'], $arguments['field']);
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Model/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions Classes/Domain/Repository/ConditionContainerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
70 changes: 36 additions & 34 deletions Configuration/TCA/tx_powermailcond_domain_model_condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand All @@ -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,
],
],
Expand Down Expand Up @@ -105,7 +102,6 @@
'default' => 0,
],
],

'title' => [
'exclude' => true,
'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xlf:tx_powermailcond_conditions.title',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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,
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand All @@ -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,
],
],
Expand Down Expand Up @@ -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' => [
Expand All @@ -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',
Expand All @@ -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,
],
],
],
Expand Down
Loading

0 comments on commit dc1cee8

Please sign in to comment.