compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-283: Prevent Membership Extension on Bulk Contribution Update #316

Closed MiyaNoctem closed 3 years ago

MiyaNoctem commented 3 years ago

Overview

Membership end date is being updated to next period after doing contribution bulk action 'Updating Pending Contribution Status'.

Before

When updating contributions in bulk, CiviCRM will set the num_terms parameter which, in their own words, is used as a "special sauce" to cause the memberships related to the contributions to be extended. Furthermore, this extension is calculated in the membership API call, before hitting the BAO.

https://github.com/civicrm/civicrm-core/blob/master/api/v3/Membership.php#L106-L108

After

Neutralized CiviCRM API's special sauce, by implementing a pre hook on the membership entity that will unset the end date if it detects a bulk contribution status update is being done.