Bläddra i källkod

Intégration app reduction

packProduct
Fabien Normand 2 år sedan
förälder
incheckning
b84013c1f7
6 ändrade filer med 66 tillägg och 10 borttagningar
  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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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,
];
}

}

Laddar…
Avbryt
Spara