瀏覽代碼

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Guillaume 4 年之前
父節點
當前提交
a98877e39a
共有 3 個檔案被更改,包括 29 行新增29 行删除
  1. +23
    -3
      ShopBundle/Controller/Backend/OrderController.php
  2. +1
    -1
      ShopBundle/Model/ProductFamily.php
  3. +5
    -25
      ShopBundle/Repository/ProductFamilyRepository.php

+ 23
- 3
ShopBundle/Controller/Backend/OrderController.php 查看文件

@@ -23,6 +23,27 @@ use Symfony\Component\HttpFoundation\Response;

class OrderController extends AdminController
{
protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
{
$filterOrderStatus = false;


if ($dqlFilter['orderStatus'])$filterOrderStatus = $dqlFilter['orderStatus'];
$dqlFilter = $dqlFilter['filter'];

$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);

$queryBuilder->leftJoin('entity.orderStatus','orderStatus');

dump($filterOrderStatus);
if ($filterOrderStatus) {
$queryBuilder->andWhere('orderStatus.alias IN (:status)');
$queryBuilder->setParameter('status', $filterOrderStatus);
}

return $queryBuilder;
}



public function updateEntity($entity)
@@ -344,7 +365,6 @@ class OrderController extends AdminController
public function renderOrderShopTemplate($actionName, $templatePath, array $parameters = [])
{
//dump($this->em->getRepository(OrderShop::class)->getValidOrder());

if ($actionName == 'show') {
$formAddProductToOrder = $this->createForm(AddPoductToOrderType::class, null, array(
'action' => $this->generateUrl('easyadmin', [
@@ -477,7 +497,7 @@ class OrderController extends AdminController
$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];
$easyadmin['entity']['name'] = 'OrderShop';
$fields = $this->entity['show']['fields'];
$deleteForm = $this->createDeleteForm($this->entity['name'], $id);

@@ -495,7 +515,7 @@ class OrderController extends AdminController

];

return $this->executeDynamicMethod('render<EntityName>Template', ['show', $this->entity['templates']['show'], $parameters]);
return $this->executeDynamicMethod('renderOrderShopTemplate', ['show', $this->entity['templates']['show'], $parameters]);
}

/**

+ 1
- 1
ShopBundle/Model/ProductFamily.php 查看文件

@@ -30,7 +30,7 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies")
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies", fetch="EAGER")
*/
protected $productCategories;


+ 5
- 25
ShopBundle/Repository/ProductFamilyRepository.php 查看文件

@@ -21,33 +21,10 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor


public function getProductFamiliesByCategory($category){
$expr = $this->_em->getExpressionBuilder();

$query = $this->findByMerchantQuery() ;
/* $query->select(array('e as product', 'reductionCatalog as reduction'));
$query->from(ReductionCatalogInterface::class, 'reductionCatalog');*/
$query->leftJoin('e.productCategories', 'cat');
$query->andWhere(':category MEMBER OF e.productCategories');
$query->andWhere('e.status = 1');
/* /* $query->andWhere($query->expr()->orX(
$query->expr()->eq('reductionCatalog', 'null'),
$query->expr()->eq( 'reductionCatalog.status = 1 AND (
:user MEMBER OF reductionCatalog.users OR reductionCatalog.users is empty ) AND
(:groupUser MEMBER OF reductionCatalog.groupUsers OR reductionCatalog.groupUsers is empty ) AND
(e MEMBER OF reductionCatalog.productFamilies OR reductionCatalog.productFamilies is empty')
));


$query
->andWhere('reductionCatalog.status = 1')
->andWhere(':user MEMBER OF reductionCatalog.users OR reductionCatalog.users is empty')
->andWhere(':groupUser MEMBER OF reductionCatalog.groupUsers OR reductionCatalog.groupUsers is empty')
->andWhere('e MEMBER OF reductionCatalog.productFamilies OR reductionCatalog.productFamilies is empty')
//->andWhere(':category MEMBER OF reductionCatalog.productCategories OR reductionCatalog.productCategories is empty')
//->andWhere('e.supplier MEMBER OF reductionCatalog.suppliers OR reductionCatalog.suppliers is empty')
->setParameter('user', $user)
->setParameter('groupUser', $user->getGroupUsers()
);*/

$query->setParameter('category', $category->getId());

return $query->getQuery()->getResult() ;
@@ -55,7 +32,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
}

public function getProductFamiliesNovelties(){
$query = $this->findByMerchantQuery() ;
$query = $this->findByMerchantQuery();
$query->andWhere('e.status = 1');
$query->andWhere(':now <= e.propertyNoveltyExpirationDate')
->setParameter('now', new \DateTime()) ;
@@ -65,6 +42,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor

public function getProductFamiliesLargeVolumes(){
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query->andWhere('e.status = 1');
$query->andWhere('e.propertyLargeVolume = 1');

@@ -73,6 +51,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor

public function getProductFamiliesOrganics(){
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query->andWhere('e.status = 1');
$query->andWhere('e.propertyOrganicLabel IS NOT NULL');

@@ -82,6 +61,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
public function findByTerms($terms, $maxResults = false)
{
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query->andWhere('e.status = 1');
$query->andWhere('e.title LIKE :terms');
$query->setParameter(':terms', '%'.$terms.'%') ;

Loading…
取消
儲存