Bläddra i källkod

Correctif déduction stocks

feature/export_comptable
Guillaume 4 år sedan
förälder
incheckning
0b9f9cbcae
1 ändrade filer med 15 tillägg och 6 borttagningar
  1. +15
    -6
      ShopBundle/Services/Order/OrderUtilsStockTrait.php

+ 15
- 6
ShopBundle/Services/Order/OrderUtilsStockTrait.php Visa fil

//Disponibilité par unité de référence //Disponibilité par unité de référence
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); $oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient())); $newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient()));
$orderProduct->getProduct()->getProductFamily()->setAvailableQuantity($newAvailability);


$this->em->persist($orderProduct->getProduct()->getProductFamily());
$productFamily = $orderProduct->getProduct()->getProductFamily() ;
$productFamily->setAvailableQuantity($newAvailability);
$productFamily->setUpdatedBy($productFamily->getCreatedBy()) ;

$this->em->persist($productFamily);


break; break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :


$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); $oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder(); $newAvailability = $oldAvailability - $orderProduct->getQuantityOrder();
$orderProduct->getProduct()->getProductFamily()->setAvailableQuantity($newAvailability);


$this->em->persist($orderProduct->getProduct()->getProductFamily());
$productFamily = $orderProduct->getProduct()->getProductFamily() ;
$productFamily->setAvailableQuantity($newAvailability);
$productFamily->setUpdatedBy($productFamily->getCreatedBy()) ;

$this->em->persist($productFamily);


break; break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); $oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder(); $newAvailability = $oldAvailability - $orderProduct->getQuantityOrder();
$orderProduct->getProduct()->setAvailableQuantity($newAvailability);


$this->em->persist($orderProduct->getProduct());
$product = $orderProduct->getProduct() ;
$product->setAvailableQuantity($newAvailability);
$product->setUpdatedBy($product->getCreatedBy()) ;

$this->em->persist($product);


break; break;
} }

Laddar…
Avbryt
Spara