Browse Source

Intégration app reduction

packProduct
Fabien Normand 3 years ago
parent
commit
b84013c1f7
6 changed files with 66 additions and 10 deletions
  1. +18
    -0
      Controller/Order/OrderShopAdminController.php
  2. +18
    -0
      Controller/Reduction/ReductionCreditAdminController.php
  3. +8
    -0
      Doctrine/QueryBuilder.php
  4. +11
    -0
      Field/AssociationField.php
  5. +0
    -10
      Model/Reduction/ReductionCartModel.php
  6. +11
    -0
      Solver/Reduction/ReductionCartSolver.php

+ 18
- 0
Controller/Order/OrderShopAdminController.php View File

@@ -0,0 +1,18 @@
<?php

namespace Lc\CaracoleBundle\Controller\Order;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class OrderShopAdminController extends AbstractAdminController
{
use AdminControllerTrait;
}

+ 18
- 0
Controller/Reduction/ReductionCreditAdminController.php View File

@@ -0,0 +1,18 @@
<?php

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class ReductionCreditAdminController extends AbstractAdminController
{
use AdminControllerTrait;
}

+ 8
- 0
Doctrine/QueryBuilder.php View File

@@ -26,4 +26,12 @@ class QueryBuilder extends SovQueryBuilder
return $this;
}

public function andWhereMerchantManyToMany($dqlId, $merchant):self
{

$this->andWhere(':currentMerchant MEMBER OF '.$dqlId.'.merchants');
$this->setParameter('currentMerchant', $merchant);
return $this;
}

}

+ 11
- 0
Field/AssociationField.php View File

@@ -64,6 +64,13 @@ final class AssociationField implements FieldInterface
return $this;
}

public function setFilterOnMerchantManyToMany(MerchantInterface $merchant): self
{
$this->queryBuilderParameters['merchantManyToMany'] = $merchant;

return $this;
}

public function setFilterOnDevAlias(string $devAlias): self
{
$this->queryBuilderParameters['devAlias'] = $devAlias;
@@ -107,6 +114,10 @@ final class AssociationField implements FieldInterface
$qb->andWhereMerchant('e',$param['merchant']);
}

if (isset($param['merchantManyToMany'])) {
$qb->andWhereMerchantManyToMany('e',$param['merchantManyToMany']);
}

if (isset($param['status'])) {
$qb->andWhere('e.status = :status')->setParameter('status', $param['status']);
}

+ 0
- 10
Model/Reduction/ReductionCartModel.php View File

@@ -42,16 +42,6 @@ abstract class ReductionCartModel extends AbstractLightEntity implements Reducti
const APPLIED_TO_DELIVERY = 'delivery';
const APPLIED_TO_ORDER_PRODUCTS = 'order-products';


public function getAppliedToChoices()
{
return [
self::APPLIED_TO_DELIVERY,
self::APPLIED_TO_ORDER_PRODUCTS,
];
}


/**
* @ORM\Column(type="string", length=255)
*/

+ 11
- 0
Solver/Reduction/ReductionCartSolver.php View File

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Solver\Reduction;

use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCartModel;
use Lc\SovBundle\Model\User\UserInterface;

class ReductionCartSolver
@@ -43,4 +44,14 @@ class ReductionCartSolver

return $conditionGroupUser;
}


public function getAppliedToChoices()
{
return [
// ReductionCartModel::APPLIED_TO_DELIVERY,
ReductionCartModel::APPLIED_TO_ORDER_PRODUCTS,
];
}

}

Loading…
Cancel
Save