Преглед изворни кода

Merge branch 'develop'

master
Guillaume пре 4 година
родитељ
комит
2b734b5655
1 измењених фајлова са 15 додато и 6 уклоњено
  1. +15
    -6
      ShopBundle/Services/Order/OrderUtilsStockTrait.php

+ 15
- 6
ShopBundle/Services/Order/OrderUtilsStockTrait.php Прегледај датотеку

@@ -20,26 +20,35 @@ trait OrderUtilsStockTrait
//Disponibilité par unité de référence
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$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;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :

$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$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;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$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;
}

Loading…
Откажи
Сачувај