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

[TASK] Fixed misc errors when submitting the apply form

parent 9e9eece5
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,7 @@ class JoblistController extends ActionController {
$this->view->assign('allowedMimeTypes', $allowedMimeTypes);
$allowedFileExtensions = $this->settings['allowedFileExtensions'];
$this->view->assign('allowedFileExtensions', $allowedFileExtensions);
$this->view->assign('jobApplication', $applyData);
$this->view->assign('applyData', $applyData);
}
/**
......@@ -108,7 +108,7 @@ class JoblistController extends ActionController {
/** @noinspection PhpMethodParametersCountMismatchInspection */
$mailService = $this->objectManager->get(
MailTemplateService::class, 'application_mail', 'sg_jobs',
$this->getApplicationMailMarkers((array) $applyData)
$this->getApplicationMailMarkers($applyData)
);
$mailService->setIgnoreMailQueue(TRUE);
$mailService->setToAddresses($this->settings['applicationEmail']);
......@@ -120,14 +120,17 @@ class JoblistController extends ActionController {
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
)['settings']['redirectPage'];
$uriBuilder = $this->uriBuilder;
$uri = $uriBuilder
->setTargetPageUid($redirectPageId)
->build();
->reset()
->setTargetPageUid($redirectPageId)
->build();
$this->redirectToUri($uri);
} 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
}
}
......@@ -183,22 +186,21 @@ class JoblistController extends ActionController {
/**
* Returns the application mail markers
*
* @param array $applyData
* @param JobApplication $applyData
* @return array
*/
private function getApplicationMailMarkers(array $applyData = []): array {
private function getApplicationMailMarkers($applyData): array {
return [
'jobtitle' => $applyData['jobTitle'],
'salutation' => $applyData['salutation'],
'firstname' => $applyData['firstName'],
'lastname' => $applyData['lastName'],
'street' => $applyData['street'],
'city' => $applyData['city'],
'country' => $applyData['country'],
'phone' => $applyData['phone'],
'mobile' => $applyData['mobile'],
'email' => $applyData['email'],
'message' => $applyData['message']
'salutation' => $applyData->getGender(),
'firstname' => $applyData->getFirstName(),
'lastname' => $applyData->getLastName(),
'street' => $applyData->getStreet(),
'city' => $applyData->getCity(),
'country' => $applyData->getCountry(),
'phone' => $applyData->getPhone(),
'mobile' => $applyData->getMobile(),
'email' => $applyData->getEmail(),
'message' => $applyData->getFirstName()
];
}
......@@ -306,7 +308,6 @@ class JoblistController extends ActionController {
}
$dataToInsertArr = [
$data->getJobId(),
$data->getJobTitle(),
$data->getFirstName(),
$data->getLastName(),
$data->getGender(),
......
......@@ -153,7 +153,7 @@ class JobApplication extends AbstractEntity {
/**
* @param string $jobId
*/
public function setJob($jobId) {
public function setJobId($jobId) {
$this->jobId = $jobId;
}
......
......@@ -3,7 +3,7 @@
<f:section name="main">
<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.job_id}" property="jobId" />
<f:form.hidden value="{job.jobId}" property="jobId" />
<label for="apply-title"><f:translate key="frontend.apply.title" /></label>
<span id="apply-title">{job.title}</span>
<br />
......
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