compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-612: Changes to autorenewal job trigger and migrating upgrader #398

Closed omarabuhussein closed 2 years ago

omarabuhussein commented 2 years ago

Overview

There was a misunderstanding that the trigger for autorenewal should be the next scheduled contribution date. There is a risk that this date may be before or after the end date of the membership (specially in Direct debit payment plans).

As such we changed the "trigger" for the autorenwal job to be the end date of the membership (taking into account the payment plan setting Days to renew in advance), or the minimum membership end date if there are more than one membership in the payment plan with different end dates as it used to be the case before.

The installments receive dates is still being calculated based on the next scheduled contribution date,

Before

The next scheduled contribution date is what we use to trigger the autorenewal.

After

The membership end date (or the minimum membership end date if there are more that one) is what triggers that autorenewal. Which meant reverting most of the work I did here: https://github.com/compucorp/uk.co.compucorp.membershipextras/pull/393.

Other notes

I also updated the migrating upgrader that updates the next scheduled contribution date for all payment plans, so it now uses the max contribution receive date plus: