Browse Source

Merge branch 'feature/section_export' into develop

develop
Guillaume Bourgeois 5 days ago
parent
commit
ba122f7974
5 changed files with 50 additions and 5 deletions
  1. +8
    -0
      Controller/AdminControllerTrait.php
  2. +18
    -0
      Doctrine/Extension/ProductPropertyTrait.php
  3. +1
    -1
      Solver/Order/OrderShopSolver.php
  4. +11
    -0
      Solver/Price/PriceSolverTrait.php
  5. +12
    -4
      Solver/Product/ProductSolver.php

+ 8
- 0
Controller/AdminControllerTrait.php View File

@@ -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,

+ 18
- 0
Doctrine/Extension/ProductPropertyTrait.php View File

@@ -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;
}

}

+ 1
- 1
Solver/Order/OrderShopSolver.php View File

@@ -232,7 +232,7 @@ class OrderShopSolver
}
return $arrayComplementaryOrderShops;
}
public function countValidComplementaryOrderShops(OrderShopInterface $orderShop): int
{
return count($this->getValidComplementaryOrderShops($orderShop));

+ 11
- 0
Solver/Price/PriceSolverTrait.php View File

@@ -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);

+ 12
- 4
Solver/Product/ProductSolver.php View File

@@ -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();
}
}

Loading…
Cancel
Save