It would be really nice if we could use relative dates ('-1 day') for scheduling and reminder mails. This would allow site admins to set sensible defaults for registration field instances.
I realise the current registration entity does not have a date associated with it, so the registration itself does not know when the event is. Node registration offers a select list to reference the event date (and other properties such as number of places) which can be set as node fields to the registration. We might be able to use some of that code?
That way people creating (basic) registrations would not need to enter the settings page anymore, as all properties are already set during node creation.
Is this something you would consider adding to the 7.x-2.x branch?
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff.txt | 14.96 KB | neograph734 |
| #17 | 2629758-17-relative_dates_for_scheduling.patch | 20.78 KB | neograph734 |
Comments
Comment #2
neograph734Comment #3
greg boggsThis sounds like a great feature to me. We'd likely review, test, and accept useful patches like one that would add the feature.
Comment #4
neograph734I'll see what I can do then. But it might take some time.
Comment #5
neograph734Perhaps you can think along with me to get this first time right.
The registration should be aware of a possible event date, thus we should add a property (event_date) to the registration entity. This property is to become the base for relative dates so that '-1 day' is calculated as
event_date -1 day. There are two possible options;On registration entity save, we update the reminder and schedule date fields with the newly calculated values
reminder_date = event_date - x daysor, when no event_date is provided (or the user does not want to use relative dates) we use the current date field. This makes sure all current implementations remain functioning as they are and requires some form API #states magic. The problem is we should store all relative date settings; open -10 days, close -1 day, reminder -3 days. Would a database blob field work (as we don't need this data to be readable or writable anywhere else except for in the forms).Summary
Should we calculate the event date based on a parent entity's property OR do we want to clone the field value and make sure it is always kept up to date?
Would it suffice to store all relative date values in a database blob to prevent creating lots of new db columns which don't require reading or writing except for when used in the form?
Comment #6
neograph734@Greg, could you perhaps share your thoughts on the proposed changes?
Comment #7
neograph734Temporarily removing myself so hopefully a maintainer sees the issue.
Comment #8
greg boggsI've read this a couple of times. This module has several maintainers and we all get emailed by each post in our issue queue. I'm afraid I'm not going to be much help to you in creating this feature. But, at a high level, it's best not to store blobs in the database. Blobs can't be used in views. Blobs can't easily be accessed with wrappers. Meanwhile, database columns are accessible. I'm wondering if you can't rely on only storing the date of the event. But, I don't really understand your use case completely as I haven't used node registration.
~Greg
Comment #9
neograph734Thanks Greg, I understand and I guess I can handle most of the issue by myself, I just wanted to get these basics discussed so I can write something that fits the module as good as possible.
The problem is twofold;
The question, should we
This has the following advantages:
Is this solid or am I missing things?
I hope I explained better now. There are two things I'd like to know before I start.
Which of the options in 1 better fits this module?
Is storing relative date strings, which are only used during the saving of registration field for calculating other date fields in a blob ok?
Comment #10
oranges13A lot of the work for this feature is already done in the patches for issue #1559178: Relative dates for scheduling and registration reminders
It allows you to choose the date field on the parent node you want to use, and basically replicates the relative date settings that the Signup module did. You set defaults in the Registration type, and then you can edit them on an instance-basis in each event node when you create it.
Comment #11
rootworkComment #12
oranges13I should have some time this weekend to get back into the code and help out with this :)
Comment #13
neograph734Awesome! Lets do this :)
Comment #14
neograph734This is what I came up with. I contains a database update hook, so you need to run update.php.
It still needs some checking if the linked date field actually contains a value, relative date options should be completely disabled otherwise.
Further it seems the state options are terribly broken somehow so all fields are shown at once. (No idea why though...)
Finally, the form validations might need some time but I could not look into that yet.
Last you want to know is that the fields are fully compatible with php relative formats, so you can enter things like
-2 weekdays,-1 month,first day of this week, etc.Please let me know what you think, I can continue working on this tomorrow.
Credits to nielsonm and oranges13 for their initial work on this.
Comment #15
neograph734Comment #16
neograph734Removed some TODO's as they were already done...
Comment #17
neograph734States API is fixed and the linked date field is actually working.
Now there are some validations that need updating (such as the registration requires a date check).
Also if no field is provided, it should not be an option to select it and minor ui tweaks (such as field descriptions).
Comment #18
kclarkson commented