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) »
  • Start date set to 0 for new memberships by relation
Pages: [1]

Author Topic: Start date set to 0 for new memberships by relation  (Read 966 times)

civicpixel

  • I’m new here
  • *
  • Posts: 25
  • Karma: 3
Start date set to 0 for new memberships by relation
July 13, 2011, 04:14:17 pm
I replicated this behavior on our client install as well as the demo site in 4.0.4 -- it looks like any membership inherited via relationship gets a start date of 0. Here's an example on the demo site.
http://drupal.demo.civicrm.org/civicrm/contact/view?action=browse&selectedChild=rel&reset=1&cid=175

You can replicate it with additional contacts by:
1. Add a new contact
2. Add a relationship of Employee Of to the organization "Widgets and Wodgets"

I didn't have time to get into the code today, but if nobody has a quick fix I'll try to submit a patch this week. I do know this behavior was not a problem in 4.0.0.

TheZorg

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.44
  • PHP version: 5.2.13
Re: Start date set to 0 for new memberships by relation
July 20, 2011, 08:14:07 am
Have you found a solution for this? I rely heavily on the membership through relationship feature for my project, and would like to find a fix for this.

civicpixel

  • I’m new here
  • *
  • Posts: 25
  • Karma: 3
Re: Start date set to 0 for new memberships by relation
July 26, 2011, 11:31:33 am
The issue is with the date format being sent to CRM_Member_BAO_Membership::create in /CRM/Contact/BAO/Relationship.php around line #1198. The format that is being set in there is 2010-07-13, but needs to be more like 20100713. I assume this should really be addressed in the chain where the values are loaded via CRM_Member_BAO_Membership::getValues, or modify
CRM_Member_BAO_Membership::create to accept both formats.

Since I haven't had time for a proper fix, what we've done for our client is add these lines before the membership is created in /CRM/Contact/BAO/Relationship.php around line #1198 to adjust the date formats:

Code: [Select]
                        $membershipValues['start_date'] = CRM_Utils_Date::isoToMysql($membershipValues['start_date']);
                        $membershipValues['join_date'] = CRM_Utils_Date::isoToMysql($membershipValues['join_date']);
                        $membershipValues['end_date'] = CRM_Utils_Date::isoToMysql($membershipValues['end_date']);
                        $membershipValues['membership_end_date'] = CRM_Utils_Date::isoToMysql($membershipValues['membership_end_date']);
                        $membershipValues['membership_start_date'] = CRM_Utils_Date::isoToMysql($membershipValues['membership_start_date']);
                        CRM_Member_BAO_Membership::create( $membershipValues, CRM_Core_DAO::$_nullArray );

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: Start date set to 0 for new memberships by relation
July 27, 2011, 12:26:21 am

Can you please file an issue and link to this forum post

thanx

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

civicpixel

  • I’m new here
  • *
  • Posts: 25
  • Karma: 3
Re: Start date set to 0 for new memberships by relation
August 03, 2011, 09:28:55 am
Done, added the issue here:
http://issues.civicrm.org/jira/browse/CRM-8605

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Start date set to 0 for new memberships by relation

This forum was archived on 2017-11-26.