Skip to content

Commit e64061b

Browse files
committed
Merge branch 'release/10.3.2'
2 parents ea7fbaa + aea7381 commit e64061b

File tree

10 files changed

+116
-55
lines changed

10 files changed

+116
-55
lines changed

Classes/Domain/Service/SaveToAnyTableService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function setAdditionalWhere(string $additionalWhere): void
308308
/**
309309
* Remove not allowed signs
310310
*
311-
* @param $string
311+
* @param string $string
312312
* @return void
313313
*/
314314
protected function removeNotAllowedSigns(string &$string): void

Classes/Finisher/AbstractFinisher.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
abstract class AbstractFinisher implements FinisherInterface
1212
{
13-
1413
/**
1514
* @var Mail
1615
*/
@@ -49,6 +48,30 @@ abstract class AbstractFinisher implements FinisherInterface
4948
*/
5049
protected $contentObject;
5150

51+
/**
52+
* @param Mail $mail
53+
* @param array $configuration
54+
* @param array $settings
55+
* @param bool $formSubmitted
56+
* @param string $actionMethodName
57+
* @param ContentObjectRenderer $contentObject
58+
*/
59+
public function __construct(
60+
Mail $mail,
61+
array $configuration,
62+
array $settings,
63+
bool $formSubmitted,
64+
string $actionMethodName,
65+
ContentObjectRenderer $contentObject
66+
) {
67+
$this->setMail($mail);
68+
$this->setConfiguration($configuration);
69+
$this->setSettings($settings);
70+
$this->setFormSubmitted($formSubmitted);
71+
$this->setActionMethodName($actionMethodName);
72+
$this->contentObject = $contentObject;
73+
}
74+
5275
/**
5376
* @return Mail
5477
*/
@@ -147,28 +170,4 @@ public function setActionMethodName(string $actionMethodName): FinisherInterface
147170
public function initializeFinisher(): void
148171
{
149172
}
150-
151-
/**
152-
* @param Mail $mail
153-
* @param array $configuration
154-
* @param array $settings
155-
* @param bool $formSubmitted
156-
* @param string $actionMethodName
157-
* @param ContentObjectRenderer $contentObject
158-
*/
159-
public function __construct(
160-
Mail $mail,
161-
array $configuration,
162-
array $settings,
163-
bool $formSubmitted,
164-
string $actionMethodName,
165-
ContentObjectRenderer $contentObject
166-
) {
167-
$this->setMail($mail);
168-
$this->setConfiguration($configuration);
169-
$this->setSettings($settings);
170-
$this->setFormSubmitted($formSubmitted);
171-
$this->setActionMethodName($actionMethodName);
172-
$this->contentObject = $contentObject;
173-
}
174173
}

Classes/Finisher/RedirectFinisher.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use In2code\Powermail\Domain\Service\RedirectUriService;
66
use In2code\Powermail\Utility\FrontendUtility;
7-
use In2code\Powermail\Utility\ObjectUtility;
7+
use TYPO3\CMS\Core\Utility\GeneralUtility;
88
use TYPO3\CMS\Core\Utility\HttpUtility;
99
use TYPO3\CMS\Extbase\Object\Exception;
1010

@@ -13,7 +13,6 @@
1313
*/
1414
class RedirectFinisher extends AbstractFinisher implements FinisherInterface
1515
{
16-
1716
/**
1817
* @var array
1918
*/
@@ -27,8 +26,7 @@ class RedirectFinisher extends AbstractFinisher implements FinisherInterface
2726
*/
2827
public function redirectToUriFinisher(): void
2928
{
30-
/** @var RedirectUriService $redirectService */
31-
$redirectService = ObjectUtility::getObjectManager()->get(RedirectUriService::class, $this->contentObject);
29+
$redirectService = GeneralUtility::makeInstance(RedirectUriService::class, $this->contentObject);
3230
$uri = $redirectService->getRedirectUri();
3331
if (!empty($uri) && $this->isRedirectEnabled()) {
3432
HttpUtility::redirect($uri);

Classes/Finisher/SaveToAnyTableFinisher.php

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,72 @@
22
declare(strict_types = 1);
33
namespace In2code\Powermail\Finisher;
44

5+
use Doctrine\DBAL\DBALException;
6+
use In2code\Powermail\Domain\Model\Mail;
57
use In2code\Powermail\Domain\Repository\MailRepository;
68
use In2code\Powermail\Domain\Service\SaveToAnyTableService;
9+
use In2code\Powermail\Exception\DatabaseFieldMissingException;
10+
use In2code\Powermail\Exception\PropertiesMissingException;
711
use In2code\Powermail\Utility\ObjectUtility;
812
use In2code\Powermail\Utility\StringUtility;
913
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
14+
use TYPO3\CMS\Core\Utility\GeneralUtility;
15+
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
1016
use TYPO3\CMS\Extbase\Object\Exception;
1117
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
1218
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException;
19+
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
1320

1421
/**
1522
* Class SaveToAnyTableFinisher
1623
*/
1724
class SaveToAnyTableFinisher extends AbstractFinisher implements FinisherInterface
1825
{
26+
/**
27+
* @var ContentObjectRenderer
28+
* local instance that can be manipulated via start() and has no influence to parent::contentObject
29+
*/
30+
protected $contentObjectLocal;
31+
1932
/**
2033
* @var array
2134
*/
2235
protected $dataArray = [];
2336

37+
/**
38+
* @param Mail $mail
39+
* @param array $configuration
40+
* @param array $settings
41+
* @param bool $formSubmitted
42+
* @param string $actionMethodName
43+
* @param ContentObjectRenderer $contentObject
44+
*/
45+
public function __construct(
46+
Mail $mail,
47+
array $configuration,
48+
array $settings,
49+
bool $formSubmitted,
50+
string $actionMethodName,
51+
ContentObjectRenderer $contentObject
52+
) {
53+
parent::__construct($mail, $configuration, $settings, $formSubmitted, $actionMethodName, $contentObject);
54+
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
55+
$this->contentObjectLocal = $configurationManager->getContentObject();
56+
}
57+
2458
/**
2559
* Preperation function for every table
2660
*
2761
* @return void
28-
* @throws Exception
62+
* @throws DBALException
63+
* @throws DatabaseFieldMissingException
64+
* @throws PropertiesMissingException
2965
*/
3066
public function savePreflightFinisher(): void
3167
{
3268
if ($this->isConfigurationAvailable()) {
3369
foreach (array_keys($this->configuration) as $key) {
34-
$this->contentObject->start($this->getDataArray());
70+
$this->contentObjectLocal->start($this->getDataArray());
3571
$tableConfiguration = $this->configuration[$key];
3672
$numberKey = (int)StringUtility::removeLastDot($key);
3773
if ($this->isSaveToAnyTableActivatedForSpecifiedTable($tableConfiguration)) {
@@ -47,12 +83,14 @@ public function savePreflightFinisher(): void
4783
* @param int $numberKey
4884
* @param array $tableConfiguration
4985
* @return void
50-
* @throws Exception
86+
* @throws DBALException
87+
* @throws DatabaseFieldMissingException
88+
* @throws PropertiesMissingException
5189
*/
5290
protected function saveSpecifiedTablePreflight(int $numberKey, array $tableConfiguration): void
5391
{
5492
/* @var $saveService SaveToAnyTableService */
55-
$saveService = ObjectUtility::getObjectManager()->get(
93+
$saveService = GeneralUtility::makeInstance(
5694
SaveToAnyTableService::class,
5795
$this->getTableName($tableConfiguration)
5896
);
@@ -73,7 +111,7 @@ protected function setPropertiesInSaveService(SaveToAnyTableService $saveService
73111
{
74112
foreach (array_keys($tableConfiguration) as $field) {
75113
if (!$this->isSkippedKey($field)) {
76-
$value = $this->contentObject->cObjGetSingle(
114+
$value = $this->contentObjectLocal->cObjGetSingle(
77115
$tableConfiguration[$field],
78116
$tableConfiguration[$field . '.']
79117
);
@@ -123,7 +161,7 @@ protected function addAdditionalWhereClause(SaveToAnyTableService $saveService,
123161
}
124162
if (!empty($tableConfiguration['_ifUniqueWhereClause'])
125163
&& !empty($tableConfiguration['_ifUniqueWhereClause.'])) {
126-
$whereClause = $this->contentObject->cObjGetSingle(
164+
$whereClause = $this->contentObjectLocal->cObjGetSingle(
127165
$tableConfiguration['_ifUniqueWhereClause'],
128166
$tableConfiguration['_ifUniqueWhereClause.']
129167
);
@@ -143,7 +181,7 @@ protected function addAdditionalWhereClause(SaveToAnyTableService $saveService,
143181
*/
144182
protected function getTableName(array $tableConfiguration): string
145183
{
146-
return $this->contentObject->cObjGetSingle($tableConfiguration['_table'], $tableConfiguration['_table.']);
184+
return $this->contentObjectLocal->cObjGetSingle($tableConfiguration['_table'], $tableConfiguration['_table.']);
147185
}
148186

149187
/**
@@ -152,7 +190,10 @@ protected function getTableName(array $tableConfiguration): string
152190
*/
153191
protected function isSaveToAnyTableActivatedForSpecifiedTable($tableConfiguration): bool
154192
{
155-
$enable = $this->contentObject->cObjGetSingle($tableConfiguration['_enable']??'', $tableConfiguration['_enable.']??null);
193+
$enable = $this->contentObjectLocal->cObjGetSingle(
194+
$tableConfiguration['_enable'] ?? '',
195+
$tableConfiguration['_enable.'] ?? null
196+
);
156197
return !empty($enable);
157198
}
158199

Classes/Finisher/SendParametersFinisher.php

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
declare(strict_types = 1);
33
namespace In2code\Powermail\Finisher;
44

5+
use In2code\Powermail\Domain\Model\Mail;
56
use In2code\Powermail\Domain\Repository\MailRepository;
67
use In2code\Powermail\Domain\Service\ConfigurationService;
78
use In2code\Powermail\Utility\ObjectUtility;
9+
use TYPO3\CMS\Core\Utility\GeneralUtility;
810
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
911
use TYPO3\CMS\Extbase\Object\Exception;
1012
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
1113
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException;
14+
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
1215

1316
/**
1417
* SendParametersFinisher to send params via CURL
@@ -17,9 +20,15 @@ class SendParametersFinisher extends AbstractFinisher implements FinisherInterfa
1720
{
1821
/**
1922
* @var ConfigurationManagerInterface
23+
* local instance that can be manipulated via start() and has no influence to parent::contentObject
2024
*/
2125
protected $configurationManager;
2226

27+
/**
28+
* @var ContentObjectRenderer
29+
*/
30+
protected $contentObjectLocal = null;
31+
2332
/**
2433
* TypoScript configuration part sendPost
2534
*
@@ -42,6 +51,27 @@ class SendParametersFinisher extends AbstractFinisher implements FinisherInterfa
4251
*/
4352
protected $configuration;
4453

54+
/**
55+
* @param Mail $mail
56+
* @param array $configuration
57+
* @param array $settings
58+
* @param bool $formSubmitted
59+
* @param string $actionMethodName
60+
* @param ContentObjectRenderer $contentObject
61+
*/
62+
public function __construct(
63+
Mail $mail,
64+
array $configuration,
65+
array $settings,
66+
bool $formSubmitted,
67+
string $actionMethodName,
68+
ContentObjectRenderer $contentObject
69+
) {
70+
parent::__construct($mail, $configuration, $settings, $formSubmitted, $actionMethodName, $contentObject);
71+
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
72+
$this->contentObjectLocal = $configurationManager->getContentObject();
73+
}
74+
4575
/**
4676
* Send values via curl to a third party software
4777
*
@@ -97,7 +127,10 @@ protected function getCurlSettings(): array
97127
*/
98128
protected function getValues(): string
99129
{
100-
return $this->contentObject->cObjGetSingle($this->configuration['values'], $this->configuration['values.']);
130+
return $this->contentObjectLocal->cObjGetSingle(
131+
$this->configuration['values'],
132+
$this->configuration['values.']
133+
);
101134
}
102135

103136
/**
@@ -109,7 +142,7 @@ protected function getValues(): string
109142
*/
110143
protected function isEnabled(): bool
111144
{
112-
return $this->contentObject->cObjGetSingle(
145+
return $this->contentObjectLocal->cObjGetSingle(
113146
$this->configuration['_enable'],
114147
$this->configuration['_enable.']
115148
) === '1' && $this->isFormSubmitted();
@@ -124,18 +157,9 @@ protected function isEnabled(): bool
124157
public function initializeFinisher(): void
125158
{
126159
$mailRepository = ObjectUtility::getObjectManager()->get(MailRepository::class);
127-
$this->contentObject->start($mailRepository->getVariablesWithMarkersFromMail($this->mail));
160+
$this->contentObjectLocal->start($mailRepository->getVariablesWithMarkersFromMail($this->mail));
128161
$configurationService = ObjectUtility::getObjectManager()->get(ConfigurationService::class);
129162
$configuration = $configurationService->getTypoScriptConfiguration();
130163
$this->configuration = $configuration['marketing.']['sendPost.'];
131164
}
132-
133-
/**
134-
* @param ConfigurationManagerInterface $configurationManager
135-
* @return void
136-
*/
137-
public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager): void
138-
{
139-
$this->configurationManager = $configurationManager;
140-
}
141165
}

Configuration/Services.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ services:
77
In2code\Powermail\:
88
resource: '../Classes/*'
99

10-
# Commands
11-
1210
In2code\Powermail\Command\CleanupExportsCommand:
1311
tags:
1412
- name: 'console.command'

Documentation/Changelog/Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ breaking changes and how to handle them
77

88
| Version | Release Date | Description |
99
|--------------|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
10+
| 10.3.2 | 2022-06-08 | Fix regression that prevented redirects after submit, Fix JS validation with reset buttons |
1011
| 10.3.1 | 2022-06-07 | Small bugfix update: Prevent exception on form submit, repair CSV/XLS/RSS in Pi2 |
1112
| 10.3.0 | 2022-06-06 | JS validation opens tab with first error field on morestep forms, Fix overrule TS settings, Fix pagebrowser in backend module, Fix finisher runner, Some more smaller fixes and code cleanups |
1213
| 10.2.0 | 2022-05-25 | Fix some tests, XLS export should be opened in a new window, fix some undefined array keys |

Resources/Private/Build/JavaScript/FormValidation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class Form {
473473

474474
#getFieldsFromForm() {
475475
return this.#form.querySelectorAll(
476-
'input:not([data-powermail-validation="disabled"]):not([type="hidden"]):not([type="submit"])'
476+
'input:not([data-powermail-validation="disabled"]):not([type="hidden"]):not([type="reset"]):not([type="submit"])'
477477
+ ', textarea:not([data-powermail-validation="disabled"])'
478478
+ ', select:not([data-powermail-validation="disabled"])'
479479
);

Resources/Public/JavaScript/Powermail/Form.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext_emconf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
and easy to use mailform extension with a lots of features
1010
(spam prevention, marketing information, optin, ajax submit, diagram analysis, etc...)',
1111
'category' => 'plugin',
12-
'version' => '10.3.1',
12+
'version' => '10.3.2',
1313
'state' => 'stable',
1414
'author' => 'Powermail Development Team',
1515
'author_email' => 'service@in2code.de',

0 commit comments

Comments
 (0)