diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 3a0fd069f278e7449e38c66ad132540b1ad9b850..d9eae01b097258ab8a9358d433f2db3ac8ee322a 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -109,16 +109,24 @@ class JoblistController extends ActionController { * * @param JobApplication $applyData * @param string $error - * @param string $folderName * @param int $uid + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException */ - public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $folderName = NULL, $uid = NULL) { + public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $uid = NULL) { if ($error !== NULL && $error !== '') { $this->view->assign('internalError', $error); + $this->request->setArgument('error', NULL); } + $folderName = NULL; + try { + $folderName = $this->request->getArgument('folderName'); + } catch (\Exception $exception) { + // nope + } if ($folderName === NULL) { $folderName = md5(uniqid('sgjobs-', TRUE)); + $this->request->setArgument('folderName', $folderName); } $this->view->assign('folderName', $folderName); @@ -157,13 +165,15 @@ class JoblistController extends ActionController { * @return void * @throws NoSuchArgumentException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ protected function initializeApplyAction() { try { $uniqueFolderName = $this->request->getArgument('folderName'); } catch (NoSuchArgumentException $exception) { $exceptionMessage = 'Eine Datei konnte nicht hochgeladen werden. Ist diese eventuell zu groß?'; - $this->forward('applyForm', NULL, NULL, ['error' => $exceptionMessage]); + $this->redirect('applyForm', NULL, NULL, ['error' => $exceptionMessage]); + exit; } $propertyMappingConfiguration = $this->arguments->getArgument('applyData')->getPropertyMappingConfiguration(); diff --git a/Classes/Domain/Model/JobApplication.php b/Classes/Domain/Model/JobApplication.php index 08d31bc398a6b16fc978d8a52e9a11c84dc5e7a1..73872e87055d068fa924f3cd2b13badd4b4fbe14 100644 --- a/Classes/Domain/Model/JobApplication.php +++ b/Classes/Domain/Model/JobApplication.php @@ -125,19 +125,19 @@ class JobApplication extends AbstractEntity { /** * @var \SGalinski\SgJobs\Domain\Model\FileReference $coverLetter - * + * @validate NotEmpty */ protected $coverLetter; /** * @var \SGalinski\SgJobs\Domain\Model\FileReference $cv - * + * @validate NotEmpty */ protected $cv; /** * @var \SGalinski\SgJobs\Domain\Model\FileReference $certificate - * + * @validate NotEmpty */ protected $certificate; diff --git a/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php b/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php index fe99a5be30db44bc9c53b65a55e4531c50fc4df1..d727da823f1a80f756d475b01eee409429bb43c7 100644 --- a/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php +++ b/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php @@ -328,7 +328,7 @@ class UploadedFileReferenceConverter implements TypeConverterInterface { * Import a resource and respect configuration given for properties * * @param array $uploadInfo - * @return \SGalinski\SgJobs\Domain\Model\FileReference + * @return \SGalinski\SgJobs\Domain\Model\FileReference|NULL * @throws \InvalidArgumentException * @throws TypeConverterException * @throws \Exception @@ -336,7 +336,8 @@ class UploadedFileReferenceConverter implements TypeConverterInterface { * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException */ - protected function importUploadedResource(array $uploadInfo): FileReference { + protected function importUploadedResource(array $uploadInfo) { + $uploadedFile = NULL; $filePathInfo = PathUtility::pathinfo($uploadInfo['name']); $fileName = $this->getTargetUploadFileName(); $finalFileName = $fileName . '.' . strtolower($filePathInfo['extension']); @@ -372,6 +373,7 @@ class UploadedFileReferenceConverter implements TypeConverterInterface { $uploadFolderId = $this->getUploadFolder(); // Security protection to not allow manipulations outside of this specific folder if (strpos($uploadFolderId, '/JobApplication/') !== FALSE) { + debug($uploadFolderId . '/' . $finalFileName); try { $uploadedFile = $this->resourceFactory->retrieveFileOrFolderObject( $uploadFolderId . '/' . $finalFileName @@ -385,6 +387,10 @@ class UploadedFileReferenceConverter implements TypeConverterInterface { } } + if (!$uploadedFile) { + return NULL; + } + return $this->createFileReferenceFromFalFileObject($uploadedFile); } diff --git a/Resources/Private/Templates/Joblist/ApplyForm.html b/Resources/Private/Templates/Joblist/ApplyForm.html index b727984ed44f4f5865a294aabeb05094c9c22297..02263c2ed53617ac1da6f7b72713cdc692be2112 100644 --- a/Resources/Private/Templates/Joblist/ApplyForm.html +++ b/Resources/Private/Templates/Joblist/ApplyForm.html @@ -31,12 +31,11 @@ </f:if> <f:if condition="{job}"> - <p> + <div> <f:form.hidden name="jobId" value="{job.jobId}" /> <f:form.hidden property="jobTitle" value="{job.title}" /> - <label for="apply-title"><f:translate key="frontend.apply.title" /></label> - <span id="apply-title">{job.title}</span> - </p> + <h1>Bewerbung für <span id="apply-title">{job.title}</span></h1> + </div> </f:if> <p>