CRM-14678 - includes adding conditional on $contactID not defined and fixes a warning...
authorDave Greenberg <dave@civicrm.org>
Wed, 25 Feb 2015 23:37:22 +0000 (15:37 -0800)
committerDave Greenberg <dave@civicrm.org>
Wed, 25 Feb 2015 23:37:22 +0000 (15:37 -0800)
----------------------------------------
* 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
CRM/Event/Form/Registration/Register.php
CRM/Price/BAO/PriceSet.php
templates/CRM/Contribute/Form/Contribution/Main.tpl
templates/CRM/Event/Form/Registration/Register.tpl

index c9feed3539442d8aefd7ea37460d85aff7630725..218c1eeccf1c852320b3a899da4e49eb838c46a5 100644 (file)
@@ -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
index 3e5dc64e7af4e7bf22635f20db36b7f5376ba9c6..a7d7d6c6ede06add1eaa8a5c5564dbe4eb19b767 100644 (file)
@@ -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);
index 711a561abdbc6a1f1b959172be64682c84bb7b77..577105ed32e3e6981291f20d868573e95c1d960c 100644 (file)
@@ -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 {
index 5d5b2bdf600e2f3333f0253cc6bef257b47c9ca1..bb7cb3cad537bea9df6bb723a03d0c5aceaf1a62 100644 (file)
 
   {capture assign='reqMark'}<span class="marker" title="{ts}This field is required.{/ts}">*</span>{/capture}
   <div class="crm-contribution-page-id-{$contributionPageID} crm-block crm-contribution-main-form-block">
+
+  {if $contact_id}
+    <div class="messages status no-popup crm-not-you-message">
+      {ts 1=$display_name}Welcome %1{/ts}. (<a href="{crmURL p='civicrm/contribute/transact' q="cid=0&reset=1&id=`$contributionPageID`"}" title="{ts}Click here to do this for a different person.{/ts}">{ts 1=$display_name}Not %1, or want to do this for a different person{/ts}</a>?)
+    </div>
+  {/if}
+
   <div id="intro_text" class="crm-section intro_text-section">
     {$intro_text}
   </div>
index e6cb1a6767ebab2cd72d26b81bff36270354ddf6..712aa9cc53258960c8b088aeaf56ec254e5c61c3 100644 (file)
@@ -60,7 +60,7 @@
     {/if}
 
     {if $contact_id}
-      <div class="messages status no-popup" id="crm-event-register-different">
+      <div class="messages status no-popup crm-not-you-message" id="crm-event-register-different">
         {ts 1=$display_name}Welcome %1{/ts}. (<a
           href="{crmURL p='civicrm/event/register' q="cid=0&reset=1&id=`$event.id`"}"
           title="{ts}Click here to register a different person for this event.{/ts}">{ts 1=$display_name}Not %1, or want to register a different person{/ts}</a>?)