Bläddra i källkod

Merge branch 'develop'

master
Guillaume 1 år sedan
förälder
incheckning
f95fae8eae
3 ändrade filer med 18 tillägg och 5 borttagningar
  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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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
{

Laddar…
Avbryt
Spara