@@ -119,7 +119,6 @@ public function aggregate($from = null, $to = null)
119
119
{
120
120
$ connection = $ this ->getConnection ();
121
121
$ this ->clearByDateRange ($ from , $ to );
122
-
123
122
foreach ($ this ->storeManager ->getStores (true ) as $ store ) {
124
123
$ this ->processStoreAggregate ($ store ->getId (), $ from , $ to );
125
124
}
@@ -200,13 +199,13 @@ protected function getRangeSubSelect($from = null, $to = null): ?Select
200
199
/**
201
200
* Calculate report aggregate per store
202
201
*
203
- * @param int $storeId
202
+ * @param int|null $storeId
204
203
* @param string|int|\DateTime|array|null $from
205
204
* @param string|int|\DateTime|array|null $to
206
205
* @return void
207
206
* @throws LocalizedException
208
207
*/
209
- protected function processStoreAggregate (int $ storeId , $ from = null , $ to = null ): void
208
+ protected function processStoreAggregate (? int $ storeId , $ from = null , $ to = null ): void
210
209
{
211
210
$ connection = $ this ->getConnection ();
212
211
@@ -248,11 +247,10 @@ protected function processStoreAggregate(int $storeId, $from = null, $to = null)
248
247
'order_item.parent_item_id = order_item_parent.item_id ' ,
249
248
[]
250
249
)->where (
251
- 'source_table.entity_id IN (?) ' ,
252
- "SELECT entity_id FROM " . $ this ->getTable ('sales_order ' ) .
250
+ "source_table.entity_id IN (SELECT entity_id FROM " . $ this ->getTable ('sales_order ' ) .
253
251
" WHERE store_id = " . $ storeId .
254
252
" AND state != ' " . \Magento \Sales \Model \Order::STATE_CANCELED . "' " .
255
- ($ subSelect !== null ? " AND " . $ this ->_makeConditionFromDateRangeSelect ($ subSelect , $ periodExpr ) : '' )
253
+ ($ subSelect !== null ? " AND " . $ this ->_makeConditionFromDateRangeSelect ($ subSelect , $ periodExpr ) : '' ) . " ) "
256
254
)->where (
257
255
'order_item.product_type NOT IN(?) ' ,
258
256
$ this ->ignoredProductTypes
0 commit comments