Browse Source

Correctif : erreur division par zero

packProduct
Fab 2 years ago
parent
commit
b076e6c43e
2 changed files with 8 additions and 2 deletions
  1. +5
    -1
      Solver/Product/ProductFamilySolver.php
  2. +3
    -1
      Solver/Product/ProductSolver.php

+ 5
- 1
Solver/Product/ProductFamilySolver.php View File



public function getQuantityInherited(ProductFamilyInterface $productFamily): ?float public function getQuantityInherited(ProductFamilyInterface $productFamily): ?float
{ {
return $productFamily->getQuantity();
if($productFamily->getQuantity()){
return $productFamily->getQuantity();
}else{
return 1;
}
} }


public function getUnitInherited(ProductFamilyInterface $productFamily) public function getUnitInherited(ProductFamilyInterface $productFamily)

+ 3
- 1
Solver/Product/ProductSolver.php View File

{ {
if ($product->getQuantity()) { if ($product->getQuantity()) {
return $product->getQuantity(); return $product->getQuantity();
} else {
} else if($product->getProductFamily()->getQuantity()){
return $product->getProductFamily()->getQuantity(); return $product->getProductFamily()->getQuantity();
}else{
return 1;
} }
} }



Loading…
Cancel
Save