Needs work
Project:
e-Commerce
Version:
6.x-4.x-dev
Component:
ec_product
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2009 at 12:11 UTC
Updated:
12 Jul 2010 at 13:15 UTC
Jump to comment: Most recent file
Comments
Comment #1
Soren Jones commentedThe issue seems to be with calling drupal_write_record from hook_enable (via ec_product_feature_save and ec_product_feature_enable). http://api.drupal.org/api/function/drupal_write_record/6#comment-2273
I've found two solutions that work.
1) Substitute db_query for lines 105 and 106 in ec_product_enable.
2) Add drupal_get_schema to ec_product_enable before line 105 (or somewhere in ec_product_feature_enable).
I don't know which is better (e.g., Is it risky to call drupal_get_schema from ec_product_enable if people are enabling multiple modules?).
Or if there is another "best" option.
Any thoughts?
Comment #2
xen commentedI'd go with db_query. It's the safe option.
Comment #3
Soren Jones commentedXen, Thank you. Attached for review.
Comment #4
xen commentedLooks good to me, but it's Gordon that got the final say.
Comment #5
gordon commentedI really don't like this esp. since if changes are made to ec_product_feature_enable() it is likely to break the initial install.
How because of your explanation I agree that inserting this directly is the safest option.
Just so this doesn't explanation doesn't get lost can you please add this a reference to this issue and the explantion to the in line documentation for ec_product_feature_enable() so if anything additional processing is added in future people should see it and replicate the code.
Also what would be even better is to add an assertion to one of the products tests to make sure that the tangible product has the shippable feature attached.
Thanks.
Powered by Dreditor.
Comment #6
Soren Jones commentedSo would it be best to get rid of ec_product_feature_enable() all together (remove it from ec_product) and use the direct insert in ec_product_update_5402() as well?
Will do on the reference and will take a shot at adding an assertion to one of product test.
Thanks for the feedback.