ソースを参照

[Backend] Edition de produit - packProductItem #118

packProduct
Fabien Normand 2年前
コミット
3f4c3a7e3d
4個のファイルの変更52行の追加53行の削除
  1. +48
    -40
      Repository/Product/ProductRepositoryQuery.php
  2. +1
    -1
      Solver/Order/OrderShopSolver.php
  3. +3
    -0
      Solver/Price/ProductPriceSolver.php
  4. +0
    -12
      Solver/Product/ProductSolver.php

+ 48
- 40
Repository/Product/ProductRepositoryQuery.php ファイルの表示

@@ -12,32 +12,33 @@ use Lc\SovBundle\Repository\RepositoryQueryInterface;

class ProductRepositoryQuery extends AbstractRepositoryQuery
{
protected bool $isJoinProductFamily =false;
protected bool $isJoinSections =false;
protected bool $isJoinProductFamilySectionProperties =false;
protected bool $isJoinProductFamily = false;
protected bool $isJoinSections = false;
protected bool $isJoinProductFamilySectionProperties = false;

public function __construct(ProductRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'product', $paginator);
}

public function orderByDefault(): \Lc\SovBundle\Repository\AbstractRepositoryQuery
{
return $this->orderBy('position', 'ASC');
}

public function joinProductFamily():self
public function joinProductFamily(): self
{
if (!$this->isJoinProductFamily) {
$this->isJoinProductFamily = true;

return $this
->innerJoin('.productFamily', 'productFamily')
->addSelect('productFamily');
->innerJoin('.productFamily', 'productFamily')
->addSelect('productFamily');
}
return $this;
}

public function filterBySection(SectionInterface $section):self
public function filterBySection(SectionInterface $section): self
{
$this->joinProductFamilySectionProperties(false);
$this->andWhereSection('productFamilySectionProperties', $section);
@@ -86,7 +87,7 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
}


public function filterIsOnline():self
public function filterIsOnline(): self
{
$this->joinProductFamily();
$this->andWhereStatus('productFamily', 1);
@@ -94,8 +95,15 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
return $this;
}

public function filterIsOnSale(): self
{
$this->joinProductFamily();
$this->andWhere('productFamily.saleStatus = 1');
return $this;
}


public function filterIsOriginProduct():self
public function filterIsOriginProduct(): self
{
$this->andWhere('.originProduct = 1');
return $this;
@@ -108,61 +116,61 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
}


public function filterIsNotAvailableQuantitySupplierUnlimited():self
public function filterIsNotAvailableQuantitySupplierUnlimited(): self
{
$this->andWhere('productFamily.availableQuantitySupplierUnlimited != 1');
return $this;
}


public function filterAvailableQuantityNegative() :self
public function filterAvailableQuantityNegative(): self
{

$this->andWhere(
$this->query->expr()->orX(
$this->query->expr()->andX(
$this->query->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
'productFamily.availableQuantity < 0 '
),
$this->query->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantity < 0 '
)
$this->query->expr()->orX(
$this->query->expr()->andX(
$this->query->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
'productFamily.availableQuantity < 0 '
),
$this->query->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantity < 0 '
)
)
);
$this->setParameter(
'behaviorCountStockByProductFamily',
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY
'behaviorCountStockByProductFamily',
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY
);
$this->setParameter('behaviorCountStockByMeasure', ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE);
$this->setParameter('behaviorCountStockByProduct', ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT);
return $this;
}

public function filterAvailableQuantitySupplierNegative() :self
public function filterAvailableQuantitySupplierNegative(): self
{

$this->andWhere(
$this->query->expr()->orX(
$this->query->expr()->andX(
$this->query->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
'productFamily.availableQuantitySupplier < 0 '
),
$this->query->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantitySupplier < 0 '
)
$this->query->expr()->orX(
$this->query->expr()->andX(
$this->query->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
'productFamily.availableQuantitySupplier < 0 '
),
$this->query->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantitySupplier < 0 '
)
)
);
$this->setParameter(
'behaviorCountStockByProductFamily',
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY
'behaviorCountStockByProductFamily',
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY
);
$this->setParameter('behaviorCountStockByMeasure', ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE);
$this->setParameter('behaviorCountStockByProduct', ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT);

+ 1
- 1
Solver/Order/OrderShopSolver.php ファイルの表示

@@ -136,6 +136,7 @@ class OrderShopSolver
return false;
}


$productFamily = $product->getProductFamily();
$quantityAsked = $quantityOrder;

@@ -177,7 +178,6 @@ class OrderShopSolver
return true;
}
}

return false;
}


+ 3
- 0
Solver/Price/ProductPriceSolver.php ファイルの表示

@@ -80,6 +80,9 @@ class ProductPriceSolver

public function getPriceWithTaxAndReduction(ProductPropertyInterface $product)
{
//TODO voir différence entre prix ici et dans tableau décli
dump('PV HT : '.$this->getPrice($product));
dump('PV TTC : '.$this->getPriceWithTax($product));
return $this->applyReductionCatalog(
$product,
$this->getPrice($product),

+ 0
- 12
Solver/Product/ProductSolver.php ファイルの表示

@@ -18,7 +18,6 @@ class ProductSolver
}

$allCategoriesSalesOff = true;
$unavailableSpecificDay = false;

foreach ($product->getProductFamily()->getProductCategories() as $category) {
if ($category->getParent()) {
@@ -30,23 +29,12 @@ class ProductSolver
$allCategoriesSalesOff = false;
}
}

// specific day
// @TODO : spécifique pdl ?
$displaySpecificDay = $category->getDisplaySpecificDay();
if ($displaySpecificDay && $displaySpecificDay != date('N')) {
$unavailableSpecificDay = true;
}
}

if ($allCategoriesSalesOff) {
return false;
}

if ($unavailableSpecificDay) {
return false;
}

return true;
}


読み込み中…
キャンセル
保存