From fa055e3cb31a417081f1110cd5068a06c27a97d2 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Wed, 8 Jun 2022 21:17:06 +0200
Subject: [PATCH] #695 - added warning banner to inform user that database
 should be deleted before import

---
 .../src/main/resources/languages/base_de.properties   |  9 +++++----
 .../src/main/resources/languages/base_en.properties   |  7 ++++---
 .../resources/templates/settings/settingsMacros.ftl   | 11 +++++++++++
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/BudgetMasterServer/src/main/resources/languages/base_de.properties b/BudgetMasterServer/src/main/resources/languages/base_de.properties
index 537812fd6..187c0a4a3 100644
--- a/BudgetMasterServer/src/main/resources/languages/base_de.properties
+++ b/BudgetMasterServer/src/main/resources/languages/base_de.properties
@@ -633,11 +633,12 @@ entity.template=Vorlagen
 entity.chart=Diagramme
 entity.image=Bilder
 
-import.entity.category=Alle Kategorien werden nacheinander importiert.<br>Wird dabei eine Kategorie mit gleichem Namen und gleicher Farbe in der bestehenden BudgetMaster Datenbank gefunden, so werden alle Buchungen und Vorlagen, die zur Kategorie gehören in diese bestehende Kategorie verschoben.<br>Das Icon der Kategorie wird in diesem Fall nicht angepasst.<br>Wenn keine bestehende Kategorie den gleichen Namen und die gleiche Farbe aufweist, so wird eine neue Kategorie angelegt.
-import.entity.account=Jedes zu importierende Konto wird in den weiteren Schritten des Importvorgangs einem Konto in der bestehenden Datenbank zugeordnet.<br>Die zugehörigen Buchungen und Vorlagen werden dann mit dem zugeordneten Konto verknüpft.<br>Falls nicht ausreichend Konten oder kein passendes Konto existiert, können neue Konten während des Importvorgangs angelegt werden.<br>Wenn ein zu importierendes Konto ein Icon gesetzt hat, so wird das Icon im bestehenden Konto ersetzt.
+import.warning.delete.database=Um Konflikte zu vermeiden, solltest du die bestehende Datenbank löschen, bevor du ein Backup importierst.
+import.entity.category=Alle Kategorien werden nacheinander zusammen mit ihren Icons importiert.
+import.entity.account=Alle Konten werden nacheinander zusammen mit ihren Icons importiert.
 import.entity.transaction=Alle Buchungen werden nacheinander importiert und dabei dem jeweils verknüpften Konto zugeordnet.<br>Wiederholende Buchungen werden am Ende des Importvorgangs automatisch bis zum aktuellen Datum aktualisiert.
-import.entity.template_group=Wenn bereits eine Gruppe mit gleichem Namen in der bestehenden BudgetMaster Datenbank existiert, so werden alle Vorlagen, die zur Gruppe gehören in diese bestehende Gruppe verschoben.<br>Wenn keine bestehende Gruppe den gleichen Namen aufweist, so wird eine neue Gruppe angelegt.<br>Der Import von Vorlagengruppen ist optional.<br>Wird der Import deaktiviert, so werden alle Vorlagen, die einer Gruppe zugeordnet sind mit der Standardgruppe verknüpft.
-import.entity.template=Alle Vorlagen werden nacheinander importiert und dabei die verknüpften Konten neu zugeordnet.<br>Der Import von Vorlagen ist optional.<br>Vorlagen verlieren ihre Gruppenzuordnung, wenn der Import von Vorlagengruppen deaktiviert wird. 
+import.entity.template_group=Alle Vorlagengruppen werden nacheinander importiert.<br>Der Import von Vorlagengruppen ist optional.<br>Wird der Import deaktiviert, so werden alle Vorlagen, die einer Gruppe zugeordnet sind mit der Standardgruppe verknüpft.
+import.entity.template=Alle Vorlagen werden nacheinander importiert und dabei die verknüpften Konten neu zugeordnet.<br>Der Import von Vorlagen ist optional.<br>Vorlagen verlieren ihre Gruppenzuordnung, wenn der Import von Vorlagengruppen deaktiviert wird.
 import.entity.image=Icons werden automatisch mit den zugehörigen Konten, Vorlagen und Kategorien importiert.
 import.entity.chart=Es werden nur die benutzerdefinierten Diagramme importiert.<br>Der Import von Diagrammen ist optional.
 
diff --git a/BudgetMasterServer/src/main/resources/languages/base_en.properties b/BudgetMasterServer/src/main/resources/languages/base_en.properties
index cc83dc4fc..3fc91e778 100644
--- a/BudgetMasterServer/src/main/resources/languages/base_en.properties
+++ b/BudgetMasterServer/src/main/resources/languages/base_en.properties
@@ -632,10 +632,11 @@ entity.template=Templates
 entity.chart=Charts
 entity.image=Images
 
-import.entity.category=All categories will be imported one by one.<br>If a category with the same name and color already exists in the BudgetMaster database, all transactions and templates belonging to the category will be moved to this existing category.<br>The category icon will not be updated in this case.<br>If no existing category has the same name and color, a new category will be created.
-import.entity.account=Each account to be imported will be assigned to an existing account in the database during the next steps of the import process.<br>The associated transactions and templates will then be linked to the assigned account.<br>If there are not enough accounts or no matching account, new accounts can be created during the import process.<br>If an account has an icon set, the icon in the existing account will be replaced.
+import.warning.delete.database=To avoid conflicts, you should delete the existing database before importing a backup.
+import.entity.category=All categories will be imported one by one together with their icons.
+import.entity.account=All categories will be imported one by one together with their icons.
 import.entity.transaction=All transactions will be imported one by one, assigning them to the respective linked account.<br>Recurring transactions are automatically updated to the current date at the end of the import process.
-import.entity.template_group=If a group with the same name already exists in the BudgetMaster database, all templates belonging to the group will be moved to this existing group.<br>f no existing group has the same name, a new group will be created.<br>The import of template groups is optional.<br>If the import is deactivated, all templates assigned to a group will be linked to the default group.
+import.entity.template_group=All template groups will be imported one by one.<br>The import of template groups is optional.<br>If the import is deactivated, all templates assigned to a group will be linked to the default group.
 import.entity.template=All templates will be imported one by one, reassigning the linked accounts.<br>The import of templates is optional.<br>Templates lose their group assignment when template group import is disabled.
 import.entity.image=Icons are automatically imported with their associated accounts, templates and categories.
 import.entity.chart=Only user-defined charts will be imported.<br>The import of charts is optional.
diff --git a/BudgetMasterServer/src/main/resources/templates/settings/settingsMacros.ftl b/BudgetMasterServer/src/main/resources/templates/settings/settingsMacros.ftl
index c12cb69c6..1ab390b9e 100644
--- a/BudgetMasterServer/src/main/resources/templates/settings/settingsMacros.ftl
+++ b/BudgetMasterServer/src/main/resources/templates/settings/settingsMacros.ftl
@@ -112,6 +112,17 @@
         <div class="modal-content">
             <h4>${locale.getString("info.title.database.import.dialog")}</h4>
 
+            <div class="row notification-row">
+                <div class="col s12 center-align">
+                    <div class="notification-wrapper">
+                        <div class="notification background-yellow text-black">
+                            <i class="fas fa-exclamation-triangle notification-item"></i>
+                            <span class="notification-item left-align">${locale.getString("import.warning.delete.database")}</span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
             <form id="form-database-import" method="POST" action="<@s.url '/settings/database/upload'/>" enctype="multipart/form-data" accept-charset="UTF-8">
                 <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
                 <div class="file-field input-field">
-- 
GitLab