Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
commerce_discount-avoid-oversized-rules-names.patch | 905 bytes | das-peter | |
Comments
Comment #2
joelpittetSaw 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.
Comment #3
jantoine CreditAttribution: jantoine as a volunteer commenteddas-peter to the rescue as seems to be always! This patch works great!
Comment #4
joelpittetThank you committed and pushed to dev.