Преглед на файлове

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…
Отказ
Запис