Issue Bug Under Review Orphaned

#93962Form variants for EmailToReceiver doesn't work

asdasdsa maximustermax 04/21/21, 12:15 updated 10/11/24, 08:55

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

Reviews 1

History 1224

  1. Mathias Brodala commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2021-08-13T10:36:03+00:00" > 08/13/21, 10:36 </span>

    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?

  2. Mathias Brodala commented <span data-processor="relativetime" data-value="2021-08-13T16:05:19+00:00" > 08/13/21, 16:05 </span>

    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.

  3. Mathias Brodala changed status Accepted In Progress assigned to Mathias Brodala <span data-processor="relativetime" data-value="2021-08-13T16:34:23+00:00" > 08/13/21, 16:34 </span>

  4. Gerrit Code Review pushed patch set 1 for master to change 70586 status In Progress Under Review <span data-processor="relativetime" data-value="2021-08-13T16:36:28+00:00" > 08/13/21, 16:36 </span>

  5. Stefan Terborg commented <span data-processor="relativetime" data-value="2022-07-07T13:24:50+00:00" > 07/07/22, 13:24 </span>

    Still present with TYPO3 11.5.12, I think.
    Will this be fixed?

  6. Stefan Froemken commented <span data-processor="relativetime" data-value="2022-08-18T10:35:23+00:00" > 08/18/22, 10:35 </span>

    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

  7. Uwe Wiebach commented <span data-processor="relativetime" data-value="2022-10-20T16:08:34+00:00" > 10/20/22, 16:08 </span>

    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.

  8. Chris W commented and changed TYPO3 Version 10 11 PHP Version 8.1 Tags form, finisher, variants <span data-processor="relativetime" data-value="2023-10-30T08:20:20+00:00" > 10/30/23, 08:20 </span>

    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.

  9. Christian Ludwig commented and changed PHP Version 8.1 8.2 <span data-processor="relativetime" data-value="2024-05-28T19:11:07+00:00" > 05/28/24, 19:11 </span>

    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).

  10. Hannes Bochmann commented and changed attached form.issue-93962.patch <span data-processor="relativetime" data-value="2024-06-05T11:39:01+00:00" > 06/05/24, 11:39 </span>

    In case anybody needs it, here is a patch for TYPO3 12.4