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

[TASK] Mail queue only for root page id

parent 5f9914d9
No related branches found
No related tags found
1 merge request!2Feature multiclient
...@@ -24,6 +24,7 @@ namespace SGalinski\SgMail\Controller; ...@@ -24,6 +24,7 @@ namespace SGalinski\SgMail\Controller;
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use SGalinski\SgMail\Service\BackendService;
use SGalinski\SgMail\Service\MailTemplateService; use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Backend\Template\Components\ButtonBar; use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent; use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
...@@ -68,10 +69,13 @@ class QueueController extends ActionController { ...@@ -68,10 +69,13 @@ class QueueController extends ActionController {
$selectedExtension = key($registerArray); $selectedExtension = key($registerArray);
$selectedTemplate = key($registerArray[$selectedExtension]); $selectedTemplate = key($registerArray[$selectedExtension]);
} }
$queue = $this->mailRepository->findAllEntries($selectedExtension, $selectedTemplate);
// create doc header component
$pageUid = (int) GeneralUtility::_GP('id'); $pageUid = (int) GeneralUtility::_GP('id');
$siteRootId = BackendService::getSiteRoot($pageUid)['uid'];
debug($siteRootId);
$queue = $this->mailRepository->findAllEntries($selectedExtension, $selectedTemplate, $siteRootId);
// create doc header component
$pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1)); $pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1));
$this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class); $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);
......
...@@ -55,10 +55,11 @@ class MailRepository extends AbstractRepository { ...@@ -55,10 +55,11 @@ class MailRepository extends AbstractRepository {
* *
* @param string $extensionKey * @param string $extensionKey
* @param string $templateName * @param string $templateName
* @param int siteroot
* @param int $limit * @param int $limit
* @return array|QueryResultInterface * @return array|QueryResultInterface
*/ */
public function findAllEntries($extensionKey, $templateName, $limit = NULL) { public function findAllEntries($extensionKey, $templateName, $siteroot = 0, $limit = NULL) {
$query = $this->createQuery(); $query = $this->createQuery();
if ($limit) { if ($limit) {
$query->setLimit($limit); $query->setLimit($limit);
...@@ -66,6 +67,7 @@ class MailRepository extends AbstractRepository { ...@@ -66,6 +67,7 @@ class MailRepository extends AbstractRepository {
$constraintsAnd[] = $query->equals('extension_key', $extensionKey); $constraintsAnd[] = $query->equals('extension_key', $extensionKey);
$constraintsAnd[] = $query->equals('template_name', $templateName); $constraintsAnd[] = $query->equals('template_name', $templateName);
$constraintsAnd[] = $query->equals('site_root_id', (int) $siteroot);
$query->setOrderings(['tstamp' => Query::ORDER_DESCENDING]); $query->setOrderings(['tstamp' => Query::ORDER_DESCENDING]);
return $query->matching($query->logicalAnd($constraintsAnd))->execute(TRUE); return $query->matching($query->logicalAnd($constraintsAnd))->execute(TRUE);
......
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