Fix recurring contribution defaults
The contribution_recur table defaults have some flaws. These don't really affect much in the way of existing code because people have been forced to pass them in and not rely on the defaults.
- more fields should have defaults (mostly because it would stop test failures like this one https://test.civicrm.org/job/CiviCRM-Core-PR/40065/testReport/ - but it's also a case of bringing the API into line with the UI.
- the default for the contribution_status_id should be pending not Completed. As long as it is correctly created as pending then the status will be updated by the BAO (to In Progress or Completed as appropriate) when a contribution is created that is linked to it. Core code correctly creates recurrings with the status id of Pending passed in but the api incorrectly defaults to Pending. Discussion is here https://github.com/civicrm/civicrm-core/pull/19512
- fields
field | UI default | Old DB default | new db default |
---|---|---|---|
create_date | current time | none - must be passed in (required field) | current time |
modified_date | current time | none - must be passed in (required field) | current time |
start_date | current time | none - must be passed in (required field) | current time |
frequency_unit | 1 | none - must be passed in (required field) | 1 |
contribution_status_id | Pending | Completed | Pending |
Regarding frequency unit - I could see a case for the existing - required with no default - except that it's 'partner' field HAS a default of 'month' - which seems more of a leap than giving this a convenience default - especially since 1 really is the most frequent - more so than 'month' I expect