Skip to content

Commit

Permalink
pkp#9518 Try to install missing template before throwing an error (pk…
Browse files Browse the repository at this point in the history
…p#9532)

* pkp#9518 Try to install missing template before throwing an error

* pkp#9518 Stop the script if alternateTo template is missing
  • Loading branch information
Vitaliy-1 authored Feb 23, 2024
1 parent 7a0db7c commit deebe32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion classes/emailTemplate/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,11 @@ public function installAlternateEmailTemplates(int $contextId, ?string $emailKey
->exists();

if (!$exists) {
throw new Exception('Tried to install email template as an alternate to `' . $alternateTo . '`, but no default template exists with this key.');
trigger_error(
'Tried to install email template as an alternate to `' . $alternateTo . '`, but no default template exists with this key. Installing ' . $alternateTo . ' email template first',
E_USER_WARNING
);
$this->installEmailTemplates(Repo::emailTemplate()->dao->getMainEmailTemplatesFilename(), [], $alternateTo);
}

DB::table($this->table)->insert([
Expand Down

0 comments on commit deebe32

Please sign in to comment.