@@ -343,6 +343,7 @@ class AdminController extends EasyAdminController | |||
$latsPos = $elm['position']; | |||
} | |||
dump($latsPos); | |||
//die(); | |||
//to do récupérer les élements hors ligne et incrémenter position | |||
/*foreach ($repo->findBy(array('status'=> false)) as $offlineEntity) { | |||
@@ -563,7 +564,7 @@ class AdminController extends EasyAdminController | |||
return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]); | |||
} | |||
public function createNewEntity(){ | |||
/* public function createNewEntity(){ | |||
$idDuplicate = $this->request->query->get('duplicate', null); | |||
if($idDuplicate){ | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
@@ -578,9 +579,10 @@ class AdminController extends EasyAdminController | |||
return new $entityFullyQualifiedClassName(); | |||
} | |||
} | |||
}*/ | |||
public function duplicateAction(){ | |||
$id = $this->request->query->get('id'); | |||
$refererUrl = $this->request->query->get('referer', ''); | |||
@@ -588,12 +590,12 @@ class AdminController extends EasyAdminController | |||
$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($id); | |||
$newProductFamily = clone $entity ; | |||
$newEntity = clone $entity ; | |||
$this->em->persist($newProductFamily) ; | |||
$this->em->persist($newEntity) ; | |||
$this->em->flush() ; | |||
return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newProductFamily->getId(), 'referer' =>$refererUrl ]) ; | |||
return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]) ; | |||
} | |||
} | |||
@@ -5,6 +5,7 @@ namespace Lc\ShopBundle\Repository; | |||
use Lc\ShopBundle\Context\DefaultRepositoryInterface; | |||
use Lc\ShopBundle\Context\ProductFamilyInterface; | |||
use Lc\ShopBundle\Context\ReductionCatalogInterface; | |||
use Lc\ShopBundle\Model\ProductFamily; | |||
/** | |||
* @method ProductFamilyInterface|null find($id, $lockMode = null, $lockVersion = null) | |||
@@ -104,4 +105,6 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor | |||
} | |||
} |
@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Repository; | |||
use Lc\ShopBundle\Context\DefaultRepositoryInterface; | |||
use Lc\ShopBundle\Context\ProductInterface; | |||
use Lc\ShopBundle\Model\ProductFamily; | |||
/** | |||
* @method ProductInterface|null find($id, $lockMode = null, $lockVersion = null) | |||
@@ -18,4 +19,36 @@ class ProductRepository extends BaseRepository implements DefaultRepositoryInter | |||
return ProductInterface::class; | |||
} | |||
public function findProductByAvailabilitiesNegative() | |||
{ | |||
$qb = $this->createQueryBuilder('e'); | |||
$qb->innerJoin('e.productFamily', 'productFamily'); | |||
$qb->addSelect('productFamily'); | |||
$qb->where('productFamily.merchant = :currentMerchant'); | |||
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()); | |||
$qb->andWhere( | |||
$qb->expr()->orX( | |||
$qb->expr()->andX( | |||
$qb->expr()->orX( | |||
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily', | |||
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure' | |||
), | |||
'productFamily.availableQuantity < 0 ' | |||
), | |||
$qb->expr()->andX( | |||
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct', | |||
'e.availableQuantity < 0 ' | |||
) | |||
) | |||
); | |||
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY); | |||
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE); | |||
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT); | |||
$qb->groupBy('productFamily.id'); | |||
return $qb->getQuery()->getResult(); | |||
} | |||
} |
@@ -44,6 +44,7 @@ group: | |||
parameters: Paramètres | |||
initReduction: Réduction | |||
export: Note à l'export | |||
stockNegative: Produits stocks négatif | |||
ReductionCatalog: | |||
info: Informations principal | |||
conditions: Conditions d'application |
@@ -0,0 +1,31 @@ | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
<table class="table table-condensed"> | |||
<thead> | |||
<tr> | |||
<th>Produits</th> | |||
<th>Stock</th> | |||
<th></th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
{% for product in product_availabilities_negative %} | |||
<tr> | |||
<td> | |||
{{ product.productFamily.title }} | |||
{% if product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT") %} | |||
- {{ product.title }} | |||
{% endif %} | |||
</td> | |||
<td> | |||
{{ macros.available_quantity_product(product) }} | |||
</td> | |||
<td> | |||
<a class="btn-sm btn-primary" href="{{ path('easyadmin', {'action' : 'edit', 'entity': 'ProductFamily', 'id' : product.productFamily.id }) }}#stock"> | |||
<i class="fa fa-pen"></i> | |||
</a> | |||
</td> | |||
</tr> | |||
{% endfor %} | |||
</tbody> | |||
</table> | |||
@@ -261,7 +261,22 @@ | |||
</div> | |||
{% endmacro form_widget_append %} | |||
{#{% macro modal(title, form) %} | |||
{% macro available_quantity_product(product) %} | |||
{% if product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY") %} | |||
{{ product.productFamily.availableQuantity }} | |||
{% elseif product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE") %} | |||
{{ product.productFamily.availableQuantity }} | |||
/ {{ product.productFamily.unit.unitReference }} | |||
{% elseif product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT") %} | |||
{{ product.availableQuantity }} | |||
{% endif %} | |||
{% endmacro available_quantity_product %} | |||
{# {% macro modal(title, form) %} | |||
{% embed '@LcShop/backend/default/block/embed_modal.twig' %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block id %}{{ id }}{% endblock %} |