Bug #93962
open
Form variants for EmailToReceiver doesn't work
Added by asdasdsa maximustermax over 3 years ago.
Updated 2 months ago.
Tags:
form, finisher, variants
Sprint Focus:
Remote Sprint
Description
It is not possible to use different emails for languages.
Variants doesn't work for EmailToReceiver.
renderingOptions:
submitButtonLabel: Submit
type: Form
identifier: contact
label: Form
prototypeName: standard
finishers:
-
options:
message: confirm
contentElementUid: ''
identifier: Confirmation
-
options:
subject: 'Subject'
recipients:
first@domain.tld: ''
senderAddress: noreply@domain.tld
senderName: ''
addHtmlPart: true
attachUploads: true
translation:
language: ''
useFluidEmail: true
title: ''
identifier: EmailToReceiver
variants:
-
identifier: variant-1
condition: 'siteLanguage("twoLetterIsoCode") == "en"'
finishers:
-
identifier: EmailToReceiver
options:
recipients:
second@domain.tld: ''
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
type: Page
identifier: page-1
label: ''
renderables:
-
defaultValue: ''
type: Textarea
identifier: message
label: Message
properties:
fluidAdditionalAttributes:
required: required
validators:
-
identifier: NotEmpty
Files
- Sprint Focus set to Remote Sprint
- Status changed from New to Needs Feedback
Can you explain in more detail what "doesn't work" mean exactly? Do you see errors or similar? What is the exact behavior you see?
The issue I can see is that the finisher options are not merged. Instead the finisher variant is added as new finisher and thus obviously misses everything from the base finisher.
- Status changed from Needs Feedback to Accepted
- Status changed from Accepted to In Progress
- Assignee set to Mathias Brodala
- Status changed from In Progress to Under Review
Still present with TYPO3 11.5.12, I think.
Will this be fixed?
I can confirm this issue. Overwriting specific finisher options will delete all previously configured options instead of merging them. Here is my example
finishers:
1:
identifier: SaveToDatabase
options:
1:
table: tx_events2_domain_model_time
mode: insert
elements:
time-begin:
mapOnDatabaseColumn: time_begin
databaseColumnMappings:
pid:
value: 8
crdate:
value: '{__currentTimestamp}'
tstamp:
value: '{__currentTimestamp}'
2:
table: tx_events2_domain_model_event
mode: insert
elements:
choose-event-type:
mapOnDatabaseColumn: event_type
title:
mapOnDatabaseColumn: title
event-begin:
mapOnDatabaseColumn: event_begin
dateFormat: U
event-end:
mapOnDatabaseColumn: event_end
dateFormat: U
recurring-end:
mapOnDatabaseColumn: recurring_end
dateFormat: U
image-1:
mapOnDatabaseColumn: images
image-2:
mapOnDatabaseColumn: images
databaseColumnMappings:
pid:
value: 8
crdate:
value: '{__currentTimestamp}'
tstamp:
value: '{__currentTimestamp}'
hidden:
value: 1
event_time:
value: '{SaveToDatabase.insertedUids.1}'
variants:
-
identifier: prevent-storing-empty-event-time
condition: 'formValues["time-begin"] == ""'
finishers:
1:
identifier: SaveToDatabase
options:
# Do not create new record for tx_events2_domain_model_time
1: __UNSET
2:
databaseColumnMappings:
# Remove column mapping for tx_events2_domain_model_time
event_time: __UNSET
The current patch works perfectly. +1 from my side
Stefan
I not only can confirm this issue (TYPO3 v10.4.32) but have (an) additional problem(s) to solve:
If more than one finisher (e.g. EmailToReceiver and Redirect) is defined, you must add them all to the variant - even if you only want to override a single option from one of them. I guess this would be solved by this patch. But at least until this is merged (hopefully not only for v12) I have the issue that I can't let an editor override the redirect page if the variant condition is valid. I even tried to merge the finishers options within YAML.
- TYPO3 Version changed from 10 to 11
- PHP Version set to 8.1
- Tags set to form, finisher, variants
I ran in to these problems while changing email recipient by applicationContext condition.
If there is more than one finisher defined they all will be completely overridden when a single variant for one of those finishers is added.
After updating from v11.5.23 to v11.5.32 i can't reproduce it anymore.
Still present in TYPO3 12.4.11
- PHP Version changed from 8.1 to 8.2
Any news on this fix? The problem is still existent in v12.4.14
Without this patch using variants for finishers produces lots of overhead when one wants to change one line only out of hundreds.
Because it might break existing form configurations we should think about an option to enable finisher merges when using variants. Maybe something like that?
variants:
-
identifier: ac-variant-1
condition: 'applicationContext != "Production"'
mergeFinisherVariants: true
finishers:
-
identifier: anyFinisher
...
Meanwhile the documentation should be extended to clarify that finishers won't get merged but overwritten completely (it took me quite a lot of time to find this out).
In case anybody needs it, here is a patch for TYPO3 12.4
Also available in: Atom
PDF