diff --git a/application/Espo/Resources/i18n/en_US/EmailTemplate.json b/application/Espo/Resources/i18n/en_US/EmailTemplate.json index 6cd44b9eb9..05e25115ba 100644 --- a/application/Espo/Resources/i18n/en_US/EmailTemplate.json +++ b/application/Espo/Resources/i18n/en_US/EmailTemplate.json @@ -29,6 +29,7 @@ "placeholderTexts": { "today": "Today's date", "now": "Current date & time", + "currentYear": "Current Year", "optOutUrl": "URL for an unsubsbribe link", "optOutLink": "an unsubscribe link" } diff --git a/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json b/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json index dcde024af5..5a1d7cd5ac 100644 --- a/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json +++ b/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json @@ -43,6 +43,6 @@ "filterList": [ "actual" ], - "placeholderList": ["today", "now", "optOutUrl", "optOutLink"], + "placeholderList": ["today", "now", "currentYear", "optOutUrl", "optOutLink"], "iconClass": "fas fa-envelope-square" } diff --git a/application/Espo/Services/EmailTemplate.php b/application/Espo/Services/EmailTemplate.php index 41a557d750..d5227bc2d1 100644 --- a/application/Espo/Services/EmailTemplate.php +++ b/application/Espo/Services/EmailTemplate.php @@ -276,6 +276,11 @@ class EmailTemplate extends Record $replaceData['today'] = $this->getDateTime()->getTodayString(); $replaceData['now'] = $this->getDateTime()->getNowString(); + $timeZone = $this->getConfig()->get('timeZone'); + $now = new \DateTime('now', new \DateTimezone($timeZone)); + + $replaceData['currentYear'] = $now->format('Y'); + foreach ($replaceData as $key => $value) { $text = str_replace('{' . $key . '}', $value, $text); }