Skip to content
Snippets Groups Projects
Commit c12133d3 authored by Matthias Adrowski's avatar Matthias Adrowski
Browse files

[TASK] Remove global option preventing manual sorting

parent e247483d
No related branches found
No related tags found
No related merge requests found
...@@ -121,34 +121,13 @@ class BackendController extends ActionController { ...@@ -121,34 +121,13 @@ class BackendController extends ActionController {
$this->view->assign('pageUid', $pageUid); $this->view->assign('pageUid', $pageUid);
$this->view->assign('pages', BackendService::getPagesWithJobRecords()); $this->view->assign('pages', BackendService::getPagesWithJobRecords());
$sortingData = [];
if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting'] && count($filters) <= 0) {
/**
* Somehow the pId is changed so data gets lost.
*
*
* $previousUid = 0;
* $sortingData = [];
* foreach ($jobs as $job) {
* if ($previousUid) {
* $sortingData['prev'][$job->getUid()] = $previousUid;
* $sortingData['next'][$previousUid] = $job->getUid();
* }
* $previousUid = $job->getUid();
* }
*/
$this->view->assign('manualSortingDestroysEverything', TRUE);
}
$this->view->assign('sortingData', $sortingData);
$jobs = $this->jobRepository->findBackendJobs($pageUid, $filters, $itemsPerPage); $jobs = $this->jobRepository->findBackendJobs($pageUid, $filters, $itemsPerPage);
$paginator = new QueryResultRawPaginator($jobs); $paginator = new QueryResultRawPaginator($jobs, $currentPage, $itemsPerPage);
$pagination = new SimplePagination($paginator); $pagination = new SimplePagination($paginator);
$this->view->assign('paginator', $paginator); $this->view->assign('paginator', $paginator);
$this->view->assign('pagination', $pagination); $this->view->assign('pagination', $pagination);
$totalJobCount = \count($jobs); $totalJobCount = \count($jobs);
$this->view->assign('totalJobCount', $totalJobCount); $this->view->assign('totalJobCount', $totalJobCount);
$isManualSortingAllowed = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting'];
// get all Locations // get all Locations
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
/** @var QueryResultInterface $companies */ /** @var QueryResultInterface $companies */
...@@ -156,7 +135,6 @@ class BackendController extends ActionController { ...@@ -156,7 +135,6 @@ class BackendController extends ActionController {
$this->view->assign('locationOptions', $companies); $this->view->assign('locationOptions', $companies);
$this->view->assign('isAdmin', $GLOBALS['BE_USER']->isAdmin()); $this->view->assign('isAdmin', $GLOBALS['BE_USER']->isAdmin());
$this->view->assign('isManualSortingAllowed', $isManualSortingAllowed);
$this->view->assign('filters', $filters); $this->view->assign('filters', $filters);
$this->view->assign('jobs', $jobs); $this->view->assign('jobs', $jobs);
if (!$totalJobCount && $pageUid) { if (!$totalJobCount && $pageUid) {
......
...@@ -238,8 +238,6 @@ class JoblistController extends ActionController { ...@@ -238,8 +238,6 @@ class JoblistController extends ActionController {
); );
$frontendPluginSettings = $frontendPluginSettings['settings']; $frontendPluginSettings = $frontendPluginSettings['settings'];
$isManualSortingAllowed = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting'];
// get all jobs for the current page // get all jobs for the current page
$ordering = (int) $frontendPluginSettings['orderBy']; $ordering = (int) $frontendPluginSettings['orderBy'];
$experienceLevel = (int) $frontendPluginSettings['filterByExperienceLevel']; $experienceLevel = (int) $frontendPluginSettings['filterByExperienceLevel'];
...@@ -248,7 +246,6 @@ class JoblistController extends ActionController { ...@@ -248,7 +246,6 @@ class JoblistController extends ActionController {
$filters['filterExperienceLevel'] = $experienceLevel; $filters['filterExperienceLevel'] = $experienceLevel;
} }
$this->jobRepository->setAllowManualSorting((bool) $isManualSortingAllowed);
$jobs = $this->jobRepository->findJobsByFilter($filters, $jobLimit, $offset, $ordering)->toArray(); $jobs = $this->jobRepository->findJobsByFilter($filters, $jobLimit, $offset, $ordering)->toArray();
// get all jobs for the current page // get all jobs for the current page
......
...@@ -45,11 +45,6 @@ class JobRepository extends Repository { ...@@ -45,11 +45,6 @@ class JobRepository extends Repository {
public const ORDER_BY_CRDATE = 2; public const ORDER_BY_CRDATE = 2;
public const ORDER_BY_SORTING = 0; public const ORDER_BY_SORTING = 0;
/**
* @var bool $allowManualSorting
*/
protected $allowManualSorting = FALSE;
public function __construct(ObjectManagerInterface $objectManager) { public function __construct(ObjectManagerInterface $objectManager) {
parent::__construct($objectManager); parent::__construct($objectManager);
$querySettings = $objectManager->get(Typo3QuerySettings::class); $querySettings = $objectManager->get(Typo3QuerySettings::class);
...@@ -57,20 +52,6 @@ class JobRepository extends Repository { ...@@ -57,20 +52,6 @@ class JobRepository extends Repository {
$this->setDefaultQuerySettings($querySettings); $this->setDefaultQuerySettings($querySettings);
} }
/**
* @return bool
*/
public function isAllowManualSorting(): bool {
return $this->allowManualSorting;
}
/**
* @param bool $allowManualSorting
*/
public function setAllowManualSorting(bool $allowManualSorting): void {
$this->allowManualSorting = $allowManualSorting;
}
/** /**
* Queries the job records based on filters (for the backend) * Queries the job records based on filters (for the backend)
* *
...@@ -200,7 +181,7 @@ class JobRepository extends Repository { ...@@ -200,7 +181,7 @@ class JobRepository extends Repository {
$query->getQuerySettings()->setRespectStoragePage(FALSE); $query->getQuerySettings()->setRespectStoragePage(FALSE);
} }
if ($ordering === self::ORDER_BY_TITLE || (!$this->allowManualSorting && $ordering === self::ORDER_BY_SORTING)) { if ($ordering === self::ORDER_BY_TITLE) {
$query->setOrderings( $query->setOrderings(
[ [
'title' => QueryInterface::ORDER_ASCENDING, 'title' => QueryInterface::ORDER_ASCENDING,
...@@ -216,7 +197,7 @@ class JobRepository extends Repository { ...@@ -216,7 +197,7 @@ class JobRepository extends Repository {
); );
} }
if ($ordering === self::ORDER_BY_SORTING && $this->allowManualSorting) { if ($ordering === self::ORDER_BY_SORTING) {
$query->setOrderings( $query->setOrderings(
[ [
'sorting' => QueryInterface::ORDER_ASCENDING 'sorting' => QueryInterface::ORDER_ASCENDING
......
...@@ -122,10 +122,6 @@ ...@@ -122,10 +122,6 @@
<source><![CDATA[Item]]></source> <source><![CDATA[Item]]></source>
<target><![CDATA[Eintrag]]></target> <target><![CDATA[Eintrag]]></target>
</trans-unit> </trans-unit>
<trans-unit id="backend.manualSortingBug" approved="yes">
<source><![CDATA[Manual sorting is currently not working. You can do that in the List module.]]></source>
<target><![CDATA[Die manuelle Sortierung ist derzeit leider fehlerbehaftet. Sie können die Reihenfolge in dem Listen-Modul ändern.]]></target>
</trans-unit>
<trans-unit id="backend.message.error" approved="yes"> <trans-unit id="backend.message.error" approved="yes">
<source><![CDATA[Something went wrong. Please reload.]]></source> <source><![CDATA[Something went wrong. Please reload.]]></source>
<target><![CDATA[Etwas ist schiefgelaufen. Bitte laden Sie die Seite neu.]]></target> <target><![CDATA[Etwas ist schiefgelaufen. Bitte laden Sie die Seite neu.]]></target>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
- Job location field is deprecated, use different Companies instead; job.location is unused in default templates/settings - Job location field is deprecated, use different Companies instead; job.location is unused in default templates/settings
- Dropped support for sg_seo < 6.0 - Dropped support for sg_seo < 6.0
- Dropped support for sg_mail < 8.0 - Dropped support for sg_mail < 8.0
- global manual sorting extension setting has been dropped
## Version 4 Breaking Changes ## Version 4 Breaking Changes
......
# cat=plugin.tx_sgjobs/other; type=boolean; label=Enable manual sorting
allowManualSorting = 0
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