From bca6d7698318c5b43a251a06d0d4d3caa3660811 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 17 Dec 2018 09:39:35 +1300 Subject: [PATCH] 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 --- api/v3/ContributionRecur.php | 1 + 1 file changed, 1 insertion(+) 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'; } -- 2.25.1