Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom email templates lost upon changing language configuration #7098

Closed
asmecher opened this issue Jun 1, 2021 · 6 comments
Closed

Custom email templates lost upon changing language configuration #7098

asmecher opened this issue Jun 1, 2021 · 6 comments
Labels
Bug:1:Low A bug that does not have a severe consequence or affects a small number of users. Community:2:Priority Any issue that has been identified through research or feedback as a major community priority.

Comments

@asmecher
Copy link
Member

asmecher commented Jun 1, 2021

From https://forum.pkp.sfu.ca/t/records-in-email-templates-settings-are-deleted-when-enabling-forms-language-in-any-journal/68053 and https://forum.pkp.sfu.ca/t/ojs-3-2-1-1-email-templates-were-restored-to-default:

I have found the email templates in OJS 3.2.1-1 dissapear immediatly after enabling one language on Website Settings → Setup → Language in the column “Forms”, at that moment all the personalized templates in that language on email_templates_settings are deleted (from all journals in the installation).

It appears that the email templates are removed when a locale is enabled (under "Forms" but probably elsewhere). This is happening due to...

  1. LanguageGridHandler::saveLanguageSetting calls PKPContextService::restoreLocaleDefaults (this call is context specific; see also another similar call a few lines later)
  2. PKPContextService::restoreLocaleDefaults then calls PKPLocale::reloadLocale, which axes email templates for all contexts (!)
@asmecher asmecher added this to the OJS/OMP/OPS 3.3.0-7 milestone Jun 1, 2021
@asmecher asmecher added Bug:1:Low A bug that does not have a severe consequence or affects a small number of users. Community:2:Priority Any issue that has been identified through research or feedback as a major community priority. labels Jun 1, 2021
@asmecher
Copy link
Member Author

Applying this change in lib/pkp will prevent language resets in one journal from affecting templates site-wide: 421ed84

@ajnyga
Copy link
Collaborator

ajnyga commented Jun 22, 2021

Any chance this can be ported for 3.2 as well?

@asmecher
Copy link
Member Author

@ajnyga, 421ed84 will apply directly to 3.2.x releases as well, but we're unlikely to release any more 3.2.x .tar.gz packages. Or are you working from the stable-3_2_0 git branch and need that updated?

@jmvezic
Copy link

jmvezic commented Apr 1, 2022

@asmecher Can this fix safely be applied to 3.2.1-4 manually? We're going to upgrade to 3.3 soon but this is an important fix to have until then.

Edit: as far as I can tell, the only difference is

        static function reloadLocale($locale) {

instead of

        public static function reloadLocale($locale) {

@asmecher
Copy link
Member Author

asmecher commented Apr 1, 2022

@jmvezic, the relevant change is a different one -- 421ed84 -- and should apply to 3.2.1-4 cleanly.

@ajnyga
Copy link
Collaborator

ajnyga commented Sep 21, 2023

Just leaving a note here that this same bug caused a situtation where reloading a locale in one context erased Component/Genre labels from all contexts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug:1:Low A bug that does not have a severe consequence or affects a small number of users. Community:2:Priority Any issue that has been identified through research or feedback as a major community priority.
Projects
None yet
Development

No branches or pull requests

3 participants