Selaa lähdekoodia

Gestion vente en vrac

develop
Guillaume Bourgeois 1 kuukausi sitten
vanhempi
commit
0f6935fbd5
8 muutettua tiedostoa jossa 20 lisäystä ja 14 poistoa
  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 Näytä tiedosto

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

+ 7
- 1
Controller/Order/CartController.php Näytä tiedosto

class CartController extends AbstractController class CartController extends AbstractController
{ {
protected ?ProductFamilyInterface $productFamily = null; protected ?ProductFamilyInterface $productFamily = null;
protected int $quantityOrder = 1;
protected float $quantityOrder = 1;
protected array $orderProducts = []; protected array $orderProducts = [];


public function addProductFamily(Request $request): JsonResponse public function addProductFamily(Request $request): JsonResponse
$data = $form->getData(); $data = $form->getData();
foreach ($data as $orderProduct) { foreach ($data as $orderProduct) {
if ($orderProduct instanceof OrderProductInterface) { 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); $this->addOrderProduct($orderShop, $orderProduct);
} }
} }

+ 1
- 1
Factory/Order/OrderProductFactory.php Näytä tiedosto



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



+ 2
- 2
Model/Order/OrderProductInterface.php Näytä tiedosto



public function setProduct(?ProductInterface $product): 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; public function getQuantityProduct(): ?float;



+ 3
- 3
Model/Order/OrderProductModel.php Näytä tiedosto

protected $product; protected $product;


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


return $this; return $this;
} }


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


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



+ 2
- 2
Model/Order/OrderProductRefundInterface.php Näytä tiedosto



interface OrderProductRefundInterface 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; public function getPrice(): ?float;



+ 3
- 3
Model/Order/OrderProductRefundModel.php Näytä tiedosto

abstract class OrderProductRefundModel implements EntityInterface, OrderProductRefundInterface abstract class OrderProductRefundModel implements EntityInterface, OrderProductRefundInterface
{ {
/** /**
* @ORM\Column(type="integer")
* @ORM\Column(type="float")
*/ */
protected $quantityRefund; protected $quantityRefund;


*/ */
protected $orderProduct; protected $orderProduct;


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


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



+ 1
- 1
Solver/Order/OrderShopSolver.php Näytä tiedosto

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

Loading…
Peruuta
Tallenna