Skip to content

Commit

Permalink
APIv4 - Fix mishandling of boolean custom values
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jul 8, 2022
1 parent 04921c2 commit 39bb0b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Civi/Api4/Generic/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,12 @@ protected function formatWriteValues(&$record) {
$options = FormattingUtil::getPseudoconstantList($info['field'], $info['expr'], $record, 'create');
$record[$fieldName] = FormattingUtil::replacePseudoconstant($options, $info['val'], TRUE);
}
// The DAO works better with ints than booleans. See https://github.com/civicrm/civicrm-core/pull/23970
foreach ($record as $key => $value) {
if (is_bool($value)) {
$record[$key] = (int) $value;
}
}
}

/**
Expand Down

0 comments on commit 39bb0b7

Please sign in to comment.