소스 검색

[Backend] Correctif count tickets dans menu

feature/export_comptable
Guillaume 4 년 전
부모
커밋
dda63cb0d6
3개의 변경된 파일20개의 추가작업 그리고 4개의 파일을 삭제
  1. +4
    -2
      ShopBundle/Controller/Backend/MerchantController.php
  2. +15
    -1
      ShopBundle/Repository/TicketRepository.php
  3. +1
    -1
      ShopBundle/Twig/BackendTwigExtension.php

+ 4
- 2
ShopBundle/Controller/Backend/MerchantController.php 파일 보기

@@ -96,13 +96,15 @@ class MerchantController extends AdminController
->find($idMerchant);

if ($merchant) {

$user->setMerchant($merchant);
$em->persist($user);
$em->flush();

return $this->redirect($merchant->getMerchantConfig('url').'admin/dashboard') ;
}
}
return $this->redirect('/admin/dashboard') ;

return $this->redirectToRoute('admin_dashboard') ;
}

}

+ 15
- 1
ShopBundle/Repository/TicketRepository.php 파일 보기

@@ -23,12 +23,26 @@ class TicketRepository extends BaseRepository implements DefaultRepositoryInterf
return TicketInterface::class;
}

public function filterStatus($query, $statusArray)
{
$query->andWhere('e.status IN (:status)')->setParameter('status', $statusArray) ;
return $query ;
}

public function findAllOpen()
{
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.status IN (:statusOpen)')->setParameter('statusOpen', [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
$query->addOrderBy('e.id', 'DESC') ;
return $query->getQuery()->getResult() ;
}

public function countAllOpen()
{
$query = $this->findByMerchantQuery() ;
$query->select('count(e.id)');
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
return $query->getQuery()->getSingleScalarResult() ;
}
}


+ 1
- 1
ShopBundle/Twig/BackendTwigExtension.php 파일 보기

@@ -82,7 +82,7 @@ class BackendTwigExtension extends AbstractExtension
switch($entityName){
case 'ticket' :
$ticketRepo = $this->em->getRepository(TicketInterface::class);
return $ticketRepo->countByStatus('open');
return $ticketRepo->countAllOpen();

}
}

Loading…
취소
저장