Browse Source

Merge branch 'develop'

master
Guillaume 3 years ago
parent
commit
cf09016ac2
7 changed files with 35 additions and 23 deletions
  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 View File

public function setOnlineIfOnlineProductfamily(ProductCategoryInterface $productCategory) public function setOnlineIfOnlineProductfamily(ProductCategoryInterface $productCategory)
{ {
if ($this->productCategorySolver->hasOnlineProductFamily($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 // mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent(); $productCategoryParent = $productCategory->getParent();
if ($productCategoryParent) { if ($productCategoryParent) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);

if(!$productCategory->getStatus()) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);
}
} }
} }
} }
public function setOfflineIfOfflineProductfamily(ProductCategoryInterface $productCategory) public function setOfflineIfOfflineProductfamily(ProductCategoryInterface $productCategory)
{ {
if (!$this->productCategorySolver->hasOnlineProductFamily($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 // mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent(); $productCategoryParent = $productCategory->getParent();
if ($productCategoryParent && !$this->productCategorySolver->hasOnlineProductFamily($productCategoryParent)) { 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 View File

use Lc\CaracoleBundle\Container\Order\OrderShopContainer; use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
use Lc\CaracoleBundle\Controller\AbstractAdminController; use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Definition\ActionDefinition;
use Lc\CaracoleBundle\Resolver\SectionResolver; use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
{ {
$crud = parent::configureCrud($crud); $crud = parent::configureCrud($crud);


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


return $crud; return $crud;
} }

+ 1
- 1
EventSubscriber/User/UserRolesEventSubscriber.php View File



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

+ 1
- 1
Solver/Order/OrderShopSolver.php View File

$this->productSolver = $productSolver; $this->productSolver = $productSolver;
} }


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

+ 7
- 7
Solver/Product/ProductFamilySolver.php View File

} }




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


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


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


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


public function getTypeExpirationDateChoices(): array
public static function getTypeExpirationDateChoices(): array
{ {
return [ return [
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC, ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC,
} }




public function getBehaviorExpirationDateChoices(): array
public static function getBehaviorExpirationDateChoices(): array
{ {
return [ return [
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
} }




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

+ 1
- 1
Solver/Reduction/ReductionCartSolver.php View File

} }




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

+ 1
- 1
Solver/Statistic/StatisticSolver.php View File

const INTERVAL_WEEK = 'W'; const INTERVAL_WEEK = 'W';
const INTERVAL_MONTH = 'M'; const INTERVAL_MONTH = 'M';


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

Loading…
Cancel
Save