mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
PHRAS-3738 Admin - worker - job tab - add filter on databox_id (name),record_id (#4132)
* add databox and record id filter * add entry count * generate translation * fix retrieve count in DB * change string position
This commit is contained in:
@@ -379,7 +379,7 @@ class WorkerRunningJobRepository extends EntityRepository
|
||||
return count($qb->getQuery()->getResult());
|
||||
}
|
||||
|
||||
public function findByStatusAndJob(array $status, $jobType, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
|
||||
public function findByFilter(array $status, $jobType, $databoxId, $recordId, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('w');
|
||||
|
||||
@@ -392,15 +392,56 @@ class WorkerRunningJobRepository extends EntityRepository
|
||||
->setParameter('work', $jobType);
|
||||
}
|
||||
|
||||
if (!empty($databoxId)) {
|
||||
$qb->andWhere('w.databoxId = :databoxId')
|
||||
->setParameter('databoxId', $databoxId);
|
||||
}
|
||||
|
||||
if (!empty($recordId)) {
|
||||
$qb->andWhere('w.recordId = :recordId')
|
||||
->setParameter('recordId', $recordId);
|
||||
}
|
||||
|
||||
if ($limit !== null) {
|
||||
$qb->setMaxResults($limit);
|
||||
}
|
||||
|
||||
$qb
|
||||
->setFirstResult($start)
|
||||
->setMaxResults($limit)
|
||||
->orderBy('w.id', 'DESC')
|
||||
;
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function getJobCount(array $status, $jobType, $databoxId, $recordId)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('w');
|
||||
$qb->select('count(w)');
|
||||
|
||||
if (!empty($status)) {
|
||||
$qb->where($qb->expr()->in('w.status', $status));
|
||||
}
|
||||
|
||||
if (!empty($jobType)) {
|
||||
$qb->andWhere('w.work = :work')
|
||||
->setParameter('work', $jobType);
|
||||
}
|
||||
|
||||
if (!empty($databoxId)) {
|
||||
$qb->andWhere('w.databoxId = :databoxId')
|
||||
->setParameter('databoxId', $databoxId);
|
||||
}
|
||||
|
||||
if (!empty($recordId)) {
|
||||
$qb->andWhere('w.recordId = :recordId')
|
||||
->setParameter('recordId', $recordId);
|
||||
}
|
||||
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
|
||||
}
|
||||
|
||||
public function updateStatusRunningToCanceledSinceCreated($hour = 0)
|
||||
{
|
||||
$sql = '
|
||||
|
Reference in New Issue
Block a user