FIX 16.0 - Notifications: configured e-mail templates not used if recipient is fixed e-mail address #29407
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue description
When you configure the notification module, e-mail notifications can be sent:
either to Users/Contacts (each user / contact can subscribe to specific notification types in the relevant tab of their User / Contact cards)
or to fixed e-mail addresses, configured directly in the admin page of the notification module
The admin page enables you to choose e-mail templates to use for specific notification types. When chosen, an e-mail template overrides the default message (based on translation keys).
The problem is that this override works for Users / Contacts (1) but not for fixed e-mail addresses (2), which always use a default message using hard-coded translation keys.
This PR
This fix is mostly a copy/paste of what is done for Users/Contacts into the portion of code that sends notifications to fixed e-mail addresses. So this adds duplicated code and thus could benefit from some refactoring in later Dolibarr versions.