Bladeren bron

[Backend] Produits : correctif historique de ventes

packProduct
Guillaume 3 jaren geleden
bovenliggende
commit
6e806c602c
2 gewijzigde bestanden met toevoegingen van 10 en 6 verwijderingen
  1. +2
    -2
      Builder/Order/OrderShopBuilder.php
  2. +8
    -4
      Statistic/Product/ProductsSalesStatistic.php

+ 2
- 2
Builder/Order/OrderShopBuilder.php Bestand weergeven

@@ -671,8 +671,8 @@ class OrderShopBuilder
$this->productSolver
);

$productsSalesStatistic->init($section, $this->distributionBuilder, $this->openingResolver);
$productsSalesStatistic->populateProperties($this->orderShopStore);
$productsSalesStatistic->init($section, $this->distributionBuilder);
$productsSalesStatistic->populateProperties($this->orderShopStore->resetContext()->setSection($section));

return $productsSalesStatistic->getAsArray();
}

+ 8
- 4
Statistic/Product/ProductsSalesStatistic.php Bestand weergeven

@@ -2,6 +2,7 @@

namespace Lc\CaracoleBundle\Statistic\Product;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Builder\Distribution\DistributionBuilder;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
@@ -56,11 +57,14 @@ class ProductsSalesStatistic extends Statistic
// Initialise les valeurs des données pour chaque Interval de date
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder)
{
$this->distributionList = $distributionBuilder->getDistributionListFromCurrentOrder($section, $this->nbCycle);
$distributionArray = $distributionBuilder->getDistributionListFromCurrentOrder($section, $this->nbCycle);
$this->distributionList = $distributionArray->toArray();

// if ($openingResolver->isOpenSale($section, null,OpeningResolver::OPENING_CONTEXT_BACKEND) == false && date('w') > 2) {
// $currentCycleNumber = $currentCycleNumber - 1;
// }
// @TODO : à retravailler pour inclure cette logique directement dans getDistributionListFromCurrentOrder()
$distributionCurrentOrder = $distributionBuilder->guessCurrentDistributionOrder($section);
if(!$distributionArray->contains($distributionCurrentOrder)) {
array_unshift($this->distributionList, $distributionCurrentOrder);
}

foreach ($this->distributionList as $distribution){
$this->labels[$this->getKey($distribution->getCycleNumber(),$distribution->getYear())] = $distribution->getCycleNumber();

Laden…
Annuleren
Opslaan