Kaynağa Gözat

Prix spécifiques : correctif filtre prix dans ProductPrice

refactoring
Guillaume Bourgeois 2 yıl önce
ebeveyn
işleme
fd3b0cb6b2
2 değiştirilmiş dosya ile 15 ekleme ve 8 silme
  1. +7
    -8
      common/models/Product.php
  2. +8
    -0
      common/models/ProductPrice.php

+ 7
- 8
common/models/Product.php Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

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

Yükleniyor…
İptal
Kaydet