Auto-generation of recurring contribution template ignores recurring amount
Overview
When a recurring contribution does not have a corresponding template, sometimes one is generated implicitly (e.g. when viewing the 'template' and clicking 'done').
That 'implicit generation' does not pay attention to the amount in the recurring contribution record.
Reproduction steps
- As an administrator, create a new recurring contribution for $1.
- Observe that only the recurring contribution and contribution record are created, no recurring template contribution (requires mysql access to see this!).
- Edit the recurring amount to $2. Note that there is still no recurring template.
- View the recurring 'template' and click done. This implicitly creates the recurring record based on the $1 contribution, ignoring the $2 recurring contribution record amount, and as a side effect, modifies the recurring contribution record amount back to $1.
Current behaviour
The implicit generation of the recurring template does not respect the amount in the recurring record total.
Expected behaviour
It should! Of course, it's complicated. e.g. maybe that recurring template should get generated when the original recurring contribution is created?
I would note that I've only described one way that the template gets created, it appears there may be others. So regardless of whether we avoid this specific way of implicitly-generating the template, it should behave better than it does ...
Environment information
CiviCRM version: likely all versions since last June 2022.
Relevant docs link https://docs.civicrm.org/dev/en/latest/financial/recurring-contributions/