Bläddra i källkod

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

refactoring
Guillaume Bourgeois 2 år sedan
förälder
incheckning
406ed45463
2 ändrade filer med 18 tillägg och 1 borttagningar
  1. +1
    -1
      backend/views/document/_form.php
  2. +17
    -0
      common/models/ProductPrice.php

+ 1
- 1
backend/views/document/_form.php Visa fil

@@ -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 Visa fil

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

Laddar…
Avbryt
Spara