compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-400: Fix Receive Date on Fixed Single Instalment Renewal #321

Closed MiyaNoctem closed 3 years ago

MiyaNoctem commented 3 years ago

Overview

If you create a new fixed membership to a contact with Auto-renew set, payment plan 1 installment and with the following dates:

After renewing, the dates will get updated to:

New contribution date should be 1 Dec 2019

Before

When renewing a payment plan with a single installment, the new recieve date is calculated from the initial cycle day of the payment plan, which was the 1st of july (day 182 of the year). Thus, all contribution recieve dates are calculated to be on that day of the corresponding year.

After

Fixed by setting the contribution's receive date as the memberships' calculated start date if there is at least one fixed membership in the payment plan. For the evaluated scenario, this would mean the recieve date of the new contribution would be 1st of Dec, 2019.

Notes

Added a test to verify the scenario.

This work started in PR #314 , but decided to re-do on top of latest master branch, as the original branch had gone stale.

erawat commented 3 years ago

@MiyaNoctem the files name and actual class name still Installment. Can you help to fix this too? Since you are chaining it, and if you could change the actual class name to CRM_MembershipExtras_Job_OfflineAutoRenewal_SingleInstalmentPlan? cc @omarabuhussein