Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.0.8
-
Fix Version/s: 4.2.0
-
Component/s: CiviMember
-
Labels:None
Description
When a membership is edited and its type or status is changed, an Activity record should be created that records the change similar to Change Case Type and Change Case Status activities. This issue specifies the work to do this on the 3.4 and 4.1 branches.
1. In appropriate file (whatever civicrm_data.mysql is generated from these days), create a new activity type in civicrm_option_value as follows (follow existing protocol in file for specifying the option_group_id and the value and weight):
-
- option_group_id=2
- label='Change Membership Status'
- name='Change Membership Status'
- value=23
- weight=23
- grouping=null
- filter=0
- is_default=0
- is_reserved=1
- is_active=1
- component_id=3
- domain_id=null
- visibility_id=null
- Create a second activity type as above with the following fields containing changes in their values:
- label='Change Membership Type'
- name='Change Membership Type'
- value=24
- weight=24
2. Include INSERT statements for these records in CRM/Upgrade/Incremental/sql/3.4.x.mysql.tpl (NB: Consult with Kurund or Deepak on appropriate version file in this directory)
3. When saving a membership after editing in the backend, eg at civicrm/contact/view/membership?reset=1&action=update&id=33&cid=119, if the status has changed then create a new activity of type Change Membership Status with the following values:
-
- subject: 'Membership Status changed from ' . $old_status_label . ' to ' . $new_status_label
- source_contact_id: current user's
- source_record_id: membership_id of relevant membership
- activity_type_id: 23 (from above)
- activity_date_time: now()
- duration, location, phone_number, details, medium_id, relationship_id, original_id: NULL
- status_id: 2 (ie Completed)
- priority_id: 2 (ie Normal)
- is_auto: 0
- is_current_revision: 1
- is_deleted: 0
4. Insert a related record into civicrm_activity_target with activity_id of newly created activity and target_contact_id = civicrm_membership.contact_id
5. Repeat 3 and 4 for membership type changes, modifying the subject and activity_type_id as appropriate.
6. Create a webtest to verify the creation of a new activity for membership type and membership status changes separately, and a third that tests the creation of two activities when both are changed at the same time.