From: Tim Otten Date: Sun, 19 Jan 2014 01:20:23 +0000 (-0800) Subject: Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-01-18-17-02-24 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9b10578bd1e1895cf21e39ff16d3363e5419b591;p=civicrm-core.git Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-01-18-17-02-24 Conflicts: CRM/Contribute/Form/Contribution/Main.php api/v3/Generic/Setvalue.php templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl --- 9b10578bd1e1895cf21e39ff16d3363e5419b591 diff --cc CRM/Contact/BAO/Query.php index fca554346e,623b8acd60..061c0933af --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@@ -754,17 -759,32 +759,35 @@@ class CRM_Contact_BAO_Query } elseif ($fieldName != 'id') { if ($fieldName == 'prefix_id') { - $this->_pseudoConstantsSelect['individual_prefix'] = array('pseudoField' => 'prefix_id', 'idCol' => "prefix_id", 'bao' => 'CRM_Contact_BAO_Contact'); + // Hack - profile views use different field name than normal views! + $this->_pseudoConstantsSelect['prefix_id'] = + $this->_pseudoConstantsSelect['individual_prefix'] = array( + 'pseudoField' => 'prefix_id', + 'idCol' => "prefix_id", + 'bao' => 'CRM_Contact_BAO_Contact' + ); } if ($fieldName == 'suffix_id') { - $this->_pseudoConstantsSelect['individual_suffix'] = array('pseudoField' => 'suffix_id', 'idCol' => "suffix_id", 'bao' => 'CRM_Contact_BAO_Contact'); + // Hack - profile views use different field name than normal views! + $this->_pseudoConstantsSelect['suffix_id'] = + $this->_pseudoConstantsSelect['individual_suffix'] = array( + 'pseudoField' => 'suffix_id', + 'idCol' => "suffix_id", + 'bao' => 'CRM_Contact_BAO_Contact' + ); } if ($fieldName == 'gender_id') { - $this->_pseudoConstantsSelect['gender'] = array('pseudoField' => 'gender_id', 'idCol' => "gender_id", 'bao' => 'CRM_Contact_BAO_Contact'); + // Hack - profile views use different field name than normal views! + $this->_pseudoConstantsSelect['gender_id'] = + $this->_pseudoConstantsSelect['gender'] = array( + 'pseudoField' => 'gender_id', + 'idCol' => "gender_id", + 'bao' => 'CRM_Contact_BAO_Contact' + ); } + if ($name == 'communication_style_id') { + $this->_pseudoConstantsSelect['communication_style'] = array('pseudoField' => 'communication_style_id', 'idCol' => "communication_style_id", 'bao' => 'CRM_Contact_BAO_Contact'); + } $this->_select[$name] = "contact_a.{$fieldName} as `$name`"; } } diff --cc CRM/Contribute/Form/Contribution/Main.php index 64b90320fc,f1fb2d6aac..65c688ef2a --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@@ -114,9 -111,10 +111,14 @@@ class CRM_Contribute_Form_Contribution_ } $this->assign('onBehalfRequired', $this->_onBehalfRequired); + if (CRM_Utils_Array::value('honor_block_is_active', $this->_values)) { - CRM_Contact_Form_ProfileContact::preprocess($this); - } ++ CRM_Contact_Form_ProfileContact::preprocess($this); ++ } ++ + if ($this->_snippet) { + $this->assign('isOnBehalfCallback', CRM_Utils_Array::value('onbehalf', $_GET, FALSE)); + return; + } if (!empty($this->_pcpInfo['id']) && !empty($this->_pcpInfo['intro_text'])) { $this->assign('intro_text', $this->_pcpInfo['intro_text']); diff --cc api/v3/Generic/Setvalue.php index abe405a5ee,9802d97bc5..be0553354b --- a/api/v3/Generic/Setvalue.php +++ b/api/v3/Generic/Setvalue.php @@@ -26,7 -26,9 +26,10 @@@ function civicrm_api3_generic_setValue( } $def = $fields[$field]; - if (array_key_exists('required', $def) && CRM_Utils_System::isNull($value)) { + // Disallow empty values except for the number zero. + // TODO: create a utility for this since it's needed in many places ++ // if (array_key_exists('required', $def) && CRM_Utils_System::isNull($value)) { + if (array_key_exists('required', $def) && empty($value) && $value !== '0' && $value !== 0) { return civicrm_api3_create_error(ts("This can't be empty, please provide a value"), array("error_code" => "required", "field" => $field)); } diff --cc templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index f218ab6936,b6ec06bf92..c5c5506fe6 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@@ -146,9 -147,8 +147,8 @@@ } function showOnBehalf(onBehalfRequired) { - if ( cj( "#is_for_organization" ).prop('checked' ) || onBehalfRequired ) { - var urlPath = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&onbehalf=1'}"; - urlPath += "{$urlParams}"; - if ( cj( "#is_for_organization" ).attr( 'checked' ) || onBehalfRequired ) { ++ if ( cj( "#is_for_organization" ).prop( 'checked' ) || onBehalfRequired ) { + var urlPath = {/literal}"{crmURL p=$urlPath h=0 q="snippet=4&onbehalf=1&id=$contributionPageID&qfKey=$qfKey"}"; {if $mode eq 'test'} urlPath += '&action=preview'; {/if}