Преглед изворни кода

[Backend] Produits : correctif update active et quantity max

feature/souke
Guillaume пре 1 година
родитељ
комит
9e2346f88a
3 измењених фајлова са 18 додато и 5 уклоњено
  1. +1
    -1
      common/logic/Distribution/Distribution/Repository/DistributionRepository.php
  2. +1
    -0
      common/logic/Distribution/Distribution/Service/DistributionBuilder.php
  3. +16
    -4
      common/logic/Distribution/ProductDistribution/Service/ProductDistributionBuilder.php

+ 1
- 1
common/logic/Distribution/Distribution/Repository/DistributionRepository.php Прегледај датотеку

@@ -92,7 +92,7 @@ class DistributionRepository extends AbstractRepository
$distributionsArray = Distribution::find()
->where('date > \'' . date('Y-m-d') . '\'')
->andWhere([
'id_producer' => GlobalParam::getCurrentProducerId(),
'id_producer' => $this->getProducerContext()->id,
'active' => 1
])
->orderBy('date ASC')

+ 1
- 0
common/logic/Distribution/Distribution/Service/DistributionBuilder.php Прегледај датотеку

@@ -102,6 +102,7 @@ class DistributionBuilder extends AbstractBuilder
public function addProduct(Distribution $distribution, Product $product): ProductDistribution
{
$productDistribution = $this->productDistributionBuilder->createProductDistributionIfNotExist($distribution, $product);
$this->productDistributionBuilder->updateProductDistribution($productDistribution);
$this->updateOrderProductPrices($distribution, $product);

return $productDistribution;

+ 16
- 4
common/logic/Distribution/ProductDistribution/Service/ProductDistributionBuilder.php Прегледај датотеку

@@ -35,10 +35,7 @@ class ProductDistributionBuilder extends AbstractBuilder
public function createProductDistribution(Distribution $distribution, Product $product): ProductDistribution
{
$productDistribution = $this->instanciateProductDistribution($distribution, $product);

$this->initActive($productDistribution);
$this->initQuantityMax($productDistribution);

$this->initProductDistribution($productDistribution);
$this->saveCreate($productDistribution);

return $productDistribution;
@@ -49,6 +46,21 @@ class ProductDistributionBuilder extends AbstractBuilder
return $this->productDistributionRepository->findOneProductDistribution($distribution, $product)
?? $this->createProductDistribution($distribution, $product);
}
public function updateProductDistribution(ProductDistribution $productDistribution): ProductDistribution
{
$this->initProductDistribution($productDistribution);
$this->saveUpdate($productDistribution);

return $productDistribution;
}

public function initProductDistribution(ProductDistribution $productDistribution): ProductDistribution
{
$this->initActive($productDistribution);
$this->initQuantityMax($productDistribution);

return $productDistribution;
}

public function initActive(ProductDistribution $productDistribution): ProductDistribution
{

Loading…
Откажи
Сачувај