Project

General

Profile

Actions

Bug #89730

closed

The EmailFinisher does not parse variables before assigning to the view

Added by Rémy DANIEL over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Category:
Form Framework
Target version:
-
Start date:
2019-11-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Remote Sprint

Description

Hello

Context

Following this guide: [https://docs.typo3.org/c/typo3/cms-form/8.7/en-us/Concepts/FrontendRendering/Index.html#concepts-frontendrendering-codecomponents-customfinisherimplementations-finishercontext-sharedatabetweenfinishers]

I am trying to get a variable from a previous finisher and to set it in the variables of a next finisher.
Here is the summary of the finishers in the form definition:

finishers:
-
    identifier: SaveToDatabase
    options:
       table: 'tx_myext_domain_model_offer'
       mode: 'insert'
       ...
-
    identifier: EmailFinisher
    options:
      ...
      variables:
        recordUid: '{SaveToDatabase.insertedUids.0}'

Issue

In the fluid template of the email, the value of the variable {recordUid} is SaveToDatabase.insertedUids.0.

Expected

In the fluid template of the email, the value of the variable {recordUid} should be the UID of the record created by the finisher SaveToDatabase.

Solution

In \TYPO3\CMS\Form\Domain\Finishers\EmailFinisher::initializeStandaloneView(), $this->parseOption should be used instead of directly accessing $this->options.

Reproduced on TYPO3 8 and 9.

Actions #1

Updated by Rémy DANIEL over 4 years ago

  • Description updated (diff)
Actions #2

Updated by Björn Jacob over 4 years ago

  • Sprint Focus set to Remote Sprint
Actions #3

Updated by Mathias Brodala over 4 years ago

  • Status changed from New to In Progress
  • Assignee set to Mathias Brodala

Actually the variable is not necessary here since the template of the EmailFinisher also gets the FinisherVariableProvider assigned as finisherVariableProvider variable.

Then you could access your value as desired.

Actions #4

Updated by Gerrit Code Review over 4 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62363

Actions #5

Updated by Vasyl Mosiychuk over 4 years ago

Daniel is right, I can get this value '{SaveToDatabase.insertedUids.0}' only in "subject email" but in the "body email" I can not get this value... this can be very helpful

Actions #6

Updated by Mathias Brodala over 4 years ago

Vasyl Mosiychuk wrote:

Daniel is right, I can get this value '{SaveToDatabase.insertedUids.0}' only in "subject email" but in the "body email" I can not get this value... this can be very helpful

It actually works in your mail template:

{finisherVariableProvider.SaveToDatabase.insertedUids.0}
Actions #7

Updated by Rémy DANIEL over 4 years ago

The example at the end of https://docs.typo3.org/c/typo3/cms-form/master/en-us/I/Concepts/Finishers/Index.html?highlight=share#share-data-between-finishers suggested to me that a variable pushed into the FinisherVariableProvider is directly usable in the next finishers.

I think I misunderstood how it works.
The other finishers have to "parse" the variable's value before using it, because it is not automatically parsed.
And in the case of the EmailFinisher, I can access directly the finisherVariableProvider from the fluid template.

It is not really user-friendly api, some variables are parsed, some aren't.

Actions #8

Updated by Gerrit Code Review over 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62290

Actions #9

Updated by Mathias Brodala over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Gerrit Code Review over 4 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62290

Actions #11

Updated by Björn Jacob over 4 years ago

  • Status changed from Under Review to Resolved
Actions #12

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF