Sfoglia il codice sorgente

Refactoring services

packProduct
Guillaume 2 anni fa
parent
commit
a014f2d695
20 ha cambiato i file con 708 aggiunte e 258 eliminazioni
  1. +69
    -0
      Builder/Address/AddressBuilder.php
  2. +176
    -3
      Builder/Order/OrderShopBuilder.php
  3. +0
    -90
      Checker/OrderChecker.php
  4. +0
    -9
      Container/Order/OrderShopContainer.php
  5. +28
    -21
      EventSubscriber/SettingEventSubscriber.php
  6. +6
    -6
      Model/Config/UnitInterface.php
  7. +1
    -1
      Model/Credit/CreditHistoryModel.php
  8. +50
    -50
      Model/Order/OrderShopInterface.php
  9. +7
    -7
      Model/Product/ProductCategoryInterface.php
  10. +41
    -41
      Model/Product/ProductFamilyInterface.php
  11. +5
    -5
      Model/Product/ProductFamilyModel.php
  12. +102
    -0
      Repository/Order/OrderProductRepositoryQuery.php
  13. +14
    -2
      Repository/Order/OrderProductStore.php
  14. +34
    -2
      Repository/Order/OrderShopStore.php
  15. +2
    -7
      Repository/Product/ProductFamilyRepositoryQuery.php
  16. +0
    -10
      Repository/Product/ProductFamilyStore.php
  17. +1
    -4
      Repository/Reduction/ReductionCartStore.php
  18. +13
    -0
      Resolver/OpeningResolver.php
  19. +70
    -0
      Solver/Order/OrderShopSolver.php
  20. +89
    -0
      Statistic/Product/ProductsSalesStatistic.php

+ 69
- 0
Builder/Address/AddressBuilder.php Vedi File

@@ -0,0 +1,69 @@
<?php

namespace Lc\CaracoleBundle\Builder\Address;

use App\Entity\Address\Address;
use App\Repository\Order\OrderShopStore;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Repository\File\DocumentStore;

class AddressBuilder
{
protected EntityManagerInterface $entityManager;
protected OrderShopStore $orderShopStore;
protected DocumentStore $documentStore;

public function __construct(
EntityManagerInterface $entityManager,
OrderShopStore $orderShopStore,
DocumentStore $documentStore
) {
$this->entityManager = $entityManager;
$this->orderShopStore = $orderShopStore;
$this->documentStore = $documentStore;
}

// unlinkAddress
public function unlink(Address $address): void
{
$orderShops = $this->orderShopStore->getBy(
[
'address' => $address
]
);

if ($orderShops) {
foreach ($orderShops as $orderShop) {
$update = false;
if ($orderShop->getInvoiceAddress() == $address) {
$orderShop->setInvoiceAddress(null);
$update = true;
}
if ($orderShop->getDeliveryAddress() == $address) {
$orderShop->setDeliveryAddress(null);
$update = true;
}
if ($update) {
$this->entityManager->update($orderShop);
}
}
}

$documents = $this->documentStore->getByBuyerAddress($address);

if ($documents) {
foreach ($documents as $document) {
$update = false;
if ($document->getBuyerAddress() == $address) {
$document->setBuyerAddress(null);
$update = true;
}
if ($update) {
$this->entityManager->update($document);
}
}
}

$this->entityManager->flush();
}
}

+ 176
- 3
Builder/Order/OrderShopBuilder.php Vedi File

@@ -7,11 +7,13 @@ use Lc\CaracoleBundle\Builder\File\DocumentBuilder;
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent;
use Lc\CaracoleBundle\Factory\File\DocumentFactory;
use Lc\CaracoleBundle\Factory\Order\OrderPaymentFactory;
use Lc\CaracoleBundle\Factory\Order\OrderProductFactory;
use Lc\CaracoleBundle\Factory\Order\OrderProductReductionCatalogFactory;
use Lc\CaracoleBundle\Factory\Order\OrderReductionCartFactory;
use Lc\CaracoleBundle\Factory\Order\OrderReductionCreditFactory;
use Lc\CaracoleBundle\Factory\Order\OrderShopFactory;
use Lc\CaracoleBundle\Factory\Order\OrderStatusHistoryFactory;
use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\CaracoleBundle\Model\File\DocumentInterface;
use Lc\CaracoleBundle\Model\File\DocumentModel;
use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
@@ -20,17 +22,23 @@ use Lc\CaracoleBundle\Model\Order\OrderReductionCreditInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
use Lc\CaracoleBundle\Model\Section\OpeningModel;
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;
use Lc\CaracoleBundle\Repository\Order\OrderStatusStore;
use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore;
use Lc\CaracoleBundle\Resolver\OpeningResolver;
use Lc\CaracoleBundle\Resolver\Price\PriceResolver;
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver;
use Lc\CaracoleBundle\Solver\Price\PriceSolver;
use Lc\CaracoleBundle\Statistic\Product\ProductsSalesStatistic;
use Lc\SovBundle\Model\User\UserInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
@@ -41,16 +49,19 @@ class OrderShopBuilder
protected OrderStatusStore $orderStatusStore;
protected OrderProductStore $orderProductStore;
protected OrderShopStore $orderShopStore;
protected OrderShopSolver $orderShopSolver;
protected ProductFamilyStore $productFamilyStore;
protected PriceSolver $priceSolver;
protected OrderProductBuilder $orderProductBuilder;
protected DocumentBuilder $documentBuilder;
protected EventDispatcherInterface $eventDispatcher;
protected FlashBagInterface $flashBag;
protected OpeningResolver $openingResolver;

public function __construct(
EntityManagerInterface $entityManager,
OrderShopStore $orderShopStore,
OrderShopSolver $orderShopSolver,
OrderStatusStore $orderStatusStore,
OrderProductStore $orderProductStore,
ProductFamilyStore $productFamilyStore,
@@ -58,10 +69,12 @@ class OrderShopBuilder
DocumentBuilder $documentBuilder,
PriceSolver $priceSolver,
EventDispatcherInterface $eventDispatcher,
FlashBagInterface $flashBag
FlashBagInterface $flashBag,
OpeningResolver $openingResolver
) {
$this->entityManager = $entityManager;
$this->orderShopStore = $orderShopStore;
$this->orderShopSolver = $orderShopSolver;
$this->orderStatusStore = $orderStatusStore;
$this->orderProductStore = $orderProductStore;
$this->productFamilyStore = $productFamilyStore;
@@ -70,6 +83,7 @@ class OrderShopBuilder
$this->priceSolver = $priceSolver;
$this->eventDispatcher = $eventDispatcher;
$this->flashBag = $flashBag;
$this->openingResolver = $openingResolver;
}

public function create(
@@ -77,7 +91,6 @@ class OrderShopBuilder
UserInterface $user = null,
VisitorInterface $visitor = null
): OrderShopInterface {

$orderShopFactory = new OrderShopFactory();
$orderShop = $orderShopFactory->create($section, $user, $visitor);

@@ -293,7 +306,7 @@ class OrderShopBuilder

$orderShop->addOrderPayment($orderPayment);

if ($this->isOrderPaid($orderShop)) {
if ($this->orderSh->isPaid($orderShop)) {
$nextStatus = OrderStatusModel::ALIAS_PAID;
} else {
$nextStatus = OrderStatusModel::ALIAS_PARTIAL_PAYMENT;
@@ -310,6 +323,49 @@ class OrderShopBuilder
return $orderShop;
}


public function initStatsInfo(OrderShopInterface $orderShop, $flush = true)
{
$orderShop->setStatTotal($this->priceSolver->getTotal($orderShop));
$orderShop->setStatTotalWithTax($this->priceSolver->getTotalWithTax($orderShop));
$orderShop->setStatTotalOrderProductsWithReductions(
$this->priceSolver->getTotalOrderProductsWithReductions($orderShop)
);
$orderShop->setStatTotalOrderProductsWithTaxAndReductions(
$this->priceSolver->getTotalOrderProductsWithTaxAndReductions($orderShop)
);
$orderShop->setStatMarginOrderProductsWithReductions(
$this->priceSolver->getMarginOrderProductsWithReductions($orderShop)
);
$orderShop->setStatDeliveryPriceWithReduction($this->priceSolver->getDeliveryPriceWithReduction($orderShop));
$orderShop->setStatDeliveryPriceWithTaxAndReduction(
$this->priceSolver->getDeliveryPriceWithTaxAndReduction($orderShop)
);

$this->entityManager->persist($orderShop);
if ($flush) {
$this->entityManager->flush();
}
}

public function initCycleNumber(OrderShopInterface $orderShop): void
{
$cycleNumber = null;
$deliveryDate = $orderShop->getDeliveryDate();

switch ($orderShop->getSection()->getCycle()) {
case SectionModel::CYCLE_DAY:
$cycleNumber = $deliveryDate->format('z');
break;
case SectionModel::CYCLE_WEEK:
$cycleNumber = $deliveryDate->format('W');
break;
}

$orderShop->setCycleNumber($cycleNumber);
}


public function createDocumentInvoice(OrderShopInterface $orderShop): DocumentInterface
{
$documentFactory = new DocumentFactory();
@@ -416,4 +472,121 @@ class OrderShopBuilder
$this->entityManager->flush();
}


public function updatePriceByProductFamily(ProductFamilyInterface $productFamily)
{
// @TODO : faire la vérification isOpenSale depuis la méthode appelante
if (!$this->openingResolver->isOpenSale($productFamily->getSection(), null,null, OpeningResolver::OPENING_CONTEXT_BACKEND)) {
$countOrderProductUpdated = 0;

foreach ($productFamily->getProducts() as $product) {
$orderProducts = $this->orderProductStore->getInCartsByProduct($product);

foreach ($orderProducts as $orderProduct) {
$quantityOrder = $orderProduct->getQuantityOrder();
$orderShop = $orderProduct->getOrderShop();
$orderShop->removeOrderProduct($orderProduct);
$this->entityManager->delete($orderProduct);
$this->entityManager->flush();
$this->entityManager->refresh($orderShop);

$orderProductFactory = new OrderProductFactory();
$addOrderProduct = $orderProductFactory->create($product, $quantityOrder);
$this->addOrderProduct($orderShop, $addOrderProduct);

$countOrderProductUpdated++;
}
}
if ($countOrderProductUpdated) {
// @TODO : faire le add flash dans le controller
/*$this->utils->addFlash(
'success',
'success.OrderShop.orderProductUpdated',
array(),
array('%count%' => $countOrderProductUpdated)
);*/
$this->entityManager->flush();
}

return $countOrderProductUpdated;
}
}


public function setStatsInfo(OrderShopInterface $orderShop, $flush = true)
{
$orderShop->setStatTotal($this->priceSolver->getTotal($orderShop));
$orderShop->setStatTotalWithTax($this->priceSolver->getTotalWithTax($orderShop));
$orderShop->setStatTotalOrderProductsWithReductions(
$this->priceSolver->getTotalOrderProductsWithReductions($orderShop)
);
$orderShop->setStatTotalOrderProductsWithTaxAndReductions(
$this->priceSolver->getTotalOrderProductsWithTaxAndReductions($orderShop)
);
$orderShop->setStatMarginOrderProductsWithReductions(
$this->priceSolver->getMarginOrderProductsWithReductions($orderShop)
);
$orderShop->setStatDeliveryPriceWithReduction($this->priceSolver->getDeliveryPriceWithReduction($orderShop));
$orderShop->setStatDeliveryPriceWithTaxAndReduction(
$this->priceSolver->getDeliveryPriceWithTaxAndReduction($orderShop)
);

$this->entityManager->update($orderShop);
if ($flush) {
$this->entityManager->flush();
}
}


public function setHasReach(int $reachStep, OrderShopInterface $orderShop)
{
if ($orderShop->getHasReach() === null || $orderShop->getHasReach() < $reachStep) {
$orderShop->setHasReach($reachStep);
$this->entityManager->persist($orderShop);
$this->entityManager->flush($orderShop);
}
}

public function initComplementaryOrderShop(OrderShopInterface $orderShop, OrderShopInterface $mainOrderShop): void
{
$orderShop->setMainOrderShop($mainOrderShop);
$orderShop->setDeliveryPrice(0);

if ($mainOrderShop->getDeliveryAddress()) {
$this->initDeliveryAddress($orderShop, $mainOrderShop->getDeliveryAddress());
}

$orderShop->setInvoiceAddress($mainOrderShop->getInvoiceAddress());
}

// setDeliveryAddress
public function initDeliveryAddress(OrderShopInterface $orderShop, AddressInterface $address):void
{
$orderShop->setDeliveryAddress($address);
$orderShop->setDeliveryInfos($address ? $address->getDeliveryInfos() : null);
}

// resetOrderShopInfos
public function reset(OrderShopInterface $orderShop)
{
$this->initDeliveryAddress($orderShop, null);
$orderShop->setMainOrderShop(null);
$orderShop->setDeliveryPrice(null);
$orderShop->setInvoiceAddress(null);
$orderShop->setDeclineComplementaryOrderShop(false);
}


public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2)
{
$productsSalesStatistic = new ProductsSalesStatistic($this->entityManager, $entity, $nbWeek);

$productsSalesStatistic->init($section, $this->orderShopSolver, $this->openingResolver);
$productsSalesStatistic->populateProperties($this->orderShopStore);

return $productsSalesStatistic->getAsArray();
}



}

+ 0
- 90
Checker/OrderChecker.php Vedi File

@@ -1,90 +0,0 @@
<?php

namespace Lc\CaracoleBundle\Checker;

use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver;
use Lc\CaracoleBundle\Solver\Price\PriceSolver;

class OrderChecker
{
protected PriceSolver $priceSolver;
protected OrderShopSolver $orderShopSolver;

public function __construct(PriceSolver $priceSolver, OrderShopSolver $orderShopSolver)
{
$this->priceSolver = $priceSolver;
$this->orderShopSolver = $orderShopSolver;
}

public function hasOrderProductAlreadyInCart(
OrderShopInterface $orderShop,
OrderProductInterface $orderProductTest
): ?OrderProductInterface {
foreach ($orderShop->getOrderProducts() as $orderProduct) {
if ($orderProduct->getProduct() == $orderProductTest->getProduct()) {
return $orderProduct;
}
}

return null;
}

public function isValid(OrderShopInterface $orderShop): bool
{
if ($orderShop->getOrderStatus() && in_array(
$orderShop->getOrderStatus()->getAlias(),
OrderStatusModel::$statusAliasAsValid
) > 0) {
return true;
}

return false;
}

public function isCart(OrderShopInterface $orderShop): bool
{
if ($orderShop->getOrderStatus() && in_array(
$orderShop->getOrderStatus()->getAlias(),
OrderStatusModel::$statusAliasAsCart
) > 0) {
return true;
}

return false;
}

// isOrderShopPositiveAmount
public function isPositiveAmount(OrderShopInterface $orderShop): bool
{
return $this->priceSolver->getTotalWithTax($orderShop) >= 0;
}

public function isPaid(OrderShopInterface $orderShop, $mergeComplementaryOrderShop = false): bool
{
$totalOrderPayments = $this->orderShopSolver->getTotalOrderPayments($orderShop, $mergeComplementaryOrderShop);
$totalOrder = $this->priceSolver->getTotalWithTax($orderShop);

if ((abs($totalOrderPayments - $totalOrder) < 0.00001
|| $totalOrderPayments >= $totalOrder)
&& $totalOrder > 0) {
return true;
} else {
return false;
}
}

// isOrderShopPositiveAmountRemainingToBePaid
public function isPositiveAmountRemainingToBePaid(OrderShopInterface $orderShop): bool
{
return $this->orderShopSolver->getTotalRemainingToBePaid($orderShop) > 0;
}

public function isCartAllowToBeOrder(OrderShopInterface $orderShop): bool
{
return true;
}

}

+ 0
- 9
Container/Order/OrderShopContainer.php Vedi File

@@ -3,7 +3,6 @@
namespace Lc\CaracoleBundle\Container\Order;

use Lc\CaracoleBundle\Builder\Order\OrderShopBuilder;
use Lc\CaracoleBundle\Checker\OrderChecker;
use Lc\CaracoleBundle\Factory\Order\OrderShopFactory;
use Lc\CaracoleBundle\Repository\Order\OrderShopRepositoryQuery;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
@@ -13,7 +12,6 @@ class OrderShopContainer
{
protected OrderShopFactory $orderShopFactory;
protected OrderShopSolver $orderShopSolver;
protected OrderChecker $orderChecker;
protected OrderShopRepositoryQuery $orderShopRepositoryQuery;
protected OrderShopStore $orderShopStore;
protected OrderShopBuilder $orderShopBuilder;
@@ -21,14 +19,12 @@ class OrderShopContainer
public function __construct(
OrderShopFactory $orderShopFactory,
OrderShopSolver $orderShopSolver,
OrderChecker $orderChecker,
OrderShopRepositoryQuery $orderShopRepositoryQuery,
OrderShopStore $orderShopStore,
OrderShopBuilder $orderShopBuilder
) {
$this->orderShopFactory = $orderShopFactory;
$this->orderShopSolver = $orderShopSolver;
$this->orderChecker = $orderChecker;
$this->orderShopRepositoryQuery = $orderShopRepositoryQuery;
$this->orderShopStore = $orderShopStore;
$this->orderShopBuilder = $orderShopBuilder;
@@ -44,11 +40,6 @@ class OrderShopContainer
return $this->orderShopSolver;
}

public function getChecker(): OrderChecker
{
return $this->orderChecker;
}

public function getRepositoryQuery(): OrderShopRepositoryQuery
{
return $this->orderShopRepositoryQuery;

+ 28
- 21
EventSubscriber/SettingEventSubscriber.php Vedi File

@@ -9,36 +9,42 @@ use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;

class SettingEventSubscriber implements EventSubscriberInterface
{
protected $em;
protected $merchantRepository;
protected $sectionRepository;
protected $merchantSettingDefinition;
protected $sectionSettingDefinition;
protected $merchantSettingFactory;
protected $sectionSettingFactory;
protected EntityManagerInterface $entityManager;
protected MerchantSettingDefinitionInterface $merchantSettingDefinition;
protected SectionSettingDefinitionInterface $sectionSettingDefinition;
protected MerchantStore $merchantStore;
protected SectionStore $sectionStore;
protected MerchantSettingFactory $merchantSettingFactory;
protected SectionSettingFactory $sectionSettingFactory;
protected SettingSolver $settingSolver;

public function __construct(
EntityManagerInterface $em,
EntityManagerInterface $entityManager,
MerchantSettingDefinitionInterface $merchantSettingDefinition,
SectionSettingDefinitionInterface $sectionSettingDefinition,
MerchantRepository $merchantRepository,
SectionRepository $sectionRepository,
MerchantStore $merchantStore,
SectionStore $sectionStore,
MerchantSettingFactory $merchantSettingFactory,
SectionSettingFactory $sectionSettingFactory
SectionSettingFactory $sectionSettingFactory,
SettingSolver $settingSolver
) {
$this->em = $em;
$this->merchantRepository = $merchantRepository;
$this->sectionRepository = $sectionRepository;
$this->entityManager = $entityManager;
$this->merchantStore = $merchantStore;
$this->sectionStore = $sectionStore;
$this->merchantSettingDefinition = $merchantSettingDefinition;
$this->sectionSettingDefinition = $sectionSettingDefinition;
$this->merchantSettingFactory = $merchantSettingFactory;
$this->sectionSettingFactory = $sectionSettingFactory;
$this->settingSolver = $settingSolver;
}

public static function getSubscribedEvents()
@@ -53,14 +59,16 @@ class SettingEventSubscriber implements EventSubscriberInterface
$this->initSettingsGeneric(
'merchant',
$this->merchantSettingDefinition->getSettings(),
$this->merchantRepository->findAll(),
//TODO vérifier que ce soit bien les online que l'on souhaite
$this->merchantStore->getOnline(),
$this->merchantSettingFactory
);

$this->initSettingsGeneric(
'section',
$this->sectionSettingDefinition->getSettings(),
$this->sectionRepository->findAll(),
//TODOJ'en suis là !!! Et je sais pas ce que je dois mettre, tout les sections ? et les sections d'un merchant ?
$this->sectionStore->getOnline(),
$this->sectionSettingFactory
);
}
@@ -80,7 +88,6 @@ class SettingEventSubscriber implements EventSubscriberInterface
}

if ($createEntitySetting) {

$text = null;
$date = null;
$file = null;
@@ -97,22 +104,22 @@ class SettingEventSubscriber implements EventSubscriberInterface

$entitySetting = $factory->create($entity, $setting['name'], $text, $date, $file);

$this->em->persist($entitySetting);
$this->entityManager->persist($entitySetting);
}
} else {
if ($entitySetting->getValue() === null
if ($this->settingSolver->getValue($entitySetting) === null
&& isset($setting['default'])
&& $setting['default'] !== null) {
$methodSetValue = 'set' . ucfirst($setting['field']);
$entitySetting->$methodSetValue($setting['default']);
$this->em->update($entitySetting);
$this->entityManager->update($entitySetting);
}
}
}
}
}

$this->em->flush();
$this->entityManager->flush();
}

}

+ 6
- 6
Model/Config/UnitInterface.php Vedi File

@@ -12,25 +12,25 @@ interface UnitInterface

public function getUnit(): ?string;

public function setUnit(string $unit): \Lc\CaracoleBundle\Model\Config\UnitModel;
public function setUnit(string $unit);

public function getWording(): ?string;

public function setWording(string $wording): \Lc\CaracoleBundle\Model\Config\UnitModel;
public function setWording(string $wording);

public function getWordingUnit(): ?string;

public function setWordingUnit(string $wordingUnit): \Lc\CaracoleBundle\Model\Config\UnitModel;
public function setWordingUnit(string $wordingUnit);

public function getWordingShort(): ?string;

public function setWordingShort(string $wordingShort): \Lc\CaracoleBundle\Model\Config\UnitModel;
public function setWordingShort(string $wordingShort);

public function getCoefficient(): ?int;

public function setCoefficient(int $coefficient): \Lc\CaracoleBundle\Model\Config\UnitModel;
public function setCoefficient(int $coefficient);

public function getUnitReference(): ?self;

public function setUnitReference(?self $unitReference): \Lc\CaracoleBundle\Model\Config\UnitModel;
public function setUnitReference(?UnitModel $unitReference): self;
}

+ 1
- 1
Model/Credit/CreditHistoryModel.php Vedi File

@@ -29,7 +29,7 @@ abstract class CreditHistoryModel extends AbstractLightEntity implements PayoffI
const MEAN_PAYMENT_TRANSFER = 'transfer';
const MEAN_PAYMENT_CASH = 'cash';

/**$merchant
/**
* @ORM\Column(type="float", nullable=true)
*/
protected $amount;

+ 50
- 50
Model/Order/OrderShopInterface.php Vedi File

@@ -21,27 +21,27 @@ interface OrderShopInterface
public function getValidationDate(): ?\DateTimeInterface;

public function setValidationDate(\DateTimeInterface $validationDate
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getUser(): ?UserInterface;

public function setUser(?UserInterface $user): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setUser(?UserInterface $user): OrderShopModel;

public function getInvoiceAddress(): ?AddressInterface;

public function setInvoiceAddress(?AddressInterface $invoiceAddress): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setInvoiceAddress(?AddressInterface $invoiceAddress): OrderShopModel;

public function getInvoiceAddressText(): ?string;

public function setInvoiceAddressText(string $invoiceAddressText): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setInvoiceAddressText(string $invoiceAddressText): OrderShopModel;

public function getComment(): ?string;

public function setComment(?string $comment): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setComment(?string $comment): OrderShopModel;

public function getMeanPayment(): ?string;

public function setMeanPayment(string $meanPayment): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setMeanPayment(string $meanPayment): OrderShopModel;

/**
* @return Collection|OrderStatusHistoryInterface[]
@@ -49,43 +49,43 @@ interface OrderShopInterface
public function getOrderStatusHistories(): Collection;

public function addOrderStatusHistory(OrderStatusHistoryInterface $orderStatusHistory
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function removeOrderStatusHistory(OrderStatusHistoryInterface $orderStatusHistory
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

/**
* @return Collection|OrderPaymentInterface[]
*/
public function getOrderPayments($meanPayment = null): Collection;

public function addOrderPayment(OrderPaymentInterface $orderPayment): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function addOrderPayment(OrderPaymentInterface $orderPayment): OrderShopModel;

public function removeOrderPayment(OrderPaymentInterface $orderPayment
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

/**
* @return Collection|OrderProductInterface[]
*/
public function getOrderProducts(): Collection;

public function addOrderProduct(OrderProductInterface $orderProduct): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function addOrderProduct(OrderProductInterface $orderProduct): OrderShopModel;

public function removeOrderProduct(OrderProductInterface $orderProduct
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getVisitor(): ?VisitorInterface;

public function setVisitor(?VisitorInterface $visitor): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setVisitor(?VisitorInterface $visitor): OrderShopModel;

public function getDeliveryInfos(): ?string;

public function setDeliveryInfos(?string $deliveryInfos): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setDeliveryInfos(?string $deliveryInfos): OrderShopModel;

public function getOrderStatus(): ?OrderStatusInterface;

public function setOrderStatusProtected(?OrderStatusInterface $orderStatus
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

/**
* @return Collection|OrderReductionCartInterface[]
@@ -93,10 +93,10 @@ interface OrderShopInterface
public function getOrderReductionCarts(): Collection;

public function addOrderReductionCart(OrderReductionCartInterface $orderReductionCart
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function removeOrderReductionCart(OrderReductionCartInterface $orderReductionCart
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

/**
* @return Collection|OrderReductionCreditInterface[]
@@ -104,139 +104,139 @@ interface OrderShopInterface
public function getOrderReductionCredits(): Collection;

public function addOrderReductionCredit(OrderReductionCreditInterface $orderReductionCredit
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function removeOrderReductionCredit(OrderReductionCreditInterface $orderReductionCredit
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

/**
* @return Collection|DocumentInterface[]
*/
public function getDocuments(): Collection;

public function addDocument(DocumentInterface $document): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function addDocument(DocumentInterface $document): OrderShopModel;

public function removeDocument(DocumentInterface $document): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function removeDocument(DocumentInterface $document): OrderShopModel;

/**
* @return Collection|TicketInterface[]
*/
public function getTickets(): Collection;

public function addTicket(TicketInterface $ticket): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function addTicket(TicketInterface $ticket): OrderShopModel;

public function removeTicket(TicketInterface $ticket): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function removeTicket(TicketInterface $ticket): OrderShopModel;

public function getSection(): ?SectionInterface;

public function setSection(?SectionInterface $section): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setSection(?SectionInterface $section): OrderShopModel;

public function getCycleId(): ?int;

public function setCycleId(?int $cycleId): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setCycleId(?int $cycleId): OrderShopModel;

public function getCycleNumber(): ?int;

public function setCycleNumber(?int $cycleNumber): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setCycleNumber(?int $cycleNumber): OrderShopModel;

public function getOrderShopCreatedAt(): ?\DateTimeInterface;

public function setOrderShopCreatedAt(?\DateTimeInterface $orderShopCreatedAt
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getIdValidOrder(): ?int;

public function setIdValidOrder(?int $idValidOrder): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setIdValidOrder(?int $idValidOrder): OrderShopModel;

public function getDeliveryAddress(): ?AddressInterface;

public function setDeliveryAddress(?AddressInterface $deliveryAddress
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getDeliveryAddressText(): ?string;

public function setDeliveryAddressText(string $deliveryAddressText): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setDeliveryAddressText(string $deliveryAddressText): OrderShopModel;

public function getDeliveryPointSale(): ?PointSaleInterface;

public function setDeliveryPointSale(?PointSaleInterface $deliveryPointSale
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getDeliveryType(): ?string;

public function setDeliveryType(?string $deliveryType): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setDeliveryType(?string $deliveryType): OrderShopModel;

public function getDeliveryPrice(): ?float;

public function setDeliveryPrice(?float $deliveryPrice): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setDeliveryPrice(?float $deliveryPrice): OrderShopModel;

public function getDeliveryTaxRate(): ?TaxRateInterface;

public function setDeliveryTaxRate(?TaxRateInterface $deliveryTaxRate
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getReference(): ?string;

public function setReference(?string $reference): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setReference(?string $reference): OrderShopModel;

public function getMainOrderShop(): ?self;

public function setMainOrderShop(?self $mainOrderShop): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setMainOrderShop(?OrderShopModel $mainOrderShop): OrderShopModel;

/**
* @return Collection|OrderShopInterface[]
*/
public function getComplementaryOrderShops(): Collection;

public function addComplementaryOrderShop(self $complementaryOrderShop
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function addComplementaryOrderShop(OrderShopModel $complementaryOrderShop
): OrderShopModel;

public function removeComplementaryOrderShop(self $complementaryOrderShop
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function removeComplementaryOrderShop(OrderShopModel $complementaryOrderShop
): OrderShopModel;

public function getDeclineComplementaryOrderShop(): ?bool;

public function setDeclineComplementaryOrderShop(?bool $declineComplementaryOrderShop
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getOrderAllowByAdmin(): ?bool;

public function setOrderAllowByAdmin(?bool $orderAllowByAdmin): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setOrderAllowByAdmin(?bool $orderAllowByAdmin): OrderShopModel;

public function getHasReach(): ?int;

public function setHasReach(?int $hasReach): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setHasReach(?int $hasReach): OrderShopModel;

public function getStatTotal(): ?float;

public function setStatTotal(?float $statTotal): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setStatTotal(?float $statTotal): OrderShopModel;

public function getStatTotalWithTax(): ?float;

public function setStatTotalWithTax(?float $statTotalWithTax): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
public function setStatTotalWithTax(?float $statTotalWithTax): OrderShopModel;

public function getStatTotalOrderProductsWithReductions(): ?float;

public function setStatTotalOrderProductsWithReductions(?float $statTotalOrderProductsWithReductions
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getStatTotalOrderProductsWithTaxAndReductions(): ?float;

public function setStatTotalOrderProductsWithTaxAndReductions(?float $statTotalOrderProductsWithTaxAndReductions
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getStatMarginOrderProductsWithReductions(): ?float;

public function setStatMarginOrderProductsWithReductions(?float $statMarginOrderProductsWithReductions
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getStatDeliveryPriceWithReduction(): ?float;

public function setStatDeliveryPriceWithReduction(?float $statDeliveryPriceWithReduction
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;

public function getStatDeliveryPriceWithTaxAndReduction(): ?float;

public function setStatDeliveryPriceWithTaxAndReduction(?float $statDeliveryPriceWithTaxAndReduction
): \Lc\CaracoleBundle\Model\Order\OrderShopModel;
): OrderShopModel;
}

+ 7
- 7
Model/Product/ProductCategoryInterface.php Vedi File

@@ -13,11 +13,11 @@ interface ProductCategoryInterface
{
public function getSection(): SectionInterface;

public function setSection(SectionInterface $section): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
public function setSection(SectionInterface $section): ProductCategoryModel;

public function getParent(): ?self;

public function setParent(?self $productCategory): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
public function setParent(?ProductCategoryModel $productCategory): ProductCategoryModel;

public function getParentCategory();

@@ -26,9 +26,9 @@ interface ProductCategoryInterface
*/
public function getChildrens(): Collection;

public function addChildren(self $productCategory): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
public function addChildren(ProductCategoryModel $productCategory): ProductCategoryModel;

public function removeChildren(self $productCategory): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
public function removeChildren(ProductCategoryModel $productCategory): ProductCategoryModel;

/**
* @return Collection|ProductFamilyInterface[]
@@ -36,14 +36,14 @@ interface ProductCategoryInterface
public function getProductFamilies(): Collection;

public function addProductFamily(ProductFamilyInterface $productFamily
): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
): ProductCategoryModel;

public function removeProductFamily(ProductFamilyInterface $productFamily
): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
): ProductCategoryModel;

public function countProductFamilies($status = null);

public function getSaleStatus(): ?bool;

public function setSaleStatus(bool $saleStatus): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel;
public function setSaleStatus(bool $saleStatus): ProductCategoryModel;
}

+ 41
- 41
Model/Product/ProductFamilyInterface.php Vedi File

@@ -33,7 +33,7 @@ interface ProductFamilyInterface

public function getSection(): SectionInterface;

public function setSection(SectionInterface $section): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setSection(SectionInterface $section): ProductFamilyModel;

public function getAvailableQuantityInherited();

@@ -41,20 +41,20 @@ interface ProductFamilyInterface

public function getActiveProducts(): ?bool;

public function setActiveProducts(bool $activeProducts): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setActiveProducts(bool $activeProducts): ProductFamilyModel;

public function getProductsQuantityAsTitle(): ?bool;

public function setProductsQuantityAsTitle(bool $productsQuantityAsTitle
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getProductsType(): ?string;

public function setProductsType(?string $productsType): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setProductsType(?string $productsType): ProductFamilyModel;

public function getQuantityLabel(): ?string;

public function setQuantityLabel(?string $quantityLabel): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setQuantityLabel(?string $quantityLabel): ProductFamilyModel;

/**
* @return Collection|ProductInterface[]
@@ -63,16 +63,16 @@ interface ProductFamilyInterface

public function getProductsOnline(): Collection;

public function addProduct(ProductInterface $product): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function addProduct(ProductInterface $product): ProductFamilyModel;

public function removeProduct(ProductInterface $product): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function removeProduct(ProductInterface $product): ProductFamilyModel;

public function getReductionCatalog(): ?ReductionCatalogInterface;

public function getReductionCatalogInherited(): ?ReductionCatalogInterface;

public function setReductionCatalog(?ReductionCatalogInterface $reductionCatalog
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

/**
* @return Collection|ProductCategoryInterface[]
@@ -82,10 +82,10 @@ interface ProductFamilyInterface
public function initProductCategories();

public function addProductCategory(ProductCategoryInterface $productCategory
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function removeProductCategory(ProductCategoryInterface $productCategory
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getProductCategoryParent();

@@ -93,134 +93,134 @@ interface ProductFamilyInterface

public function getSubtitle(): ?string;

public function setSubtitle(?string $subtitle): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setSubtitle(?string $subtitle): ProductFamilyModel;

public function getWarningMessage(): ?string;

public function setWarningMessage(?string $warningMessage): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setWarningMessage(?string $warningMessage): ProductFamilyModel;

public function getWarningMessageType(): ?string;

public function setWarningMessageType(?string $warningMessageType
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getNote(): ?string;

public function setNote(?string $note): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setNote(?string $note): ProductFamilyModel;

public function getBehaviorOutOfStock(): ?string;

public function setBehaviorOutOfStock(?string $behaviorOutOfStock
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getBehaviorCountStock(): ?string;

public function setBehaviorCountStock(string $behaviorCountStock
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getExportTitle(): ?string;

public function setExportTitle(?string $exportTitle): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setExportTitle(?string $exportTitle): ProductFamilyModel;

public function getExportNote(): ?string;

public function setExportNote(?string $exportNote): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setExportNote(?string $exportNote): ProductFamilyModel;

public function getBehaviorStockWeek(): ?string;
public function getBehaviorStockCycle(): ?string;

public function setBehaviorStockWeek(string $behaviorStockWeek
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setBehaviorStockCycle(string $behaviorStockWeek
): ProductFamilyModel;

public function getAvailabilityRenewedThisWeek(): ?bool;

public function setAvailabilityRenewedThisWeek(?bool $availabilityRenewedThisWeek
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getBehaviorDisplaySale(): ?string;

public function setBehaviorDisplaySale(string $behaviorDisplaySale
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function isPropertyNoveltyOnline(): ?bool;

public function getPropertyNoveltyExpirationDate(): ?\DateTimeInterface;

public function setPropertyNoveltyExpirationDate(?\DateTimeInterface $propertyNoveltyExpirationDate
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyOrganicLabel(): ?string;

public function setPropertyOrganicLabel(?string $propertyOrganicLabel
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyAllergens(): ?string;

public function setPropertyAllergens(?string $propertyAllergens
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyComposition(): ?string;

public function setPropertyComposition(?string $propertyComposition
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyFragrances(): ?string;

public function setPropertyFragrances(?string $propertyFragrances
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function countProperties(): bool;

public function getBehaviorExpirationDate(): ?string;

public function setBehaviorExpirationDate(?string $behaviorExpirationDate
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getTypeExpirationDate(): ?string;

public function setTypeExpirationDate(?string $typeExpirationDate
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyWeight(): ?string;

public function setPropertyWeight(?string $propertyWeight): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setPropertyWeight(?string $propertyWeight): ProductFamilyModel;

public function getPropertyQuantity(): ?string;

public function setPropertyQuantity(?string $propertyQuantity): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setPropertyQuantity(?string $propertyQuantity): ProductFamilyModel;

public function getPropertyVariety(): ?string;

public function setPropertyVariety(?string $propertyVariety): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setPropertyVariety(?string $propertyVariety): ProductFamilyModel;

public function getPropertyFeature(): ?string;

public function setPropertyFeature(?string $propertyFeature): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setPropertyFeature(?string $propertyFeature): ProductFamilyModel;

public function getPropertyAlcoholLevel(): ?string;

public function setPropertyAlcoholLevel(?string $propertyAlcoholLevel
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyPackaging(): ?string;

public function setPropertyPackaging(?string $propertyPackaging
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getPropertyCharacteristics(): ?string;

public function setPropertyCharacteristics(?string $propertyCharacteristics
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getBehaviorAddToCart(): ?string;

public function setBehaviorAddToCart(?string $behaviorAddToCart
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
): ProductFamilyModel;

public function getBehaviorPrice(): ?string;

public function getBehaviorPriceInherited();

public function setBehaviorPrice(?string $behaviorPrice): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setBehaviorPrice(?string $behaviorPrice): ProductFamilyModel;

public function hasProductsWithVariousWeight();

@@ -234,7 +234,7 @@ interface ProductFamilyInterface

public function getSaleStatus(): ?bool;

public function setSaleStatus(bool $saleStatus): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setSaleStatus(bool $saleStatus): ProductFamilyModel;

public function getFieldBuyingPrice();

@@ -242,5 +242,5 @@ interface ProductFamilyInterface

public function getImage(): ?FileInterface;

public function setImage(?FileInterface $image): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
public function setImage(?FileInterface $image): ProductFamilyModel;
}

+ 5
- 5
Model/Product/ProductFamilyModel.php Vedi File

@@ -208,7 +208,7 @@ abstract class ProductFamilyModel extends AbstractFullEntity implements ProductP
/**
* @ORM\Column(type="string", length=255)
*/
protected $behaviorStockWeek;
protected $behaviorStockCycle;

/**
* @ORM\Column(type="boolean", nullable=true)
@@ -654,14 +654,14 @@ abstract class ProductFamilyModel extends AbstractFullEntity implements ProductP
return $this;
}

public function getBehaviorStockWeek(): ?string
public function getBehaviorStockCycle(): ?string
{
return $this->behaviorStockWeek;
return $this->behaviorStockCycle;
}

public function setBehaviorStockWeek(string $behaviorStockWeek): self
public function setBehaviorStockCycle(string $behaviorStockCycle): self
{
$this->behaviorStockWeek = $behaviorStockWeek;
$this->behaviorStockCycle = $behaviorStockCycle;

return $this;
}

+ 102
- 0
Repository/Order/OrderProductRepositoryQuery.php Vedi File

@@ -3,12 +3,114 @@
namespace Lc\CaracoleBundle\Repository\Order;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class OrderProductRepositoryQuery extends AbstractRepositoryQuery
{

protected bool $isJoinProduct = false;
protected bool $isJoinProductFamily = false;
protected bool $isJoinOrderShop = false;
protected bool $isJoinOrderStatus = false;

public function __construct(OrderProductRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
public function filterByOrderShop(OrderShopInterface $orderShop): self
{
return $this
->andWhere('.orderShop = :orderShop')
->setParameter('orderShop', $orderShop);
}

public function filterByProduct(ProductInterface $product): self
{
return $this
->andWhere('.product = :product')
->setParameter('product', $product);
}

public function filterByUser(UserInterface $user): self
{
$this->joinOrderShop();

return $this
->andWhere('orderShop.user = :user')
->setParameter('user', $user);
}

public function filterBySection(SectionInterface $section): self
{
$this->joinOrderShop();

return $this->andWhereSection('orderShop', $section);
}

public function filterByOrderStatus(array $status): self
{
$this->joinOrderStatus();

return $this
->andWhere('os.alias IN (:alias)')
->setParameter('alias', $status);
}


public function selectCount(): self
{
return $this
->select('count(r.id) as total');
}

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

return $this
->leftJoin('.product', 'product');
}
return $this;
}

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

return $this
->leftJoin('product.productFamily', 'productFamily');
}
return $this;
}

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

return $this
->leftJoin('.orderShop', 'orderShop');
}
return $this;
}

public function joinOrderStatus(): self
{
$this->joinOrderShop();
if (!$this->isJoinOrderStatus) {
$this->isJoinOrderStatus = true;

return $this
->leftJoin('orderShop.orderStatus', 'os');
}
return $this;
}
}

+ 14
- 2
Repository/Order/OrderProductStore.php Vedi File

@@ -2,13 +2,16 @@

namespace Lc\CaracoleBundle\Repository\Order;

use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class OrderProductStore extends AbstractStore
{
use SectionStoreTrait;

protected OrderProductRepositoryQuery $query;

public function __construct(OrderProductRepositoryQuery $query)
@@ -24,6 +27,7 @@ class OrderProductStore extends AbstractStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->filterBySection($this->section);
return $query;
}

@@ -31,4 +35,12 @@ class OrderProductStore extends AbstractStore
{
return $query;
}

//findOrderProductsInCartsByProduct
public function getInCartsByProduct(ProductInterface $product, $query = null): array
{
$query = $this->createDefaultQuery($query);
$query->filterByProduct($product);
$query->filterByOrderStatus(OrderStatusModel::$statusAliasAsValid);
}
}

+ 34
- 2
Repository/Order/OrderShopStore.php Vedi File

@@ -21,6 +21,7 @@ use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver;
use Lc\CaracoleBundle\Solver\Price\PriceSolver;
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver;
use Lc\CaracoleBundle\Statistic\Product\ProductsSalesStatistic;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
@@ -58,7 +59,6 @@ class OrderShopStore extends AbstractStore
OrderProductStore $orderProductStore,
MerchantStore $merchantStore,
FlashBagInterface $flashBag,
OpeningResolver $openingResolver,
ParameterBagInterface $parameterBag,
UrlGeneratorInterface $router,
OrderShopSolver $orderShopSolver
@@ -73,7 +73,6 @@ class OrderShopStore extends AbstractStore
$this->orderProductStore = $orderProductStore;
$this->merchantStore = $merchantStore;
$this->flashBag = $flashBag;
$this->openingResolver = $openingResolver;
$this->parameterBag = $parameterBag;
$this->router = $router;
$this->orderShopSolver = $orderShopSolver;
@@ -513,4 +512,37 @@ class OrderShopStore extends AbstractStore

return $reductionCartsArray;
}

public function countValidOrderProductsOfCyclesByProducts(array $cycleNumbers, array $products, $query =null): array
{
$query = $this->createDefaultQuery($query);

$query
->filterByAlias(OrderStatusModel::$statusAliasAsValid)
->filterByCycleNumbers($cycleNumbers)
->filterByProducts($products)
->selectSum()
->groupBy('.cycleNumber, product.id');

return $query->find();
}

public function countValidOrderProductsOfCycleByProduct(int $cycleNumber, int $productId, $query =null): ?string
{
$query = $this->createDefaultQuery($query);

$query
->filterByAlias(OrderStatusModel::$statusAliasAsValid)
->filterByCycleNumber($cycleNumber)
->filterByProduct($productId)
->selectSumQuantityOrder()
->groupBy('.cycleNumber, product.id');

$result = $query->findOne();

if ($result) {
return $result['quantity'];
}
return null;
}
}

+ 2
- 7
Repository/Product/ProductFamilyRepositoryQuery.php Vedi File

@@ -6,7 +6,7 @@ use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQuery
class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
{
protected bool $isJoinProductCategories;
protected bool $isJoinProducts;
@@ -66,12 +66,7 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery implements Re
->setParameter('now', $dateTime);
}

public function filterPropertyLargeVolume(): self
{
return $this->andWhere('.propertyLargeVolume = 1');
}

public function filterPropertyOrganicLabel(): self
public function filterIsOrganicLabel(): self
{
return $this->andWhere('.propertyOrganicLabel IS NOT NULL');
}

+ 0
- 10
Repository/Product/ProductFamilyStore.php Vedi File

@@ -62,17 +62,7 @@ class ProductFamilyStore extends AbstractStore

return $query->find();
}
//getProductFamiliesLargeVolumes
public function getLargeVolumes($query = null)
{
$query = $this->createDefaultQuery($query);

$query
->filterPropertyLargeVolume()
->filterIsOnline();

return $query->find();
}
//getProductFamiliesOrganics
public function getOrganics($query = null)
{

+ 1
- 4
Repository/Reduction/ReductionCartStore.php Vedi File

@@ -19,18 +19,15 @@ class ReductionCartStore extends AbstractStore
protected ReductionCartRepositoryQuery $query;
protected ReductionCartSolver $reductionCartSolver;
protected PriceSolver $priceSolver;
protected FlashBagInterface $flashBag;

public function __construct(
ReductionCartRepositoryQuery $query,
ReductionCartSolver $reductionCartSolver,
PriceSolver $priceSolver,
FlashBagInterface $flashBag,
PriceSolver $priceSolver
) {
$this->query = $query;
$this->reductionCartSolver = $reductionCartSolver;
$this->priceSolver = $priceSolver;
$this->flashBag = $flashBag;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface

+ 13
- 0
Resolver/OpeningResolver.php Vedi File

@@ -12,6 +12,9 @@ use Symfony\Component\Security\Core\Security;

class OpeningResolver
{
const OPENING_CONTEXT_FRONTEND = 'frontend' ;
const OPENING_CONTEXT_BACKEND = 'backend' ;

protected array $messages = [];
protected SectionResolver $sectionResolver;
protected Security $security;
@@ -166,4 +169,14 @@ class OpeningResolver
{
$this->messages[] = $message;
}

public function isOpenSaleOnlyComplementaryOrders(Section $section, UserInterface $user)
{
// @TODO : ajouter une option dans les sections (permettre les commandes complémentaires ou non)
$orderShopsUser = $this->orderShopStore->setSection($section)->getByCurrentCycleAndUser($user);

return $this->isOpenSale($section, $user)
&& $this->isMaximumOrderCycleAchieved($section)
&& count($orderShopsUser) > 0;
}
}

+ 70
- 0
Solver/Order/OrderShopSolver.php Vedi File

@@ -5,6 +5,7 @@ namespace Lc\CaracoleBundle\Solver\Order;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Model\File\DocumentInterface;
use Lc\CaracoleBundle\Model\File\DocumentModel;
use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopModel;
use Lc\CaracoleBundle\Model\Order\OrderStatusInterface;
@@ -214,4 +215,73 @@ class OrderShopSolver
return false;
}



public function hasOrderProductAlreadyInCart(
OrderShopInterface $orderShop,
OrderProductInterface $orderProductTest
): ?OrderProductInterface {
foreach ($orderShop->getOrderProducts() as $orderProduct) {
if ($orderProduct->getProduct() == $orderProductTest->getProduct()) {
return $orderProduct;
}
}

return null;
}

public function isValid(OrderShopInterface $orderShop): bool
{
if ($orderShop->getOrderStatus() && in_array(
$orderShop->getOrderStatus()->getAlias(),
OrderStatusModel::$statusAliasAsValid
) > 0) {
return true;
}

return false;
}

public function isCart(OrderShopInterface $orderShop): bool
{
if ($orderShop->getOrderStatus() && in_array(
$orderShop->getOrderStatus()->getAlias(),
OrderStatusModel::$statusAliasAsCart
) > 0) {
return true;
}

return false;
}

// isOrderShopPositiveAmount
public function isPositiveAmount(OrderShopInterface $orderShop): bool
{
return $this->priceSolver->getTotalWithTax($orderShop) >= 0;
}

public function isPaid(OrderShopInterface $orderShop, $mergeComplementaryOrderShop = false): bool
{
$totalOrderPayments = $this->getTotalOrderPayments($orderShop, $mergeComplementaryOrderShop);
$totalOrder = $this->priceSolver->getTotalWithTax($orderShop);

if ((abs($totalOrderPayments - $totalOrder) < 0.00001
|| $totalOrderPayments >= $totalOrder)
&& $totalOrder > 0) {
return true;
} else {
return false;
}
}

// isOrderShopPositiveAmountRemainingToBePaid
public function isPositiveAmountRemainingToBePaid(OrderShopInterface $orderShop): bool
{
return $this->getTotalRemainingToBePaid($orderShop) > 0;
}

public function isCartAllowToBeOrder(OrderShopInterface $orderShop): bool
{
return true;
}
}

+ 89
- 0
Statistic/Product/ProductsSalesStatistic.php Vedi File

@@ -0,0 +1,89 @@
<?php

namespace Lc\CaracoleBundle\Statistic\Product;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\Order\OrderProductStore;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\CaracoleBundle\Resolver\OpeningResolver;
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver;
use Lc\CaracoleBundle\Statistic\Statistic;

class ProductsSalesStatistic extends Statistic
{
protected int $nbCycle;
protected $productFamily;
protected $cycleNumbers = array();
protected $productIds = array();

public function __construct(EntityManagerInterface $entityManager, $productFamily, $nbCycle)
{
parent::__construct($entityManager);
$this->nbCycle = $nbCycle;
$this->productFamily = $productFamily;

$this->createProperties();
}

public function createProperties()
{
$this->addProperty(
'total_sales',
[
'label' => 'Total ventes'
]
);
foreach ($this->productFamily->getProducts() as $product) {
$this->productIds[$product->getId()] = $product;
$this->addProperty(
$product->getId(),
[
'label' => $product->getTitle()
]
);
}
}

// Initialise les valeurs des données pour chaque Interval de date
public function init(SectionInterface $section, OrderShopSolver $orderShopSolver, OpeningResolver $openingResolver)
{
$currentCycleNumber = $orderShopSolver->getCycleNumberCurrentOrder();
if ($openingResolver->isOpenSale($section, null, null,OpeningResolver::OPENING_CONTEXT_BACKEND) == false && date('w') > 2) {
$currentCycleNumber = $currentCycleNumber - 1;
}
$this->cycleNumbers = array();
for ($w = $currentCycleNumber - $this->nbCycle + 1; $w <= $currentCycleNumber; $w++) {
$this->cycleNumbers[] = $w;
$this->labels[$w] = 'S ' . $w;
foreach ($this->getProperties() as $propertyName => $property) {
$this->properties[$propertyName]['data'][$w] = 0;
}
foreach ($this->getAverageProperties() as $propertyName => $property) {
$this->averageProperties[$propertyName]['data'][$w] = 0;
}
}
}

public function populateProperties(OrderShopStore $orderShopStore)
{
$countsOrderedByCyclesAndProducts = $orderShopStore->countValidOrderProductsOfCyclesByProducts(
$this->cycleNumbers,
$this->productIds
);
foreach ($countsOrderedByCyclesAndProducts as $result) {
$this->setData($result['productId'], $result['cycleNumber'], $result['quantity']);
$product = $this->productIds[$result['productId']];
if ($this->productFamily->getBehaviorDisplaySale() == ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE) {
$ratioByMeasure = $product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient();
$this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']) * $ratioByMeasure);
} else {
$this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']));
}
}
$this->setAveragePropertiesData();
}


}

Loading…
Annulla
Salva