compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

IO-121: Save settings when creating new membership type #356

Closed erawat closed 3 years ago

erawat commented 3 years ago

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.