"Confirm from waitlist" doesn't consider whether participant roles are counted.
To test this:
- Set your Participant Role of "Host" as not Counted. Keep "Attendee" as Counted.
- Create an event with a max enrollment of 1.
- Register a host.
- Observe that everywhere you can look in the UI, the non-counted participant isn't counted; registration is still open.
- Register an attendee.
- Add an attendee to the waitlist.
- Cancel (or delete) the registered attendee's participant record.
- At this point, everything STILL works correctly.
The issue only arises when the person gets the "Confirm you want to come off the waitlist" email and clicks the link, bringing them to
<site>/civicrm/event/confirm. This page says that registration is closed - because it's counting the Host against the max enrollment count.
After working through this, I realized this is very similar to #7 (closed) - the function
CRM_Event_BAO_Participant::pendingToConfirmSpaces() is a dog. It duplicates code found elsewhere, but poorly.
I replaced the one reference to this function with a call to
CRM_Event_BAO_Participant::eventFull(), which I tweaked slightly to accommodate this use case. This means that:
- We removed a 50-line function by adding 5 lines to another function;
- We replaced an untested function with a tested one.