Say a module defines a new status, and this status is used in the site for some registrations. Then the module defining this status is removed. How is this status exposed to users?

Somewhat related: How will other modules know it is OK to override this status with something else? Using a previous example , what if a registration needs an AWAITING PAYMENT -or- PAID -and- UNCONFIRMED status. Should multiple status be allowed per Registration?

CommentFileSizeAuthor
#11 signup_status_example.png51.84 KBezra-g

Comments

levelos’s picture

Good questions @dpi, and I'm open to suggestions.

How is this status exposed to users?

I suppose if could just be NA or something along those lines. I don't see this being a common situation.

How will other modules know it is OK to override this status with something else?

Not sure I understand your question. They could look in the API docs?

Should multiple status be allowed per Registration?

I don't think as part of core. E.g., if a payment is processed, usually safe to treat the registration as complete. Additional fields with a matrix of statuses could always be added.

Feel free to close if nothing else, or leave open if we need to keep exploring ...

jpontani’s picture

Not sure if you want this in another issue or not.

Another possible scenario (I know this scenario exists in COD setups with uc/signup):
Which statuses are taken into account in the count of actual registrations for an event? If I create a custom status of "Waitlist", it will still currently count against the total number of registrations for an event, even though it shouldn't as it is a waitlisted registration.

levelos’s picture

If I create a custom status of "Waitlist", it will still currently count against the total number of registrations for an event, even though it shouldn't as it is a waitlisted registration.

Actually it won't. Only Registrations with a status of "complete" counts against the total. But I can see how this could be limiting and maybe we need a separate schema for statuses with a flag on whether they should count against the total. Suggestions welcome.

dpi’s picture

I guess I feel that state should be either 0 or 1, like node.module status meaning either unpublished or published. Third parties have implemented an in-between state for an editors workflow, but do not override the status column at all.

Right now, I'm thinking do not allow other modules to define their own state, as this seems like it could get messy.

Using the payment example. A field could be attached to a registration which shows unpaid or paid. There's surely an advantage to exposing this kind of status to views or permitted users.

jpontani’s picture

Actually it won't. Only Registrations with a status of "complete" counts against the total. But I can see how this could be limiting and maybe we need a separate schema for statuses with a flag on whether they should count against the total. Suggestions welcome.

Ah ok. Wasn't sure if it did that or not (haven't looked at the code recently).

I know COD is looking at possibly using this module for its next version, so the following two things are features they're needing if this is the module they go with:

  1. Each status can have its own signup limit for an event
  2. Each status can count against the total signup limit for an event

Possible solution:
For both, in hook_registration_states, have more info returned in the array. IE:

$states['waitlist'] = array(
  'title' => t('Waitlist'),
  'state_limit' => 0,
  'total_limit' => FALSE,
);

Where state_limit is the state's registrant limit (maybe only 10 allowed on the waitlist, for example), total_limit is a flag as to whether any registration in this state would count against the overall registration limit, and title is self-explanatory.

You would probably want to store these in a separate table. That way you can have a UI to override settings that are declared initially in a module.

Just a thought.

levelos’s picture

Thanks @jpontani, great ideas. One issue to resolve is that an event's capacity is currently stored at the registration parent entity level, and can be managed per event. That seems to go against having a global limit per state. A possible solution would be to allow users to map limits to each state in the registration settings and store that in the serialized settings field. registration_has_room() would have to be updated accordingly.

@dpi, I hear ya', but we need more than a binary flip for registrations and at least some of it is needed in core.

jpontani’s picture

One issue to resolve is that an event's capacity is currently stored at the registration parent entity level, and can be managed per event. That seems to go against having a global limit per state. A possible solution would be to allow users to map limits to each state in the registration settings and store that in the serialized settings field. registration_has_room() would have to be updated accordingly.

True, hadn't really thought out the solution completely, just first thing that came to mind. In that case the hook_registration_states could pretty much remain the same, just as you said, store the state's settings in the registration settings.

greggles’s picture

Discussion here feels pretty good to me.

My sense is that modules can create new states, but that Registration should ultimately keep that information even if the module is disabled to avoid the problem that registration are in a state that is no longer visible. This argues away from hooks for declaring states and for having an API to create states that a module would use during hook_install/hook_update.

ezra-g’s picture

I agree with greggles' point in #8 that it would be ideal for Registration to store the various statuses natively so that we don't run into the situation where a status is deleted.

But I can see how this could be limiting and maybe we need a separate schema for statuses with a flag on whether they should count against the total. Suggestions welcome.
[snip]
A possible solution would be to allow users to map limits to each state in the registration settings and store that in the serialized settings field.

A separate schema seems preferable to me. For example, see the schema for Signup_status.

As an example of how this kind of configurability can be used, here's screenshot from the Drupal 6 version of Signup status:

Signup status example

Beyond the popular waiting list and "payment pending placeholder" use cases described above, this kind of configurability provides a solid base for more customized attendee requirements. For example, I worked on a site that had different signup statuses set aside for folks from specific companies. The motivation was to ensure a mix of attendees from companies other than the one that was hosting the event. We used a special attendee status for the host company and programatically enforced a limit for that signup type, and automatically assigned the type to folks from the company hosting the event.

greggles’s picture

@ezra-g #9 needs moar file upload.

ezra-g’s picture

StatusFileSize
new51.84 KB
levelos’s picture

Assigned: Unassigned » bleedev

Looks good gang, we're on it.

levelos’s picture

Status: Active » Fixed

This one's all set and pushed. The basics:

  • Add a new schema for registration states
  • Registration states are a new entity type, not fieldable, with the following properties: (machine) name, label, description, default flag, active flag to indicate if it should count against capacity, be used in broadcasts, etc., flag for including in registration form, and weight.
  • Completed, Pending, and Canceled default states are created on install and removed on uninstall.
  • There are several new state API calls, including getting all active states.
  • Existing API calls have been modified to account for the new active states.

Feedback welcome!

dpi’s picture

Status: Fixed » Needs work

Im going to bring back the original topic: If no states are active, what happens?

  • Broadcasting emails: no mails are sent out if there are no types.
  • registration_event_count(): Cannot determine available slots for a host entity. Defaulting to zero is safest. But this means users will be shown an 'is Full' message for host entity. This would be untrue.
greggles’s picture

@levelos - Thanks for the work and for documenting the changes in narrative form in #13. it would be great if you could post patches or the link to the commit to be able to go back and forth to confirm how the change was implemented. The commit for this is http://drupalcode.org/project/registration.git/commit/f36156c

levelos’s picture

Sure @greggles, normally I would. The changes are actually spread across several commits. We also found a couple lingering issues which we'll be pushing any minute now.

@dpi, we could force at least one state to be active. Otherwise, I think it's reasonable behavior for events to appear full and not send any broadcast messages if there are no active states.

All, one change to consider is a set of registration states per registration bundle. Adds complexity, but potentially useful. Thoughts?

jpontani’s picture

All, one change to consider is a set of registration states per registration bundle. Adds complexity, but potentially useful. Thoughts?

Quite useful, in my mind. You might want to have a VIP role for one event, but another event might not have VIP potential. Just an example.

dpi’s picture

Split off state per registration discussion to #1547190: States per registration type / states as fields.

levelos’s picture

Status: Needs work » Fixed

Marking this "meta" ticket as fixed so we can continue discussions as needed in other tickets.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • bleedev committed f36156c on 7.x-1.x, panels, any-entity, slots, integrations, hold_state
    #1529954: Registration states configuration