systopia / de.systopia.eventmessages

CiviCRM Custom Event Communication Extension
Other
4 stars 6 forks source link

adjust multi-language rule selection #50

Open bjendres opened 5 months ago

bjendres commented 5 months ago

IMHO the algorithm to select the rule to be executed in a multi-language scenario should be as follows:

  1. the language providers return an ordered list of languages, which represent the priority in which they are chosen
  2. the last element of this element is always empty, which only matches rules that have no language set
  3. the algorithm iterates through the list from 1, checking every rule in the order displayed to the user in the following way:
    1. previous registration status of the participant matches the previous registration status of the rule. An empty value in the rule means is considered a match.
    2. new registration status of the participant matches the new registration status of the rule. An empty value in the rule means is considered a match.
    3. language - empty field in the rule is only considered match of the language delivered by the language providers (on the submission) also return an empty value.

If all three items match, the rule as a whole matches, i.e. the email is sent, and the processing terminates.

Additionally, this should ensure that people upgrading from an older version should not see any change in behaviour.

Internal reference: 22014#note-49

bjendres commented 5 months ago

See also #49