@@ -94,7 +94,7 @@ class ReportController extends BackendController | |||
} | |||
$distributionsByMonthArray = []; | |||
$distributionsArray = $distributionModule->findDistributionsActive(); | |||
$distributionsArray = $distributionModule->findDistributionsWithOrders(); | |||
foreach ($distributionsArray as $distribution) { | |||
$month = date('Y-m', strtotime($distribution->date)); | |||
if (!isset($distributionsByMonthArray[$month])) { |
@@ -71,6 +71,14 @@ class DistributionRepository extends AbstractRepository | |||
->find(); | |||
} | |||
public function findDistributionsWithOrders() | |||
{ | |||
return $this->createDefaultQuery() | |||
->filterHasOrders() | |||
->orderBy('date ASC') | |||
->find(); | |||
} | |||
/** | |||
* Récupère les distributions futures. | |||
*/ |
@@ -28,6 +28,12 @@ class DistributionRepositoryQuery extends AbstractRepositoryQuery | |||
return $this; | |||
} | |||
public function filterHasOrders(): self | |||
{ | |||
$this->innerJoinWith('order'); | |||
return $this; | |||
} | |||
public function filterByDateBetterThanToday(): self | |||
{ | |||
$this->query |