After discussing with rszrama, the conclusion was that we don't need a whole entity structure for keeping coupon-order information, it's painful to maintain and update.
A multiple coupon reference field or an entity reference field attached to the order entity would be enough, so we can have the coupons, no matter the type associated with the order at any time.

Also, for listing the coupons applied to the order, we can build a views handler to get the price component related with the coupon for displaying a coupon->discount relationship.

Comments

pcambra’s picture

Status: Active » Fixed

This is a huge commit.

* Revamped all coupon log feature into a entity reference field in the order entity so we don't have log as a separate entity.
* Removed all coupon log traces.
* Removed coupon reference field in favor of entity reference.
* Provided a component name for price components as a property of the coupon entity.
* Fixed all rules accordingly.
* Moved coupon calculation logic from line_item_refresh to a rule that can be configured
* Provided rules for deleting coupons individually and in mass.
* Code cleaning.
* Probably more but can't remember.

Testing is really appreciated.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.