Repository: urlaubsverwaltung/urlaubsverwaltung (java)

Issue:
Hinweis auf Verfall von Urlaub ergänzen

**Mail am 01.01**
Aktuell haben wir zwar die Information drin, bis wann der Urlaub genommen werden soll (`account_cron_remind_remaining_vacation_days.txt`), allerdings nicht explizit formuliert, dass er bis XX.XX.XXXX verfällt.


**Mail im Oktober**
Ggf. könnte man den Hinweis auf Verfall in die Oktober Mail packen (`account_cron_currently_left_vacation_days.txt`), oder aber jedem Mitarbeiter zum Jahresbeginn die Information zukommen lassen. 

> Nach dem BAG-Urteil aus 2019 können Arbeitgeber ihre Hinweispflicht vergleichbar einfach erfüllen. Danach reicht ein Hinweis jeweils zu Jahresbeginn aus, welcher Urlaubsanspruch für das neue Jahr entstanden ist und dass der Arbeitnehmer diesen bis Jahresende nehmen soll, damit er nicht verfällt.

https://www.juraforum.de/news/arbeitgeber-muessen-resturlaub-gegebenenfalls-ueber-jahre-nachzahlen_258516

Pull request description:
Add expiry date in new years mail with the information about remaining vacation days
closes #3571

<!--

Thanks for contributing to the Urlaubsverwaltung.
Please review the following notes before submitting you pull request.

Please look for other issues or pull requests which already work on this topic. Is somebody already on it? Do you need to synchronize?

# Security Vulnerabilities

🛑 STOP! 🛑 If your contribution fixes a security vulnerability, please do not submit it.
Instead, please open a report of a security vulnerability via
[Report a security vulnerability](https://github.com/urlaubsverwaltung/urlaubsverwaltung/security/advisories/new)


# Describing Your Changes

If, having reviewed the notes above, you're ready to submit your pull request, please
provide a brief description of the proposed changes.

If they:
 🐞 fix a bug, please describe the broken behaviour and how the changes fix it.
    Please label with 'type: bug' and 'status: new'
    
 🎁 make an enhancement, please describe the new functionality and why you believe it's useful.
    Please label with 'type: enhancement' and 'status: new'
 
If your pull request relates to any existing issues,
please reference them by using the issue number prefixed with #.

-->


Patch:
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterConfiguration.java b/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterConfiguration.java
index 08a6cab49..3f69c1d99 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterConfiguration.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterConfiguration.java
@@ -18,7 +18,10 @@ class TurnOfTheYearAccountUpdaterConfiguration implements SchedulingConfigurer {
     private final TaskScheduler taskScheduler;
 
     @Autowired
-    TurnOfTheYearAccountUpdaterConfiguration(AccountProperties accountProperties, TurnOfTheYearAccountUpdaterService turnOfTheYearAccountUpdaterService, ScheduleLocking scheduleLocking, TaskScheduler taskScheduler) {
+    TurnOfTheYearAccountUpdaterConfiguration(
+        AccountProperties accountProperties, TurnOfTheYearAccountUpdaterService turnOfTheYearAccountUpdaterService,
+        ScheduleLocking scheduleLocking, TaskScheduler taskScheduler
+    ) {
         this.accountProperties = accountProperties;
         this.turnOfTheYearAccountUpdaterService = turnOfTheYearAccountUpdaterService;
         this.scheduleLocking = scheduleLocking;
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterService.java b/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterService.java
index bf8999648..c5cf77630 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterService.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/account/TurnOfTheYearAccountUpdaterService.java
@@ -21,7 +21,6 @@ import static java.lang.invoke.MethodHandles.lookup;
 import static org.slf4j.LoggerFactory.getLogger;
 import static org.synyx.urlaubsverwaltung.person.Role.OFFICE;
 
-
 /**
  * Is to be scheduled every turn of the year: calculates the remaining vacation days for the new year.
  */
@@ -38,8 +37,12 @@ public class TurnOfTheYearAccountUpdaterService {
     private final Clock clock;
 
     @Autowired
-    TurnOfTheYearAccountUpdaterService(PersonService personService, AccountService accountService,
-                                       AccountInteractionService accountInteractionService, VacationDaysReminderService vacationDaysReminderService, MailService mailService, Clock clock) {
+    TurnOfTheYearAccountUpdaterService(
+        PersonService personService, AccountService accountService,
+        AccountInteractionService accountInteractionService,
+        VacationDaysReminderService vacationDaysReminderService,
+        MailService mailService, Clock clock
+    ) {
         this.personService = personService;
         this.accountService = accountService;
         this.accountInteractionService = accountInteractionService;
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderConfiguration.java b/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderConfiguration.java
index c61942d89..4ba38f5f8 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderConfiguration.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderConfiguration.java
@@ -18,7 +18,10 @@ class VacationDaysReminderConfiguration implements SchedulingConfigurer {
     private final TaskScheduler taskScheduler;
 
     @Autowired
-    VacationDaysReminderConfiguration(AccountProperties accountProperties, VacationDaysReminderService vacationDaysReminderService, ScheduleLocking scheduleLocking, TaskScheduler taskScheduler) {
+    VacationDaysReminderConfiguration(
+        AccountProperties accountProperties, VacationDaysReminderService vacationDaysReminderService,
+        ScheduleLocking scheduleLocking, TaskScheduler taskScheduler
+    ) {
         this.accountProperties = accountProperties;
         this.vacationDaysReminderService = vacationDaysReminderService;
         this.scheduleLocking = scheduleLocking;
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderService.java b/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderService.java
index a3ccc345b..ebea6a1cd 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderService.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderService.java
@@ -15,6 +15,7 @@ import java.time.Year;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 
 import static java.lang.invoke.MethodHandles.lookup;
 import static java.math.BigDecimal.ZERO;
@@ -32,8 +33,10 @@ public class VacationDaysReminderService {
     private final Clock clock;
 
     @Autowired
-    VacationDaysReminderService(PersonService personService, AccountService accountService, VacationDaysService vacationDaysService,
-                                MailService mailService, Clock clock) {
+    VacationDaysReminderService(
+        PersonService personService, AccountService accountService, VacationDaysService vacationDaysService,
+        MailService mailService, Clock clock
+    ) {
         this.personService = personService;
         this.accountService = accountService;
         this.vacationDaysService = vacationDaysService;
@@ -43,18 +46,25 @@ public class VacationDaysReminderService {
 
     /**
      * Reminds for vacation days left for <b>current year</b>.
+     * This mail will be sent by default in october
      */
     public void remindForCurrentlyLeftVacationDays() {
         final Year year = Year.now(clock);
+        final Year nextYear = year.plusYears(1);
         final List<Person> persons = personService.getActivePersons();
 
-        accountService.getHolidaysAccount(year.getValue(), persons).stream()
-            .filter(Account::doRemainingVacationDaysExpire)
-            .forEach(account -> {
-                final BigDecimal vacationDaysLeft = vacationDaysService.getTotalLeftVacationDays(account);
+        accountService.getHolidaysAccount(year.getValue(), persons)
+            .forEach(holidayAccountThisYear -> {
+                final BigDecimal vacationDaysLeft = vacationDaysService.getTotalLeftVacationDays(holidayAccountThisYear);
                 if (vacationDaysLeft.compareTo(ZERO) > 0) {
-                    sendReminderForCurrentlyLeftVacationDays(account.getPerson(), vacationDaysLeft, year.plusYears(1));
-                    LOG.info("Reminded person with id {} for {} currently left vacation days", account.getPerson().getId(), vacationDaysLeft);
+
+                    final Optional<Account> holidaysAccountsNextYear = accountService.getHolidaysAccount(nextYear.getValue(), holidayAccountThisYear.getPerson());
+                    final Account holidayAccountNextWithFallbackThisYear = holidaysAccountsNextYear.orElse(holidayAccountThisYear);
+                    if (holidayAccountNextWithFallbackThisYear.doRemainingVacationDaysExpire()) {
+                        final LocalDate expiryDate = holidayAccountNextWithFallbackThisYear.getExpiryDate().withYear(nextYear.getValue());
+                        sendReminderForCurrentlyLeftVacationDays(holidayAccountNextWithFallbackThisYear.getPerson(), vacationDaysLeft, expiryDate);
+                        LOG.info("Reminded person with id {} for {} currently left vacation days", holidayAccountNextWithFallbackThisYear.getPerson().getId(), vacationDaysLeft);
+                    }
                 }
             });
     }
@@ -86,7 +96,7 @@ public class VacationDaysReminderService {
                         .subtract(vacationDaysLeft.getRemainingVacationDaysNotExpiring());
 
                     if (remainingVacationDaysLeft.compareTo(ZERO) > 0) {
-                        sendReminderForRemainingVacationDaysNotification(account.getPerson(), remainingVacationDaysLeft, account.getExpiryDate().minusDays(1));
+                        sendReminderForRemainingVacationDaysNotification(account.getPerson(), remainingVacationDaysLeft, account.getExpiryDate().minusDays(1), account.getExpiryDate());
                         LOG.info("Reminded person with id {} for {} remaining vacation days in year {}.", account.getPerson().getId(), remainingVacationDaysLeft, year);
                     }
                 });
@@ -134,18 +144,19 @@ public class VacationDaysReminderService {
         }
     }
 
-    private void sendReminderForCurrentlyLeftVacationDays(Person person, BigDecimal vacationDaysLeft, Year nextYear) {
+    private void sendReminderForCurrentlyLeftVacationDays(Person person, BigDecimal vacationDaysLeft, LocalDate expiryDateNextYear) {
         final Map<String, Object> model = new HashMap<>();
         model.put("vacationDaysLeft", vacationDaysLeft);
-        model.put("nextYear", nextYear.getValue());
+        model.put("expiryDateNextYear", expiryDateNextYear);
 
         sendMail(person, "subject.account.remindForCurrentlyLeftVacationDays", "account_cron_currently_left_vacation_days", model);
     }
 
-    private void sendReminderForRemainingVacationDaysNotification(Person person, BigDecimal remainingVacationDays, LocalDate dayBeforeExpiryDate) {
+    private void sendReminderForRemainingVacationDaysNotification(Person person, BigDecimal remainingVacationDays, LocalDate dayBeforeExpiryDate, LocalDate expiryDate) {
         final Map<String, Object> model = new HashMap<>();
         model.put("remainingVacationDays", remainingVacationDays);
         model.put("dayBeforeExpiryDate", dayBeforeExpiryDate);
+        model.put("expiryDate", expiryDate);
 
         sendMail(person, "subject.account.remindForRemainingVacationDays", "account_cron_remind_remaining_vacation_days", model);
     }
diff --git a/src/main/resources/MailMessages_de.properties b/src/main/resources/MailMessages_de.properties
index 1c1be2af7..93195b900 100644
--- a/src/main/resources/MailMessages_de.properties
+++ b/src/main/resources/MailMessages_de.properties
@@ -30,11 +30,11 @@ application.data.sicknotetype.sicknotechild=Kind-Krankmeldung
 account.vacation_entitlement.information=Mehr Informationen zu deinem Urlaubsanspruch findest du hier:
 account.remaining_vacation_days=Resturlaubstage zum {0} (mitgenommene Resturlaubstage aus dem Vorjahr)
 account.remaining_vacation_days.last_year=Gesamtzahl an Resturlaubstagen aus dem Vorjahr:
-account.remaining_vacation_days.last_year.use_until=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Resturlaub aus dem Vorjahr, bitte denke daran den Urlaub bis zum {1} zu nehmen.
+account.remaining_vacation_days.last_year.use_until=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Resturlaub aus dem Vorjahr. Bitte plane deinen Resturlaub rechtzeitig, da dieser bis zum {1} genommen werden muss und am {2} verfällt.
 account.remaining_vacation_days.expired=leider ist dein Resturlaub zum {0} in Höhe von {1, choice, 0#{1} Tage|1#1 Tag|1.5#{1} Tagen} verfallen.
 account.remaining_vacation_days.expired.vacation=Dein aktueller Urlaubsanspruch:
 account.remaining_vacation_days.expired.not_expiring=Resturlaub, der nicht am {0} verfallen ist:
-account.vacation_days.this_year=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Urlaub für dieses Jahr offen, bitte denke daran, deinen Urlaub zu planen.
+account.vacation_days.this_year=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Urlaub für dieses Jahr offen. Bitte denke daran, deinen Urlaub rechtzeitig zu planen, da der nicht genommenen Resturlaub im kommenden Jahr am {1} verfällt.
 
 subject.account.updatedRemainingDays=Auswertung Resturlaubstage
 subject.account.remindForCurrentlyLeftVacationDays=Erinnerung an offenen Urlaubsanspruch
diff --git a/src/main/resources/MailMessages_de_AT.properties b/src/main/resources/MailMessages_de_AT.properties
index c22c70a59..034d3d4ee 100644
--- a/src/main/resources/MailMessages_de_AT.properties
+++ b/src/main/resources/MailMessages_de_AT.properties
@@ -30,11 +30,11 @@ application.data.sicknotetype.sicknotechild=Kind-Krankmeldung
 account.vacation_entitlement.information=Mehr Informationen zu deinem Urlaubsanspruch findest du hier:
 account.remaining_vacation_days=Resturlaubstage zum {0} (mitgenommene Resturlaubstage aus dem Vorjahr)
 account.remaining_vacation_days.last_year=Gesamtzahl an Resturlaubstagen aus dem Vorjahr:
-account.remaining_vacation_days.last_year.use_until=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Resturlaub aus dem Vorjahr, bitte denke daran den Urlaub bis zum {1} zu nehmen.
+account.remaining_vacation_days.last_year.use_until=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Resturlaub aus dem Vorjahr. Bitte plane deinen Resturlaub rechtzeitig, da dieser bis zum {1} genommen werden muss und am {2} verfällt.
 account.remaining_vacation_days.expired=leider ist dein Resturlaub zum {0} in Höhe von {1, choice, 0#{1} Tage|1#1 Tag|1.5#{1} Tagen} verfallen.
 account.remaining_vacation_days.expired.vacation=Dein aktueller Urlaubsanspruch:
 account.remaining_vacation_days.expired.not_expiring=Resturlaub, der nicht am {0} verfallen ist:
-account.vacation_days.this_year=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Urlaub für dieses Jahr offen, bitte denke daran, deinen Urlaub zu planen.
+account.vacation_days.this_year=Du hast noch {0, choice, 0#{0} Tage|1#1 Tag|1.5#{0} Tage} Urlaub für dieses Jahr offen. Bitte denke daran, deinen Urlaub rechtzeitig zu planen, da der nicht genommenen Resturlaub im kommenden Jahr am {1} verfällt.
 
 subject.account.updatedRemainingDays=Auswertung Resturlaubstage
 subject.account.remindForCurrentlyLeftVacationDays=Erinnerung an offenen Urlaubsanspruch
diff --git a/src/main/resources/MailMessages_el.properties b/src/main/resources/MailMessages_el.properties
index 53d4d4311..8fd627eb7 100644
--- a/src/main/resources/MailMessages_el.properties
+++ b/src/main/resources/MailMessages_el.properties
@@ -30,11 +30,11 @@ application.data.sicknotetype.sicknotechild=Χαρτί άρρωστου παιδ
 account.vacation_entitlement.information=Μπορείτε να βρείτε περισσότερες πληροφορίες σχετικά με το δικαίωμα διακοπών σας εδώ:
 account.remaining_vacation_days=Υπολειπόμενες ημέρες άδειας την {0} (υπολειπόμενες ημέρες άδειας που λήφθηκαν από το προηγούμενο έτος)
 account.remaining_vacation_days.last_year=Συνολικός αριθμός ημερών άδειας που απομένουν από το προηγούμενο έτος:
-account.remaining_vacation_days.last_year.use_until=Έχετε {0, choice, 0#{0} ημέρες|1#1 ημέρα|1.5#{0} ημέρες} υπόλοιπο άδειας από το προηγούμενο έτος, θυμηθείτε να πάρετε την άδεια μέχρι την {1}.
+account.remaining_vacation_days.last_year.use_until=account.remaining_vacation_days.last_year.use_until=Σου απομένουν {0, choice, 0#{0} υπόλοιπες ημέρες άδειας|1#1 υπόλοιπη ημέρα άδειας|1.5#{0} υπόλοιπες ημέρες άδειας} από το προηγούμενο έτος. Παρακαλώ προγραμμάτισε την υπόλοιπη άδειά σου εγκαίρως, καθώς πρέπει να χρησιμοποιηθεί έως τις {1} και θα λήξει στις {2}.
 account.remaining_vacation_days.expired=Δυστυχώς, η υπόλοιπη άδεια σας από {0} έχει λήξει στο ποσό των {1, choice, 0#{1} ημέρες|1#1 ημέρα|1.5#{1} ημέρες}.
 account.remaining_vacation_days.expired.vacation=Το τρέχον δικαίωμά σας για διακοπές:
 account.remaining_vacation_days.expired.not_expiring=Υπόλοιπη άδεια που δεν έχει λήξει στις {0}:
-account.vacation_days.this_year=Έχετε ακόμα {0, choice, 0#{0} ημέρες|1#1 ημέρα|1.5#{0} ημέρες} διακοπές ανοιχτές για φέτος, θυμηθείτε να προγραμματίσετε τις διακοπές σας.
+account.vacation_days.this_year=Σου απομένουν {0, choice, 0#{0} ημέρες|1#1 ημέρα|1.5#{0} ημέρες} άδειας για φέτος. Παρακαλώ θυμήσου να προγραμματίσεις την άδειά σου εγκαίρως, καθώς η μη χρησιμοποιημένη υπόλοιπη άδεια θα λήξει στις {1} το επόμενο έτος.
 
 subject.account.updatedRemainingDays=Αξιολόγηση των ενημερωμένων υπόλοιπων ημερών
 subject.account.remindForCurrentlyLeftVacationDays=Υπενθύμιση του δικαιώματος ανοικτής άδειας
diff --git a/src/main/resources/MailMessages_en.properties b/src/main/resources/MailMessages_en.properties
index 2352b639e..fbe9375ef 100644
--- a/src/main/resources/MailMessages_en.properties
+++ b/src/main/resources/MailMessages_en.properties
@@ -30,11 +30,11 @@ application.data.sicknotetype.sicknotechild=Child sick note
 account.vacation_entitlement.information=You can find more information about your holiday entitlement here:
 account.remaining_vacation_days=Remaining leave days as of {0} (remaining leave days taken from the previous year)
 account.remaining_vacation_days.last_year=Total number of remaining leave days from the previous year:
-account.remaining_vacation_days.last_year.use_until=You have {0, choice, 0#{0} days|1#1 day|1.5#{0} days} remaining leave from the previous year, please remember to take the leave by {1}.
+account.remaining_vacation_days.last_year.use_until=account.remaining_vacation_days.last_year.use_until=You still have {0, choice, 0#{0} remaining vacation days|1#1 remaining vacation day|1.5#{0} remaining vacation days} from the previous year. Please plan your remaining leave in time, as it must be used by {1} and will expire on {2}.
 account.remaining_vacation_days.expired=Unfortunately, your remaining leave as of {0} has expired in the amount of {1, choice, 0#{1} days|1#1 day|1.5#{1} days}.
 account.remaining_vacation_days.expired.vacation=Your current holiday entitlement:
 account.remaining_vacation_days.expired.not_expiring=Remaining leave that has not expired on {0}:
-account.vacation_days.this_year=You still have {0, choice, 0#{0} days|1#1 day|1.5#{0} days} holiday open for this year, please remember to plan your holiday.
+account.vacation_days.this_year=You still have {0, choice, 0#{0} days|1#1 day|1.5#{0} days} of vacation left for this year. Please remember to plan your vacation in time, as any unused remaining leave will expire on {1} in the coming year.
 
 subject.account.updatedRemainingDays=Evaluation of updated remaining days
 subject.account.remindForCurrentlyLeftVacationDays=Reminder of open vacation entitlement
diff --git a/src/main/resources/mail/account_cron_currently_left_vacation_days.txt b/src/main/resources/mail/account_cron_currently_left_vacation_days.txt
index 471bfbd74..69fb8e1ab 100644
--- a/src/main/resources/mail/account_cron_currently_left_vacation_days.txt
+++ b/src/main/resources/mail/account_cron_currently_left_vacation_days.txt
@@ -1,5 +1,5 @@
 [(#{greeting(${recipientNiceName})})],
 
-[(#{account.vacation_days.this_year(${vacationDaysLeft})})]
+[(#{account.vacation_days.this_year(${vacationDaysLeft},${#temporals.format(expiryDateNextYear, "dd.MM.yyyy")})})]
 
 [(#{account.vacation_entitlement.information})] [(${baseLinkURL})]web/person/[(${personId})]/overview
diff --git a/src/main/resources/mail/account_cron_remind_remaining_vacation_days.txt b/src/main/resources/mail/account_cron_remind_remaining_vacation_days.txt
index 6be387ecf..3656b0b6a 100644
--- a/src/main/resources/mail/account_cron_remind_remaining_vacation_days.txt
+++ b/src/main/resources/mail/account_cron_remind_remaining_vacation_days.txt
@@ -1,5 +1,5 @@
 [(#{greeting(${recipientNiceName})})],
 
-[(#{account.remaining_vacation_days.last_year.use_until(${remainingVacationDays},${#temporals.format(dayBeforeExpiryDate, "dd.MM.yyyy")})})]
+[(#{account.remaining_vacation_days.last_year.use_until(${remainingVacationDays},${#temporals.format(dayBeforeExpiryDate, "dd.MM.yyyy")},${#temporals.format(expiryDate, "dd.MM.yyyy")})})]
 
 [(#{account.vacation_entitlement.information})] [(${baseLinkURL})]web/person/[(${personId})]/overview


Test patch:
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceIT.java b/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceIT.java
index 1c7497178..af4dbf033 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceIT.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceIT.java
@@ -25,6 +25,7 @@ import java.time.Year;
 import java.time.ZoneId;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 
 import static com.icegreen.greenmail.util.ServerSetupTest.SMTP_IMAP;
 import static java.math.BigDecimal.TEN;
@@ -51,7 +52,7 @@ class VacationDaysReminderServiceIT extends SingleTenantTestContainersBase {
     private MailService mailService;
 
     @Test
-    void ensureReminderForLeftVacationDays() throws MessagingException, IOException {
+    void ensureReminderForLeftVacationDaysWithNextYearHolidayAccountAvailable() throws MessagingException, IOException {
 
         final Clock clock = Clock.fixed(Instant.parse("2022-10-31T06:00:00Z"), ZoneId.of("UTC"));
         final VacationDaysReminderService sut = new VacationDaysReminderService(personService, accountService, vacationDaysService, mailService, clock);
@@ -67,6 +68,53 @@ class VacationDaysReminderServiceIT extends SingleTenantTestContainersBase {
         when(accountService.getHolidaysAccount(2022, List.of(person))).thenReturn(List.of(account));
         when(vacationDaysService.getTotalLeftVacationDays(account)).thenReturn(TEN);
 
+        final Account accountNextYear = new Account();
+        accountNextYear.setPerson(person);
+        accountNextYear.setExpiryDateLocally(LocalDate.of(2023, 4, 10));
+        accountNextYear.setDoRemainingVacationDaysExpireLocally(true);
+        when(accountService.getHolidaysAccount(2023, person)).thenReturn(Optional.of(accountNextYear));
+
+        sut.remindForCurrentlyLeftVacationDays();
+
+        await()
+            .atMost(Duration.ofSeconds(1))
+            .untilAsserted(() -> assertThat(greenMail.getReceivedMessagesForDomain(person.getEmail())).hasSize(1));
+
+        // was email sent?
+        final MimeMessage[] inbox = greenMail.getReceivedMessagesForDomain(person.getEmail());
+        final Message msg = inbox[0];
+        assertThat(msg.getSubject()).contains("Erinnerung an offenen Urlaubsanspruch");
+        assertThat(new InternetAddress(person.getEmail())).isEqualTo(msg.getAllRecipients()[0]);
+
+        // check content of email
+        final String content = readPlainContent(msg);
+        assertThat(content).isEqualTo("""
+            Hallo Lieschen Müller,
+
+            Du hast noch 10 Tage Urlaub für dieses Jahr offen. Bitte denke daran, deinen Urlaub rechtzeitig zu planen, da der nicht genommenen Resturlaub im kommenden Jahr am 10.04.2023 verfällt.
+
+            Mehr Informationen zu deinem Urlaubsanspruch findest du hier: https://localhost:8080/web/person/42/overview""");
+    }
+
+    @Test
+    void ensureReminderForLeftVacationDaysWithoutHolidayAccountForNextYearAvailableSoTakeTheExpireDayFromThisYearAccountWithNextYear() throws MessagingException, IOException {
+
+        final Clock clock = Clock.fixed(Instant.parse("2022-10-31T06:00:00Z"), ZoneId.of("UTC"));
+        final VacationDaysReminderService sut = new VacationDaysReminderService(personService, accountService, vacationDaysService, mailService, clock);
+
+        final Person person = new Person("user", "Müller", "Lieschen", "lieschen@example.org");
+        person.setId(42L);
+        when(personService.getActivePersons()).thenReturn(List.of(person));
+
+        final Account account = new Account();
+        account.setPerson(person);
+        account.setExpiryDateLocally(LocalDate.of(2022, 4, 1));
+        account.setDoRemainingVacationDaysExpireLocally(true);
+        when(accountService.getHolidaysAccount(2022, List.of(person))).thenReturn(List.of(account));
+        when(vacationDaysService.getTotalLeftVacationDays(account)).thenReturn(TEN);
+
+        when(accountService.getHolidaysAccount(2023, person)).thenReturn(Optional.empty());
+
         sut.remindForCurrentlyLeftVacationDays();
 
         await()
@@ -84,7 +132,7 @@ class VacationDaysReminderServiceIT extends SingleTenantTestContainersBase {
         assertThat(content).isEqualTo("""
             Hallo Lieschen Müller,
 
-            Du hast noch 10 Tage Urlaub für dieses Jahr offen, bitte denke daran, deinen Urlaub zu planen.
+            Du hast noch 10 Tage Urlaub für dieses Jahr offen. Bitte denke daran, deinen Urlaub rechtzeitig zu planen, da der nicht genommenen Resturlaub im kommenden Jahr am 01.04.2023 verfällt.
 
             Mehr Informationen zu deinem Urlaubsanspruch findest du hier: https://localhost:8080/web/person/42/overview""");
     }
@@ -138,7 +186,7 @@ class VacationDaysReminderServiceIT extends SingleTenantTestContainersBase {
         assertThat(content).isEqualTo("""
             Hallo Lieschen Müller,
 
-            Du hast noch 10 Tage Resturlaub aus dem Vorjahr, bitte denke daran den Urlaub bis zum 31.03.2022 zu nehmen.
+            Du hast noch 10 Tage Resturlaub aus dem Vorjahr. Bitte plane deinen Resturlaub rechtzeitig, da dieser bis zum 31.03.2022 genommen werden muss und am 01.04.2022 verfällt.
 
             Mehr Informationen zu deinem Urlaubsanspruch findest du hier: https://localhost:8080/web/person/42/overview""");
     }
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceTest.java b/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceTest.java
index b53ae9002..1ac3f9525 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/account/VacationDaysReminderServiceTest.java
@@ -18,6 +18,7 @@ import java.time.Year;
 import java.time.ZoneId;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 
 import static java.math.BigDecimal.ONE;
 import static java.math.BigDecimal.TEN;
@@ -55,6 +56,7 @@ class VacationDaysReminderServiceTest {
         final Account account = new Account();
         account.setExpiryDateLocally(LocalDate.of(2022, 4, 1));
         when(accountService.getHolidaysAccount(2022, List.of(person))).thenReturn(List.of(account));
+        when(vacationDaysService.getTotalLeftVacationDays(account)).thenReturn(ZERO);
 
         sut.remindForCurrentlyLeftVacationDays();
 
@@ -62,7 +64,7 @@ class VacationDaysReminderServiceTest {
     }
 
     @Test
-    void ensureNoReminderIfRemainingVacationDaysToNotExpire() {
+    void ensureNoReminderIfRemainingVacationDaysDoNotExpire() {
 
         final Clock clock = Clock.fixed(Instant.parse("2022-10-31T06:00:00Z"), ZoneId.of("UTC"));
         final VacationDaysReminderService sut = new VacationDaysReminderService(personService, accountService, vacationDaysService, mailService, clock);
@@ -71,9 +73,14 @@ class VacationDaysReminderServiceTest {
         when(personService.getActivePersons()).thenReturn(List.of(person));
 
         final Account account = new Account();
-        account.setDoRemainingVacationDaysExpireGlobally(true);
+        account.setPerson(person);
         when(accountService.getHolidaysAccount(2022, List.of(person))).thenReturn(List.of(account));
-        when(vacationDaysService.getTotalLeftVacationDays(account)).thenReturn(ZERO);
+        when(vacationDaysService.getTotalLeftVacationDays(account)).thenReturn(TEN);
+
+        final Account accountNextYear = new Account();
+        accountNextYear.setPerson(person);
+        accountNextYear.setDoRemainingVacationDaysExpireGlobally(false);
+        when(accountService.getHolidaysAccount(2023, person)).thenReturn(Optional.of(accountNextYear));
 
         sut.remindForCurrentlyLeftVacationDays();
 
@@ -124,7 +131,7 @@ class VacationDaysReminderServiceTest {
             entry("recipientNiceName", "Marlene Muster"),
             entry("personId", 42L),
             entry("vacationDaysLeft", TEN),
-            entry("nextYear", 2023)
+            entry("expiryDateNextYear", LocalDate.of(2023, 4, 1))
         );
     }
 
@@ -201,12 +208,14 @@ class VacationDaysReminderServiceTest {
         assertThat(capturedMail.getMailAddressRecipients()).contains(List.of(person));
         assertThat(capturedMail.getSubjectMessageKey()).isEqualTo("subject.account.remindForRemainingVacationDays");
         assertThat(capturedMail.getTemplateName()).isEqualTo("account_cron_remind_remaining_vacation_days");
-        assertThat(capturedMail.getTemplateModel(GERMAN)).contains(
-            entry("recipientNiceName", "Marlene Muster"),
-            entry("personId", 42L),
-            entry("remainingVacationDays", TEN),
-            entry("dayBeforeExpiryDate", LocalDate.of(2022, 3, 31))
-        );
+        assertThat(capturedMail.getTemplateModel(GERMAN))
+            .containsOnly(
+                entry("recipientNiceName", "Marlene Muster"),
+                entry("personId", 42L),
+                entry("remainingVacationDays", TEN),
+                entry("dayBeforeExpiryDate", LocalDate.of(2022, 3, 31)),
+                entry("expiryDate", LocalDate.of(2022, 4, 1))
+            );
     }
 
     @Test