diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 27f6ccf3f4f..939ffa451dd 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -672,12 +672,14 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
{
$pu_ht = $prod->multiprices[$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
+ $price_min = $prod->multiprices_min[$object->client->price_level];
$price_base_type = $prod->multiprices_base_type[$object->client->price_level];
}
else
{
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
+ $price_min = $prod->price_min;
$price_base_type = $prod->price_base_type;
}
@@ -714,9 +716,9 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
$info_bits=0;
if ($tva_npr) $info_bits |= 0x01;
- if ($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min)))
+ if ($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
{
- $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
+ $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
}
else
{
@@ -794,10 +796,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
{
$product = new Product($db) ;
$res=$product->fetch($productid) ;
+ $price_min = $product->price_min;
+ if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level];
}
- if ($productid && $product->price_min && (price2num($up_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min)))
+ if ($productid && $price_min && (price2num($up_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
{
- $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
+ $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
}
else
{
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 84942a5d95f..ecb1add0890 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -402,12 +402,14 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
{
$pu_ht = $prod->multiprices[$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
+ $price_min = $prod->multiprices_min[$object->client->price_level];
$price_base_type = $prod->multiprices_base_type[$object->client->price_level];
}
else
{
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
+ $price_min = $prod->price_min;
$price_base_type = $prod->price_base_type;
}
@@ -450,10 +452,10 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
if ($result >= 0)
{
- if($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min)))
+ if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
{
//print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
- $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
+ $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
}
else
{
@@ -548,10 +550,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
$product = new Product($db);
$product->fetch($productid);
$type=$product->type;
+ $price_min = $product->price_min;
+ if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level];
}
- if ($product->price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num($_POST['elremise_percent'])/100) < price2num($product->price_min)))
+ if ($price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num($_POST['elremise_percent'])/100) < price2num($price_min)))
{
- $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
+ $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
$result=-1;
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 330a4cd350e..125a2901d4d 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -909,7 +909,7 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $
{
if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
{
- $object->error = $langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ;
+ $object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ;
$result = -1 ;
}
else
@@ -1005,11 +1005,13 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$product = new Product($db);
$product->fetch($productid);
$type=$product->type;
+ $price_min = $product->price_min;
+ if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level];
}
- if ($object->type!=2 && $product->price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($product->price_min)))
+ if ($object->type!=2 && $price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
{
//print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
- $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
';
+ $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
';
$result=-1;
}