It is beneficial for some clients to be able to skip membership pro rata within certain dates, for example you might want to have such configurations:
A- If the membership start date is between 1st of Jan to 30th of June, then pro rata calculation will be ignored.
B- If the start date is between the 1st of July to 31th of December then we should pro-rata.
The goal of this PR is to add a membership type setting that allows us to have such arrangment.
Before
You cannot skip pro-rata if the membership created before certain date.
After
A new field Skip Pro-rata calculation until is added to the membership type form (only for fixed memberships):
In which if you create a membership using such type and the start date of such membership is on or before the date configured in this new setting, then the pro-rata will be skipped and the membership will be charged in full price:
Where if the start date of the membership is after the configured date, then pro-rata will apply normally:
The work here applies to webform as well (nothing extra need to be done given the changed code in this PR is also used by webforms), but hence that webform under certain configurations have issues with pro rata in general (see https://github.com/compucorp/webform_civicrm_membership_extras/pull/52 for more info).
Overview
It is beneficial for some clients to be able to skip membership pro rata within certain dates, for example you might want to have such configurations:
A- If the membership start date is between 1st of Jan to 30th of June, then pro rata calculation will be ignored. B- If the start date is between the 1st of July to 31th of December then we should pro-rata.
The goal of this PR is to add a membership type setting that allows us to have such arrangment.
Before
You cannot skip pro-rata if the membership created before certain date.
After
A new field
Skip Pro-rata calculation until
is added to the membership type form (only for fixed memberships):In which if you create a membership using such type and the start date of such membership is on or before the date configured in this new setting, then the pro-rata will be skipped and the membership will be charged in full price:
Where if the start date of the membership is after the configured date, then pro-rata will apply normally:
The work here applies to webform as well (nothing extra need to be done given the changed code in this PR is also used by webforms), but hence that webform under certain configurations have issues with pro rata in general (see https://github.com/compucorp/webform_civicrm_membership_extras/pull/52 for more info).
Technical Details
The work in this PR is divided into two parts, the first part is about adding the new setting to the membership type form: https://github.com/compucorp/uk.co.compucorp.membershipextras/pull/478/commits/7310a3f572a77a318dd6639df159a8bdc71c29d0 which uses the same stuff that were used to handle
membership_type_annual_pro_rata_calculation
setting.Where in the second part (https://github.com/compucorp/uk.co.compucorp.membershipextras/pull/478/commits/9f525283b7d57ced1acda4498625aad8b16ad4f2) the pro rata service for fixed memberships is updated to make use of this setting to allow skipping pro-rata calculation. No other places had to be changed given all the pro rata calculation in both Membershipextras and webform use this service for pro-rata calculation.