diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index c92a9090dcc8da2ccf25cfb0d6dda698e4ac7c44..a2a8eec83eef8be96d8f9755828f62ef61ceffda 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -349,14 +349,15 @@ class JoblistController extends ActionController { '&tx_sgjobs_jobapplication[jobId]=' . $jobId ); $headTagService->execute(); + + $enableAutomaticRelatedJobs = (bool) $this->settings['enableAutomaticRelatedJobs']; + if ($enableAutomaticRelatedJobs) { + $automaticRelatedJobsLimit = (int) $this->settings['automaticRelatedJobsLimit']; + $relatedJobs = $this->jobRepository->findRelated($job, $automaticRelatedJobsLimit); + $this->view->assign('relatedJobs', $relatedJobs); + } } $this->view->assign('job', $job); - $enableAutomaticRelatedJobs = (bool) $this->settings['enableAutomaticRelatedJobs']; - $automaticRelatedJobsLimit = (int) $this->settings['automaticRelatedJobsLimit']; - if ($enableAutomaticRelatedJobs) { - $relatedJobs = $this->jobRepository->findRelated($job, $automaticRelatedJobsLimit); - $this->view->assign('relatedJobs', $relatedJobs); - } } else { $storagePid = (int) $this->configurationManager->getConfiguration( ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK @@ -384,7 +385,6 @@ class JoblistController extends ActionController { $this->view->assign('allowedFileExtensions', $allowedFileExtensions); if ($applyData === NULL) { - /** @noinspection CallableParameterUseCaseInTypeContextInspection */ $applyData = $this->objectManager->get(JobApplication::class); if ($job) { $applyData->setJobId($job->getJobId()); @@ -498,6 +498,7 @@ class JoblistController extends ActionController { $this->moveTmpFolder($folderName, $applyData); $this->submitApplicationFiles($applyData, $folderName); + /** @noinspection PhpParamsInspection */ $mailService = $this->objectManager->get( MailTemplateService::class, 'application_mail', @@ -719,12 +720,20 @@ class JoblistController extends ActionController { /** @var ResourceFactory $resourceFactory */ $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); $storage = $resourceFactory->getStorageObject(1); + + $newFolder = $tempFolder = NULL; $folder = $storage->getFolder(UploadController::JOB_APPLICATION_FOLDER); - $tempFolder = $storage->getFolderInFolder(UploadController::JOB_APPLICATION_TEMP_FOLDER, $folder); - if (!$storage->hasFolderInFolder($folderName, $folder)) { - $newFolder = $storage->createFolder($folderName, $folder); - } else { - $newFolder = $storage->getFolder(UploadController::JOB_APPLICATION_FOLDER . $folderName); + if ($folder) { + $tempFolder = $storage->getFolderInFolder(UploadController::JOB_APPLICATION_TEMP_FOLDER, $folder); + if (!$storage->hasFolderInFolder($folderName, $folder)) { + $newFolder = $storage->createFolder($folderName, $folder); + } else { + $newFolder = $storage->getFolder(UploadController::JOB_APPLICATION_FOLDER . $folderName); + } + } + + if (!$newFolder || !$tempFolder) { + throw new \RuntimeException('Upload folder can\'t be created (write permissions?)!'); } // Move uploaded files & csv fo real folder and delete the tmp folder