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

[BUGFIX] Fix some issues with the validation

parent c1df03ab
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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>
......
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