瀏覽代碼

Merge branch 'develop'

master
Guillaume Bourgeois 2 週之前
父節點
當前提交
52dcff4a34
共有 5 個檔案被更改,包括 50 行新增5 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存