瀏覽代碼

Prix spécifiques : correctif filtre prix dans ProductPrice

refactoring
Guillaume Bourgeois 2 年之前
父節點
當前提交
fd3b0cb6b2
共有 2 個檔案被更改,包括 15 行新增8 行删除
  1. +7
    -8
      common/models/Product.php
  2. +8
    -0
      common/models/ProductPrice.php

+ 7
- 8
common/models/Product.php 查看文件

@@ -455,18 +455,17 @@ class Product extends ActiveRecordCommon
public function getSpecificPricesFilterByPriorityMatch($specificPrices, $user, $pointSale)
{
$priorityMatchSpecificPrice = ProductPrice::getPriorityMatchOfSpecificPriceArray($specificPrices, $user, $pointSale);
$specificPricesFilter = [];

if($priorityMatchSpecificPrice) {
foreach($specificPrices as $keySpecificPrice => $specificPrice) {
if(!$specificPrice->$priorityMatchSpecificPrice($user, $pointSale)) {
unset($specificPrices[$keySpecificPrice]);
}
}
foreach($specificPrices as $keySpecificPrice => $specificPrice) {
if(($priorityMatchSpecificPrice && $specificPrice->$priorityMatchSpecificPrice($user, $pointSale))
|| $specificPrice->matchFromQuantityOnly()) {

return $specificPrices;
$specificPricesFilter[] = $specificPrice;
}
}

return [];
return $specificPricesFilter;
}

public function getPrice($params = [])

+ 8
- 0
common/models/ProductPrice.php 查看文件

@@ -251,4 +251,12 @@ class ProductPrice extends ActiveRecordCommon
&& $this->id_point_sale == $pointSale->id
&& $this->id_user == $user->id;
}

public function matchFromQuantityOnly()
{
return !$this->id_user
&& !$this->id_point_sale
&& !$this->id_user_group
&& $this->from_quantity;
}
}

Loading…
取消
儲存