namespace Lc\CaracoleBundle\Controller; | namespace Lc\CaracoleBundle\Controller; | ||||
use App\Entity\Section\Section; | |||||
use Doctrine\Common\Collections\ArrayCollection; | use Doctrine\Common\Collections\ArrayCollection; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | ||||
} | } | ||||
} | } | ||||
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( | public function createIndexRepositoryQuery( | ||||
SearchDto $searchDto, | SearchDto $searchDto, | ||||
EntityDto $entityDto, | EntityDto $entityDto, |
*/ | */ | ||||
protected $propertyExpirationDate; | protected $propertyExpirationDate; | ||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $weight; | |||||
public function getBuyingPriceByRefUnit(): ?float | public function getBuyingPriceByRefUnit(): ?float | ||||
{ | { | ||||
return $this->buyingPriceByRefUnit; | return $this->buyingPriceByRefUnit; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getWeight(): ?float | |||||
{ | |||||
return $this->weight; | |||||
} | |||||
public function setWeight(?float $weight): self | |||||
{ | |||||
$this->weight = $weight; | |||||
return $this; | |||||
} | |||||
} | } |
} | } | ||||
return $arrayComplementaryOrderShops; | return $arrayComplementaryOrderShops; | ||||
} | } | ||||
public function countValidComplementaryOrderShops(OrderShopInterface $orderShop): int | public function countValidComplementaryOrderShops(OrderShopInterface $orderShop): int | ||||
{ | { | ||||
return count($this->getValidComplementaryOrderShops($orderShop)); | return count($this->getValidComplementaryOrderShops($orderShop)); |
return $price; | 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) | public function applyReductionPercent($price, $percentage) | ||||
{ | { | ||||
return $this->applyPercent($price, -$percentage); | return $this->applyPercent($price, -$percentage); |
if ($product->getTitle()) { | if ($product->getTitle()) { | ||||
$endOfTitle = $product->getTitle(); | $endOfTitle = $product->getTitle(); | ||||
} else { | } 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) | public function getQuantityInherited(ProductInterface $product) | ||||
{ | { | ||||
if ($product->getQuantity()) { | if ($product->getQuantity()) { | ||||
return $product->getQuantity(); | return $product->getQuantity(); | ||||
} else if($product->getProductFamily()->getQuantity()){ | |||||
} else if ($product->getProductFamily()->getQuantity()) { | |||||
return $product->getProductFamily()->getQuantity(); | return $product->getProductFamily()->getQuantity(); | ||||
}else{ | |||||
} else { | |||||
return 1; | return 1; | ||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
public function getWeightInherited(ProductInterface $product): ? float | |||||
{ | |||||
if ($product->getWeight()) { | |||||
return $product->getWeight(); | |||||
} | |||||
return $product->getProductFamily()->getWeight(); | |||||
} | |||||
} | } |