From 646b54006d8ac0799ab64c91c9358ca4a12e0665 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 10 Jun 2019 23:19:14 -0400 Subject: [PATCH] Fix deletion of contact sub_type in api4 --- CRM/Contact/BAO/Contact.php | 5 ----- tests/phpunit/api/v3/ContactTest.php | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index cf540790ed..13a040636e 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -140,11 +140,6 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { $params['contact_sub_type'] = CRM_Utils_Array::implodePadded($params['contact_sub_type']); } } - else { - // Reset the value. - // CRM-101XX. - $params['contact_sub_type'] = 'null'; - } if (isset($params['preferred_communication_method']) && is_array($params['preferred_communication_method'])) { CRM_Utils_Array::formatArrayKeys($params['preferred_communication_method']); diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index 028cf80bee..24dc8dbe85 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -226,9 +226,11 @@ class api_v3_ContactTest extends CiviUnitTestCase { * * Verify that sub-types are created successfully and not deleted by subsequent updates. * - * v3 only - uses nonstandard syntax + * @param int $version + * @dataProvider versionThreeAndFour */ - public function testIndividualSubType() { + public function testIndividualSubType($version) { + $this->_apiversion = $version; $params = array( 'first_name' => 'test abc', 'contact_type' => 'Individual', -- 2.25.1