CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • "Event Full" after one registration?
Pages: [1]

Author Topic: "Event Full" after one registration?  (Read 3306 times)

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
"Event Full" after one registration?
January 28, 2009, 05:20:32 pm
I have an event set to no registration limit (i.e. 0 max participants), but after registering a single user for the event, I get an "event full" error every time I try to register another test user.  What might I be doing wrong?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: "Event Full" after one registration?
January 28, 2009, 05:43:59 pm

can you reproduce this error on the demo server and/or the sandbox server. If so, please file an issue and we'll fix for next release

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: "Event Full" after one registration?
January 28, 2009, 06:44:13 pm
Nope, can't reproduce on the demo site.  So I must be doing something wrong... or using some odd combination of configurations.

I have no clue how to track this down.  Worst case scenario, I can set the event to a ridiculously large limit, but I fear that may be too complicated to ask the staff who will be managing events to remember to do.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: "Event Full" after one registration?
January 29, 2009, 04:17:24 pm
This seems weird. You might want to add debug code to the eventFull() function in CRM/Event/BAO/Participant.php and see how that message is getting triggered in your install...

Check out the Debugging in Code FAQ for info on spitting out variable values, queries etc:

http://wiki.civicrm.org/confluence/display/CRMDOC/Debug+Tools
Protect your investment in CiviCRM by  becoming a Member!

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: "Event Full" after one registration?
January 30, 2009, 07:41:21 pm
Well, I've tracked down the problem.

I'm using the API to create events.  If passed a NULL value (or no value at all) for max_participants, the API instead inserts 0 into the max_participants column.

Then the following code in CRM_Event_BAO_Participant::eventFull() sees a 0 instead of a NULL and decides that 1 registrant is greater than the limit of 0:

Code: [Select]
        if ( $dao->fetch( ) ) {
            if( $dao->max_participants == NULL ) {
                return false;
            }
           
            if( $dao->total_participants >= $dao->max_participants ) {
                if( $dao->event_full_text ) {
                    return $dao->event_full_text;
                } else {
                    return ts( "This event is full !!!" );
                }
            }
        }
        return false;

Presumably this could be fixed either in the API or in CRM_Event_BAO_Participant, depending on what other behavior it would break.  For an emergency workaround, I'll be duplicating CRM_Event_BAO_Participant and adding a check for 0 to the check for NULL.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: "Event Full" after one registration?
January 30, 2009, 09:56:52 pm
Quote
I'm using the API to create events.  If passed a NULL value (or no value at all) for max_participants, the API instead inserts 0 into the max_participants column.

You should try passing NULL as string. For eg:  max_participants => 'NULL'  or 'null'

HTh

Kurund
Found this reply helpful? Support CiviCRM

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: "Event Full" after one registration?
January 31, 2009, 08:08:44 am
Kurund - I'm wondering if the BAO should check for 0 and handle it the same as NULL (since max = 0 doesn't make sense).
Protect your investment in CiviCRM by  becoming a Member!

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: "Event Full" after one registration?
January 31, 2009, 08:36:17 am
Quote from: Kurund Jalmi on January 30, 2009, 09:56:52 pm
You should try passing NULL as string. For eg:  max_participants => 'NULL'  or 'null'

Thanks, I'll give that a shot.  My concern is that 0 is also the default value when the parameter (which is an optional one) isn't passed at all -- and since 0 is currently interpreted as an actual max, that doesn't work as a sane default.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: "Event Full" after one registration?
January 31, 2009, 08:40:12 am

can u apply the following patch, it should work (let us know if not)

Code: [Select]
svn diff CRM/Event/BAO/Participant.php
Index: CRM/Event/BAO/Participant.php
===================================================================
--- CRM/Event/BAO/Participant.php       (revision 19367)
+++ CRM/Event/BAO/Participant.php       (working copy)
@@ -296,7 +296,8 @@
         $dao =& CRM_Core_DAO::executeQuery( $query, CRM_Core_DAO::$_nullArray );
         
         if ( $dao->fetch( ) ) {
-            if( $dao->max_participants == NULL ) {
+            if( $dao->max_participants == NULL ||
+                $dao->max_participants <= 0 ) {
                 return false;

we'll incorporate this into 2.1 and future releases

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: "Event Full" after one registration?
January 31, 2009, 08:49:21 am
Yes, that's actually the exact fix I'd applied last night, since it seemed like the simplest approach -- and it does work.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: "Event Full" after one registration?
January 31, 2009, 01:16:12 pm

thanx. this is now part of 2.1 (and 2.2 etc). issue filed and fixed here: http://issues.civicrm.org/jira/browse/CRM-4057

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • "Event Full" after one registration?

This forum was archived on 2017-11-26.