From a3ecf723506a7d322c61fde28708dd24e55c2584 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Fri, 29 Dec 2023 11:14:02 +0100
Subject: [PATCH] #760 - added new settings option
 "orderTransactionNameSuggestionsAlphabetically"

---
 .../budgetmaster/settings/Settings.java            | 14 ++++++++++++++
 .../budgetmaster/settings/SettingsService.java     |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/Settings.java b/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/Settings.java
index 2f7c86097..69f737fb7 100644
--- a/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/Settings.java
+++ b/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/Settings.java
@@ -45,6 +45,8 @@ public class Settings
 
 	private Boolean migrationDeclined;
 
+	private Boolean orderTransactionNameSuggestionsAlphabetically;
+
 	public Settings()
 	{
 		// empty
@@ -73,6 +75,7 @@ public class Settings
 		defaultSettings.setInstalledVersionCode(0);
 		defaultSettings.setWhatsNewShownForCurrentVersion(false);
 		defaultSettings.setMigrationDeclined(false);
+		defaultSettings.setOrderTransactionNameSuggestionsAlphabetically(true);
 
 		return defaultSettings;
 	}
@@ -301,6 +304,16 @@ public class Settings
 		this.migrationDeclined = migrationDeclined;
 	}
 
+	public Boolean getOrderTransactionNameSuggestionsAlphabetically()
+	{
+		return orderTransactionNameSuggestionsAlphabetically;
+	}
+
+	public void setOrderTransactionNameSuggestionsAlphabetically(Boolean orderTransactionNameSuggestionsAlphabetically)
+	{
+		this.orderTransactionNameSuggestionsAlphabetically = orderTransactionNameSuggestionsAlphabetically;
+	}
+
 	@Override
 	public String toString()
 	{
@@ -326,6 +339,7 @@ public class Settings
 				", installedVersionCode=" + installedVersionCode +
 				", whatsNewShownForCurrentVersion=" + whatsNewShownForCurrentVersion +
 				", migrationDeclined=" + migrationDeclined +
+				", orderTransactionNameSuggestionsAlphabetically=" + orderTransactionNameSuggestionsAlphabetically +
 				'}';
 	}
 }
\ No newline at end of file
diff --git a/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/SettingsService.java b/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/SettingsService.java
index e06c91a83..7f68c4f9e 100644
--- a/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/SettingsService.java
+++ b/BudgetMasterServer/src/main/java/de/deadlocker8/budgetmaster/settings/SettingsService.java
@@ -112,6 +112,10 @@ public class SettingsService
 		{
 			settings.setMigrationDeclined(defaultSettings.getMigrationDeclined());
 		}
+		if(settings.getOrderTransactionNameSuggestionsAlphabetically() == null)
+		{
+			settings.setOrderTransactionNameSuggestionsAlphabetically(defaultSettings.getOrderTransactionNameSuggestionsAlphabetically());
+		}
 
 		settingsRepository.save(settings);
 	}
-- 
GitLab