Details
-
Type: Improvement
-
Status: In Quality Assurance
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: 4.7.19
-
Fix Version/s: None
-
Component/s: Extension System
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:Developer Doc
-
Funding Source:Contributed Code
-
Verified?:No
Description
In the course of an extension review, Allen Shaw and I were discussing the caveat in the README for his Percentage Price Field extension, which states that "for proper CiviDiscount support, this extension must be installed after CiviDiscount." The unstated reason for this is that CiviDiscount's hook should fire first so that the percentage price field bases its value off the discounted amount rather than the original amount.
Upon further discussion we realized that this workaround, while likely to work most of the time, is not guaranteed to work. MySQL queries without an explicit ORDER BY clause typically return results in the same order (oldest first), but there are no guarantees. Allen says he's looked at the relevant code and that CiviCRM is pulling a list of a extensions but not guaranteeing that the list is pulled in the same order each time.
While weighting extensions (à la Drupal) or moving to using events rather than hooks may provide more robustness, there is some very low hanging fruit to be had by jamming a few ORDER BY clauses in the right places.