Closed (fixed)
Project:
Commerce File
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Aug 2011 at 16:55 UTC
Updated:
1 Sep 2011 at 02:11 UTC
When trying to delete an order that has line items that point to products with commerce_file fields I get:
Error message
EntityMetadataWrapperException: Unable to load the commerce_order with the id 4792. in EntityDrupalWrapper->value() (line 697 of /home/rfay/workspace/commerce/sites/all/modules/entity/includes/entity.wrapper.inc). Backtrace:
EntityDrupalWrapper->value() entity.wrapper.inc:647
EntityDrupalWrapper->spotBundleInfo(1) entity.wrapper.inc:633
EntityDrupalWrapper->spotInfo() entity.wrapper.inc:323
EntityStructureWrapper->getPropertyInfo('owner') entity.wrapper.inc:385
EntityStructureWrapper->get('owner') entity.wrapper.inc:406
EntityStructureWrapper->__get('owner') commerce_file.entities.inc:895
commerce_file_license_revoke_line_item(Object) commerce_file.entities.inc:878
commerce_file_license_revoke_order(Object) commerce_file.module:689
commerce_file_commerce_order_delete(Object)
call_user_func_array('commerce_file_commerce_order_delete', Array) rules.module:739
rules_invoke_all('commerce_order_delete', Object) commerce.controller.inc:26
DrupalCommerceEntityController->invoke('delete', Object) commerce.controller.inc:73
DrupalCommerceEntityController->delete(Array) commerce_order.module:658
commerce_order_delete_multiple(Array) commerce_order.module:645
commerce_order_delete('4792') commerce_order.forms.inc:338
commerce_order_order_delete_form_submit(Array, Array) form.inc:1389
form_execute_handlers('submit', Array, Array) form.inc:829
drupal_process_form('commerce_order_ui_order_delete_form', Array, Array) form.inc:349
drupal_build_form('commerce_order_ui_order_delete_form', Array) form.inc:187
drupal_get_form('commerce_order_ui_order_delete_form', Object) commerce_order_ui.orders.inc:67
commerce_order_ui_order_delete_form_wrapper(Object)
call_user_func_array('commerce_order_ui_order_delete_form_wrapper', Array) menu.inc:503
menu_execute_active_handler() index.php:21
The order and related line items seem to be just fine.
Comments
Comment #1
recrit commentedI have updated commerce_file_license_revoke_line_item() to resolve the order owner from the order object if it is passed to in. Previously it was getting the order from the line item object since this function is also used in line item deletion. Since on order delete the order is deleted already, it cannot be loaded from the order id anymore.
Please test and report back.
http://drupalcode.org/project/commerce_file.git/commitdiff/82cb613
Comment #2
rfayI recovered from this using the technique in #1135182-16: Error message EntityMetadataWrapperException: Unable to load the commerce_product with the id 5053. in EntityDrupalWrapper->valu.
I'll load the bad database and test.
Comment #3
rfayI was able to delete orders that were completed, but orders that are pending still give
Comment #4
recrit commentedThis new error is cause by hook line item delete being called first, so then on hook order delete, the line item cannot be loaded anymore. Since the only information guaranteed to be there about the line item is line_item_id, I have updated the revoke function to accept an id also.
http://drupalcode.org/project/commerce_file.git/commitdiff/211dbe5
Comment #5
recrit commented