浏览代码

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

packProduct
Charly 3 年前
父节点
当前提交
92d24fe9ac
共有 10 个文件被更改,包括 45 次插入35 次删除
  1. +1
    -1
      Controller/User/UserAdminController.php
  2. +1
    -1
      Controller/User/UserMerchantAdminController.php
  3. +3
    -22
      EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php
  4. +3
    -3
      Repository/Order/OrderShopRepositoryQuery.php
  5. +7
    -1
      Repository/Order/OrderShopStore.php
  6. +1
    -1
      Repository/Product/ProductCategoryStore.php
  7. +14
    -1
      Repository/Product/ProductFamilyStore.php
  8. +6
    -4
      Resolver/MerchantResolver.php
  9. +1
    -1
      Solver/Config/UnitSolver.php
  10. +8
    -0
      Solver/Order/OrderShopSolver.php

+ 1
- 1
Controller/User/UserAdminController.php 查看文件

@@ -25,7 +25,7 @@ abstract class UserAdminController extends SovUserAdminController
return $this->getUserContainer()->getFactory()->create();
}

public function overrideEntitiesActions(?EntityCollection $entities): void
public function overrideEntitiesActions(?EntityCollection $entities, string $pageName): void
{
foreach ($entities as $entity) {
foreach ($entity->getActions() as $action){

+ 1
- 1
Controller/User/UserMerchantAdminController.php 查看文件

@@ -52,7 +52,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
return $repositoryQuery;
}

public function overrideEntitiesActions(?EntityCollection $entities): void
public function overrideEntitiesActions(?EntityCollection $entities, string $pageName): void
{
$context = $this->get(AdminContextProvider::class)->getContext();
$adminUrlGenerator = $this->get(AdminUrlGenerator::class);

+ 3
- 22
EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php 查看文件

@@ -27,28 +27,9 @@ class UpdateProductFamilySectionPropertyEventSubscriber implements EventSubscrib

public function processBeforePersistProductFamilySectionInterface(EntityManagerEvent $event)
{
$productFamilySectionProperty = $event->getEntity();

if($productFamilySectionProperty instanceof ProductFamilySectionPropertyInterface) {
$section = $productFamilySectionProperty->getSection();
if($productFamilySectionProperty->getStatus() == 1) {
$productCategoryArray = $productFamilySectionProperty->getProductFamily()->getProductCategories();
foreach($productCategoryArray as $productCategory) {
if($productCategory->getSection() == $section) {
// mise à jour du statut
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);

// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if($productCategoryParent) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);
}
}
}
}
}

//TODO à supprimer déplacer dans le script d'import, à remplacer par une alerte à l'édition d'un produit

}

}

+ 3
- 3
Repository/Order/OrderShopRepositoryQuery.php 查看文件

@@ -152,11 +152,11 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
->setParameter('year', $year);
}

public function filterByDistributions(array $distributions): self
public function filterByDistributions(array $distributionArray): self
{
return $this
->andWhere('.distribution IN(:distributions)')
->setParameter('distributions', $distributions);
->andWhere('.distribution IN (:distributions)')
->setParameter('distributions', $distributionArray);
}

public function filterByProducts(array $products): self

+ 7
- 1
Repository/Order/OrderShopStore.php 查看文件

@@ -89,7 +89,7 @@ class OrderShopStore extends AbstractStore

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

@@ -392,6 +392,10 @@ class OrderShopStore extends AbstractStore
$query->filterByDistribution($params['distribution']);
}

if (isset($params['distributions'])) {
$query->filterByDistributions($params['distributions']);
}

if (isset($params['isCart'])) {
$query->filterByStatus(OrderStatusModel::$statusAliasAsCart);
}
@@ -428,6 +432,7 @@ class OrderShopStore extends AbstractStore
if (isset($params['excludeComplementaryOrderShops']) || isset($params['mergeComplementaryOrderShops'])) {
$query->filterIsNullMainOrderShop();
}

if (isset($params['joinProductFamily'])) {
$query->joinProductFamily(true);
}
@@ -442,6 +447,7 @@ class OrderShopStore extends AbstractStore
if (isset($params['groupBy'])) {
$query->groupBy($params['groupBy']);
}

return $query;
}


+ 1
- 1
Repository/Product/ProductCategoryStore.php 查看文件

@@ -46,7 +46,7 @@ class ProductCategoryStore extends AbstractStore
return $query->findOne();
}

public function getAllByDevAlias(string $devAlias): array
public function getByDevAlias(string $devAlias): array
{
$query = $this->createDefaultQuery();
$query->filterByDevAlias($devAlias);

+ 14
- 1
Repository/Product/ProductFamilyStore.php 查看文件

@@ -34,7 +34,7 @@ class ProductFamilyStore extends AbstractStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->filterIsOnlineAndOffline();
$this->addFilterBySectionOptionnal($query);
$this->addFilterByMerchantViaSectionOptionnal($query);

@@ -81,6 +81,19 @@ class ProductFamilyStore extends AbstractStore
return $query->find();
}

//TODO ajouter status en donné de contexte pour éviter ce truc
public function getByCategoryOnlineAndOffline(
ProductCategoryInterface $productCategory,
$query = null
) {
$query = $this->createDefaultQuery($query);

$query
->filterByProductCategory($productCategory);

return $query->find();
}

// getProductFamiliesNovelties
public function getNovelty($user = null, $organizeByParentCategory = true, $query = null)
{

+ 6
- 4
Resolver/MerchantResolver.php 查看文件

@@ -127,11 +127,13 @@ class MerchantResolver

public function getUrl(SectionInterface $section)
{
if ($this->urlResolver->isServerLocalhost()) {
return $this->router->generate('frontend_home', ['section' => $section->getSlug()], UrlGeneratorInterface::ABSOLUTE_URL);
} else {
return $this->settingSolver->getSettingValue($section->getMerchant(), MerchantSettingDefinition::SETTING_URL);
$url = $this->settingSolver->getSettingValue($section->getMerchant(), MerchantSettingDefinition::SETTING_URL);
if(!$section->getIsDefault()) {
$url .= $section->getSlug();
}

return$url;
}

public function getMerchantUser(UserInterface $user = null)

+ 1
- 1
Solver/Config/UnitSolver.php 查看文件

@@ -13,7 +13,7 @@ class UnitSolver
if($quantity) {
return ($quantityProduct / $unit->getCoefficient()) * $quantity;
}else{
$quantity = 0;
return 0;
}
}


+ 8
- 0
Solver/Order/OrderShopSolver.php 查看文件

@@ -345,6 +345,14 @@ class OrderShopSolver
return false;
}

public function isDone(OrderShopInterface $orderShop): bool
{
if ($orderShop->getOrderStatus() && $orderShop->getOrderStatus()->getAlias() == OrderStatusModel::ALIAS_DONE ) {
return true;
}
return false;
}

// getProductQuantityMaxAddCart
public function getProductQuantityMaxAddCart(OrderShopInterface $orderShop, ProductInterface $product)
{

正在加载...
取消
保存