diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 6c49e15ce3f57afacb6ead8784633183591b92b6..2e685961600e603ad5f1ef424e5f54a5768fa00b 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -150,13 +150,6 @@ class JoblistController extends ActionController { $this->view->assign('job', $jobData); } - // look for a configured default job, in case of unsolicited application - if ($jobData === NULL && $this->settings['defaultJobId']) { - /** @var Job $unsoliticedJob */ - $unsoliticedJob = $this->jobRepository->findByUid($this->settings['defaultJobId']); - $this->view->assign('job', $unsoliticedJob); - } - // display country options $countryRepository = $this->objectManager->get(CountryRepository::class); $countries = $countryRepository->findAllOrderedBy('shortNameEn')->toArray(); @@ -250,6 +243,15 @@ class JoblistController extends ActionController { try { $applyData->setPid($GLOBALS['TSFE']->id); + /** @var Job $job */ + $job = $applyData->getJob(); + + // look for a configured default job, in case of unsolicited application + if ($job === NULL && $this->settings['defaultJobId']) { + $unsoliticedJob = $this->settings['defaultJobId']; + $applyData->setJobId($unsoliticedJob); + } + if ($applyData->_isNew()) { $this->jobApplicationRepository->add($applyData); } else { @@ -266,8 +268,6 @@ class JoblistController extends ActionController { ); // get email from the job contact, fallback is TS settings - /** @var Job $job */ - $job = $applyData->getJob(); if ($job !== NULL) { /** @var Contact $contact */ diff --git a/Configuration/TypoScript/Frontend/setup.ts b/Configuration/TypoScript/Frontend/setup.ts index 926528cf328befa0a0657e12ef4a78c401c61ada..26f79142ffddaef53e104b4a13f624719ea73c51 100644 --- a/Configuration/TypoScript/Frontend/setup.ts +++ b/Configuration/TypoScript/Frontend/setup.ts @@ -25,7 +25,7 @@ plugin.tx_sgjobs { allowedFileExtensions = {$plugin.tx_sgjobs.settings.allowedFileExtensions} allowedMimeTypes = {$plugin.tx_sgjobs.settings.allowedMimeTypes} defaultContactId = 1 - defaultJobId = + defaultJobId = 28 } features { diff --git a/README.md b/README.md index 5a0e7b3a11329e9b96085ce24b7b4e666162a73d..fece6cd0da092f3611cb1d29a11ea7c1e1970d23 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The Backend module is found in the **WEB** section under the name **Job Offers** You can create a new job offer by clicking on the **New Job Offer** button. ## Defining a default Job (unsoliticed Application) -In your typoscript settings you can set a job offer, which will be used for all **unsoliticed Applications**. +In your typoscript settings you can set a job id, which will be used for all **unsoliticed Applications**. If nothing is set, unsolicited applications are not connected to any job offer. ```