Skip to content

Commit

Permalink
NEUSPRT-405: Fix issues with mysql 8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Shahrukh committed Dec 16, 2024
1 parent 8d8a3c9 commit 5f4adec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CRM/Civicase/APIHelpers/CustomFieldFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ private static function joinCustomFieldQuery(CRM_Utils_SQL_Select $sql, array $c
$value = $value['IN'] ?? $value;
$table = $columnGroup[0];
$column = $columnGroup[1];
$mysqlVersion = CRM_Core_DAO::executeQuery('SELECT VERSION() AS version;')->fetchValue();
$isMysql8 = version_compare($mysqlVersion, '8.0') !== -1;

$conditions = array_map(function ($param) use ($table, $column) {
return "custom_case_to_{$table}.{$column} REGEXP '[[:<:]]" . $param . "[[:>:]]'";
$conditions = array_map(function ($param) use ($table, $column, $isMysql8) {
return $isMysql8 ? "custom_case_to_{$table}.{$column} REGEXP '\\b" . $param . "\\b'" : "custom_case_to_{$table}.{$column} REGEXP '[[:<:]]" . $param . "[[:>:]]'";
}, $value);
$conditions = implode(" AND ", $conditions);

Expand Down

0 comments on commit 5f4adec

Please sign in to comment.