From: eileen Date: Sun, 16 Dec 2018 20:39:35 +0000 (+1300) Subject: Declare 'amount' as required on ContributionRecur api X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bca6d7698318c5b43a251a06d0d4d3caa3660811;p=civicrm-core.git Declare 'amount' as required on ContributionRecur api This is effectively required already as you get a DB error without it. The field is not required at the DB level (it probably should be that too) but it has no default value so you wind up with [nativecode=1364 ** Field 'amount' doesn't have a default value] Note that making it required at the DB level won't change the need for this patch & is separate. The api declares what is required at the api level - somethings are required at the DB level but not at the api level as they are calculated in the BAO --- diff --git a/api/v3/ContributionRecur.php b/api/v3/ContributionRecur.php index a990d48ad6..4160e19faf 100644 --- a/api/v3/ContributionRecur.php +++ b/api/v3/ContributionRecur.php @@ -56,6 +56,7 @@ function _civicrm_api3_contribution_recur_create_spec(&$params) { $params['contact_id']['api.required'] = 1; $params['create_date']['api.default'] = 'now'; $params['frequency_interval']['api.required'] = 1; + $params['amount']['api.required'] = 1; $params['start_date']['api.default'] = 'now'; $params['modified_date']['api.default'] = 'now'; }