From 362bc106eb9439d015fca87ccd25f879c19f999b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?=
 <marcosgdf@gmail.com>
Date: Wed, 30 Mar 2016 11:38:39 +0200
Subject: [PATCH] FIX Multiprice generator didn't recalculate prices if only
 the price_base_type property changes

---
 htdocs/product/class/product.class.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index ec7a67aff83..f8cb45a8b38 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -7,7 +7,7 @@
  * Copyright (C) 2010-2013	Juanjo Menent			<jmenent@2byte.es>
  * Copyright (C) 2012       Cedric Salvador         <csalvador@gpcsolutions.fr>
  * Copyright (C) 2013-2014	Cedric GROSS			<c.gross@kreiz-it.fr>
- * Copyright (C) 2013-2015	Marcos García			<marcosgdf@gmail.com>
+ * Copyright (C) 2013-2016	Marcos García			<marcosgdf@gmail.com>
  * Copyright (C) 2011-2014	Alexandre Spangaro		<aspangaro.dolibarr@gmail.com>
  * Copyright (C) 2014		Henry Florian			<florian.henry@open-concept.pro>
  * Copyright (C) 2014-2016	Philippe Grand			<philippe.grand@atoo-net.com>
@@ -4123,7 +4123,11 @@ class Product extends CommonObject
 				$price_min = $price * (1 - ($rules[$i]->var_min_percent/100));
 			}
 
-			if ($price == $this->multiprices[$i] && ($price_min == $this->multiprices_min[$i])) {
+			//Little check to make sure the price is modified before triggering generation
+			$check_amount = $price == $this->multiprices[$i] && ($price_min == $this->multiprices_min[$i]);
+			$check_type = $baseprice == $this->multiprices_base_type[$i];
+
+			if ($check_amount && $check_type) {
 				continue;
 			}
 
-- 
GitLab