From 513ee4c7d917ee036a49f9a30a8425fbaae603e1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 3 Jul 2017 18:00:20 +0200 Subject: [PATCH 01/23] New translations firefly.php (Polish) --- resources/lang/pl_PL/firefly.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lang/pl_PL/firefly.php b/resources/lang/pl_PL/firefly.php index d5797fd22d..ae6de09206 100644 --- a/resources/lang/pl_PL/firefly.php +++ b/resources/lang/pl_PL/firefly.php @@ -20,15 +20,15 @@ return [ 'everything' => 'Wszystko', 'customRange' => 'Niestandardowy zakres', 'apply' => 'Zastosuj', - 'select_date' => 'Select date..', + 'select_date' => 'Wybierz datę...', 'cancel' => 'Anuluj', 'from' => 'Z', 'to' => 'Do', 'showEverything' => 'Pokaż wszystko', 'never' => 'Nigdy', 'search_results_for' => 'Wyniki wyszukiwania dla ":query"', - 'advanced_search' => 'Advanced search', - 'advanced_search_intro' => 'There are several modifiers that you can use in your search to narrow down the results. If you use any of these, the search will only return transactions. Please click the -icon for more information.', + 'advanced_search' => 'Wyszukiwanie zaawansowane', + 'advanced_search_intro' => 'Istnieje kilka modyfikatorów, których można użyć w wyszukiwaniu, aby zawęzić wyniki. Jeśli używasz któregoś z nich, wyszukiwanie będzie zwracać tylko transakcje. Kliknij ikonę , aby uzyskać więcej informacji.', 'bounced_error' => 'Wiadomość wysłana na adres :email została odrzucona, więc nie ma dostępu dla Ciebie.', 'deleted_error' => 'Te poświadczenia nie zgadzają się z naszymi danymi.', 'general_blocked_error' => 'Twoje konto zostało zablokowane. Dlatego nie możesz się zalogować.', From 467e708617ac63af68876b1e5e541ad539b331ea Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 19:40:05 +0200 Subject: [PATCH 02/23] New translations form.php (German) --- resources/lang/de_DE/form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/form.php b/resources/lang/de_DE/form.php index b38fbfaf6c..71d3c09168 100644 --- a/resources/lang/de_DE/form.php +++ b/resources/lang/de_DE/form.php @@ -68,7 +68,7 @@ return [ 'exchanged_amount' => 'Ausgetauschter Betrag', 'source_amount' => 'Betrag (Quelle)', 'destination_amount' => 'Betrag (Ziel)', - 'native_amount' => 'Native amount', + 'native_amount' => 'Nativer Betrag', 'revenue_account_source' => 'Ertragskonto (Quelle)', 'source_account_asset' => 'Quellkonto (Bestandskonto)', From 69f6dc09d3b817e066063690f5097479efd81f89 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 19:40:06 +0200 Subject: [PATCH 03/23] New translations demo.php (German) --- resources/lang/de_DE/demo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/de_DE/demo.php b/resources/lang/de_DE/demo.php index 24e22bfa97..557d4290d9 100644 --- a/resources/lang/de_DE/demo.php +++ b/resources/lang/de_DE/demo.php @@ -16,8 +16,8 @@ return [ 'reports-index-start' => 'Firefly III supports four types of reports. Read about them by clicking on the -icon in the top right corner.', 'reports-index-examples' => 'Be sure to check out these examples: a monthly financial overview, a yearly financial overview and a budget overview.', 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', - 'transactions-index' => 'These expenses, deposits and transfers are not particularly imaginative. They have been generated automatically.', - 'piggy-banks-index' => 'As you can see, there are three piggy banks. Use the plus and minus buttons to influence the amount of money in each piggy bank. Click the name of the piggy bank to see the administration for each piggy bank.', + 'transactions-index' => 'Diese Aufwendungen, Einzahlungen und Überweisungen sind nicht besonders einfallsreich. Sie wurden automatisch generiert.', + 'piggy-banks-index' => 'Wie Sie sehen können, gibt es drei Sparschweine. Benutzen die Plus- und Minusknöpfe um die Menge des Geldes in den Sparschweinen zu beeinflussen. Klicken Sie auf den Namen des Sparschweins um Details einzusehen.', 'import-index' => 'Natürlich kann eine CSV-Datei in Firefly III importiert werden ', 'import-configure-security' => 'Aufgrund von Sicherheitsbedenken wurde der Upload mit einer lokalen Datei ersetzt.', 'import-configure-configuration' => 'Die unten stehende Konfiguration für die lokale Datei ist korrekt.', From 0a78b0b1304b60494e1ef26c43c6ecb7d4399427 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 19:50:06 +0200 Subject: [PATCH 04/23] New translations demo.php (German) --- resources/lang/de_DE/demo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/demo.php b/resources/lang/de_DE/demo.php index 557d4290d9..471f716c2c 100644 --- a/resources/lang/de_DE/demo.php +++ b/resources/lang/de_DE/demo.php @@ -15,7 +15,7 @@ return [ 'budgets-index' => 'This page shows you an overview of your budgets. The top bar shows the amount that is available to be budgeted. This can be customized for any period by clicking the amount on the right. The amount you\'ve actually spent is shown in the bar below. Below that are the expenses per budget and what you\'ve budgeted for them.', 'reports-index-start' => 'Firefly III supports four types of reports. Read about them by clicking on the -icon in the top right corner.', 'reports-index-examples' => 'Be sure to check out these examples: a monthly financial overview, a yearly financial overview and a budget overview.', - 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', + 'currencies-index' => 'Firefly III unterstützt mehrere Währungen. Obwohl es den Euro standardmäßig nutzt, ist es möglich US-Dollar oder viele andere Währungen zu verwenden. Wie Sie sehen können, ist eine kleine Auswahl an Währungen aufgenommen worden, aber Sie können Ihre Eigenen hinzufügen. Die Standardwährung zu ändern, wird die Währung der vorhandenen Buchungen jedoch nicht ändern: Firefly III unterstützt die Verwendung mehrerer Währungen zur gleichen Zeit.', 'transactions-index' => 'Diese Aufwendungen, Einzahlungen und Überweisungen sind nicht besonders einfallsreich. Sie wurden automatisch generiert.', 'piggy-banks-index' => 'Wie Sie sehen können, gibt es drei Sparschweine. Benutzen die Plus- und Minusknöpfe um die Menge des Geldes in den Sparschweinen zu beeinflussen. Klicken Sie auf den Namen des Sparschweins um Details einzusehen.', 'import-index' => 'Natürlich kann eine CSV-Datei in Firefly III importiert werden ', From c970a25d58a2e43b734f648e9e16162a3e5efad6 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 19:50:09 +0200 Subject: [PATCH 05/23] New translations firefly.php (German) --- resources/lang/de_DE/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index 498344f65a..a3dcf6d674 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -20,7 +20,7 @@ return [ 'everything' => 'Alle', 'customRange' => 'Individueller Bereich', 'apply' => 'Übernehmen', - 'select_date' => 'Select date..', + 'select_date' => 'Wähle ein Datum..', 'cancel' => 'Abbrechen', 'from' => 'Von', 'to' => 'Bis', From 7a1528d1e45d1e1d94efe7ca1db19db22398b73c Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 19:50:10 +0200 Subject: [PATCH 06/23] New translations csv.php (German) --- resources/lang/de_DE/csv.php | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/resources/lang/de_DE/csv.php b/resources/lang/de_DE/csv.php index 632d14db44..0336c50ade 100644 --- a/resources/lang/de_DE/csv.php +++ b/resources/lang/de_DE/csv.php @@ -15,33 +15,33 @@ return [ // initial config 'initial_title' => 'Import setup (1/3) - Basic CSV import setup', - 'initial_text' => 'To be able to import your file correctly, please validate the options below.', - 'initial_box' => 'Basic CSV import setup', - 'initial_header_help' => 'Check this box if the first row of your CSV file are the column titles.', - 'initial_date_help' => 'Date time format in your CSV. Follow the format like this page indicates. The default value will parse dates that look like this: :dateExample.', - 'initial_delimiter_help' => 'Choose the field delimiter that is used in your input file. If not sure, comma is the safest option.', - 'initial_import_account_help' => 'If your CSV file does NOT contain information about your asset account(s), use this dropdown to select to which account the transactions in the CSV belong to.', - 'initial_submit' => 'Continue with step 2/3', + 'initial_text' => 'Um Ihre Datei korrekt importieren zu können, überprüfen Sie die folgenden Optionen.', + 'initial_box' => 'Standard CSV Importeinstellungen', + 'initial_header_help' => 'Hier auswählen, wenn die ersten Zeilen der CSV-Datei die Spaltenüberschriften sind.', + 'initial_date_help' => 'Datumsformat in ihrer CSV-Datei. Geben Sie das Format so an, wie es diese Seite zeigt. Die Standardeinstellung ergibt Daten die so aussehen: :dateExample.', + 'initial_delimiter_help' => 'Wählen Sie das Trennzeichen, welches in ihrer Datei genutzt wird. Wenn Sie nicht sicher sind ist Komma die sicherste Option.', + 'initial_import_account_help' => 'Wenn ihre CSV-Datei KEINE Informationen über ihre Girokonten enthält nutzen Sie bitte diese Dropdown-Liste um anzugeben, zu welchem Girokonto die Transaktionen in der CSV-Datei gehören.', + 'initial_submit' => 'Fortfahren mit Schritt 2/3', // roles config 'roles_title' => 'Import setup (2/3) - Define each column\'s role', 'roles_text' => 'Each column in your CSV file contains certain data. Please indicate what kind of data the importer should expect. The option to "map" data means that you will link each entry found in the column to a value in your database. An often mapped column is the column that contains the IBAN of the opposing account. That can be easily matched to IBAN\'s present in your database already.', - 'roles_table' => 'Table', - 'roles_column_name' => 'Name of column', - 'roles_column_example' => 'Column example data', - 'roles_column_role' => 'Column data meaning', - 'roles_do_map_value' => 'Map these values', - 'roles_column' => 'Column', - 'roles_no_example_data' => 'No example data available', - 'roles_submit' => 'Continue with step 3/3', + 'roles_table' => 'Tabelle', + 'roles_column_name' => 'Name der Spalte', + 'roles_column_example' => 'Beispieldaten', + 'roles_column_role' => 'Bedeutung der Spalte', + 'roles_do_map_value' => 'Ordnen Sie diese Werte zu', + 'roles_column' => 'Spalte', + 'roles_no_example_data' => 'Keine Beispieldaten vorhanden', + 'roles_submit' => 'Fortfahren mit Schritt 3/3', // map data 'map_title' => 'Import setup (3/3) - Connect import data to Firefly III data', 'map_text' => 'In den folgenden Tabellen zeigt der linke Wert Informationen, die sich in Ihrer hochgeladenen CSV-Datei befinden. Es ist Ihre Aufgabe, diesen Wert, wenn möglich, einem bereits in der Datenbank vorhandem zuzuordnen. Firefly wird sich an diese Zuordnung halten. Wenn kein Wert für die Zuordnung vorhanden ist oder Sie den bestimmten Wert nicht abbilden möchten, wählen Sie nichts aus.', - 'map_field_value' => 'Field value', - 'map_field_mapped_to' => 'Mapped to', - 'map_do_not_map' => '(do not map)', - 'map_submit' => 'Start the import', + 'map_field_value' => 'Feldwert', + 'map_field_mapped_to' => 'Zugeordnet zu', + 'map_do_not_map' => '(keine Zuordnung)', + 'map_submit' => 'Starte den Import', // map things. 'column__ignore' => '(diese Spalte ignorieren)', From 44a1d6b3d4e4a8f827c49125c697470e1365aea8 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 20:00:06 +0200 Subject: [PATCH 07/23] New translations csv.php (German) --- resources/lang/de_DE/csv.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lang/de_DE/csv.php b/resources/lang/de_DE/csv.php index 0336c50ade..21c776c6ab 100644 --- a/resources/lang/de_DE/csv.php +++ b/resources/lang/de_DE/csv.php @@ -14,7 +14,7 @@ declare(strict_types=1); return [ // initial config - 'initial_title' => 'Import setup (1/3) - Basic CSV import setup', + 'initial_title' => 'Import Einrichten (1/3) - Grundlegende Einstellungen', 'initial_text' => 'Um Ihre Datei korrekt importieren zu können, überprüfen Sie die folgenden Optionen.', 'initial_box' => 'Standard CSV Importeinstellungen', 'initial_header_help' => 'Hier auswählen, wenn die ersten Zeilen der CSV-Datei die Spaltenüberschriften sind.', @@ -24,8 +24,8 @@ return [ 'initial_submit' => 'Fortfahren mit Schritt 2/3', // roles config - 'roles_title' => 'Import setup (2/3) - Define each column\'s role', - 'roles_text' => 'Each column in your CSV file contains certain data. Please indicate what kind of data the importer should expect. The option to "map" data means that you will link each entry found in the column to a value in your database. An often mapped column is the column that contains the IBAN of the opposing account. That can be easily matched to IBAN\'s present in your database already.', + 'roles_title' => 'Import Einrichten (2/3) - Jeder Spalte eine Rolle zuordnen', + 'roles_text' => 'Jede Spalte in Ihrer CSV-Datei enthält bestimmte Daten. Bitte geben Sie an, welche Art von Daten enthalten sind. Die Option "Daten zuordnen" bedeutet, dass jeder Eintrag in der Spalte mit einem Wert aus Ihrer der Datenbank ersetzt wird. Eine oft zugeordnete Spalte ist die Spalte, welche die IBAN des fremden Kontos enthält. Diese können leicht mit bereits angelegten IBANs in Ihrer Datenbank verglichen werden.', 'roles_table' => 'Tabelle', 'roles_column_name' => 'Name der Spalte', 'roles_column_example' => 'Beispieldaten', From b3801f65cf69176594652ac7be9c5ca1de24abd6 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 20:10:06 +0200 Subject: [PATCH 08/23] New translations demo.php (German) --- resources/lang/de_DE/demo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/de_DE/demo.php b/resources/lang/de_DE/demo.php index 471f716c2c..5c22bac289 100644 --- a/resources/lang/de_DE/demo.php +++ b/resources/lang/de_DE/demo.php @@ -12,8 +12,8 @@ return [ 'see_help_icon' => 'Trotzdem kann der -Icon in der oberen rechten Ecke mehr erzählen.', 'index' => 'Wilkommen bei Firefly III! Auf dieser Seite erhalten Sie einen schnellen Überblick über Ihre Finanzen. Für weitere Informationen, besuchen Sie die Accounts → Girokonten und natürlich Budgets und Berichte Seiten. Oder sehen Sie sich einfach um und schauen wo Sie landen.', 'accounts-index' => 'Asset accounts are your personal bank accounts. Expense accounts are the accounts you spend money at, such as stores and friends. Revenue accounts are accounts you receive money from, such as your job, the government or other sources of income. On this page you can edit or remove them.', - 'budgets-index' => 'This page shows you an overview of your budgets. The top bar shows the amount that is available to be budgeted. This can be customized for any period by clicking the amount on the right. The amount you\'ve actually spent is shown in the bar below. Below that are the expenses per budget and what you\'ve budgeted for them.', - 'reports-index-start' => 'Firefly III supports four types of reports. Read about them by clicking on the -icon in the top right corner.', + 'budgets-index' => 'Diese Seite zeigt Ihnen einen Überblick über Ihre Budgets. Die obere Leiste zeigt den Betrag, der zur Verfügung steht. Dieser kann für einen Zeitraum angepasst werden, indem Sie auf den Betrag auf der rechten Seite klicken. Wieviel bisher ausgegeb wurde wird darunter angezeigt. Darunter sind die Aufwendungen pro Haushalt und wieviel dafür veranschlagt ist.', + 'reports-index-start' => 'Firefly III unterstützt vier Berichtarten. Mehr Informationen hirzu können durch ein Klick auf das Symbol in der oberen rechten Ecke aufgerufen werden.', 'reports-index-examples' => 'Be sure to check out these examples: a monthly financial overview, a yearly financial overview and a budget overview.', 'currencies-index' => 'Firefly III unterstützt mehrere Währungen. Obwohl es den Euro standardmäßig nutzt, ist es möglich US-Dollar oder viele andere Währungen zu verwenden. Wie Sie sehen können, ist eine kleine Auswahl an Währungen aufgenommen worden, aber Sie können Ihre Eigenen hinzufügen. Die Standardwährung zu ändern, wird die Währung der vorhandenen Buchungen jedoch nicht ändern: Firefly III unterstützt die Verwendung mehrerer Währungen zur gleichen Zeit.', 'transactions-index' => 'Diese Aufwendungen, Einzahlungen und Überweisungen sind nicht besonders einfallsreich. Sie wurden automatisch generiert.', From 767267c89e60b3dbfe410a2b8d0103e5306d157b Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 20:20:16 +0200 Subject: [PATCH 09/23] New translations demo.php (German) --- resources/lang/de_DE/demo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/de_DE/demo.php b/resources/lang/de_DE/demo.php index 5c22bac289..40278d30ec 100644 --- a/resources/lang/de_DE/demo.php +++ b/resources/lang/de_DE/demo.php @@ -11,10 +11,10 @@ return [ 'no_demo_text' => 'Leider gibt es keine zusätzlichen Demoerklärungen für diese Seite.', 'see_help_icon' => 'Trotzdem kann der -Icon in der oberen rechten Ecke mehr erzählen.', 'index' => 'Wilkommen bei Firefly III! Auf dieser Seite erhalten Sie einen schnellen Überblick über Ihre Finanzen. Für weitere Informationen, besuchen Sie die Accounts → Girokonten und natürlich Budgets und Berichte Seiten. Oder sehen Sie sich einfach um und schauen wo Sie landen.', - 'accounts-index' => 'Asset accounts are your personal bank accounts. Expense accounts are the accounts you spend money at, such as stores and friends. Revenue accounts are accounts you receive money from, such as your job, the government or other sources of income. On this page you can edit or remove them.', + 'accounts-index' => 'Vermögenskonten sind Ihre persönlichen Bank-Konten. Aufwandskonten sind Konten, denen Sie Geld zahlen, z. B. Läden und Freunde. Einnahmekonten sind Konten von denen Sie Geld erhalten, z. B. Ihr Arbeitgeber und andere Einkommensquellen. Auf dieser Seite können Sie diese bearbeiten oder entfernen.', 'budgets-index' => 'Diese Seite zeigt Ihnen einen Überblick über Ihre Budgets. Die obere Leiste zeigt den Betrag, der zur Verfügung steht. Dieser kann für einen Zeitraum angepasst werden, indem Sie auf den Betrag auf der rechten Seite klicken. Wieviel bisher ausgegeb wurde wird darunter angezeigt. Darunter sind die Aufwendungen pro Haushalt und wieviel dafür veranschlagt ist.', 'reports-index-start' => 'Firefly III unterstützt vier Berichtarten. Mehr Informationen hirzu können durch ein Klick auf das Symbol in der oberen rechten Ecke aufgerufen werden.', - 'reports-index-examples' => 'Be sure to check out these examples: a monthly financial overview, a yearly financial overview and a budget overview.', + 'reports-index-examples' => 'Achten Sie darauf, diese Beispiele anzusehen: eine monatliche Finanzübersicht, eine jährliche Finanzübersicht und eine Haushaltsübersicht.', 'currencies-index' => 'Firefly III unterstützt mehrere Währungen. Obwohl es den Euro standardmäßig nutzt, ist es möglich US-Dollar oder viele andere Währungen zu verwenden. Wie Sie sehen können, ist eine kleine Auswahl an Währungen aufgenommen worden, aber Sie können Ihre Eigenen hinzufügen. Die Standardwährung zu ändern, wird die Währung der vorhandenen Buchungen jedoch nicht ändern: Firefly III unterstützt die Verwendung mehrerer Währungen zur gleichen Zeit.', 'transactions-index' => 'Diese Aufwendungen, Einzahlungen und Überweisungen sind nicht besonders einfallsreich. Sie wurden automatisch generiert.', 'piggy-banks-index' => 'Wie Sie sehen können, gibt es drei Sparschweine. Benutzen die Plus- und Minusknöpfe um die Menge des Geldes in den Sparschweinen zu beeinflussen. Klicken Sie auf den Namen des Sparschweins um Details einzusehen.', From a29a78e199a6ca212848068d126652b0031ff8f9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 20:40:05 +0200 Subject: [PATCH 10/23] New translations csv.php (German) --- resources/lang/de_DE/csv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/csv.php b/resources/lang/de_DE/csv.php index 21c776c6ab..fdea249937 100644 --- a/resources/lang/de_DE/csv.php +++ b/resources/lang/de_DE/csv.php @@ -36,7 +36,7 @@ return [ 'roles_submit' => 'Fortfahren mit Schritt 3/3', // map data - 'map_title' => 'Import setup (3/3) - Connect import data to Firefly III data', + 'map_title' => 'Import Einrichten (3/3) - Import mit bereits vorhandenen Daten verknüpfen', 'map_text' => 'In den folgenden Tabellen zeigt der linke Wert Informationen, die sich in Ihrer hochgeladenen CSV-Datei befinden. Es ist Ihre Aufgabe, diesen Wert, wenn möglich, einem bereits in der Datenbank vorhandem zuzuordnen. Firefly wird sich an diese Zuordnung halten. Wenn kein Wert für die Zuordnung vorhanden ist oder Sie den bestimmten Wert nicht abbilden möchten, wählen Sie nichts aus.', 'map_field_value' => 'Feldwert', 'map_field_mapped_to' => 'Zugeordnet zu', From 98712f288ceafea837c5e839b9894cb08cb800e8 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 20:40:08 +0200 Subject: [PATCH 11/23] New translations firefly.php (German) --- resources/lang/de_DE/firefly.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index a3dcf6d674..755fd7117d 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -110,11 +110,11 @@ return [ 'current_period' => 'Aktuelle Periode', 'show_the_current_period_and_overview' => 'Zeigen Sie die aktuelle Periode und die Übersicht', 'pref_languages_locale' => 'Damit eine andere Sprache als Englisch richtig funktioniert muss Ihr Betriebssystem mit den korrekten Gebietsschema-Informationen ausgestattet werden. Wenn diese nicht vorhanden sind, können die Währungsdaten, Terminen und Mengen falsch formatiert.', - 'budget_in_period' => 'All transactions for budget ":name" between :start and :end', - 'chart_budget_in_period' => 'Chart for all transactions for budget ":name" between :start and :end', - 'chart_account_in_period' => 'Chart for all transactions for account ":name" between :start and :end', - 'chart_category_in_period' => 'Chart for all transactions for category ":name" between :start and :end', - 'chart_category_all' => 'Chart for all transactions for category ":name"', + 'budget_in_period' => 'Alle Transaktionen für Haushalt :name zwischen :start und :end', + 'chart_budget_in_period' => 'Diagramm für alle Transaktionen des Haushalts ":name" zwischen :start und :end', + 'chart_account_in_period' => 'Diagramm für alle Transaktionen des Kontos ":name" zwischen :start und :end', + 'chart_category_in_period' => 'Diagramm für alle Transaktionen der Kategorie ":name" zwischen :start und :end', + 'chart_category_all' => 'Diagramm für alle Transaktionen der Kategorie ":name"', 'budget_in_period_breadcrumb' => 'Zwischen :start und :end', 'clone_withdrawal' => 'Diese Ausgabe klonen', 'clone_deposit' => 'Diese Einnahme klonen', @@ -129,9 +129,9 @@ return [ 'all_journals_without_category' => 'Alle Transaktionen ohne Kategorie', 'journals_without_category' => 'Transaktionen ohne Kategorie', 'all_journals_for_account' => 'Alle Transaktionen für Konto :name', - 'chart_all_journals_for_account' => 'Chart of all transactions for account :name', + 'chart_all_journals_for_account' => 'Diagramm für alle Transaktionen des Kontos :name', 'journals_in_period_for_account' => 'Alle Transaktionen für Konto :name zwischen :start und :end', - 'transferred' => 'Transferred', + 'transferred' => 'Überwiesen', 'all_withdrawal' => 'Alle Ausgaben', 'all_transactions' => 'Alle Transaktionen', 'title_withdrawal_between' => 'Alle Ausgabe zwischen :start und :end', @@ -143,14 +143,14 @@ return [ 'all_journals_for_tag' => 'Alle Transaktionen für Tag ":tag"', 'title_transfer_between' => 'Alle Transfers zwischen :start und :end', 'all_journals_for_category' => 'Alle Transaktionen für Kategorie :name', - 'all_journals_for_budget' => 'All transactions for budget :name', - 'chart_all_journals_for_budget' => 'Chart of all transactions for budget :name', + 'all_journals_for_budget' => 'Alle Transaktionen des Haushalts :name', + 'chart_all_journals_for_budget' => 'Diagramm für alle Transaktionen des Haushalts :name', 'journals_in_period_for_category' => 'Alle Transaktionen für Kategorie :name zwischen :start und :end', 'journals_in_period_for_tag' => 'Alle Transaktionen für Tag :tag zwischen :start und :end', 'not_available_demo_user' => 'Die Funktionen, auf welche sie zugreifen wollen, steht Demo-Benutzer nicht zur Verfügung.', 'exchange_rate_instructions' => 'Das Girokonto "@name" akzeptiert nur Transaktionen in @native_currency. Wenn Sie stattdessen @foreign_currency verwenden wollen, sollten Sie sicherstellen, dass der Betrag auch in @native_currency angengeben ist:', 'transfer_exchange_rate_instructions' => 'Das Quellkonto "@source_name" akzeptiert nur Transaktionen in @source_currency. Das Zielkonto "@dest_name" akzeptiert nur Transaktionen in @dest_currency. Sie müssen den Betrag in beiden Währungen korrenkt angeben.', - 'transaction_data' => 'Transaction data', + 'transaction_data' => 'Transaktionsdaten', // repeat frequencies: 'repeat_freq_yearly' => 'Jährlich', @@ -598,7 +598,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'select_more_than_one_tag' => 'Bitte wählen Sie mehr als einen Tag aus', 'from_to' => 'Von :start bis :end', 'from_to_breadcrumb' => 'von :start bis :end', - 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'account_default_currency' => 'Wenn Sie eine andere Währung auswählen, werden neue Transaktionen von diesem Konto standardmäßig diese Währung ausgewählt haben.', // categories: 'new_category' => 'Neue Kategorie', From 13ad40402a4992418abf76ea608d7c8d37036f98 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 6 Jul 2017 11:30:11 +0200 Subject: [PATCH 12/23] New translations firefly.php (German) --- resources/lang/de_DE/firefly.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index 755fd7117d..cf20db28d4 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -480,7 +480,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'create_new_withdrawal' => 'Erstelle eine neue Ausgabe', 'create_new_deposit' => 'Erstelle ein neues Einkommen', 'create_new_transfer' => 'Eine neue Überweisung erstellen', - 'create_new_asset' => 'Erstellen Sie ein neuen Girokonto', + 'create_new_asset' => 'Neues Girokonto erstellen', 'create_new_expense' => 'Neuen Debitor (Ausgabe) erstellen', 'create_new_revenue' => 'Neuen Schuldner erstellen', 'create_new_piggy_bank' => 'Ein neues Sparschwein erstellen', @@ -577,7 +577,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'update_asset_account' => 'Girokonto aktualisieren', 'update_expense_account' => 'Debitor (Ausgabe) bearbeiten', 'update_revenue_account' => 'Schuldner bearbeiten', - 'make_new_asset_account' => 'Erstellen Sie ein neuen Girokonto', + 'make_new_asset_account' => 'Neues Girokonto erstellen', 'make_new_expense_account' => 'Neuen Debitor (Ausgabe) erstellen', 'make_new_revenue_account' => 'Neuen Schuldner erstellen', 'asset_accounts' => 'Girokonten', From dd508dbc49ad885a4901faacac8c9e73d949f8e5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 7 Jul 2017 08:04:21 +0200 Subject: [PATCH 13/23] This should fix #693. --- app/Import/Object/ImportCurrency.php | 2 +- app/Import/Object/ImportJournal.php | 34 +++++++++++------- app/Import/Routine/ImportRoutine.php | 1 + app/Import/Storage/ImportStorage.php | 9 ++++- .../Import/Configuration/Csv/Roles.php | 36 ++++++++++--------- 5 files changed, 52 insertions(+), 30 deletions(-) diff --git a/app/Import/Object/ImportCurrency.php b/app/Import/Object/ImportCurrency.php index 8427f3ce5f..6791caba62 100644 --- a/app/Import/Object/ImportCurrency.php +++ b/app/Import/Object/ImportCurrency.php @@ -77,7 +77,7 @@ class ImportCurrency 'decimal_places' => 2, ]; if (is_null($data['code'])) { - Log::info('Need at least a code to create currency, return nothing.'); + Log::debug('Need at least a code to create currency, return nothing.'); return new TransactionCurrency(); } diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index a86cdffe5d..ce3af83147 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -19,6 +19,8 @@ use FireflyIII\Import\Converter\ConverterInterface; use FireflyIII\Models\TransactionJournal; use FireflyIII\User; use Illuminate\Support\Collection; +use InvalidArgumentException; +use Log; use Steam; /** @@ -30,22 +32,26 @@ class ImportJournal { /** @var ImportAccount */ public $asset; + /** @var ImportBill */ + public $bill; /** @var ImportBudget */ public $budget; + /** @var ImportCategory */ + public $category; /** @var string */ public $description = ''; /** @var Collection */ public $errors; /** @var string */ public $hash; + /** @var array */ + public $metaDates = []; + /** @var string */ + public $notes = ''; /** @var ImportAccount */ public $opposing; /** @var string */ private $amount = '0'; - /** @var ImportBill */ - public $bill; - /** @var ImportCategory */ - public $category; /** @var ImportCurrency */ private $currency; /** @var string */ @@ -54,16 +60,12 @@ class ImportJournal private $externalId = ''; /** @var array */ private $modifiers = []; - /** @var array */ - private $tags = []; - /** @var string */ - public $notes = ''; + /** @var array */ + private $tags = []; /** @var string */ private $transactionType = ''; /** @var User */ private $user; - /** @var array */ - public $metaDates = []; /** * ImportEntry constructor. @@ -133,7 +135,15 @@ class ImportJournal */ public function getDate(string $format): Carbon { - return Carbon::createFromFormat($format, $this->date); + $date = new Carbon; + try { + $date = Carbon::createFromFormat($format, $this->date); + } catch (InvalidArgumentException $e) { + // don't care, just log. + Log::error(sprintf('Import journal cannot parse date "%s" from value "%s" so will return current date instead.', $format, $this->date)); + } + + return $date; } /** @@ -223,7 +233,7 @@ class ImportJournal case 'sepa-ct-op': case 'sepa-ct-id': case 'sepa-db': - $this->notes .= ' '.$array['value']; + $this->notes .= ' ' . $array['value']; $this->notes = trim($this->notes); break; case 'external-id': diff --git a/app/Import/Routine/ImportRoutine.php b/app/Import/Routine/ImportRoutine.php index 62da476f86..6177f7a464 100644 --- a/app/Import/Routine/ImportRoutine.php +++ b/app/Import/Routine/ImportRoutine.php @@ -86,6 +86,7 @@ class ImportRoutine Log::info(sprintf('Done with import job %s', $this->job->key)); + return true; } diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.php index d0eea39f5d..23d1ed9ad4 100644 --- a/app/Import/Storage/ImportStorage.php +++ b/app/Import/Storage/ImportStorage.php @@ -29,7 +29,6 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Rules\Processor; use Illuminate\Support\Collection; -use Illuminate\Support\MessageBag; use Log; use Steam; @@ -107,6 +106,7 @@ class ImportStorage $this->storeImportJournal($index, $object); } catch (FireflyException $e) { $this->errors->push($e->getMessage()); + Log::error(sprintf('Cannot import row #%d because: %s', $index, $e->getMessage())); } } @@ -351,6 +351,13 @@ class ImportStorage $this->journals->push($journal); + Log::info( + sprintf( + 'Imported new journal #%d with description "%s" and amount %s %s.', $journal->id, $journal->description, $journal->transactionCurrency->code, + $amount + ) + ); + return true; } diff --git a/app/Support/Import/Configuration/Csv/Roles.php b/app/Support/Import/Configuration/Csv/Roles.php index adb0707beb..ced9b88aa0 100644 --- a/app/Support/Import/Configuration/Csv/Roles.php +++ b/app/Support/Import/Configuration/Csv/Roles.php @@ -68,6 +68,18 @@ class Roles implements ConfigurationInterface return $this->data; } + /** + * @param ImportJob $job + * + * @return ConfigurationInterface + */ + public function setJob(ImportJob $job): ConfigurationInterface + { + $this->job = $job; + + return $this; + } + /** * Store the result. * @@ -217,16 +229,20 @@ class Roles implements ConfigurationInterface */ private function setRolesComplete(): bool { - $config = $this->job->configuration; - $count = $config['column-count']; - $assigned = 0; + $config = $this->job->configuration; + $count = $config['column-count']; + $assigned = 0; + $hasAmount = false; for ($i = 0; $i < $count; $i++) { $role = $config['column-roles'][$i] ?? '_ignore'; if ($role !== '_ignore') { $assigned++; } + if ($role === 'amount') { + $hasAmount = true; + } } - if ($assigned > 0) { + if ($assigned > 0 && $hasAmount) { $config['column-roles-complete'] = true; $this->job->configuration = $config; $this->job->save(); @@ -248,16 +264,4 @@ class Roles implements ConfigurationInterface return true; } - - /** - * @param ImportJob $job - * - * @return ConfigurationInterface - */ - public function setJob(ImportJob $job): ConfigurationInterface - { - $this->job = $job; - - return $this; - } } \ No newline at end of file From 71a41bc00dfbe6d32993936f94ea11439224f8f7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 7 Jul 2017 08:09:42 +0200 Subject: [PATCH 14/23] Add newlines [skip ci] --- app/Console/Commands/Import.php | 2 - app/Helpers/Filter/AmountFilter.php | 2 +- app/Helpers/Filter/EmptyFilter.php | 2 +- app/Helpers/Filter/FilterInterface.php | 2 +- app/Helpers/Filter/InternalTransferFilter.php | 2 +- app/Helpers/Filter/NegativeAmountFilter.php | 2 +- app/Helpers/Filter/OpposingAccountFilter.php | 2 +- app/Helpers/Filter/PositiveAmountFilter.php | 2 +- app/Helpers/Filter/TransferFilter.php | 2 +- app/Helpers/Report/PopupReport.php | 2 +- app/Helpers/Report/PopupReportInterface.php | 2 +- app/Http/Controllers/AttachmentController.php | 1 - .../Controllers/Chart/TagReportController.php | 2 +- app/Http/Controllers/ImportController.php | 2 +- .../Controllers/Json/ExchangeController.php | 2 +- app/Http/Controllers/PiggyBankController.php | 4 +- .../Controllers/TransactionController.php | 2 +- .../Configurator/ConfiguratorInterface.php | 16 ++++---- app/Import/Configurator/CsvConfigurator.php | 2 +- app/Import/FileProcessor/CsvProcessor.php | 2 +- .../FileProcessor/FileProcessorInterface.php | 2 +- app/Import/Object/ImportAccount.php | 2 +- app/Import/Object/ImportBill.php | 2 +- app/Import/Object/ImportBudget.php | 2 +- app/Import/Object/ImportCategory.php | 39 ++++++++++--------- app/Import/Object/ImportCurrency.php | 4 +- app/Import/Object/ImportJournal.php | 2 +- app/Import/Object/ImportTransaction.php | 2 +- app/Import/Routine/ImportRoutine.php | 19 +++++---- app/Import/Storage/ImportStorage.php | 2 +- app/Mail/RegisteredUser.php | 4 +- app/Models/CurrencyExchangeRate.php | 2 +- app/Models/ImportJob.php | 2 +- app/Models/Tag.php | 3 +- .../Account/FindAccountsTrait.php | 2 +- .../Journal/CreateJournalsTrait.php | 2 +- .../Journal/SupportJournalsTrait.php | 2 +- .../Journal/UpdateJournalsTrait.php | 2 +- app/Rules/Triggers/HasAttachment.php | 2 +- .../Currency/ExchangeRateInterface.php | 2 +- app/Services/Currency/FixerIO.php | 2 +- app/Support/Binder/CurrencyCode.php | 2 +- .../Configuration/ConfigurationInterface.php | 2 +- .../Import/Configuration/Csv/Initial.php | 2 +- app/Support/Import/Configuration/Csv/Map.php | 2 +- .../Import/Configuration/Csv/Roles.php | 2 +- app/Support/Search/Modifier.php | 2 +- app/Support/Search/Search.php | 2 +- app/Support/Steam.php | 2 +- app/Support/Twig/AmountFormat.php | 2 +- database/factories/ModelFactory.php | 2 +- resources/views/bills/index.twig | 2 +- resources/views/partials/empty.twig | 2 +- .../Auth/ForgotPasswordControllerTest.php | 2 +- .../Chart/BudgetReportControllerTest.php | 2 +- .../Handlers/Events/UserEventHandlerTest.php | 2 +- tests/Unit/Helpers/AttachmentHelperTest.php | 2 +- tests/Unit/Helpers/MetaPieChartTest.php | 2 +- 58 files changed, 94 insertions(+), 96 deletions(-) diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.php index b8cecf4202..f37203cc41 100644 --- a/app/Console/Commands/Import.php +++ b/app/Console/Commands/Import.php @@ -16,9 +16,7 @@ namespace FireflyIII\Console\Commands; use FireflyIII\Import\Logging\CommandHandler; use FireflyIII\Import\Routine\ImportRoutine; use FireflyIII\Models\ImportJob; -use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; -use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; use Log; diff --git a/app/Helpers/Filter/AmountFilter.php b/app/Helpers/Filter/AmountFilter.php index eb4ab55662..7fdd9eb966 100644 --- a/app/Helpers/Filter/AmountFilter.php +++ b/app/Helpers/Filter/AmountFilter.php @@ -53,4 +53,4 @@ class AmountFilter implements FilterInterface } ); } -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/EmptyFilter.php b/app/Helpers/Filter/EmptyFilter.php index 23a4172e88..5fa9f64521 100644 --- a/app/Helpers/Filter/EmptyFilter.php +++ b/app/Helpers/Filter/EmptyFilter.php @@ -31,4 +31,4 @@ class EmptyFilter implements FilterInterface { return $set; } -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/FilterInterface.php b/app/Helpers/Filter/FilterInterface.php index d2dcb9eda4..f189eb10ff 100644 --- a/app/Helpers/Filter/FilterInterface.php +++ b/app/Helpers/Filter/FilterInterface.php @@ -23,4 +23,4 @@ interface FilterInterface */ public function filter(Collection $set): Collection; -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/InternalTransferFilter.php b/app/Helpers/Filter/InternalTransferFilter.php index 24b4b9727c..7ab06618aa 100644 --- a/app/Helpers/Filter/InternalTransferFilter.php +++ b/app/Helpers/Filter/InternalTransferFilter.php @@ -70,4 +70,4 @@ class InternalTransferFilter implements FilterInterface } -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/NegativeAmountFilter.php b/app/Helpers/Filter/NegativeAmountFilter.php index f2ef34bcc4..e1e494127e 100644 --- a/app/Helpers/Filter/NegativeAmountFilter.php +++ b/app/Helpers/Filter/NegativeAmountFilter.php @@ -44,4 +44,4 @@ class NegativeAmountFilter implements FilterInterface } ); } -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/OpposingAccountFilter.php b/app/Helpers/Filter/OpposingAccountFilter.php index 69a1567943..663f9a35ce 100644 --- a/app/Helpers/Filter/OpposingAccountFilter.php +++ b/app/Helpers/Filter/OpposingAccountFilter.php @@ -60,4 +60,4 @@ class OpposingAccountFilter implements FilterInterface } ); } -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/PositiveAmountFilter.php b/app/Helpers/Filter/PositiveAmountFilter.php index ddb71841da..e3d4065942 100644 --- a/app/Helpers/Filter/PositiveAmountFilter.php +++ b/app/Helpers/Filter/PositiveAmountFilter.php @@ -47,4 +47,4 @@ class PositiveAmountFilter implements FilterInterface } ); } -} \ No newline at end of file +} diff --git a/app/Helpers/Filter/TransferFilter.php b/app/Helpers/Filter/TransferFilter.php index d33d5e41ed..1aa0b5bd43 100644 --- a/app/Helpers/Filter/TransferFilter.php +++ b/app/Helpers/Filter/TransferFilter.php @@ -55,4 +55,4 @@ class TransferFilter implements FilterInterface return $new; } -} \ No newline at end of file +} diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index 265c930e6c..7823eb95b8 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -196,4 +196,4 @@ class PopupReport implements PopupReportInterface return $journals; } -} \ No newline at end of file +} diff --git a/app/Helpers/Report/PopupReportInterface.php b/app/Helpers/Report/PopupReportInterface.php index 79ca4be007..388c1a1d91 100644 --- a/app/Helpers/Report/PopupReportInterface.php +++ b/app/Helpers/Report/PopupReportInterface.php @@ -80,4 +80,4 @@ interface PopupReportInterface * @return Collection */ public function byIncome(Account $account, array $attributes): Collection; -} \ No newline at end of file +} diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 8e1bba3a03..3f06091f35 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -105,7 +105,6 @@ class AttachmentController extends Controller $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\')); - /** @var LaravelResponse $response */ $response = response($content, 200); $response diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php index 2aca50bc77..5c3ee98ed1 100644 --- a/app/Http/Controllers/Chart/TagReportController.php +++ b/app/Http/Controllers/Chart/TagReportController.php @@ -364,4 +364,4 @@ class TagReportController extends Controller return $grouped; } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.php index 310b418789..c4b0bd1342 100644 --- a/app/Http/Controllers/ImportController.php +++ b/app/Http/Controllers/ImportController.php @@ -246,7 +246,7 @@ class ImportController extends Controller /** @var ImportRoutine $routine */ $routine = app(ImportRoutine::class); $routine->setJob($job); - $result = $routine->run(); + $result = $routine->run(); if ($result) { return Response::json(['run' => 'ok']); } diff --git a/app/Http/Controllers/Json/ExchangeController.php b/app/Http/Controllers/Json/ExchangeController.php index 79f88acf2c..b1e3b5a60d 100644 --- a/app/Http/Controllers/Json/ExchangeController.php +++ b/app/Http/Controllers/Json/ExchangeController.php @@ -62,4 +62,4 @@ class ExchangeController extends Controller return Response::json($return); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index f4dc60cee9..e186f04d87 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -329,8 +329,8 @@ class PiggyBankController extends Controller Session::flash( 'error', strval( - trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)]) - ) + trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)]) + ) ); return redirect(route('piggy-banks.index')); diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 1636ded76c..6d088942b4 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -86,7 +86,7 @@ class TransactionController extends Controller $first = $repository->first(); $start = $first->date ?? new Carbon; $end = new Carbon; - $path = '/transactions/'.$what.'/all/'; + $path = '/transactions/' . $what . '/all/'; } // prep for "specific date" view. diff --git a/app/Import/Configurator/ConfiguratorInterface.php b/app/Import/Configurator/ConfiguratorInterface.php index 4969109b01..1f120d30d3 100644 --- a/app/Import/Configurator/ConfiguratorInterface.php +++ b/app/Import/Configurator/ConfiguratorInterface.php @@ -34,13 +34,6 @@ interface ConfiguratorInterface */ public function configureJob(array $data): bool; - /** - * @param ImportJob $job - * - * @return void - */ - public function setJob(ImportJob $job); - /** * Return the data required for the next step in the job configuration. * @@ -62,4 +55,11 @@ interface ConfiguratorInterface */ public function isJobConfigured(): bool; -} \ No newline at end of file + /** + * @param ImportJob $job + * + * @return void + */ + public function setJob(ImportJob $job); + +} diff --git a/app/Import/Configurator/CsvConfigurator.php b/app/Import/Configurator/CsvConfigurator.php index a3c9750fee..4e7d4ff476 100644 --- a/app/Import/Configurator/CsvConfigurator.php +++ b/app/Import/Configurator/CsvConfigurator.php @@ -156,4 +156,4 @@ class CsvConfigurator implements ConfiguratorInterface return $class; } -} \ No newline at end of file +} diff --git a/app/Import/FileProcessor/CsvProcessor.php b/app/Import/FileProcessor/CsvProcessor.php index 5585cf4b04..5be25f5ed1 100644 --- a/app/Import/FileProcessor/CsvProcessor.php +++ b/app/Import/FileProcessor/CsvProcessor.php @@ -232,4 +232,4 @@ class CsvProcessor implements FileProcessorInterface return $row; } -} \ No newline at end of file +} diff --git a/app/Import/FileProcessor/FileProcessorInterface.php b/app/Import/FileProcessor/FileProcessorInterface.php index 5dfccd4dd7..0813246750 100644 --- a/app/Import/FileProcessor/FileProcessorInterface.php +++ b/app/Import/FileProcessor/FileProcessorInterface.php @@ -39,4 +39,4 @@ interface FileProcessorInterface * @return FileProcessorInterface */ public function setJob(ImportJob $job): FileProcessorInterface; -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportAccount.php b/app/Import/Object/ImportAccount.php index 19ff1c8f40..22295cae12 100644 --- a/app/Import/Object/ImportAccount.php +++ b/app/Import/Object/ImportAccount.php @@ -296,4 +296,4 @@ class ImportAccount } -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportBill.php b/app/Import/Object/ImportBill.php index c3d5f2f93d..729a290d3b 100644 --- a/app/Import/Object/ImportBill.php +++ b/app/Import/Object/ImportBill.php @@ -225,4 +225,4 @@ class ImportBill return true; } -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportBudget.php b/app/Import/Object/ImportBudget.php index b3732a4efa..011fef8c8e 100644 --- a/app/Import/Object/ImportBudget.php +++ b/app/Import/Object/ImportBudget.php @@ -226,4 +226,4 @@ class ImportBudget } -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportCategory.php b/app/Import/Object/ImportCategory.php index f8ee78442e..69265fcd3a 100644 --- a/app/Import/Object/ImportCategory.php +++ b/app/Import/Object/ImportCategory.php @@ -30,33 +30,17 @@ class ImportCategory private $repository; /** @var User */ private $user; - /** - * @param array $id - */ - public function setId(array $id) - { - $this->id = $id; - } /** * ImportCategory constructor. */ public function __construct() { - $this->category = new Category(); + $this->category = new Category(); $this->repository = app(CategoryRepositoryInterface::class); Log::debug('Created ImportCategory.'); } - /** - * @param array $name - */ - public function setName(array $name) - { - $this->name = $name; - } - - /** * @return Category */ @@ -68,6 +52,23 @@ class ImportCategory return $this->category; } + + /** + * @param array $id + */ + public function setId(array $id) + { + $this->id = $id; + } + + /** + * @param array $name + */ + public function setName(array $name) + { + $this->name = $name; + } + /** * @param User $user */ @@ -100,7 +101,7 @@ class ImportCategory if (count($this->name) === 3) { /** @var Collection $categories */ $categories = $this->repository->getCategories(); - $name = $this->name['value']; + $name = $this->name['value']; Log::debug(sprintf('Finding category with name %s', $name)); $filtered = $categories->filter( function (Category $category) use ($name) { @@ -219,4 +220,4 @@ class ImportCategory } -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportCurrency.php b/app/Import/Object/ImportCurrency.php index 6791caba62..983c2591ae 100644 --- a/app/Import/Object/ImportCurrency.php +++ b/app/Import/Object/ImportCurrency.php @@ -53,7 +53,7 @@ class ImportCurrency } Log::debug('In createCurrency()'); // check if any of them is mapped: - $mapped = $this->findMappedObject(); + $mapped = $this->findMappedObject(); if (!is_null($mapped->id)) { @@ -215,4 +215,4 @@ class ImportCurrency } -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index ce3af83147..8c6c86384b 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -272,4 +272,4 @@ class ImportJournal break; } } -} \ No newline at end of file +} diff --git a/app/Import/Object/ImportTransaction.php b/app/Import/Object/ImportTransaction.php index cbb6a453cd..696aaaac6c 100644 --- a/app/Import/Object/ImportTransaction.php +++ b/app/Import/Object/ImportTransaction.php @@ -154,4 +154,4 @@ class ImportTransaction return round(floatval($value), 12); } -} \ No newline at end of file +} diff --git a/app/Import/Routine/ImportRoutine.php b/app/Import/Routine/ImportRoutine.php index 6177f7a464..ee8fd22c6b 100644 --- a/app/Import/Routine/ImportRoutine.php +++ b/app/Import/Routine/ImportRoutine.php @@ -44,15 +44,6 @@ class ImportRoutine $this->errors = new Collection; } - /** - * @param ImportJob $job - */ - public function setJob(ImportJob $job) - { - $this->job = $job; - } - - /** * */ @@ -90,6 +81,14 @@ class ImportRoutine return true; } + /** + * @param ImportJob $job + */ + public function setJob(ImportJob $job) + { + $this->job = $job; + } + /** * @return Collection */ @@ -164,4 +163,4 @@ class ImportRoutine return $storage; } -} \ No newline at end of file +} diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.php index 23d1ed9ad4..b366aeb8c7 100644 --- a/app/Import/Storage/ImportStorage.php +++ b/app/Import/Storage/ImportStorage.php @@ -379,4 +379,4 @@ class ImportStorage } } -} \ No newline at end of file +} diff --git a/app/Mail/RegisteredUser.php b/app/Mail/RegisteredUser.php index d988506393..ea8e6a7e63 100644 --- a/app/Mail/RegisteredUser.php +++ b/app/Mail/RegisteredUser.php @@ -22,8 +22,8 @@ class RegisteredUser extends Mailable */ public function __construct(string $address, string $ipAddress) { - $this->address = $address; - $this->ipAddress = $ipAddress; + $this->address = $address; + $this->ipAddress = $ipAddress; } /** diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php index 2c7d12558c..bfd66f881f 100644 --- a/app/Models/CurrencyExchangeRate.php +++ b/app/Models/CurrencyExchangeRate.php @@ -50,4 +50,4 @@ class CurrencyExchangeRate extends Model return $this->belongsTo(User::class); } -} \ No newline at end of file +} diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php index 5b3febd6c5..4f23de2c83 100644 --- a/app/Models/ImportJob.php +++ b/app/Models/ImportJob.php @@ -86,7 +86,7 @@ class ImportJob extends Model */ public function addStepsDone(int $count) { - $status = $this->extended_status; + $status = $this->extended_status; $status['done'] += $count; $this->extended_status = $status; $this->save(); diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 19573b2b29..21430124c2 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -133,9 +133,10 @@ class Tag extends Model */ public function getTagAttribute($value) { - if(is_null($value)) { + if (is_null($value)) { return null; } + return Crypt::decrypt($value); } diff --git a/app/Repositories/Account/FindAccountsTrait.php b/app/Repositories/Account/FindAccountsTrait.php index a3a4248ab2..e06a598a47 100644 --- a/app/Repositories/Account/FindAccountsTrait.php +++ b/app/Repositories/Account/FindAccountsTrait.php @@ -212,4 +212,4 @@ trait FindAccountsTrait return $account; } -} \ No newline at end of file +} diff --git a/app/Repositories/Journal/CreateJournalsTrait.php b/app/Repositories/Journal/CreateJournalsTrait.php index 77b97eadd2..44064b7432 100644 --- a/app/Repositories/Journal/CreateJournalsTrait.php +++ b/app/Repositories/Journal/CreateJournalsTrait.php @@ -188,4 +188,4 @@ trait CreateJournalsTrait } -} \ No newline at end of file +} diff --git a/app/Repositories/Journal/SupportJournalsTrait.php b/app/Repositories/Journal/SupportJournalsTrait.php index 601c8cf9b7..df57879971 100644 --- a/app/Repositories/Journal/SupportJournalsTrait.php +++ b/app/Repositories/Journal/SupportJournalsTrait.php @@ -243,4 +243,4 @@ trait SupportJournalsTrait return $data; } -} \ No newline at end of file +} diff --git a/app/Repositories/Journal/UpdateJournalsTrait.php b/app/Repositories/Journal/UpdateJournalsTrait.php index 8e249d5bff..9bf2cae058 100644 --- a/app/Repositories/Journal/UpdateJournalsTrait.php +++ b/app/Repositories/Journal/UpdateJournalsTrait.php @@ -153,4 +153,4 @@ trait UpdateJournalsTrait return true; } -} \ No newline at end of file +} diff --git a/app/Rules/Triggers/HasAttachment.php b/app/Rules/Triggers/HasAttachment.php index 4fc3bd720f..6fc86c6a6c 100644 --- a/app/Rules/Triggers/HasAttachment.php +++ b/app/Rules/Triggers/HasAttachment.php @@ -58,4 +58,4 @@ class HasAttachment extends AbstractTrigger implements TriggerInterface return false; } -} \ No newline at end of file +} diff --git a/app/Services/Currency/ExchangeRateInterface.php b/app/Services/Currency/ExchangeRateInterface.php index a37133db9a..69a8040a5d 100644 --- a/app/Services/Currency/ExchangeRateInterface.php +++ b/app/Services/Currency/ExchangeRateInterface.php @@ -35,4 +35,4 @@ interface ExchangeRateInterface */ public function setUser(User $user); -} \ No newline at end of file +} diff --git a/app/Services/Currency/FixerIO.php b/app/Services/Currency/FixerIO.php index e77a7777ba..7a3290bb96 100644 --- a/app/Services/Currency/FixerIO.php +++ b/app/Services/Currency/FixerIO.php @@ -68,4 +68,4 @@ class FixerIO implements ExchangeRateInterface { $this->user = $user; } -} \ No newline at end of file +} diff --git a/app/Support/Binder/CurrencyCode.php b/app/Support/Binder/CurrencyCode.php index 4616ce5ef2..39b0a73915 100644 --- a/app/Support/Binder/CurrencyCode.php +++ b/app/Support/Binder/CurrencyCode.php @@ -36,4 +36,4 @@ class CurrencyCode implements BinderInterface } throw new NotFoundHttpException; } -} \ No newline at end of file +} diff --git a/app/Support/Import/Configuration/ConfigurationInterface.php b/app/Support/Import/Configuration/ConfigurationInterface.php index f44203517e..7f13ebe167 100644 --- a/app/Support/Import/Configuration/ConfigurationInterface.php +++ b/app/Support/Import/Configuration/ConfigurationInterface.php @@ -43,4 +43,4 @@ interface ConfigurationInterface */ public function storeConfiguration(array $data): bool; -} \ No newline at end of file +} diff --git a/app/Support/Import/Configuration/Csv/Initial.php b/app/Support/Import/Configuration/Csv/Initial.php index 096d997f5e..30eabec6dc 100644 --- a/app/Support/Import/Configuration/Csv/Initial.php +++ b/app/Support/Import/Configuration/Csv/Initial.php @@ -121,4 +121,4 @@ class Initial implements ConfigurationInterface return true; } -} \ No newline at end of file +} diff --git a/app/Support/Import/Configuration/Csv/Map.php b/app/Support/Import/Configuration/Csv/Map.php index eb51c04e4d..813cecd071 100644 --- a/app/Support/Import/Configuration/Csv/Map.php +++ b/app/Support/Import/Configuration/Csv/Map.php @@ -265,4 +265,4 @@ class Map implements ConfigurationInterface return $column; } -} \ No newline at end of file +} diff --git a/app/Support/Import/Configuration/Csv/Roles.php b/app/Support/Import/Configuration/Csv/Roles.php index ced9b88aa0..445628aeab 100644 --- a/app/Support/Import/Configuration/Csv/Roles.php +++ b/app/Support/Import/Configuration/Csv/Roles.php @@ -264,4 +264,4 @@ class Roles implements ConfigurationInterface return true; } -} \ No newline at end of file +} diff --git a/app/Support/Search/Modifier.php b/app/Support/Search/Modifier.php index 18e94d3aff..4422cf2e56 100644 --- a/app/Support/Search/Modifier.php +++ b/app/Support/Search/Modifier.php @@ -208,4 +208,4 @@ class Modifier return self::stringCompare($journalCategory, $search) || self::stringCompare($transactionCategory, $search); } -} \ No newline at end of file +} diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php index ebceaf59f9..490e24708a 100644 --- a/app/Support/Search/Search.php +++ b/app/Support/Search/Search.php @@ -53,7 +53,7 @@ class Search implements SearchInterface public function __construct() { $this->modifiers = new Collection; - $this->validModifiers = (array) config('firefly.search_modifiers'); + $this->validModifiers = (array)config('firefly.search_modifiers'); } /** diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 32e07f08dc..8a3ca9c885 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -13,7 +13,7 @@ declare(strict_types=1); namespace FireflyIII\Support; -use \Amount as GlobalAmount; +use Amount as GlobalAmount; use Carbon\Carbon; use Crypt; use DB; diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index db267e4401..55e5c28942 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -265,4 +265,4 @@ class AmountFormat extends Twig_Extension ); } -} \ No newline at end of file +} diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 2727d4d86c..c014cb7078 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -244,4 +244,4 @@ $factory->define( 'foreign_currency_symbol' => null, ]; } -); \ No newline at end of file +); diff --git a/resources/views/bills/index.twig b/resources/views/bills/index.twig index b56f32da2b..55d2280420 100644 --- a/resources/views/bills/index.twig +++ b/resources/views/bills/index.twig @@ -31,4 +31,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/resources/views/partials/empty.twig b/resources/views/partials/empty.twig index 4dead2ac1d..43285b55ab 100644 --- a/resources/views/partials/empty.twig +++ b/resources/views/partials/empty.twig @@ -20,4 +20,4 @@ - \ No newline at end of file + diff --git a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php index 34e1d7e36a..7d180e5b95 100644 --- a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php +++ b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php @@ -48,4 +48,4 @@ class ForgotPasswordControllerTest extends TestCase $response = $this->post(route('password.email'), $data); $response->assertStatus(302); } -} \ No newline at end of file +} diff --git a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php index a00de386f1..51f68239f9 100644 --- a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php +++ b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php @@ -118,4 +118,4 @@ class BudgetReportControllerTest extends TestCase $response->assertStatus(200); } -} \ No newline at end of file +} diff --git a/tests/Unit/Handlers/Events/UserEventHandlerTest.php b/tests/Unit/Handlers/Events/UserEventHandlerTest.php index 27b44dfb72..dc0e36a62c 100644 --- a/tests/Unit/Handlers/Events/UserEventHandlerTest.php +++ b/tests/Unit/Handlers/Events/UserEventHandlerTest.php @@ -85,4 +85,4 @@ class UserEventHandlerTest extends TestCase $this->assertTrue(true); } -} \ No newline at end of file +} diff --git a/tests/Unit/Helpers/AttachmentHelperTest.php b/tests/Unit/Helpers/AttachmentHelperTest.php index 47f039f332..5f2d64308e 100644 --- a/tests/Unit/Helpers/AttachmentHelperTest.php +++ b/tests/Unit/Helpers/AttachmentHelperTest.php @@ -133,4 +133,4 @@ class AttachmentHelperTest extends TestCase } -} \ No newline at end of file +} diff --git a/tests/Unit/Helpers/MetaPieChartTest.php b/tests/Unit/Helpers/MetaPieChartTest.php index e47c9e0cd4..983ff8016d 100644 --- a/tests/Unit/Helpers/MetaPieChartTest.php +++ b/tests/Unit/Helpers/MetaPieChartTest.php @@ -208,4 +208,4 @@ class MetaPieChartTest extends TestCase return $set; } -} \ No newline at end of file +} From 69eef30ad35246f8628db0653c93782f5b4a47c0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 7 Jul 2017 13:50:15 +0200 Subject: [PATCH 15/23] Various code clean up. --- .../Report/Audit/MonthReportGenerator.php | 2 +- .../Controllers/Chart/TagReportController.php | 2 +- .../Controllers/Report/CategoryController.php | 2 +- app/Import/Object/ImportJournal.php | 2 - app/Import/Object/ImportTransaction.php | 157 ------------------ .../Category/CategoryRepository.php | 90 ++++++---- .../ImportJobRepositoryInterface.php | 8 +- .../Import/Configuration/Csv/Initial.php | 20 ++- app/Support/Import/Configuration/Csv/Map.php | 2 +- 9 files changed, 83 insertions(+), 202 deletions(-) delete mode 100644 app/Import/Object/ImportTransaction.php diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index d02815963a..43e23ad1a4 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -163,7 +163,7 @@ class MonthReportGenerator implements ReportGeneratorInterface /** @var Transaction $journal */ foreach ($journals as $transaction) { $transaction->before = $startBalance; - $transactionAmount = $transaction->transaction_amount; + $transactionAmount = $transaction->transaction_amount; if ($currency->id === $transaction->foreign_currency_id) { $transactionAmount = $transaction->transaction_foreign_amount; diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php index 5c3ee98ed1..2aca50bc77 100644 --- a/app/Http/Controllers/Chart/TagReportController.php +++ b/app/Http/Controllers/Chart/TagReportController.php @@ -364,4 +364,4 @@ class TagReportController extends Controller return $grouped; } -} +} \ No newline at end of file diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php index 969ea8afdc..250e54dde9 100644 --- a/app/Http/Controllers/Report/CategoryController.php +++ b/app/Http/Controllers/Report/CategoryController.php @@ -120,7 +120,7 @@ class CategoryController extends Controller foreach ($categories as $category) { $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end); if (bccomp($spent, '0') !== 0) { - $report[$category->id] = ['name' => $category->name, 'spent' => $spent,'id' => $category->id]; + $report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'id' => $category->id]; } } diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index 8c6c86384b..adebaea1f6 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -62,8 +62,6 @@ class ImportJournal private $modifiers = []; /** @var array */ private $tags = []; - /** @var string */ - private $transactionType = ''; /** @var User */ private $user; diff --git a/app/Import/Object/ImportTransaction.php b/app/Import/Object/ImportTransaction.php deleted file mode 100644 index 696aaaac6c..0000000000 --- a/app/Import/Object/ImportTransaction.php +++ /dev/null @@ -1,157 +0,0 @@ -currency = new ImportCurrency; - } - - public function addToModifier(array $modifier) - { - $this->modifiers[] = $modifier; - } - - /** - * @return string - */ - public function getAmount(): string - { - // use converter: - $this->amount = strval($this->parseAmount()); - - - // also apply modifiers: - $this->amount = Steam::positive($this->amount); - - // Can handle ING - foreach ($this->modifiers as $modifier) { - $class = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $modifier['role']))); - /** @var ConverterInterface $converter */ - $converter = app($class); - if ($converter->convert($modifier['value']) === -1) { - $this->amount = Steam::negative($this->amount); - } - } - - return $this->amount; - } - - /** - * @param string $amount - */ - public function setAmount(string $amount) - { - $this->amount = $amount; - } - - /** - * @return ImportCurrency - */ - public function getCurrency(): ImportCurrency - { - return $this->currency; - } - - /** - * @param ImportCurrency $currency - */ - public function setCurrency(ImportCurrency $currency) - { - $this->currency = $currency; - } - - /** - * @param string $date - */ - public function setDate(string $date) - { - $this->date = $date; - } - - /** - * @param string $description - */ - public function setDescription(string $description) - { - $this->description = $description; - } - - /** - * @param bool $positive - */ - public function setPositive(bool $positive) - { - $this->positive = $positive; - } - - /** - * Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. - * - Jamie Zawinski - * - * @return float - */ - private function parseAmount() - { - $value = $this->amount; - $len = strlen($value); - $decimalPosition = $len - 3; - $decimal = null; - - if (($len > 2 && $value{$decimalPosition} == '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) { - $decimal = '.'; - } - if ($len > 2 && $value{$decimalPosition} == ',') { - $decimal = ','; - } - - // if decimal is dot, replace all comma's and spaces with nothing. then parse as float (round to 4 pos) - if ($decimal === '.') { - $search = [',', ' ']; - $value = str_replace($search, '', $value); - } - if ($decimal === ',') { - $search = ['.', ' ']; - $value = str_replace($search, '', $value); - $value = str_replace(',', '.', $value); - } - if (is_null($decimal)) { - // replace all: - $search = ['.', ' ', ',']; - $value = str_replace($search, '', $value); - } - - return round(floatval($value), 12); - } - -} diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index bef618f634..e0a9f262b7 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -160,42 +160,19 @@ class CategoryRepository implements CategoryRepositoryInterface */ public function lastUseDate(Category $category, Collection $accounts): Carbon { - $last = null; + $last = new Carbon('1900-01-01'); + $lastJournalDate = $this->getLastJournalDate($category, $accounts); - /** @var TransactionJournal $first */ - $lastJournalQuery = $category->transactionJournals()->orderBy('date', 'DESC'); - - if ($accounts->count() > 0) { - // filter journals: - $ids = $accounts->pluck('id')->toArray(); - $lastJournalQuery->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id'); - $lastJournalQuery->whereIn('t.account_id', $ids); + if ($lastJournalDate->year !== 1900) { + $last = clone $lastJournalDate; + unset($lastJournalDate); } - $lastJournal = $lastJournalQuery->first(['transaction_journals.*']); + $lastTransactionDate = $this->getLastTransactionDate($category, $accounts); - if ($lastJournal) { - $last = $lastJournal->date; - } - - // check transactions: - - $lastTransactionQuery = $category->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'DESC'); - if ($accounts->count() > 0) { - // filter journals: - $ids = $accounts->pluck('id')->toArray(); - $lastTransactionQuery->whereIn('transactions.account_id', $ids); - } - - $lastTransaction = $lastTransactionQuery->first(['transaction_journals.*']); - if (!is_null($lastTransaction) && ((!is_null($last) && $lastTransaction->date < $last) || is_null($last))) { - $last = new Carbon($lastTransaction->date); - } - - if (is_null($last)) { - return new Carbon('1900-01-01'); + if ($lastTransactionDate->year !== 1900 && $lastTransactionDate < $last) { + $last = clone $lastTransactionDate; + unset($lastTransactionDate); } return $last; @@ -479,4 +456,53 @@ class CategoryRepository implements CategoryRepositoryInterface return $category; } + /** + * @param Category $category + * @param Collection $accounts + * + * @return Carbon + */ + private function getLastJournalDate(Category $category, Collection $accounts): Carbon + { + $query = $category->transactionJournals()->orderBy('date', 'DESC'); + + if ($accounts->count() > 0) { + $query->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id'); + $query->whereIn('t.account_id', $accounts->pluck('id')->toArray()); + } + + $result = $query->first(['transaction_journals.*']); + + if (!is_null($result)) { + return $result->date; + } + + return new Carbon('1900-01-01'); + } + + /** + * @param Category $category + * @param Collection $accounts + * + * @return Carbon + */ + private function getLastTransactionDate(Category $category, Collection $accounts): Carbon + { + // check transactions: + $query = $category->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'DESC'); + if ($accounts->count() > 0) { + // filter journals: + $query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray()); + } + + $lastTransaction = $query->first(['transaction_journals.*']); + if (!is_null($lastTransaction)) { + return new Carbon($lastTransaction->date); + } + + return new Carbon('1900-01-01'); + } + } diff --git a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php index 421a7849b2..bfdc0493b9 100644 --- a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php +++ b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php @@ -42,17 +42,17 @@ interface ImportJobRepositoryInterface * @param ImportJob $job * @param UploadedFile $file * - * @return mixed + * @return bool */ - public function processFile(ImportJob $job, UploadedFile $file): bool; + public function processConfiguration(ImportJob $job, UploadedFile $file): bool; /** * @param ImportJob $job * @param UploadedFile $file * - * @return bool + * @return mixed */ - public function processConfiguration(ImportJob $job, UploadedFile $file): bool; + public function processFile(ImportJob $job, UploadedFile $file): bool; /** * @param ImportJob $job diff --git a/app/Support/Import/Configuration/Csv/Initial.php b/app/Support/Import/Configuration/Csv/Initial.php index 30eabec6dc..7884a83f6b 100644 --- a/app/Support/Import/Configuration/Csv/Initial.php +++ b/app/Support/Import/Configuration/Csv/Initial.php @@ -26,6 +26,7 @@ use Log; class Initial implements ConfigurationInterface { private $job; + /** * @return array */ @@ -106,6 +107,21 @@ class Initial implements ConfigurationInterface Log::error('Could not find anything for csv_import_account.', ['id' => $importId]); } + $config = $this->storeSpecifics($data, $config); + $this->job->configuration = $config; + $this->job->save(); + + return true; + } + + /** + * @param array $data + * @param array $config + * + * @return array + */ + private function storeSpecifics(array $data, array $config): array + { // loop specifics. if (isset($data['specifics']) && is_array($data['specifics'])) { foreach ($data['specifics'] as $name => $enabled) { @@ -116,9 +132,7 @@ class Initial implements ConfigurationInterface } } } - $this->job->configuration = $config; - $this->job->save(); - return true; + return $config; } } diff --git a/app/Support/Import/Configuration/Csv/Map.php b/app/Support/Import/Configuration/Csv/Map.php index 813cecd071..eb51c04e4d 100644 --- a/app/Support/Import/Configuration/Csv/Map.php +++ b/app/Support/Import/Configuration/Csv/Map.php @@ -265,4 +265,4 @@ class Map implements ConfigurationInterface return $column; } -} +} \ No newline at end of file From e62b979708b8952d160d0a5f6ca6a3ccead98c4b Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 7 Jul 2017 16:53:44 +0200 Subject: [PATCH 16/23] Fix redirect error [skip ci] --- app/Http/Controllers/PiggyBankController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index e186f04d87..207f98cd6f 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -397,7 +397,7 @@ class PiggyBankController extends Controller // @codeCoverageIgnoreEnd } - return redirect($this->getPreviousUri('piggy-banks.edit.uri')); + return redirect($this->getPreviousUri('piggy-banks.create.uri')); } /** From 19774f32c2ead618a4bc93ad161fc256bba7b52c Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 7 Jul 2017 17:51:14 +0200 Subject: [PATCH 17/23] First code for #658 --- .../Transaction/SingleController.php | 65 ++++++++++--------- app/Support/ExpandedForm.php | 13 ++++ public/js/ff/transactions/single/create.js | 17 +++-- resources/views/form/amount.twig | 2 +- .../views/transactions/single/create.twig | 4 ++ 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 71b5bc9430..8ce2cbae87 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -21,6 +21,7 @@ use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\JournalFormRequest; use FireflyIII\Models\AccountType; +use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; @@ -86,39 +87,41 @@ class SingleController extends Controller public function cloneTransaction(TransactionJournal $journal) { - $source = $journal->sourceAccountList()->first(); - $destination = $journal->destinationAccountList()->first(); - $budget = $journal->budgets()->first(); - $budgetId = is_null($budget) ? 0 : $budget->id; - $category = $journal->categories()->first(); - $categoryName = is_null($category) ? '' : $category->name; - $tags = join(',', $journal->tags()->get()->pluck('tag')->toArray()); - $transaction = $journal->transactions()->first(); - $amount = Steam::positive($transaction->amount); - $foreignAmount = is_null($transaction->foreign_amount) ? null : Steam::positive($transaction->foreign_amount); + $source = $journal->sourceAccountList()->first(); + $destination = $journal->destinationAccountList()->first(); + $budget = $journal->budgets()->first(); + $budgetId = is_null($budget) ? 0 : $budget->id; + $category = $journal->categories()->first(); + $categoryName = is_null($category) ? '' : $category->name; + $tags = join(',', $journal->tags()->get()->pluck('tag')->toArray()); + /** @var Transaction $transaction */ + $transaction = $journal->transactions()->first(); + $amount = Steam::positive($transaction->amount); + $foreignAmount = is_null($transaction->foreign_amount) ? null : Steam::positive($transaction->foreign_amount); $preFilled = [ - 'description' => $journal->description, - 'source_account_id' => $source->id, - 'source_account_name' => $source->name, - 'destination_account_id' => $destination->id, - 'destination_account_name' => $destination->name, - 'amount' => $amount, - 'source_amount' => $amount, - 'destination_amount' => $foreignAmount, - 'foreign_amount' => $foreignAmount, - 'date' => $journal->date->format('Y-m-d'), - 'budget_id' => $budgetId, - 'category' => $categoryName, - 'tags' => $tags, - 'interest_date' => $journal->getMeta('interest_date'), - 'book_date' => $journal->getMeta('book_date'), - 'process_date' => $journal->getMeta('process_date'), - 'due_date' => $journal->getMeta('due_date'), - 'payment_date' => $journal->getMeta('payment_date'), - 'invoice_date' => $journal->getMeta('invoice_date'), - 'internal_reference' => $journal->getMeta('internal_reference'), - 'notes' => $journal->getMeta('notes'), + 'description' => $journal->description, + 'source_account_id' => $source->id, + 'source_account_name' => $source->name, + 'destination_account_id' => $destination->id, + 'destination_account_name' => $destination->name, + 'amount' => $amount, + 'source_amount' => $amount, + 'destination_amount' => $foreignAmount, + 'foreign_amount' => $foreignAmount, + 'amount_currency_id_amount' => $transaction->foreign_currency_id ?? 0, + 'date' => $journal->date->format('Y-m-d'), + 'budget_id' => $budgetId, + 'category' => $categoryName, + 'tags' => $tags, + 'interest_date' => $journal->getMeta('interest_date'), + 'book_date' => $journal->getMeta('book_date'), + 'process_date' => $journal->getMeta('process_date'), + 'due_date' => $journal->getMeta('due_date'), + 'payment_date' => $journal->getMeta('payment_date'), + 'invoice_date' => $journal->getMeta('invoice_date'), + 'internal_reference' => $journal->getMeta('internal_reference'), + 'notes' => $journal->getMeta('notes'), ]; Session::flash('preFilled', $preFilled); diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index dab2ed286d..c1dc2fc174 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -565,6 +565,19 @@ class ExpandedForm unset($options['currency']); unset($options['placeholder']); + // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) + $preFilled = session('preFilled'); + $key = 'amount_currency_id_' . $name; + $sentCurrencyId = isset($preFilled[$key]) ? intval($preFilled[$key]) : $defaultCurrency->id; + + // find this currency in set of currencies: + foreach ($currencies as $currency) { + if ($currency->id === $sentCurrencyId) { + $defaultCurrency = $currency; + break; + } + } + // make sure value is formatted nicely: if (!is_null($value) && $value !== '') { $value = round($value, $defaultCurrency->decimal_places); diff --git a/public/js/ff/transactions/single/create.js b/public/js/ff/transactions/single/create.js index c98759b9b9..9f2ac22603 100644 --- a/public/js/ff/transactions/single/create.js +++ b/public/js/ff/transactions/single/create.js @@ -23,7 +23,6 @@ $(document).ready(function () { updateForm(); updateLayout(); updateDescription(); - updateNativeCurrency(); // when user changes source account or destination, native currency may be different. @@ -60,9 +59,15 @@ function getExchangeInstructions() { * There is an input that shows the currency symbol that is native to the selected * acccount. So when the user changes the selected account, the native currency is updated: */ -function updateNativeCurrency() { - var newAccountId = getAccountId(); - var nativeCurrencyId = accountInfo[newAccountId].preferredCurrency; +function updateNativeCurrency(useAccountCurrency) { + var nativeCurrencyId; + if (useAccountCurrency) { + var newAccountId = getAccountId(); + nativeCurrencyId = accountInfo[newAccountId].preferredCurrency; + } + if (!useAccountCurrency) { + nativeCurrencyId = overruleCurrency; + } $('.currency-option[data-id="' + nativeCurrencyId + '"]').click(); $('[data-toggle="dropdown"]').parent().removeClass('open'); @@ -180,7 +185,9 @@ function updateForm() { default: break; } - updateNativeCurrency(); + // get instructions all the time. + updateNativeCurrency(useAccountCurrency); + selectsForeignCurrency(); } /** diff --git a/resources/views/form/amount.twig b/resources/views/form/amount.twig index c28227d1f7..eaf1ec2d8f 100644 --- a/resources/views/form/amount.twig +++ b/resources/views/form/amount.twig @@ -7,7 +7,7 @@