ESEB-137: Fix 'Next Contribution Date' for webform fixed memberships #516
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before
If you configure a webform with a payment plan and a fixed 1 year membership that starts at 1st of January and ends at 31th of December:
then the created recurring contribution "Next Scheduled Contribution Date" will be:
Or
This shouldn't be the case, and instead the "Next Scheduled Contribution Date" should be:
After
The "Next Scheduled Contribution Date" is : The membership end date + 1 day
Technical Details
The
PaymentPlanNextContributionDateUpdater
Webform API passes the word "Creation" as 2nd argument to thePaymentPlanNextContributionDate
Service that is responsible for calculating the "Next Scheduled Contribution Date"instead of "creation" (all letters should be lower case), so this part of the code that is responsible for calculating the date for fixed memberships did not run:
uk.co.compucorp.membershipextras/CRM/MembershipExtras/Service/PaymentPlanNextContributionDate.php
Lines 74 to 82 in feaf575
So I fixed this by passing the right operation name which is "creation" instead of "Creation", and as fail-safe I also change the
$operation
parameter letters to be lower case before using it.