From: Coleman Watts Date: Fri, 2 Jan 2015 01:34:08 +0000 (-0500) Subject: Fix membershipType options lookup and display X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dbd825925cf73a9c23bc65972113ca1b6ec4d848;p=civicrm-core.git Fix membershipType options lookup and display --- diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index fbbb1e2b62..1d8812ba1c 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -135,6 +135,18 @@ class CRM_Core_SelectValues { ); } + /** + * Member auto-renew options + * @static + */ + public static function memberAutoRenew() { + return array( + ts('No auto-renew option'), + ts('Give option, but not required'), + ts('Auto-renew required') + ); + } + /** * Various pre defined event dates * @static diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 8036c86772..5537c55b39 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -266,7 +266,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $allMembershipInfo = $membershipType = array(); // auto renew options if enabled for the membership - $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required ')); + $options = CRM_Core_SelectValues::memberAutoRenew(); foreach( $allMemberships as $key => $values ) { if (!empty($values['is_active'])) { diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 1e8a6dee72..97ff8248d6 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -155,7 +155,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig { $options = array(); if (is_array($paymentProcessor) && !empty($paymentProcessor)) { $isAuthorize = TRUE; - $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required ')); + $options = CRM_Core_SelectValues::memberAutoRenew(); } $this->addRadio('auto_renew', ts('Auto-renew Option'), $options); diff --git a/CRM/Member/Page/AJAX.php b/CRM/Member/Page/AJAX.php index fb349373e8..15b9bb002d 100644 --- a/CRM/Member/Page/AJAX.php +++ b/CRM/Member/Page/AJAX.php @@ -65,7 +65,7 @@ WHERE id = %1"; $details['total_amount_numeric'] = $details['total_amount']; // fix the display of the monetary value, CRM-4038 $details['total_amount'] = CRM_Utils_Money::format($details['total_amount'], NULL, '%a'); - $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required ')); + $options = CRM_Core_SelectValues::memberAutoRenew(); $details['auto_renew'] = CRM_Utils_Array::value('auto_renew', $options[$details]); CRM_Utils_JSON::output($details); } diff --git a/CRM/Member/Page/MembershipType.php b/CRM/Member/Page/MembershipType.php index 2b54fe0d34..ef739c8533 100644 --- a/CRM/Member/Page/MembershipType.php +++ b/CRM/Member/Page/MembershipType.php @@ -115,11 +115,13 @@ class CRM_Member_Page_MembershipType extends CRM_Core_Page { $dao->orderBy('weight'); $dao->find(); - while ($dao->fetch()) { $membershipType[$dao->id] = array(); CRM_Core_DAO::storeValues($dao, $membershipType[$dao->id]); + $membershipType[$dao->id]['period_type'] = CRM_Utils_Array::value($dao->period_type, CRM_Core_SelectValues::periodType(), ''); + $membershipType[$dao->id]['visibility'] = CRM_Utils_Array::value($dao->visibility, CRM_Core_SelectValues::memberVisibility(), ''); + //adding column for relationship type label. CRM-4178. if ($dao->relationship_type_id) { //If membership associated with 2 or more relationship then display all relationship with comma separated diff --git a/xml/schema/Member/MembershipType.xml b/xml/schema/Member/MembershipType.xml index a076d0ebbc..e1cca9d096 100644 --- a/xml/schema/Member/MembershipType.xml +++ b/xml/schema/Member/MembershipType.xml @@ -248,6 +248,9 @@ auto_renew boolean 0 + + CRM_Core_SelectValues::memberAutoRenew + 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required; 3.3