Browse Source

[Backend] Produits : correctif historique de ventes

packProduct
Guillaume 3 years ago
parent
commit
6e806c602c
2 changed files with 10 additions and 6 deletions
  1. +2
    -2
      Builder/Order/OrderShopBuilder.php
  2. +8
    -4
      Statistic/Product/ProductsSalesStatistic.php

+ 2
- 2
Builder/Order/OrderShopBuilder.php View File

$this->productSolver $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(); return $productsSalesStatistic->getAsArray();
} }

+ 8
- 4
Statistic/Product/ProductsSalesStatistic.php View File



namespace Lc\CaracoleBundle\Statistic\Product; namespace Lc\CaracoleBundle\Statistic\Product;


use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Builder\Distribution\DistributionBuilder; use Lc\CaracoleBundle\Builder\Distribution\DistributionBuilder;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer; use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
// Initialise les valeurs des données pour chaque Interval de date // Initialise les valeurs des données pour chaque Interval de date
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder) 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){ foreach ($this->distributionList as $distribution){
$this->labels[$this->getKey($distribution->getCycleNumber(),$distribution->getYear())] = $distribution->getCycleNumber(); $this->labels[$this->getKey($distribution->getCycleNumber(),$distribution->getYear())] = $distribution->getCycleNumber();

Loading…
Cancel
Save