Explorar el Código

Merge branch 'develop'

master
Guillaume hace 3 años
padre
commit
cf09016ac2
Se han modificado 7 ficheros con 35 adiciones y 23 borrados
  1. +18
    -11
      Builder/Product/ProductCategoryBuilder.php
  2. +6
    -1
      Controller/Product/ProductFamilyAdminController.php
  3. +1
    -1
      EventSubscriber/User/UserRolesEventSubscriber.php
  4. +1
    -1
      Solver/Order/OrderShopSolver.php
  5. +7
    -7
      Solver/Product/ProductFamilySolver.php
  6. +1
    -1
      Solver/Reduction/ReductionCartSolver.php
  7. +1
    -1
      Solver/Statistic/StatisticSolver.php

+ 18
- 11
Builder/Product/ProductCategoryBuilder.php Ver fichero

@@ -23,16 +23,19 @@ class ProductCategoryBuilder
public function setOnlineIfOnlineProductfamily(ProductCategoryInterface $productCategory)
{
if ($this->productCategorySolver->hasOnlineProductFamily($productCategory)) {
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);
if(!$productCategory->getStatus()) {
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);

$this->flashBagTranslator->add('success', 'setOnline','ProductCategory', array('%category%'=> $productCategory, '%section%'=> $productCategory->getSection()));
$this->flashBagTranslator->add('success', 'setOnline', 'ProductCategory', array('%category%' => $productCategory, '%section%' => $productCategory->getSection()));
}
// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if ($productCategoryParent) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);

if(!$productCategory->getStatus()) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);
}
}
}
}
@@ -41,15 +44,19 @@ class ProductCategoryBuilder
public function setOfflineIfOfflineProductfamily(ProductCategoryInterface $productCategory)
{
if (!$this->productCategorySolver->hasOnlineProductFamily($productCategory)) {
$productCategory->setStatus(0);
$this->entityManager->update($productCategory);
$this->flashBagTranslator->add('info', 'setOffline','ProductCategory', array('%category%'=> $productCategory, '%section%'=> $productCategory->getSection()));
if($productCategory->getStatus()) {

$productCategory->setStatus(0);
$this->entityManager->update($productCategory);
$this->flashBagTranslator->add('info', 'setOffline', 'ProductCategory', array('%category%' => $productCategory, '%section%' => $productCategory->getSection()));
}
// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if ($productCategoryParent && !$this->productCategorySolver->hasOnlineProductFamily($productCategoryParent)) {
$productCategoryParent->setStatus(0);
$this->entityManager->update($productCategoryParent);
if($productCategory->getStatus()) {
$productCategoryParent->setStatus(0);
$this->entityManager->update($productCategoryParent);
}
}
}
}

+ 6
- 1
Controller/Product/ProductFamilyAdminController.php Ver fichero

@@ -8,6 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Definition\ActionDefinition;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Response;
@@ -18,7 +19,11 @@ abstract class ProductFamilyAdminController extends AbstractAdminController
{
$crud = parent::configureCrud($crud);

$crud->setDefaultSort(['id' => 'DESC']);
if($this->getRequestCrudAction() === ActionDefinition::SORT) {
$crud->setDefaultSort(['position' => 'ASC']);
}else{
$crud->setDefaultSort(['id' => 'DESC']);
}

return $crud;
}

+ 1
- 1
EventSubscriber/User/UserRolesEventSubscriber.php Ver fichero

@@ -46,7 +46,7 @@ class UserRolesEventSubscriber implements EventSubscriberInterface

public function setUserRolesFromKernelRequest(RequestEvent $event)
{
if (!$event->isMasterRequest()) {
if (!$event->isMainRequest()) {
return;
}
if ($this->setUserRoles($event->getRequest())) {

+ 1
- 1
Solver/Order/OrderShopSolver.php Ver fichero

@@ -33,7 +33,7 @@ class OrderShopSolver
$this->productSolver = $productSolver;
}

public function getTypeDeliveryChoices()
public static function getTypeDeliveryChoices()
{
return [
OrderShopModel::DELIVERY_TYPE_HOME,

+ 7
- 7
Solver/Product/ProductFamilySolver.php Ver fichero

@@ -27,7 +27,7 @@ class ProductFamilySolver
}


public function getBehaviorCountStockChoices(): array
public static function getBehaviorCountStockChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
@@ -36,7 +36,7 @@ class ProductFamilySolver
];
}

public function getWaringMessageTypeChoices(): array
public static function getWaringMessageTypeChoices(): array
{
return [
ProductFamilyModel::WARNING_MESSAGE_TYPE_ERROR,
@@ -46,7 +46,7 @@ class ProductFamilySolver
];
}

public function getBehaviorAddToCartChoices(): array
public static function getBehaviorAddToCartChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_MULTIPLE,
@@ -54,7 +54,7 @@ class ProductFamilySolver
];
}

public function getBehaviorPriceChoices(): array
public static function getBehaviorPriceChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE,
@@ -62,7 +62,7 @@ class ProductFamilySolver
];
}

public function getTypeExpirationDateChoices(): array
public static function getTypeExpirationDateChoices(): array
{
return [
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC,
@@ -72,7 +72,7 @@ class ProductFamilySolver
}


public function getBehaviorExpirationDateChoices(): array
public static function getBehaviorExpirationDateChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
@@ -81,7 +81,7 @@ class ProductFamilySolver
}


public function getBehaviorDisplaySaleChoices(): array
public static function getBehaviorDisplaySaleChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,

+ 1
- 1
Solver/Reduction/ReductionCartSolver.php Ver fichero

@@ -46,7 +46,7 @@ class ReductionCartSolver
}


public function getAppliedToChoices()
public static function getAppliedToChoices()
{
return [
// ReductionCartModel::APPLIED_TO_DELIVERY,

+ 1
- 1
Solver/Statistic/StatisticSolver.php Ver fichero

@@ -8,7 +8,7 @@ class StatisticSolver
const INTERVAL_WEEK = 'W';
const INTERVAL_MONTH = 'M';

public function getIntervalChoices()
public static function getIntervalChoices()
{
return [
self::INTERVAL_DAY,

Cargando…
Cancelar
Guardar