From: Jamie McClelland Date: Mon, 18 Nov 2013 21:11:01 +0000 (-0500) Subject: Only add option to display in honor role if PCP allows honor role X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=31ed28061f95c8cd6c0dd2687ad8f511ccc66847;p=civicrm-core.git Only add option to display in honor role if PCP allows honor role See: http://issues.civicrm.org/jira/browse/CRM-13795 --- diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 602615d2d0..1485677afc 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -517,18 +517,22 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->assign('pcpSupporterText', $pcp_supporter_text); } $this->assign('pcp', TRUE); - $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, - array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );") - ); - $extraOption = array('onclick' => "return pcpAnonymous( );"); - $elements = array(); - $elements[] = &$this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption); - $elements[] = &$this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption); - $this->addGroup($elements, 'pcp_is_anonymous', NULL, '   '); - $this->_defaults['pcp_is_anonymous'] = 0; - - $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30)); - $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;')); + $prms = array('id' => $this->_pcpId); + CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo); + if ($pcpInfo['is_honor_roll']) { + $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, + array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );") + ); + $extraOption = array('onclick' => "return pcpAnonymous( );"); + $elements = array(); + $elements[] = &$this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption); + $elements[] = &$this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption); + $this->addGroup($elements, 'pcp_is_anonymous', NULL, '   '); + $this->_defaults['pcp_is_anonymous'] = 0; + + $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30)); + $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;')); + } } //we have to load confirm contribution button in template