Kaynağa Gözat

[Backend] Documents : problème prix spécifiques non pris en compte #569

refactoring
Guillaume Bourgeois 2 yıl önce
ebeveyn
işleme
406ed45463
2 değiştirilmiş dosya ile 18 ekleme ve 1 silme
  1. +1
    -1
      backend/views/document/_form.php
  2. +17
    -0
      common/models/ProductPrice.php

+ 1
- 1
backend/views/document/_form.php Dosyayı Görüntüle

@@ -275,7 +275,7 @@ use common\models\Producer;
<td class="col-md-2">
{{ formatPrice(getProductOrderPrice(productOrder)) }}
<template v-if="document.status == 'draft' && getProductOrderPrice(productOrder) != getBestProductPrice(productOrder.id_product, productOrder.quantity)">
<i class="fa fa-exclamation-triangle" title="Prix différent du prix défini au niveau du produit"></i>
<i class="fa fa-exclamation-triangle" title="Prix différent de celui défini au niveau du produit"></i>
</template>
</td>
<td class="col-md-2">{{ productOrder.quantity }}</td>

+ 17
- 0
common/models/ProductPrice.php Dosyayı Görüntüle

@@ -202,9 +202,11 @@ class ProductPrice extends ActiveRecordCommon
if(self::hasMatchOfType($specificPriceArray, 'matchUser', $user, $pointSale)) {
return 'matchUser';
}

if(self::hasMatchOfType($specificPriceArray, 'matchUserGroup', $user, $pointSale)) {
return 'matchUserGroup';
}

if(self::hasMatchOfType($specificPriceArray, 'matchPointSale', $user, $pointSale)) {
return 'matchPointSale';
}
@@ -213,6 +215,10 @@ class ProductPrice extends ActiveRecordCommon
return 'matchUserPointSale';
}

if(self::hasMatchOfType($specificPriceArray, 'matchUserGroupPointSale', $user, $pointSale)) {
return 'matchUserGroupPointSale';
}

return null;
}

@@ -252,6 +258,17 @@ class ProductPrice extends ActiveRecordCommon
&& $this->id_user == $user->id;
}

public function matchUserGroupPointSale($user, $pointSale)
{
return $user
&& $pointSale
&& $this->id_user_group
&& $this->id_point_sale
&& !$this->id_user
&& $user->belongsToUserGroup($this->id_user_group)
&& $this->id_point_sale == $pointSale->id;
}

public function matchFromQuantityOnly()
{
return !$this->id_user

Yükleniyor…
İptal
Kaydet