Problem/Motivation
A bug has come to our attention: if a customer adds a license to their cart, the existing license will never expire and the customer's roles will not be revoked.
Steps to reproduce
- Create a new license for yourself.
Granting you a role or another.
In a rooling interval of 1 year.
Expiring some 20 days from now. - Activate the license.
Now find a product associated to the same license.
Add it to the cart.
The license from step 1 will go into renewal in progress. - Edit the license from step 1 to expire two days ago.
- Now execute:
drush eval "Drupal::service('commerce_license.cron')->run()"; drush advancedqueue:queue:process commerce_license;
Expected result: the license will expire and roles revoked.
Actual result: nothing happens, the user keep their roles.
That's because the license cannot transit from renewal_in_progress to expire, only from active to expire.
Which is strange, because LicenseExpire.php suggests it should allow such transition.
I would suggest updating the workflow to enable this transition.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3466297-2.patch | 1.38 KB | adinancenci |
Issue fork commerce_license-3466297
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
adinancenci commentedI hope what I did here makes sense.
Comment #3
adinancenci commentedAlternatively we could update LicenseExpire.php to activate the license before expiring it ...
Comment #4
joekersI've changed the priority to major as this issue allows users to prolong their license without renewing. Depending on the implementation, it would allow users to bypass paying for the renewal and/or retain user roles that they should no longer have.
Comment #5
hockey2112 commentedExperiencing the same issue.
Comment #6
qaiser iqbal commentedExperiencing the same issue.
Comment #7
zaporylieComment #9
zaporylieComment #10
zaporylieAdded test for it and reformatted the condition.
Comment #11
zaporylieComment #12
tbkot commentedComment #14
jsacksick commentedMerged, thank you!