diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 24312505dd850a5e6a01ba71ff60768fb6e9ec6b..d5aa5d3607da5a3fdc28b1a251c13684c20a4135 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -131,11 +131,11 @@ class JoblistController extends ActionController { * * @param JobApplication $applyData * @param string $error - * @param int $uid + * @param int $jobId * @throws \InvalidArgumentException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException */ - public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $uid = NULL) { + public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $jobId = NULL) { if ($error !== NULL && $error !== '') { $this->view->assign('internalError', $error); $this->request->setArgument('error', NULL); @@ -157,19 +157,19 @@ class JoblistController extends ActionController { $job = NULL; - if (!$uid !== NULL) { + if ($jobId !== NULL) { /** @var Job $job */ - $job = $this->jobRepository->findByUid($uid); + $job = $this->jobRepository->findByUid($jobId); if ($job) { $GLOBALS['TSFE']->page['titlebyextension'] = $job->getTitle(); $GLOBALS['TSFE']->page['description'] = substr($job->getDescription(), 0, 200); - } else { - $storagePid = (int) $this->configurationManager->getConfiguration( - ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK - )['persistence']['storagePid']; - $this->view->assign('companies', $this->companyRepository->getAllCompanies($storagePid)); } $this->view->assign('job', $job); + } else { + $storagePid = (int) $this->configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK + )['persistence']['storagePid']; + $this->view->assign('companies', $this->companyRepository->getAllCompanies($storagePid)); } // display country options @@ -292,7 +292,7 @@ class JoblistController extends ActionController { ); // get email from the job contact, fallback is TS settings - + $contact = NULL; if ($job !== NULL) { /** @var Contact $contact */ $contact = $job->getContact(); @@ -301,7 +301,12 @@ class JoblistController extends ActionController { if ($contact !== NULL) { $mailService->setToAddresses($contact->getEmail()); } else { - $mailService->setToAddresses($applyData->getCompany()->getContact()->getEmail()); + $company = $applyData->getCompany(); + if ($company !== NULL) { + if ($company->getContact() !== NULL) { + $mailService->setToAddresses($company->getContact()->getEmail()); + } + } } $mailService->setMarkers(['application' => $applyData]); diff --git a/Resources/Private/Partials/Job.html b/Resources/Private/Partials/Job.html index 904ad622390902ea2d329a84cfba389e68b4dc86..be226f82b15e6a6b10a0dc3e6aed36b939b8ad77 100644 --- a/Resources/Private/Partials/Job.html +++ b/Resources/Private/Partials/Job.html @@ -78,7 +78,7 @@ </div> <div class="pia-card-footer"> <f:link.action class="cta-link" pageUid="{settings.applyPage}" controller="Joblist" action="applyForm" - pluginName="JobApplication" arguments="{uid: job.uid}"> + pluginName="JobApplication" arguments="{jobId: job.uid}"> <f:translate key="frontend.applyNow" /> </f:link.action> </div>