Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1331 Don't freeze fields for auto-renew memberships #16609

Merged
merged 2 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,6 @@ public function buildQuickForm() {
);

$sel->setOptions([$selMemTypeOrg, $selOrgMemType]);
if ($isUpdateToExistingRecurringMembership) {
$sel->freeze();
}

if ($this->_action & CRM_Core_Action::ADD) {
$this->add('number', 'num_terms', ts('Number of Terms'), ['size' => 6]);
Expand All @@ -579,9 +576,6 @@ public function buildQuickForm() {
$statusOverride = $this->addElement('select', 'is_override', ts('Status Override?'),
CRM_Member_StatusOverrideTypes::getSelectOptions()
);
if ($statusOverride && $isUpdateToExistingRecurringMembership) {
$statusOverride->freeze();
}

$this->add('datepicker', 'status_override_end_date', ts('Status Override End Date'), '', FALSE, ['minDate' => time(), 'time' => FALSE]);

Expand Down
37 changes: 34 additions & 3 deletions templates/CRM/Member/Form/Membership.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
+--------------------------------------------------------------------+
*}
{* this template is used for adding/editing/deleting memberships for a contact *}
{if $cancelAutoRenew}
{if $isRecur}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
<p>{ts 1=$cancelAutoRenew}This membership is set to renew automatically {if $endDate}on {$endDate|crmDate}{/if}. You will need to cancel the auto-renew option if you want to modify the Membership Type or Membership Status: <a href="%1">Cancel auto-renew</a>{/ts}</p>
<p>{ts}This membership is set to renew automatically {if $endDate}on {$endDate|crmDate}{/if}. Please be aware that any changes that you make here may not be reflected in the payment processor. Please ensure that you alter the related subscription at the payment processor.{/ts}</p>
{if $cancelAutoRenew}<p>{ts}To stop the automatic renewal:
<a href="%1">Cancel auto-renew</a>
{/ts}</p>{/if}
</div>
{/if}
<div class="spacer"></div>
Expand Down Expand Up @@ -73,7 +76,16 @@
</tr>
<tr class="crm-membership-form-block-membership_type_id">
<td class="label">{$form.membership_type_id.label}</td>
<td><span id='mem_type_id'>{$form.membership_type_id.html}</span>
<td id="mem_type_id-readonly">
<span id="membership_type_id_0-readonly"></span> : <span id="membership_type_id_1-readonly"></span>
<span id="mem-type-override">
<a href="#" class="crm-hover-button action-item override-mem-type" id="show-mem-type">
{ts}Override organization and type{/ts}
</a>
{help id="override_membership_type"}
</span>
</td>
<td id="mem_type_id-editable"><span id='mem_type_id'>{$form.membership_type_id.html}</span>
{if $hasPriceSets}
<span id='totalAmountORPriceSet'> {ts}OR{/ts}</span>
<span id='selectPriceSet'>{$form.price_set_id.html}</span>
Expand Down Expand Up @@ -349,6 +361,25 @@
setDifferentContactBlock();
});

// give option to override membership type for auto-renew memberships - dev/core#1331
{/literal}
{if $isRecur}
cj('#membership_type_id_0-readonly').text(cj('#membership_type_id_0 option:selected').text());
cj('#membership_type_id_1-readonly').text(cj('#membership_type_id_1 option:selected').text());
cj('#mem_type_id-readonly').show();
cj('#mem_type_id-editable').hide();
{else}
cj('#mem_type_id-readonly').hide();
cj('#mem_type_id-editable').show();
{/if}
{literal}

cj('#show-mem-type').click( function( e ) {
e.preventDefault();
cj('#mem_type_id-readonly').hide();
cj('#mem_type_id-editable').show();
});

// give option to override end-date for auto-renew memberships
{/literal}
{if $isRecur && $endDate}
Expand Down
7 changes: 7 additions & 0 deletions templates/CRM/Member/Page/Tab.hlp
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@
{htxt id="override_end_date"}
<p>{ts}If CiviCRM's membership end-date is different from when the payment processor will next collect a payment, various problems can occur. Members may experience a gap in their membership, and the renewal date may get changed from what is manually entered. Use care when modifying the End Date value, and check the associated recurring payment in your payment processor system so they always match.{/ts}</p>
{/htxt}

{htxt id="override_membership_type-title"}
{ts}Override Membership Type for Auto-renew Memberships{/ts}
{/htxt}
{htxt id="override_membership_type"}
<p>{ts}This membership is set to renew automatically. Take care when you change the membership type. Make sure that you also change the related payment at the payment processor. Otherwise future payments may be for the wrong amount.{/ts}</p>
{/htxt}