diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 55b293603bb0ab47d2a42175237491497b32cb1b..472e17c4a450ea6825931d4ddf5d2d35090f6a4b 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -107,9 +107,9 @@ class BackendController extends ActionController { /** @var BackendUserAuthentication $backendUser */ $backendUser = $GLOBALS['BE_USER']; if ($filters === []) { - $filters = $backendUser->getModuleData('tools_beuser/index.php/web_SgJobsBackend_filters', 'ses') ?: []; + $filters = $backendUser->getModuleData('web_SgJobsBackend_filters', 'ses') ?: []; } else { - $backendUser->pushModuleData('tools_beuser/index.php/web_SgJobsBackend_filters', $filters); + $backendUser->pushModuleData('web_SgJobsBackend_filters', $filters); } // create docheader + buttons diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index a5bbd8f0d5f133113c7c1095f4b24a070e6d4cc3..483c525bd5129a8147d4470c0ee00737fcd8279f 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -49,6 +49,7 @@ use TYPO3\CMS\Core\Country\CountryProvider; use TYPO3\CMS\Core\Error\Http\PageNotFoundException; use TYPO3\CMS\Core\Exception\SiteNotFoundException; use TYPO3\CMS\Core\Http\ImmediateResponseException; +use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Resource\Exception\AbstractFileOperationException; use TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException; use TYPO3\CMS\Core\Resource\Exception\ExistingTargetFolderException; @@ -304,6 +305,12 @@ class JoblistController extends ActionController { $allJobsCount = $this->jobRepository->findJobsByFilter($filters)->count(); $numberOfPages = (int) ($jobLimit <= 0 ? 0 : \ceil($allJobsCount / $jobLimit)); if ($numberOfPages !== 0 && $currentPageBrowserPage >= $numberOfPages) { + /** @var PageRenderer $pageRenderer */ + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); + // the PageRenderer contains the content of the current request, the result of the following sub-request will + // be appended to it and we get 2 pages, the current one and the 404 page in one. We flush the PageRenderer + // content here, so it will contain only the 404 page content + $pageRenderer->setBodyContent(''); /** @var ErrorController $errorController */ $errorController = GeneralUtility::makeInstance(ErrorController::class); $response = $errorController->pageNotFoundAction( @@ -525,19 +532,6 @@ class JoblistController extends ActionController { * @throws NoSuchArgumentException */ protected function initializeApplyAction(): void { - $propertyMappingConfiguration = $this->arguments->getArgument('applyData')->getPropertyMappingConfiguration(); - $propertyMappingConfiguration->forProperty('job')->allowAllProperties(); - - // remove the job validator - /** @var ConjunctionValidator $validator */ - $validator = $this->arguments->getArgument('applyData')->getValidator(); - foreach ($validator->getValidators() as $subValidator) { - /** @var GenericObjectValidator $subValidatorSub */ - foreach ($subValidator->getValidators() as $subValidatorSub) { - $subValidatorsSub = $subValidatorSub->getPropertyValidators(); - unset($subValidatorsSub['job']); - } - } } /** @@ -558,11 +552,11 @@ class JoblistController extends ActionController { $job = $applyData->getJob(); if ($job) { $applyData->setJobId($job->getJobId()); - foreach ($job->getCompanies() as $company) { + foreach ($job->getCompany() as $company) { /** @var Company $company */ $applyData->setCompany($company); } - } elseif (!$applyData->getCompany()) { + } elseif (!$applyData->getFirstCompany()) { /** @var Company $company */ $company = $this->companyRepository->findByUid( (int) $_POST['tx_sgjobs_jobapplication']['applyData']['company'] @@ -574,8 +568,8 @@ class JoblistController extends ActionController { // look for a configured default job, in case of unsolicited application $applyData->setPid($GLOBALS['TSFE']->id); - if ((!$job || !$applyData->getJobId()) && $applyData->getCompany()) { - $applyData->setJobId($applyData->getCompany()->getJobId()); + if ((!$job || !$applyData->getJobId()) && $applyData->getFirstCompany()) { + $applyData->setJobId($applyData->getFirstCompany()->getJobId()); } if ($applyData->_isNew()) { @@ -620,7 +614,7 @@ class JoblistController extends ActionController { if ($contact !== NULL) { $mailService->setToAddresses($contact->getEmail()); } else { - $company = $applyData->getCompany(); + $company = $applyData->getFirstCompany(); if (($company !== NULL) && $company->getContact() !== NULL) { $mailService->setToAddresses($company->getContact()->getEmail()); } @@ -723,8 +717,8 @@ class JoblistController extends ActionController { */ protected function getApplicationMailMarkers(JobApplication $applyData): array { $location = ''; - if ($applyData->getCompany() !== NULL) { - $location = $applyData->getCompany()->getCity(); + if ($applyData->getFirstCompany() !== NULL) { + $location = $applyData->getFirstCompany()->getCity(); } return [ diff --git a/Classes/Domain/Model/Job.php b/Classes/Domain/Model/Job.php index cb2976f8d6d73d9a2cba4946fb1bb4d38647f764..a9fbba2ab1f99c86a0f413fb63a54370ae983ebb 100644 --- a/Classes/Domain/Model/Job.php +++ b/Classes/Domain/Model/Job.php @@ -107,7 +107,7 @@ class Job extends AbstractEntity { * @var ObjectStorage<Company> */ #[Lazy] - protected $company; + protected $company = NULL; /** * @var ObjectStorage<Job> @@ -287,25 +287,28 @@ class Job extends AbstractEntity { } /** - * @return Company|NULL + * @return ObjectStorage|NULL */ public function getCompany() { if ($this->company instanceof LazyLoadingProxy) { $this->company->_loadRealInstance(); } - return $this->company->offsetGet(0); + return $this->company; } /** - * @return ObjectStorage + * @return Company|NULL */ - public function getCompanies(): ObjectStorage { + public function getFirstCompany(): ?Company { if ($this->company instanceof LazyLoadingProxy) { $this->company->_loadRealInstance(); } - return $this->company; + if ($this->company->count() === 0) { + return NULL; + } + return $this->company->offsetGet(0); } /** diff --git a/Classes/Domain/Model/JobApplication.php b/Classes/Domain/Model/JobApplication.php index afbf630c17a4663cd0afe8f52dbdb7d3130afeb1..a19e4a26c2f8c0408ebcaeac275145c3601b87ec 100644 --- a/Classes/Domain/Model/JobApplication.php +++ b/Classes/Domain/Model/JobApplication.php @@ -53,7 +53,7 @@ class JobApplication extends AbstractEntity { * @var ObjectStorage<Company> */ #[Lazy] - protected $company; + protected $company = NULL; /** * @var Job $job @@ -477,13 +477,21 @@ class JobApplication extends AbstractEntity { } /** - * @return Company|NULL + * @return ObjectStorage|NULL */ public function getCompany() { if ($this->company instanceof LazyLoadingProxy) { $this->company->_loadRealInstance(); } + return $this->company; + } + + public function getFirstCompany(): ?Company { + if ($this->company instanceof LazyLoadingProxy) { + $this->company->_loadRealInstance(); + } + if ($this->company->count() === 0) { return NULL; } diff --git a/Classes/Domain/Repository/JobRepository.php b/Classes/Domain/Repository/JobRepository.php index 7c1acccd61c05aa7779c7220986252e90ea503f9..ca99220f4439cd2b6fc353ac2f34f9ddaa142979 100644 --- a/Classes/Domain/Repository/JobRepository.php +++ b/Classes/Domain/Repository/JobRepository.php @@ -339,7 +339,7 @@ class JobRepository extends Repository { $query->getQuerySettings()->setRespectStoragePage(FALSE); } - $company = $job->getCompany(); + $company = $job->getFirstCompany(); $department = $job->getDepartment(); if ($limit > 0) { diff --git a/Configuration/SgMail/ApplicantMail.php b/Configuration/SgMail/ApplicantMail.php index f83256bc39da121c2fcf9cf974158cc69d8d0512..037178259e4a4204645f4e01239466de3dc9fc04 100644 --- a/Configuration/SgMail/ApplicantMail.php +++ b/Configuration/SgMail/ApplicantMail.php @@ -26,7 +26,7 @@ EOT 'description' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang.xlf:application_mail.marker.jobtitle' ], [ - 'marker' => 'application.company.location', + 'marker' => 'application.firstCompany.location', 'type' => MailTemplateService::MARKER_TYPE_STRING, 'value' => 'München', 'description' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang.xlf:application_mail.marker.location' diff --git a/Configuration/SgMail/ApplicationMail.php b/Configuration/SgMail/ApplicationMail.php index a0e9197c07b9c5b2ce96412b6871bd0bb175e9b3..36e187c592ec5279374d325508d689c392b83391 100644 --- a/Configuration/SgMail/ApplicationMail.php +++ b/Configuration/SgMail/ApplicationMail.php @@ -8,7 +8,7 @@ return [ 'description' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang.xlf:mail.application.description', 'subject' => 'Eine neue Bewerbung', 'templateContent' => <<<EOT -Eine neue {f:if(condition: '{application.jobTitle}', then: 'Bewerbung als <b>{application.jobTitle}</b> für den Standort <b>{application.company.city}</b>.', else: 'Initiativbewerbung für den Standort <b>{application.company.city}</b>.')} +Eine neue {f:if(condition: '{application.jobTitle}', then: 'Bewerbung als <b>{application.jobTitle}</b> für den Standort <b>{application.firstCompany.city}</b>.', else: 'Initiativbewerbung für den Standort <b>{application.firstCompany.city}</b>.')} Geschlecht: {f:translate(key: 'frontend.apply.gender.{application.gender}', extensionName: 'SgJobs')} @@ -51,7 +51,7 @@ EOT 'description' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang.xlf:application_mail.marker.jobtitle' ], [ - 'marker' => 'application.company.location', + 'marker' => 'application.firstCompany.location', 'type' => MailTemplateService::MARKER_TYPE_STRING, 'value' => 'München', 'description' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang.xlf:application_mail.marker.location' diff --git a/Configuration/TCA/tx_sgjobs_domain_model_job.php b/Configuration/TCA/tx_sgjobs_domain_model_job.php index dc086e2343498e2cca079c9dea883bdb11f5a0a2..b434ac1c59d4bf35151c836647244a350eed0775 100644 --- a/Configuration/TCA/tx_sgjobs_domain_model_job.php +++ b/Configuration/TCA/tx_sgjobs_domain_model_job.php @@ -311,6 +311,7 @@ $columns = [ 'foreign_table' => 'tx_sgjobs_domain_model_company', 'foreign_table_where' => ' AND tx_sgjobs_domain_model_company.sys_language_uid IN (0,-1) ORDER BY tx_sgjobs_domain_model_company.sorting ASC', 'minitems' => 1, + 'multiple' => 1, 'fieldControl' => [ 'editPopup' => [ 'disabled' => FALSE, diff --git a/Resources/Private/Partials/ApplyFormSchema.html b/Resources/Private/Partials/ApplyFormSchema.html index ab35b14a548385cadb9a3b960bd5e8f7d3602a0f..00efd97b8fcc21c32669b6d902efef10131c23d3 100644 --- a/Resources/Private/Partials/ApplyFormSchema.html +++ b/Resources/Private/Partials/ApplyFormSchema.html @@ -76,8 +76,8 @@ "hiringOrganization": {leftBrace} "@type": "Organization", - "name": "{job.company.name}", - "sameAs": "{f:uri.typolink(parameter: job.company.identifyingUrl, absolute: 'TRUE')}", + "name": "{job.firstCompany.name}", + "sameAs": "{f:uri.typolink(parameter: job.firstCompany.identifyingUrl, absolute: 'TRUE')}", "department": {leftBrace} "@type": "Organization", "name": "{job.department.title}" diff --git a/Resources/Private/Partials/Backend/Filter.html b/Resources/Private/Partials/Backend/Filter.html index affedb3fbb6d250b6e97bdd65e34487ccb1dc3f1..fd5293af87184d2860313dc7ae2bfdb6de40d95a 100644 --- a/Resources/Private/Partials/Backend/Filter.html +++ b/Resources/Private/Partials/Backend/Filter.html @@ -14,6 +14,7 @@ optionLabelField="name" optionValueField="city" options="{locationOptions}" + value="{filters.locations}" id="filter-locations" /> <small> <f:format.raw><f:translate key="backend.filters.locations.description" /></f:format.raw> @@ -23,7 +24,7 @@ <div class="col-xs-6 col-6 col-sm-6"> <div class="form-group"> <label for="filter-search"><f:translate key="backend.filters.search" /></label> - <f:form.textfield class="reset-me form-control" property="search" id="filter-search" /> + <f:form.textfield class="reset-me form-control" value="{filters.search}" property="search" id="filter-search" /> </div> </div> <div class="form-group"> diff --git a/Resources/Private/Templates/Backend/Index.html b/Resources/Private/Templates/Backend/Index.html index 03f386983edcf64a514ab518deeb73ac58caf541..b2f26076200995e6212db005bbb6a13e7754d814 100644 --- a/Resources/Private/Templates/Backend/Index.html +++ b/Resources/Private/Templates/Backend/Index.html @@ -46,7 +46,7 @@ </td> <td> <be:link.editRecord uid="{job.uid}" table="tx_sgjobs_domain_model_job"> - <span>{job.title} - <sg:backend.companyLabel uid="{job.uid}" companyraw="{job.company}"></sg:backend.companyLabel> </span> + <span>{job.title} - <sg:backend.companyLabel uid="{job.uid}" companyraw="{job.firstCompany}"></sg:backend.companyLabel> </span> </be:link.editRecord> </td> <td nowrap="nowrap" class="col-control"> diff --git a/Resources/Private/Templates/Joblist/ApplyForm.html b/Resources/Private/Templates/Joblist/ApplyForm.html index 68110fb631f8441946def34a2c4436dc728a928b..99443c5e2cf12051b2342ecb9e6d20747c279d0e 100644 --- a/Resources/Private/Templates/Joblist/ApplyForm.html +++ b/Resources/Private/Templates/Joblist/ApplyForm.html @@ -91,13 +91,13 @@ <f:if condition="!{job.hideApplyByPostal}"> <p> <f:format.raw><f:translate key="frontend.job.via.post" /></f:format.raw><br> - {job.company.name}<br> + {job.firstCompany.name}<br> <f:if condition="{job.contact}"> <f:then> {job.contact.title} {job.contact.firstName} {job.contact.lastName}<br> </f:then> <f:else> - {job.company.contact.title} {job.company.contact.firstName} {job.company.contact.lastName}<br> + {job.firstCompany.contact.title} {job.firstCompany.contact.firstName} {job.firstCompany.contact.lastName}<br> </f:else> </f:if> <f:if condition="{job.contact} && {job.contact.street}"> @@ -112,25 +112,25 @@ </f:if> </f:then> <f:else> - <f:if condition="{job.company.contact} && {job.company.contact.street}"> + <f:if condition="{job.firstCompany.contact} && {job.firstCompany.contact.street}"> <f:then> - {job.company.contact.street}<br> - <f:if condition="{job.company.contact.state}"> - {job.company.contact.state}<br> + {job.firstCompany.contact.street}<br> + <f:if condition="{job.firstCompany.contact.state}"> + {job.firstCompany.contact.state}<br> </f:if> - {job.company.contact.zip} {job.company.contact.city} - <f:if condition="{job.company.contact.country}"> - <br>{job.company.contact.country} + {job.firstCompany.contact.zip} {job.firstCompany.contact.city} + <f:if condition="{job.firstCompany.contact.country}"> + <br>{job.firstCompany.contact.country} </f:if> </f:then> <f:else> - {job.company.street}<br> - <f:if condition="{job.company.state}"> - {job.company.state}<br> + {job.firstCompany.street}<br> + <f:if condition="{job.firstCompany.state}"> + {job.firstCompany.state}<br> </f:if> - {job.company.zip} {job.company.city} - <f:if condition="{job.company.country}"> - <br>{job.company.country} + {job.firstCompany.zip} {job.firstCompany.city} + <f:if condition="{job.firstCompany.country}"> + <br>{job.firstCompany.country} </f:if> </f:else> </f:if> @@ -149,7 +149,7 @@ <f:format.html parseFuncTSPath="lib.parseFunc"><a href="mailto:{job.contact.email}"><f:translate key="frontend.emailContact"/></a></f:format.html> </f:then> <f:else> - <f:format.html parseFuncTSPath="lib.parseFunc"><a href="mailto:{job.company.contact.email}"><f:translate key="frontend.emailContact"/></a></f:format.html> + <f:format.html parseFuncTSPath="lib.parseFunc"><a href="mailto:{job.firstCompany.contact.email}"><f:translate key="frontend.emailContact"/></a></f:format.html> </f:else> </f:if> </p> @@ -170,7 +170,7 @@ <f:render section="contactBox" arguments="{contact: job.contact, hideApplyByEmail: job.hideApplyByEmail}" /> </f:then> <f:else> - <f:render section="contactBox" arguments="{contact: job.company.contact, hideApplyByEmail: job.hideApplyByEmail}" /> + <f:render section="contactBox" arguments="{contact: job.firstCompany.contact, hideApplyByEmail: job.hideApplyByEmail}" /> </f:else> </f:if> <f:if condition="{job.attachment}"> diff --git a/composer.json b/composer.json index 602d86b1e3bc35ea372b9786cd3cbad76af06f72..a79f8c8ebc2f1dc96db3af8d7c8fa977c3b8ec3a 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": [ "GPL-2.0-or-later" ], - "version": "6.0.0-dev", + "version": "5.7.4", "support": { "issues": "https://gitlab.sgalinski.de/typo3/sg_jobs" }, diff --git a/ext_emconf.php b/ext_emconf.php index 17d74dc8f409fb03bd715e4251c7e46dd03d967b..76a64a921ef942644ac0509ea172df5ad51fd4c5 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,7 +4,7 @@ $EM_CONF['sg_jobs'] = [ 'title' => 'Jobs', 'description' => 'Manage and display your Job offers.', 'category' => 'plugin', - 'version' => '6.0.0-dev', + 'version' => '5.7.4', 'state' => 'stable', 'author' => 'Stefan Galinski', 'author_email' => 'stefan@sgalinski.de',