Additional fields at Event level

OK.

I would like to add a couple or three extra fields to an Event – Namely Country of Origin(for VAT purposes – not necessary country of event), Country VAT Rate, and Country VAT Number.

Ideally I would record these when entering the general ‘settings’ when creating the event.

Previously I had managed to change OOTB code to allow me to add this data when creating a registration, but of course was duplicating it for every registration within an event. I added DB fields to the event_registrations.forms table to persist these.

This worked fine, but as I said, I was duplicating info, so decided to attempt to put at general settings level when creating the event.

I noticed that as well as using the events.event table for general data , you store some settings information in the events.settings table using the ‘module’ and ‘name’ to identify the value for the appropriate event.

I have tried about 5 times now to mimic your code but always end up with an attribute missing error, or assertion errors, or something similar – in all cases I am trying to add to the ‘settings’ table using either a ‘new’ module name, e.g. ‘country’ or one of the existing ones (tried both core and contact). I am doing this by code surfing for say ‘additional_info’ (along with related forms etc) and then making similar changes for my field(s)

The closest I got was initial persistence, but have never been allowed to edit them (can see them but get the errors etc), and now cannot even persist again!.

Have you got any sort of crib sheet of steps I should be following for this, or are you going to say ‘DON’T DO IT THAT WAY’ – if so, what way should I do it???

My next attempt was to add additional columns to the event table itself to see if I could persist there, but all these changes need to be recorded of course for future release.

Please can you advise (hopefully not with a DON’T DO IT) on how best to achieve this?

Mark.

1 Like

Write a plugin for it, and use its event_settings proxy. The EventSettingsProxy is the (only supported) way to access the events.settings table.

That way you do not need to touch the database or the core at all, and you can add e.g. a new link to the management menu that shows a page where you can configure this data.

I don’t expect you have any sort of example that does it already do you - just looked at git and couldn’t see any - I haven’t written any plugins yet!!!

Not for this particular case. But the indico-plugins and especially indico-plugins-cern repos do have many plugins that provide useful examples on plugin development in general.