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

[TASK] Another ton of smaller fixes and more feedback reported already

parent eb372847
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,6 @@ namespace SGalinski\SgJobs\Controller; ...@@ -28,7 +28,6 @@ namespace SGalinski\SgJobs\Controller;
use SGalinski\SgJobs\Domain\Model\JobApplication; use SGalinski\SgJobs\Domain\Model\JobApplication;
use SGalinski\SgMail\Service\MailTemplateService; use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Resource\DuplicationBehavior; use TYPO3\CMS\Core\Resource\DuplicationBehavior;
use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility; use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
...@@ -74,8 +73,10 @@ class JoblistController extends ActionController { ...@@ -74,8 +73,10 @@ class JoblistController extends ActionController {
/** /**
* Renders the application form with an optional job * Renders the application form with an optional job
*
* @param JobApplication $applyData
*/ */
public function applyFormAction() { public function applyFormAction(JobApplication $applyData = NULL) {
if ($this->request->getOriginalRequest()) { if ($this->request->getOriginalRequest()) {
$uploadedFiles = $this->request->getOriginalRequest()->getArguments()['uploadedFiles']; $uploadedFiles = $this->request->getOriginalRequest()->getArguments()['uploadedFiles'];
$this->view->assign('uploadedFiles', $uploadedFiles); $this->view->assign('uploadedFiles', $uploadedFiles);
...@@ -89,29 +90,18 @@ class JoblistController extends ActionController { ...@@ -89,29 +90,18 @@ class JoblistController extends ActionController {
$allowedMimeTypes = $this->settings['allowedMimeTypes']; $allowedMimeTypes = $this->settings['allowedMimeTypes'];
$this->view->assign('allowedMimeTypes', $allowedMimeTypes); $this->view->assign('allowedMimeTypes', $allowedMimeTypes);
$this->view->assign('jobApplication', $applyData);
} }
/** /**
* Saves the application send by the applyFormAction * Saves the application send by the applyFormAction
* *
* @param JobApplication $applyData * @param JobApplication $applyData
* @return void
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
* @throws \TYPO3\CMS\Core\Resource\Exception\InvalidTargetFolderException
* @throws \TYPO3\CMS\Core\Resource\Exception\IllegalFileExtensionException
* @throws \TYPO3\CMS\Core\Exception
* @throws \RuntimeException
* @throws \BadFunctionCallException
* @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException
* @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException
* @throws \TYPO3\CMS\Core\Resource\Exception\ExistingTargetFolderException
* @throws \Exception
* @throws \InvalidArgumentException
*/ */
public function applyAction(JobApplication $applyData) { public function applyAction(JobApplication $applyData) {
$this->submitApplicationFiles($GLOBALS['TSFE']->fe_user->id, $applyData);
try { try {
$this->submitApplicationFiles($GLOBALS['TSFE']->fe_user->id, $applyData);
/** @noinspection PhpMethodParametersCountMismatchInspection */ /** @noinspection PhpMethodParametersCountMismatchInspection */
$mailService = $this->objectManager->get( $mailService = $this->objectManager->get(
MailTemplateService::class, 'application_mail', 'sg_jobs', MailTemplateService::class, 'application_mail', 'sg_jobs',
...@@ -121,7 +111,7 @@ class JoblistController extends ActionController { ...@@ -121,7 +111,7 @@ class JoblistController extends ActionController {
$mailService->setToAddresses($this->settings['applicationEmail']); $mailService->setToAddresses($this->settings['applicationEmail']);
$mailService->sendEmail(); $mailService->sendEmail();
} catch (Exception $exception) { } catch (\Exception $exception) {
// possible errors, because of wrong mails (maybe log that somewhere? Does this makes sense?) // possible errors, because of wrong mails (maybe log that somewhere? Does this makes sense?)
} }
} }
......
...@@ -40,7 +40,7 @@ class JobApplication extends AbstractEntity { ...@@ -40,7 +40,7 @@ class JobApplication extends AbstractEntity {
protected $jobTitle = ''; protected $jobTitle = '';
/** /**
* @var string $jobTitle * @var \SGalinski\SgJobs\Domain\Model\Job
*/ */
protected $jobId = ''; protected $jobId = '';
...@@ -160,16 +160,16 @@ class JobApplication extends AbstractEntity { ...@@ -160,16 +160,16 @@ class JobApplication extends AbstractEntity {
} }
/** /**
* @return string * @return \SGalinski\SgJobs\Domain\Model\Job
*/ */
public function getJobId() { public function getJobId() {
return $this->jobId; return $this->jobId;
} }
/** /**
* @param string $jobId * @param \SGalinski\SgJobs\Domain\Model\Job $jobId
*/ */
public function setJobId(string $jobId) { public function setJobId(Job $jobId) {
$this->jobId = $jobId; $this->jobId = $jobId;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<f:section name="main"> <f:section name="main">
<f:form action="apply" controller="Joblist" method="post" objectName="applyData" object="{applyData}" enctype="multipart/form-data"> <f:form action="apply" controller="Joblist" method="post" objectName="applyData" object="{applyData}" enctype="multipart/form-data">
<f:form.hidden value="{job}" property="uid" /> <f:form.hidden value="{job.uid}" property="jobId" />
<label for="apply-gender"><f:translate key="frontend.apply.gender" /></label> <label for="apply-gender"><f:translate key="frontend.apply.gender" /></label>
<f:form.select property="gender" id="apply-gender" class="" options="{None: '', Male: 'Male', Female: 'Female'}" /> <f:form.select property="gender" id="apply-gender" class="" options="{None: '', Male: 'Male', Female: 'Female'}" />
......
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