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) »
  • Inherited membership records missing
Pages: [1]

Author Topic: Inherited membership records missing  (Read 743 times)

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Inherited membership records missing
February 07, 2012, 09:25:08 am
I'm finding individuals with records that should have inherited memberships through their relationship with an organization that has a membership.

If I go and edit the primary membership (changing nothing, and re-saving), the inherited membership records get created. As soon as I make any changes to the individual contact record (not the membership, just basic profile changes), the inherited membership record disappears. UpdateMembershipRecord.php doesn't recreate it.  I've disabled all modules with Civi hooks to assure it wasn't any extraneous code causing this.

Note that I've set the membership type to inherit using a relationship type of "Named Member". I tried doing this with the "Employer of" relationship and didn't experience the issue. Is this a bug? If so, can you direct me to where in the code I can look to troubleshoot it?

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Re: Inherited membership records missing
February 07, 2012, 05:25:55 pm
I narrowed this down further. If you edit/save the individual record and the current employer is the SAME organization as the one in the "Named Member" relationship, the membership will be deleted.

I modified the code in CRM_Contact_BAO_Relationship::isDeleteRelatedMembership, adding this above all other code in the function:

Code: [Select]
if ( ! in_array($relTypeId, $relTypeIds ) {
            return false;
}

Basically, I don't want to delete any memberships based on a relationship type that has nothing to do with the employer/employee relationship. This hack seems to work and haven't yet found any repercussions to it.

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: Inherited membership records missing
February 07, 2012, 11:17:56 pm
This is a bug, please file an issue in bug tracker.

Thanks
Kurund
Found this reply helpful? Support CiviCRM

AudreyKate

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
  • CiviCRM version: 3.4.4
  • CMS version: Drupal 6.24
Re: Inherited membership records missing
April 16, 2012, 07:35:40 pm
I'd love some help with this, as it's plaguing me at the moment. I tried to apply the hack described here, but it broke my 3.4.4 install.  :)

Here's what I tried to do:

Code: [Select]
function isDeleteRelatedMembership( $relTypeIds, $contactId, $mainRelatedContactId, $relTypeId, $relIds ) {
+       if ( ! in_array($relTypeId, $relTypeIds ) {
+           return false;
+ }
+
if ( in_array($relTypeId, $relTypeIds ) ||
             empty($relIds) ) {
            return true;
        }

But no luck. I couldn't find a new issue for this bug, although I found this old issue:

http://issues.civicrm.org/jira/browse/CRM-7740

This is exactly the problem I'm having. The patch specified here has already been added to my 3.4.4 install, but the problem persists....


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Inherited membership records missing

This forum was archived on 2017-11-26.