From the recurring entities admin UI, deleting an entity results in the message:

Commerce recurring entity could not be deleted.

This appears regardless of whether or not the entity was actually deleted.

Comments

pcambra’s picture

Status: Active » Closed (duplicate)

Yeah, this one was already there ;)
#1974664: Review the delete recurring entity process

veso_83’s picture

Issue summary: View changes
Status: Closed (duplicate) » Active
StatusFileSize
new11.72 KB
new1.03 KB

This is slightly different issue, the message for unsuccessful deletion appears because entity->delete() function will not return anything on success, just empty result!
See: http://drupalcontrib.org/api/drupal/contributions%21entity%21includes%21...
That’s why to avoid that error message the code needs to be reshuffled. A patch is attached

pcambra’s picture

Status: Active » Needs review
geertvd’s picture

Status: Needs review » Reviewed & tested by the community

Bumped into the same issue, this patch fixes it.

pcambra’s picture

Cool, thanks. We need a test and we're good to go.

geertvd’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new12.07 KB
new13.1 KB

I created a new commerce_recurring_ui.test file but wanted to use some of the helper functions in commerce_recurring.test so I moved those to a new file commerce_recurring_base.test.

Lot's of moving around for such a small test, I hope this is not out of scope for this.

edit: forgot to add a new line to the commerce_recurring_ui.info file, I guess this can be fixed on commit if this is green.

webadpro’s picture

Patch in #2 fixed it for me.

heddn’s picture

Status: Needs review » Needs work

Instead of calling $entity->delete and checking status, we need to check if the entity still exists. Calling entity_delete or $entity->delete() will always return nothing of value.

g33kg1rl’s picture

Never mind, unrelated issue.

sgdev’s picture

Status: Needs work » Needs review
StatusFileSize
new1.37 KB

Per @heddn's feedback, here is an updated patch that checks for the existence of the recurring entity after it has been deleted.

Please review, thanks.

deggertsen’s picture

This looks good to me. Thanks ron_s, this looks like the best solution.