Browse Source

#944 Better initialization of the 'origin' field based on localized comments.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3238 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 11 years ago
parent
commit
7fa7aaccb2
1 changed files with 13 additions and 2 deletions
  1. 13 2
      setup/applicationinstaller.class.inc.php

+ 13 - 2
setup/applicationinstaller.class.inc.php

@@ -607,9 +607,20 @@ class ApplicationInstaller
 				$sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'csv-interactive' WHERE `userinfo` LIKE '%(CSV)' AND origin = 'interactive'";
 				CMDBSource::Query($sInit);
 				
-				// Syncho data sources were identified by the comment at the end (Yes: Synchronisation with a S!!)
-				$sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'synchro-data-source' WHERE `userinfo` LIKE '%(Synchronisation)'";
 				
+				// Syncho data sources were identified by the comment at the end
+				// Unfortunately the comment is localized, so we have to search for all possible patterns
+				$sCurrentLanguage = Dict::GetUserLanguage();
+				foreach(Dict::GetLanguages() as $sLangCode => $aLang)
+				{
+					Dict::SetUserLanguage($sLangCode);
+					$sSuffix = CMDBSource::Quote('%'.Dict::S('Core:SyncDataExchangeComment'));
+					$aSuffixes[$sSuffix] = true;
+				}
+				Dict::SetUserLanguage($sCurrentLanguage);
+				$sCondition = "`userinfo` LIKE ".implode(" OR `userinfo` LIKE ", array_keys($aSuffixes));
+
+				$sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'synchro-data-source' WHERE ($sCondition)"; 
 				CMDBSource::Query($sInit);
 				
 				SetupPage::log_info("Initialization of '{$sDBPrefix}priv_change.origin' completed.");