Fix: Avoid error in migration from 3.1 version.
Fix: Suggested migration choice was ko from x.y.z to x.y.z+1
This commit is contained in:
parent
6a84a7f935
commit
94be4ec897
@ -45,8 +45,8 @@
|
|||||||
* @param string $price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC
|
* @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 $info_bits Miscellaneous informations on line
|
||||||
* @param int $type 0/1=Product/service
|
* @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 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)
|
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function).
|
||||||
* @return result[ 0=total_ht,
|
* @return result[ 0=total_ht,
|
||||||
* 1=total_vat,
|
* 1=total_vat,
|
||||||
* 2=total_ttc,
|
* 2=total_ttc,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -393,24 +393,32 @@ else
|
|||||||
foreach ($migrationscript as $migarray)
|
foreach ($migrationscript as $migarray)
|
||||||
{
|
{
|
||||||
$count++;
|
$count++;
|
||||||
$versionfrom=$migarray['from'];
|
$version=preg_split('/[\.-]/',DOL_VERSION);
|
||||||
|
$versionfrom=$migarray['from'];
|
||||||
$versionto=$migarray['to'];
|
$versionto=$migarray['to'];
|
||||||
$newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom);
|
$versionarray=preg_split('/[\.-]/',$version);
|
||||||
$newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto);
|
|
||||||
$dolibarrversionfromarray=preg_split('/[\.-]/',$versionfrom);
|
$dolibarrversionfromarray=preg_split('/[\.-]/',$versionfrom);
|
||||||
$dolibarrversiontoarray=preg_split('/[\.-]/',$versionto);
|
$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='';
|
$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 '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
|
||||||
print '<td class="listofchoices">';
|
print '<td class="listofchoices">';
|
||||||
print $langs->trans("UpgradeDesc");
|
print $langs->trans("UpgradeDesc");
|
||||||
|
|
||||||
if ($ok)
|
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
|
// 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 '<br>';
|
||||||
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||||
|
|||||||
@ -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 DoliDB $db Database handler
|
||||||
* @param Translate $langs Object langs
|
* @param Translate $langs Object langs
|
||||||
@ -1470,6 +1470,10 @@ function migrate_price_contrat($db,$langs,$conf)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$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 '<tr><td colspan="4">';
|
||||||
|
|
||||||
print '<br>';
|
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->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
|
||||||
$contratligne->rowid=$rowid;
|
$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_ht = $result[0];
|
||||||
$total_tva = $result[1];
|
$total_tva = $result[1];
|
||||||
$total_ttc = $result[2];
|
$total_ttc = $result[2];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user