Browse Source

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

packProduct
Charly 3 years ago
parent
commit
de147795fb
8 changed files with 194 additions and 156 deletions
  1. +3
    -2
      Builder/Order/OrderShopBuilder.php
  2. +6
    -3
      Controller/Order/CartController.php
  3. +1
    -1
      Repository/Credit/CreditHistoryStore.php
  4. +153
    -145
      Repository/Order/OrderShopStore.php
  5. +1
    -1
      Repository/User/UserRepositoryQuery.php
  6. +2
    -1
      Repository/User/UserStore.php
  7. +13
    -2
      Solver/Price/PriceSolverTrait.php
  8. +15
    -1
      Solver/Section/OpeningSolver.php

+ 3
- 2
Builder/Order/OrderShopBuilder.php View File



$orderShop->addOrderReductionCredit($orderReductionCredit); $orderShop->addOrderReductionCredit($orderReductionCredit);


if ($this->isOrderShopPositiveAmount($orderShop)
&& $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) {
if ($this->orderShopResolver->isPositiveAmount($orderShop)
&& $this->orderShopResolver->isPositiveAmountRemainingToBePaid($orderShop)) {

$this->entityManager->create($orderReductionCredit); $this->entityManager->create($orderReductionCredit);
$this->entityManager->flush(); $this->entityManager->flush();



+ 6
- 3
Controller/Order/CartController.php View File

use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;


/**
* @Route("/{section}/panier", name="frontend_cart_")
*/
class CartController extends AbstractController class CartController extends AbstractController
{ {
protected ProductFamilyInterface $productFamily; protected ProductFamilyInterface $productFamily;
} }


/** /**
* @Route("/order-reduction-cart/delete/{id}", name="frontend_cart_delete_reduction_cart")
* @Route("/order-reduction-cart/delete/{id}", name="delete_reduction_cart")
*/ */
public function deleteReductionCart(Request $request): RedirectResponse public function deleteReductionCart(Request $request): RedirectResponse
{ {
} }


/** /**
* @Route("/reduction-credit/add/{id}", name="frontend_order_cart_reduction_credit")
* @Route("/reduction-credit/add/{id}", name="order_reduction_credit")
*/ */
public function addReductionCredit(Request $request): RedirectResponse public function addReductionCredit(Request $request): RedirectResponse
{ {
} }


/** /**
* @Route("/order-reduction-credit/delete/{id}", name="frontend_cart_delete_reduction_credit")
* @Route("/order-reduction-credit/delete/{id}", name="delete_reduction_credit")
*/ */
public function deleteReductionCredit(Request $request): RedirectResponse public function deleteReductionCredit(Request $request): RedirectResponse
{ {

+ 1
- 1
Repository/Credit/CreditHistoryStore.php View File



public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->orderBy('createdAt');
//$query->orderBy('createdAt');
return $query; return $query;
} }



+ 153
- 145
Repository/Order/OrderShopStore.php View File

use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\CaracoleBundle\Repository\AbstractStore; use Lc\CaracoleBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\FlashBagTranslator;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;


class OrderShopStore extends AbstractStore class OrderShopStore extends AbstractStore
protected SectionStore $sectionStore; protected SectionStore $sectionStore;
protected OrderProductStore $orderProductStore; protected OrderProductStore $orderProductStore;
protected MerchantStore $merchantStore; protected MerchantStore $merchantStore;
protected FlashBagInterface $flashBag;
protected FlashBagTranslator $flashBagTranslator;
protected OpeningResolver $openingResolver; protected OpeningResolver $openingResolver;
protected ParameterBagInterface $parameterBag; protected ParameterBagInterface $parameterBag;
protected UrlGeneratorInterface $router; protected UrlGeneratorInterface $router;
protected DistributionBuilder $distributionBuilder; protected DistributionBuilder $distributionBuilder;


public function __construct( public function __construct(
OrderShopRepositoryQuery $query,
EntityManagerInterface $entityManager,
PriceSolver $priceSolver,
DocumentBuilder $documentBuilder,
ReductionCreditStore $reductionCreditStore,
ReductionCartSolver $reductionCartSolver,
SectionStore $sectionStore,
OrderProductStore $orderProductStore,
MerchantStore $merchantStore,
FlashBagInterface $flashBag,
ParameterBagInterface $parameterBag,
UrlGeneratorInterface $router,
OrderShopSolver $orderShopSolver,
ReductionCartStore $reductionCartStore,
DistributionBuilder $distributionBuilder
) {
OrderShopRepositoryQuery $query,
EntityManagerInterface $entityManager,
PriceSolver $priceSolver,
DocumentBuilder $documentBuilder,
ReductionCreditStore $reductionCreditStore,
ReductionCartSolver $reductionCartSolver,
SectionStore $sectionStore,
OrderProductStore $orderProductStore,
MerchantStore $merchantStore,
FlashBagTranslator $flashBagTranslator,
ParameterBagInterface $parameterBag,
UrlGeneratorInterface $router,
OrderShopSolver $orderShopSolver,
ReductionCartStore $reductionCartStore,
DistributionBuilder $distributionBuilder
)
{
$this->query = $query; $this->query = $query;
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->priceSolver = $priceSolver; $this->priceSolver = $priceSolver;
$this->sectionStore = $sectionStore; $this->sectionStore = $sectionStore;
$this->orderProductStore = $orderProductStore; $this->orderProductStore = $orderProductStore;
$this->merchantStore = $merchantStore; $this->merchantStore = $merchantStore;
$this->flashBag = $flashBag;
$this->flashBagTranslator = $flashBagTranslator;
$this->parameterBag = $parameterBag; $this->parameterBag = $parameterBag;
$this->router = $router; $this->router = $router;
$this->orderShopSolver = $orderShopSolver; $this->orderShopSolver = $orderShopSolver;
public function getByCurrentDistribution($params = [], $query = null) public function getByCurrentDistribution($params = [], $query = null)
{ {
return $this->getBy( return $this->getBy(
array_merge(
[
'distribution' => $this->distributionBuilder->guessCurrentDistributionOrder($this->section),
'isValid' => true,
],
$params
),
$query
array_merge(
[
'distribution' => $this->distributionBuilder->guessCurrentDistributionOrder($this->section),
'isValid' => true,
],
$params
),
$query
); );
} }


public function getByCurrentDistributionAndUser(UserInterface $user = null, array $params = [], $query = null) public function getByCurrentDistributionAndUser(UserInterface $user = null, array $params = [], $query = null)
{ {
return $this->getByCurrentDistribution( return $this->getByCurrentDistribution(
array_merge(
[
'user' => $user,
'excludeComplementaryOrderShops' => true
],
$params
),
$query
array_merge(
[
'user' => $user,
'excludeComplementaryOrderShops' => true
],
$params
),
$query
); );
} }


public function countByCurrentDistribution(array $params, $query = null) public function countByCurrentDistribution(array $params, $query = null)
{ {
return $this->countBy( return $this->countBy(
array_merge(
[
'distribution' => $this->distributionBuilder->guessCurrentDistributionOrder($this->section),
'excludeComplementaryOrderShops' => isset($params['excludeComplementaryOrderShops']) ?? true,
],
$params
),
$query
array_merge(
[
'distribution' => $this->distributionBuilder->guessCurrentDistributionOrder($this->section),
'excludeComplementaryOrderShops' => isset($params['excludeComplementaryOrderShops']) ?? true,
],
$params
),
$query
); );


// @TODO : optimisation à remettre en place // @TODO : optimisation à remettre en place
public function countValidByUserAllMerchant($user, $query = null): int public function countValidByUserAllMerchant($user, $query = null): int
{ {
return $this->countBy( return $this->countBy(
[
'user' => $user,
'isValid' => true,
// @TODO : à tester
'isMerchantOnline' => true,
'excludeComplementaryOrderShops' => true
],
$query
[
'user' => $user,
'isValid' => true,
// @TODO : à tester
'isMerchantOnline' => true,
'excludeComplementaryOrderShops' => true
],
$query
); );
} }


public function countValidByUser(UserInterface $user = null, $query = null): int public function countValidByUser(UserInterface $user = null, $query = null): int
{ {
return $this->countBy( return $this->countBy(
[
'user' => $user,
'isValid' => true,
'excludeComplementaryOrderShops' => true
],
$query
[
'user' => $user,
'isValid' => true,
'excludeComplementaryOrderShops' => true
],
$query
); );
} }


public function countValidByCurrentDistribution($query = null): int public function countValidByCurrentDistribution($query = null): int
{ {
return $this->countBy( return $this->countBy(
[
'distribution' => $this->distributionBuilder->guessCurrentDistributionOrder($this->section),
'isValid' => true,
'excludeComplementaryOrderShops' => true
],
$query
[
'distribution' => $this->distributionBuilder->guessCurrentDistributionOrder($this->section),
'isValid' => true,
'excludeComplementaryOrderShops' => true
],
$query
); );
} }


// countValidOrderWithReductionCredit // countValidOrderWithReductionCredit
public function countValidWithReductionCredit( public function countValidWithReductionCredit(
ReductionCreditInterface $reductionCredit,
UserInterface $user = null,
$query = null
): int {
ReductionCreditInterface $reductionCredit,
UserInterface $user = null,
$query = null
): int
{


//TODO vérifier que ne pas utiliser createDefaultQuery est pertinent //TODO vérifier que ne pas utiliser createDefaultQuery est pertinent
$query = $this->createQuery($query); $query = $this->createQuery($query);
} }


$query $query
->selectCount()
->filterByReductionCredit($reductionCredit)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);
->selectCount()
->filterByReductionCredit($reductionCredit)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);


return $query->count(); return $query->count();
} }


// countValidOrderWithReductionCart // countValidOrderWithReductionCart
public function countValidWithReductionCart( public function countValidWithReductionCart(
ReductionCartInterface $reductionCart,
$query = null
): int {
ReductionCartInterface $reductionCart,
$query = null
): int
{
$query = $this->createQuery($query); $query = $this->createQuery($query);


$query $query
->selectCount()
->filterByReductionCart($reductionCart)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);
->selectCount()
->filterByReductionCart($reductionCart)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);


return $query->count(); return $query->count();
} }


// countValidOrderWithReductionCartPerUser // countValidOrderWithReductionCartPerUser
public function countValidWithReductionCartByUser( public function countValidWithReductionCartByUser(
ReductionCartInterface $reductionCart,
UserInterface $user,
$query = null
): int {
ReductionCartInterface $reductionCart,
UserInterface $user,
$query = null
): int
{
$query = $this->createDefaultQuery($query); $query = $this->createDefaultQuery($query);


$query $query
->selectCount()
->filterByUser($user)
->filterByReductionCart($reductionCart)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);
->selectCount()
->filterByUser($user)
->filterByReductionCart($reductionCart)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);


return $query->count(); return $query->count();
} }
// findCartCurrent // findCartCurrent
public function getOneCartCurrent(UserInterface $user = null, VisitorInterface $visitor = null, $query = null): ?OrderShopInterface public function getOneCartCurrent(UserInterface $user = null, VisitorInterface $visitor = null, $query = null): ?OrderShopInterface
{ {
if(is_null($user) && is_null($visitor)) {
if (is_null($user) && is_null($visitor)) {
return null; return null;
} }




if (!is_null($user)) { if (!is_null($user)) {
$query->filterByUser($user); $query->filterByUser($user);
}
else {
} else {
if (!is_null($visitor)) { if (!is_null($visitor)) {
$query->filterByVisitor($visitor); $query->filterByVisitor($visitor);
} }
} }


$query $query
->selectOrderReductionCarts()
->filterByStatus(OrderStatusModel::$statusAliasAsCart);
->selectOrderReductionCarts()
->filterByStatus(OrderStatusModel::$statusAliasAsCart);


return $query->findOne(); return $query->findOne();
} }
$query = $this->createDefaultQuery($query); $query = $this->createDefaultQuery($query);


$query $query
->filterByDistribution($distribution)
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.cycleId', 'DESC');
->filterByDistribution($distribution)
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.cycleId', 'DESC');


return $query->findOne(); return $query->findOne();
} }
$query = $this->createDefaultQuery($query); $query = $this->createDefaultQuery($query);


$query $query
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.idValidOrder', 'DESC');
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.idValidOrder', 'DESC');


return $query->findOne(); return $query->findOne();
} }
$query->filterByAddress($params['address']); $query->filterByAddress($params['address']);
} }


if(isset($params['minimumTomorrowDelivery'])) {
if (isset($params['minimumTomorrowDelivery'])) {
$query->filterMinimumTomorrowDelivery(); $query->filterMinimumTomorrowDelivery();
} }


if (isset($params['mergeComplementaryOrderShops'])) { if (isset($params['mergeComplementaryOrderShops'])) {
$query $query
->joinComplementaryOrderShops();
->joinComplementaryOrderShops();
} }


if (isset($params['excludeComplementaryOrderShops']) || isset($params['mergeComplementaryOrderShops'])) { if (isset($params['excludeComplementaryOrderShops']) || isset($params['mergeComplementaryOrderShops'])) {
} }


public function isReductionCreditUsed( public function isReductionCreditUsed(
ReductionCreditInterface $reductionCredit,
UserInterface $user = null,
$query = null
) {
ReductionCreditInterface $reductionCredit,
UserInterface $user = null,
$query = null
)
{
if ($this->countValidWithReductionCredit($reductionCredit, $user, $query)) { if ($this->countValidWithReductionCredit($reductionCredit, $user, $query)) {
return true; return true;
} else { } else {
public function getReductionCreditsAvailableByUser(UserInterface $user): array public function getReductionCreditsAvailableByUser(UserInterface $user): array
{ {
$reductionCredits = $this->reductionCreditStore $reductionCredits = $this->reductionCreditStore
->setMerchant($this->merchant)
->getByTypeAndUser(ReductionCreditModel::TYPE_CREDIT, $user);
->setMerchant($this->merchant)
->getByTypeAndUser(ReductionCreditModel::TYPE_CREDIT, $user);


$reductionCreditsArray = []; $reductionCreditsArray = [];
foreach ($reductionCredits as $reductionCredit) { foreach ($reductionCredits as $reductionCredit) {
public function getReductionGiftsAvailableByUser(UserInterface $user): array public function getReductionGiftsAvailableByUser(UserInterface $user): array
{ {
$reductionGifts = $this->reductionCreditStore $reductionGifts = $this->reductionCreditStore
->setMerchant($this->merchant)
->getByTypeAndUser(ReductionCreditModel::TYPE_GIFT, $user);
->setMerchant($this->merchant)
->getByTypeAndUser(ReductionCreditModel::TYPE_GIFT, $user);


$reductionGiftsArray = []; $reductionGiftsArray = [];
foreach ($reductionGifts as $reductionGift) { foreach ($reductionGifts as $reductionGift) {
public function getReductionCartRemainingQuantity(ReductionCartInterface $reductionCart): float public function getReductionCartRemainingQuantity(ReductionCartInterface $reductionCart): float
{ {
return $reductionCart->getAvailableQuantity() - $this->countValidWithReductionCart( return $reductionCart->getAvailableQuantity() - $this->countValidWithReductionCart(
$reductionCart
);
$reductionCart
);
} }


// getReductionCartUsedQuantityPerUser // getReductionCartUsedQuantityPerUser
public function getReductionCartUsedQuantityByUser( public function getReductionCartUsedQuantityByUser(
ReductionCartInterface $reductionCart,
UserInterface $user
): float {
ReductionCartInterface $reductionCart,
UserInterface $user
): float
{
return $this->countValidWithReductionCartByUser($reductionCart, $user); return $this->countValidWithReductionCartByUser($reductionCart, $user);
} }




// getReductionCartRemainingQuantityPerUser // getReductionCartRemainingQuantityPerUser
public function getReductionCartRemainingQuantityByUser( public function getReductionCartRemainingQuantityByUser(
ReductionCartInterface $reductionCart,
UserInterface $user
): float {
ReductionCartInterface $reductionCart,
UserInterface $user
): float
{
if ($reductionCart->getAvailableQuantityPerUser()) { if ($reductionCart->getAvailableQuantityPerUser()) {
return $reductionCart->getAvailableQuantityPerUser() - $this->countValidWithReductionCartByUser( return $reductionCart->getAvailableQuantityPerUser() - $this->countValidWithReductionCartByUser(
$reductionCart,
$user
);
$reductionCart,
$user
);
} }


return false; return false;
public function getReductionCartAvailableByUser(UserInterface $user, $query = null) public function getReductionCartAvailableByUser(UserInterface $user, $query = null)
{ {
$reductionCarts = $this->reductionCartStore $reductionCarts = $this->reductionCartStore
->setMerchant($this->merchant)
->getOnline();
->setMerchant($this->merchant)
->getOnline();


$reductionCartsArray = []; $reductionCartsArray = [];
foreach ($reductionCarts as $reductionCart) { foreach ($reductionCarts as $reductionCart) {
if ($this->reductionCartSolver->matchWithUser($reductionCart, $user) if ($this->reductionCartSolver->matchWithUser($reductionCart, $user)
&& $this->reductionCartSolver->matchWithGroupUser($reductionCart, $user)
&& $this->getReductionCartRemainingQuantityByUser($reductionCart, $user)
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)
&& (!$this->merchant || $reductionCart->getMerchant() == $this->merchant)) {
&& $this->reductionCartSolver->matchWithGroupUser($reductionCart, $user)
&& $this->getReductionCartRemainingQuantityByUser($reductionCart, $user)
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)
&& (!$this->merchant || $reductionCart->getMerchant() == $this->merchant)) {


$reductionCartsArray[] = $reductionCart;
$reductionCartsArray[] = $reductionCart;
} }
} }




//countValidOrderProductsOfCyclesByProducts //countValidOrderProductsOfCyclesByProducts
public function countValidOrderProductsOfDistributionsByProducts( public function countValidOrderProductsOfDistributionsByProducts(
array $distributions,
array $products,
$query = null
): array {
array $distributions,
array $products,
$query = null
): array
{
$query = $this->createDefaultQuery($query); $query = $this->createDefaultQuery($query);
$query $query
->filterByAlias(OrderStatusModel::$statusAliasAsValid)
->filterByDistributions($distributions)
->filterByProducts($products)
->selectSum()
->groupBy('distribution.cycleNumber, product.id');
->filterByAlias(OrderStatusModel::$statusAliasAsValid)
->filterByDistributions($distributions)
->filterByProducts($products)
->selectSum()
->groupBy('distribution.cycleNumber, product.id');




return $query->find(); return $query->find();
$query = $this->createQuery($query); $query = $this->createQuery($query);


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


$result = $query->findOne(); $result = $query->findOne();


} }


public function isReductionCreditAllowAddToOrder( public function isReductionCreditAllowAddToOrder(
OrderShopInterface $orderShop,
ReductionCreditInterface $reductionCredit
) {
OrderShopInterface $orderShop,
ReductionCreditInterface $reductionCredit
)
{
$user = $orderShop->getUser(); $user = $orderShop->getUser();


// appartient à l'utilisateur // appartient à l'utilisateur
if (!$reductionCredit->getUsers()->contains($user)) { if (!$reductionCredit->getUsers()->contains($user)) {
// @TODO : déplacer la gestion du flash message // @TODO : déplacer la gestion du flash message
//$this->flashBag->add('error', 'error.reductionCredit.userNotAllow');
$this->flashBagTranslator->add('error', 'userNotAllow', 'ReductionCredit');
return false; return false;
} }


if ($reductionCredit->getType() == ReductionCreditModel::TYPE_CREDIT) { if ($reductionCredit->getType() == ReductionCreditModel::TYPE_CREDIT) {
if ($this->countValidWithReductionCredit($reductionCredit, $user) > 0) { if ($this->countValidWithReductionCredit($reductionCredit, $user) > 0) {
// @TODO : déplacer la gestion du flash message // @TODO : déplacer la gestion du flash message
//$this->flashBah->add('error', 'error.reductionCredit.alreadyUse');
$this->flashBagTranslator->add('error', 'alreadyUse', 'ReductionCredit');
return false; return false;
} }
} else { } else {
if ($this->countValidWithReductionCredit($reductionCredit) > 0) { if ($this->countValidWithReductionCredit($reductionCredit) > 0) {
// @TODO : déplacer la gestion du flash message // @TODO : déplacer la gestion du flash message
//$this->flashBah->add('error', 'error.reductionCredit.alreadyUse');
$this->flashBagTranslator->add('error', 'alreadyUse', 'ReductionCredit');
return false; return false;
} }
} }

+ 1
- 1
Repository/User/UserRepositoryQuery.php View File

$this->isJoinUserMerchants = true; $this->isJoinUserMerchants = true;


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

+ 2
- 1
Repository/User/UserStore.php View File

} }


public function getJoinGroupUsers(){ public function getJoinGroupUsers(){
$query = $this->createDefaultQuery();
$query = $this->createQuery();
$query->joinGroupUsers(true); $query->joinGroupUsers(true);
$query->orderBy('id');
return $query->find(); return $query->find();


} }

+ 13
- 2
Solver/Price/PriceSolverTrait.php View File

$round = true $round = true
): ?float { ): ?float {



if($entity instanceof ProductFamilyInterface) {
$taxRate = $this->productFamilySolver->getTaxRateInherited($entity)->getValue();
}else if ($entity instanceof ProductInterface) {
$taxRate = $this->productFamilySolver->getTaxRateInherited($entity->getProductFamily())->getValue();
}else{
$taxRate = $entity->getTaxRate()->getValue();
}


if ($reductionCatalog) { if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue(); $reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit(); $reductionCatalogUnit = $reductionCatalog->getUnit();
$price, $price,
$reductionCatalogValue * $quantity $reductionCatalogValue * $quantity
), ),
$this->productFamilySolver->getTaxRateInherited($entity)->getValue()
$taxRate
); );
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { } elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount( $priceWithTax = $this->applyReductionAmount(
if ($withTax) { if ($withTax) {
$priceReturn = $priceWithTax; $priceReturn = $priceWithTax;
} else { } else {
$priceReturn = $this->applyPercentNegative($priceWithTax, $this->productFamilySolver->getTaxRateInherited($entity)->getValue());

$priceReturn = $this->applyPercentNegative($priceWithTax, $taxRate);
} }
if ($round) { if ($round) {
return $this->round($priceReturn); return $this->round($priceReturn);

+ 15
- 1
Solver/Section/OpeningSolver.php View File



protected function isOpeningDay(int $weekDay, array $openings): bool protected function isOpeningDay(int $weekDay, array $openings): bool
{ {
return (bool) $this->getOpeningByWeekday($weekDay, $openings);
$opening = $this->getOpeningByWeekday($weekDay, $openings);

if($opening) {
$now = new \DateTime();
if($weekDay == $now->format('N')) {
if($now < $opening->getTimeEnd()) {
return true;
}
}
else {
return true;
}
}

return false;
} }


protected function isClosingDay(int $weekDay, array $openings): bool protected function isClosingDay(int $weekDay, array $openings): bool

Loading…
Cancel
Save