diff --git a/appli_sf/src/Controller/SearchController.php b/appli_sf/src/Controller/SearchController.php index 957760e9aeca47b53d47392e18079903d8b9174e..da92e97673bed7496b1b74d0c774469a133c89a7 100644 --- a/appli_sf/src/Controller/SearchController.php +++ b/appli_sf/src/Controller/SearchController.php @@ -351,15 +351,27 @@ class SearchController extends BaseController /** @var User $user */ $user = $this->getUser(); - $mailSubject = $this->translator->trans( - 'searchResultMail.subject.default', - [ - '%appName%' => $this->settingsData->getAppName(), - '%recipient%' => $searchData->getRecipient(), - '%firstName%' => $searchData->getFirstName(), - '%name%' => $searchData->getName($this->settingsData), - ] - ); + if ($searchData->getRecipient()) { + $mailSubject = $this->translator->trans( + 'searchResultMail.subject.default', + [ + '%appName%' => $this->settingsData->getAppName(), + '%recipient%' => $searchData->getRecipient(), + '%firstName%' => $searchData->getFirstName(), + '%name%' => $searchData->getName($this->settingsData), + ] + ); + } else { + $mailSubject = $this->translator->trans( + 'searchResultMail.subject.norecipient', + [ + '%appName%' => $this->settingsData->getAppName(), + '%firstName%' => $searchData->getFirstName(), + '%name%' => $searchData->getName($this->settingsData), + ] + ); + } + $mailTemplate = ''; $mailParameters = [ 'firstName' => $searchData->getFirstName(), diff --git a/appli_sf/translations/messages.fr.yaml b/appli_sf/translations/messages.fr.yaml index 53e94289b8e47ba7b570870155112ceceb167076..8346e1ae84132e3b40df8590fdf965e043f66527 100644 --- a/appli_sf/translations/messages.fr.yaml +++ b/appli_sf/translations/messages.fr.yaml @@ -208,8 +208,9 @@ dateJsValidation: deathDateAfterdeathCertificateDate: "La date de décès ne peut être postérieure à la date de l'acte." searchResultMail: subject: - default: "[%appName%] Notaire référent : %recipient% - Succession %firstName% %name%" - hasRequest: "[%appName%] Instruction" + default: "[%appName%] Notaire référent : %recipient% - Succession %firstName% %name%" + norecipient: "[%appName%] Succession %firstName% %name%" + hasRequest: "[%appName%] Instruction" formError: date: "Mauvais format de date" userLogs: