compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-401: Fix Renewal of Plans with Only New Membership for Next Period #315

Closed MiyaNoctem closed 3 years ago

MiyaNoctem commented 3 years ago

Overview

If you create a renewable payment plan with one membership and multiple instalments, and before renewing you set the membership not to auto-renew, and add a new membership for the next period, once auto-renew runs the amount for the new recurring contribution will be 0, and if you enter the manage future instalments screen, the plan will have no line items for the current period.

Before

When renewing, the start date of the new lines was being calculated by checking the latest end date of all the renewable memberships in the plan and adding a day. Since there are no memberships to be renewed, the start date for the lines was left empty, which in turn caused:

After

Fixed by checking all lines associated to a payment plan, regardless of their renewable status, so that it takes the latest end date of renewable memberships, but if there are no renewable memberships, it takes the latest end date of non-renewable memberships.