Remove always-true membership_assign
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 19 Nov 2023 21:44:59 +0000 (10:44 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 20 Nov 2023 00:37:39 +0000 (13:37 +1300)
The combination of membership_assign and useForMember toggles whether the membership
information shows up. It shows up when we are not showing line items - in
which case it shows in the line item block instead - see
https://github.com/civicrm/civicrm-core/pull/28181

membership_assign is Always assigned when this receipt
is sent - hence it can go

useForMember winds up being a pseudonym of isShowLineItems
so this instance is replaced with that
- #28181 replaces some further instances

CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/Form/Contribution/Confirm.php

index 331daa89962c009f0f26d658d3285da48110f08d..06ec2be5a9968109468d06d49ea76ded4d1378a9 100644 (file)
@@ -2632,8 +2632,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         foreach ($this->_relatedObjects['membership'] as $membership) {
           if ($membership->id) {
             $values['membership_id'] = $membership->id;
-            $values['membership_assign'] = TRUE;
-
             // need to set the membership values here
             $template->assign('membership_name',
               CRM_Member_PseudoConstant::membershipType($membership->membership_type_id)
index 43c385ed5654a557946b4da45ef1246d66a9cbe3..9be8c666de80a0b2f76e72df6d2ad6b8c9aaa54e 100644 (file)
@@ -147,7 +147,6 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
       'customPre_grouptitle',
       'customPost_grouptitle',
       'useForMember',
-      'membership_assign',
       'amount',
       'receipt_date',
       'is_pay_later',
@@ -351,7 +350,6 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
         'customPost' => $values['customPost'],
         'customPost_grouptitle' => $values['customPost_grouptitle'],
         'useForMember' => $values['useForMember'],
-        'membership_assign' => $values['membership_assign'],
         'amount' => $values['amount'],
         'is_pay_later' => $values['is_pay_later'],
         'receipt_date' => !$values['receipt_date'] ? NULL : date('YmdHis', strtotime($values['receipt_date'])),
index abf4e44b16d78554563a817b7c55fa4451237af6..d3172f995fd6452a3fbd1f46366d6293c080f4b6 100644 (file)
@@ -1368,7 +1368,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $this->postProcessMembership($membershipParams, $contactID, $premiumParams, $customFieldsFormatted, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID,
       $membershipLineItems);
 
-    $this->assign('membership_assign', TRUE);
     $this->set('membershipTypeID', $membershipParams['selectMembership']);
   }
 
@@ -1637,7 +1636,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
 
     $emailValues = array_merge($membershipParams, $this->_values);
-    $emailValues['membership_assign'] = 1;
     $emailValues['useForMember'] = !empty($this->_useForMember);
     $emailValues['membership_id'] = !empty($membership) ? $membership->id : NULL;
 
@@ -2365,7 +2363,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
    */
   protected function doMembershipProcessing($contactID, $membershipParams, $premiumParams, $formLineItems) {
     if (!$this->_useForMember) {
-      $this->assign('membership_assign', TRUE);
       $this->set('membershipTypeID', $this->_params['selectMembership']);
     }