systopia / de.systopia.eventmessages

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

Unexpected behaivor when more than one language provider is defined. #49

Open frank-systopia opened 5 months ago

frank-systopia commented 5 months ago

If you select more than one language provider, unexpected behavior may occur because the sources are processed differently than expected. Currently, the sources are not applied to all rules one after the other in the specified order, but one after the other for each rule.

Here is an example. Setup: First add a language provider compatible custom field to participant to save the chosen language on registering for an event. Second select "participant" followed by "contact" in the language provider select. Third define two rules involving the "Preferred Language" filter option. The first rule filter is set to "German" the second to "English".

Case: The participant sets the language on registration to "English" and is send to CiviCRM on submitting the registration form. Eventmessages now checks the first rule which filters for "German". It goes now through all provided sources of languages for this rule. So there will be no match for the language that comes with the registration which is "English". But as contact is also select in the language providers now the preferred language of the contact is checked and if that is set to "German" than the rule is met an the first email is send. The deliberate selection of the language during registration is therefore not taken into account.

Expected behavior: The expected behavior would be that with the language provided by the first selected option of the language providers select all rules will be checked and the email send accordingly. In the case that no match is made, the second option language is used to check all rules with it and send email accordingly.