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) »
  • Changing the inherited relationship type for a membership type
Pages: [1]

Author Topic: Changing the inherited relationship type for a membership type  (Read 3033 times)

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Changing the inherited relationship type for a membership type
November 14, 2008, 02:17:33 pm
Once you create a membership type that includes a relationship type that will automatically be granted that membership, you cannot later change which relationship type gets that inherited membership (at least not through the interface).

Well, I've now run into a situation with a client that needs this done and don't know how to do this or what the best approach would be.

Any ideas?

Thanks!
Tony

p.s. The client is on 2.1 but I think this has always been the case.
http://dharmatech.org
oss@dharmatech.org
801.541.8671

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Changing the inherited relationship type for a membership type
November 14, 2008, 04:32:24 pm
Talk about synchronicity - just hit that yesterday. Only route I saw was to export memberships and reimport - it worked for us though it would have been a second step to sort out the contributions associated with the membership but there were so few in this case that this can be sorted manually.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Changing the inherited relationship type for a membership type
November 14, 2008, 04:52:39 pm
You could possibly handle this by updating the DB directly. The relevant fields are in the civicrm_membership_type table:

relationship_type_id
relationship_direction

(you can verify what values they should be changed TO by creating a new membership type w/ the config you want to move to)

The issue with doing it this way is that you need to think about / deal with the existing inherited memberships (if any).  I "think" they will still be valid if you make sure that the relationship they have with the membership "owner" is updated to match the new relationship_type_id. If you want to go down this road - and there are existing inherited memberships - we can talk more specifics. I'd definitely try it out with a test copy of the DB, in any case.
Protect your investment in CiviCRM by  becoming a Member!

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: Changing the inherited relationship type for a membership type
November 17, 2008, 07:37:40 am
Thanks Dave.  Talked it over with Walt and he also thinks it should be straightforward.

They do have existing inherited memberships. This is the group I told you about that used households instead of organizations (still don't know why) and so their inherited relationship types for their memberships were set for household member of but should be employee of.

Is there an order that we need to think about? In other words, should we change the relationships for the contacts first and then change the relationship type for the membership type? Or does it not matter?

Any other gotchas we should think about?

Either way, we'll definitely test this first.

thanks again
tony
http://dharmatech.org
oss@dharmatech.org
801.541.8671

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Changing the inherited relationship type for a membership type
November 17, 2008, 09:59:58 pm
Assuming you're doing both changes via direct update queries to the DB, I don't think the order matters. Haven't thought of any other gotchas.
Protect your investment in CiviCRM by  becoming a Member!

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Changing the inherited relationship type for a membership type
May 27, 2009, 07:28:41 am
Okay, i've got an issue like this also and am trying to fix it via sql calls [civicrm 2.1.4 w/ Drupal 6]

Clearing the membership rules is easy:

UPDATE civicrm_membership_type SET relationship_type_id = NULL, relationship_direction = NULL

but fixing the existing memberships is confusing. The key field is

civicrm_membership.owner_membership_id

and the sql to remove them should be as easy as

DELETE FROM civicrm_membership WHERE owner_membership_id > 0

but in my data, the field is filled in for the owner member, not the related member, and contains the id of the automated membership id.

This seems like a bad design (since an owner couldn't have more than one automated membership attached to it) and I wonder if it's just a case of corrupted data?
It would seem from here: http://issues.civicrm.org/jira/browse/CRM-2038
that the owner_membership_id normally is only filled in for a membership that is granted automatically, and contains its owner's id, which makes much more sense.

In any case, is there any documentation, confirmation or other hints for this?

As background - my install with the issue was originally created with civicrm 2.0/Drupal 5 and later upgraded and these related memberships were created via the import process, so there are a few spots where data corruption could have occurred.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Changing the inherited relationship type for a membership type
May 27, 2009, 11:14:38 am
Hi Alan - Your thought about how this "should" work is correct. The owner_membership_id should be NULL for the "parent" membership record. For inherited memberships, it should contain the ID (civicrm_membership.id) from their "parent" record.
Protect your investment in CiviCRM by  becoming a Member!

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: Changing the inherited relationship type for a membership type
May 27, 2009, 12:30:13 pm
Quote from: adixon on May 27, 2009, 07:28:41 am
... but in my data, the field is filled in for the owner member, not the related member, and contains the id of the automated membership id....

Alan, try the DB Tools to see if they tell you anything useful.

-- Walt
http://dharmatech.org
oss@dharmatech.org
801.541.8671

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Changing the inherited relationship type for a membership type
June 08, 2009, 08:54:13 am
Okay, thanks. I'm going to asssume that the data got corrupted in the import or upgrade process and not worry about it.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Changing the inherited relationship type for a membership type

This forum was archived on 2017-11-26.