Fix avoid migration when already migrated

This commit is contained in:
Laurent Destailleur 2016-08-29 21:07:36 +02:00
parent fbdbad0d7c
commit 98eb3fec5a

View File

@ -402,6 +402,14 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$afterversionarray=explode('.','3.9.9'); $afterversionarray=explode('.','3.9.9');
$beforeversionarray=explode('.','4.0.9'); $beforeversionarray=explode('.','4.0.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
migrate_directories($db,$langs,$conf,'/fckeditor','/medias');
}
// Scripts for last version
$afterversionarray=explode('.','4.0.9');
$beforeversionarray=explode('.','5.0.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{ {
// Migrate to add entity value into llx_societe_remise // Migrate to add entity value into llx_societe_remise
migrate_remise_entity($db,$langs,$conf); migrate_remise_entity($db,$langs,$conf);
@ -409,8 +417,6 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
// Migrate to add entity value into llx_societe_remise_except // Migrate to add entity value into llx_societe_remise_except
migrate_remise_except_entity($db,$langs,$conf); migrate_remise_except_entity($db,$langs,$conf);
migrate_directories($db,$langs,$conf,'/fckeditor','/medias');
// Reload modules (this must be always and only into last targeted version) // Reload modules (this must be always and only into last targeted version)
$listofmodule=array( $listofmodule=array(
'MAIN_MODULE_BARCODE'=>'newboxdefonly', 'MAIN_MODULE_BARCODE'=>'newboxdefonly',
@ -424,7 +430,6 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
migrate_reload_menu($db,$langs,$conf,$versionto); migrate_reload_menu($db,$langs,$conf,$versionto);
} }
// Can force activation of some module during migration with third paramater = MAIN_MODULE_XXX,MAIN_MODULE_YYY,... // Can force activation of some module during migration with third paramater = MAIN_MODULE_XXX,MAIN_MODULE_YYY,...
if ($enablemodules) if ($enablemodules)
{ {
@ -3688,7 +3693,7 @@ function migrate_remise_entity($db,$langs,$conf)
$sqlSelect = "SELECT sr.rowid, s.entity"; $sqlSelect = "SELECT sr.rowid, s.entity";
$sqlSelect.= " FROM ".MAIN_DB_PREFIX."societe_remise as sr, ".MAIN_DB_PREFIX."societe as s"; $sqlSelect.= " FROM ".MAIN_DB_PREFIX."societe_remise as sr, ".MAIN_DB_PREFIX."societe as s";
$sqlSelect.= " WHERE sr.fk_soc = s.rowid"; $sqlSelect.= " WHERE sr.fk_soc = s.rowid and sr.entity != s.entity";
//print $sqlSelect; //print $sqlSelect;