Ver código fonte

Gestion vente en vrac

develop
Guillaume Bourgeois 8 meses atrás
pai
commit
0f6935fbd5
8 arquivos alterados com 20 adições e 14 exclusões
  1. +1
    -1
      Builder/Order/OrderShopBuilder.php
  2. +7
    -1
      Controller/Order/CartController.php
  3. +1
    -1
      Factory/Order/OrderProductFactory.php
  4. +2
    -2
      Model/Order/OrderProductInterface.php
  5. +3
    -3
      Model/Order/OrderProductModel.php
  6. +2
    -2
      Model/Order/OrderProductRefundInterface.php
  7. +3
    -3
      Model/Order/OrderProductRefundModel.php
  8. +1
    -1
      Solver/Order/OrderShopSolver.php

+ 1
- 1
Builder/Order/OrderShopBuilder.php Ver arquivo

@@ -493,7 +493,7 @@ class OrderShopBuilder
public function applyDeductAvailabilityProduct(
OrderShopInterface $orderShop,
ProductInterface $product,
int $quantityOrder,
float $quantityOrder,
float $quantityProduct = null
): void {
switch ($product->getProductFamily()->getBehaviorCountStock()) {

+ 7
- 1
Controller/Order/CartController.php Ver arquivo

@@ -18,7 +18,7 @@ use Symfony\Component\Routing\Annotation\Route;
class CartController extends AbstractController
{
protected ?ProductFamilyInterface $productFamily = null;
protected int $quantityOrder = 1;
protected float $quantityOrder = 1;
protected array $orderProducts = [];

public function addProductFamily(Request $request): JsonResponse
@@ -69,6 +69,12 @@ class CartController extends AbstractController
$data = $form->getData();
foreach ($data as $orderProduct) {
if ($orderProduct instanceof OrderProductInterface) {

// sécurité liée à la possibilité de saisir des quantités en float pour les comptes ventes complémentaires
if(!$orderShop->getUser() || !$orderShop->getUser()->getIsAdditionalSalesAccount()) {
$orderProduct->setQuantityOrder(intval($orderProduct->getQuantityOrder()));
}

$this->addOrderProduct($orderShop, $orderProduct);
}
}

+ 1
- 1
Factory/Order/OrderProductFactory.php Ver arquivo

@@ -10,7 +10,7 @@ use Lc\SovBundle\Factory\AbstractFactory;

class OrderProductFactory extends AbstractFactory
{
public function create(ProductInterface $product, int $quantityOrder): OrderProductInterface
public function create(ProductInterface $product, float $quantityOrder): OrderProductInterface
{
$orderProduct = $this->createBase();


+ 2
- 2
Model/Order/OrderProductInterface.php Ver arquivo

@@ -17,9 +17,9 @@ interface OrderProductInterface

public function setProduct(?ProductInterface $product): OrderProductInterface;

public function getQuantityOrder(): ?int;
public function getQuantityOrder(): ?float;

public function setQuantityOrder(int $quantityOrder): OrderProductInterface;
public function setQuantityOrder(float $quantityOrder): OrderProductInterface;

public function getQuantityProduct(): ?float;


+ 3
- 3
Model/Order/OrderProductModel.php Ver arquivo

@@ -27,7 +27,7 @@ abstract class OrderProductModel implements PriceInterface, EntityInterface, Ord
protected $product;

/**
* @ORM\Column(type="integer")
* @ORM\Column(type="float")
*/
protected $quantityOrder;

@@ -98,12 +98,12 @@ abstract class OrderProductModel implements PriceInterface, EntityInterface, Ord
return $this;
}

public function getQuantityOrder(): ?int
public function getQuantityOrder(): ?float
{
return $this->quantityOrder;
}

public function setQuantityOrder(int $quantityOrder): self
public function setQuantityOrder(float $quantityOrder): self
{
$this->quantityOrder = $quantityOrder;


+ 2
- 2
Model/Order/OrderProductRefundInterface.php Ver arquivo

@@ -5,9 +5,9 @@ namespace Lc\CaracoleBundle\Model\Order;

interface OrderProductRefundInterface
{
public function getQuantityRefund(): ?int;
public function getQuantityRefund(): ?float;

public function setQuantityOrder(int $quantityRefund): OrderProductRefundInterface;
public function setQuantityOrder(float $quantityRefund): OrderProductRefundInterface;

public function getPrice(): ?float;


+ 3
- 3
Model/Order/OrderProductRefundModel.php Ver arquivo

@@ -12,7 +12,7 @@ use Lc\SovBundle\Doctrine\EntityInterface;
abstract class OrderProductRefundModel implements EntityInterface, OrderProductRefundInterface
{
/**
* @ORM\Column(type="integer")
* @ORM\Column(type="float")
*/
protected $quantityRefund;

@@ -32,12 +32,12 @@ abstract class OrderProductRefundModel implements EntityInterface, OrderProductR
*/
protected $orderProduct;

public function getQuantityRefund(): ?int
public function getQuantityRefund(): ?float
{
return $this->quantityRefund;
}

public function setQuantityOrder(int $quantityRefund): self
public function setQuantityOrder(float $quantityRefund): self
{
$this->quantityRefund = $quantityRefund;


+ 1
- 1
Solver/Order/OrderShopSolver.php Ver arquivo

@@ -129,7 +129,7 @@ class OrderShopSolver
SectionInterface $section,
?OrderShopInterface $orderShop,
ProductInterface $product,
int $quantityOrder = 0,
float $quantityOrder = 0,
bool $checkCart = false
) {
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus(

Carregando…
Cancelar
Salvar