Autorenewal memberships should support differing frequencies in a single price set
Currently if you set up auto-renewing memberships with a price set, contribution pages using that price set will always use the duration unit and interval of the first membership listed as the recurring frequency.
Verified on dmaster 28/May/2019.
Steps to Reproduce
- Create two membership types, "Monthly" and "Annual", with respective durations and auto-renewal enabled
- Create a price set and field with three membership options:
- Monthly (1 term)
- Annual (1 term)
- Monthly (12 terms)
- Create a contribution page that uses this price set
- Submit the contribution page once for each option.
Three Membership & Recurring Contribution pairs with the respective intervals.
Three Memberships, all with the correct intervals, however all are linked to recurring contributions with a frequency of 1 month.
I'm fairly certain the problem occurs because of a call from
CRM_Price_BAO_PriceSet::getRecurDetails($priceSetId) (https://github.com/civicrm/civicrm-core/blob/9f26604/CRM/Contribute/Form/ContributionBase.php#L1381) which will only return the details for the first membership related PriceFieldValue in the referenced price set, in the order the MySQL retrieves it.
Agileware Ref: CIVICRM-1202