From f819588f9136d5eefc03a9ff158cfd01fa6572f4 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Sun, 16 Aug 2015 21:24:52 +0530 Subject: [PATCH] Formatting fixes 2 --- CRM/Contact/BAO/Query.php | 21 +-------------------- tests/phpunit/api/v3/CustomValueTest.php | 6 +++--- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index cad962f148..2a778ef562 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1867,26 +1867,7 @@ class CRM_Contact_BAO_Query { } // check for both id and contact_id if ($this->_params[$id][0] == 'id' || $this->_params[$id][0] == 'contact_id') { - if ( - $this->_params[$id][1] == 'IS NULL' || - $this->_params[$id][1] == 'IS NOT NULL' - ) { - $this->_where[0][] = "contact_a.id {$this->_params[$id][1]}"; - } - elseif (is_array($this->_params[$id][2])) { - $idList = implode("','", $this->_params[$id][2]); - //why on earth do they put ' in the middle & not on the outside? We have to assume it's - //to support 'something' so lets add them conditionally to support the api (which is a tested flow - // so if you are looking to alter this check api test results - if (strpos(trim($idList), "'") > 0) { - $idList = "'" . $idList . "'"; - } - - $this->_where[0][] = "contact_a.id IN ({$idList})"; - } - else { - $this->_where[0][] = self::buildClause("contact_a.id", "{$this->_params[$id][1]}", "{$this->_params[$id][2]}"); - } + $this->_where[0][] = self::buildClause("contact_a.id", $this->_params[$id][1], $this->_params[$id][2]); } else { $this->whereClauseSingle($this->_params[$id]); diff --git a/tests/phpunit/api/v3/CustomValueTest.php b/tests/phpunit/api/v3/CustomValueTest.php index 75640cbd1d..0471ac8d99 100644 --- a/tests/phpunit/api/v3/CustomValueTest.php +++ b/tests/phpunit/api/v3/CustomValueTest.php @@ -68,8 +68,8 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { $this->optionGroup[$dataType]['id'] = $result['id']; } elseif ($dataType == 'contact') { - for ($i=0; $i < 3; $i++) { - $result = $this->callAPISuccess('Contact', 'create', array('contact_type' => 'Individual', 'email' => substr(sha1(rand()), 0, 7) . '@yahoo.com',)); + for ($i = 0; $i < 3; $i++) { + $result = $this->callAPISuccess('Contact', 'create', array('contact_type' => 'Individual', 'email' => substr(sha1(rand()), 0, 7) . '@yahoo.com')); $this->optionGroup[$dataType]['values'][$i] = $result['id']; } } @@ -145,8 +145,8 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { $count++; break; - //TODO: Test case of Country fields remain as it throws foreign key contraint ONLY in test environment default: + //TODO: Test case of Country fields remain as it throws foreign key contraint ONLY in test environment $count++; break; } -- 2.25.1