diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php
index 1d51485185bb41f072de2ea0ac09c81c58330363..d4c0e72820ffcec2f7653a26e96025bc1b664985 100644
--- a/htdocs/core/lib/price.lib.php
+++ b/htdocs/core/lib/price.lib.php
@@ -45,8 +45,8 @@
  *		@param	string	$price_base_type 			HT=on calcule sur le HT, TTC=on calcule sur le TTC
  *		@param	int		$info_bits					Miscellaneous informations on line
  *		@param	int		$type						0/1=Product/service
- *		@param  string	$seller						Thirdparty seller (we need $seller->country_code property). Provided only if seller is the supplier.
- *		@param  array	$localtaxes_array			Array with localtaxes info (loaded by getLocalTaxesFromRate function)
+ *		@param  string	$seller						Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
+ *		@param  array	$localtaxes_array			Array with localtaxes info (loaded by getLocalTaxesFromRate function).
  *		@return result[ 0=total_ht,
  *						 1=total_vat,
  *						 2=total_ttc,
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index 097ee22817a78893e4dcf2952a7dafa2747a0181..6690f6fc61fb4da4b7c6a77bbbbce1caadb6a597 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2004-2005	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
- * Copyright (C) 2004-2012	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2014	Laurent Destailleur		<eldy@users.sourceforge.net>
  * Copyright (C) 2005		Marc Barilley / Ocebo	<marc@ocebo.com>
  * Copyright (C) 2005-2012	Regis Houssin			<regis.houssin@capnetworks.com>
  * Copyright (C) 2013		Juanjo Menent			<jmenent@2byte.es>
@@ -393,24 +393,32 @@ else
 		foreach ($migrationscript as $migarray)
 		{
 			$count++;
-            $versionfrom=$migarray['from'];
+            $version=preg_split('/[\.-]/',DOL_VERSION);
+			$versionfrom=$migarray['from'];
             $versionto=$migarray['to'];
-            $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom);
-            $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto);
+            $versionarray=preg_split('/[\.-]/',$version);
             $dolibarrversionfromarray=preg_split('/[\.-]/',$versionfrom);
             $dolibarrversiontoarray=preg_split('/[\.-]/',$versionto);
-            $version=preg_split('/[\.-]/',DOL_VERSION);
+            // Define string newversionxxx that are used for text to show
+            $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom);
+            $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto);
             $newversionfrombis='';
-            if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis=' '.$langs->trans("or").' '.$versionto;
+            if (versioncompare($dolibarrversiontoarray,$version) < -2)	// From x.y.z -> x.y.z+1
+            {
+            	$newversionfrombis=' '.$langs->trans("or").' '.$versionto;
+            }
 			print '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
 			print '<td class="listofchoices">';
 			print $langs->trans("UpgradeDesc");
+
 			if ($ok)
 			{
-				if (count($dolibarrlastupgradeversionarray) >= 2)	// If a database access is available and a version x.y already available
+				if (count($dolibarrlastupgradeversionarray) >= 2)	// If a database access is available and last upgrade version is known
 				{
 					// Now we check if this is the first qualified choice
-					if ($allowupgrade && empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0)
+					if ($allowupgrade && empty($foundrecommandedchoice) &&
+						(versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$version) < -2)
+						)
 					{
 						print '<br>';
 						//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 593ae33ebcc227d2744b915b1a51d2247cfba0ff..2bcb244690e3bc8557599ccd8e1eeb9a5198327e 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -1459,7 +1459,7 @@ function migrate_price_propal($db,$langs,$conf)
 }
 
 /**
- * Mise a jour des totaux lignes de propal
+ * Update total of contract lines
  *
  * @param	DoliDB		$db		Database handler
  * @param	Translate	$langs	Object langs
@@ -1470,6 +1470,10 @@ function migrate_price_contrat($db,$langs,$conf)
 {
     $db->begin();
 
+   	$tmpmysoc=new Societe($db);
+	$tmpmysoc->setMysoc($conf);
+    if (empty($tmpmysoc->country_id)) $tmpmysoc->country_id=0;	// Ti not have this set to '' or will make sql syntax error.
+
     print '<tr><td colspan="4">';
 
     print '<br>';
@@ -1506,7 +1510,7 @@ function migrate_price_contrat($db,$langs,$conf)
                 //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
                 $contratligne->rowid=$rowid;
 
-                $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0);
+                $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0,$tmpmysoc);
                 $total_ht  = $result[0];
                 $total_tva = $result[1];
                 $total_ttc = $result[2];