Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/rc#14 handle api calls post schema change #21189

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v3/utils.php
Original file line number Diff line number Diff line change
@@ -2059,6 +2059,10 @@ function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) {
*/
function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $entity) {
list($fieldValue, $op) = _civicrm_api3_field_value_check($params, $fieldName);
if ($fieldName === 'auto_renew' && $fieldValue === TRUE) {
// https://lab.civicrm.org/dev/rc/-/issues/14
$fieldValue = 1;
}
if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
return;
}
18 changes: 18 additions & 0 deletions tests/phpunit/api/v3/MembershipTypeTest.php
Original file line number Diff line number Diff line change
@@ -184,6 +184,24 @@ public function testMemberTypePeriodTypeRequired($version) {
]);
}

/**
* Test that auto renew = TRUE still works post schema change.
*
* https://lab.civicrm.org/dev/rc/-/issues/14
*/
public function testCreateMembershipTypeAutoRenewBool(): void {
$this->callAPISuccess('MembershipType', 'create', [
'member_of_contact_id' => 1,
'financial_type_id' => 'Member Dues',
'duration_unit' => 'year',
'duration_interval' => 1,
'period_type' => 'rolling',
'minimum_fee' => 1,
'name' => 'gen',
'auto_renew' => TRUE,
]);
}

/**
* Test update.
*