Skip to content
Snippets Groups Projects
Commit b987fa2b authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-01-20-19-00-14

parents 2cfd4a61 3e1fa095
No related branches found
No related tags found
No related merge requests found
Showing
with 105 additions and 30 deletions
...@@ -328,6 +328,19 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ...@@ -328,6 +328,19 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
*/ */
function &getColumnHeaders($action = NULL, $output = NULL) { function &getColumnHeaders($action = NULL, $output = NULL) {
$headers = NULL; $headers = NULL;
// unset return property elements that we don't care
if (!empty($this->_returnProperties)) {
$doNotCareElements = array(
'contact_type',
'contact_sub_type',
'sort_name',
);
foreach ( $doNotCareElements as $value) {
unset($this->_returnProperties[$value]);
}
}
if ($output == CRM_Core_Selector_Controller::EXPORT) { if ($output == CRM_Core_Selector_Controller::EXPORT) {
$csvHeaders = array(ts('Contact Id'), ts('Contact Type')); $csvHeaders = array(ts('Contact Id'), ts('Contact Type'));
foreach ($this->getColHeads($action, $output) as $column) { foreach ($this->getColHeads($action, $output) as $column) {
...@@ -430,10 +443,6 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ...@@ -430,10 +443,6 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
$properties = self::makeProperties($this->_returnProperties); $properties = self::makeProperties($this->_returnProperties);
foreach ($properties as $prop) { foreach ($properties as $prop) {
if ($prop == 'contact_type' || $prop == 'contact_sub_type' || $prop == 'sort_name') {
continue;
}
if (strpos($prop, '-')) { if (strpos($prop, '-')) {
list($loc, $fld, $phoneType) = CRM_Utils_System::explode('-', $prop, 3); list($loc, $fld, $phoneType) = CRM_Utils_System::explode('-', $prop, 3);
$title = $this->_query->_fields[$fld]['title']; $title = $this->_query->_fields[$fld]['title'];
...@@ -444,7 +453,8 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ...@@ -444,7 +453,8 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
} }
elseif (isset($this->_query->_fields[$prop]) && isset($this->_query->_fields[$prop]['title'])) { elseif (isset($this->_query->_fields[$prop]) && isset($this->_query->_fields[$prop]['title'])) {
$title = $this->_query->_fields[$prop]['title']; $title = $this->_query->_fields[$prop]['title'];
} else { }
else {
$title = ''; $title = '';
} }
......
...@@ -635,5 +635,48 @@ class CRM_Utils_Array { ...@@ -635,5 +635,48 @@ class CRM_Utils_Array {
} }
return $default; return $default;
} }
/**
* Generate the Cartesian product of zero or more vectors
*
* @param array $dimensions list of dimensions to multiply; each key is a dimension name; each value is a vector
* @param array $template a base set of values included in every output
* @return array each item is a distinct combination of values from $dimensions
*
* For example, the product of
* {
* fg => {red, blue},
* bg => {white, black}
* }
* would be
* {
* {fg => red, bg => white},
* {fg => red, bg => black},
* {fg => blue, bg => white},
* {fg => blue, bg => black}
* }
*/
static function product($dimensions, $template = array()) {
if (empty($dimensions)) {
return array($template);
}
foreach ($dimensions as $key => $value) {
$firstKey = $key;
$firstValues = $value;
break;
}
unset($dimensions[$key]);
$results = array();
foreach ($firstValues as $firstValue) {
foreach (self::product($dimensions, $template) as $result) {
$result[$firstKey] = $firstValue;
$results[] = $result;
}
}
return $results;
}
} }
...@@ -581,8 +581,10 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = ...@@ -581,8 +581,10 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
if(isset($profileFields[$profileID][$entityfield])) { if(isset($profileFields[$profileID][$entityfield])) {
unset($profileFields[$profileID][$entityfield]); unset($profileFields[$profileID][$entityfield]);
} }
// we will make the mixed case version (e.g. of 'Primary') an alias if(!in_array($entityfield, $profileFields[$profileID][$fieldName]['api.aliases'])) {
$profileFields[$profileID][$fieldName]['api.aliases'][] = $entityfield; // we will make the mixed case version (e.g. of 'Primary') an alias
$profileFields[$profileID][$fieldName]['api.aliases'][] = $entityfield;
}
} }
/** /**
* putting this on hold -this would cause the api to set the default - but could have unexpected behaviour * putting this on hold -this would cause the api to set the default - but could have unexpected behaviour
......
...@@ -95,4 +95,4 @@ function activity_create_expectedresult(){ ...@@ -95,4 +95,4 @@ function activity_create_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -49,6 +49,8 @@ function activity_get_expectedresult(){ ...@@ -49,6 +49,8 @@ function activity_get_expectedresult(){
'is_current_revision' => '1', 'is_current_revision' => '1',
'is_deleted' => 0, 'is_deleted' => 0,
'source_contact_id' => '1', 'source_contact_id' => '1',
'custom_1' => 'defaultValue',
'custom_1_1' => 'defaultValue',
'custom_2_id' => '1', 'custom_2_id' => '1',
'custom_2_1_id' => '1', 'custom_2_1_id' => '1',
'custom_2' => 'Anderson, Anthony', 'custom_2' => 'Anderson, Anthony',
...@@ -81,4 +83,4 @@ function activity_get_expectedresult(){ ...@@ -81,4 +83,4 @@ function activity_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -78,4 +78,4 @@ function activity_get_expectedresult(){ ...@@ -78,4 +78,4 @@ function activity_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -77,4 +77,4 @@ function activity_get_expectedresult(){ ...@@ -77,4 +77,4 @@ function activity_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -96,4 +96,4 @@ function activity__expectedresult(){ ...@@ -96,4 +96,4 @@ function activity__expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -79,11 +79,16 @@ function activity_get_expectedresult(){ ...@@ -79,11 +79,16 @@ function activity_get_expectedresult(){
'nick_name' => '', 'nick_name' => '',
'legal_name' => '', 'legal_name' => '',
'image_URL' => '', 'image_URL' => '',
'preferred_communication_method' => '',
'preferred_language' => 'en_US',
'preferred_mail_format' => 'Both', 'preferred_mail_format' => 'Both',
'first_name' => 'Anthony', 'first_name' => 'Anthony',
'middle_name' => 'J.', 'middle_name' => 'J.',
'last_name' => 'Anderson', 'last_name' => 'Anderson',
'prefix_id' => 'Mr.',
'suffix_id' => 'II',
'job_title' => '', 'job_title' => '',
'gender_id' => '',
'birth_date' => '', 'birth_date' => '',
'is_deceased' => 0, 'is_deceased' => 0,
'deceased_date' => '', 'deceased_date' => '',
...@@ -114,6 +119,9 @@ function activity_get_expectedresult(){ ...@@ -114,6 +119,9 @@ function activity_get_expectedresult(){
'im' => '', 'im' => '',
'worldregion_id' => '', 'worldregion_id' => '',
'world_region' => '', 'world_region' => '',
'individual_prefix' => 'Mr.',
'individual_suffix' => 'II',
'gender' => '',
'state_province_name' => '', 'state_province_name' => '',
'state_province' => '', 'state_province' => '',
'country' => '', 'country' => '',
...@@ -149,4 +157,4 @@ function activity_get_expectedresult(){ ...@@ -149,4 +157,4 @@ function activity_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -95,4 +95,4 @@ function activity_create_expectedresult(){ ...@@ -95,4 +95,4 @@ function activity_create_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -58,4 +58,4 @@ function activity_delete_expectedresult(){ ...@@ -58,4 +58,4 @@ function activity_delete_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -77,4 +77,4 @@ function activity_get_expectedresult(){ ...@@ -77,4 +77,4 @@ function activity_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -45,6 +45,7 @@ function activity_getfields_expectedresult(){ ...@@ -45,6 +45,7 @@ function activity_getfields_expectedresult(){
'import' => true, 'import' => true,
'where' => 'civicrm_activity.activity_type_id', 'where' => 'civicrm_activity.activity_type_id',
'headerPattern' => '/(activity.)?type(.id$)/i', 'headerPattern' => '/(activity.)?type(.id$)/i',
'default' => '1',
'pseudoconstant' => array( 'pseudoconstant' => array(
'optionGroupName' => 'activity_type', 'optionGroupName' => 'activity_type',
), ),
...@@ -94,7 +95,7 @@ function activity_getfields_expectedresult(){ ...@@ -94,7 +95,7 @@ function activity_getfields_expectedresult(){
'name' => 'relationship_id', 'name' => 'relationship_id',
'type' => 1, 'type' => 1,
'title' => 'Relationship Id', 'title' => 'Relationship Id',
'default' => 'UL', 'default' => 'NULL',
'FKClassName' => 'CRM_Contact_DAO_Relationship', 'FKClassName' => 'CRM_Contact_DAO_Relationship',
), ),
'is_current_revision' => array( 'is_current_revision' => array(
...@@ -105,6 +106,7 @@ function activity_getfields_expectedresult(){ ...@@ -105,6 +106,7 @@ function activity_getfields_expectedresult(){
'where' => 'civicrm_activity.is_current_revision', 'where' => 'civicrm_activity.is_current_revision',
'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i', 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
'export' => true, 'export' => true,
'default' => '1',
), ),
'original_id' => array( 'original_id' => array(
'name' => 'original_id', 'name' => 'original_id',
...@@ -187,6 +189,9 @@ function activity_getfields_expectedresult(){ ...@@ -187,6 +189,9 @@ function activity_getfields_expectedresult(){
'optionGroupName' => 'activity_status', 'optionGroupName' => 'activity_status',
), ),
'uniqueName' => 'activity_status_id', 'uniqueName' => 'activity_status_id',
'api.aliases' => array(
'0' => 'activity_status',
),
), ),
'is_test' => array( 'is_test' => array(
'name' => 'is_test', 'name' => 'is_test',
...@@ -202,7 +207,7 @@ function activity_getfields_expectedresult(){ ...@@ -202,7 +207,7 @@ function activity_getfields_expectedresult(){
'name' => 'medium_id', 'name' => 'medium_id',
'type' => 1, 'type' => 1,
'title' => 'Activity Medium', 'title' => 'Activity Medium',
'default' => 'UL', 'default' => 'NULL',
'pseudoconstant' => array( 'pseudoconstant' => array(
'optionGroupName' => 'encounter_medium', 'optionGroupName' => 'encounter_medium',
), ),
...@@ -229,11 +234,16 @@ function activity_getfields_expectedresult(){ ...@@ -229,11 +234,16 @@ function activity_getfields_expectedresult(){
'campaign_id' => array( 'campaign_id' => array(
'name' => 'campaign_id', 'name' => 'campaign_id',
'type' => 1, 'type' => 1,
'title' => 'Campaign ID', 'title' => 'Campaign',
'import' => true, 'import' => true,
'where' => 'civicrm_activity.campaign_id', 'where' => 'civicrm_activity.campaign_id',
'export' => true, 'export' => true,
'FKClassName' => 'CRM_Campaign_DAO_Campaign', 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
'pseudoconstant' => array(
'table' => 'civicrm_campaign',
'keyColumn' => 'id',
'labelColumn' => 'title',
),
'uniqueName' => 'activity_campaign_id', 'uniqueName' => 'activity_campaign_id',
), ),
'engagement_level' => array( 'engagement_level' => array(
...@@ -294,4 +304,4 @@ function activity_getfields_expectedresult(){ ...@@ -294,4 +304,4 @@ function activity_getfields_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -36,10 +36,10 @@ function activity_type_create_expectedresult(){ ...@@ -36,10 +36,10 @@ function activity_type_create_expectedresult(){
'is_error' => 0, 'is_error' => 0,
'version' => 3, 'version' => 3,
'count' => 1, 'count' => 1,
'id' => 722, 'id' => 727,
'values' => array( 'values' => array(
'722' => array( '727' => array(
'id' => '722', 'id' => '727',
'option_group_id' => '2', 'option_group_id' => '2',
'label' => 'send out letters', 'label' => 'send out letters',
'value' => '46', 'value' => '46',
...@@ -83,4 +83,4 @@ function activity_type_create_expectedresult(){ ...@@ -83,4 +83,4 @@ function activity_type_create_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -102,4 +102,4 @@ function activity_type_get_expectedresult(){ ...@@ -102,4 +102,4 @@ function activity_type_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -77,4 +77,4 @@ function address_get_expectedresult(){ ...@@ -77,4 +77,4 @@ function address_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -76,4 +76,4 @@ function address_create_expectedresult(){ ...@@ -76,4 +76,4 @@ function address_create_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -96,4 +96,4 @@ function address_get_expectedresult(){ ...@@ -96,4 +96,4 @@ function address_get_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -82,4 +82,4 @@ function address_create_expectedresult(){ ...@@ -82,4 +82,4 @@ function address_create_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
...@@ -58,4 +58,4 @@ function address_delete_expectedresult(){ ...@@ -58,4 +58,4 @@ function address_delete_expectedresult(){
* *
* API Standards documentation: * API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/ */
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment