Scrutinizer fixes
This commit is contained in:
parent
8d8fc1caa9
commit
77cb18429f
|
@ -216,9 +216,6 @@ class CalendarController extends AbstractController
|
|||
return;
|
||||
}
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
|
||||
->getQueryBuilderForTable('tx_dlf_documents');
|
||||
|
||||
// Get all children of anchor. This should be the year anchor documents
|
||||
$documents = $this->documentRepository->getChildrenOfYearAnchor($this->doc->cPid, $this->doc->uid, 'year');
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Kitodo\Dlf\Controller;
|
|||
|
||||
use Kitodo\Dlf\Common\Document;
|
||||
use Kitodo\Dlf\Domain\Repository\LibraryRepository;
|
||||
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
|
|
|
@ -223,13 +223,13 @@ class MetadataController extends AbstractController
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$metadataResult = $this->metadataRepository->getMetadata($this->settings['pages'], $GLOBALS['TSFE']->sys_language_uid);
|
||||
$context = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class);
|
||||
$currentLanguageUid = $context->getPropertyFromAspect('language', 'id');
|
||||
|
||||
$metadataResult = $this->metadataRepository->getMetadata($this->settings['pages'], $currentLanguageUid);
|
||||
|
||||
/** @var Metadata $metadata */
|
||||
foreach ($metadataResult as $metadata) {
|
||||
if ($metadata && $metadata->getSysLanguageUid() != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) {
|
||||
$resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
|
||||
}
|
||||
if ($metadata) {
|
||||
if ($this->settings['showFull'] || $metadata->getIsListed()) {
|
||||
$metaList[$metadata->getIndexName()] = [
|
||||
|
|
|
@ -15,6 +15,8 @@ use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
|
|||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use Kitodo\Dlf\Common\DocumentList;
|
||||
use Kitodo\Dlf\Common\Solr;
|
||||
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
|
||||
use Kitodo\Dlf\Domain\Repository\TokenRepository;
|
||||
|
||||
/**
|
||||
* Controller for the plugin 'OAI-PMH Interface' for the 'dlf' extension
|
||||
|
@ -46,6 +48,26 @@ class OaiPmhController extends AbstractController
|
|||
$this->tokenRepository = $tokenRepository;
|
||||
}
|
||||
|
||||
protected $collectionRepository;
|
||||
|
||||
/**
|
||||
* @param CollectionRepository $collectionRepository
|
||||
*/
|
||||
public function injectCollectionRepository(CollectionRepository $collectionRepository)
|
||||
{
|
||||
$this->collectionRepository = $collectionRepository;
|
||||
}
|
||||
|
||||
protected $libraryRepository;
|
||||
|
||||
/**
|
||||
* @param LibraryRepository $libraryRepository
|
||||
*/
|
||||
public function injectLibraryRepository(LibraryRepository $libraryRepository)
|
||||
{
|
||||
$this->libraryRepository = $libraryRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the current action
|
||||
*
|
||||
|
@ -323,7 +345,7 @@ class OaiPmhController extends AbstractController
|
|||
return;
|
||||
}
|
||||
|
||||
$resArray = $this->documentRepository->getOaiRecord($this->settings);
|
||||
$resArray = $this->documentRepository->getOaiRecord($this->settings, $this->parameters);
|
||||
|
||||
if (!$resArray['uid']) {
|
||||
$this->error = 'idDoesNotExist';
|
||||
|
@ -546,7 +568,7 @@ class OaiPmhController extends AbstractController
|
|||
*/
|
||||
protected function verbListSets()
|
||||
{
|
||||
$allResults = $this->collectionRepository->getOaiRecord($this->settings);
|
||||
$allResults = $this->collectionRepository->getOaiRecord($this->settings, $this->parameters);
|
||||
|
||||
$this->view->assign('oaiSets', $allResults);
|
||||
}
|
||||
|
|
|
@ -49,12 +49,6 @@ class CollectionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
|||
$showUserDefinedColls = '';
|
||||
// Handle collections set by configuration.
|
||||
if ($settings['collections']) {
|
||||
if (
|
||||
count(explode(',', $settings['collections'])) == 1
|
||||
&& empty($settings['dont_show_single'])
|
||||
) {
|
||||
$this->showSingleCollection(intval(trim($settings['collections'], ' ,')));
|
||||
}
|
||||
$selectedCollections = $queryBuilder->expr()->in('tx_dlf_collections.uid', implode(',', GeneralUtility::intExplode(',', $settings['collections'])));
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
|||
/**
|
||||
* @param $structure
|
||||
* @param $partOf
|
||||
* @param $indexName (can be issue or year)
|
||||
* @param $indexName
|
||||
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
|
||||
*/
|
||||
public function getChildrenOfYearAnchor($structure, $partOf, $indexName)
|
||||
|
@ -293,7 +293,7 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function getOaiRecord($settings) {
|
||||
public function getOaiRecord($settings, $parameters) {
|
||||
$where = '';
|
||||
if (!$settings['show_userdefined']) {
|
||||
$where .= 'AND tx_dlf_collections.fe_cruser_id=0 ';
|
||||
|
@ -313,7 +313,7 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
|||
'AND ' . Helper::whereExpression('tx_dlf_collections');
|
||||
|
||||
$values = [
|
||||
$this->parameters['identifier'],
|
||||
$parameters['identifier'],
|
||||
$settings['pages'],
|
||||
$settings['pages']
|
||||
];
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
namespace Kitodo\Dlf\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
|
||||
class LibraryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
||||
{
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ class MetadataRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
|||
public function getMetadataForListview($pages) {
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->matching($query->logicalOr(
|
||||
$query->matching($query->logicalOr([
|
||||
$query->equals('is_listed', 1),
|
||||
$query->equals('is_sortable', 1)
|
||||
));
|
||||
]));
|
||||
$query->matching($query->equals('pid', $pages));
|
||||
|
||||
$query->setOrderings([
|
||||
|
@ -37,14 +37,11 @@ class MetadataRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
|||
public function getMetadata($pages, $sysLangUid) {
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->matching($query->logicalAnd(
|
||||
$query->logicalOr(
|
||||
$query->in('sys_language_uid', [-1, 0]),
|
||||
$query->equals('sys_language_uid', $sysLangUid)
|
||||
),
|
||||
$query->equals('l18n_parent', 0)
|
||||
));
|
||||
$query->matching('pid', $pages);
|
||||
$querySettings = $query->getQuerySettings();
|
||||
$querySettings->setLanguageUid($sysLangUid);
|
||||
$querySettings->setLanguageOverlayMode('strict');
|
||||
|
||||
$query->matching($query->equals('pid', $pages));
|
||||
|
||||
return $query->execute();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
namespace Kitodo\Dlf\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
|
||||
class TokenRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
||||
{
|
||||
public function deleteExpiredTokens($execTime, $expired) {
|
||||
|
|
Loading…
Reference in New Issue