@@ -2,6 +2,7 @@ | |||
namespace Lc\CaracoleBundle\Controller; | |||
use App\Entity\Section\Section; | |||
use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | |||
@@ -59,6 +60,13 @@ trait AdminControllerTrait | |||
} | |||
} | |||
public function configureResponseParametersDisableShowIfNotSection(KeyValueStore $responseParameters, Section $section) | |||
{ | |||
if($this->getSectionCurrent() != $section) { | |||
$responseParameters->set('replace_content_with_message', "Vous devez vous rendre sur la section ". $section->getTitle().' pour afficher cette page'); | |||
} | |||
} | |||
public function createIndexRepositoryQuery( | |||
SearchDto $searchDto, | |||
EntityDto $entityDto, |
@@ -39,6 +39,12 @@ trait ProductPropertyTrait | |||
*/ | |||
protected $propertyExpirationDate; | |||
/** | |||
* @ORM\Column(type="float", nullable=true) | |||
*/ | |||
protected $weight; | |||
public function getBuyingPriceByRefUnit(): ?float | |||
{ | |||
return $this->buyingPriceByRefUnit; | |||
@@ -111,4 +117,16 @@ trait ProductPropertyTrait | |||
return $this; | |||
} | |||
public function getWeight(): ?float | |||
{ | |||
return $this->weight; | |||
} | |||
public function setWeight(?float $weight): self | |||
{ | |||
$this->weight = $weight; | |||
return $this; | |||
} | |||
} |
@@ -232,7 +232,7 @@ class OrderShopSolver | |||
} | |||
return $arrayComplementaryOrderShops; | |||
} | |||
public function countValidComplementaryOrderShops(OrderShopInterface $orderShop): int | |||
{ | |||
return count($this->getValidComplementaryOrderShops($orderShop)); |
@@ -20,6 +20,17 @@ trait PriceSolverTrait | |||
return $price; | |||
} | |||
public function excludeTax($price, $taxRateValue, $round = true) | |||
{ | |||
$price = $this->applyPercentNegative($price, $taxRateValue); | |||
if($round) { | |||
return $this->round($price); | |||
} | |||
return $price; | |||
} | |||
public function applyReductionPercent($price, $percentage) | |||
{ | |||
return $this->applyPercent($price, -$percentage); |
@@ -119,18 +119,18 @@ class ProductSolver | |||
if ($product->getTitle()) { | |||
$endOfTitle = $product->getTitle(); | |||
} else { | |||
$endOfTitle = $this->getQuantityInherited($product).' '.$this->getUnitInherited($product)->getWordingShort(); | |||
$endOfTitle = $this->getQuantityInherited($product) . ' ' . $this->getUnitInherited($product)->getWordingShort(); | |||
} | |||
return $product->getProductFamily()->getTitle(). ' - '. $endOfTitle; | |||
return $product->getProductFamily()->getTitle() . ' - ' . $endOfTitle; | |||
} | |||
public function getQuantityInherited(ProductInterface $product) | |||
{ | |||
if ($product->getQuantity()) { | |||
return $product->getQuantity(); | |||
} else if($product->getProductFamily()->getQuantity()){ | |||
} else if ($product->getProductFamily()->getQuantity()) { | |||
return $product->getProductFamily()->getQuantity(); | |||
}else{ | |||
} else { | |||
return 1; | |||
} | |||
} | |||
@@ -210,4 +210,12 @@ class ProductSolver | |||
return null; | |||
} | |||
public function getWeightInherited(ProductInterface $product): ? float | |||
{ | |||
if ($product->getWeight()) { | |||
return $product->getWeight(); | |||
} | |||
return $product->getProductFamily()->getWeight(); | |||
} | |||
} |