Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Classes/Domain/Repository/LogRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function getNumberOfReceivers(Filter $filter): int
. ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter'
. ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid'
. ' where l.deleted=0 and l.status=' . Log::STATUS_DISPATCH
. ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")'
. ' and c.site in (\'' . implode('\',\'', $filter->getSitesForFilter()) . '\')'
. ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp()
. ' limit 1';
return (int)$connection->executeQuery($sql)->fetchOne();
Expand All @@ -57,7 +57,7 @@ public function getGroupedLinksByHref(Filter $filter): array
. ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter'
. ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid'
. ' where l.deleted=0 and l.status=' . Log::STATUS_LINKOPENING
. ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")'
. ' and c.site in (\'' . implode('\',\'', $filter->getSitesForFilter()) . '\')'
. ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp()
. ' group by l.properties, l.newsletter'
. ' order by count desc'
Expand All @@ -79,13 +79,13 @@ public function getGroupedLinksByHref(Filter $filter): array
public function getOverallOpenings(Filter $filter): int
{
$connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME);
$sql = 'select count(distinct newsletter, user)'
$sql = 'select count(distinct (newsletter, user))'
. ' from ' . Log::TABLE_NAME . ' l'
. ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter'
. ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid'
. ' where l.deleted = 0'
. ' and l.status IN (' . Log::STATUS_NEWSLETTEROPENING . ',' . Log::STATUS_LINKOPENING . ')'
. ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")'
. ' and c.site in (\'' . implode('\',\'', $filter->getSitesForFilter()) . '\')'
. ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp();
return (int)$connection->executeQuery($sql)->fetchOne();
}
Expand All @@ -98,12 +98,12 @@ public function getOverallOpenings(Filter $filter): int
public function getOpeningsByClickers(Filter $filter): int
{
$connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME);
$sql = 'select count(distinct newsletter, user)'
$sql = 'select count(distinct (newsletter, user))'
. ' from ' . Log::TABLE_NAME . ' l'
. ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter'
. ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid'
. ' where l.deleted = 0 and l.status=' . Log::STATUS_LINKOPENING
. ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")'
. ' and c.site in (\'' . implode('\',\'', $filter->getSitesForFilter()) . '\')'
. ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp();
return (int)$connection->executeQuery($sql)->fetchOne();
}
Expand Down Expand Up @@ -152,7 +152,7 @@ protected function getOverallAmountByLogStatus(array $status, Filter $filter): i
. ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter'
. ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid'
. ' where l.deleted = 0 and l.status in (' . ArrayUtility::convertArrayToIntegerList($status) . ')'
. ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")'
. ' and c.site in (\'' . implode('\',\'', $filter->getSitesForFilter()) . '\')'
. ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp();
return (int)$connection->executeQuery($sql)->fetchOne();
}
Expand Down Expand Up @@ -275,7 +275,7 @@ public function isLogRecordExisting(int $newsletterIdentifier, int $userIdentifi
$uid = (int)$queryBuilder
->select('uid')
->from(Log::TABLE_NAME)
->where('newsletter=' . $newsletterIdentifier . ' and user=' . $userIdentifier . ' and status=' . $status)
->where('newsletter=' . $newsletterIdentifier . ' and user=\'' . $userIdentifier . '\' and status=\'' . $status . '\'')
->setMaxResults(1)
->executeQuery()
->fetchOne();
Expand Down Expand Up @@ -312,7 +312,7 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status,
public function findRawByUser(User $user, array $statusWhitelist = [], array $statusBlacklist = []): array
{
$connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME);
$sql = 'select * from ' . Log::TABLE_NAME . ' where deleted=0 and user=' . $user->getUid();
$sql = 'select * from ' . Log::TABLE_NAME . ' where deleted=0 and user=\'' . $user->getUid() . '\'';
if ($statusWhitelist !== []) {
$sql .= ' and status in (' . implode(',', $statusWhitelist) . ')';
} elseif ($statusBlacklist !== []) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/QueueRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function isUserAndNewsletterAlreadyAddedToQueue(User $user, Newsletter $n
return (int)$queryBuilder
->select('uid')
->from(Queue::TABLE_NAME)
->where('newsletter=' . $newsletter->getUid() . ' and user=' . $user->getUid())
->where('newsletter=' . $newsletter->getUid() . ' and user=\'' . $user->getUid() . '\'')
->setMaxResults(1)
->executeQuery()
->fetchOne() > 0;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function getUserAmountFromGroups(array $groupIdentifiers): int
}
$sub .= 'find_in_set(' . (int)$identifier . ',usergroup)';
}
$sql .= ' where deleted=0 and disable=0 and email like "%@%" and (' . $sub . ')';
$sql .= ' where deleted=0 and disable=0 and email like \'%@%\' and (' . $sub . ')';
return (int)$connection->executeQuery($sql)->fetchOne();
}
return 0;
Expand Down