CRM-15589 - Membership section label mixup
authoratif-shaikh <shaikh388@gmail.com>
Thu, 27 Nov 2014 13:49:11 +0000 (19:19 +0530)
committeratif-shaikh <shaikh388@gmail.com>
Thu, 27 Nov 2014 13:49:11 +0000 (19:19 +0530)
https://issues.civicrm.org/jira/browse/CRM-15589

CRM/Member/Form/MembershipBlock.php
templates/CRM/Member/Form/MembershipBlock.tpl

index 71b0e4982a79cbd32fbb888185cd59266920ddbe..a31a8c537d8769dc456b030416f00743e1503a15 100644 (file)
@@ -80,10 +80,11 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
       $this->_memPriceSetId = $priceSetId;
       $pFIDs = array();
       if ($priceSetId) {
-        CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name'));
+        CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'label'));
         foreach ($pFIDs as $pid => $pValue) {
           if ($pValue['html_type'] == 'Radio' && $pValue['name'] == 'membership_amount') {
             $defaults['mem_price_field_id'] = $pValue['id'];
+            $defaults['membership_type_label'] = $pValue['label'];
           }
         }
 
@@ -127,6 +128,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
       $this->addElement('checkbox', 'is_required', ts('Require Membership Signup'));
       $this->addElement('checkbox', 'display_min_fee', ts('Display Membership Fee'));
       $this->addElement('checkbox', 'is_separate_payment', ts('Separate Membership Payment'));
+      $this->addElement('text', 'membership_type_label', ts('Membership Types Label'), array('placeholder' => ts('Membership')));
 
       $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
       $paymentProcessorIds = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
@@ -390,7 +392,6 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
         if (empty($editedResults['id'])) {
           $fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
-          $fieldParams['label'] = !empty($params['new_title']) ? $params['new_title'] : ts('Membership');
           if (empty($params['mem_price_field_id'])) {
             CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
           }
@@ -400,6 +401,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
           $fieldParams['id'] = CRM_Utils_Array::value('id', $editedResults);
         }
 
+        $fieldParams['label'] = !empty($params['membership_type_label']) ? $params['membership_type_label'] : ts('Membership');
         $fieldParams['is_active'] = 1;
         $fieldParams['html_type'] = 'Radio';
         $fieldParams['is_required'] = !empty($params['is_required']) ? 1 : 0;
index 51f82127a40ac78cb8ec4fc62d7093cba73561b6..905384ed538cdb583b906b89e9cd0f679a1898c5 100644 (file)
       <td><div class="status message">{ts}Click <a id='memQuickconfig' href='#'>here</a> if you want to configure the Membership Types below as part of a Price Set, with the added flexibility and complexity that entails.{/ts}</div></td>
     </tr>
     {/if}
+          <tr id="membership_type-label" class="crm-member-membershipblock-form-block-membership_type_label">
+            <td class="label">{$form.membership_type_label.label}</td>
+            <td>{$form.membership_type_label.html}</td>
+          </tr>
           <tr id="membership_type-block" class="crm-member-membershipblock-form-block-membership_type">
               <td class="label">{$form.membership_type.label}</td>
               <td>
     // function to handle show/hide of membership type and related blocks if price set is selected
     function checkIfPriceSetIsSelected( ) {
         if ( cj('#member_price_set_id').val() ) {
+            cj('#membership_type-label').hide();
             cj('#membership_type-block').hide();
             cj('#requiredSignup').hide();
             cj('#displayFee').hide();
             cj('#separatePayment').hide();
             cj('#quickConfigConvertMessage').hide();
         } else {
+            cj('#membership_type-label').show();
             cj('#membership_type-block').show();
             cj('#requiredSignup').show();
             cj('#displayFee').show();