This PR fixes the issue when extended membership type settings have not been saved when creating a new membership type.
The PR also adds script to the template to hide fixed rollover days when selected fixed membership type to ensure that the field will not show when the page returns from validation if the user selects month as a duration interval for fixed period membership type.
Before
Membership type colour and annual pro rata calculation values are only created into the settings on edit mode.
After
Membership type colour and annual pro rata calculation values are created and updated on when create or update membership type.
Technical Details
A form object that passes on CiviCRM postProcess hook does not contain an ID when creating a new object, so the membership type settings will never be saved.
In order to address this issue, we check if the ID does not exist, then we will call Membership Type API to get membership type ID by name as membership type name is unique. By doing this, we can ensure that the settings will be saved when creating new membership type.
Overview
This PR fixes the issue when extended membership type settings have not been saved when creating a new membership type.
The PR also adds script to the template to hide fixed rollover days when selected fixed membership type to ensure that the field will not show when the page returns from validation if the user selects month as a duration interval for fixed period membership type.
Before
After
Technical Details
A form object that passes on CiviCRM postProcess hook does not contain an ID when creating a new object, so the membership type settings will never be saved.
In order to address this issue, we check if the ID does not exist, then we will call Membership Type API to get membership type ID by name as membership type name is unique. By doing this, we can ensure that the settings will be saved when creating new membership type.