Prechádzať zdrojové kódy

#674 request_type:servicerequest changed into service_request - added the DB update to allow an upgrade

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2650 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 rokov pred
rodič
commit
6b6b47f288

+ 5 - 3
datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php

@@ -17,7 +17,7 @@ SetupWebPage::AddModule(
 		),
 		'mandatory' => false,
 		'visible' => true,
-		'installer' => 'ServiceMgmtInstaller',
+		'installer' => 'ServiceMgmtProviderInstaller',
 
 		// Components
 		//
@@ -52,11 +52,11 @@ SetupWebPage::AddModule(
 	)
 );
 
-if (!class_exists('ServiceMgmtInstaller'))
+if (!class_exists('ServiceMgmtProviderInstaller'))
 {
 	// Module installation handler
 	//
-	class ServiceMgmtInstaller extends ModuleInstallerAPI
+	class ServiceMgmtProviderInstaller extends ModuleInstallerAPI
 	{
 		public static function BeforeWritingConfig(Config $oConfiguration)
 		{
@@ -76,6 +76,8 @@ if (!class_exists('ServiceMgmtInstaller'))
 			{
 				// If you want to migrate data from one format to another, do it here
 				self::RenameClassInDB('ServiceFamilly', 'ServiceFamily');
+
+				self::RenameEnumValueInDB('SLT', 'request_type', 'servicerequest', 'service_request');
 			}
 		}
 	

+ 38 - 0
datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php

@@ -17,6 +17,7 @@ SetupWebPage::AddModule(
 		),
 		'mandatory' => false,
 		'visible' => true,
+		'installer' => 'ServiceMgmtInstaller',
 
 		// Components
 		//
@@ -51,4 +52,41 @@ SetupWebPage::AddModule(
 	)
 );
 
+if (!class_exists('ServiceMgmtInstaller'))
+{
+	// Module installation handler
+	//
+	class ServiceMgmtInstaller extends ModuleInstallerAPI
+	{
+		public static function BeforeWritingConfig(Config $oConfiguration)
+		{
+			// If you want to override/force some configuration values, do it here
+			return $oConfiguration;
+		}
+
+		/**
+		 * Handler called before creating or upgrading the database schema
+		 * @param $oConfiguration Config The new configuration of the application
+		 * @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
+		 * @param $sCurrentVersion string Current version number of the module
+		 */
+		public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
+		{
+			if (strlen($sPreviousVersion) > 0)
+			{
+				self::RenameEnumValueInDB('SLT', 'request_type', 'servicerequest', 'service_request');
+			}
+		}
+	
+		/**
+		 * Handler called after the creation/update of the database schema
+		 * @param $oConfiguration Config The new configuration of the application
+		 * @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
+		 * @param $sCurrentVersion string Current version number of the module
+		 */
+		public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
+		{
+		}
+	}
+}
 ?>