Inconsistent behaviour when paying/completing a pending contribution with linked membership
Overview
CiviCRM has inconsistent behaviour when completing a pending contribution with linked pending membership either by a) completing the contribution or b) recording a payment.
This applies to both a "new/pending" membership or when renewing an expired membership.
Reproduction steps
Scenario 1: New membership
Create a membership with start date 1/1/2019 and term 1 year. Set the membership status to anything. Set the contribution status to pending. Save
Scenario 1.1: Record payment
If you completed the payment using “Record Payment” and no matter what you set the receive date to during completing the payment the end date and the start date will remain the same (start date = 1/1/2019 , end date = 31/12/2019).
Scenario 1.2: “Edit Contribution -> change status to completed"
While completing the payment using “Edit Contribution -> change status to completed” will result in changing the membership start date to equal the contribution receive date and the end date to be 1 term away from the receive date, so if you set the receive date for example to 1/3/2019 then the start date will become 1/3/2019 and the end date 29/2/2020
Scenario 2. Renew membership that has expired (end date in the past)
Create a membership with start date 1/1/2018 and term 1 year. Set the membership status to anything. It will be created as an expired membership. Set the contribution status to completed. Save
Scenario 2.1: Record payment
If you complete the renewal pending payment using “Record Payment” option, then no matter what you set the payment receive date to, the start date will change to “today's date” and the end date will be one 1 term after the start date
Scenario 2.2: “Edit Contribution -> change status to completed"
If you complete the payment with “edit contribution -> change status to completed” then also here Civi ignores the the receive date and it will always set the start date to “today's date” and the end date to 1 term after the start date.
Expected behaviour
Well, they should at least be consistent... but perhaps this is our opportunity to make CiviCRM less opaque and give users control over how the system should work?
Scenario no | Situation | Recording payment approach | Current behaviour | Suggested behaviour |
---|---|---|---|---|
1.1 | New | Record payment | Start date will remain as before | Message 1 below |
1.2 | New | Edit Contribution -> change status to completed | Changes the membership start date to equal the contribution receive date | Message 1 below |
2.1 | Renew expired | Record payment | The start date will change to “today's date” and the end date will be one 1 term after the start date | Message 2 below |
2.2 | Renew expired | Edit Contribution -> change status to completed | Set the start date to “today's date” and the end date to 1 term after the start date. | Message 2 below |
Message 1:
Show a message / popup to tell ask the user "The membership payment has been made in full, but the membership's start date is different to the payment date. Would you like to set the membership start date to the payment date?
- Option 1: Yes - Set Membership Start Date to the payment date (Show the proposed start date if using the payment date) This would be the date of the last payment if recording the payment OR the contribution received date if completing the contribution by changing the status.
- Option 2: No - Do not change the membership start date (Show the existing start date)
Message 2:
Show a message / popup to tell ask the user "The membership payment has been made in full. Please select a start date:
- Option 1: Set Membership Start Date to the previous membership term end date
- Option 2: Set Membership Start Date to the payment date (Show the proposed start date if using the payment date) This would be the date of the last payment if recording the payment OR the contribution received date if completing the contribution by changing the status.
- Option 3: Create a new membership line with Membership start date on the payment date (Show the proposed start date if using the payment date) This would be the date of the last payment if recording the payment OR the contribution received date if completing the contribution by changing the status.
In future we could allow admin to have a setting to set the defaults and hide the message to define the behaviour.
Environment information
- CiviCRM: _Master/5.21 etc
Comments
This isn't the place for the long discussion about it but just to reiterate that I think the contribution "received" date field needs the label changed to be something more generic like "contribution date" as the field is used as the invoice date when generating an invoice (and cannot mean received date when the contribution is pending...). It also leads to inconsistencies with the above - the date of the last payment could be different from the contribution received date which is a meaningless statement. We should decouple "payment" from the order or invoice object (the contribution) and make the payments mean what they mean - when we got the payment - and the order/invoice mean what is means - when the contact entered into the obligation to pay from an accounting perspective.
Oh well seems I started a discussion on that here: #1403 (comment 27422) and a decision on how the above should work should be done once the contribution date field usage is confirmed.