Kaynağa Gözat

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Guillaume 3 yıl önce
ebeveyn
işleme
77fa2f9e81
6 değiştirilmiş dosya ile 90 ekleme ve 159 silme
  1. +0
    -9
      Controller/Product/ProductFamilyAdminController.php
  2. +0
    -76
      Model/Product/ProductFamilyModel.php
  3. +1
    -0
      Solver/Order/OrderShopSolver.php
  4. +13
    -0
      Solver/Product/ProductFamilySectionPropertySolver.php
  5. +64
    -72
      Solver/Product/ProductFamilySolver.php
  6. +12
    -2
      Solver/Product/ProductSolver.php

+ 0
- 9
Controller/Product/ProductFamilyAdminController.php Dosyayı Görüntüle

@@ -26,15 +26,6 @@ abstract class ProductFamilyAdminController extends AbstractAdminController
->create($this->getMerchantCurrent());
}

// public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
// {
// $queryBuilder = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters);
//
// $queryBuilder->leftJoin('entity.productFamilySectionProperties', 'pfsp');
// $queryBuilder->andWhereSection('pfsp', $this->getSectionCurrent());
// $queryBuilder->addOrderBy('entity.id');
// return $queryBuilder;
// }

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{

+ 0
- 76
Model/Product/ProductFamilyModel.php Dosyayı Görüntüle

@@ -21,82 +21,24 @@ abstract class ProductFamilyModel extends AbstractFullEntity implements ProductP
{
use ProductPropertyTrait;

const BEHAVIOR_COUNT_STOCK_UNLIMITED = 'unlimited';
const BEHAVIOR_COUNT_STOCK_BY_MEASURE = 'by-measure';
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family';
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product';

public function getBehaviorCountStockChoices(): array
{
return [
self::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT,
self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY,
self::BEHAVIOR_COUNT_STOCK_UNLIMITED,
];
}

const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure';
const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity';

public function getBehaviorDisplaySaleChoices(): array
{
return [
self::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,
self::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
];
}

const BEHAVIOR_STOCK_CYCLE_RENEWABLE = 'renewable';
const BEHAVIOR_STOCK_CYCLE_RENEWABLE_VALIDATION = 'renewable-with-validation';
const BEHAVIOR_STOCK_CYCLE_NON_RENEWABLE = 'non-renewable';

public function getBehaviorStockCycleChoices(): array
{
return [
self::BEHAVIOR_STOCK_CYCLE_NON_RENEWABLE,
self::BEHAVIOR_STOCK_CYCLE_RENEWABLE,
self::BEHAVIOR_STOCK_CYCLE_RENEWABLE_VALIDATION,
];
}

const WARNING_MESSAGE_TYPE_SUCCESS = 'success';
const WARNING_MESSAGE_TYPE_ERROR = 'error';
const WARNING_MESSAGE_TYPE_WARNING = 'warning';
const WARNING_MESSAGE_TYPE_INFO = 'info';

public function getWaringMessageTypeChoices(): array
{
return [
self::WARNING_MESSAGE_TYPE_ERROR,
self::WARNING_MESSAGE_TYPE_INFO,
self::WARNING_MESSAGE_TYPE_SUCCESS,
self::WARNING_MESSAGE_TYPE_WARNING,
];
}

const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple';
const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple';

public function getBehaviorAddToCartChoices(): array
{
return [
self::BEHAVIOR_ADD_TO_CART_MULTIPLE,
self::BEHAVIOR_ADD_TO_CART_SIMPLE,
];
}

const BEHAVIOR_PRICE_BY_PIECE = 'by-piece';
const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit';

public function getBehaviorPriceChoices(): array
{
return [
self::BEHAVIOR_PRICE_BY_PIECE,
self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT,
];
}

const QUALITY_LABEL_AB = 'ab';
const QUALITY_LABEL_NP = 'nature-progres';
const QUALITY_LABEL_HVE = 'hve';
@@ -111,7 +53,6 @@ abstract class ProductFamilyModel extends AbstractFullEntity implements ProductP
self::QUALITY_LABEL_HVE,
self::QUALITY_LABEL_TVVR
];

static $geographicLabels = [
self::QUALITY_LABEL_AOC,
self::QUALITY_LABEL_AOP,
@@ -122,26 +63,9 @@ abstract class ProductFamilyModel extends AbstractFullEntity implements ProductP
const TYPE_EXPIRATION_DATE_DDM = 'ddm';
const TYPE_EXPIRATION_DATE_DLUO = 'dluo';

public function getTypeExpirationDateChoices(): array
{
return [
self::TYPE_EXPIRATION_DATE_DLC,
self::TYPE_EXPIRATION_DATE_DDM,
self::TYPE_EXPIRATION_DATE_DLUO,
];
}

const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family';
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product';

public function getBehaviorExpirationDateChoices(): array
{
return [
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT
];
}

// @TODO : Champ hydraté par ProductFamilyBuilder ?
protected $reductionCatalog;


+ 1
- 0
Solver/Order/OrderShopSolver.php Dosyayı Görüntüle

@@ -17,6 +17,7 @@ use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
use Lc\CaracoleBundle\Solver\Product\ProductFamilySectionPropertySolver;
use Lc\CaracoleBundle\Solver\Product\ProductSolver;

class OrderShopSolver

+ 13
- 0
Solver/Product/ProductFamilySectionPropertySolver.php Dosyayı Görüntüle

@@ -2,9 +2,22 @@

namespace Lc\CaracoleBundle\Solver\Product;

use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;

class ProductFamilySectionPropertySolver
{

public function getProductFamilySectionProperty(ProductFamilyInterface $productFamily, SectionInterface $section):? ProductFamilySectionPropertyInterface
{
foreach ($productFamily->getProductFamilySectionProperties() as $productFamilySectionProperty) {
if ($productFamilySectionProperty->getSection() == $section) {
return $productFamilySectionProperty;
}
}
return null;
}
}



+ 64
- 72
Solver/Product/ProductFamilySolver.php Dosyayı Görüntüle

@@ -9,7 +9,6 @@ use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface;
use Lc\CaracoleBundle\Solver\Price\PriceSolver;

class ProductFamilySolver
{
@@ -21,6 +20,70 @@ class ProductFamilySolver
$this->productSolver = $productSolver;
}


public function getBehaviorCountStockChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY,
];
}

public function getWaringMessageTypeChoices(): array
{
return [
ProductFamilyModel::WARNING_MESSAGE_TYPE_ERROR,
ProductFamilyModel::WARNING_MESSAGE_TYPE_INFO,
ProductFamilyModel::WARNING_MESSAGE_TYPE_SUCCESS,
ProductFamilyModel::WARNING_MESSAGE_TYPE_WARNING,
];
}

public function getBehaviorAddToCartChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_MULTIPLE,
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE,
];
}

public function getBehaviorPriceChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE,
ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT,
];
}

public function getTypeExpirationDateChoices(): array
{
return [
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DDM,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLUO,
];
}


public function getBehaviorExpirationDateChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT,
];
}


public function getBehaviorDisplaySaleChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
];
}


public function countProductFamiliesOrganizedByParentCategory(array $categories): int
{
$count = 0;
@@ -262,77 +325,6 @@ class ProductFamilySolver
return $productFamily->getBehaviorPrice();
}

public function getBehaviorCountStockChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED,
];
}

public function getBehaviorDisplaySaleChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
];
}

public function getBehaviorStockCycleChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_STOCK_CYCLE_NON_RENEWABLE,
ProductFamilyModel::BEHAVIOR_STOCK_CYCLE_RENEWABLE,
ProductFamilyModel::BEHAVIOR_STOCK_CYCLE_RENEWABLE_VALIDATION,
];
}

public function getWaringMessageTypeChoices(): array
{
return [
ProductFamilyModel::WARNING_MESSAGE_TYPE_ERROR,
ProductFamilyModel::WARNING_MESSAGE_TYPE_INFO,
ProductFamilyModel::WARNING_MESSAGE_TYPE_SUCCESS,
ProductFamilyModel::WARNING_MESSAGE_TYPE_WARNING,
];
}

public function getBehaviorAddToCartChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_MULTIPLE,
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE,
];
}

public function getBehaviorPriceChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE,
ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT,
];
}

public function getTypeExpirationDateChoices(): array
{
return [
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DDM,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLUO,
];
}


public function getBehaviorExpirationDateChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT,
];
}

public function getBuyingPriceByRefUnitInherited(ProductFamilyInterface $productFamily): ?float
{
return $productFamily->getBuyingPriceByRefUnit();

+ 12
- 2
Solver/Product/ProductSolver.php Dosyayı Görüntüle

@@ -150,11 +150,21 @@ class ProductSolver
return $product->getProductFamily()->getAvailableQuantity();
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
return $product->getAvailableQuantity();
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED :
return false;
}
}

public function getAvailableQuantitySupplierInherited(ProductInterface $product)
{
switch ($product->getProductFamily()->getBehaviorCountStock()) {
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
return $product->getProductFamily()->getAvailableQuantitySupplier();
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
return $product->getAvailableQuantitySupplier();
}
}


/*public function getTaxRateInherited(ProductInterface $product)
{
return $product->getProductFamily()->getTaxRateInherited();

Yükleniyor…
İptal
Kaydet