Author Topic: Event free places  (Read 1527 times)

Offline chrisivens

  • I’m new here
  • *
  • Posts: 15
  • Karma: 2
    • Adhere Creative
Event free places
« on: February 08, 2009, 01:25:24 pm »
Things are getting a bit tricky here to work out. I have memberships that define a number of free places. The only thing now is to figure out how they are assigned and counted. Have a look at the possible scenarios and let me know if you have a way of counting them etc. Scenarios PDF

Offline chrisivens

  • I’m new here
  • *
  • Posts: 15
  • Karma: 2
    • Adhere Creative
Re: Event free places
« Reply #1 on: February 09, 2009, 08:14:10 am »
Okay it's very confusing.

In essence, A membership (defined by the grey box at the top with the number in) allows a certain number of free places. A membership either goes directly to a contact record OR it goes to a record and then cascades down to one or more other contacts using the membership relationship options.

If a contact is a member of more than one membership type, how do I count their free places allocation AND how do I tell when they've used it up?

I could go on for hours trying to explain myself. Please grab me in irc if you need a bit more info.

Offline Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5016
  • Karma: 193
    • My CiviCRM Blog
Re: Event free places
« Reply #2 on: February 09, 2009, 06:23:44 pm »
Not sure I understand fully what you're trying to accomplish. However, it seems like one thing you need to know is the list of contact record ID's linked to a given membership (including the contacts who inherit the membership from another contact).

The owner_membership_id in civicrm_membership links inherited memberships to the "primary member". For example, if I wanted to find out all the contacts who have inherited membership from contact 5 ...
Code: [Select]
SELECT contact_id
FROM `civicrm_membership`
WHERE owner_membership_id
IN ( SELECT id FROM civicrm_membership WHERE contact_id =5
)

You could then get a count on the civicrm_participant records for the event you are interested in, where contact_id is in the list returned above.

Not sure this is on track for what you're trying to do. Hopefully it's a start. Else, I guess pinging one of us on IRC is your best bet.
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My faves: Relative dates in search forms and Scheduled reminders for membership renewal.