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 CiviMember (Moderator: Deepak Srivastava) »
  • Search listings for memberships 'on behalf of'
Pages: [1]

Author Topic: Search listings for memberships 'on behalf of'  (Read 1959 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Search listings for memberships 'on behalf of'
January 22, 2009, 07:49:50 am
Now that you can sign up for membership on behalf of an organization, all membership-based listings on member pages and elsewhere show the organization name in the columns. I need to print out mailing labels for all of these, but I need the mailing labels addressed to the individual who signed up on behalf of an org, not the organization itself.

My first thought was to create a profile for search listings, but I don't seem to have this field available to me as an option. Is there another way that I can accomplish this?

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: Search listings for memberships 'on behalf of'
January 22, 2009, 08:17:43 am

I suspect you'll need to build a custom search for this one. We store the link between the org and the individual as an "Employee of" permissioned relationship, so you can create a custom query which joins the two tables. As always, please publish your code if you do write this search :)

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

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Search listings for memberships 'on behalf of'
January 22, 2009, 12:39:55 pm
I am confused. I am trying to write the query for this but it doesn't make any sense to me.

Part 1: Aside from filling out the member sign-up form on behalf of an org, there isn't anywhere that I can see who signed up. You can't see this when you view the membership of the organization, you can't see this when you look at the individual who signed up on behalf of the organization. Seems like it should at least be on the membership form.....are there plans for this? should i file an issue?

Part 2: Anyway, I'm looking at the tables, and I see in civicrm_relationship my relationship of the org/ind and I see that it's a type of '4' - employer/employee of. However, I am at a complete loss of how a membership is flagged as being a membership 'on behalf of' in the database so that I can just pull those results rather than all employee/employer relationships. I must be missing something here, but where is it stored???

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Search listings for memberships 'on behalf of'
January 22, 2009, 03:12:01 pm
If you pull the employee contact from employee / employer relationships which have the is_permission_a_b flag TRUE (I think it's a_b, might be b_a) - then you are probably getting individuals who signed up On Behalf ... However this flag could be set manually from the Edit Relationship form so it's not 100%.

If we aren't inserting an Activity record for the individual doing the signup, and / or creating a civicrm_membership_log record with the individual's contact id as the modified_id - then we probably should be doing one or both. (If neither of these is happening when you test with 2.2 alpha - go ahead and file an issue for 2.3.)
Protect your investment in CiviCRM by  becoming a Member!

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Search listings for memberships 'on behalf of'
January 23, 2009, 06:09:33 am
I created 2 issues.

This one is for the original bug: http://issues.civicrm.org/jira/browse/CRM-4027

And this one is for 2 additional improvements that relate to this issue: http://issues.civicrm.org/jira/browse/CRM-4028
If anyone else is following this and would like to see these same improvements, please watch the issue directly above and/or comment on it there or here.

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Search listings for memberships 'on behalf of'
January 23, 2009, 08:22:37 am
OK, I made the custom search and it returns everything great. BUT of course there is a problem.

When I go to print mailing labels for my results, it's giving the address for the individual, not the org. I basically need this format for these particular mailing labels:

- Individual Name
- Org Address
- Org City, Org State, Org Zip

While my search results are giving all the right data, mailing labels are not. What to do next?

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Search listings for memberships 'on behalf of'
January 23, 2009, 09:02:10 am
And for anyone else who wants this search, complete code and docs are available here:
http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Search+%27On+Behalf+Of%27+Membership+Listings

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: Search listings for memberships 'on behalf of'
January 23, 2009, 10:14:50 am
Quote from: emilyf on January 23, 2009, 08:22:37 am
While my search results are giving all the right data, mailing labels are not. What to do next?

no idea :(

The best thing i can think of is to write your own custom task which prints the mailing label as a combination of the two records. You can reuse a lot of the mailing code

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 CiviMember (Moderator: Deepak Srivastava) »
  • Search listings for memberships 'on behalf of'

This forum was archived on 2017-11-26.