@@ -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()) { |
@@ -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); | |||
} | |||
} |
@@ -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(); | |||
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
@@ -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( |