Skip to content
Snippets Groups Projects
Commit 05e4b331 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Fix some possible crashes

parent 74d5155e
No related branches found
No related tags found
No related merge requests found
...@@ -349,14 +349,15 @@ class JoblistController extends ActionController { ...@@ -349,14 +349,15 @@ class JoblistController extends ActionController {
'&tx_sgjobs_jobapplication[jobId]=' . $jobId '&tx_sgjobs_jobapplication[jobId]=' . $jobId
); );
$headTagService->execute(); $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); $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 { } else {
$storagePid = (int) $this->configurationManager->getConfiguration( $storagePid = (int) $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
...@@ -384,7 +385,6 @@ class JoblistController extends ActionController { ...@@ -384,7 +385,6 @@ class JoblistController extends ActionController {
$this->view->assign('allowedFileExtensions', $allowedFileExtensions); $this->view->assign('allowedFileExtensions', $allowedFileExtensions);
if ($applyData === NULL) { if ($applyData === NULL) {
/** @noinspection CallableParameterUseCaseInTypeContextInspection */
$applyData = $this->objectManager->get(JobApplication::class); $applyData = $this->objectManager->get(JobApplication::class);
if ($job) { if ($job) {
$applyData->setJobId($job->getJobId()); $applyData->setJobId($job->getJobId());
...@@ -498,6 +498,7 @@ class JoblistController extends ActionController { ...@@ -498,6 +498,7 @@ class JoblistController extends ActionController {
$this->moveTmpFolder($folderName, $applyData); $this->moveTmpFolder($folderName, $applyData);
$this->submitApplicationFiles($applyData, $folderName); $this->submitApplicationFiles($applyData, $folderName);
/** @noinspection PhpParamsInspection */
$mailService = $this->objectManager->get( $mailService = $this->objectManager->get(
MailTemplateService::class, MailTemplateService::class,
'application_mail', 'application_mail',
...@@ -719,12 +720,20 @@ class JoblistController extends ActionController { ...@@ -719,12 +720,20 @@ class JoblistController extends ActionController {
/** @var ResourceFactory $resourceFactory */ /** @var ResourceFactory $resourceFactory */
$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
$storage = $resourceFactory->getStorageObject(1); $storage = $resourceFactory->getStorageObject(1);
$newFolder = $tempFolder = NULL;
$folder = $storage->getFolder(UploadController::JOB_APPLICATION_FOLDER); $folder = $storage->getFolder(UploadController::JOB_APPLICATION_FOLDER);
$tempFolder = $storage->getFolderInFolder(UploadController::JOB_APPLICATION_TEMP_FOLDER, $folder); if ($folder) {
if (!$storage->hasFolderInFolder($folderName, $folder)) { $tempFolder = $storage->getFolderInFolder(UploadController::JOB_APPLICATION_TEMP_FOLDER, $folder);
$newFolder = $storage->createFolder($folderName, $folder); if (!$storage->hasFolderInFolder($folderName, $folder)) {
} else { $newFolder = $storage->createFolder($folderName, $folder);
$newFolder = $storage->getFolder(UploadController::JOB_APPLICATION_FOLDER . $folderName); } 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 // Move uploaded files & csv fo real folder and delete the tmp folder
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment