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

<?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

<?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

return $this; 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

return $this; return $this;
} }


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

return $this;
}

public function setFilterOnDevAlias(string $devAlias): self public function setFilterOnDevAlias(string $devAlias): self
{ {
$this->queryBuilderParameters['devAlias'] = $devAlias; $this->queryBuilderParameters['devAlias'] = $devAlias;
$qb->andWhereMerchant('e',$param['merchant']); $qb->andWhereMerchant('e',$param['merchant']);
} }


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

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

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

const APPLIED_TO_DELIVERY = 'delivery'; const APPLIED_TO_DELIVERY = 'delivery';
const APPLIED_TO_ORDER_PRODUCTS = 'order-products'; 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) * @ORM\Column(type="string", length=255)
*/ */

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

namespace Lc\CaracoleBundle\Solver\Reduction; namespace Lc\CaracoleBundle\Solver\Reduction;


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


class ReductionCartSolver class ReductionCartSolver


return $conditionGroupUser; return $conditionGroupUser;
} }


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

} }

Loading…
Cancel
Save