alfio-event / alf.io

alf.io - The open source ticket reservation system for conferences, trade shows, workshops, meetups
https://alf.io
GNU General Public License v3.0
1.35k stars 341 forks source link

Additional Fields to Collect cannot be edited in the Template Editor #1354

Open andrewlewis426 opened 2 months ago

andrewlewis426 commented 2 months ago

Describe the bug I am using alf.io to host a car show and we would like to display the additional fields we collected. For our purposes, this is the car's make/model/year.

To Reproduce Steps to reproduce the behavior:

  1. Go to Templates
  2. Select a Template such as Ticket_PDF
  3. Try to add an additional field (note: This is not documented but I found it in the source code as "additional-fields" with: {{additional-fields.make}}
  4. Press preview
  5. You will get an error saying "field does not exist"

Expected behavior You can preview the template

Workaround Using the devtools in the browser, you can unhide the save button and save the updated template. The additional field then works as expected and displays in the final rendered template the registrant receives.

Potential Fix I think this is happening due to this line passing an empty map into the template editor: https://github.com/alfio-event/alf.io/blob/1cc53b7ce3673cc30aa6d7c3cb006d78c4909db9/src/main/java/alfio/util/TemplateResource.java#L201

We should be passing the collection of fields.