Merge pull request 'Handle no tickets results returned from search' (#13) from ticket-no-results into master
Reviewed-on: https://gitea/IT/intranet/pulls/13
This commit is contained in:
commit
eb72070dbf
@ -34,12 +34,14 @@ class CSPController extends AbstractController
|
||||
$searchQuery = $ticketsRepo->getByKeyword($searchKeywords);
|
||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($searchQuery);
|
||||
$ticketsPerPage = count($paginator);
|
||||
//If no tickets were found, return a special page.
|
||||
//NOTE: we set page information to 1 of 1. Paginator has no tickets, which we're letting the twig template deal with.
|
||||
return $this->render('cspViewer.html.twig',['tickets' => $paginator, 'portal' => $portal, 'pageNum' => 1, 'pageCount' => 1, 'form' => $form]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query);
|
||||
}
|
||||
|
||||
//Pagination
|
||||
$totalItems = count($paginator);
|
||||
$pageCount = ceil($totalItems / $ticketsPerPage);
|
||||
|
||||
@ -49,6 +49,7 @@ class TicketRepository extends EntityRepository
|
||||
{
|
||||
$qb->andwhere('t.description LIKE :keyword'.$i)
|
||||
->orwhere('t.summary LIKE :keyword'.$i)
|
||||
->orwhere('t.id LIKE :keyword'.$i)
|
||||
->setParameter('keyword'.$i, '%'.$keyword.'%');
|
||||
}
|
||||
return $qb
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user