Unverified Commit 49b24c32 authored by Monish Deb's avatar Monish Deb Committed by GitHub

Merge pull request #11654 from eileenmcnaughton/greetings_earthling

CRM-21750 support addressee_id, email_greeting_id, postal_greeting_id  as api filters
parents 6c1fe156 54e389ac
......@@ -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',
......
......@@ -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.
*
......
......@@ -535,6 +535,7 @@
<name>email_greeting_id</name>
<type>int unsigned</type>
<title>Email Greeting ID</title>
<export>true</export>
<comment>FK to civicrm_option_value.id, that has to be valid registered Email Greeting.</comment>
<add>3.0</add>
<pseudoconstant>
......@@ -568,6 +569,7 @@
<name>postal_greeting_id</name>
<type>int unsigned</type>
<title>Postal Greeting ID</title>
<export>true</export>
<comment>FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.</comment>
<add>3.0</add>
<html>
......@@ -606,6 +608,7 @@
<title>Addressee ID</title>
<comment>FK to civicrm_option_value.id, that has to be valid registered Addressee.</comment>
<add>3.0</add>
<export>true</export>
<pseudoconstant>
<optionGroupName>addressee</optionGroupName>
</pseudoconstant>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment