diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index abe106af4a8954f886e47fa1a3835c0aa473d8b7..334d90a01818216f75d6dabefce2a4ce389037ca 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/CRM/Contact/DAO/Contact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Contact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:395cdbb5eaf3b1f74fb87f93269d8336) + * (GenCodeChecksum:8ace6d508a6e4412f52c6cbd2978b072) */ /** @@ -991,6 +991,10 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Email Greeting ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.', + 'export' => TRUE, + 'where' => 'civicrm_contact.email_greeting_id', + 'headerPattern' => '', + 'dataPattern' => '', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', @@ -1040,6 +1044,10 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Postal Greeting ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.', + 'export' => TRUE, + 'where' => 'civicrm_contact.postal_greeting_id', + 'headerPattern' => '', + 'dataPattern' => '', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', @@ -1092,6 +1100,10 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Addressee ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.', + 'export' => TRUE, + 'where' => 'civicrm_contact.addressee_id', + 'headerPattern' => '', + 'dataPattern' => '', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index c4d094c82b4fe4278be3589f870e5c81b6d7cf72..691a02c8b19852a7bbcda70f5575fe4f21ed49a7 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -1000,6 +1000,33 @@ class api_v3_ContactTest extends CiviUnitTestCase { $this->assertEquals("O'Connor", $result['last_name'], 'in line' . __LINE__); } + /** + * Test retrieval by addressee id. + */ + public function testGetByAddresseeID() { + $individual1ID = $this->individualCreate([ + 'skip_greeting_processing' => 1, + 'addressee_id' => 'null', + 'email_greeting_id' => 'null', + 'postal_greeting_id' => 'null' + ]); + $individual2ID = $this->individualCreate(); + + $this->assertEquals($individual1ID, + $this->callAPISuccessGetValue('Contact', ['contact_type' => 'Individual', 'addressee_id' => ['IS NULL' => 1], 'return' => 'id']) + ); + $this->assertEquals($individual1ID, + $this->callAPISuccessGetValue('Contact', ['contact_type' => 'Individual', 'email_greeting_id' => ['IS NULL' => 1], 'return' => 'id']) + ); + $this->assertEquals($individual1ID, + $this->callAPISuccessGetValue('Contact', ['contact_type' => 'Individual', 'postal_greeting_id' => ['IS NULL' => 1], 'return' => 'id']) + ); + + $this->assertEquals($individual2ID, + $this->callAPISuccessGetValue('Contact', ['contact_type' => 'Individual', 'addressee_id' => ['NOT NULL' => 1], 'return' => 'id']) + ); + } + /** * Check with complete array + custom field. * diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index e6a596c6701c7ad658a4693f37a9272423e31155..cfc14f5bd1367e616be40480647b47dd7bbc9a1f 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -535,6 +535,7 @@ email_greeting_id int unsigned Email Greeting ID + true FK to civicrm_option_value.id, that has to be valid registered Email Greeting. 3.0 @@ -568,6 +569,7 @@ postal_greeting_id int unsigned Postal Greeting ID + true FK to civicrm_option_value.id, that has to be valid registered Postal Greeting. 3.0 @@ -606,6 +608,7 @@ Addressee ID FK to civicrm_option_value.id, that has to be valid registered Addressee. 3.0 + true addressee