Demonstrate retrieving custom field options
*/
function contact_getfields_example(){
-$params = array(
- 'options' => array(
+$params = array(
+ 'options' => array(
'get_options' => 'custom_1',
),
'version' => 3,
*/
function contact_getfields_expectedresult(){
- $expectedResult = array(
+ $expectedResult = array(
'is_error' => 0,
'version' => 3,
- 'count' => 52,
- 'values' => array(
- 'id' => array(
+ 'count' => 53,
+ 'values' => array(
+ 'id' => array(
'name' => 'id',
'type' => 1,
'title' => 'Internal Contact ID',
'where' => 'civicrm_contact.id',
'headerPattern' => '/internal|contact?|id$/i',
'export' => true,
- 'api.aliases' => array(
+ 'api.aliases' => array(
'0' => 'contact_id',
),
),
- 'contact_type' => array(
+ 'contact_type' => array(
'name' => 'contact_type',
'type' => 2,
'title' => 'Contact Type',
'size' => 30,
'export' => true,
'where' => 'civicrm_contact.contact_type',
- 'pseudoconstant' => array(
- 'name' => 'contactType',
- 'table' => 'civicrm_location_type',
+ 'pseudoconstant' => array(
+ 'table' => 'civicrm_contact_type',
'keyColumn' => 'name',
'labelColumn' => 'label',
+ 'condition' => 'parent_id IS NULL',
),
'api.required' => 1,
- 'options' => array(
- 'Individual' => 'Individual',
- 'Household' => 'Household',
- 'Organization' => 'Organization',
- ),
),
- 'contact_sub_type' => array(
+ 'contact_sub_type' => array(
'name' => 'contact_sub_type',
'type' => 2,
'title' => 'Contact Subtype',
'where' => 'civicrm_contact.contact_sub_type',
'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
'export' => true,
+ 'pseudoconstant' => array(
+ 'table' => 'civicrm_contact_type',
+ 'keyColumn' => 'name',
+ 'labelColumn' => 'label',
+ 'condition' => 'parent_id IS NOT NULL',
+ ),
),
- 'do_not_email' => array(
+ 'do_not_email' => array(
'name' => 'do_not_email',
'type' => 16,
'title' => 'Do Not Email',
'dataPattern' => '/^\d{1,}$/',
'export' => true,
),
- 'do_not_phone' => array(
+ 'do_not_phone' => array(
'name' => 'do_not_phone',
'type' => 16,
'title' => 'Do Not Phone',
'dataPattern' => '/^\d{1,}$/',
'export' => true,
),
- 'do_not_mail' => array(
+ 'do_not_mail' => array(
'name' => 'do_not_mail',
'type' => 16,
'title' => 'Do Not Mail',
'dataPattern' => '/^\d{1,}$/',
'export' => true,
),
- 'do_not_sms' => array(
+ 'do_not_sms' => array(
'name' => 'do_not_sms',
'type' => 16,
'title' => 'Do Not Sms',
'dataPattern' => '/^\d{1,}$/',
'export' => true,
),
- 'do_not_trade' => array(
+ 'do_not_trade' => array(
'name' => 'do_not_trade',
'type' => 16,
'title' => 'Do Not Trade',
'dataPattern' => '/^\d{1,}$/',
'export' => true,
),
- 'is_opt_out' => array(
+ 'is_opt_out' => array(
'name' => 'is_opt_out',
'type' => 16,
'title' => 'No Bulk Emails (User Opt Out)',
'where' => 'civicrm_contact.is_opt_out',
'export' => true,
),
- 'legal_identifier' => array(
+ 'legal_identifier' => array(
'name' => 'legal_identifier',
'type' => 2,
'title' => 'Legal Identifier',
'dataPattern' => '/\w+?\d{5,}/',
'export' => true,
),
- 'external_identifier' => array(
+ 'external_identifier' => array(
'name' => 'external_identifier',
'type' => 2,
'title' => 'External Identifier',
'dataPattern' => '/^\d{11,}$/',
'export' => true,
),
- 'sort_name' => array(
+ 'sort_name' => array(
'name' => 'sort_name',
'type' => 2,
'title' => 'Sort Name',
'export' => true,
'where' => 'civicrm_contact.sort_name',
),
- 'display_name' => array(
+ 'display_name' => array(
'name' => 'display_name',
'type' => 2,
'title' => 'Display Name',
'export' => true,
'where' => 'civicrm_contact.display_name',
),
- 'nick_name' => array(
+ 'nick_name' => array(
'name' => 'nick_name',
'type' => 2,
- 'title' => 'Nick Name',
+ 'title' => 'Nickname',
'maxlength' => 128,
'size' => 30,
'import' => true,
'dataPattern' => '/^\w+$/',
'export' => true,
),
- 'legal_name' => array(
+ 'legal_name' => array(
'name' => 'legal_name',
'type' => 2,
'title' => 'Legal Name',
'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
'export' => true,
),
- 'image_URL' => array(
+ 'image_URL' => array(
'name' => 'image_URL',
'type' => 2,
'title' => 'Image Url',
'where' => 'civicrm_contact.image_URL',
'export' => true,
),
- 'preferred_communication_method' => array(
+ 'preferred_communication_method' => array(
'name' => 'preferred_communication_method',
'type' => 2,
'title' => 'Preferred Communication Method',
'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
'dataPattern' => '/^\w+$/',
'export' => true,
+ 'pseudoconstant' => array(
+ 'optionGroupName' => 'preferred_communication_method',
+ ),
),
- 'preferred_language' => array(
+ 'preferred_language' => array(
'name' => 'preferred_language',
'type' => 2,
'title' => 'Preferred Language',
'where' => 'civicrm_contact.preferred_language',
'headerPattern' => '/^lang/i',
'export' => true,
+ 'pseudoconstant' => array(
+ 'optionGroupName' => 'languages',
+ 'keyColumn' => 'name',
+ ),
),
- 'preferred_mail_format' => array(
+ 'preferred_mail_format' => array(
'name' => 'preferred_mail_format',
'type' => 2,
'title' => 'Preferred Mail Format',
'export' => true,
'default' => 'Both',
'enumValues' => 'Text, HTML, Both',
- 'options' => array(
+ 'options' => array(
'0' => 'Text',
'1' => 'HTML',
'2' => 'Both',
),
),
- 'hash' => array(
+ 'hash' => array(
'name' => 'hash',
'type' => 2,
'title' => 'Contact Hash',
'export' => true,
'where' => 'civicrm_contact.hash',
),
- 'api_key' => array(
+ 'api_key' => array(
'name' => 'api_key',
'type' => 2,
'title' => 'Api Key',
'maxlength' => 32,
'size' => 20,
),
- 'first_name' => array(
+ 'first_name' => array(
'name' => 'first_name',
'type' => 2,
'title' => 'First Name',
'dataPattern' => '/^\w+$/',
'export' => true,
),
- 'middle_name' => array(
+ 'middle_name' => array(
'name' => 'middle_name',
'type' => 2,
'title' => 'Middle Name',
'dataPattern' => '/^\w+$/',
'export' => true,
),
- 'last_name' => array(
+ 'last_name' => array(
'name' => 'last_name',
'type' => 2,
'title' => 'Last Name',
'dataPattern' => '/^\w+(\s\w+)?+$/',
'export' => true,
),
- 'prefix_id' => array(
+ 'prefix_id' => array(
'name' => 'prefix_id',
'type' => 1,
'title' => 'Individual Prefix',
- 'pseudoconstant' => array(
- 'name' => 'individualPrefix',
- 'optionGroupName' => 'individualPrefix',
+ 'import' => true,
+ 'where' => 'civicrm_contact.prefix_id',
+ 'headerPattern' => '/^(prefix|title)/i',
+ 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
+ 'export' => true,
+ 'pseudoconstant' => array(
+ 'optionGroupName' => 'individual_prefix',
),
- 'api.aliases' => array(
+ 'api.aliases' => array(
'0' => 'prefix',
),
- 'options' => array(
- '1' => 'Mrs.',
- '2' => 'Ms.',
- '3' => 'Mr.',
- '4' => 'Dr.',
- ),
),
- 'suffix_id' => array(
+ 'suffix_id' => array(
'name' => 'suffix_id',
'type' => 1,
'title' => 'Individual Suffix',
- 'pseudoconstant' => array(
- 'name' => 'individualSuffix',
- 'optionGroupName' => 'individualSuffix',
+ 'import' => true,
+ 'where' => 'civicrm_contact.suffix_id',
+ 'headerPattern' => '/^suffix$/i',
+ 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
+ 'export' => true,
+ 'pseudoconstant' => array(
+ 'optionGroupName' => 'individual_suffix',
),
- 'api.aliases' => array(
+ 'api.aliases' => array(
'0' => 'suffix',
),
- 'options' => array(
- '1' => 'Jr.',
- '2' => 'Sr.',
- '3' => 'II',
- '4' => 'III',
- '5' => 'IV',
- '6' => 'V',
- '7' => 'VI',
- '8' => 'VII',
- ),
),
- 'email_greeting_id' => array(
+ 'email_greeting_id' => array(
'name' => 'email_greeting_id',
'type' => 1,
'title' => 'Email Greeting ID',
),
- 'email_greeting_custom' => array(
+ 'email_greeting_custom' => array(
'name' => 'email_greeting_custom',
'type' => 2,
'title' => 'Email Greeting Custom',
'import' => true,
'where' => 'civicrm_contact.email_greeting_custom',
),
- 'email_greeting_display' => array(
+ 'email_greeting_display' => array(
'name' => 'email_greeting_display',
'type' => 2,
'title' => 'Email Greeting',
'maxlength' => 255,
'size' => 45,
),
- 'postal_greeting_id' => array(
+ 'postal_greeting_id' => array(
'name' => 'postal_greeting_id',
'type' => 1,
'title' => 'Postal Greeting ID',
),
- 'postal_greeting_custom' => array(
+ 'postal_greeting_custom' => array(
'name' => 'postal_greeting_custom',
'type' => 2,
'title' => 'Postal Greeting Custom',
'import' => true,
'where' => 'civicrm_contact.postal_greeting_custom',
),
- 'postal_greeting_display' => array(
+ 'postal_greeting_display' => array(
'name' => 'postal_greeting_display',
'type' => 2,
'title' => 'Postal Greeting',
'maxlength' => 255,
'size' => 45,
),
- 'addressee_id' => array(
+ 'addressee_id' => array(
'name' => 'addressee_id',
'type' => 1,
'title' => 'Addressee ID',
),
- 'addressee_custom' => array(
+ 'addressee_custom' => array(
'name' => 'addressee_custom',
'type' => 2,
'title' => 'Addressee Custom',
'import' => true,
'where' => 'civicrm_contact.addressee_custom',
),
- 'addressee_display' => array(
+ 'addressee_display' => array(
'name' => 'addressee_display',
'type' => 2,
'title' => 'Addressee',
'maxlength' => 255,
'size' => 45,
),
- 'job_title' => array(
+ 'job_title' => array(
'name' => 'job_title',
'type' => 2,
'title' => 'Job Title',
'dataPattern' => '//',
'export' => true,
),
- 'gender_id' => array(
+ 'gender_id' => array(
'name' => 'gender_id',
'type' => 1,
'title' => 'Gender',
- 'pseudoconstant' => array(
- 'name' => 'gender',
+ 'import' => true,
+ 'where' => 'civicrm_contact.gender_id',
+ 'headerPattern' => '/^gender$/i',
+ 'export' => true,
+ 'pseudoconstant' => array(
'optionGroupName' => 'gender',
),
- 'api.aliases' => array(
+ 'api.aliases' => array(
'0' => 'gender',
),
- 'options' => array(
- '1' => 'Female',
- '2' => 'Male',
- '3' => 'Transgender',
- ),
),
- 'birth_date' => array(
+ 'birth_date' => array(
'name' => 'birth_date',
'type' => 4,
'title' => 'Birth Date',
'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
'export' => true,
),
- 'is_deceased' => array(
+ 'is_deceased' => array(
'name' => 'is_deceased',
'type' => 16,
'title' => 'Is Deceased',
'headerPattern' => '/i(s\s)?d(eceased)$/i',
'export' => true,
),
- 'deceased_date' => array(
+ 'deceased_date' => array(
'name' => 'deceased_date',
'type' => 4,
'title' => 'Deceased Date',
'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
'export' => true,
),
- 'household_name' => array(
+ 'household_name' => array(
'name' => 'household_name',
'type' => 2,
'title' => 'Household Name',
'dataPattern' => '/^\w+$/',
'export' => true,
),
- 'primary_contact_id' => array(
+ 'primary_contact_id' => array(
'name' => 'primary_contact_id',
'type' => 1,
'title' => 'Household Primary Contact ID',
'FKClassName' => 'CRM_Contact_DAO_Contact',
),
- 'organization_name' => array(
+ 'organization_name' => array(
'name' => 'organization_name',
'type' => 2,
'title' => 'Organization Name',
'dataPattern' => '/^\w+$/',
'export' => true,
),
- 'sic_code' => array(
+ 'sic_code' => array(
'name' => 'sic_code',
'type' => 2,
'title' => 'Sic Code',
'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
'export' => true,
),
- 'user_unique_id' => array(
+ 'user_unique_id' => array(
'name' => 'user_unique_id',
'type' => 2,
'title' => 'Unique ID (OpenID)',
'export' => true,
'rule' => 'url',
),
- 'created_date' => array(
+ 'created_date' => array(
'name' => 'created_date',
'type' => 256,
'title' => 'Created Date',
'required' => '',
'default' => 'UL',
),
- 'modified_date' => array(
+ 'modified_date' => array(
'name' => 'modified_date',
'type' => 256,
'title' => 'Modified Date',
'required' => '',
'default' => 'URRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAM',
),
- 'source' => array(
+ 'source' => array(
'name' => 'source',
'type' => 2,
'title' => 'Source of Contact Data',
'export' => true,
'uniqueName' => 'contact_source',
),
- 'employer_id' => array(
+ 'employer_id' => array(
'name' => 'employer_id',
'type' => 1,
'title' => 'Current Employer ID',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'uniqueName' => 'current_employer_id',
),
- 'is_deleted' => array(
+ 'is_deleted' => array(
'name' => 'is_deleted',
'type' => 16,
'title' => 'Contact is in Trash',
'where' => 'civicrm_contact.is_deleted',
'uniqueName' => 'contact_is_deleted',
),
- 'custom_1' => array(
+ 'custom_1' => array(
'label' => 'Country',
'groupTitle' => 'select_test_g',
'data_type' => 'String',
'extends_entity_column_id' => '',
'is_view' => 0,
'is_multiple' => 0,
- 'option_group_id' => '86',
+ 'option_group_id' => '97',
'date_format' => '',
'time_format' => '',
- 'options' => array(
+ 'options' => array(
'1' => 'Label1',
'2' => 'Label2',
),
),
- 'current_employer' => array(
+ 'current_employer' => array(
'title' => 'Current Employer',
'description' => 'Name of Current Employer',
),
+ 'dupe_check' => array(
+ 'title' => 'Check for Duplicates',
+ 'description' => 'Throw error if contact create matches dedupe rule',
+ ),
),
);