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

[FEATURE] Much code cleanup, show jobs in all language even without translation

parent 59d3a607
No related branches found
No related tags found
No related merge requests found
...@@ -49,19 +49,19 @@ class BackendController extends ActionController { ...@@ -49,19 +49,19 @@ class BackendController extends ActionController {
* *
* @var DocHeaderComponent * @var DocHeaderComponent
*/ */
protected $docHeaderComponent; protected DocHeaderComponent $docHeaderComponent;
/** /**
* @var CompanyRepository * @var CompanyRepository
* *
*/ */
protected $companyRepository; protected CompanyRepository $companyRepository;
/** /**
* @var JobRepository * @var JobRepository
* *
*/ */
protected $jobRepository; protected JobRepository $jobRepository;
/** /**
* Inject the CompanyRepository * Inject the CompanyRepository
...@@ -86,7 +86,7 @@ class BackendController extends ActionController { ...@@ -86,7 +86,7 @@ class BackendController extends ActionController {
* *
* @param array $filters * @param array $filters
* @return \Psr\Http\Message\ResponseInterface|null * @return \Psr\Http\Message\ResponseInterface|null
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException|\TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/ */
public function indexAction(array $filters = []): ?\Psr\Http\Message\ResponseInterface { public function indexAction(array $filters = []): ?\Psr\Http\Message\ResponseInterface {
$pageUid = (int) GeneralUtility::_GP('id'); $pageUid = (int) GeneralUtility::_GP('id');
...@@ -145,10 +145,10 @@ class BackendController extends ActionController { ...@@ -145,10 +145,10 @@ class BackendController extends ActionController {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
$this->view->assign('V11', FALSE); $this->view->assign('V11', FALSE);
return NULL; return NULL;
} else {
$this->view->assign('V11', TRUE);
return $this->createBackendResponse();
} }
$this->view->assign('V11', TRUE);
return $this->createBackendResponse();
} }
/** /**
......
...@@ -37,7 +37,7 @@ class JobTeaserController extends ActionController { ...@@ -37,7 +37,7 @@ class JobTeaserController extends ActionController {
/** /**
* @var JobRepository * @var JobRepository
*/ */
protected $jobRepository; protected JobRepository $jobRepository;
/** /**
* @param JobRepository $jobRepository * @param JobRepository $jobRepository
...@@ -69,13 +69,14 @@ class JobTeaserController extends ActionController { ...@@ -69,13 +69,14 @@ class JobTeaserController extends ActionController {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
return NULL; return NULL;
} else {
return $this->htmlResponse();
} }
return $this->htmlResponse();
} }
/** /**
* Build Typo3 11 Response * Build Typo3 11 Response
*
* @param string|NULL $html * @param string|NULL $html
* @return \Psr\Http\Message\ResponseInterface * @return \Psr\Http\Message\ResponseInterface
*/ */
......
...@@ -26,6 +26,7 @@ namespace SGalinski\SgJobs\Controller; ...@@ -26,6 +26,7 @@ namespace SGalinski\SgJobs\Controller;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use Psr\Http\Message\ResponseInterface;
use SGalinski\ProjectBase\Domain\Repository\CountryRepository; use SGalinski\ProjectBase\Domain\Repository\CountryRepository;
use SGalinski\SgJobs\Domain\Model\Company; use SGalinski\SgJobs\Domain\Model\Company;
use SGalinski\SgJobs\Domain\Model\Job; use SGalinski\SgJobs\Domain\Model\Job;
...@@ -39,8 +40,16 @@ use SGalinski\SgJobs\Service\FileAndFolderService; ...@@ -39,8 +40,16 @@ use SGalinski\SgJobs\Service\FileAndFolderService;
use SGalinski\SgMail\Service\MailTemplateService; use SGalinski\SgMail\Service\MailTemplateService;
use SGalinski\SgSeo\Service\HeadTagService; use SGalinski\SgSeo\Service\HeadTagService;
use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Error\Http\PageNotFoundException;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Http\ImmediateResponseException; use TYPO3\CMS\Core\Http\ImmediateResponseException;
use TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException;
use TYPO3\CMS\Core\Resource\Exception\ExistingTargetFolderException;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderReadPermissionsException;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException;
use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
...@@ -73,32 +82,32 @@ class JoblistController extends ActionController { ...@@ -73,32 +82,32 @@ class JoblistController extends ActionController {
/** /**
* @var CompanyRepository * @var CompanyRepository
*/ */
protected $companyRepository; protected CompanyRepository $companyRepository;
/** /**
* @var JobRepository * @var JobRepository
*/ */
protected $jobRepository; protected JobRepository $jobRepository;
/** /**
* @var JobApplicationRepository * @var JobApplicationRepository
*/ */
protected $jobApplicationRepository; protected JobApplicationRepository $jobApplicationRepository;
/** /**
* @var DepartmentRepository * @var DepartmentRepository
*/ */
protected $departmentRepository; protected DepartmentRepository $departmentRepository;
/** /**
* @var ExperienceLevelRepository * @var ExperienceLevelRepository
*/ */
protected $experienceLevelRepository; protected ExperienceLevelRepository $experienceLevelRepository;
/** /**
* @var FileAndFolderService * @var FileAndFolderService
*/ */
protected $fileAndFolderService; protected FileAndFolderService $fileAndFolderService;
/** /**
* Inject the CompanyRepository * Inject the CompanyRepository
...@@ -112,7 +121,7 @@ class JoblistController extends ActionController { ...@@ -112,7 +121,7 @@ class JoblistController extends ActionController {
/** /**
* Inject the CompanyRepository * Inject the CompanyRepository
* *
* @param CompanyRepository $companyRepository * @param FileAndFolderService $fileAndFolderService
*/ */
public function injectFileAndFolderService(FileAndFolderService $fileAndFolderService): void { public function injectFileAndFolderService(FileAndFolderService $fileAndFolderService): void {
$this->fileAndFolderService = $fileAndFolderService; $this->fileAndFolderService = $fileAndFolderService;
...@@ -156,13 +165,10 @@ class JoblistController extends ActionController { ...@@ -156,13 +165,10 @@ class JoblistController extends ActionController {
/** /**
* Initialize the indexAction to set the currentPageBrowserPage parameter * Initialize the indexAction to set the currentPageBrowserPage parameter
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
*/ */
public function initializeIndexAction() { public function initializeIndexAction(): void {
$currentPageBrowserPage = GeneralUtility::_GP('tx_sgjobs_pagebrowser') ? (int) GeneralUtility::_GP( $currentPageBrowserPage = GeneralUtility::_GP('tx_sgjobs_pagebrowser') ?
'tx_sgjobs_pagebrowser' (int) GeneralUtility::_GP('tx_sgjobs_pagebrowser')['currentPage'] : 0;
)['currentPage'] : 0;
if ($currentPageBrowserPage > 0) { if ($currentPageBrowserPage > 0) {
$this->request->setArgument('currentPageBrowserPage', $currentPageBrowserPage); $this->request->setArgument('currentPageBrowserPage', $currentPageBrowserPage);
} }
...@@ -172,18 +178,18 @@ class JoblistController extends ActionController { ...@@ -172,18 +178,18 @@ class JoblistController extends ActionController {
* Show all job offers and options to manage them * Show all job offers and options to manage them
* *
* @param array $filters * @param array $filters
* @param int $jobId * @param int|null $jobId
* @param int $currentPageBrowserPage * @param int $currentPageBrowserPage
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException * @return ResponseInterface|null
* @throws \TYPO3\CMS\Core\Error\Http\PageNotFoundException
* @throws ImmediateResponseException * @throws ImmediateResponseException
* @throws \TYPO3\CMS\Core\Package\Exception * @throws AspectNotFoundException
* @throws PageNotFoundException
*/ */
public function indexAction( public function indexAction(
array $filters = [], array $filters = [],
int $jobId = NULL, int $jobId = NULL,
int $currentPageBrowserPage = 0 int $currentPageBrowserPage = 0
): ?\Psr\Http\Message\ResponseInterface { ): ?ResponseInterface {
if ($filters) { if ($filters) {
$this->view->assign('selectedCountry', $filters['filterCountry'] ?? ''); $this->view->assign('selectedCountry', $filters['filterCountry'] ?? '');
$this->view->assign('selectedCompany', $filters['filterCompany'] ?? ''); $this->view->assign('selectedCompany', $filters['filterCompany'] ?? '');
...@@ -264,9 +270,9 @@ class JoblistController extends ActionController { ...@@ -264,9 +270,9 @@ class JoblistController extends ActionController {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
return NULL; return NULL;
} else {
return $this->htmlResponse();
} }
return $this->htmlResponse();
} }
/** /**
...@@ -274,16 +280,17 @@ class JoblistController extends ActionController { ...@@ -274,16 +280,17 @@ class JoblistController extends ActionController {
* *
* @param JobApplication|null $applyData * @param JobApplication|null $applyData
* @param string $error * @param string $error
* @param int $jobId * @param int|null $jobId
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException * @return ResponseInterface|null
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException * @throws AspectNotFoundException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws StopActionException
* @throws SiteNotFoundException
*/ */
public function applyFormAction( public function applyFormAction(
JobApplication $applyData = NULL, JobApplication $applyData = NULL,
string $error = '', string $error = '',
int $jobId = NULL int $jobId = NULL
): ?\Psr\Http\Message\ResponseInterface { ): ?ResponseInterface {
if ($error !== '') { if ($error !== '') {
$this->view->assign('internalError', $error); $this->view->assign('internalError', $error);
$this->request->setArgument('error', NULL); $this->request->setArgument('error', NULL);
...@@ -383,9 +390,9 @@ class JoblistController extends ActionController { ...@@ -383,9 +390,9 @@ class JoblistController extends ActionController {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
return NULL; return NULL;
} else {
return $this->htmlResponse();
} }
return $this->htmlResponse();
} }
/** /**
...@@ -394,9 +401,9 @@ class JoblistController extends ActionController { ...@@ -394,9 +401,9 @@ class JoblistController extends ActionController {
* @param JobApplication $applicationData * @param JobApplication $applicationData
* @param string $folderName * @param string $folderName
* @return void * @return void
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws StopActionException
*/ */
protected function submitApplicationFiles(JobApplication $applicationData, $folderName): void { protected function submitApplicationFiles(JobApplication $applicationData, string $folderName): void {
$resourceFactory = $this->objectManager->get(ResourceFactory::class); $resourceFactory = $this->objectManager->get(ResourceFactory::class);
$newName = \date('Ymd-His') . '_' . $applicationData->getJobId() . '-' . $applicationData->getFirstName() $newName = \date('Ymd-His') . '_' . $applicationData->getJobId() . '-' . $applicationData->getFirstName()
. '-' . $applicationData->getLastName(); . '-' . $applicationData->getLastName();
...@@ -411,28 +418,9 @@ class JoblistController extends ActionController { ...@@ -411,28 +418,9 @@ class JoblistController extends ActionController {
* Pre-apply action setup, configures model-property mapping and handles file upload * Pre-apply action setup, configures model-property mapping and handles file upload
* *
* @throws NoSuchArgumentException * @throws NoSuchArgumentException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws StopActionException
*/ */
protected function initializeApplyAction() { protected function initializeApplyAction(): void {
$arguments = ($this->request->getArguments());
$parsedBody = $this->request->getParsedBody();
$uniqueFolderName = $arguments['folderName'] ?? '';
try {
$uniqueFolderName = $this->request->getArgument('folderName');
} catch (NoSuchArgumentException $exception) {
$exceptionMessage = LocalizationUtility::translate('error.NoSuchArgumentException', 'sg_jobs');
if (version_compare(
\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(),
'11.0.0',
'<'
)) {
$this->redirect('applyForm', NULL, NULL, ['error' => $exceptionMessage]);
return NULL;
} else {
return $this->redirect('applyForm', NULL, NULL, ['error' => $exceptionMessage]);
}
}
$propertyMappingConfiguration = $this->arguments->getArgument('applyData')->getPropertyMappingConfiguration(); $propertyMappingConfiguration = $this->arguments->getArgument('applyData')->getPropertyMappingConfiguration();
$propertyMappingConfiguration->forProperty('job')->allowAllProperties(); $propertyMappingConfiguration->forProperty('job')->allowAllProperties();
...@@ -453,11 +441,11 @@ class JoblistController extends ActionController { ...@@ -453,11 +441,11 @@ class JoblistController extends ActionController {
* Saves the application send by the applyFormAction * Saves the application send by the applyFormAction
* *
* @param JobApplication $applyData * @param JobApplication $applyData
* @return ResponseInterface|null
* @throws NoSuchArgumentException * @throws NoSuchArgumentException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException * @throws StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/ */
public function applyAction(JobApplication $applyData): ?\Psr\Http\Message\ResponseInterface { public function applyAction(JobApplication $applyData): ?ResponseInterface {
$folderName = $this->request->getArgument('folderName'); $folderName = $this->request->getArgument('folderName');
try { try {
...@@ -560,18 +548,18 @@ class JoblistController extends ActionController { ...@@ -560,18 +548,18 @@ class JoblistController extends ActionController {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
return NULL; return NULL;
} else {
return $this->htmlResponse();
} }
return $this->htmlResponse();
} }
/** /**
* Assign filter values * Assign filter values
* *
* @param int $rootPageId * @param int $rootPageId
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException * @throws AspectNotFoundException
*/ */
protected function assignFilterValues($rootPageId): void { protected function assignFilterValues(int $rootPageId): void {
$countries = $this->companyRepository->getAllCountries($rootPageId); $countries = $this->companyRepository->getAllCountries($rootPageId);
$this->view->assign('countries', $countries); $this->view->assign('countries', $countries);
...@@ -620,9 +608,9 @@ class JoblistController extends ActionController { ...@@ -620,9 +608,9 @@ class JoblistController extends ActionController {
* *
* @param JobApplication $data * @param JobApplication $data
* @param string $filePath * @param string $filePath
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws StopActionException
*/ */
protected function writeApplicationFile(JobApplication $data, $filePath): void { protected function writeApplicationFile(JobApplication $data, string $filePath): void {
$coverLetter = ''; $coverLetter = '';
$coverLetterObject = $data->getCoverLetter(); $coverLetterObject = $data->getCoverLetter();
if ($coverLetterObject) { if ($coverLetterObject) {
...@@ -684,14 +672,15 @@ class JoblistController extends ActionController { ...@@ -684,14 +672,15 @@ class JoblistController extends ActionController {
* Move the temp folder to its proper location * Move the temp folder to its proper location
* *
* @param string $folderName * @param string $folderName
* @throws \TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException * @param JobApplication $applicationData
* @throws \TYPO3\CMS\Core\Resource\Exception\ExistingTargetFolderException * @throws TypeConverterException
* @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException * @throws ExistingTargetFileNameException
* @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException * @throws ExistingTargetFolderException
* @throws InsufficientFolderAccessPermissionsException
* @throws InsufficientFolderReadPermissionsException
* @throws InsufficientFolderWritePermissionsException
*/ */
protected function moveTmpFolder(string $folderName, JobApplication $applicationData): void { protected function moveTmpFolder(string $folderName, JobApplication $applicationData): void {
$filePathInfo = [];
$namesToMove = [];
$allowedFileExtensions = $this->getAllowedFileExtensions(); $allowedFileExtensions = $this->getAllowedFileExtensions();
/** @var ResourceFactory $resourceFactory */ /** @var ResourceFactory $resourceFactory */
...@@ -712,35 +701,39 @@ class JoblistController extends ActionController { ...@@ -712,35 +701,39 @@ class JoblistController extends ActionController {
if (array_key_exists($singleFilePostKey, $_POST)) { if (array_key_exists($singleFilePostKey, $_POST)) {
foreach ($_POST[$singleFilePostKey] as $singleUploadedArr) { foreach ($_POST[$singleFilePostKey] as $singleUploadedArr) {
$filePathInfo = PathUtility::pathinfo($singleUploadedArr['path']); $filePathInfo = PathUtility::pathinfo($singleUploadedArr['path']);
$namesToMove[] = $filePathInfo['basename'];
if (!GeneralUtility::inList($allowedFileExtensions, strtolower($filePathInfo['extension']))) { if (!GeneralUtility::inList($allowedFileExtensions, strtolower($filePathInfo['extension']))) {
throw new TypeConverterException(LocalizationUtility::translate('error.TypeConverterException.type', 'sg_jobs'), 1399312430); throw new TypeConverterException(
LocalizationUtility::translate('error.TypeConverterException.type', 'sg_jobs'), 1399312430
);
} }
if (!$newFolder->hasFile($filePathInfo['basename'])) { if (!$newFolder->hasFile($filePathInfo['basename'])) {
/** @noinspection PhpUnreachableStatementInspection */
$singleFileToMove = $storage->getFileInFolder($filePathInfo['basename'], $tempFolder); $singleFileToMove = $storage->getFileInFolder($filePathInfo['basename'], $tempFolder);
// when we reload etc this image might already be moved. // when we reload etc. this image might already be moved.
$usableFile = $storage->moveFile($singleFileToMove, $newFolder); $usableFile = $storage->moveFile($singleFileToMove, $newFolder);
} else { } else {
/** @noinspection PhpUnreachableStatementInspection */
$usableFile = $newFolder->getFile($filePathInfo['basename']); $usableFile = $newFolder->getFile($filePathInfo['basename']);
} }
$fileReference = $this->fileAndFolderService->createFileReferenceFromFalFileObject($usableFile); $fileReference = $this->fileAndFolderService->createFileReferenceFromFalFileObject($usableFile);
if ($fileReference) { if ($singleFilePostKey === 'coverLetter') {
if ($singleFilePostKey === 'coverLetter') { $applicationData->setCoverLetter($fileReference);
$applicationData->setCoverLetter($fileReference); }
} if ($singleFilePostKey === 'cv') {
if ($singleFilePostKey === 'cv') { $applicationData->setCV($fileReference);
$applicationData->setCV($fileReference); }
} if ($singleFilePostKey === 'certificate') {
if ($singleFilePostKey === 'certificate') { $applicationData->setCertificate($fileReference);
$applicationData->setCertificate($fileReference);
}
} }
continue;
} }
} else { } else {
throw new TypeConverterException(LocalizationUtility::translate('error.TypeConverterException.missing.' . $singleFilePostKey, 'sg_jobs'), 1399312430); throw new TypeConverterException(
LocalizationUtility::translate(
'error.TypeConverterException.missing.' . $singleFilePostKey, 'sg_jobs'
), 1399312430
);
} }
} }
} }
...@@ -759,7 +752,7 @@ class JoblistController extends ActionController { ...@@ -759,7 +752,7 @@ class JoblistController extends ActionController {
* *
* @param string $folderName * @param string $folderName
*/ */
protected function deleteTmpFolder($folderName): void { protected function deleteTmpFolder(string $folderName): void {
/** @var ResourceFactory $resourceFactory */ /** @var ResourceFactory $resourceFactory */
$resourceFactory = $this->objectManager->get(ResourceFactory::class); $resourceFactory = $this->objectManager->get(ResourceFactory::class);
$storage = $resourceFactory->getStorageObject(1); $storage = $resourceFactory->getStorageObject(1);
...@@ -774,7 +767,7 @@ class JoblistController extends ActionController { ...@@ -774,7 +767,7 @@ class JoblistController extends ActionController {
/** /**
* If for any reason something goes wrong, delete the tmp upload folder * If for any reason something goes wrong, delete the tmp upload folder
* *
* @return mixed * @return ResponseInterface
* @throws NoSuchArgumentException * @throws NoSuchArgumentException
*/ */
public function errorAction() { public function errorAction() {
...@@ -787,12 +780,12 @@ class JoblistController extends ActionController { ...@@ -787,12 +780,12 @@ class JoblistController extends ActionController {
} }
/** /**
* Build Typo3 11 Response * Build TYPO3 11 Response
* *
* @param string|NULL $html * @param string|NULL $html
* @return \Psr\Http\Message\ResponseInterface * @return ResponseInterface
*/ */
protected function htmlResponse(string $html = NULL): \Psr\Http\Message\ResponseInterface { protected function htmlResponse(string $html = NULL): ResponseInterface {
return $this->responseFactory->createResponse() return $this->responseFactory->createResponse()
->withHeader('Content-Type', 'text/html; charset=utf-8') ->withHeader('Content-Type', 'text/html; charset=utf-8')
->withBody($this->streamFactory->createStream($html ?? $this->view->render())); ->withBody($this->streamFactory->createStream($html ?? $this->view->render()));
......
...@@ -56,10 +56,10 @@ class JobRepository extends Repository { ...@@ -56,10 +56,10 @@ class JobRepository extends Repository {
* @param array $filters * @param array $filters
* @param int $limit * @param int $limit
* @param int $offset * @param int $offset
* @return mixed * @return ExtbaseQueryResultInterface|object[]
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
*/ */
public function findBackendJobs($recordPageId, array $filters = [], $limit = 0, $offset = 0) { public function findBackendJobs(int $recordPageId, array $filters = [], int $limit = 0, int $offset = 0) {
$query = $this->createQuery(); $query = $this->createQuery();
$query->setOrderings( $query->setOrderings(
[ [
...@@ -166,13 +166,18 @@ class JobRepository extends Repository { ...@@ -166,13 +166,18 @@ class JobRepository extends Repository {
*/ */
public function findJobsByFilter( public function findJobsByFilter(
array $filters = [], array $filters = [],
$limit = 0, int $limit = 0,
$offset = 0, int $offset = 0,
$ordering = 0 int $ordering = 0
): ExtbaseQueryResultInterface { ): ExtbaseQueryResultInterface {
$query = $this->createQuery(); $query = $this->createQuery();
$storagePageIds = $query->getQuerySettings()->getStoragePageIds(); $storagePageIds = $query->getQuerySettings()->getStoragePageIds();
// we always show all jobs (translated or only created in the specific language)
$querySettings = $query->getQuerySettings();
$querySettings->setLanguageOverlayMode(FALSE);
$query->setQuerySettings($querySettings);
if (empty($storagePageIds)) { if (empty($storagePageIds)) {
// if no record storage page has been selected in the plugin, ignore it // if no record storage page has been selected in the plugin, ignore it
$query->getQuerySettings()->setRespectStoragePage(FALSE); $query->getQuerySettings()->setRespectStoragePage(FALSE);
......
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