Problem/Motivation

Currently commerce_discount_default_rules_configuration() creates rules names based on the machine name of the discount and the prefix commerce_discount_rule_.
This can lead to rules names that are too long to be stored in the machine name field.

Proposed resolution

Check to ensure the rules name is within the given limits.
Use a a hash to ensure uniqueness of the shortened name.

Remaining tasks

Reviews needed.

User interface changes

None.

API changes

None.
Only affects discounts that couldn't be saved until now.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

das-peter created an issue. See original summary.

joelpittet’s picture

Saw a weird bug about data type "Error: The data type of the configured argument does not match the parameter's entity requirement." while testing this out, it is likely not related could be an issue with rules, but otherwise this looks like a nice solution and thanks @das-peter.

I'll likely commit it unless someone else beats me to it. But want to resolve the rules bug first.

jantoine’s picture

das-peter to the rescue as seems to be always! This patch works great!

joelpittet’s picture

Status: Needs review » Fixed

Thank you committed and pushed to dev.

Status: Fixed » Closed (fixed)

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