Skip to content
Snippets Groups Projects
Commit dfb552b2 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

Merge branch 'master' of gitlab.sgalinski.de:typo3/sg_jobs

parents 916f5370 79a04105
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ namespace SGalinski\SgJobs\Controller;
use SGalinski\SgJobs\Domain\Model\JobApplication;
use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Resource\DuplicationBehavior;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
......@@ -35,7 +36,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
/**
* The joblist plugin controller
......@@ -68,7 +68,6 @@ class JoblistController extends ActionController {
$this->assignFilterValues($storagePid);
$this->view->assign('recordPageId', $storagePid);
// pagination logic
$jobLimit = (int) $this->settings['jobLimit'];
$offset = 0;
......@@ -117,6 +116,9 @@ class JoblistController extends ActionController {
* Saves the application send by the applyFormAction
*
* @param JobApplication $applyData
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \InvalidArgumentException
*/
public function applyAction(JobApplication $applyData) {
try {
......@@ -147,7 +149,8 @@ class JoblistController extends ActionController {
} catch (\Exception $exception) {
// possible errors, because of wrong mails (maybe log that somewhere? Does this makes sense?)
// @TODO handle the exception, possibley redirect to form with error message
GeneralUtility::makeInstance(FlashMessage::class, $exception->getMessage());
$this->redirect('applyFormAction');
}
}
......@@ -155,6 +158,9 @@ class JoblistController extends ActionController {
* Pre-apply action setup, configures model-property mapping and handles file upload
*
* @return void
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
* @throws \Exception
......@@ -170,9 +176,10 @@ class JoblistController extends ActionController {
$this->handleFileUpload('coverLetter', $uniqueFolderName);
$this->handleFileUpload('cv', $uniqueFolderName);
$this->handleFileUpload('certificates', $uniqueFolderName);
} catch (\Exception $e) {
} catch (\Exception $exception) {
// possible errors, because of wrong mails
// @TODO output them in some way?
GeneralUtility::makeInstance(FlashMessage::class, $exception->getMessage());
$this->redirect('applyFormAction');
}
$propertyMappingConfiguration = $this->arguments->getArgument('applyData')->getPropertyMappingConfiguration();
$propertyMappingConfiguration->forProperty('coverLetter')->allowAllProperties();
......@@ -317,6 +324,9 @@ class JoblistController extends ActionController {
* @param JobApplication $data
* @param string $filePath
* @param array $fileNames
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
private function writeApplicationFile(JobApplication $data, $filePath, $fileNames) {
......@@ -353,7 +363,8 @@ class JoblistController extends ActionController {
fputcsv($file, $dataToInsertArr);
fclose($file);
} catch (\RuntimeException $exception) {
throw new \RuntimeException($exception->getMessage());
GeneralUtility::makeInstance(FlashMessage::class, $exception->getMessage());
$this->redirect('applyFormAction');
}
}
......
<f:layout name="Default" />
<f:section name="main">
<f:flashMessages />
<f:form action="apply" controller="Joblist" method="post" objectName="applyData" object="{applyData}" enctype="multipart/form-data">
<f:if condition="{job}">
<f:form.hidden value="{job.jobId}" property="jobId" />
......
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