Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9937

in some cases, updating record with employer overwrites activity_date_time field in civicrm_activity table

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 4.1.1
    • Fix Version/s: Unscheduled
    • Component/s: Core CiviCRM
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Under certain circumstances (involving contacts that have memberships via relationships), when a contact is saved, CiviCRM deletes existing relationships and then re-creates them, which seems to be the cause of the updated activity_date_time field.

      The relationship is re-created with the proper values, but the related activity is created with the current date/time, rather than the date/time of when the relationship was initially created, thus losing that data.

      The code responsible seems to be in the CRM/Contact/BAO/Relationship.php file, in the relatedMemberships() functions - toward the bottom:

      if ( $action & CRM_Core_Action::UPDATE )

      { //delete the membership record for related //contact before creating new membership record. CRM_Member_BAO_Membership::deleteRelatedMemberships( $membershipId, $relatedContactId ); }

      CRM_Member_BAO_Membership::create( $membershipValues, CRM_Core_DAO::$_nullArray );

      I'm not sure if it's possible to avoid deleting and then re-creating or if there's another way around the problem.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jamie Jamie McClelland
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: