Guillaume 2 лет назад
Родитель
Сommit
32124e725d
4 измененных файлов: 28 добавлений и 19 удалений
  1. +5
    -8
      Builder/Order/OrderShopBuilder.php
  2. +15
    -9
      Definition/Field/Product/ProductCategoryFieldDefinition.php
  3. +5
    -1
      Solver/Product/ProductFamilySolver.php
  4. +3
    -1
      Solver/Product/ProductSolver.php

+ 5
- 8
Builder/Order/OrderShopBuilder.php Просмотреть файл

@@ -8,7 +8,6 @@ use Lc\CaracoleBundle\Builder\Credit\CreditHistoryBuilder;
use Lc\CaracoleBundle\Builder\File\DocumentBuilder;
use Lc\CaracoleBundle\Event\Order\CartChangeEvent;
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent;
use Lc\CaracoleBundle\Factory\Credit\CreditHistoryFactory;
use Lc\CaracoleBundle\Factory\File\DocumentFactory;
use Lc\CaracoleBundle\Factory\Order\OrderPaymentFactory;
use Lc\CaracoleBundle\Factory\Order\OrderProductFactory;
@@ -33,7 +32,6 @@ use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Model\Section\SectionModel;
use Lc\CaracoleBundle\Model\User\VisitorInterface;
use Lc\CaracoleBundle\Repository\Order\OrderProductStore;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
@@ -51,9 +49,6 @@ use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\FlashBagTranslator;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;

class OrderShopBuilder
{
@@ -76,6 +71,7 @@ class OrderShopBuilder
protected MerchantResolver $merchantResolver;
protected CreditHistoryBuilder $creditHistoryBuilder;
protected FlashBagTranslator $flashBagTranslator;
protected OrderShopFactory $orderShopFactory;

public function __construct(
EntityManagerInterface $entityManager,
@@ -96,7 +92,8 @@ class OrderShopBuilder
DistributionBuilder $distributionBuilder,
MerchantResolver $merchantResolver,
CreditHistoryBuilder $creditHistoryBuilder,
FlashBagTranslator $flashBagTranslator
FlashBagTranslator $flashBagTranslator,
OrderShopFactory $orderShopFactory
) {
$this->entityManager = $entityManager;
$this->orderShopStore = $orderShopStore;
@@ -117,6 +114,7 @@ class OrderShopBuilder
$this->merchantResolver = $merchantResolver;
$this->creditHistoryBuilder = $creditHistoryBuilder;
$this->flashBagTranslator = $flashBagTranslator;
$this->orderShopFactory = $orderShopFactory;
}

public function create(
@@ -124,8 +122,7 @@ class OrderShopBuilder
UserInterface $user = null,
VisitorInterface $visitor = null
): OrderShopInterface {
$orderShopFactory = new OrderShopFactory();
$orderShop = $orderShopFactory->create($section, $user, $visitor);
$orderShop = $this->orderShopFactory->create($section, $user, $visitor);

$this->setOrderStatus($orderShop, OrderStatusModel::ALIAS_CART);


+ 15
- 9
Definition/Field/Product/ProductCategoryFieldDefinition.php Просмотреть файл

@@ -57,14 +57,14 @@ class ProductCategoryFieldDefinition extends AbstractFieldDefinition
public function configurePanelMain(): array
{
return [
'section',
'parent',
'title',
'description',
'image',
'status',
'saleStatus',
'isEligibleTicketRestaurant',
'section',
'parent',
'title',
'description',
'image',
'status',
'saleStatus',
'isEligibleTicketRestaurant',
];
}

@@ -78,7 +78,13 @@ class ProductCategoryFieldDefinition extends AbstractFieldDefinition
'title' => TextField::new('title')->setSortable(true),
'position' => NumberField::new('position')->setSortable(true),
'parent' => AssociationField::new('parent')
->setFormTypeOption('choices', $productCategoryArray),
->setFormTypeOption('choices', $productCategoryArray)
->setFormTypeOption(
'choice_label',
function ($productCategory) {
return $productCategory->getTitle() . ' (' . $productCategory->getSection() . ')';
}
),
'image' => ImageManagerField::new('image'),
'description' => CKEditorField::new('description'),
'saleStatus' => ToggleField::new('saleStatus')->setSortable(true),

+ 5
- 1
Solver/Product/ProductFamilySolver.php Просмотреть файл

@@ -372,7 +372,11 @@ class ProductFamilySolver

public function getQuantityInherited(ProductFamilyInterface $productFamily): ?float
{
return $productFamily->getQuantity();
if($productFamily->getQuantity()){
return $productFamily->getQuantity();
}else{
return 1;
}
}

public function getUnitInherited(ProductFamilyInterface $productFamily)

+ 3
- 1
Solver/Product/ProductSolver.php Просмотреть файл

@@ -130,8 +130,10 @@ class ProductSolver
{
if ($product->getQuantity()) {
return $product->getQuantity();
} else {
} else if($product->getProductFamily()->getQuantity()){
return $product->getProductFamily()->getQuantity();
}else{
return 1;
}
}


Загрузка…
Отмена
Сохранить