5

I am working on a website that has the option for members to pay for membership by direct debit (via GoCardless). This is working fine but occasionally we have an issue where a member pays by direct debit and also by card. We refund the card payment to the member but the membership end date is incorrect and we are unable to edit it.

The membership is annual so if a member signs up by both direct debit and card the two payments will add two years to the end date (e.g. it will be 2021 rather than 2020). So, after we refund the card payment we want to also edit the end date to change it to 2020. Unfortunately, we are unable to do this.

Normally, you can edit the end date, as shown below:

enter image description here

It appears that if the membership is set as auto-renew and linked to a recurring payment then CiviCRM doesn't allow you to edit the end date. I presume this is a deliberate 'feature' but in our case it is preventing us from correcting the end date.

enter image description here How can we edit the end date in these circumstances?

CiviCRM 5.7.6 on WordPress

2
  • I am having the same issue in CiviCRM 5.13.6 on Drupal. This field used to be editable (with an appropriate caution that would appear), but it was changed to be view-only. I wonder if there might be a simple code modification that could make it editable again? Commented Aug 19, 2019 at 19:45
  • 1
    Update: This has been reported as a bug at lab.civicrm.org/dev/core/issues/1126 - hopefully the restriction will be removed in coming updates. Commented Aug 20, 2019 at 17:24

4 Answers 4

4

I've raised this as issue #1126 in GitLab. From the discussion, it appears that this was implemented as a 'feature' in the past but it is unclear why this was necessary. Hopefully this issue will be resolved at some point in the future but this may take some time as we need to ensure that it won't cause a regression for existing users.

As a workaround in the meantime, this issue can be resolved by either by making some minor changes to a core file or creating an extension that undoes the core behaviour and makes the fields editable.

The relevant core file is CRM/Member/Form/Membership.php. The class in this file checks to see if the membership is related to a recurring contribution. If so, it prevents users from editing certain fields by freezing them. To prevent this behaviour you can simply search for and comment out the lines with 'freeze' in them.

These are the relevant lines:

  • line 217: $this->entityFields['end_date']['is_freeze'] = TRUE;
  • line 584: $sel->freeze();
  • line 611: $statusOverride->freeze();

Obviously, do some testing on a copy of your site before implementing this to make sure it doesn't cause any issues!

Update 19 October 2019

A fix has been merged into CiviCRM core (PR #15540) that fixes this issue for the end date field. This fix should be included in CiviCRM 5.20.

A separate issue (#1331) has been raised in Git Lab for the other fields that are also frozen (Membership Organisation, Membership Type, Membership Status).

Update 23 March 2020

A fix for the Membership Organisation, Membership Type and Membership Status has been merged into core (PR #16609). This fix should be included in CiviCRM 5.25

1
  • An extension would be an awesome contribution, thanks for this. I used the answer in my above post to change hundreds of them, this would have been much sleeker.
    – Zachary
    Commented Oct 8, 2019 at 19:14
2

An interesting workaround is you can make a profile that includes the membership end date for bulk updating memberships, then edit the membership end date there, and save. It won't throw an error. Not sure what the unintended consequences may be.

1

You can probably still change it via the API - specify the new end date on the existing membership, but that may have unintended consequences.

How did you do the refund? What status is the contribution? Maybe changing the end date should be part of the refund process.

3
  • Thanks Aidan. The card payments are made via SagePay and we make the refunds via SagePay. Unfortunately, this doesn't update CiviCRM directly so we need to edit the contribution and membership end date manually in CiviCRM. Commented Jun 27, 2019 at 13:36
  • The contribution status would be 'completed' before the money is refunded. Commented Jun 27, 2019 at 13:43
  • 1
    Using the API isn't ideal for us as it would be the membership team that do this and we don't really want to unleash them on the API! Commented Jun 27, 2019 at 13:44
0

If you disable auto-renew on the membership record, this will allow you to edit the end date. Once you have changed the end date, if you then enable auto-renew again.

2
  • Thanks for the suggestion but unfortunately this isn't possible. There isn't an option to cancel the auto-renew on the membership. Commented Jul 16, 2019 at 10:30
  • Even in cases where "Cancel auto-renew" does appear in the "Renew" menu, if one elects to cancel it, then there is no option to re-enable it again. user6930 can you clarify what you meant here? Commented Aug 20, 2019 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.