Skip to content

Commit

Permalink
Merge pull request #17875 from colemanw/customFieldVersionCheck
Browse files Browse the repository at this point in the history
Ensure serialize field exists before adding to query
  • Loading branch information
seamuslee001 authored Jul 17, 2020
2 parents dcdde7e + da0577d commit 7111a99
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions CRM/Core/BAO/CustomGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public static function create(&$params) {
'is_multiple',
'icon',
];
$current_db_version = CRM_Core_DAO::singleValueQuery("SELECT version FROM civicrm_domain WHERE id = " . CRM_Core_Config::domainID());
$is_public_version = $current_db_version >= '4.7.19' ? 1 : 0;
$current_db_version = CRM_Core_BAO_Domain::version();
$is_public_version = version_compare($current_db_version, '4.7.19', '>=');
if ($is_public_version) {
$fields[] = 'is_public';
}
Expand Down Expand Up @@ -400,7 +400,6 @@ public static function getTree(
'time_format',
'option_group_id',
'in_selector',
'serialize',
],
'custom_group' => [
'id',
Expand All @@ -418,11 +417,15 @@ public static function getTree(
'max_multiple',
],
];
$current_db_version = CRM_Core_DAO::singleValueQuery("SELECT version FROM civicrm_domain WHERE id = " . CRM_Core_Config::domainID());
$is_public_version = $current_db_version >= '4.7.19' ? 1 : 0;
$current_db_version = CRM_Core_BAO_Domain::version();
$is_public_version = version_compare($current_db_version, '4.7.19', '>=');
$serialize_version = version_compare($current_db_version, '5.27.alpha1', '>=');
if ($is_public_version) {
$tableData['custom_group'][] = 'is_public';
}
if ($serialize_version) {
$tableData['custom_field'][] = 'serialize';
}
if (!$toReturn || !is_array($toReturn)) {
$toReturn = $tableData;
}
Expand Down

0 comments on commit 7111a99

Please sign in to comment.