diff --git a/api/v3/LocBlock.php b/api/v3/LocBlock.php index 17270805238c2e49eaeb4cffb33d709e155a46f7..85b4f2822d3f902925715fb0d403a1387b5419fb 100644 --- a/api/v3/LocBlock.php +++ b/api/v3/LocBlock.php @@ -101,6 +101,7 @@ function civicrm_api3_loc_block_get($params) { // If a return param has been set then fetch the appropriate fk objects // This is a helper because api chaining does not work with a key like 'email_2' if (!empty($options['return'])) { + unset($params['return']); $values = array(); $items = array('address', 'email', 'phone', 'im'); $returnAll = !empty($options['return']['all']); diff --git a/api/v3/examples/LocBlockCreate.php b/api/v3/examples/LocBlockCreate.php index 584520ce63fbe5f5f77265aeabe346ef55890e05..2ce3383b193e7b257d3f956985a51fb9adbb9f97 100644 --- a/api/v3/examples/LocBlockCreate.php +++ b/api/v3/examples/LocBlockCreate.php @@ -4,7 +4,7 @@ */ function loc_block_create_example(){ -$params = array( +$params = array( 'version' => 3, 'address_id' => 2, 'phone_id' => 2, @@ -21,13 +21,13 @@ $params = array( */ function loc_block_create_expectedresult(){ - $expectedResult = array( + $expectedResult = array( 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => array( + '2' => array( 'id' => '2', 'address_id' => '2', 'email_id' => '3', diff --git a/api/v3/examples/LocBlockCreateEntities.php b/api/v3/examples/LocBlockCreateEntities.php index b5eded8c903a142da9d8b445db4ad3a870d6ebbc..545e64b2f1540c95d96c69ce244580c9f69dfed5 100644 --- a/api/v3/examples/LocBlockCreateEntities.php +++ b/api/v3/examples/LocBlockCreateEntities.php @@ -4,21 +4,21 @@ Create entities and location block in 1 api call */ function loc_block_createentities_example(){ -$params = array( +$params = array( 'version' => 3, - 'email' => array( + 'email' => array( 'location_type_id' => 1, 'email' => 'test2@loc.block', ), - 'phone' => array( + 'phone' => array( 'location_type_id' => 1, 'phone' => '987654321', ), - 'phone_2' => array( + 'phone_2' => array( 'location_type_id' => 1, 'phone' => '456-7890', ), - 'address' => array( + 'address' => array( 'location_type_id' => 1, 'street_address' => '987654321', ), @@ -34,14 +34,14 @@ $params = array( */ function loc_block_createentities_expectedresult(){ - $expectedResult = array( + $expectedResult = array( 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( - 'address' => array( + 'values' => array( + '3' => array( + 'address' => array( 'id' => '3', 'location_type_id' => '1', 'is_primary' => 0, @@ -49,7 +49,7 @@ function loc_block_createentities_expectedresult(){ 'street_address' => '987654321', 'manual_geo_code' => 0, ), - 'email' => array( + 'email' => array( 'id' => '4', 'contact_id' => 'null', 'location_type_id' => '1', @@ -63,7 +63,7 @@ function loc_block_createentities_expectedresult(){ 'signature_text' => '', 'signature_html' => '', ), - 'phone' => array( + 'phone' => array( 'id' => '3', 'contact_id' => 'null', 'location_type_id' => '1', @@ -75,7 +75,7 @@ function loc_block_createentities_expectedresult(){ 'phone_numeric' => '', 'phone_type_id' => '', ), - 'phone_2' => array( + 'phone_2' => array( 'id' => '4', 'contact_id' => 'null', 'location_type_id' => '1', diff --git a/api/v3/examples/LocBlockGet.php b/api/v3/examples/LocBlockGet.php index 5e1d4cb2898246943a584ed1288888446f62df49..86e7d42ab7c0c792cbd68cc1fdcf3a94dd7746a7 100644 --- a/api/v3/examples/LocBlockGet.php +++ b/api/v3/examples/LocBlockGet.php @@ -4,7 +4,7 @@ Get entities and location block in 1 api call */ function loc_block_get_example(){ -$params = array( +$params = array( 'version' => 3, 'id' => 3, 'return' => 'all', @@ -20,13 +20,13 @@ $params = array( */ function loc_block_get_expectedresult(){ - $expectedResult = array( + $expectedResult = array( 'id' => '3', 'address_id' => '3', 'email_id' => '4', 'phone_id' => '3', 'phone_2_id' => '4', - 'address' => array( + 'address' => array( 'id' => '3', 'location_type_id' => '1', 'is_primary' => 0, @@ -34,7 +34,7 @@ function loc_block_get_expectedresult(){ 'street_address' => '987654321', 'manual_geo_code' => 0, ), - 'email' => array( + 'email' => array( 'id' => '4', 'location_type_id' => '1', 'email' => 'test2@loc.block', @@ -43,7 +43,7 @@ function loc_block_get_expectedresult(){ 'on_hold' => 0, 'is_bulkmail' => 0, ), - 'phone' => array( + 'phone' => array( 'id' => '3', 'location_type_id' => '1', 'is_primary' => 0, @@ -51,7 +51,7 @@ function loc_block_get_expectedresult(){ 'phone' => '987654321', 'phone_numeric' => '987654321', ), - 'phone_2' => array( + 'phone_2' => array( 'id' => '4', 'location_type_id' => '1', 'is_primary' => 0, diff --git a/tests/phpunit/api/v3/LocBlockTest.php b/tests/phpunit/api/v3/LocBlockTest.php index f5c80b0792a12e12209ac75377d317a87eec74cd..8464feb03a9089cceef72cc949e8ac08b4fcb1f4 100644 --- a/tests/phpunit/api/v3/LocBlockTest.php +++ b/tests/phpunit/api/v3/LocBlockTest.php @@ -99,7 +99,11 @@ class api_v3_LocBlockTest extends CiviUnitTestCase { $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); // Now check our results using the return param 'all' - $getParams = array('version' => $this->_apiversion, 'id' => $id, 'return' => 'all'); + $getParams = array( + 'version' => $this->_apiversion, + 'id' => $id, + 'return' => 'all' + ); $result = civicrm_api($this->_entity, 'getsingle', $getParams); $this->documentMe($getParams, $result, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call', NULL, 'get'); $this->assertNotNull($result['email_id'], 'In line ' . __LINE__);