From bc05ccc7fe2d2a21fb3285a3684908d7e1c3d5ea Mon Sep 17 00:00:00 2001 From: Dominic Tubach Date: Thu, 26 Sep 2024 11:01:04 +0200 Subject: [PATCH] Show message if there's no funding program for new applications --- src/Controller/ChooseFundingProgramController.php | 9 ++++++++- translations/civiremote_funding.pot | 8 ++++++-- translations/de.po | 8 ++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Controller/ChooseFundingProgramController.php b/src/Controller/ChooseFundingProgramController.php index 5a07daf..a8ed035 100644 --- a/src/Controller/ChooseFundingProgramController.php +++ b/src/Controller/ChooseFundingProgramController.php @@ -55,7 +55,14 @@ public function form() { return []; } - if (1 === count($fundingProgramOptions)) { + $fundingProgramOptionsCount = count($fundingProgramOptions); + if (0 === $fundingProgramOptionsCount) { + $this->messenger()->addStatus($this->t('Currently there is no funding program for new applications.')); + + return []; + } + + if (1 === $fundingProgramOptionsCount) { $fundingProgramId = key($fundingProgramOptions); try { $fundingCaseTypes = $this->fundingApi->getFundingCaseTypesByFundingProgramId( diff --git a/translations/civiremote_funding.pot b/translations/civiremote_funding.pot index dd1c1d0..25d8690 100644 --- a/translations/civiremote_funding.pot +++ b/translations/civiremote_funding.pot @@ -329,12 +329,16 @@ msgstr "" msgid "Failed to load available funding programs: @error" msgstr "" -#: src/Controller/ChooseFundingProgramController.php:67 +#: src/Controller/ChooseFundingProgramController.php:60 +msgid "Currently there is no funding program for new applications." +msgstr "" + +#: src/Controller/ChooseFundingProgramController.php:74 #: src/Form/ChooseFundingProgramForm.php:83 msgid "Failed to load funding case types: @error" msgstr "" -#: src/Controller/ChooseFundingProgramController.php:74 +#: src/Controller/ChooseFundingProgramController.php:81 #: src/Form/ChooseFundingProgramForm.php:90 msgid "No funding case type available in the selected funding program." msgstr "" diff --git a/translations/de.po b/translations/de.po index 388b8c5..ce16892 100644 --- a/translations/de.po +++ b/translations/de.po @@ -333,12 +333,16 @@ msgstr "Antragsverlauf" msgid "Failed to load available funding programs: @error" msgstr "Laden der verfügbaren Förderprogramme fehlgeschlagen: @error" -#: src/Controller/ChooseFundingProgramController.php:67 +#: src/Controller/ChooseFundingProgramController.php:60 +msgid "Currently there is no funding program for new applications." +msgstr "Momentan gibt es kein Förderprogramm für neue Anträge." + +#: src/Controller/ChooseFundingProgramController.php:74 #: src/Form/ChooseFundingProgramForm.php:83 msgid "Failed to load funding case types: @error" msgstr "Laden der Förderfalltypen fehlgeschlagen: @error" -#: src/Controller/ChooseFundingProgramController.php:74 +#: src/Controller/ChooseFundingProgramController.php:81 #: src/Form/ChooseFundingProgramForm.php:90 msgid "No funding case type available in the selected funding program." msgstr "Kein Förderfalltyp im gewählten Förderprogramm verfügbar."