Sorry if this is a duplicate of others, since there's a few issues that might apply here.

I'm not sure if this is an issue or the intended design, but some review would be good on a specific section of `registration.module` and the function `registration_event_count()`.

Right now, the code runs as follows:

<?php
    $active_held_states = registration_states(array('held' => TRUE, 'active' => TRUE));
    if (!empty($active_held_states)) {
      $query->condition('state', $active_held_states, 'IN');
    }
?>

But where I'm getting lost on it is that this is grabbing registration states that are BOTH held and active, since `registration_states()` will accept condition parameters and add them separately as property conditions (i.e. AND select statements in SQL not OR). According to the validation patch in the DEV version on line 965 in `includes/registration.forms.inc` states can only be held OR active, so this check should never run, in theory.

Without that form validation, when a state is set to both held and active the system will return a fatal error, because registration objects are passed to the query condition, rather than arrays, which is described in Issue 2469985.

So I think it should be as follows:

<?php
    $active_held_states = array_merge(registration_get_active_states(), registration_get_held_states());
    if (!empty($active_held_states)) {
      $query->condition('state', $active_held_states, 'IN');
    }
?>

This appears to work on our testing site, but it would be good to get some feedback since ours is a limited use case.

CommentFileSizeAuthor
#1 registration-event-count-fix-2496559.patch655 bytes.bert

Comments

.bert’s picture

StatusFileSize
new655 bytes
aj2’s picture

I'm having the same issue, where a registration state that does not have an active or held configuration is being held against the total available spots. I can confirm that the patch in post #1 fixes my issue.

Appears this bug here, is also likely linked to the one here, with a different solution:

https://www.drupal.org/node/2497203

.bert’s picture

Thanks for that aj2. Looks like it's the same solution, just a different way of getting there. I think the patch included here is the better option since it makes use of functions that already return the state identifiers (names).

dsnopek’s picture

dsnopek’s picture

Status: Active » Reviewed & tested by the community

Works for me! :-)

LonitaD’s picture

The patch seems to work well. Thanks!

Marking #2487586: Active checkbox for registration state does not change the number of spaces filled as a duplicate of this issue.

nrackleff’s picture

Assigned: Unassigned » nrackleff
nrackleff’s picture

Assigned: nrackleff » Unassigned
amytswan’s picture

Assigned: Unassigned » amytswan
amytswan’s picture

Status: Reviewed & tested by the community » Fixed

Thank you .bert, dsnopek, aj2, and creativ180, for your attention to this issue. I've applied your patch .bert, and it is set to go out in our next release!

  • 94ed732 committed on 7.x-1.x
    Issue #2496559 by .bert with the assistance of dsnopek, aj2, amyvs,...

  • 94ed732 committed on 7.x-2.x
    Issue #2496559 by .bert with the assistance of dsnopek, aj2, amyvs,...

Status: Fixed » Closed (fixed)

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