From 37326fa191079b4389949e2433e4c5c0b25c5289 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Wed, 25 Feb 2015 15:37:22 -0800 Subject: [PATCH] CRM-14678 - includes adding conditional on $contactID not defined and fixes a warning in copyPriceSet due to invalid pass by reference. ---------------------------------------- * CRM-14678: Add "Not you, or want to join/contribute for a different person?" text to contribution pages https://issues.civicrm.org/jira/browse/CRM-14678 --- CRM/Contribute/Form/Contribution/Main.php | 6 ++++++ CRM/Event/Form/Registration/Register.php | 6 ++++-- CRM/Price/BAO/PriceSet.php | 2 +- templates/CRM/Contribute/Form/Contribution/Main.tpl | 7 +++++++ templates/CRM/Event/Form/Registration/Register.tpl | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index c9feed3539..218c1eeccf 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -407,6 +407,12 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $config = CRM_Core_Config::singleton(); + $contactID = $this->getContactID(); + if ($contactID) { + $this->assign('contact_id', $contactID); + $this->assign('display_name', CRM_Contact_BAO_Contact::displayName($contactID)); + } + if ($this->_onbehalf) { CRM_Contribute_Form_Contribution_OnBehalfOf::buildQuickForm($this); // Return if we are in an ajax callback diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 3e5dc64e7a..a7d7d6c6ed 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -340,8 +340,10 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } $contactID = $this->getContactID(); - $this->assign('contact_id', $contactID); - $this->assign('display_name', CRM_Contact_BAO_Contact::displayName($contactID)); + if ($contactID) { + $this->assign('contact_id', $contactID); + $this->assign('display_name', CRM_Contact_BAO_Contact::displayName($contactID)); + } $this->add('hidden', 'scriptFee', NULL); $this->add('hidden', 'scriptArray', NULL); diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 711a561abd..577105ed32 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -1370,7 +1370,7 @@ WHERE ps.id = %1 if ($priceSetId) { $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config'); if ($isQuickConfig) { - $copyPriceSet = &CRM_Price_BAO_PriceSet::copy($priceSetId); + $copyPriceSet = CRM_Price_BAO_PriceSet::copy($priceSetId); CRM_Price_BAO_PriceSet::addTo($baoName, $newId, $copyPriceSet->id); } else { diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 5d5b2bdf60..bb7cb3cad5 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -99,6 +99,13 @@ {capture assign='reqMark'}*{/capture}
+ + {if $contact_id} + + {/if} +
{$intro_text}
diff --git a/templates/CRM/Event/Form/Registration/Register.tpl b/templates/CRM/Event/Form/Registration/Register.tpl index e6cb1a6767..712aa9cc53 100644 --- a/templates/CRM/Event/Form/Registration/Register.tpl +++ b/templates/CRM/Event/Form/Registration/Register.tpl @@ -60,7 +60,7 @@ {/if} {if $contact_id} -
+
{ts 1=$display_name}Welcome %1{/ts}. ({ts 1=$display_name}Not %1, or want to register a different person{/ts}?) -- 2.25.1