From 831545ee8be240fbee074a9bbe2ad90feab3f89d Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 1 Mar 2021 19:21:34 +1300 Subject: [PATCH] Bring back some madness --- CRM/Core/BAO/CustomValueTable.php | 4 +++- tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/CustomValueTable.php b/CRM/Core/BAO/CustomValueTable.php index 0594d41324..e099241759 100644 --- a/CRM/Core/BAO/CustomValueTable.php +++ b/CRM/Core/BAO/CustomValueTable.php @@ -229,7 +229,9 @@ class CRM_Core_BAO_CustomValueTable { $set[$field['column_name']] = "%{$count}"; // The second parameter is the type of the db field, which // would be 'String' for a concatenated set of integers. - $params[$count] = [$value, $field['is_multiple'] ? 'String' : $type]; + // However, the god-forsaken timestamp hack also needs to be kept + // if value is NULL. + $params[$count] = [$value, ($value && $field['is_multiple']) ? 'String' : $type]; $count++; } diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php index 8d2b52519d..cd04a2e05a 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php @@ -12,9 +12,10 @@ class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase { /** * Test setValues() and GetValues() methods with custom Date field + * + * @throws \CiviCRM_API3_Exception */ - public function testSetGetValuesDate() { - $params = []; + public function testSetGetValuesDate(): void { $contactID = $this->individualCreate(); //create Custom Group -- 2.25.1