Track purchases regardless of status but return revenue status correctly
When we apply this commit every purchase will be tracked. When the shop manager updates an order the status will be updated. For the statistics it will only return values for purchases with the 'completed' status [MAILPOET-5485]
This commit is contained in:
@@ -263,6 +263,8 @@ class NewsletterStatisticsRepository extends Repository {
|
||||
return null;
|
||||
}
|
||||
|
||||
$revenueStatus = $this->wcHelper->getPurchaseStates();
|
||||
|
||||
$currency = $this->wcHelper->getWoocommerceCurrency();
|
||||
$query = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
@@ -270,8 +272,10 @@ class NewsletterStatisticsRepository extends Repository {
|
||||
->from(StatisticsWooCommercePurchaseEntity::class, 'stats')
|
||||
->where('stats.newsletter IN (:newsletters)')
|
||||
->andWhere('stats.orderCurrency = :currency')
|
||||
->andWhere('stats.status IN (:revenue_status)')
|
||||
->setParameter('newsletters', $newsletters)
|
||||
->setParameter('currency', $currency)
|
||||
->setParameter('revenue_status', $revenueStatus)
|
||||
->groupBy('stats.newsletter');
|
||||
|
||||
if ($from && $to) {
|
||||
|
Reference in New Issue
Block a user