From dd17a20b6083703b506cb5907c44731337b551d4 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 4 May 2017 17:30:12 +0200
Subject: [PATCH 001/103] New translations firefly.php (Slovenian)
---
resources/lang/sl_SI/firefly.php | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/resources/lang/sl_SI/firefly.php b/resources/lang/sl_SI/firefly.php
index 3f7e800a62..0b4ebb7269 100644
--- a/resources/lang/sl_SI/firefly.php
+++ b/resources/lang/sl_SI/firefly.php
@@ -11,21 +11,21 @@
return [
// general stuff:
- 'language_incomplete' => 'incomplete translation',
- 'close' => 'Close',
+ 'language_incomplete' => 'nepopoln prevod',
+ 'close' => 'zapri',
'actions' => 'Actions',
- 'edit' => 'Edit',
- 'delete' => 'Delete',
- 'welcomeBack' => 'What\'s playing?',
- 'everything' => 'Everything',
- 'customRange' => 'Custom range',
- 'apply' => 'Apply',
- 'cancel' => 'Cancel',
+ 'edit' => 'uredi',
+ 'delete' => 'izbriši',
+ 'welcomeBack' => 'Kaj dogaja?',
+ 'everything' => 'vse',
+ 'customRange' => 'obseg po meri',
+ 'apply' => 'uporabi',
+ 'cancel' => 'prekliči',
'from' => 'From',
'to' => 'To',
- 'showEverything' => 'Show everything',
- 'never' => 'Never',
- 'search_results_for' => 'Search results for ":query"',
+ 'showEverything' => 'pokaži vse',
+ 'never' => 'nikoli',
+ 'search_results_for' => 'rezultati iskanja za ":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.',
'bounced_error' => 'The message sent to :email bounced, so no access for you.',
From 9856a1831a3513526b8b33c484e5120742e75ec1 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 4 May 2017 17:40:13 +0200
Subject: [PATCH 002/103] New translations firefly.php (Slovenian)
---
resources/lang/sl_SI/firefly.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/resources/lang/sl_SI/firefly.php b/resources/lang/sl_SI/firefly.php
index 0b4ebb7269..8358bb5d84 100644
--- a/resources/lang/sl_SI/firefly.php
+++ b/resources/lang/sl_SI/firefly.php
@@ -26,7 +26,7 @@ return [
'showEverything' => 'pokaži vse',
'never' => 'nikoli',
'search_results_for' => 'rezultati iskanja za ":query"',
- 'advanced_search' => 'Advanced search',
+ 'advanced_search' => 'napredno iskanje',
'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.',
'bounced_error' => 'The message sent to :email bounced, so no access for you.',
'deleted_error' => 'These credentials do not match our records.',
@@ -38,13 +38,13 @@ return [
'Opening balance' => 'Opening balance',
'create_new_stuff' => 'Create new stuff',
'new_withdrawal' => 'New withdrawal',
- 'new_deposit' => 'New deposit',
- 'new_transfer' => 'New transfer',
+ 'new_deposit' => 'nov depozit',
+ 'new_transfer' => 'nov prenos',
'new_asset_account' => 'nov premoženjski račun',
'new_expense_account' => 'nov konto za stroške',
- 'new_revenue_account' => 'New revenue account',
- 'new_budget' => 'New budget',
- 'new_bill' => 'New bill',
+ 'new_revenue_account' => 'nov konto za dohodke',
+ 'new_budget' => 'nov budžet',
+ 'new_bill' => 'nov trajnik',
'block_account_logout' => 'You have been logged out. Blocked accounts cannot use this site. Did you register with a valid email address?',
'flash_success' => 'Success!',
'flash_info' => 'Message',
From 7f082ea38914370a711d8f7b08f544033aef1fbb Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sat, 6 May 2017 10:20:27 +0200
Subject: [PATCH 003/103] Remove focus thing
---
public/js/ff/transactions/single/common.js | 2 +-
public/js/ff/transactions/single/create.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/js/ff/transactions/single/common.js b/public/js/ff/transactions/single/common.js
index d98ac6afce..0fd23dd6ac 100644
--- a/public/js/ff/transactions/single/common.js
+++ b/public/js/ff/transactions/single/common.js
@@ -158,7 +158,7 @@ function validateCurrencyForTransfer() {
$('#source_amount_holder').show().find('.non-selectable-currency-symbol').text(sourceSymbol);
if (sourceCurrency === destinationCurrency) {
- console.log('Both accounts accept ' + sourceCurrency);
+ console.log('Both accounts accept #' + sourceCurrency);
$('#destination_amount_holder').hide();
$('#amount_holder').hide();
return;
diff --git a/public/js/ff/transactions/single/create.js b/public/js/ff/transactions/single/create.js
index 61806b786f..56109f855c 100644
--- a/public/js/ff/transactions/single/create.js
+++ b/public/js/ff/transactions/single/create.js
@@ -68,7 +68,7 @@ function updateNativeCurrency() {
$('.currency-option[data-id="' + nativeCurrencyId + '"]').click();
$('[data-toggle="dropdown"]').parent().removeClass('open');
- $('select[name="source_account_id"]').focus();
+ //$('select[name="source_account_id"]').focus();
validateCurrencyForTransfer();
}
From 5fb73bdb01fabd0557d770f8f2dff898df58a1f1 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 7 May 2017 19:24:53 +0200
Subject: [PATCH 004/103] Fix bug #642
---
app/Http/Controllers/TransactionController.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 0dedf135d1..1e838c5dec 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -119,7 +119,7 @@ class TransactionController extends Controller
$collector->setAllAssetAccounts()->setRange($start, $end)->setTypes($types)->setLimit($pageSize)->setPage($page)->withOpposingAccount();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
- $journals->setPath('/budgets/list/no-budget');
+ $journals->setPath('/transactions/' . $what);
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
@@ -179,10 +179,10 @@ class TransactionController extends Controller
return $this->redirectToAccount($journal);
}
- $events = $tasker->getPiggyBankEvents($journal);
- $transactions = $tasker->getTransactionsOverview($journal);
- $what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
- $subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
+ $events = $tasker->getPiggyBankEvents($journal);
+ $transactions = $tasker->getTransactionsOverview($journal);
+ $what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
+ $subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
$foreignCurrency = null;
if ($journal->hasMeta('foreign_currency_id')) {
From 17fb6983d89a501c9ef7851fc2210d0ecabbd0ee Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 7 May 2017 19:45:40 +0200
Subject: [PATCH 005/103] Fix issue #637 with cash accounts.
---
.../Transaction/ConvertController.php | 14 ++++++++++
.../Account/AccountRepository.php | 13 +++++++++
.../Account/AccountRepositoryInterface.php | 5 ++++
resources/views/transactions/convert.twig | 28 +++++++++++++++----
4 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php
index 72e4209a51..8853a3dbaa 100644
--- a/app/Http/Controllers/Transaction/ConvertController.php
+++ b/app/Http/Controllers/Transaction/ConvertController.php
@@ -182,6 +182,12 @@ class ConvertController extends Controller
break;
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: // three
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: // five
+ if ($data['destination_account_expense'] === '') {
+ // destination is a cash account.
+ $destination = $accountRepository->getCashAccount();
+
+ return $destination;
+ }
$data = [
'name' => $data['destination_account_expense'],
'accountType' => 'expense',
@@ -221,6 +227,14 @@ class ConvertController extends Controller
throw new FireflyException('Cannot handle ' . $joined); // @codeCoverageIgnore
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: // one
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: // six
+
+ if ($data['source_account_revenue'] === '') {
+ // destination is a cash account.
+ $destination = $accountRepository->getCashAccount();
+
+ return $destination;
+ }
+
$data = [
'name' => $data['source_account_revenue'],
'accountType' => 'revenue',
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index a9e74aa9ef..423efcd23e 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -250,6 +250,19 @@ class AccountRepository implements AccountRepositoryInterface
return $result;
}
+ /**
+ * @return Account
+ */
+ public function getCashAccount(): Account
+ {
+ $type = AccountType::where('type', AccountType::CASH)->first();
+ $account = Account::firstOrCreateEncrypted(
+ ['user_id' => $this->user->id, 'account_type_id' => $type->id, 'name' => 'Cash account', 'active' => 1]
+ );
+
+ return $account;
+ }
+
/**
* Returns the date of the very last transaction in this account.
*
diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php
index f51c398f0b..e444fcada0 100644
--- a/app/Repositories/Account/AccountRepositoryInterface.php
+++ b/app/Repositories/Account/AccountRepositoryInterface.php
@@ -36,6 +36,11 @@ interface AccountRepositoryInterface
*/
public function count(array $types): int;
+ /**
+ * @return Account
+ */
+ public function getCashAccount(): Account;
+
/**
* Moved here from account CRUD.
*
diff --git a/resources/views/transactions/convert.twig b/resources/views/transactions/convert.twig
index ca5203c47f..33f5c08daf 100644
--- a/resources/views/transactions/convert.twig
+++ b/resources/views/transactions/convert.twig
@@ -23,12 +23,23 @@
{# in case of withdrawal #}
{% if sourceType.type == "Withdrawal" %}
{{ ExpandedForm.staticText('source_account_asset', ''~sourceAccount.name~'') }}
- {{ ExpandedForm.staticText('destination_account_expense', ''~destinationAccount.name~'') }}
+ {# if destination is cash, show (cash) #}
+ {% if destinationAccount.accountType.type == "Cash account" %}
+ {{ ExpandedForm.staticText('destination_account_expense', '(cash)') }}
+ {% else %}
+ {{ ExpandedForm.staticText('destination_account_expense', ''~destinationAccount.name~'') }}
+ {% endif %}
+
{% endif %}
{# in case of deposit #}
{% if sourceType.type == "Deposit" %}
- {{ ExpandedForm.staticText('source_account_revenue', ''~sourceAccount.name~'') }}
+ {# if source is cash, show (cash) #}
+ {% if sourceAccount.accountType.type == "Cash account" %}
+ {{ ExpandedForm.staticText('source_account_revenue', '(cash)') }}
+ {% else %}
+ {{ ExpandedForm.staticText('source_account_revenue', ''~sourceAccount.name~'') }}
+ {% endif %}
{{ ExpandedForm.staticText('destination_account_asset', ''~destinationAccount.name~'') }}
{% endif %}
@@ -55,8 +66,11 @@
{{ 'convert_please_set_revenue_source'|_ }}
-
- {{ ExpandedForm.text('source_account_revenue', destinationAccount.name) }}
+ {% if destinationAccount.accountType.type == "Cash account" %}
+ {{ ExpandedForm.text('source_account_revenue', '') }}
+ {% else %}
+ {{ ExpandedForm.text('source_account_revenue', destinationAccount.name) }}
+ {% endif %}
{% endif %}
{# TWO #}
@@ -103,7 +117,11 @@
- {{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}
+ {% if sourceAccount.accountType.type == "Cash account" %}
+ {{ ExpandedForm.text('destination_account_expense', '') }}
+ {% else %}
+ {{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}
+ {% endif %}
{% endif %}
From 0c44fe6ce0d5c3f29e413b059a5a3df083416890 Mon Sep 17 00:00:00 2001
From: Enrico Lamperti
Date: Sun, 7 May 2017 21:24:07 -0300
Subject: [PATCH 006/103] Add translations for Spanish language
---
resources/lang/es_ES/auth.php | 28 +++++++++
resources/lang/es_ES/breadcrumbs.php | 41 +++++++++++++
resources/lang/es_ES/csv.php | 80 ++++++++++++++++++++++++
resources/lang/es_ES/demo.php | 24 ++++++++
resources/lang/es_ES/passwords.php | 19 ++++++
resources/lang/es_ES/validation.php | 91 ++++++++++++++++++++++++++++
6 files changed, 283 insertions(+)
create mode 100644 resources/lang/es_ES/auth.php
create mode 100644 resources/lang/es_ES/breadcrumbs.php
create mode 100644 resources/lang/es_ES/csv.php
create mode 100644 resources/lang/es_ES/demo.php
create mode 100644 resources/lang/es_ES/passwords.php
create mode 100644 resources/lang/es_ES/validation.php
diff --git a/resources/lang/es_ES/auth.php b/resources/lang/es_ES/auth.php
new file mode 100644
index 0000000000..45d765e4fa
--- /dev/null
+++ b/resources/lang/es_ES/auth.php
@@ -0,0 +1,28 @@
+ 'Las credenciales no coinciden con los registros.',
+ 'throttle' => 'Demasiados intentos de inicio de sesión. Por favor reintente en :seconds segundos.',
+
+];
diff --git a/resources/lang/es_ES/breadcrumbs.php b/resources/lang/es_ES/breadcrumbs.php
new file mode 100644
index 0000000000..211e6a3037
--- /dev/null
+++ b/resources/lang/es_ES/breadcrumbs.php
@@ -0,0 +1,41 @@
+ 'Inicio',
+ 'edit_currency' => 'Editar moneda ":name"',
+ 'delete_currency' => 'Eliminar moneda ":name"',
+ 'newPiggyBank' => 'Crear nueva alcancía',
+ 'edit_piggyBank' => 'Editar alcancía ":name"',
+ 'preferences' => 'Preferencias',
+ 'profile' => 'Perfil',
+ 'changePassword' => 'Cambiar contraseña',
+ 'bills' => 'Facturas',
+ 'newBill' => 'Nueva factura',
+ 'edit_bill' => 'Editar factura ":name"',
+ 'delete_bill' => 'Eliminar factura ":name"',
+ 'reports' => 'Reportes',
+ 'searchResult' => 'Buscar ":query"',
+ 'withdrawal_list' => 'Expensas',
+ 'deposit_list' => 'Ganancia, ingresos y depósitos',
+ 'transfer_list' => 'Transferencias',
+ 'transfers_list' => 'Transferencias',
+ 'create_withdrawal' => 'Crear nueva extracción',
+ 'create_deposit' => 'Crear nuevo depósito',
+ 'create_transfer' => 'Crear nueva transferencia',
+ 'edit_journal' => 'Editar transacción ":description"',
+ 'delete_journal' => 'Eliminar transacción ":description"',
+ 'tags' => 'Etiquetas',
+ 'createTag' => 'Crear nueva etiqueta',
+ 'edit_tag' => 'Editar etiqueta ":tag"',
+ 'delete_tag' => 'Eliminar etiqueta ":tag"',
+];
diff --git a/resources/lang/es_ES/csv.php b/resources/lang/es_ES/csv.php
new file mode 100644
index 0000000000..47b611f81a
--- /dev/null
+++ b/resources/lang/es_ES/csv.php
@@ -0,0 +1,80 @@
+ 'Configurar su importación',
+ 'import_configure_intro' => 'Hay algunas opciones para su importación desde CSV. Por facor indique si su CSV contiene encabezados en la primera fila, y cuál es el formato de fecha utilizado. ¡Puede requerir un poco de experimentación! El delimitador de campos es usualmente ",", pero también puede ser ";". Verifíquelo cuidadosamente.',
+ 'import_configure_form' => 'Opciones básicas de importación desde CSV',
+ 'header_help' => 'Marque aquí si el CSV contiene títulos de columna en la primera fila',
+ 'date_help' => 'Formato de fecha y hora en el CSV. Siga el formato que esta página indica. El valor por defecto interpretará fechas que se vean así: :dateExample.',
+ 'delimiter_help' => 'Elija el delimitador de campos del archivo de entrada. Si no está seguro, la coma es la opción más segura.',
+ 'import_account_help' => 'Si el archivo NO contiene información sobre su(s) caja(s) de ahorros seleccion una opción para definir a qué cuenta pertenecen las transacciones del CSV.',
+ 'upload_not_writeable' => 'El texto en gris indica un directorio. Debe tener permiso de escritura. Por favor verifíquelo.',
+
+ // roles
+ 'column_roles_title' => 'Definir roles de las columnas',
+ 'column_roles_table' => 'Tabla',
+ 'column_name' => 'Nombre de la columna',
+ 'column_example' => 'Ejemplo de datos de columna',
+ 'column_role' => 'Significado de los datos de la columna',
+ 'do_map_value' => 'Mapear estos valores',
+ 'column' => 'Columna',
+ 'no_example_data' => 'No hay datos de ejemplo disponibles',
+ 'store_column_roles' => 'Continuar importación',
+ 'do_not_map' => '(no mapear)',
+ 'map_title' => 'Conectar datos de importación con datos de Firefly-III',
+ 'map_text' => 'En las siguientes tablas el valor de la izquierda muestra información encontrada en el CSV cargado. Es su tarea mapear este valor, si es posible, a un valor ya presente en su base de datos. Firefly respeterá este mapeo. Si no hay un valor hacia el cual mapear o no desea mapear un valor específico, no seleccione ninguno.',
+
+ 'field_value' => 'Valor del campo',
+ 'field_mapped_to' => 'Mapeado a',
+ 'store_column_mapping' => 'Guardar mapeo',
+
+ // map things.
+
+
+ 'column__ignore' => '(ignorar esta columna)',
+ 'column_account-iban' => 'Caja de ahorro (CBU)',
+ 'column_account-id' => 'ID de la caja de ahorro (coincide con Firefly)',
+ 'column_account-name' => 'Caja de ahorro (nombre)',
+ 'column_amount' => 'Monto',
+ 'column_amount-comma-separated' => 'Monto (coma como separador de decimales)',
+ 'column_bill-id' => 'ID de factura (coincide con Firefly)',
+ 'column_bill-name' => 'Nombre de factura',
+ 'column_budget-id' => 'ID de presupuesto (coincide con Firefly)',
+ 'column_budget-name' => 'Nombre de presupuesto',
+ 'column_category-id' => 'ID de categoría (coincide con Firefly)',
+ 'column_category-name' => 'Nombre de categoría',
+ 'column_currency-code' => 'Código de moneda (ISO 4217)',
+ 'column_currency-id' => 'ID de moneda (coincide con Firefly)',
+ 'column_currency-name' => 'Nombre de moneda (coincide con Firefly)',
+ 'column_currency-symbol' => 'Símbolo de moneda (coincide con Firefly)',
+ 'column_date-interest' => 'Fecha de cálculo de intereses',
+ 'column_date-book' => 'Fecha de registro de transacción',
+ 'column_date-process' => 'Fecha de proceso de transacción',
+ 'column_date-transaction' => 'Fecha',
+ 'column_description' => 'Descripción',
+ 'column_opposing-iban' => 'Cuenta opuesta (CBU)',
+ 'column_opposing-id' => 'ID de cuenta opuesta (coincide con Firefly)',
+ 'column_external-id' => 'ID externo',
+ 'column_opposing-name' => 'Cuenta opuesta (nombre)',
+ 'column_rabo-debet-credit' => 'Indicador de débito/crédito específico de Rabobank',
+ 'column_ing-debet-credit' => 'Indicador de débito/crédito específico de ING',
+ 'column_sepa-ct-id' => 'ID de transferencia de crédito end-to-end de SEPA',
+ 'column_sepa-ct-op' => 'Transferencia de crédito a cuenta opuesta SEPA',
+ 'column_sepa-db' => 'Débito directo SEPA',
+ 'column_tags-comma' => 'Etiquetas (separadas por comas)',
+ 'column_tags-space' => 'Etiquetas (separadas por espacios)',
+ 'column_account-number' => 'Caja de ahorro (número de cuenta)',
+ 'column_opposing-number' => 'Cuenta opuesta (número de cuenta)',
+];
diff --git a/resources/lang/es_ES/demo.php b/resources/lang/es_ES/demo.php
new file mode 100644
index 0000000000..e2d7695439
--- /dev/null
+++ b/resources/lang/es_ES/demo.php
@@ -0,0 +1,24 @@
+ 'Lamentablemente no hay textos de ayuda para esta página.',
+ 'see_help_icon' => 'Sin embargo, el ícono en la esquina superior-derecha puede tener más información.',
+ 'index' => '¡Bienvenido a Firefly III! En esta página tendrá una vista rápida de sus finanzas. Para más información, mire sus cuentas rarr; Asset Accounts y, claro, las páginas de presupuestos y reportes. O simplemente investigue la aplicación por su cuenta.',
+ 'accounts-index' => 'Las cajas de ahorro son sus cuentas de banco personales. Las cuentas de gastos contienen sus gastos habituales como compras y salidas con amigos. Las cuentas de ingresos repesentan ingresos de su trabajo u otras fuentes. En esta página puede editarlas o eliminarlas.',
+ '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.',
+ '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.',
+ 'import-index' => 'Of course, any CSV file can be imported into Firefly III ',
+ 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.',
+ 'import-configure-configuration' => 'The configuration you see below is correct for the local file.',
+];
diff --git a/resources/lang/es_ES/passwords.php b/resources/lang/es_ES/passwords.php
new file mode 100644
index 0000000000..1dfc1a738c
--- /dev/null
+++ b/resources/lang/es_ES/passwords.php
@@ -0,0 +1,19 @@
+ 'Las contraseñas deben tener al menos seis caracteres y coincidir entre sí.',
+ 'user' => 'No podemos encontrar un usuario con esa dirección de correo electrónico.',
+ 'token' => 'Este token para reestablecer la contraseña no es válido.',
+ 'sent' => 'Te enviamos un correo con el link para reestablecer tu contraseña!',
+ 'reset' => 'Tu contraseña fue reestablecida!',
+ 'blocked' => 'Buen intento.',
+];
diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php
new file mode 100644
index 0000000000..e5ef49397a
--- /dev/null
+++ b/resources/lang/es_ES/validation.php
@@ -0,0 +1,91 @@
+ 'This is not a valid CBU.',
+ 'unique_account_number_for_user' => 'It looks like this account number is already in use.',
+ 'deleted_user' => 'Due to security constraints, you cannot register using this email address.',
+ 'rule_trigger_value' => 'This value is invalid for the selected trigger.',
+ 'rule_action_value' => 'This value is invalid for the selected action.',
+ 'invalid_domain' => 'Due to security constraints, you cannot register from this domain.',
+ 'file_already_attached' => 'Uploaded file ":name" is already attached to this object.',
+ 'file_attached' => 'Succesfully uploaded file ":name".',
+ 'file_invalid_mime' => 'File ":name" is of type ":mime" which is not accepted as a new upload.',
+ 'file_too_large' => 'File ":name" is too large.',
+ 'belongs_to_user' => 'The value of :attribute is unknown',
+ 'accepted' => 'The :attribute must be accepted.',
+ 'bic' => 'This is not a valid BIC.',
+ 'more' => ':attribute must be larger than zero.',
+ 'active_url' => 'The :attribute is not a valid URL.',
+ 'after' => 'The :attribute must be a date after :date.',
+ 'alpha' => 'The :attribute may only contain letters.',
+ 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
+ 'alpha_num' => 'The :attribute may only contain letters and numbers.',
+ 'array' => 'The :attribute must be an array.',
+ 'unique_for_user' => 'There already is an entry with this :attribute.',
+ 'before' => 'The :attribute must be a date before :date.',
+ 'unique_object_for_user' => 'This name is already in use',
+ 'unique_account_for_user' => 'This account name is already in use',
+ 'between.numeric' => 'The :attribute must be between :min and :max.',
+ 'between.file' => 'The :attribute must be between :min and :max kilobytes.',
+ 'between.string' => 'The :attribute must be between :min and :max characters.',
+ 'between.array' => 'The :attribute must have between :min and :max items.',
+ 'boolean' => 'The :attribute field must be true or false.',
+ 'confirmed' => 'The :attribute confirmation does not match.',
+ 'date' => 'The :attribute is not a valid date.',
+ 'date_format' => 'The :attribute does not match the format :format.',
+ 'different' => 'The :attribute and :other must be different.',
+ 'digits' => 'The :attribute must be :digits digits.',
+ 'digits_between' => 'The :attribute must be between :min and :max digits.',
+ 'email' => 'The :attribute must be a valid email address.',
+ 'filled' => 'The :attribute field is required.',
+ 'exists' => 'The selected :attribute is invalid.',
+ 'image' => 'The :attribute must be an image.',
+ 'in' => 'The selected :attribute is invalid.',
+ 'integer' => 'The :attribute must be an integer.',
+ 'ip' => 'The :attribute must be a valid IP address.',
+ 'json' => 'The :attribute must be a valid JSON string.',
+ 'max.numeric' => 'The :attribute may not be greater than :max.',
+ 'max.file' => 'The :attribute may not be greater than :max kilobytes.',
+ 'max.string' => 'The :attribute may not be greater than :max characters.',
+ 'max.array' => 'The :attribute may not have more than :max items.',
+ 'mimes' => 'The :attribute must be a file of type: :values.',
+ 'min.numeric' => 'The :attribute must be at least :min.',
+ 'min.file' => 'The :attribute must be at least :min kilobytes.',
+ 'min.string' => 'The :attribute must be at least :min characters.',
+ 'min.array' => 'The :attribute must have at least :min items.',
+ 'not_in' => 'The selected :attribute is invalid.',
+ 'numeric' => 'The :attribute must be a number.',
+ 'regex' => 'The :attribute format is invalid.',
+ 'required' => 'The :attribute field is required.',
+ 'required_if' => 'The :attribute field is required when :other is :value.',
+ 'required_unless' => 'The :attribute field is required unless :other is in :values.',
+ 'required_with' => 'The :attribute field is required when :values is present.',
+ 'required_with_all' => 'The :attribute field is required when :values is present.',
+ 'required_without' => 'The :attribute field is required when :values is not present.',
+ 'required_without_all' => 'The :attribute field is required when none of :values are present.',
+ 'same' => 'The :attribute and :other must match.',
+ 'size.numeric' => 'The :attribute must be :size.',
+ 'size.file' => 'The :attribute must be :size kilobytes.',
+ 'size.string' => 'The :attribute must be :size characters.',
+ 'size.array' => 'The :attribute must contain :size items.',
+ 'unique' => 'The :attribute has already been taken.',
+ 'string' => 'The :attribute must be a string.',
+ 'url' => 'The :attribute format is invalid.',
+ 'timezone' => 'The :attribute must be a valid zone.',
+ '2fa_code' => 'The :attribute field is invalid.',
+ 'dimensions' => 'The :attribute has invalid image dimensions.',
+ 'distinct' => 'The :attribute field has a duplicate value.',
+ 'file' => 'The :attribute must be a file.',
+ 'in_array' => 'The :attribute field does not exist in :other.',
+ 'present' => 'The :attribute field must be present.',
+ 'amount_zero' => 'The total amount cannot be zero',
+];
From 0c4539e4facdc9484042b9df64d6121bd753216c Mon Sep 17 00:00:00 2001
From: James Cole
Date: Wed, 10 May 2017 20:40:31 +0200
Subject: [PATCH 007/103] New translations validation.php (Spanish)
---
resources/lang/es_ES/validation.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php
index addd0e6f39..843a9438eb 100644
--- a/resources/lang/es_ES/validation.php
+++ b/resources/lang/es_ES/validation.php
@@ -10,7 +10,7 @@
*/
return [
- 'iban' => 'This is not a valid IBAN.',
+ 'iban' => 'This is not a valid CBU.',
'unique_account_number_for_user' => 'It looks like this account number is already in use.',
'deleted_user' => 'Due to security constraints, you cannot register using this email address.',
'rule_trigger_value' => 'This value is invalid for the selected trigger.',
From 1893d1a2c20e46c14a563402f8c5e7e856c4a3e6 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Wed, 10 May 2017 20:40:37 +0200
Subject: [PATCH 008/103] New translations demo.php (Spanish)
---
resources/lang/es_ES/demo.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/resources/lang/es_ES/demo.php b/resources/lang/es_ES/demo.php
index e7f8ea934d..ed19589949 100644
--- a/resources/lang/es_ES/demo.php
+++ b/resources/lang/es_ES/demo.php
@@ -8,10 +8,10 @@
*/
return [
- 'no_demo_text' => 'Sorry, there is no extra demo-explanation text for this page.',
- 'see_help_icon' => 'However, the -icon in the top right corner may tell you more.',
- 'index' => 'Welcome to Firefly III! On this page you get a quick overview of your finances. For more information, check out Accounts → Asset Accounts and of course the Budgets and Reports pages. Or just take a look around and see where you end up.',
- '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.',
+ 'no_demo_text' => 'Lamentablemente no hay textos de ayuda para esta página.',
+ 'see_help_icon' => 'Sin embargo, el ícono en la esquina superior-derecha puede tener más información.',
+ 'index' => '¡Bienvenido a Firefly III! En esta página tendrá una vista rápida de sus finanzas. Para más información, mire sus cuentas rarr; Asset Accounts y, claro, las páginas de presupuestos y reportes. O simplemente investigue la aplicación por su cuenta.',
+ 'accounts-index' => 'Las cajas de ahorro son sus cuentas de banco personales. Las cuentas de gastos contienen sus gastos habituales como compras y salidas con amigos. Las cuentas de ingresos repesentan ingresos de su trabajo u otras fuentes. En esta página puede editarlas o eliminarlas.',
'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.',
From d449c35025397bf3be179c39e53d5f02ac53b093 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Wed, 10 May 2017 20:40:39 +0200
Subject: [PATCH 009/103] New translations passwords.php (Spanish)
---
resources/lang/es_ES/passwords.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/resources/lang/es_ES/passwords.php b/resources/lang/es_ES/passwords.php
index 2e11aa92dc..f61f371a0d 100644
--- a/resources/lang/es_ES/passwords.php
+++ b/resources/lang/es_ES/passwords.php
@@ -10,10 +10,10 @@
*/
return [
- 'password' => 'Passwords must be at least six characters and match the confirmation.',
- 'user' => 'We can\'t find a user with that e-mail address.',
- 'token' => 'This password reset token is invalid.',
- 'sent' => 'We have e-mailed your password reset link!',
- 'reset' => 'Your password has been reset!',
- 'blocked' => 'Nice try though.',
+ 'password' => 'Las contraseñas deben tener al menos seis caracteres y coincidir entre sí.',
+ 'user' => 'No podemos encontrar un usuario con esa dirección de correo electrónico.',
+ 'token' => 'Este token para reestablecer la contraseña no es válido.',
+ 'sent' => 'Te enviamos un correo con el link para reestablecer tu contraseña!',
+ 'reset' => 'Tu contraseña fue reestablecida!',
+ 'blocked' => 'Buen intento.',
];
\ No newline at end of file
From 0009f1f8656a1ca84ffb5ae3fd3e8e8cc91330e3 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Wed, 10 May 2017 20:40:41 +0200
Subject: [PATCH 010/103] New translations csv.php (Spanish)
---
resources/lang/es_ES/csv.php | 114 +++++++++++++++++------------------
1 file changed, 57 insertions(+), 57 deletions(-)
diff --git a/resources/lang/es_ES/csv.php b/resources/lang/es_ES/csv.php
index 4424610191..27143be1bc 100644
--- a/resources/lang/es_ES/csv.php
+++ b/resources/lang/es_ES/csv.php
@@ -13,68 +13,68 @@ declare(strict_types=1);
return [
- 'import_configure_title' => 'Configure your import',
- 'import_configure_intro' => 'There are some options for your CSV import. Please indicate if your CSV file contains headers on the first column, and what the date format of your date-fields is. That might require some experimentation. The field delimiter is usually a ",", but could also be a ";". Check this carefully.',
- 'import_configure_form' => 'Basic CSV import options',
- 'header_help' => 'Check this if the first row of your CSV file are the column titles',
- '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.',
- 'delimiter_help' => 'Choose the field delimiter that is used in your input file. If not sure, comma is the safest option.',
- '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.',
- 'upload_not_writeable' => 'The grey box contains a file path. It should be writeable. Please make sure it is.',
+ 'import_configure_title' => 'Configurar su importación',
+ 'import_configure_intro' => 'Hay algunas opciones para su importación desde CSV. Por facor indique si su CSV contiene encabezados en la primera fila, y cuál es el formato de fecha utilizado. ¡Puede requerir un poco de experimentación! El delimitador de campos es usualmente ",", pero también puede ser ";". Verifíquelo cuidadosamente.',
+ 'import_configure_form' => 'Opciones básicas de importación desde CSV',
+ 'header_help' => 'Marque aquí si el CSV contiene títulos de columna en la primera fila',
+ 'date_help' => 'Formato de fecha y hora en el CSV. Siga el formato que esta página indica. El valor por defecto interpretará fechas que se vean así: :dateExample.',
+ 'delimiter_help' => 'Elija el delimitador de campos del archivo de entrada. Si no está seguro, la coma es la opción más segura.',
+ 'import_account_help' => 'Si el archivo NO contiene información sobre su(s) caja(s) de ahorros seleccion una opción para definir a qué cuenta pertenecen las transacciones del CSV.',
+ 'upload_not_writeable' => 'El texto en gris indica un directorio. Debe tener permiso de escritura. Por favor verifíquelo.',
// roles
- 'column_roles_title' => 'Define column roles',
- 'column_roles_table' => 'Table',
- 'column_name' => 'Name of column',
- 'column_example' => 'Column example data',
- 'column_role' => 'Column data meaning',
- 'do_map_value' => 'Map these values',
- 'column' => 'Column',
- 'no_example_data' => 'No example data available',
- 'store_column_roles' => 'Continue import',
- 'do_not_map' => '(do not map)',
- 'map_title' => 'Connect import data to Firefly III data',
- 'map_text' => 'In the following tables, the left value shows you information found in your uploaded CSV file. It is your task to map this value, if possible, to a value already present in your database. Firefly will stick to this mapping. If there is no value to map to, or you do not wish to map the specific value, select nothing.',
+ 'column_roles_title' => 'Definir roles de las columnas',
+ 'column_roles_table' => 'Tabla',
+ 'column_name' => 'Nombre de la columna',
+ 'column_example' => 'Ejemplo de datos de columna',
+ 'column_role' => 'Significado de los datos de la columna',
+ 'do_map_value' => 'Mapear estos valores',
+ 'column' => 'Columna',
+ 'no_example_data' => 'No hay datos de ejemplo disponibles',
+ 'store_column_roles' => 'Continuar importación',
+ 'do_not_map' => '(no mapear)',
+ 'map_title' => 'Conectar datos de importación con datos de Firefly-III',
+ 'map_text' => 'En las siguientes tablas el valor de la izquierda muestra información encontrada en el CSV cargado. Es su tarea mapear este valor, si es posible, a un valor ya presente en su base de datos. Firefly respeterá este mapeo. Si no hay un valor hacia el cual mapear o no desea mapear un valor específico, no seleccione ninguno.',
- 'field_value' => 'Field value',
- 'field_mapped_to' => 'Mapped to',
- 'store_column_mapping' => 'Store mapping',
+ 'field_value' => 'Valor del campo',
+ 'field_mapped_to' => 'Mapeado a',
+ 'store_column_mapping' => 'Guardar mapeo',
// map things.
- 'column__ignore' => '(ignore this column)',
- 'column_account-iban' => 'Asset account (IBAN)',
- 'column_account-id' => 'Asset account ID (matching Firefly)',
- 'column_account-name' => 'Asset account (name)',
- 'column_amount' => 'Amount',
- 'column_amount-comma-separated' => 'Amount (comma as decimal separator)',
- 'column_bill-id' => 'Bill ID (matching Firefly)',
- 'column_bill-name' => 'Bill name',
- 'column_budget-id' => 'Budget ID (matching Firefly)',
- 'column_budget-name' => 'Budget name',
- 'column_category-id' => 'Category ID (matching Firefly)',
- 'column_category-name' => 'Category name',
- 'column_currency-code' => 'Currency code (ISO 4217)',
- 'column_currency-id' => 'Currency ID (matching Firefly)',
- 'column_currency-name' => 'Currency name (matching Firefly)',
- 'column_currency-symbol' => 'Currency symbol (matching Firefly)',
- 'column_date-interest' => 'Interest calculation date',
- 'column_date-book' => 'Transaction booking date',
- 'column_date-process' => 'Transaction process date',
- 'column_date-transaction' => 'Date',
- 'column_description' => 'Description',
- 'column_opposing-iban' => 'Opposing account (IBAN)',
- 'column_opposing-id' => 'Opposing account ID (matching Firefly)',
- 'column_external-id' => 'External ID',
- 'column_opposing-name' => 'Opposing account (name)',
- 'column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator',
- 'column_ing-debet-credit' => 'ING specific debet/credit indicator',
- 'column_sepa-ct-id' => 'SEPA Credit Transfer end-to-end ID',
- 'column_sepa-ct-op' => 'SEPA Credit Transfer opposing account',
- 'column_sepa-db' => 'SEPA Direct Debet',
- 'column_tags-comma' => 'Tags (comma separated)',
- 'column_tags-space' => 'Tags (space separated)',
- 'column_account-number' => 'Asset account (account number)',
- 'column_opposing-number' => 'Opposing account (account number)',
+ 'column__ignore' => '(ignorar esta columna)',
+ 'column_account-iban' => 'Caja de ahorro (CBU)',
+ 'column_account-id' => 'ID de la caja de ahorro (coincide con Firefly)',
+ 'column_account-name' => 'Caja de ahorro (nombre)',
+ 'column_amount' => 'Monto',
+ 'column_amount-comma-separated' => 'Monto (coma como separador de decimales)',
+ 'column_bill-id' => 'ID de factura (coincide con Firefly)',
+ 'column_bill-name' => 'Nombre de factura',
+ 'column_budget-id' => 'ID de presupuesto (coincide con Firefly)',
+ 'column_budget-name' => 'Nombre de presupuesto',
+ 'column_category-id' => 'ID de categoría (coincide con Firefly)',
+ 'column_category-name' => 'Nombre de categoría',
+ 'column_currency-code' => 'Código de moneda (ISO 4217)',
+ 'column_currency-id' => 'ID de moneda (coincide con Firefly)',
+ 'column_currency-name' => 'Nombre de moneda (coincide con Firefly)',
+ 'column_currency-symbol' => 'Símbolo de moneda (coincide con Firefly)',
+ 'column_date-interest' => 'Fecha de cálculo de intereses',
+ 'column_date-book' => 'Fecha de registro de transacción',
+ 'column_date-process' => 'Fecha de proceso de transacción',
+ 'column_date-transaction' => 'Fecha',
+ 'column_description' => 'Descripción',
+ 'column_opposing-iban' => 'Cuenta opuesta (CBU)',
+ 'column_opposing-id' => 'ID de cuenta opuesta (coincide con Firefly)',
+ 'column_external-id' => 'ID externo',
+ 'column_opposing-name' => 'Cuenta opuesta (nombre)',
+ 'column_rabo-debet-credit' => 'Indicador de débito/crédito específico de Rabobank',
+ 'column_ing-debet-credit' => 'Indicador de débito/crédito específico de ING',
+ 'column_sepa-ct-id' => 'ID de transferencia de crédito end-to-end de SEPA',
+ 'column_sepa-ct-op' => 'Transferencia de crédito a cuenta opuesta SEPA',
+ 'column_sepa-db' => 'Débito directo SEPA',
+ 'column_tags-comma' => 'Etiquetas (separadas por comas)',
+ 'column_tags-space' => 'Etiquetas (separadas por espacios)',
+ 'column_account-number' => 'Caja de ahorro (número de cuenta)',
+ 'column_opposing-number' => 'Cuenta opuesta (número de cuenta)',
];
\ No newline at end of file
From fb8638fe6a8a4a78f3209050d3693a4a833bd050 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Wed, 10 May 2017 20:40:42 +0200
Subject: [PATCH 011/103] New translations breadcrumbs.php (Spanish)
---
resources/lang/es_ES/breadcrumbs.php | 54 ++++++++++++++--------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/resources/lang/es_ES/breadcrumbs.php b/resources/lang/es_ES/breadcrumbs.php
index 6bcf9b862d..ddb5479e3f 100644
--- a/resources/lang/es_ES/breadcrumbs.php
+++ b/resources/lang/es_ES/breadcrumbs.php
@@ -11,31 +11,31 @@
*/
return [
- 'home' => 'Home',
- 'edit_currency' => 'Edit currency ":name"',
- 'delete_currency' => 'Delete currency ":name"',
- 'newPiggyBank' => 'Create a new piggy bank',
- 'edit_piggyBank' => 'Edit piggy bank ":name"',
- 'preferences' => 'Preferences',
- 'profile' => 'Profile',
- 'changePassword' => 'Change your password',
- 'bills' => 'Bills',
- 'newBill' => 'New bill',
- 'edit_bill' => 'Edit bill ":name"',
- 'delete_bill' => 'Delete bill ":name"',
- 'reports' => 'Reports',
- 'searchResult' => 'Search for ":query"',
- 'withdrawal_list' => 'Expenses',
- 'deposit_list' => 'Revenue, income and deposits',
- 'transfer_list' => 'Transfers',
- 'transfers_list' => 'Transfers',
- 'create_withdrawal' => 'Create new withdrawal',
- 'create_deposit' => 'Create new deposit',
- 'create_transfer' => 'Create new transfer',
- 'edit_journal' => 'Edit transaction ":description"',
- 'delete_journal' => 'Delete transaction ":description"',
- 'tags' => 'Tags',
- 'createTag' => 'Create new tag',
- 'edit_tag' => 'Edit tag ":tag"',
- 'delete_tag' => 'Delete tag ":tag"',
+ 'home' => 'Inicio',
+ 'edit_currency' => 'Editar moneda ":name"',
+ 'delete_currency' => 'Eliminar moneda ":name"',
+ 'newPiggyBank' => 'Crear nueva alcancía',
+ 'edit_piggyBank' => 'Editar alcancía ":name"',
+ 'preferences' => 'Preferencias',
+ 'profile' => 'Perfil',
+ 'changePassword' => 'Cambiar contraseña',
+ 'bills' => 'Facturas',
+ 'newBill' => 'Nueva factura',
+ 'edit_bill' => 'Editar factura ":name"',
+ 'delete_bill' => 'Eliminar factura ":name"',
+ 'reports' => 'Reportes',
+ 'searchResult' => 'Buscar ":query"',
+ 'withdrawal_list' => 'Expensas',
+ 'deposit_list' => 'Ganancia, ingresos y depósitos',
+ 'transfer_list' => 'Transferencias',
+ 'transfers_list' => 'Transferencias',
+ 'create_withdrawal' => 'Crear nueva extracción',
+ 'create_deposit' => 'Crear nuevo depósito',
+ 'create_transfer' => 'Crear nueva transferencia',
+ 'edit_journal' => 'Editar transacción ":description"',
+ 'delete_journal' => 'Eliminar transacción ":description"',
+ 'tags' => 'Etiquetas',
+ 'createTag' => 'Crear nueva etiqueta',
+ 'edit_tag' => 'Editar etiqueta ":tag"',
+ 'delete_tag' => 'Eliminar etiqueta ":tag"',
];
\ No newline at end of file
From a6305ddea48756c39508ab9131b53c668696fdf9 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Wed, 10 May 2017 20:40:44 +0200
Subject: [PATCH 012/103] New translations auth.php (Spanish)
---
resources/lang/es_ES/auth.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/lang/es_ES/auth.php b/resources/lang/es_ES/auth.php
index 5d833b3d68..3f4e103f18 100644
--- a/resources/lang/es_ES/auth.php
+++ b/resources/lang/es_ES/auth.php
@@ -22,7 +22,7 @@ return [
|
*/
- 'failed' => 'These credentials do not match our records.',
- 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
+ 'failed' => 'Las credenciales no coinciden con los registros.',
+ 'throttle' => 'Demasiados intentos de inicio de sesión. Por favor reintente en :seconds segundos.',
];
\ No newline at end of file
From 0f0f91237093ace58c2c04757447f810705edf74 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 12 May 2017 06:21:26 +0200
Subject: [PATCH 013/103] Partial JS focus [skip ci]
---
public/js/ff/transactions/single/create.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/public/js/ff/transactions/single/create.js b/public/js/ff/transactions/single/create.js
index 56109f855c..f74263d899 100644
--- a/public/js/ff/transactions/single/create.js
+++ b/public/js/ff/transactions/single/create.js
@@ -68,7 +68,9 @@ function updateNativeCurrency() {
$('.currency-option[data-id="' + nativeCurrencyId + '"]').click();
$('[data-toggle="dropdown"]').parent().removeClass('open');
- //$('select[name="source_account_id"]').focus();
+ if (what !== 'transfer') {
+ $('select[name="source_account_id"]').focus();
+ }
validateCurrencyForTransfer();
}
From f66286105f80c482c2792f5829d5a9afc79da1fe Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 01:20:07 +0200
Subject: [PATCH 014/103] New translations validation.php (Slovenian)
---
resources/lang/sl_SI/validation.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/validation.php b/resources/lang/sl_SI/validation.php
index 6d181ac1d6..a333e6cfb7 100644
--- a/resources/lang/sl_SI/validation.php
+++ b/resources/lang/sl_SI/validation.php
@@ -12,7 +12,7 @@
return [
'iban' => 'To ni veljaven IBAN.',
'unique_account_number_for_user' => 'Kaže, da je ta številka računa že v uporabi.',
- 'deleted_user' => 'Due to security constraints, you cannot register using this email address.',
+ 'deleted_user' => 'Iz varnostnih razlogov ne morete ustvariti uporabnika s takim e-poštnim naslovom.',
'rule_trigger_value' => 'This value is invalid for the selected trigger.',
'rule_action_value' => 'This value is invalid for the selected action.',
'invalid_domain' => 'Due to security constraints, you cannot register from this domain.',
From 9f9a3ea8fd2142c7607184b75e785c4313aac65a Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 01:20:08 +0200
Subject: [PATCH 015/103] New translations breadcrumbs.php (Slovenian)
---
resources/lang/sl_SI/breadcrumbs.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/resources/lang/sl_SI/breadcrumbs.php b/resources/lang/sl_SI/breadcrumbs.php
index 96f9298b55..051d41b74e 100644
--- a/resources/lang/sl_SI/breadcrumbs.php
+++ b/resources/lang/sl_SI/breadcrumbs.php
@@ -11,7 +11,7 @@
*/
return [
- 'home' => 'Domov',
+ 'home' => 'Prva stran',
'edit_currency' => 'uredi valuto ":name"',
'delete_currency' => 'izbriši valuto ":name"',
'newPiggyBank' => 'ustvari novega pujska',
@@ -19,10 +19,10 @@ return [
'preferences' => 'nastavitve',
'profile' => 'profil',
'changePassword' => 'spremeni geslo',
- 'bills' => 'Bills',
- 'newBill' => 'New bill',
- 'edit_bill' => 'Edit bill ":name"',
- 'delete_bill' => 'Delete bill ":name"',
+ 'bills' => 'Trajniki',
+ 'newBill' => 'nov trajnik',
+ 'edit_bill' => 'uredi trajnik ":name"',
+ 'delete_bill' => 'izbriši trajnik ":name"',
'reports' => 'Poročila',
'searchResult' => 'rezultati iskanja za ":query"',
'withdrawal_list' => 'stroški',
From 368df6694780af74d8a2d8fd313748cb22400941 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 08:40:06 +0200
Subject: [PATCH 016/103] New translations validation.php (Slovenian)
---
resources/lang/sl_SI/validation.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/validation.php b/resources/lang/sl_SI/validation.php
index a333e6cfb7..f4760a6c28 100644
--- a/resources/lang/sl_SI/validation.php
+++ b/resources/lang/sl_SI/validation.php
@@ -13,7 +13,7 @@ return [
'iban' => 'To ni veljaven IBAN.',
'unique_account_number_for_user' => 'Kaže, da je ta številka računa že v uporabi.',
'deleted_user' => 'Iz varnostnih razlogov ne morete ustvariti uporabnika s takim e-poštnim naslovom.',
- 'rule_trigger_value' => 'This value is invalid for the selected trigger.',
+ 'rule_trigger_value' => 'Ta vrednost je neveljavna za izbrani sprožilec.',
'rule_action_value' => 'This value is invalid for the selected action.',
'invalid_domain' => 'Due to security constraints, you cannot register from this domain.',
'file_already_attached' => 'Uploaded file ":name" is already attached to this object.',
From 2eafd3cc15acfd8c581fb35f6cabcc6cfcad1117 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 08:57:43 +0200
Subject: [PATCH 017/103] Should fix #644
---
app/Console/Commands/UpgradeDatabase.php | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.php
index d313c55ec6..aa2656b712 100644
--- a/app/Console/Commands/UpgradeDatabase.php
+++ b/app/Console/Commands/UpgradeDatabase.php
@@ -269,9 +269,10 @@ class UpgradeDatabase extends Command
$repository = app(CurrencyRepositoryInterface::class);
$notification = '%s #%d uses %s but should use %s. It has been updated. Please verify this in Firefly III.';
$transfer = 'Transfer #%d has been updated to use the correct currencies. Please verify this in Firefly III.';
+ $driver = DB::connection()->getDriverName();
foreach ($types as $type => $operator) {
- $set = TransactionJournal
+ $query = TransactionJournal
::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')->leftJoin(
'transactions', function (JoinClause $join) use ($operator) {
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', $operator, '0');
@@ -280,9 +281,15 @@ class UpgradeDatabase extends Command
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
->where('transaction_types.type', $type)
- ->where('account_meta.name', 'currency_id')
- ->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'))
- ->get(['transaction_journals.*', 'account_meta.data as expected_currency_id', 'transactions.amount as transaction_amount']);
+ ->where('account_meta.name', 'currency_id');
+ if($driver === 'postgresql') {
+ $query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('cast(account_meta.data as int)'));
+ }
+ if($driver !== 'postgresql') {
+ $query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'));
+ }
+
+ $set = $query->get(['transaction_journals.*', 'account_meta.data as expected_currency_id', 'transactions.amount as transaction_amount']);
/** @var TransactionJournal $journal */
foreach ($set as $journal) {
$expectedCurrency = $repository->find(intval($journal->expected_currency_id));
From 8c3871e8deb1e3ff96430a717d67e0c31c7296bc Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 09:00:09 +0200
Subject: [PATCH 018/103] New translations csv.php (Slovenian)
---
resources/lang/sl_SI/csv.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/csv.php b/resources/lang/sl_SI/csv.php
index 1fa0f9a61c..5e8b81121d 100644
--- a/resources/lang/sl_SI/csv.php
+++ b/resources/lang/sl_SI/csv.php
@@ -20,7 +20,7 @@ return [
'date_help' => 'Formatiranje datuma in časa v vaši CSV datoteki. Uporabite obliko zapisa kot je navedena na tej strani. Privzeta vrednost bo prepoznala datume, ki so videti takole:: dateExample.',
'delimiter_help' => 'Izberi ločilo, ki je uporabljeno za ločevanje med posameznimi stolpci v vaši datoteki. Če niste prepričani, je vejica najbolj pogosta izbira.',
'import_account_help' => 'Če vaša CSV datoteka ne vsebuje informacij o vaših premoženjskih računih, uporabite ta seznam, da izberete kateremu računu pripadajo transakcije v CSV datoteki.',
- 'upload_not_writeable' => 'The grey box contains a file path. It should be writeable. Please make sure it is.',
+ 'upload_not_writeable' => 'Prosim zagotovite, da ima Firefly dovoljenje za pisanje v datoteko, ki je navedena v sivem okvirčku.',
// roles
'column_roles_title' => 'doličite pomen stolpcev',
From 4410e1bbd77ee0fa421c75a2d8063b75a4e203ad Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 09:10:12 +0200
Subject: [PATCH 019/103] New translations csv.php (Slovenian)
---
resources/lang/sl_SI/csv.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/resources/lang/sl_SI/csv.php b/resources/lang/sl_SI/csv.php
index 5e8b81121d..4287a60fa8 100644
--- a/resources/lang/sl_SI/csv.php
+++ b/resources/lang/sl_SI/csv.php
@@ -34,10 +34,10 @@ return [
'store_column_roles' => 'nadaljuj z uvozom',
'do_not_map' => '(ne poveži)',
'map_title' => 'poveži podatke za uvoz s podatki iz Firefly III',
- 'map_text' => 'In the following tables, the left value shows you information found in your uploaded CSV file. It is your task to map this value, if possible, to a value already present in your database. Firefly will stick to this mapping. If there is no value to map to, or you do not wish to map the specific value, select nothing.',
+ 'map_text' => 'Vrednosti na levi v spodnji tabeli prikazujejo podatke iz naložene CSV datoteke. Vaša naloga je, da jim, če je možno, določite obtoječio vrednost iz podatkovne baze. Firefly bo to upošteval pri uvozu. Če v podatkovni bazi ni ustrezne vrednosti, ali vrednosti ne želite določiti ničesar, potem pustite prazno.',
- 'field_value' => 'Field value',
- 'field_mapped_to' => 'Mapped to',
+ 'field_value' => 'podatek',
+ 'field_mapped_to' => 'povezan z',
'store_column_mapping' => 'shrani nastavitve',
// map things.
@@ -49,7 +49,7 @@ return [
'column_account-name' => 'premoženjski račun (ime)',
'column_amount' => 'znesek',
'column_amount-comma-separated' => 'znesek (z decimalno vejico)',
- 'column_bill-id' => 'Bill ID (matching Firefly)',
+ 'column_bill-id' => 'ID trajnika (Firefly)',
'column_bill-name' => 'Bill name',
'column_budget-id' => 'ID bugžeta (Firefly)',
'column_budget-name' => 'ime budžeta',
From b263047f4e70ca3d379b7e70a69b23e00bbd8d94 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 09:20:21 +0200
Subject: [PATCH 020/103] New translations csv.php (Slovenian)
---
resources/lang/sl_SI/csv.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/lang/sl_SI/csv.php b/resources/lang/sl_SI/csv.php
index 4287a60fa8..fb4718d63d 100644
--- a/resources/lang/sl_SI/csv.php
+++ b/resources/lang/sl_SI/csv.php
@@ -50,7 +50,7 @@ return [
'column_amount' => 'znesek',
'column_amount-comma-separated' => 'znesek (z decimalno vejico)',
'column_bill-id' => 'ID trajnika (Firefly)',
- 'column_bill-name' => 'Bill name',
+ 'column_bill-name' => 'Ime trajnika',
'column_budget-id' => 'ID bugžeta (Firefly)',
'column_budget-name' => 'ime budžeta',
'column_category-id' => 'ID Kategorije (Firefly)',
@@ -59,7 +59,7 @@ return [
'column_currency-id' => 'ID valute (Firefly)',
'column_currency-name' => 'ime valute (Firefly)',
'column_currency-symbol' => 'simbol valute (Firefly)',
- 'column_date-interest' => 'Interest calculation date',
+ 'column_date-interest' => 'Datum obračuna obresti',
'column_date-book' => 'datum knjiženja transakcije',
'column_date-process' => 'datum izvedbe transakcije',
'column_date-transaction' => 'datum',
From 0d624f021b697d79763e7fb9f91b9eb034cdce98 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 09:30:23 +0200
Subject: [PATCH 021/103] New translations csv.php (Slovenian)
---
resources/lang/sl_SI/csv.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/lang/sl_SI/csv.php b/resources/lang/sl_SI/csv.php
index fb4718d63d..7afe32c5da 100644
--- a/resources/lang/sl_SI/csv.php
+++ b/resources/lang/sl_SI/csv.php
@@ -70,9 +70,9 @@ return [
'column_opposing-name' => 'ime ciljnega računa',
'column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator',
'column_ing-debet-credit' => 'ING specific debet/credit indicator',
- 'column_sepa-ct-id' => 'SEPA Credit Transfer end-to-end ID',
- 'column_sepa-ct-op' => 'SEPA Credit Transfer opposing account',
- 'column_sepa-db' => 'SEPA Direct Debet',
+ 'column_sepa-ct-id' => 'SEPA številka transakcije',
+ 'column_sepa-ct-op' => 'SEPA protiračun',
+ 'column_sepa-db' => 'SEPA direktna obremenitev',
'column_tags-comma' => 'značke (ločene z vejicami)',
'column_tags-space' => 'značke (ločene s presledki)',
'column_account-number' => 'premoženjski račun (številka računa)',
From 0eb56537132fea9de7b4823ff5a3ed45c2498458 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 10:00:08 +0200
Subject: [PATCH 022/103] New translations csv.php (Slovenian)
---
resources/lang/sl_SI/csv.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/lang/sl_SI/csv.php b/resources/lang/sl_SI/csv.php
index 7afe32c5da..6f5ca5cac9 100644
--- a/resources/lang/sl_SI/csv.php
+++ b/resources/lang/sl_SI/csv.php
@@ -68,8 +68,8 @@ return [
'column_opposing-id' => 'protiračun (firefly)',
'column_external-id' => 'zunanja ID številka',
'column_opposing-name' => 'ime ciljnega računa',
- 'column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator',
- 'column_ing-debet-credit' => 'ING specific debet/credit indicator',
+ 'column_rabo-debet-credit' => 'Poseben indikator za Rabobank',
+ 'column_ing-debet-credit' => 'Poseben indikator za banko ING',
'column_sepa-ct-id' => 'SEPA številka transakcije',
'column_sepa-ct-op' => 'SEPA protiračun',
'column_sepa-db' => 'SEPA direktna obremenitev',
From 613eb7522c494c4b8218037a90596cd53b6ad9ad Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 10:00:10 +0200
Subject: [PATCH 023/103] New translations pagination.php (Slovenian)
---
resources/lang/sl_SI/pagination.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/pagination.php b/resources/lang/sl_SI/pagination.php
index 4eeab21dee..a6dd04e76c 100644
--- a/resources/lang/sl_SI/pagination.php
+++ b/resources/lang/sl_SI/pagination.php
@@ -11,7 +11,7 @@
return [
- 'previous' => '« Previous',
+ 'previous' => '« Prejšnja stran',
'next' => 'Next »',
];
\ No newline at end of file
From 79154bba25cfeb2232d3d4f5cd0df488b691c4f9 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 10:10:06 +0200
Subject: [PATCH 024/103] New translations pagination.php (Slovenian)
---
resources/lang/sl_SI/pagination.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/pagination.php b/resources/lang/sl_SI/pagination.php
index a6dd04e76c..943de4aa40 100644
--- a/resources/lang/sl_SI/pagination.php
+++ b/resources/lang/sl_SI/pagination.php
@@ -12,6 +12,6 @@
return [
'previous' => '« Prejšnja stran',
- 'next' => 'Next »',
+ 'next' => 'Naslednja stran »',
];
\ No newline at end of file
From e072f8350736d786bca3aa0ce840d6e59effc5fe Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 14 May 2017 10:10:08 +0200
Subject: [PATCH 025/103] New translations list.php (Slovenian)
---
resources/lang/sl_SI/list.php | 38 +++++++++++++++++------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php
index 90625d54e6..88a8d15cef 100644
--- a/resources/lang/sl_SI/list.php
+++ b/resources/lang/sl_SI/list.php
@@ -10,29 +10,29 @@
*/
return [
- 'buttons' => 'Buttons',
- 'icon' => 'Icon',
+ 'buttons' => 'Gumbi',
+ 'icon' => 'Ikona',
'id' => 'ID',
- 'create_date' => 'Created at',
- 'update_date' => 'Updated at',
- 'balance_before' => 'Balance before',
- 'balance_after' => 'Balance after',
- 'name' => 'Name',
- 'role' => 'Role',
- 'currentBalance' => 'Current balance',
- 'active' => 'Is active?',
- 'lastActivity' => 'Last activity',
- 'balanceDiff' => 'Balance difference between :start and :end',
+ 'create_date' => 'Ustvarjeno',
+ 'update_date' => 'Posodobljeno',
+ 'balance_before' => 'Stanje prej',
+ 'balance_after' => 'Stanje potem',
+ 'name' => 'ime',
+ 'role' => 'vloga',
+ 'currentBalance' => 'trenutno stanje',
+ 'active' => 'Aktiviran?',
+ 'lastActivity' => 'zadnja aktivnost',
+ 'balanceDiff' => 'Razlika stanja med :start in :end',
'matchedOn' => 'Matched on',
'matchesOn' => 'Matched on',
- 'account_type' => 'Account type',
- 'created_at' => 'Created at',
- 'new_balance' => 'New balance',
- 'account' => 'Account',
- 'matchingAmount' => 'Amount',
+ 'account_type' => 'vrsta računa',
+ 'created_at' => 'ustvarjeno',
+ 'new_balance' => 'novo stanje',
+ 'account' => 'račun',
+ 'matchingAmount' => 'znesek',
'lastMatch' => 'Last match',
- 'split_number' => 'Split #',
- 'destination' => 'Destination',
+ 'split_number' => 'Delitev #',
+ 'destination' => 'Ciljni račun',
'source' => 'Source',
'next_expected_match' => 'Next expected match',
'automatch' => 'Auto match?',
From b995a1d0918dcf790cb57e515a440f93f5670e63 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 15 May 2017 08:50:08 +0200
Subject: [PATCH 026/103] New translations list.php (Slovenian)
---
resources/lang/sl_SI/list.php | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php
index 88a8d15cef..10c62690d3 100644
--- a/resources/lang/sl_SI/list.php
+++ b/resources/lang/sl_SI/list.php
@@ -23,26 +23,26 @@ return [
'active' => 'Aktiviran?',
'lastActivity' => 'zadnja aktivnost',
'balanceDiff' => 'Razlika stanja med :start in :end',
- 'matchedOn' => 'Matched on',
- 'matchesOn' => 'Matched on',
+ 'matchedOn' => 'Povezano',
+ 'matchesOn' => 'Povezano',
'account_type' => 'vrsta računa',
'created_at' => 'ustvarjeno',
'new_balance' => 'novo stanje',
'account' => 'račun',
'matchingAmount' => 'znesek',
- 'lastMatch' => 'Last match',
+ 'lastMatch' => 'Nazadnje povezano',
'split_number' => 'Delitev #',
'destination' => 'Ciljni račun',
- 'source' => 'Source',
- 'next_expected_match' => 'Next expected match',
- 'automatch' => 'Auto match?',
- 'repeat_freq' => 'Repeats',
- 'description' => 'Description',
- 'amount' => 'Amount',
+ 'source' => 'Izvor',
+ 'next_expected_match' => 'Naslenje pričakovano ujemanje',
+ 'automatch' => 'Samodejno poveži?',
+ 'repeat_freq' => 'Ponovitev',
+ 'description' => 'Opis',
+ 'amount' => 'Znesek',
'internal_reference' => 'Internal reference',
- 'date' => 'Date',
- 'interest_date' => 'Interest date',
- 'book_date' => 'Book date',
+ 'date' => 'datum',
+ 'interest_date' => 'datum obresti',
+ 'book_date' => 'datum knjiženja',
'process_date' => 'Processing date',
'due_date' => 'Due date',
'payment_date' => 'Payment date',
From 438ce5c3db092e5867aea1bb5282bee540e46740 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 15 May 2017 09:00:35 +0200
Subject: [PATCH 027/103] New translations list.php (Slovenian)
---
resources/lang/sl_SI/list.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php
index 10c62690d3..0b17aa148c 100644
--- a/resources/lang/sl_SI/list.php
+++ b/resources/lang/sl_SI/list.php
@@ -43,8 +43,8 @@ return [
'date' => 'datum',
'interest_date' => 'datum obresti',
'book_date' => 'datum knjiženja',
- 'process_date' => 'Processing date',
- 'due_date' => 'Due date',
+ 'process_date' => 'datum izvedbe',
+ 'due_date' => 'rok plačila',
'payment_date' => 'Payment date',
'invoice_date' => 'Invoice date',
'interal_reference' => 'Internal reference',
From f1028dbaed3059d75d65dc76576fbca1d3b205c8 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 15 May 2017 09:10:14 +0200
Subject: [PATCH 028/103] New translations list.php (Slovenian)
---
resources/lang/sl_SI/list.php | 44 +++++++++++++++++------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php
index 0b17aa148c..0537531876 100644
--- a/resources/lang/sl_SI/list.php
+++ b/resources/lang/sl_SI/list.php
@@ -39,34 +39,34 @@ return [
'repeat_freq' => 'Ponovitev',
'description' => 'Opis',
'amount' => 'Znesek',
- 'internal_reference' => 'Internal reference',
+ 'internal_reference' => 'Notranji sklic',
'date' => 'datum',
'interest_date' => 'datum obresti',
'book_date' => 'datum knjiženja',
'process_date' => 'datum izvedbe',
'due_date' => 'rok plačila',
- 'payment_date' => 'Payment date',
- 'invoice_date' => 'Invoice date',
- 'interal_reference' => 'Internal reference',
- 'notes' => 'Notes',
- 'from' => 'From',
- 'piggy_bank' => 'Piggy bank',
- 'to' => 'To',
- 'budget' => 'Budget',
- 'category' => 'Category',
- 'bill' => 'Bill',
- 'withdrawal' => 'Withdrawal',
- 'deposit' => 'Deposit',
- 'transfer' => 'Transfer',
- 'type' => 'Type',
- 'completed' => 'Completed',
+ 'payment_date' => 'Datum plačila',
+ 'invoice_date' => 'datum računa',
+ 'interal_reference' => 'Notranji sklic',
+ 'notes' => 'Zabeležke',
+ 'from' => 'Pošiljatelj',
+ 'piggy_bank' => 'Pujsek',
+ 'to' => 'Prejemnik',
+ 'budget' => 'Budžet',
+ 'category' => 'Kategorija',
+ 'bill' => 'Trajnik',
+ 'withdrawal' => 'Odhodek',
+ 'deposit' => 'Prihodek',
+ 'transfer' => 'Prenos',
+ 'type' => 'Vrsta',
+ 'completed' => 'Dokončano',
'iban' => 'IBAN',
- 'paid_current_period' => 'Paid this period',
- 'email' => 'Email',
- 'registered_at' => 'Registered at',
- 'is_activated' => 'Is activated',
- 'is_blocked' => 'Is blocked',
- 'is_admin' => 'Is admin',
+ 'paid_current_period' => 'Plačano v tem obdobju',
+ 'email' => 'E-pošta',
+ 'registered_at' => 'Registriran pri',
+ 'is_activated' => 'Je v uporabi',
+ 'is_blocked' => 'Je blokiran',
+ 'is_admin' => 'Je administrator',
'has_two_factor' => 'Has 2FA',
'confirmed_from' => 'Confirmed from',
'registered_from' => 'Registered from',
From a102f7044e44e8484fb1fb7dd8e9787a2d50d788 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 15 May 2017 09:20:09 +0200
Subject: [PATCH 029/103] New translations list.php (Slovenian)
---
resources/lang/sl_SI/list.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php
index 0537531876..35b6fc1a5c 100644
--- a/resources/lang/sl_SI/list.php
+++ b/resources/lang/sl_SI/list.php
@@ -64,11 +64,11 @@ return [
'paid_current_period' => 'Plačano v tem obdobju',
'email' => 'E-pošta',
'registered_at' => 'Registriran pri',
- 'is_activated' => 'Je v uporabi',
+ 'is_activated' => 'Je aktiviran',
'is_blocked' => 'Je blokiran',
'is_admin' => 'Je administrator',
- 'has_two_factor' => 'Has 2FA',
- 'confirmed_from' => 'Confirmed from',
+ 'has_two_factor' => 'Ima dvostopenjsko overovitev',
+ 'confirmed_from' => 'Potrjen od',
'registered_from' => 'Registered from',
'blocked_code' => 'Block code',
'domain' => 'Domain',
From 98bb0731df533f5882a8a55a0ccb61c1f5585d7a Mon Sep 17 00:00:00 2001
From: James Cole
Date: Tue, 16 May 2017 15:10:12 +0200
Subject: [PATCH 030/103] New translations list.php (Slovenian)
---
resources/lang/sl_SI/list.php | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php
index 35b6fc1a5c..a5812ba409 100644
--- a/resources/lang/sl_SI/list.php
+++ b/resources/lang/sl_SI/list.php
@@ -69,21 +69,21 @@ return [
'is_admin' => 'Je administrator',
'has_two_factor' => 'Ima dvostopenjsko overovitev',
'confirmed_from' => 'Potrjen od',
- 'registered_from' => 'Registered from',
- 'blocked_code' => 'Block code',
- 'domain' => 'Domain',
- 'registration_attempts' => 'Registration attempts',
- 'source_account' => 'Source account',
- 'destination_account' => 'Destination account',
+ 'registered_from' => 'Registriran',
+ 'blocked_code' => 'Koda vzroka blokade',
+ 'domain' => 'Domena',
+ 'registration_attempts' => 'Poskusov registriranja',
+ 'source_account' => 'Izvorni račun',
+ 'destination_account' => 'Ciljni račun',
- 'accounts_count' => 'Number of accounts',
- 'journals_count' => 'Number of transactions',
- 'attachments_count' => 'Number of attachments',
- 'bills_count' => 'Number of bills',
- 'categories_count' => 'Number of categories',
- 'export_jobs_count' => 'Number of export jobs',
- 'import_jobs_count' => 'Number of import jobs',
- 'budget_count' => 'Number of budgets',
- 'rule_and_groups_count' => 'Number of rules and rule groups',
- 'tags_count' => 'Number of tags',
+ 'accounts_count' => 'Število računov',
+ 'journals_count' => 'Število transakcij',
+ 'attachments_count' => 'Število prilog',
+ 'bills_count' => 'Število trajnikov',
+ 'categories_count' => 'Število kategorij',
+ 'export_jobs_count' => 'Število izvozov',
+ 'import_jobs_count' => 'Število uvozov',
+ 'budget_count' => 'Število budžetov',
+ 'rule_and_groups_count' => 'Število pravil in skupin pravil',
+ 'tags_count' => 'Število značk',
];
\ No newline at end of file
From 6b3b19632ac09486ec9c29ee70a7793a69010b5f Mon Sep 17 00:00:00 2001
From: James Cole
Date: Tue, 16 May 2017 15:10:15 +0200
Subject: [PATCH 031/103] New translations help.php (Slovenian)
---
resources/lang/sl_SI/help.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/help.php b/resources/lang/sl_SI/help.php
index 61210ffe41..a411c5d146 100644
--- a/resources/lang/sl_SI/help.php
+++ b/resources/lang/sl_SI/help.php
@@ -12,7 +12,7 @@
return [
// tour!
- 'main-content-title' => 'Welcome to Firefly III',
+ 'main-content-title' => 'Dobrodošli na Firefly III',
'main-content-text' => 'Do yourself a favor and follow this short guide to make sure you know your way around.',
'sidebar-toggle-title' => 'Sidebar to create stuff',
'sidebar-toggle-text' => 'Hidden under the plus icon are all the buttons to create new stuff. Accounts, transactions, everything!',
From 2a7ba1893acc53a38a02047f97106afda9abfc3d Mon Sep 17 00:00:00 2001
From: James Cole
Date: Tue, 16 May 2017 15:10:18 +0200
Subject: [PATCH 032/103] New translations form.php (Slovenian)
---
resources/lang/sl_SI/form.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/sl_SI/form.php b/resources/lang/sl_SI/form.php
index 300054df31..4c24c5c20b 100644
--- a/resources/lang/sl_SI/form.php
+++ b/resources/lang/sl_SI/form.php
@@ -12,7 +12,7 @@
return [
// new user:
- 'bank_name' => 'Bank name',
+ 'bank_name' => 'Naziv banke',
'bank_balance' => 'Balance',
'savings_balance' => 'Savings balance',
'credit_card_limit' => 'Credit card limit',
From ded0df93032389e025d0c08eb53a705d1b6e06eb Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:00:06 +0200
Subject: [PATCH 033/103] New translations config.php (Spanish)
---
resources/lang/es_ES/config.php | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 resources/lang/es_ES/config.php
diff --git a/resources/lang/es_ES/config.php b/resources/lang/es_ES/config.php
new file mode 100644
index 0000000000..9067645275
--- /dev/null
+++ b/resources/lang/es_ES/config.php
@@ -0,0 +1,23 @@
+ 'es, Spanish, es_ES, es_ES.utf8, es_ES.UTF-8',
+ 'month' => '%B %Y',
+ 'month_and_day' => '%B %e, %Y',
+ 'date_time' => '%B %e, %Y, @ %T',
+ 'specific_day' => '%e %B %Y',
+ 'week_in_year' => 'Semana %W, %Y',
+ 'quarter_of_year' => '%B %Y',
+ 'year' => '%Y',
+ 'half_year' => '%B %Y',
+
+];
\ No newline at end of file
From 1f41f27e89092ca418da398d2fbe489f784061dd Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:00:11 +0200
Subject: [PATCH 034/103] New translations breadcrumbs.php (Spanish)
---
resources/lang/es_ES/breadcrumbs.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/lang/es_ES/breadcrumbs.php b/resources/lang/es_ES/breadcrumbs.php
index 211e6a3037..91d26f164b 100644
--- a/resources/lang/es_ES/breadcrumbs.php
+++ b/resources/lang/es_ES/breadcrumbs.php
@@ -25,11 +25,11 @@ return [
'delete_bill' => 'Eliminar factura ":name"',
'reports' => 'Reportes',
'searchResult' => 'Buscar ":query"',
- 'withdrawal_list' => 'Expensas',
+ 'withdrawal_list' => 'Gastos',
'deposit_list' => 'Ganancia, ingresos y depósitos',
'transfer_list' => 'Transferencias',
'transfers_list' => 'Transferencias',
- 'create_withdrawal' => 'Crear nueva extracción',
+ 'create_withdrawal' => 'Crear nuevo retiro',
'create_deposit' => 'Crear nuevo depósito',
'create_transfer' => 'Crear nueva transferencia',
'edit_journal' => 'Editar transacción ":description"',
@@ -38,4 +38,4 @@ return [
'createTag' => 'Crear nueva etiqueta',
'edit_tag' => 'Editar etiqueta ":tag"',
'delete_tag' => 'Eliminar etiqueta ":tag"',
-];
+];
\ No newline at end of file
From 0608fd77323c4195e6bd2d1d414d635fa29cfc78 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:10:06 +0200
Subject: [PATCH 035/103] New translations demo.php (Spanish)
---
resources/lang/es_ES/demo.php | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/resources/lang/es_ES/demo.php b/resources/lang/es_ES/demo.php
index e2d7695439..57bb9cdcb0 100644
--- a/resources/lang/es_ES/demo.php
+++ b/resources/lang/es_ES/demo.php
@@ -12,13 +12,13 @@ return [
'see_help_icon' => 'Sin embargo, el ícono en la esquina superior-derecha puede tener más información.',
'index' => '¡Bienvenido a Firefly III! En esta página tendrá una vista rápida de sus finanzas. Para más información, mire sus cuentas rarr; Asset Accounts y, claro, las páginas de presupuestos y reportes. O simplemente investigue la aplicación por su cuenta.',
'accounts-index' => 'Las cajas de ahorro son sus cuentas de banco personales. Las cuentas de gastos contienen sus gastos habituales como compras y salidas con amigos. Las cuentas de ingresos repesentan ingresos de su trabajo u otras fuentes. En esta página puede editarlas o eliminarlas.',
- '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' => 'Esta página le muestra una visión general de sus presupuestos. La barra superior muestra la cantidad que está disponible para ser presupuestado. Esto se puede personalizar para cualquier período haciendo clic en la cantidad a la derecha. La cantidad que has gastado hasta ahora se muestra en la barra de abajo. Debajo están los gastos por presupuesto y lo que ha presupuestado para ellos.',
+ 'reports-index-start' => 'Firefly III admite cuatro tipos de informes. Lea sobre ellos haciendo clic en el icono en la esquina superior derecha.',
'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.',
+ 'currencies-index' => 'Firefly III admite múltiples monedas. A pesar de que la moneda por defecto es el Euro, se puede seleccionar el Dólar de EE.UU, y muchas otras monedas. Como se puede ver se ha incluido una pequeña selección de monedas, pero puedes agregar tu propia moneda si lo deseas. Sin embargo, cambiar la moneda predeterminada no cambiará la moneda de las transacciones existentes: Firefly III admite el uso de varias monedas al mismo tiempo.',
+ 'transactions-index' => 'Estos gastos, depósitos y transferencias no son particularmente imaginativos. Se han generado automáticamente.',
+ 'piggy-banks-index' => 'Como puede ver, hay tres alcancías. Utilice los botones más y menos para influir en la cantidad de dinero en cada alcancía. Haga clic en el nombre de la alcancía para ver la administración de cada una.',
'import-index' => 'Of course, any CSV file can be imported into Firefly III ',
'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.',
- 'import-configure-configuration' => 'The configuration you see below is correct for the local file.',
-];
+ 'import-configure-configuration' => 'La configuración que ves a continuación es correcta para el archivo local.',
+];
\ No newline at end of file
From 3eba3167fd3f9bf23cb7da2544088051ce23f9d7 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:20:07 +0200
Subject: [PATCH 036/103] New translations firefly.php (Spanish)
---
resources/lang/es_ES/firefly.php | 1063 ++++++++++++++++++++++++++++++
1 file changed, 1063 insertions(+)
create mode 100644 resources/lang/es_ES/firefly.php
diff --git a/resources/lang/es_ES/firefly.php b/resources/lang/es_ES/firefly.php
new file mode 100644
index 0000000000..0c136971fd
--- /dev/null
+++ b/resources/lang/es_ES/firefly.php
@@ -0,0 +1,1063 @@
+ 'traducción incompleta',
+ 'close' => 'Cerrar',
+ 'actions' => 'Acciones',
+ 'edit' => 'Editar',
+ 'delete' => 'Eliminar',
+ 'welcomeBack' => '¿Qué está tocando?',
+ 'everything' => 'Todo',
+ 'customRange' => 'Rango personalizado',
+ 'apply' => 'Aplicar',
+ 'cancel' => 'Cancelar',
+ 'from' => 'Desde',
+ 'to' => 'Hasta',
+ 'showEverything' => 'Mostrar todo',
+ 'never' => 'Nunca',
+ 'search_results_for' => 'Resultados de la búsqueda para %{query}',
+ 'advanced_search' => 'Búsqueda avanzada',
+ 'advanced_search_intro' => 'Hay varios modificadores que puedes utilizar en tu búsqueda para acotar los resultados. Si usas alguna de estas, la búsqueda regresará sólo las transacciones. Por favor, has clic en el -icono para obtener más información.',
+ 'bounced_error' => 'El mensaje enviado al: correo electrónico no ha sido recibido, así que no hay acceso para usted.',
+ 'deleted_error' => 'Las credenciales no coinciden con los registros.',
+ 'general_blocked_error' => 'Tu cuenta ha sido creada. Ahora puedes iniciar sesión.',
+ 'expired_error' => 'Su cuenta ha caducado y ya no puede ser utilizado.',
+ 'removed_amount' => 'Eliminado: cantidad',
+ 'added_amount' => 'Agregado: cantidad',
+ 'asset_account_role_help' => 'Las opciones extras como resultado de su elección se pueden establecer más tarde.',
+ 'Opening balance' => 'Balance inicial',
+ 'create_new_stuff' => 'Crear nueva etiqueta',
+ 'new_withdrawal' => 'Nuevo retiro',
+ 'new_deposit' => 'Nuevo depósito',
+ 'new_transfer' => 'Nueva transferencia',
+ 'new_asset_account' => 'Nueva cuenta de activo',
+ 'new_expense_account' => 'Nueva cuenta de gastos',
+ 'new_revenue_account' => 'Nueva cuenta de ingresos',
+ 'new_budget' => 'Nuevo presupuesto',
+ 'new_bill' => 'Nueva factura',
+ 'block_account_logout' => 'Tu sesión ha sido cerrada. Las cuentas bloqueadas no pueden utilizar este sitio. ¿Registrarte con una dirección válida de correo electrónico?',
+ 'flash_success' => '¡Operación correcta!',
+ 'flash_info' => 'Mensaje',
+ 'flash_warning' => '¡Atención!',
+ 'flash_error' => '¡Error!',
+ 'flash_info_multiple' => 'Hay un mensaje | Hay: mensajes de la cuenta',
+ 'flash_error_multiple' => 'Hay un error | Hay: contar errores',
+ 'net_worth' => 'Valor Neto',
+ 'route_has_no_help' => 'There is no help for this route.',
+ 'help_may_not_be_your_language' => 'This help text is in English. It is not yet available in your language',
+ 'two_factor_welcome' => 'Hello, :user!',
+ 'two_factor_enter_code' => 'To continue, please enter your two factor authentication code. Your application can generate it for you.',
+ 'two_factor_code_here' => 'Enter code here',
+ 'two_factor_title' => 'Two factor authentication',
+ 'authenticate' => 'Authenticate',
+ 'two_factor_forgot_title' => 'Lost two factor authentication',
+ 'two_factor_forgot' => 'I forgot my two-factor thing.',
+ 'two_factor_lost_header' => 'Lost your two factor authentication?',
+ 'two_factor_lost_intro' => 'Unfortunately, this is not something you can reset from the web interface. You have two choices.',
+ 'two_factor_lost_fix_self' => 'If you run your own instance of Firefly III, check the logs in storage/logs for instructions.',
+ 'two_factor_lost_fix_owner' => 'Otherwise, email the site owner, :site_owner and ask them to reset your two factor authentication.',
+ 'warning_much_data' => ':days days of data may take a while to load.',
+ 'registered' => 'You have registered successfully!',
+ 'search' => 'Search',
+ 'search_found_accounts' => 'Found :count account(s) for your query.',
+ 'search_found_categories' => 'Found :count category(ies) for your query.',
+ 'search_found_budgets' => 'Found :count budget(s) for your query.',
+ 'search_found_tags' => 'Found :count tag(s) for your query.',
+ 'search_found_transactions' => 'Found :count transaction(s) for your query.',
+ 'results_limited' => 'The results are limited to :count entries.',
+ 'tagbalancingAct' => 'Balancing act',
+ 'tagadvancePayment' => 'Advance payment',
+ 'tagnothing' => '',
+ 'Default asset account' => 'Default asset account',
+ 'no_budget_pointer' => 'You seem to have no budgets yet. You should create some on the budgets-page. Budgets can help you keep track of expenses.',
+ 'Savings account' => 'Savings account',
+ 'Credit card' => 'Credit card',
+ 'source_accounts' => 'Source account(s)',
+ 'destination_accounts' => 'Destination account(s)',
+ 'user_id_is' => 'Your user id is :user',
+ 'field_supports_markdown' => 'This field supports Markdown.',
+ 'need_more_help' => 'If you need more help using Firefly III, please open a ticket on Github.',
+ 'nothing_to_display' => 'There are no transactions to show you',
+ 'show_all_no_filter' => 'Show all transactions without grouping them by date.',
+ 'expenses_by_category' => 'Expenses by category',
+ 'expenses_by_budget' => 'Expenses by budget',
+ 'income_by_category' => 'Income by category',
+ 'expenses_by_asset_account' => 'Expenses by asset account',
+ 'expenses_by_expense_account' => 'Expenses by expense account',
+ 'cannot_redirect_to_account' => 'Firefly III cannot redirect you to the correct page. Apologies.',
+ 'sum_of_expenses' => 'Sum of expenses',
+ 'sum_of_income' => 'Sum of income',
+ 'total_sum' => 'Total sum',
+ 'spent_in_specific_budget' => 'Spent in budget ":budget"',
+ 'sum_of_expenses_in_budget' => 'Spent total in budget ":budget"',
+ 'left_in_budget_limit' => 'Left to spend according to budgeting',
+ 'cannot_change_demo' => 'You cannot change the password of the demonstration account.',
+ 'cannot_delete_demo' => 'You cannot remove the demonstration account.',
+ 'cannot_reset_demo_user' => 'You cannot reset the password of the demonstration account',
+ 'per_period' => 'Per period',
+ 'all_periods' => 'All periods',
+ 'current_period' => 'Current period',
+ 'show_the_current_period_and_overview' => 'Show the current period and overview',
+ 'pref_languages_locale' => 'For a language other than English to work properly, your operating system must be equipped with the correct locale-information. If these are not present, currency data, dates and amounts may be formatted wrong.',
+ '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_breadcrumb' => 'Between :start and :end',
+ 'clone_withdrawal' => 'Clone this withdrawal',
+ 'clone_deposit' => 'Clone this deposit',
+ 'clone_transfer' => 'Clone this transfer',
+ 'transaction_journal_other_options' => 'Other options',
+ 'multi_select_no_selection' => 'None selected',
+ 'multi_select_all_selected' => 'All selected',
+ 'multi_select_filter_placeholder' => 'Find..',
+ 'between_dates_breadcrumb' => 'Between :start and :end',
+ 'all_journals_without_budget' => 'All transactions without a budget',
+ 'journals_without_budget' => 'Transactions without a budget',
+ 'all_journals_without_category' => 'All transactions without a category',
+ 'journals_without_category' => 'Transactions without a category',
+ 'all_journals_for_account' => 'All transactions for account :name',
+ 'chart_all_journals_for_account' => 'Chart of all transactions for account :name',
+ 'journals_in_period_for_account' => 'All transactions for account :name between :start and :end',
+ 'transferred' => 'Transferred',
+ 'all_withdrawal' => 'All expenses',
+ 'all_transactions' => 'All transactions',
+ 'title_withdrawal_between' => 'All expenses between :start and :end',
+ 'all_deposit' => 'All revenue',
+ 'title_deposit_between' => 'All revenue between :start and :end',
+ 'all_transfers' => 'All transfers',
+ 'title_transfers_between' => 'All transfers between :start and :end',
+ 'all_transfer' => 'All transfers',
+ 'all_journals_for_tag' => 'All transactions for tag ":tag"',
+ 'title_transfer_between' => 'All transfers between :start and :end',
+ 'all_journals_for_category' => 'All transactions for category :name',
+ 'all_journals_for_budget' => 'All transactions for budget :name',
+ 'chart_all_journals_for_budget' => 'Chart of all transactions for budget :name',
+ 'journals_in_period_for_category' => 'All transactions for category :name between :start and :end',
+ 'journals_in_period_for_tag' => 'All transactions for tag :tag between :start and :end',
+ 'not_available_demo_user' => 'The feature you try to access is not available to demo users.',
+ 'exchange_rate_instructions' => 'Asset account "@name" only accepts transactions in @native_currency. If you wish to use @foreign_currency instead, make sure that the amount in @native_currency is known as well:',
+ 'transfer_exchange_rate_instructions' => 'Source asset account "@source_name" only accepts transactions in @source_currency. Destination asset account "@dest_name" only accepts transactions in @dest_currency. You must provide the transferred amount correctly in both currencies.',
+
+ // repeat frequencies:
+ 'repeat_freq_yearly' => 'yearly',
+ 'repeat_freq_monthly' => 'monthly',
+ 'weekly' => 'weekly',
+ 'quarterly' => 'quarterly',
+ 'half-year' => 'every half year',
+ 'yearly' => 'yearly',
+ // account confirmation:
+ 'confirm_account_header' => 'Please confirm your account',
+ 'confirm_account_intro' => 'An email has been sent to the address you used during your registration. Please check it out for further instructions. If you did not get this message, you can have Firefly send it again.',
+ 'confirm_account_resend_email' => 'Send me the confirmation message I need to activate my account.',
+ 'account_is_confirmed' => 'Your account has been confirmed!',
+ 'invalid_activation_code' => 'It seems the code you are using is not valid, or has expired.',
+ 'confirm_account_is_resent_header' => 'The confirmation has been resent',
+ 'confirm_account_is_resent_text' => 'The confirmation message has been resent. If you still did not receive the confirmation message, please contact the site owner at :owner or check the log files to see what went wrong.',
+ 'confirm_account_is_resent_go_home' => 'Go to the index page of Firefly',
+ 'confirm_account_not_resent_header' => 'Something went wrong :(',
+ 'confirm_account_not_resent_intro' => 'The confirmation message has been not resent. If you still did not receive the confirmation message, please contact the site owner at :owner instead. Possibly, you have tried to resend the activation message too often. You can have Firefly III try to resend the confirmation message every hour.',
+ 'confirm_account_not_resent_go_home' => 'Go to the index page of Firefly',
+
+ // export data:
+ 'import_and_export' => 'Import and export',
+ 'export_data' => 'Export data',
+ 'export_data_intro' => 'For backup purposes, when migrating to another system or when migrating to another Firefly III installation.',
+ 'export_format' => 'Export format',
+ 'export_format_csv' => 'Comma separated values (CSV file)',
+ 'export_format_mt940' => 'MT940 compatible format',
+ 'export_included_accounts' => 'Export transactions from these accounts',
+ 'include_old_uploads_help' => 'Firefly III does not throw away the original CSV files you have imported in the past. You can include them in your export.',
+ 'do_export' => 'Export',
+ 'export_status_never_started' => 'The export has not started yet',
+ 'export_status_make_exporter' => 'Creating exporter thing...',
+ 'export_status_collecting_journals' => 'Collecting your transactions...',
+ 'export_status_collected_journals' => 'Collected your transactions!',
+ 'export_status_converting_to_export_format' => 'Converting your transactions...',
+ 'export_status_converted_to_export_format' => 'Converted your transactions!',
+ 'export_status_creating_journal_file' => 'Creating the export file...',
+ 'export_status_created_journal_file' => 'Created the export file!',
+ 'export_status_collecting_attachments' => 'Collecting all your attachments...',
+ 'export_status_collected_attachments' => 'Collected all your attachments!',
+ 'export_status_collecting_old_uploads' => 'Collecting all your previous uploads...',
+ 'export_status_collected_old_uploads' => 'Collected all your previous uploads!',
+ 'export_status_creating_config_file' => 'Creating a configuration file...',
+ 'export_status_created_config_file' => 'Created a configuration file!',
+ 'export_status_creating_zip_file' => 'Creating a zip file...',
+ 'export_status_created_zip_file' => 'Created a zip file!',
+ 'export_status_finished' => 'Export has succesfully finished! Yay!',
+ 'export_data_please_wait' => 'Please wait...',
+ 'attachment_explanation' => 'The file called \':attachment_name\' (#:attachment_id) was originally uploaded to :type \':description\' (#:journal_id) dated :date for the amount of :amount.',
+
+ // rules
+ 'rules' => 'Rules',
+ 'rules_explanation' => 'Here you can manage rules. Rules are triggered when a transaction is created or updated. Then, if the transaction has certain properties (called "triggers") Firefly will execute the "actions". Combined, you can make Firefly respond in a certain way to new transactions.',
+ 'rule_name' => 'Name of rule',
+ 'rule_triggers' => 'Rule triggers when',
+ 'rule_actions' => 'Rule will',
+ 'new_rule' => 'New rule',
+ 'new_rule_group' => 'New rule group',
+ 'rule_priority_up' => 'Give rule more priority',
+ 'rule_priority_down' => 'Give rule less priority',
+ 'make_new_rule_group' => 'Make new rule group',
+ 'store_new_rule_group' => 'Store new rule group',
+ 'created_new_rule_group' => 'New rule group ":title" stored!',
+ 'updated_rule_group' => 'Successfully updated rule group ":title".',
+ 'edit_rule_group' => 'Edit rule group ":title"',
+ 'delete_rule_group' => 'Delete rule group ":title"',
+ 'deleted_rule_group' => 'Deleted rule group ":title"',
+ 'update_rule_group' => 'Update rule group',
+ 'no_rules_in_group' => 'There are no rules in this group',
+ 'move_rule_group_up' => 'Move rule group up',
+ 'move_rule_group_down' => 'Move rule group down',
+ 'save_rules_by_moving' => 'Save these rule(s) by moving them to another rule group:',
+ 'make_new_rule' => 'Make new rule in rule group ":title"',
+ 'rule_help_stop_processing' => 'When you check this box, later rules in this group will not be executed.',
+ 'rule_help_active' => 'Inactive rules will never fire.',
+ 'stored_new_rule' => 'Stored new rule with title ":title"',
+ 'deleted_rule' => 'Deleted rule with title ":title"',
+ 'store_new_rule' => 'Store new rule',
+ 'updated_rule' => 'Updated rule with title ":title"',
+ 'default_rule_group_name' => 'Default rules',
+ 'default_rule_group_description' => 'All your rules not in a particular group.',
+ 'default_rule_name' => 'Your first default rule',
+ 'default_rule_description' => 'This rule is an example. You can safely delete it.',
+ 'default_rule_trigger_description' => 'The Man Who Sold the World',
+ 'default_rule_trigger_from_account' => 'David Bowie',
+ 'default_rule_action_prepend' => 'Bought the world from ',
+ 'default_rule_action_set_category' => 'Large expenses',
+ 'trigger' => 'Trigger',
+ 'trigger_value' => 'Trigger on value',
+ 'stop_processing_other_triggers' => 'Stop processing other triggers',
+ 'add_rule_trigger' => 'Add new trigger',
+ 'action' => 'Action',
+ 'action_value' => 'Action value',
+ 'stop_executing_other_actions' => 'Stop executing other actions',
+ 'add_rule_action' => 'Add new action',
+ 'edit_rule' => 'Edit rule ":title"',
+ 'delete_rule' => 'Delete rule ":title"',
+ 'update_rule' => 'Update rule',
+ 'test_rule_triggers' => 'See matching transactions',
+ 'warning_transaction_subset' => 'For performance reasons this list is limited to :max_num_transactions and may only show a subset of matching transactions',
+ 'warning_no_matching_transactions' => 'No matching transactions found. Please note that for performance reasons, only the last :num_transactions transactions have been checked.',
+ 'warning_no_valid_triggers' => 'No valid triggers provided.',
+ 'execute_on_existing_transactions' => 'Execute for existing transactions',
+ 'rule_group_select_transactions' => 'Execute rule group ":title" on existing transactions',
+ 'execute_on_existing_transactions_intro' => 'When a rule or group has been changed or added, you can execute it for existing transactions',
+ 'execute_on_existing_transactions_short' => 'Existing transactions',
+ 'executed_group_on_existing_transactions' => 'Executed group ":title" for existing transactions',
+ 'execute_group_on_existing_transactions' => 'Execute group ":title" for existing transactions',
+ 'include_transactions_from_accounts' => 'Include transactions from these accounts',
+ 'execute' => 'Execute',
+
+ // actions and triggers
+ 'rule_trigger_user_action' => 'User action is ":trigger_value"',
+ 'rule_trigger_from_account_starts' => 'Source account starts with ":trigger_value"',
+ 'rule_trigger_from_account_ends' => 'Source account ends with ":trigger_value"',
+ 'rule_trigger_from_account_is' => 'Source account is ":trigger_value"',
+ 'rule_trigger_from_account_contains' => 'Source account contains ":trigger_value"',
+ 'rule_trigger_to_account_starts' => 'Destination account starts with ":trigger_value"',
+ 'rule_trigger_to_account_ends' => 'Destination account ends with ":trigger_value"',
+ 'rule_trigger_to_account_is' => 'Destination account is ":trigger_value"',
+ 'rule_trigger_to_account_contains' => 'Destination account contains ":trigger_value"',
+ 'rule_trigger_transaction_type' => 'Transaction is of type ":trigger_value"',
+ 'rule_trigger_category_is' => 'Category is ":trigger_value"',
+ 'rule_trigger_amount_less' => 'Amount is less than :trigger_value',
+ 'rule_trigger_amount_exactly' => 'Amount is :trigger_value',
+ 'rule_trigger_amount_more' => 'Amount is more than :trigger_value',
+ 'rule_trigger_description_starts' => 'Description starts with ":trigger_value"',
+ 'rule_trigger_description_ends' => 'Description ends with ":trigger_value"',
+ 'rule_trigger_description_contains' => 'Description contains ":trigger_value"',
+ 'rule_trigger_description_is' => 'Description is ":trigger_value"',
+ 'rule_trigger_from_account_starts_choice' => 'Source account starts with..',
+ 'rule_trigger_from_account_ends_choice' => 'Source account ends with..',
+ 'rule_trigger_from_account_is_choice' => 'Source account is..',
+ 'rule_trigger_from_account_contains_choice' => 'Source account contains..',
+ 'rule_trigger_to_account_starts_choice' => 'Destination account starts with..',
+ 'rule_trigger_to_account_ends_choice' => 'Destination account ends with..',
+ 'rule_trigger_to_account_is_choice' => 'Destination account is..',
+ 'rule_trigger_to_account_contains_choice' => 'Destination account contains..',
+ 'rule_trigger_transaction_type_choice' => 'Transaction is of type..',
+ 'rule_trigger_amount_less_choice' => 'Amount is less than..',
+ 'rule_trigger_amount_exactly_choice' => 'Amount is..',
+ 'rule_trigger_amount_more_choice' => 'Amount is more than..',
+ 'rule_trigger_description_starts_choice' => 'Description starts with..',
+ 'rule_trigger_description_ends_choice' => 'Description ends with..',
+ 'rule_trigger_description_contains_choice' => 'Description contains..',
+ 'rule_trigger_description_is_choice' => 'Description is..',
+ 'rule_trigger_category_is_choice' => 'Category is..',
+ 'rule_trigger_budget_is_choice' => 'Budget is..',
+ 'rule_trigger_tag_is_choice' => '(A) tag is..',
+ 'rule_trigger_has_attachments_choice' => 'Has at least this many attachments',
+ 'rule_trigger_has_attachments' => 'Has at least :trigger_value attachment(s)',
+ 'rule_trigger_store_journal' => 'When a transaction is created',
+ 'rule_trigger_update_journal' => 'When a transaction is updated',
+ 'rule_action_set_category' => 'Set category to ":action_value"',
+ 'rule_action_clear_category' => 'Clear category',
+ 'rule_action_set_budget' => 'Set budget to ":action_value"',
+ 'rule_action_clear_budget' => 'Clear budget',
+ 'rule_action_add_tag' => 'Add tag ":action_value"',
+ 'rule_action_remove_tag' => 'Remove tag ":action_value"',
+ 'rule_action_remove_all_tags' => 'Remove all tags',
+ 'rule_action_set_description' => 'Set description to ":action_value"',
+ 'rule_action_append_description' => 'Append description with ":action_value"',
+ 'rule_action_prepend_description' => 'Prepend description with ":action_value"',
+ 'rule_action_set_category_choice' => 'Set category to..',
+ 'rule_action_clear_category_choice' => 'Clear any category',
+ 'rule_action_set_budget_choice' => 'Set budget to..',
+ 'rule_action_clear_budget_choice' => 'Clear any budget',
+ 'rule_action_add_tag_choice' => 'Add tag..',
+ 'rule_action_remove_tag_choice' => 'Remove tag..',
+ 'rule_action_remove_all_tags_choice' => 'Remove all tags',
+ 'rule_action_set_description_choice' => 'Set description to..',
+ 'rule_action_append_description_choice' => 'Append description with..',
+ 'rule_action_prepend_description_choice' => 'Prepend description with..',
+ 'rule_action_set_source_account_choice' => 'Set source account to...',
+ 'rule_action_set_source_account' => 'Set source account to :action_value',
+ 'rule_action_set_destination_account_choice' => 'Set destination account to...',
+ 'rule_action_set_destination_account' => 'Set destination account to :action_value',
+
+ // tags
+ 'store_new_tag' => 'Store new tag',
+ 'update_tag' => 'Update tag',
+ 'no_location_set' => 'No location set.',
+ 'meta_data' => 'Meta data',
+ 'location' => 'Location',
+
+ // preferences
+ 'pref_home_screen_accounts' => 'Home screen accounts',
+ 'pref_home_screen_accounts_help' => 'Which accounts should be displayed on the home page?',
+ 'pref_view_range' => 'View range',
+ 'pref_view_range_help' => 'Some charts are automatically grouped in periods. What period would you prefer?',
+ 'pref_1D' => 'One day',
+ 'pref_1W' => 'One week',
+ 'pref_1M' => 'One month',
+ 'pref_3M' => 'Three months (quarter)',
+ 'pref_6M' => 'Six months',
+ 'pref_1Y' => 'One year',
+ 'pref_languages' => 'Languages',
+ 'pref_languages_help' => 'Firefly III supports several languages. Which one do you prefer?',
+ 'pref_custom_fiscal_year' => 'Fiscal year settings',
+ 'pref_custom_fiscal_year_label' => 'Enabled',
+ 'pref_custom_fiscal_year_help' => 'In countries that use a financial year other than January 1 to December 31, you can switch this on and specify start / end days of the fiscal year',
+ 'pref_fiscal_year_start_label' => 'Fiscal year start date',
+ 'pref_two_factor_auth' => '2-step verification',
+ 'pref_two_factor_auth_help' => 'When you enable 2-step verification (also known as two-factor authentication), you add an extra layer of security to your account. You sign in with something you know (your password) and something you have (a verification code). Verification codes are generated by an application on your phone, such as Authy or Google Authenticator.',
+ 'pref_enable_two_factor_auth' => 'Enable 2-step verification',
+ 'pref_two_factor_auth_disabled' => '2-step verification code removed and disabled',
+ 'pref_two_factor_auth_remove_it' => 'Don\'t forget to remove the account from your authentication app!',
+ 'pref_two_factor_auth_code' => 'Verify code',
+ 'pref_two_factor_auth_code_help' => 'Scan the QR code with an application on your phone such as Authy or Google Authenticator and enter the generated code.',
+ 'pref_two_factor_auth_reset_code' => 'Reset verification code',
+ 'pref_two_factor_auth_remove_code' => 'Remove verification code',
+ 'pref_two_factor_auth_remove_will_disable' => '(this will also disable two-factor authentication)',
+ 'pref_save_settings' => 'Save settings',
+ 'saved_preferences' => 'Preferences saved!',
+ 'preferences_general' => 'General',
+ 'preferences_frontpage' => 'Home screen',
+ 'preferences_security' => 'Security',
+ 'preferences_layout' => 'Layout',
+ 'pref_home_show_deposits' => 'Show deposits on the home screen',
+ 'pref_home_show_deposits_info' => 'The home screen already shows your expense accounts. Should it also show your revenue accounts?',
+ 'pref_home_do_show_deposits' => 'Yes, show them',
+ 'successful_count' => 'of which :count successful',
+ 'transaction_page_size_title' => 'Page size',
+ 'transaction_page_size_help' => 'Any list of transactions shows at most this many transactions',
+ 'transaction_page_size_label' => 'Page size',
+ 'between_dates' => '(:start and :end)',
+ 'pref_optional_fields_transaction' => 'Optional fields for transactions',
+ 'pref_optional_fields_transaction_help' => 'By default not all fields are enabled when creating a new transaction (because of the clutter). Below, you can enable these fields if you think they could be useful for you. Of course, any field that is disabled, but already filled in, will be visible regardless of the setting.',
+ 'optional_tj_date_fields' => 'Date fields',
+ 'optional_tj_business_fields' => 'Business fields',
+ 'optional_tj_attachment_fields' => 'Attachment fields',
+ 'pref_optional_tj_interest_date' => 'Interest date',
+ 'pref_optional_tj_book_date' => 'Book date',
+ 'pref_optional_tj_process_date' => 'Processing date',
+ 'pref_optional_tj_due_date' => 'Due date',
+ 'pref_optional_tj_payment_date' => 'Payment date',
+ 'pref_optional_tj_invoice_date' => 'Invoice date',
+ 'pref_optional_tj_internal_reference' => 'Internal reference',
+ 'pref_optional_tj_notes' => 'Notes',
+ 'pref_optional_tj_attachments' => 'Attachments',
+ 'optional_field_meta_dates' => 'Dates',
+ 'optional_field_meta_business' => 'Business',
+ 'optional_field_attachments' => 'Attachments',
+ 'optional_field_meta_data' => 'Optional meta data',
+
+
+ // profile:
+ 'change_your_password' => 'Change your password',
+ 'delete_account' => 'Delete account',
+ 'current_password' => 'Current password',
+ 'new_password' => 'New password',
+ 'new_password_again' => 'New password (again)',
+ 'delete_your_account' => 'Delete your account',
+ 'delete_your_account_help' => 'Deleting your account will also delete any accounts, transactions, anything you might have saved into Firefly III. It\'ll be GONE.',
+ 'delete_your_account_password' => 'Enter your password to continue.',
+ 'password' => 'Password',
+ 'are_you_sure' => 'Are you sure? You cannot undo this.',
+ 'delete_account_button' => 'DELETE your account',
+ 'invalid_current_password' => 'Invalid current password!',
+ 'password_changed' => 'Password changed!',
+ 'should_change' => 'The idea is to change your password.',
+ 'invalid_password' => 'Invalid password!',
+
+
+ // attachments
+ 'nr_of_attachments' => 'One attachment|:count attachments',
+ 'attachments' => 'Attachments',
+ 'edit_attachment' => 'Edit attachment ":name"',
+ 'update_attachment' => 'Update attachment',
+ 'delete_attachment' => 'Delete attachment ":name"',
+ 'attachment_deleted' => 'Deleted attachment ":name"',
+ 'attachment_updated' => 'Updated attachment ":name"',
+ 'upload_max_file_size' => 'Maximum file size: :size',
+
+ // tour:
+ 'prev' => 'Prev',
+ 'next' => 'Next',
+ 'end-tour' => 'End tour',
+ 'pause' => 'Pause',
+
+ // transaction index
+ 'title_expenses' => 'Expenses',
+ 'title_withdrawal' => 'Expenses',
+ 'title_revenue' => 'Revenue / income',
+ 'title_deposit' => 'Revenue / income',
+ 'title_transfer' => 'Transfers',
+ 'title_transfers' => 'Transfers',
+
+ // convert stuff:
+ 'convert_is_already_type_Withdrawal' => 'This transaction is already a withdrawal',
+ 'convert_is_already_type_Deposit' => 'This transaction is already a deposit',
+ 'convert_is_already_type_Transfer' => 'This transaction is already a transfer',
+ 'convert_to_Withdrawal' => 'Convert ":description" to a withdrawal',
+ 'convert_to_Deposit' => 'Convert ":description" to a deposit',
+ 'convert_to_Transfer' => 'Convert ":description" to a transfer',
+ 'convert_options_WithdrawalDeposit' => 'Convert a withdrawal into a deposit',
+ 'convert_options_WithdrawalTransfer' => 'Convert a withdrawal into a transfer',
+ 'convert_options_DepositTransfer' => 'Convert a deposit into a transfer',
+ 'convert_options_DepositWithdrawal' => 'Convert a deposit into a withdrawal',
+ 'convert_options_TransferWithdrawal' => 'Convert a transfer into a withdrawal',
+ 'convert_options_TransferDeposit' => 'Convert a transfer into a deposit',
+ 'transaction_journal_convert_options' => 'Convert this transaction',
+ 'convert_Withdrawal_to_deposit' => 'Convert this withdrawal to a deposit',
+ 'convert_Withdrawal_to_transfer' => 'Convert this withdrawal to a transfer',
+ 'convert_Deposit_to_withdrawal' => 'Convert this deposit to a withdrawal',
+ 'convert_Deposit_to_transfer' => 'Convert this deposit to a transfer',
+ 'convert_Transfer_to_deposit' => 'Convert this transfer to a deposit',
+ 'convert_Transfer_to_withdrawal' => 'Convert this transfer to a withdrawal',
+ 'convert_please_set_revenue_source' => 'Please pick the revenue account where the money will come from.',
+ 'convert_please_set_asset_destination' => 'Please pick the asset account where the money will go to.',
+ 'convert_please_set_expense_destination' => 'Please pick the expense account where the money will go to.',
+ 'convert_please_set_asset_source' => 'Please pick the asset account where the money will come from.',
+ 'convert_explanation_withdrawal_deposit' => 'If you convert this withdrawal into a deposit, :amount will be deposited into :sourceName instead of taken from it.',
+ 'convert_explanation_withdrawal_transfer' => 'If you convert this withdrawal into a transfer, :amount will be transferred from :sourceName to a new asset account, instead of being paid to :destinationName.',
+ 'convert_explanation_deposit_withdrawal' => 'If you convert this deposit into a withdrawal, :amount will be removed from :destinationName instead of added to it.',
+ 'convert_explanation_deposit_transfer' => 'If you convert this deposit into a transfer, :amount will be transferred from an asset account of your choice into :destinationName.',
+ 'convert_explanation_transfer_withdrawal' => 'If you convert this transfer into a withdrawal, :amount will go from :sourceName to a new destination as an expense, instead of to :destinationName as a transfer.',
+ 'convert_explanation_transfer_deposit' => 'If you convert this transfer into a deposit, :amount will be deposited into account :destinationName instead of being transferred there.',
+ 'converted_to_Withdrawal' => 'The transaction has been converted to a withdrawal',
+ 'converted_to_Deposit' => 'The transaction has been converted to a deposit',
+ 'converted_to_Transfer' => 'The transaction has been converted to a transfer',
+
+
+ // create new stuff:
+ 'create_new_withdrawal' => 'Create new withdrawal',
+ 'create_new_deposit' => 'Create new deposit',
+ 'create_new_transfer' => 'Create new transfer',
+ 'create_new_asset' => 'Create new asset account',
+ 'create_new_expense' => 'Create new expense account',
+ 'create_new_revenue' => 'Create new revenue account',
+ 'create_new_piggy_bank' => 'Create new piggy bank',
+ 'create_new_bill' => 'Create new bill',
+
+ // currencies:
+ 'create_currency' => 'Create a new currency',
+ 'store_currency' => 'Store new currency',
+ 'update_currency' => 'Update currency',
+ 'new_default_currency' => ':name is now the default currency.',
+ 'cannot_delete_currency' => 'Cannot delete :name because it is still in use.',
+ 'deleted_currency' => 'Currency :name deleted',
+ 'created_currency' => 'Currency :name created',
+ 'updated_currency' => 'Currency :name updated',
+ 'ask_site_owner' => 'Please ask :owner to add, remove or edit currencies.',
+ 'currencies_intro' => 'Firefly III supports various currencies which you can set and enable here.',
+ 'make_default_currency' => 'make default',
+ 'default_currency' => 'default',
+
+ // new user:
+ 'submit' => 'Submit',
+ 'getting_started' => 'Getting started',
+ 'to_get_started' => 'To get started with Firefly, please enter your current bank\'s name, and the balance of your checking account:',
+ 'savings_balance_text' => 'If you have a savings account, please enter the current balance of your savings account:',
+ 'cc_balance_text' => 'If you have a credit card, please enter your credit card\'s limit.',
+ 'stored_new_account_new_user' => 'Yay! Your new account has been stored.',
+ 'stored_new_accounts_new_user' => 'Yay! Your new accounts have been stored.',
+
+ // forms:
+ 'mandatoryFields' => 'Mandatory fields',
+ 'optionalFields' => 'Optional fields',
+ 'options' => 'Options',
+
+ // budgets:
+ 'create_new_budget' => 'Create a new budget',
+ 'store_new_budget' => 'Store new budget',
+ 'stored_new_budget' => 'Stored new budget ":name"',
+ 'available_between' => 'Available between :start and :end',
+ 'transactionsWithoutBudget' => 'Expenses without budget',
+ 'transactions_no_budget' => 'Expenses without budget between :start and :end',
+ 'spent_between' => 'Spent between :start and :end',
+ 'createBudget' => 'New budget',
+ 'inactiveBudgets' => 'Inactive budgets',
+ 'without_budget_between' => 'Transactions without a budget between :start and :end',
+ 'budget_in_month' => ':name in :month',
+ 'delete_budget' => 'Delete budget ":name"',
+ 'deleted_budget' => 'Deleted budget ":name"',
+ 'edit_budget' => 'Edit budget ":name"',
+ 'updated_budget' => 'Updated budget ":name"',
+ 'update_amount' => 'Update amount',
+ 'update_budget' => 'Update budget',
+ 'update_budget_amount_range' => 'Update (expected) available amount between :start and :end',
+
+ // bills:
+ 'matching_on' => 'Matching on',
+ 'between_amounts' => 'between :low and :high.',
+ 'repeats' => 'Repeats',
+ 'connected_journals' => 'Connected transactions',
+ 'auto_match_on' => 'Automatically matched by Firefly',
+ 'auto_match_off' => 'Not automatically matched by Firefly',
+ 'next_expected_match' => 'Next expected match',
+ 'delete_bill' => 'Delete bill ":name"',
+ 'deleted_bill' => 'Deleted bill ":name"',
+ 'edit_bill' => 'Edit bill ":name"',
+ 'more' => 'More',
+ 'rescan_old' => 'Rescan old transactions',
+ 'update_bill' => 'Update bill',
+ 'updated_bill' => 'Updated bill ":name"',
+ 'store_new_bill' => 'Store new bill',
+ 'stored_new_bill' => 'Stored new bill ":name"',
+ 'cannot_scan_inactive_bill' => 'Inactive bills cannot be scanned.',
+ 'rescanned_bill' => 'Rescanned everything.',
+ 'average_bill_amount_year' => 'Average bill amount (:year)',
+ 'average_bill_amount_overall' => 'Average bill amount (overall)',
+ 'not_or_not_yet' => 'Not (yet)',
+ 'not_expected_period' => 'Not expected this period',
+ // accounts:
+ 'details_for_asset' => 'Details for asset account ":name"',
+ 'details_for_expense' => 'Details for expense account ":name"',
+ 'details_for_revenue' => 'Details for revenue account ":name"',
+ 'details_for_cash' => 'Details for cash account ":name"',
+ 'store_new_asset_account' => 'Store new asset account',
+ 'store_new_expense_account' => 'Store new expense account',
+ 'store_new_revenue_account' => 'Store new revenue account',
+ 'edit_asset_account' => 'Edit asset account ":name"',
+ 'edit_expense_account' => 'Edit expense account ":name"',
+ 'edit_revenue_account' => 'Edit revenue account ":name"',
+ 'delete_asset_account' => 'Delete asset account ":name"',
+ 'delete_expense_account' => 'Delete expense account ":name"',
+ 'delete_revenue_account' => 'Delete revenue account ":name"',
+ 'asset_deleted' => 'Successfully deleted asset account ":name"',
+ 'expense_deleted' => 'Successfully deleted expense account ":name"',
+ 'revenue_deleted' => 'Successfully deleted revenue account ":name"',
+ 'update_asset_account' => 'Update asset account',
+ 'update_expense_account' => 'Update expense account',
+ 'update_revenue_account' => 'Update revenue account',
+ 'make_new_asset_account' => 'Create a new asset account',
+ 'make_new_expense_account' => 'Create a new expense account',
+ 'make_new_revenue_account' => 'Create a new revenue account',
+ 'asset_accounts' => 'Asset accounts',
+ 'expense_accounts' => 'Expense accounts',
+ 'revenue_accounts' => 'Revenue accounts',
+ 'cash_accounts' => 'Cash accounts',
+ 'Cash account' => 'Cash account',
+ 'account_type' => 'Account type',
+ 'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:',
+ 'stored_new_account' => 'New account ":name" stored!',
+ 'updated_account' => 'Updated account ":name"',
+ 'credit_card_options' => 'Credit card options',
+ 'no_transactions_account' => 'There are no transactions (in this period) for asset account ":name".',
+ 'no_data_for_chart' => 'There is not enough information (yet) to generate this chart.',
+ 'select_more_than_one_account' => 'Please select more than one account',
+ 'select_more_than_one_category' => 'Please select more than one category',
+ 'select_more_than_one_budget' => 'Please select more than one budget',
+ 'select_more_than_one_tag' => 'Please select more than one tag',
+ 'from_to' => 'From :start to :end',
+ 'from_to_breadcrumb' => 'from :start to :end',
+ 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.',
+
+ // categories:
+ 'new_category' => 'New category',
+ 'create_new_category' => 'Create a new category',
+ 'without_category' => 'Without a category',
+ 'update_category' => 'Update category',
+ 'updated_category' => 'Updated category ":name"',
+ 'categories' => 'Categories',
+ 'edit_category' => 'Edit category ":name"',
+ 'no_category' => '(no category)',
+ 'category' => 'Category',
+ 'delete_category' => 'Delete category ":name"',
+ 'deleted_category' => 'Deleted category ":name"',
+ 'store_category' => 'Store new category',
+ 'stored_category' => 'Stored new category ":name"',
+ 'without_category_between' => 'Without category between :start and :end',
+
+ // transactions:
+ 'update_withdrawal' => 'Update withdrawal',
+ 'update_deposit' => 'Update deposit',
+ 'update_transfer' => 'Update transfer',
+ 'updated_withdrawal' => 'Updated withdrawal ":description"',
+ 'updated_deposit' => 'Updated deposit ":description"',
+ 'updated_transfer' => 'Updated transfer ":description"',
+ 'delete_withdrawal' => 'Delete withdrawal ":description"',
+ 'delete_deposit' => 'Delete deposit ":description"',
+ 'delete_transfer' => 'Delete transfer ":description"',
+ 'deleted_withdrawal' => 'Successfully deleted withdrawal ":description"',
+ 'deleted_deposit' => 'Successfully deleted deposit ":description"',
+ 'deleted_transfer' => 'Successfully deleted transfer ":description"',
+ 'stored_journal' => 'Successfully created new transaction ":description"',
+ 'select_transactions' => 'Select transactions',
+ 'stop_selection' => 'Stop selecting transactions',
+ 'edit_selected' => 'Edit selected',
+ 'delete_selected' => 'Delete selected',
+ 'mass_delete_journals' => 'Delete a number of transactions',
+ 'mass_edit_journals' => 'Edit a number of transactions',
+ 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.',
+ 'perm-delete-many' => 'Deleting many items in one go can be very disruptive. Please be cautious.',
+ 'mass_deleted_transactions_success' => 'Deleted :amount transaction(s).',
+ 'mass_edited_transactions_success' => 'Updated :amount transaction(s)',
+
+
+ // new user:
+ 'welcome' => 'Welcome to Firefly!',
+
+ // home page:
+ 'yourAccounts' => 'Your accounts',
+ 'budgetsAndSpending' => 'Budgets and spending',
+ 'savings' => 'Savings',
+ 'markAsSavingsToContinue' => 'Mark your asset accounts as "Savings account" to fill this panel',
+ 'createPiggyToContinue' => 'Create piggy banks to fill this panel.',
+ 'newWithdrawal' => 'New expense',
+ 'newDeposit' => 'New deposit',
+ 'newTransfer' => 'New transfer',
+ 'moneyIn' => 'Money in',
+ 'moneyOut' => 'Money out',
+ 'billsToPay' => 'Bills to pay',
+ 'billsPaid' => 'Bills paid',
+ 'divided' => 'divided',
+ 'toDivide' => 'left to divide',
+
+ // menu and titles, should be recycled as often as possible:
+ 'currency' => 'Currency',
+ 'preferences' => 'Preferences',
+ 'logout' => 'Logout',
+ 'searchPlaceholder' => 'Search...',
+ 'dashboard' => 'Dashboard',
+ 'currencies' => 'Currencies',
+ 'accounts' => 'Accounts',
+ 'Asset account' => 'Asset account',
+ 'Default account' => 'Asset account',
+ 'Expense account' => 'Expense account',
+ 'Revenue account' => 'Revenue account',
+ 'Initial balance account' => 'Initial balance account',
+ 'budgets' => 'Budgets',
+ 'tags' => 'Tags',
+ 'reports' => 'Reports',
+ 'transactions' => 'Transactions',
+ 'expenses' => 'Expenses',
+ 'income' => 'Revenue / income',
+ 'transfers' => 'Transfers',
+ 'moneyManagement' => 'Money management',
+ 'piggyBanks' => 'Piggy banks',
+ 'bills' => 'Bills',
+ 'withdrawal' => 'Withdrawal',
+ 'deposit' => 'Deposit',
+ 'account' => 'Account',
+ 'transfer' => 'Transfer',
+ 'Withdrawal' => 'Withdrawal',
+ 'Deposit' => 'Deposit',
+ 'Transfer' => 'Transfer',
+ 'bill' => 'Bill',
+ 'yes' => 'Yes',
+ 'no' => 'No',
+ 'amount' => 'Amount',
+ 'overview' => 'Overview',
+ 'saveOnAccount' => 'Save on account',
+ 'unknown' => 'Unknown',
+ 'daily' => 'Daily',
+ 'monthly' => 'Monthly',
+ 'profile' => 'Profile',
+ 'errors' => 'Errors',
+
+ // reports:
+ 'report_default' => 'Default financial report between :start and :end',
+ 'report_audit' => 'Transaction history overview between :start and :end',
+ 'report_category' => 'Category report between :start and :end',
+ 'report_budget' => 'Budget report between :start and :end',
+ 'report_tag' => 'Tag report between :start and :end',
+ 'quick_link_reports' => 'Quick links',
+ 'quick_link_default_report' => 'Default financial report',
+ 'quick_link_audit_report' => 'Transaction history overview',
+ 'report_this_month_quick' => 'Current month, all accounts',
+ 'report_this_year_quick' => 'Current year, all accounts',
+ 'report_this_fiscal_year_quick' => 'Current fiscal year, all accounts',
+ 'report_all_time_quick' => 'All-time, all accounts',
+ 'reports_can_bookmark' => 'Remember that reports can be bookmarked.',
+ 'incomeVsExpenses' => 'Income vs. expenses',
+ 'accountBalances' => 'Account balances',
+ 'balanceStartOfYear' => 'Balance at start of year',
+ 'balanceEndOfYear' => 'Balance at end of year',
+ 'balanceStartOfMonth' => 'Balance at start of month',
+ 'balanceEndOfMonth' => 'Balance at end of month',
+ 'balanceStart' => 'Balance at start of period',
+ 'balanceEnd' => 'Balance at end of period',
+ 'reportsOwnAccounts' => 'Reports for your own accounts',
+ 'reportsOwnAccountsAndShared' => 'Reports for your own accounts and shared accounts',
+ 'splitByAccount' => 'Split by account',
+ 'balancedByTransfersAndTags' => 'Balanced by transfers and tags',
+ 'coveredWithTags' => 'Covered with tags',
+ 'leftUnbalanced' => 'Left unbalanced',
+ 'expectedBalance' => 'Expected balance',
+ 'outsideOfBudgets' => 'Outside of budgets',
+ 'leftInBudget' => 'Left in budget',
+ 'sumOfSums' => 'Sum of sums',
+ 'noCategory' => '(no category)',
+ 'notCharged' => 'Not charged (yet)',
+ 'inactive' => 'Inactive',
+ 'active' => 'Active',
+ 'difference' => 'Difference',
+ 'in' => 'In',
+ 'out' => 'Out',
+ 'topX' => 'top :number',
+ 'show_full_list' => 'Show entire list',
+ 'show_only_top' => 'Show only top :number',
+ 'sum_of_year' => 'Sum of year',
+ 'sum_of_years' => 'Sum of years',
+ 'average_of_year' => 'Average of year',
+ 'average_of_years' => 'Average of years',
+ 'categories_earned_in_year' => 'Categories (by earnings)',
+ 'categories_spent_in_year' => 'Categories (by spendings)',
+ 'report_type' => 'Report type',
+ 'report_type_default' => 'Default financial report',
+ 'report_type_audit' => 'Transaction history overview (audit)',
+ 'report_type_category' => 'Category report',
+ 'report_type_budget' => 'Budget report',
+ 'report_type_tag' => 'Tag report',
+ 'report_type_meta-history' => 'Categories, budgets and bills overview',
+ 'more_info_help' => 'More information about these types of reports can be found in the help pages. Press the (?) icon in the top right corner.',
+ 'report_included_accounts' => 'Included accounts',
+ 'report_date_range' => 'Date range',
+ 'report_preset_ranges' => 'Pre-set ranges',
+ 'shared' => 'Shared',
+ 'fiscal_year' => 'Fiscal year',
+ 'income_entry' => 'Income from account ":name" between :start and :end',
+ 'expense_entry' => 'Expenses to account ":name" between :start and :end',
+ 'category_entry' => 'Expenses in category ":name" between :start and :end',
+ 'budget_spent_amount' => 'Expenses in budget ":budget" between :start and :end',
+ 'balance_amount' => 'Expenses in budget ":budget" paid from account ":account" between :start and :end',
+ 'no_audit_activity' => 'No activity was recorded on account :account_name between :start and :end.',
+ 'audit_end_balance' => 'Account balance of :account_name at the end of :end was: :balance',
+ 'reports_extra_options' => 'Extra options',
+ 'report_has_no_extra_options' => 'This report has no extra options',
+ 'reports_submit' => 'View report',
+ 'end_after_start_date' => 'End date of report must be after start date.',
+ 'select_category' => 'Select category(ies)',
+ 'select_budget' => 'Select budget(s).',
+ 'select_tag' => 'Select tag(s).',
+ 'income_per_category' => 'Income per category',
+ 'expense_per_category' => 'Expense per category',
+ 'expense_per_budget' => 'Expense per budget',
+ 'income_per_account' => 'Income per account',
+ 'expense_per_account' => 'Expense per account',
+ 'expense_per_tag' => 'Expense per tag',
+ 'income_per_tag' => 'Income per tag',
+ 'include_expense_not_in_budget' => 'Included expenses not in the selected budget(s)',
+ 'include_expense_not_in_account' => 'Included expenses not in the selected account(s)',
+ 'include_expense_not_in_category' => 'Included expenses not in the selected category(ies)',
+ 'include_income_not_in_category' => 'Included income not in the selected category(ies)',
+ 'include_income_not_in_account' => 'Included income not in the selected account(s)',
+ 'include_income_not_in_tags' => 'Included income not in the selected tag(s)',
+ 'include_expense_not_in_tags' => 'Included expenses not in the selected tag(s)',
+ 'everything_else' => 'Everything else',
+ 'income_and_expenses' => 'Income and expenses',
+ 'spent_average' => 'Spent (average)',
+ 'income_average' => 'Income (average)',
+ 'transaction_count' => 'Transaction count',
+ 'average_spending_per_account' => 'Average spending per account',
+ 'average_income_per_account' => 'Average income per account',
+ 'total' => 'Total',
+ 'description' => 'Description',
+ 'sum_of_period' => 'Sum of period',
+ 'average_in_period' => 'Average in period',
+ 'account_role_defaultAsset' => 'Default asset account',
+ 'account_role_sharedAsset' => 'Shared asset account',
+ 'account_role_savingAsset' => 'Savings account',
+ 'account_role_ccAsset' => 'Credit card',
+
+ // charts:
+ 'chart' => 'Chart',
+ 'dayOfMonth' => 'Day of the month',
+ 'month' => 'Month',
+ 'budget' => 'Budget',
+ 'spent' => 'Spent',
+ 'spent_in_budget' => 'Spent in budget',
+ 'left_to_spend' => 'Left to spend',
+ 'earned' => 'Earned',
+ 'overspent' => 'Overspent',
+ 'left' => 'Left',
+ 'no_budget' => '(no budget)',
+ 'max-amount' => 'Maximum amount',
+ 'min-amount' => 'Minumum amount',
+ 'journal-amount' => 'Current bill entry',
+ 'name' => 'Name',
+ 'date' => 'Date',
+ 'paid' => 'Paid',
+ 'unpaid' => 'Unpaid',
+ 'day' => 'Day',
+ 'budgeted' => 'Budgeted',
+ 'period' => 'Period',
+ 'balance' => 'Balance',
+ 'summary' => 'Summary',
+ 'sum' => 'Sum',
+ 'average' => 'Average',
+ 'balanceFor' => 'Balance for :name',
+
+ // piggy banks:
+ 'add_money_to_piggy' => 'Add money to piggy bank ":name"',
+ 'piggy_bank' => 'Piggy bank',
+ 'new_piggy_bank' => 'New piggy bank',
+ 'store_piggy_bank' => 'Store new piggy bank',
+ 'stored_piggy_bank' => 'Store new piggy bank ":name"',
+ 'account_status' => 'Account status',
+ 'left_for_piggy_banks' => 'Left for piggy banks',
+ 'sum_of_piggy_banks' => 'Sum of piggy banks',
+ 'saved_so_far' => 'Saved so far',
+ 'left_to_save' => 'Left to save',
+ 'suggested_amount' => 'Suggested monthly amount to save',
+ 'add_money_to_piggy_title' => 'Add money to piggy bank ":name"',
+ 'remove_money_from_piggy_title' => 'Remove money from piggy bank ":name"',
+ 'add' => 'Add',
+
+ 'remove' => 'Remove',
+ 'max_amount_add' => 'The maximum amount you can add is',
+ 'max_amount_remove' => 'The maximum amount you can remove is',
+ 'update_piggy_button' => 'Update piggy bank',
+ 'update_piggy_title' => 'Update piggy bank ":name"',
+ 'updated_piggy_bank' => 'Updated piggy bank ":name"',
+ 'details' => 'Details',
+ 'events' => 'Events',
+ 'target_amount' => 'Target amount',
+ 'start_date' => 'Start date',
+ 'target_date' => 'Target date',
+ 'no_target_date' => 'No target date',
+ 'todo' => 'to do',
+ 'table' => 'Table',
+ 'piggy_bank_not_exists' => 'Piggy bank no longer exists.',
+ 'add_any_amount_to_piggy' => 'Add money to this piggy bank to reach your target of :amount.',
+ 'add_set_amount_to_piggy' => 'Add :amount to fill this piggy bank on :date',
+ 'delete_piggy_bank' => 'Delete piggy bank ":name"',
+ 'cannot_add_amount_piggy' => 'Could not add :amount to ":name".',
+ 'cannot_remove_from_piggy' => 'Could not remove :amount from ":name".',
+ 'deleted_piggy_bank' => 'Deleted piggy bank ":name"',
+ 'added_amount_to_piggy' => 'Added :amount to ":name"',
+ 'removed_amount_from_piggy' => 'Removed :amount from ":name"',
+ 'cannot_remove_amount_piggy' => 'Could not remove :amount from ":name".',
+
+ // tags
+ 'regular_tag' => 'Just a regular tag.',
+ 'balancing_act' => 'The tag takes at most two transactions; an expense and a transfer. They\'ll balance each other out.',
+ 'advance_payment' => 'The tag accepts one expense and any number of deposits aimed to repay the original expense.',
+ 'delete_tag' => 'Delete tag ":tag"',
+ 'deleted_tag' => 'Deleted tag ":tag"',
+ 'new_tag' => 'Make new tag',
+ 'edit_tag' => 'Edit tag ":tag"',
+ 'updated_tag' => 'Updated tag ":tag"',
+ 'created_tag' => 'Tag ":tag" has been created!',
+ 'no_year' => 'No year set',
+ 'no_month' => 'No month set',
+ 'tag_title_nothing' => 'Default tags',
+ 'tag_title_balancingAct' => 'Balancing act tags',
+ 'tag_title_advancePayment' => 'Advance payment tags',
+ 'tags_introduction' => 'Usually tags are singular words, designed to quickly band items together using things like expensive, bill or for-party. In Firefly III, tags can have more properties such as a date, description and location. This allows you to join transactions together in a more meaningful way. For example, you could make a tag called Christmas dinner with friends and add information about the restaurant. Such tags are "singular", you would only use them for a single occasion, perhaps with multiple transactions.',
+ 'tags_group' => 'Tags group transactions together, which makes it possible to store reimbursements (in case you front money for others) and other "balancing acts" where expenses are summed up (the payments on your new TV) or where expenses and deposits are cancelling each other out (buying something with saved money). It\'s all up to you. Using tags the old-fashioned way is of course always possible.',
+ 'tags_start' => 'Create a tag to get started or enter tags when creating new transactions.',
+
+ 'transaction_journal_information' => 'Transaction information',
+ 'transaction_journal_meta' => 'Meta information',
+ 'total_amount' => 'Total amount',
+ 'number_of_decimals' => 'Number of decimals',
+
+ // administration
+ 'administration' => 'Administration',
+ 'user_administration' => 'User administration',
+ 'list_all_users' => 'All users',
+ 'all_users' => 'All users',
+ 'instance_configuration' => 'Configuration',
+ 'firefly_instance_configuration' => 'Configuration options for Firefly III',
+ 'setting_single_user_mode' => 'Single user mode',
+ 'setting_single_user_mode_explain' => 'By default, Firefly III only accepts one (1) registration: you. This is a security measure, preventing others from using your instance unless you allow them to. Future registrations are blocked. When you uncheck this box, others can use your instance as wel, assuming they can reach it (when it is connected to the internet).',
+ 'store_configuration' => 'Store configuration',
+ 'single_user_administration' => 'User administration for :email',
+ 'edit_user' => 'Edit user :email',
+ 'hidden_fields_preferences' => 'Not all fields are visible right now. You must enable them in your settings.',
+ 'user_data_information' => 'User data',
+ 'user_information' => 'User information',
+ 'total_size' => 'total size',
+ 'budget_or_budgets' => 'budget(s)',
+ 'budgets_with_limits' => 'budget(s) with configured amount',
+ 'rule_or_rules' => 'rule(s)',
+ 'rulegroup_or_groups' => 'rule group(s)',
+ 'setting_must_confirm_account' => 'Account confirmation',
+ 'setting_must_confirm_account_explain' => 'When this setting is enabled, users must activate their account before it can be used.',
+ 'configuration_updated' => 'The configuration has been updated',
+ 'setting_is_demo_site' => 'Demo site',
+ 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.',
+ 'setting_send_email_notifications' => 'Send email notifications',
+ 'setting_send_email_explain' => 'Firefly III can send you email notifications about certain events. They will be sent to :site_owner. This email address can be set in the .env file.',
+ 'block_code_bounced' => 'Email message(s) bounced',
+ 'block_code_expired' => 'Demo account expired',
+ 'no_block_code' => 'No reason for block or user not blocked',
+
+
+ // split a transaction:
+ 'transaction_meta_data' => 'Transaction meta-data',
+ 'transaction_dates' => 'Transaction dates',
+ 'splits' => 'Splits',
+ 'split_title_withdrawal' => 'Split your new withdrawal',
+ 'split_intro_one_withdrawal' => 'Firefly supports the "splitting" of a withdrawal.',
+ 'split_intro_two_withdrawal' => 'It means that the amount of money you\'ve spent is divided between several destination expense accounts, budgets or categories.',
+ 'split_intro_three_withdrawal' => 'For example: you could split your :total groceries so you pay :split_one from your "daily groceries" budget and :split_two from your "cigarettes" budget.',
+ 'split_table_intro_withdrawal' => 'Split your withdrawal in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.',
+ 'store_splitted_withdrawal' => 'Store splitted withdrawal',
+ 'update_splitted_withdrawal' => 'Update splitted withdrawal',
+ 'split_title_deposit' => 'Split your new deposit',
+ 'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.',
+ 'split_intro_two_deposit' => 'It means that the amount of money you\'ve earned is divided between several source revenue accounts or categories.',
+ 'split_intro_three_deposit' => 'For example: you could split your :total salary so you get :split_one as your base salary and :split_two as a reimbursment for expenses made.',
+ 'split_table_intro_deposit' => 'Split your deposit in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.',
+ 'store_splitted_deposit' => 'Store splitted deposit',
+ 'split_title_transfer' => 'Split your new transfer',
+ 'split_intro_one_transfer' => 'Firefly supports the "splitting" of a transfer.',
+ 'split_intro_two_transfer' => 'It means that the amount of money you\'re moving is divided between several categories or piggy banks.',
+ 'split_intro_three_transfer' => 'For example: you could split your :total move so you get :split_one in one piggy bank and :split_two in another.',
+ 'split_table_intro_transfer' => 'Split your transfer in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.',
+ 'store_splitted_transfer' => 'Store splitted transfer',
+ 'add_another_split' => 'Add another split',
+ 'split-transactions' => 'Split transactions',
+ 'split-new-transaction' => 'Split a new transaction',
+ 'do_split' => 'Do a split',
+ 'split_this_withdrawal' => 'Split this withdrawal',
+ 'split_this_deposit' => 'Split this deposit',
+ 'split_this_transfer' => 'Split this transfer',
+ 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
+ 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
+
+ // import
+ 'configuration_file_help' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.',
+ 'import_data_index' => 'Index',
+ 'import_file_type_csv' => 'CSV (comma separated values)',
+ 'import_file_type_help' => 'Select the type of file you will upload',
+ 'import_start' => 'Start the import',
+ 'configure_import' => 'Further configure your import',
+ 'import_finish_configuration' => 'Finish configuration',
+ 'settings_for_import' => 'Settings',
+ 'import_status' => 'Import status',
+ 'import_status_text' => 'The import is currently running, or will start momentarily.',
+ 'import_complete' => 'Import configuration complete!',
+ 'import_complete_text' => 'The import is ready to start. All the configuration you needed to do has been done. Please download the configuration file. It will help you with the import should it not go as planned. To actually run the import, you can either execute the following command in your console, or run the web-based import. Depending on your configuration, the console import will give you more feedback.',
+ 'import_download_config' => 'Download configuration',
+ 'import_start_import' => 'Start import',
+ 'import_data' => 'Import data',
+ 'import_data_full' => 'Import data into Firefly III',
+ 'import' => 'Import',
+ 'import_file_help' => 'Select your file',
+ 'import_status_settings_complete' => 'The import is ready to start.',
+ 'import_status_import_complete' => 'The import has completed.',
+ 'import_status_import_running' => 'The import is currently running. Please be patient.',
+ 'import_status_header' => 'Import status and progress',
+ 'import_status_errors' => 'Import errors',
+ 'import_status_report' => 'Import report',
+ 'import_finished' => 'Import has finished',
+ 'import_error_single' => 'An error has occured during the import.',
+ 'import_error_multi' => 'Some errors occured during the import.',
+ 'import_error_fatal' => 'There was an error during the import routine. Please check the log files. The error seems to be:',
+ 'import_error_timeout' => 'The import seems to have timed out. If this error persists, please import your data using the console command.',
+ 'import_double' => 'Row #:row: This row has been imported before, and is stored in :description.',
+ 'import_finished_all' => 'The import has finished. Please check out the results below.',
+ 'import_with_key' => 'Import with key \':key\'',
+ 'import_share_configuration' => 'Please consider downloading your configuration and sharing it at the import configuration center. This will allow other users of Firefly III to import their files more easily.',
+ 'import_finished_report' => 'The import has finished. Please note any errors in the block above this line. All transactions imported during this particular session have been tagged, and you can check them out below. ',
+ 'import_finished_link' => 'The transactions imported can be found in tag :tag.',
+ 'need_at_least_one_account' => 'You need at least one asset account to be able to create piggy banks',
+ 'see_help_top_right' => 'For more information, please check out the help pages using the icon in the top right corner of the page.',
+ 'bread_crumb_import_complete' => 'Import ":key" complete',
+ 'bread_crumb_configure_import' => 'Configure import ":key"',
+ 'bread_crumb_import_finished' => 'Import ":key" finished',
+ 'import_finished_intro' => 'The import has finished! You can now see the new transactions in Firefly.',
+ 'import_finished_text_without_link' => 'It seems there is no tag that points to all your imported transactions. Please look for your imported data in the menu on the left, under "Transactions".',
+ 'import_finished_text_with_link' => 'You can find a list of your imported transactions on the page of the tag that was created for this import.',
+
+ // sandstorm.io errors and messages:
+ 'sandstorm_not_available' => 'This function is not available when you are using Firefly III within a Sandstorm.io environment.',
+
+ // empty lists? no objects? instructions:
+ 'no_transactions_in_period' => 'There are no transactions in this period.',
+ 'no_accounts_title_asset' => 'Let\'s create an asset account!',
+ 'no_accounts_intro_asset' => 'You have no asset accounts yet. Asset accounts are your main accounts: your checking account, savings account, shared account or even your credit card.',
+ 'no_accounts_imperative_asset' => 'To start using Firefly III you must create at least one asset account. Let\'s do so now:',
+ 'no_accounts_create_asset' => 'Create an asset account',
+ 'no_accounts_title_expense' => 'Let\'s create an expense account!',
+ 'no_accounts_intro_expense' => 'You have no expense accounts yet. Expense accounts are the places where you spend money, such as shops and supermarkets.',
+ 'no_accounts_imperative_expense' => 'Expense accounts are created automatically when you create transactions, but you can create one manually too, if you want. Let\'s create one now:',
+ 'no_accounts_create_expense' => 'Create an expense account',
+ 'no_accounts_title_revenue' => 'Let\'s create a revenue account!',
+ 'no_accounts_intro_revenue' => 'You have no revenue accounts yet. Revenue accounts are the places where you receive money from, such as your employer.',
+ 'no_accounts_imperative_revenue' => 'Expense accounts are created automatically when you create transactions, but you can create one manually too, if you want. Let\'s create one now:',
+ 'no_accounts_create_revenue' => 'Create a revenue account',
+ 'no_budgets_title_default' => 'Let\'s create a budget',
+ 'no_budgets_intro_default' => 'You have no budgets yet. Budgets are used to organise your expenses into logical groups, which you can give a soft-cap to limit your expenses.',
+ 'no_budgets_imperative_default' => 'Budgets are the basic tools of financial management. Let\'s create one now:',
+ 'no_budgets_create_default' => 'Create a budget',
+ 'no_categories_title_default' => 'Let\'s create a category!',
+ 'no_categories_intro_default' => 'You have no categories yet. Categories are used to fine tune your transactions and label them with their designated category.',
+ 'no_categories_imperative_default' => 'Categories are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:',
+ 'no_categories_create_default' => 'Create a category',
+ 'no_tags_title_default' => 'Let\'s create a tag!',
+ 'no_tags_intro_default' => 'You have no tags yet. Tags are used to fine tune your transactions and label them with specific keywords.',
+ 'no_tags_imperative_default' => 'Tags are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:',
+ 'no_tags_create_default' => 'Create a tag',
+ 'no_transactions_title_withdrawal' => 'Let\'s create an expense!',
+ 'no_transactions_intro_withdrawal' => 'You have no expenses yet. You should create expenses to start managing your finances.',
+ 'no_transactions_imperative_withdrawal' => 'Have you spent some money? Then you should write it down:',
+ 'no_transactions_create_withdrawal' => 'Create an expense',
+ 'no_transactions_title_deposit' => 'Let\'s create some income!',
+ 'no_transactions_intro_deposit' => 'You have no recorded income yet. You should create income entries to start managing your finances.',
+ 'no_transactions_imperative_deposit' => 'Have you received some money? Then you should write it down:',
+ 'no_transactions_create_deposit' => 'Create a deposit',
+ 'no_transactions_title_transfers' => 'Let\'s create a transfer!',
+ 'no_transactions_intro_transfers' => 'You have no transfers yet. When you move money between asset accounts, it is recorded as a transfer.',
+ 'no_transactions_imperative_transfers' => 'Have you moved some money around? Then you should write it down:',
+ 'no_transactions_create_transfers' => 'Create a transfer',
+ 'no_piggies_title_default' => 'Let\'s create a piggy bank!',
+ 'no_piggies_intro_default' => 'You have no piggy banks yet. You can create piggy banks to divide your savings and keep track of what you\'re saving up for.',
+ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:',
+ 'no_piggies_create_default' => 'Create a new piggy bank',
+ 'no_bills_title_default' => 'Let\'s create a bill!',
+ 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.',
+ 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:',
+ 'no_bills_create_default' => 'Create a bill',
+
+
+];
\ No newline at end of file
From 4adcbf9e48e9b283d8a9dc7f7184ba293c1b98ef Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:20:11 +0200
Subject: [PATCH 037/103] New translations demo.php (Spanish)
---
resources/lang/es_ES/demo.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/lang/es_ES/demo.php b/resources/lang/es_ES/demo.php
index 57bb9cdcb0..f033a24a0b 100644
--- a/resources/lang/es_ES/demo.php
+++ b/resources/lang/es_ES/demo.php
@@ -14,11 +14,11 @@ return [
'accounts-index' => 'Las cajas de ahorro son sus cuentas de banco personales. Las cuentas de gastos contienen sus gastos habituales como compras y salidas con amigos. Las cuentas de ingresos repesentan ingresos de su trabajo u otras fuentes. En esta página puede editarlas o eliminarlas.',
'budgets-index' => 'Esta página le muestra una visión general de sus presupuestos. La barra superior muestra la cantidad que está disponible para ser presupuestado. Esto se puede personalizar para cualquier período haciendo clic en la cantidad a la derecha. La cantidad que has gastado hasta ahora se muestra en la barra de abajo. Debajo están los gastos por presupuesto y lo que ha presupuestado para ellos.',
'reports-index-start' => 'Firefly III admite cuatro tipos de informes. Lea sobre ellos haciendo clic en el icono en la esquina superior derecha.',
- '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' => 'Asegúrese de revisar estos ejemplos: un resumen financiero mensual , un resumen financiero anual y una vista general del presupuesto.',
'currencies-index' => 'Firefly III admite múltiples monedas. A pesar de que la moneda por defecto es el Euro, se puede seleccionar el Dólar de EE.UU, y muchas otras monedas. Como se puede ver se ha incluido una pequeña selección de monedas, pero puedes agregar tu propia moneda si lo deseas. Sin embargo, cambiar la moneda predeterminada no cambiará la moneda de las transacciones existentes: Firefly III admite el uso de varias monedas al mismo tiempo.',
'transactions-index' => 'Estos gastos, depósitos y transferencias no son particularmente imaginativos. Se han generado automáticamente.',
'piggy-banks-index' => 'Como puede ver, hay tres alcancías. Utilice los botones más y menos para influir en la cantidad de dinero en cada alcancía. Haga clic en el nombre de la alcancía para ver la administración de cada una.',
- 'import-index' => 'Of course, any CSV file can be imported into Firefly III ',
- 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.',
+ 'import-index' => 'Por supuesto, cualquier archivo CSV puede ser importado en Firefly III',
+ 'import-configure-security' => 'Debido a problemas de seguridad, su subida se ha sustituido por un archivo local.',
'import-configure-configuration' => 'La configuración que ves a continuación es correcta para el archivo local.',
];
\ No newline at end of file
From 61535bf4b8e0c4cb1682bb2f56fa7a8c75078e6c Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:30:08 +0200
Subject: [PATCH 038/103] New translations firefly.php (Spanish)
---
resources/lang/es_ES/firefly.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/resources/lang/es_ES/firefly.php b/resources/lang/es_ES/firefly.php
index 0c136971fd..3a45d7aa57 100644
--- a/resources/lang/es_ES/firefly.php
+++ b/resources/lang/es_ES/firefly.php
@@ -53,14 +53,14 @@ return [
'flash_info_multiple' => 'Hay un mensaje | Hay: mensajes de la cuenta',
'flash_error_multiple' => 'Hay un error | Hay: contar errores',
'net_worth' => 'Valor Neto',
- 'route_has_no_help' => 'There is no help for this route.',
- 'help_may_not_be_your_language' => 'This help text is in English. It is not yet available in your language',
- 'two_factor_welcome' => 'Hello, :user!',
- 'two_factor_enter_code' => 'To continue, please enter your two factor authentication code. Your application can generate it for you.',
- 'two_factor_code_here' => 'Enter code here',
- 'two_factor_title' => 'Two factor authentication',
- 'authenticate' => 'Authenticate',
- 'two_factor_forgot_title' => 'Lost two factor authentication',
+ 'route_has_no_help' => 'No hay datos en este registro.',
+ 'help_may_not_be_your_language' => 'Este texto de ayuda está en inglés. Aún no está disponible en tu idioma',
+ 'two_factor_welcome' => 'Hola %{user}!',
+ 'two_factor_enter_code' => 'Para continuar, introduce tu código de autenticación de dos pasos. La aplicación puede generarlo para usted.',
+ 'two_factor_code_here' => 'Ingresar código aquí',
+ 'two_factor_title' => 'Autenticación en dos pasos',
+ 'authenticate' => 'Autentificar',
+ 'two_factor_forgot_title' => 'Autenticación en dos pasos perdida',
'two_factor_forgot' => 'I forgot my two-factor thing.',
'two_factor_lost_header' => 'Lost your two factor authentication?',
'two_factor_lost_intro' => 'Unfortunately, this is not something you can reset from the web interface. You have two choices.',
From 70cd8ffb721392240da5aa9ef98e67f815596d5f Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:30:10 +0200
Subject: [PATCH 039/103] New translations validation.php (Spanish)
---
resources/lang/es_ES/validation.php | 42 ++++++++++++++---------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php
index e5ef49397a..81a33dac21 100644
--- a/resources/lang/es_ES/validation.php
+++ b/resources/lang/es_ES/validation.php
@@ -11,26 +11,26 @@
return [
'iban' => 'This is not a valid CBU.',
- 'unique_account_number_for_user' => 'It looks like this account number is already in use.',
- 'deleted_user' => 'Due to security constraints, you cannot register using this email address.',
- 'rule_trigger_value' => 'This value is invalid for the selected trigger.',
- 'rule_action_value' => 'This value is invalid for the selected action.',
- 'invalid_domain' => 'Due to security constraints, you cannot register from this domain.',
- 'file_already_attached' => 'Uploaded file ":name" is already attached to this object.',
- 'file_attached' => 'Succesfully uploaded file ":name".',
- 'file_invalid_mime' => 'File ":name" is of type ":mime" which is not accepted as a new upload.',
- 'file_too_large' => 'File ":name" is too large.',
- 'belongs_to_user' => 'The value of :attribute is unknown',
- 'accepted' => 'The :attribute must be accepted.',
- 'bic' => 'This is not a valid BIC.',
- 'more' => ':attribute must be larger than zero.',
- 'active_url' => 'The :attribute is not a valid URL.',
- 'after' => 'The :attribute must be a date after :date.',
- 'alpha' => 'The :attribute may only contain letters.',
- 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
- 'alpha_num' => 'The :attribute may only contain letters and numbers.',
- 'array' => 'The :attribute must be an array.',
- 'unique_for_user' => 'There already is an entry with this :attribute.',
+ 'unique_account_number_for_user' => 'Parece que este número de cuenta ya está en uso.',
+ 'deleted_user' => 'Debido a restricciones de seguridad, no se puede registrar utilizando esta dirección de correo electrónico.',
+ 'rule_trigger_value' => 'Este valor es válido para el disparador seleccionado.',
+ 'rule_action_value' => 'Este valor es inválido para la acción seleccionado.',
+ 'invalid_domain' => 'Debido a restricciones de seguridad, no se puede registrar utilizando este dominio.',
+ 'file_already_attached' => 'Archivo ":name" ya ha sido añadido para este objeto.',
+ 'file_attached' => 'Archivo subido correctamente ": nombre".',
+ 'file_invalid_mime' => 'Archivo ":name" es de tipo": mime" que no es aceptado como una nueva carga.',
+ 'file_too_large' => 'Archivo ":name" es demasiado grande.',
+ 'belongs_to_user' => 'El valor de :attribute es desconocido',
+ 'accepted' => 'El :attribute debe ser aceptado.',
+ 'bic' => 'Esto no es un BIC válido.',
+ 'more' => ':attribute debe ser mayor que cero.',
+ 'active_url' => 'El campo :attribute no es una URL válida.',
+ 'after' => 'El campo :attribute debe ser una fecha posterior a :date.',
+ 'alpha' => 'El campo :attribute sólo puede contener letras.',
+ 'alpha_dash' => 'El campo :attribute sólo puede contener letras, números y guiones.',
+ 'alpha_num' => 'El campo :attribute sólo puede contener letras y números.',
+ 'array' => 'El campo :attribute debe ser un arreglo.',
+ 'unique_for_user' => 'Ya hay una entrada con esto :attribute.',
'before' => 'The :attribute must be a date before :date.',
'unique_object_for_user' => 'This name is already in use',
'unique_account_for_user' => 'This account name is already in use',
@@ -88,4 +88,4 @@ return [
'in_array' => 'The :attribute field does not exist in :other.',
'present' => 'The :attribute field must be present.',
'amount_zero' => 'The total amount cannot be zero',
-];
+];
\ No newline at end of file
From 0fad9d4ac74cc9d6cb08de4cfac5c9aeaaeff014 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:40:07 +0200
Subject: [PATCH 040/103] New translations validation.php (Spanish)
---
resources/lang/es_ES/validation.php | 48 ++++++++++++++---------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php
index 81a33dac21..d2ccbc2c92 100644
--- a/resources/lang/es_ES/validation.php
+++ b/resources/lang/es_ES/validation.php
@@ -31,30 +31,30 @@ return [
'alpha_num' => 'El campo :attribute sólo puede contener letras y números.',
'array' => 'El campo :attribute debe ser un arreglo.',
'unique_for_user' => 'Ya hay una entrada con esto :attribute.',
- 'before' => 'The :attribute must be a date before :date.',
- 'unique_object_for_user' => 'This name is already in use',
- 'unique_account_for_user' => 'This account name is already in use',
- 'between.numeric' => 'The :attribute must be between :min and :max.',
- 'between.file' => 'The :attribute must be between :min and :max kilobytes.',
- 'between.string' => 'The :attribute must be between :min and :max characters.',
- 'between.array' => 'The :attribute must have between :min and :max items.',
- 'boolean' => 'The :attribute field must be true or false.',
- 'confirmed' => 'The :attribute confirmation does not match.',
- 'date' => 'The :attribute is not a valid date.',
- 'date_format' => 'The :attribute does not match the format :format.',
- 'different' => 'The :attribute and :other must be different.',
- 'digits' => 'The :attribute must be :digits digits.',
- 'digits_between' => 'The :attribute must be between :min and :max digits.',
- 'email' => 'The :attribute must be a valid email address.',
- 'filled' => 'The :attribute field is required.',
- 'exists' => 'The selected :attribute is invalid.',
- 'image' => 'The :attribute must be an image.',
- 'in' => 'The selected :attribute is invalid.',
- 'integer' => 'The :attribute must be an integer.',
- 'ip' => 'The :attribute must be a valid IP address.',
- 'json' => 'The :attribute must be a valid JSON string.',
- 'max.numeric' => 'The :attribute may not be greater than :max.',
- 'max.file' => 'The :attribute may not be greater than :max kilobytes.',
+ 'before' => 'El campo :attribute debe contener una fecha anterior a :date.',
+ 'unique_object_for_user' => 'Este nombre ya está en uso',
+ 'unique_account_for_user' => 'Este nombre cuenta ya está en uso',
+ 'between.numeric' => 'El atributo :attribute debe estar entre :min y :max.',
+ 'between.file' => 'El atributo :attribute debe estar entre :min y :max kilobytes.',
+ 'between.string' => 'El atributo :attribute debe estar entre :min y :max caracteres.',
+ 'between.array' => 'El atributo :attribute debe estar entre :min y :max items.',
+ 'boolean' => 'El campo :attribute debe ser verdadero o falso.',
+ 'confirmed' => 'La confirmación de :attribute no coincide.',
+ 'date' => 'El campo :attribute no es una fecha válida.',
+ 'date_format' => 'El campo :attribute no corresponde con el formato :format.',
+ 'different' => 'Los campos :attribute y :other han de ser diferentes.',
+ 'digits' => 'El campo :attribute debe contener un número de :digits dígitos.',
+ 'digits_between' => 'El campo :attribute debe contener entre :min y :max dígitos.',
+ 'email' => 'El campo :attribute no corresponde con una dirección de e-mail válida.',
+ 'filled' => 'El campo :attribute es requerido.',
+ 'exists' => 'El campo :attribute seleccionado no es correcto.',
+ 'image' => 'El campo :attribute debe ser una imagen.',
+ 'in' => 'El campo :attribute seleccionado es inválido.',
+ 'integer' => 'El campo :attribute debe ser un entero.',
+ 'ip' => 'El campo :attribute debe contener una dirección IP válida.',
+ 'json' => 'El campo :attribute debe ser una cadena JSON válida.',
+ 'max.numeric' => 'El campo :attribute no puede ser mayor que :max.',
+ 'max.file' => 'El campo :attribute no puede ser mayor :max de kilobytes.',
'max.string' => 'The :attribute may not be greater than :max characters.',
'max.array' => 'The :attribute may not have more than :max items.',
'mimes' => 'The :attribute must be a file of type: :values.',
From c3ff69d1478b3c2dc5efdf97fa9e875056a5c0f8 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:40:09 +0200
Subject: [PATCH 041/103] New translations list.php (Spanish)
---
resources/lang/es_ES/list.php | 89 +++++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
create mode 100644 resources/lang/es_ES/list.php
diff --git a/resources/lang/es_ES/list.php b/resources/lang/es_ES/list.php
new file mode 100644
index 0000000000..df53bfd0c9
--- /dev/null
+++ b/resources/lang/es_ES/list.php
@@ -0,0 +1,89 @@
+ 'Botones',
+ 'icon' => 'Icono',
+ 'id' => 'ID',
+ 'create_date' => 'Fecha de creación',
+ 'update_date' => 'Fecha de modificación',
+ 'balance_before' => 'Balance antes de ',
+ 'balance_after' => 'Balance después de la',
+ 'name' => 'Nombre',
+ 'role' => 'Rol',
+ 'currentBalance' => 'Balance actual',
+ 'active' => '¿Está Activo?',
+ 'lastActivity' => 'Actividad más reciente',
+ 'balanceDiff' => 'Diferencia de saldo entre :start y :end',
+ 'matchedOn' => 'Comparado en',
+ 'matchesOn' => 'Comparado en',
+ 'account_type' => 'Tipo de cuenta',
+ 'created_at' => 'Fecha de creación',
+ 'new_balance' => 'New balance',
+ 'account' => 'Account',
+ 'matchingAmount' => 'Amount',
+ 'lastMatch' => 'Last match',
+ 'split_number' => 'Split #',
+ 'destination' => 'Destination',
+ 'source' => 'Source',
+ 'next_expected_match' => 'Next expected match',
+ 'automatch' => 'Auto match?',
+ 'repeat_freq' => 'Repeats',
+ 'description' => 'Description',
+ 'amount' => 'Amount',
+ 'internal_reference' => 'Internal reference',
+ 'date' => 'Date',
+ 'interest_date' => 'Interest date',
+ 'book_date' => 'Book date',
+ 'process_date' => 'Processing date',
+ 'due_date' => 'Due date',
+ 'payment_date' => 'Payment date',
+ 'invoice_date' => 'Invoice date',
+ 'interal_reference' => 'Internal reference',
+ 'notes' => 'Notes',
+ 'from' => 'From',
+ 'piggy_bank' => 'Piggy bank',
+ 'to' => 'To',
+ 'budget' => 'Budget',
+ 'category' => 'Category',
+ 'bill' => 'Bill',
+ 'withdrawal' => 'Withdrawal',
+ 'deposit' => 'Deposit',
+ 'transfer' => 'Transfer',
+ 'type' => 'Type',
+ 'completed' => 'Completed',
+ 'iban' => 'IBAN',
+ 'paid_current_period' => 'Paid this period',
+ 'email' => 'Email',
+ 'registered_at' => 'Registered at',
+ 'is_activated' => 'Is activated',
+ 'is_blocked' => 'Is blocked',
+ 'is_admin' => 'Is admin',
+ 'has_two_factor' => 'Has 2FA',
+ 'confirmed_from' => 'Confirmed from',
+ 'registered_from' => 'Registered from',
+ 'blocked_code' => 'Block code',
+ 'domain' => 'Domain',
+ 'registration_attempts' => 'Registration attempts',
+ 'source_account' => 'Source account',
+ 'destination_account' => 'Destination account',
+
+ 'accounts_count' => 'Number of accounts',
+ 'journals_count' => 'Number of transactions',
+ 'attachments_count' => 'Number of attachments',
+ 'bills_count' => 'Number of bills',
+ 'categories_count' => 'Number of categories',
+ 'export_jobs_count' => 'Number of export jobs',
+ 'import_jobs_count' => 'Number of import jobs',
+ 'budget_count' => 'Number of budgets',
+ 'rule_and_groups_count' => 'Number of rules and rule groups',
+ 'tags_count' => 'Number of tags',
+];
\ No newline at end of file
From 94939ea3d31b88f0c67f96cb7c4ce6a3304bc6a4 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:40:13 +0200
Subject: [PATCH 042/103] New translations firefly.php (Portuguese, Brazilian)
---
resources/lang/pt_BR/firefly.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/resources/lang/pt_BR/firefly.php b/resources/lang/pt_BR/firefly.php
index 021c1955ca..7d7ee85b8c 100644
--- a/resources/lang/pt_BR/firefly.php
+++ b/resources/lang/pt_BR/firefly.php
@@ -26,8 +26,8 @@ return [
'showEverything' => 'Mostrar tudo',
'never' => 'Nunca',
'search_results_for' => 'Pesquisar resultados por ":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' => 'Busca avançada',
+ 'advanced_search_intro' => 'Existem vários modificadores que você pode usar em sua busca para limitar os resultados. Se você usar qualquer um destes, a busca vai apenas transações de retorno. Por favor, clique no -ícone para obter mais informações.',
'bounced_error' => 'A mensagem enviado para :email ressaltado, não tem acesso para você.',
'deleted_error' => 'Estas credenciais não correspondem aos nossos registros.',
'general_blocked_error' => 'Sua conta foi desativada, você não pode entrar.',
@@ -69,12 +69,12 @@ return [
'warning_much_data' => ':days dias de dados podem demorar um pouco para carregar.',
'registered' => 'Você se registrou com sucesso!',
'search' => 'Pesquisa',
- 'search_found_accounts' => 'Found :count account(s) for your query.',
- 'search_found_categories' => 'Found :count category(ies) for your query.',
- 'search_found_budgets' => 'Found :count budget(s) for your query.',
- 'search_found_tags' => 'Found :count tag(s) for your query.',
- 'search_found_transactions' => 'Found :count transaction(s) for your query.',
- 'results_limited' => 'The results are limited to :count entries.',
+ 'search_found_accounts' => 'Encontrado: contar conta (s) para sua consulta.',
+ 'search_found_categories' => 'Encontrado: contar categoria(s) para sua consulta.',
+ 'search_found_budgets' => 'Encontrado: contagem despesa(s) para a sua consulta.',
+ 'search_found_tags' => 'Encontrado: contar Tag (s) para sua consulta.',
+ 'search_found_transactions' => 'Encontrado: contagem de transação para a sua consulta.',
+ 'results_limited' => 'Os resultados são limitados a: contar as entradas.',
'tagbalancingAct' => 'Saldo',
'tagadvancePayment' => 'Pagamento antecipado',
'tagnothing' => '',
From 1e9dacb6e4fff823c49660ea4f68cb3b2fe278eb Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:40:16 +0200
Subject: [PATCH 043/103] New translations pagination.php (Spanish)
---
resources/lang/es_ES/pagination.php | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 resources/lang/es_ES/pagination.php
diff --git a/resources/lang/es_ES/pagination.php b/resources/lang/es_ES/pagination.php
new file mode 100644
index 0000000000..832406ce27
--- /dev/null
+++ b/resources/lang/es_ES/pagination.php
@@ -0,0 +1,17 @@
+ '« Anterior',
+ 'next' => 'Siguiente »',
+
+];
\ No newline at end of file
From 1bd82d71a26fee4581aef210233bc63d6562faee Mon Sep 17 00:00:00 2001
From: James Cole
Date: Thu, 25 May 2017 16:50:09 +0200
Subject: [PATCH 044/103] New translations list.php (Spanish)
---
resources/lang/es_ES/list.php | 116 +++++++++++++++++-----------------
1 file changed, 58 insertions(+), 58 deletions(-)
diff --git a/resources/lang/es_ES/list.php b/resources/lang/es_ES/list.php
index df53bfd0c9..924c3cbf74 100644
--- a/resources/lang/es_ES/list.php
+++ b/resources/lang/es_ES/list.php
@@ -23,67 +23,67 @@ return [
'active' => '¿Está Activo?',
'lastActivity' => 'Actividad más reciente',
'balanceDiff' => 'Diferencia de saldo entre :start y :end',
- 'matchedOn' => 'Comparado en',
- 'matchesOn' => 'Comparado en',
+ 'matchedOn' => 'Encontrado en',
+ 'matchesOn' => 'Encontrado en',
'account_type' => 'Tipo de cuenta',
'created_at' => 'Fecha de creación',
- 'new_balance' => 'New balance',
- 'account' => 'Account',
- 'matchingAmount' => 'Amount',
- 'lastMatch' => 'Last match',
- 'split_number' => 'Split #',
- 'destination' => 'Destination',
- 'source' => 'Source',
- 'next_expected_match' => 'Next expected match',
- 'automatch' => 'Auto match?',
- 'repeat_freq' => 'Repeats',
- 'description' => 'Description',
- 'amount' => 'Amount',
- 'internal_reference' => 'Internal reference',
- 'date' => 'Date',
- 'interest_date' => 'Interest date',
- 'book_date' => 'Book date',
- 'process_date' => 'Processing date',
- 'due_date' => 'Due date',
- 'payment_date' => 'Payment date',
- 'invoice_date' => 'Invoice date',
- 'interal_reference' => 'Internal reference',
- 'notes' => 'Notes',
- 'from' => 'From',
- 'piggy_bank' => 'Piggy bank',
- 'to' => 'To',
- 'budget' => 'Budget',
- 'category' => 'Category',
- 'bill' => 'Bill',
- 'withdrawal' => 'Withdrawal',
- 'deposit' => 'Deposit',
- 'transfer' => 'Transfer',
- 'type' => 'Type',
- 'completed' => 'Completed',
+ 'new_balance' => 'Nuevo balance',
+ 'account' => 'Cuenta',
+ 'matchingAmount' => 'Monto',
+ 'lastMatch' => 'Última coincidencia',
+ 'split_number' => 'División #',
+ 'destination' => 'Destino',
+ 'source' => 'Origen',
+ 'next_expected_match' => 'Próxima coincidencia esperada',
+ 'automatch' => '¿Buscar coincidencia automaticamente?',
+ 'repeat_freq' => 'Repetición:',
+ 'description' => 'Descripción',
+ 'amount' => 'Monto',
+ 'internal_reference' => 'Referencia interna',
+ 'date' => 'Fecha',
+ 'interest_date' => 'Tasa de interés',
+ 'book_date' => 'Libro fecha',
+ 'process_date' => 'Fecha de procesamiento',
+ 'due_date' => 'Fecha de vencimiento',
+ 'payment_date' => 'Fecha de pago',
+ 'invoice_date' => 'Fecha de facturación',
+ 'interal_reference' => 'Referencia interna',
+ 'notes' => 'Notas',
+ 'from' => 'Desde',
+ 'piggy_bank' => 'Alcancilla',
+ 'to' => 'Hasta',
+ 'budget' => 'Presupuesto',
+ 'category' => 'Categoría',
+ 'bill' => 'Factura',
+ 'withdrawal' => 'Retiro',
+ 'deposit' => 'Depósito',
+ 'transfer' => 'Trasferencia',
+ 'type' => 'Tipo',
+ 'completed' => 'Completado',
'iban' => 'IBAN',
- 'paid_current_period' => 'Paid this period',
+ 'paid_current_period' => 'Pagado este período',
'email' => 'Email',
- 'registered_at' => 'Registered at',
- 'is_activated' => 'Is activated',
- 'is_blocked' => 'Is blocked',
- 'is_admin' => 'Is admin',
- 'has_two_factor' => 'Has 2FA',
- 'confirmed_from' => 'Confirmed from',
- 'registered_from' => 'Registered from',
- 'blocked_code' => 'Block code',
- 'domain' => 'Domain',
- 'registration_attempts' => 'Registration attempts',
- 'source_account' => 'Source account',
- 'destination_account' => 'Destination account',
+ 'registered_at' => 'Registrado el',
+ 'is_activated' => 'Está activado',
+ 'is_blocked' => 'Está bloqueado',
+ 'is_admin' => '¿Es el administrador?',
+ 'has_two_factor' => 'Tiene 2FA',
+ 'confirmed_from' => 'Confirmado desde',
+ 'registered_from' => 'Registrado desde',
+ 'blocked_code' => 'Bloque de código',
+ 'domain' => 'Dominio',
+ 'registration_attempts' => 'Intentos de registro',
+ 'source_account' => 'Cuenta origen',
+ 'destination_account' => 'Cuenta destino',
- 'accounts_count' => 'Number of accounts',
- 'journals_count' => 'Number of transactions',
- 'attachments_count' => 'Number of attachments',
- 'bills_count' => 'Number of bills',
- 'categories_count' => 'Number of categories',
- 'export_jobs_count' => 'Number of export jobs',
- 'import_jobs_count' => 'Number of import jobs',
- 'budget_count' => 'Number of budgets',
- 'rule_and_groups_count' => 'Number of rules and rule groups',
- 'tags_count' => 'Number of tags',
+ 'accounts_count' => 'Número de cuentas',
+ 'journals_count' => 'Número de transacciones',
+ 'attachments_count' => 'Núm. de datos adjuntos',
+ 'bills_count' => 'Número de facturas',
+ 'categories_count' => 'Número de categorías',
+ 'export_jobs_count' => 'Número de operaciones de exportación',
+ 'import_jobs_count' => 'Número de operaciones de importación',
+ 'budget_count' => 'Número de presupuestos',
+ 'rule_and_groups_count' => 'Número de reglas y grupos de reglas',
+ 'tags_count' => 'Número de etiquetas',
];
\ No newline at end of file
From 01fedc0bf8d1d71608dc1d4b613865f156517318 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 06:45:38 +0200
Subject: [PATCH 045/103] Fix for #593, as inspired by @nhaarman.
---
.../Controllers/Chart/BudgetController.php | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 189c1e2dea..8a0d923231 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -31,6 +31,7 @@ use Illuminate\Support\Collection;
use Navigation;
use Preferences;
use Response;
+use Steam;
/**
* Class BudgetController
@@ -320,12 +321,12 @@ class BudgetController extends Controller
['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar',],
];
-
/** @var Budget $budget */
foreach ($budgets as $budget) {
// get relevant repetitions:
$limits = $this->repository->getBudgetLimits($budget, $start, $end);
$expenses = $this->getExpensesForBudget($limits, $budget, $start, $end);
+
foreach ($expenses as $name => $row) {
$chartData[0]['entries'][$name] = $row['spent'];
$chartData[1]['entries'][$name] = $row['left'];
@@ -529,9 +530,7 @@ class BudgetController extends Controller
$rows = $this->spentInPeriodMulti($budget, $limits);
foreach ($rows as $name => $row) {
if (bccomp($row['spent'], '0') !== 0 || bccomp($row['left'], '0') !== 0) {
- $return[$name]['spent'] = bcmul($row['spent'], '-1');
- $return[$name]['left'] = $row['left'];
- $return[$name]['overspent'] = bcmul($row['overspent'], '-1');
+ $return[$name] = $row;
}
}
unset($rows, $row);
@@ -563,6 +562,7 @@ class BudgetController extends Controller
/** @var BudgetLimit $budgetLimit */
foreach ($limits as $budgetLimit) {
$expenses = $this->repository->spentInPeriod(new Collection([$budget]), new Collection, $budgetLimit->start_date, $budgetLimit->end_date);
+ $expenses = Steam::positive($expenses);
if ($limits->count() > 1) {
$name = $budget->name . ' ' . trans(
@@ -578,10 +578,14 @@ class BudgetController extends Controller
* left: amount of budget limit min spent, or 0 when < 0.
* spent: spent, or amount of budget limit when > amount
*/
- $amount = $budgetLimit->amount;
- $left = bccomp(bcadd($amount, $expenses), '0') < 1 ? '0' : bcadd($amount, $expenses);
- $spent = bccomp($expenses, $amount) === 1 ? $expenses : bcmul($amount, '-1');
- $overspent = bccomp(bcadd($amount, $expenses), '0') < 1 ? bcadd($amount, $expenses) : '0';
+ $amount = $budgetLimit->amount;
+ $leftInLimit = bcsub($amount, $expenses);
+ $hasOverspent = bccomp($leftInLimit, '0') === -1;
+
+ $left = $hasOverspent ? '0' : bcsub($amount, $expenses);
+ $spent = $hasOverspent ? $amount : $expenses;
+ $overspent = $hasOverspent ? Steam::positive($leftInLimit) : '0';
+
$return[$name] = [
'left' => $left,
'overspent' => $overspent,
From 2b1ab5c6ef9689bdd6c02eae9e89be6e916616fa Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 07:05:42 +0200
Subject: [PATCH 046/103] Fixed edit of multi currency transaction, ##651
---
app/Repositories/Journal/JournalRepository.php | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 98ab2dafb5..ef4820ac2e 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -259,18 +259,9 @@ class JournalRepository implements JournalRepositoryInterface
$journal->description = $data['description'];
$journal->date = $data['date'];
$accounts = $this->storeAccounts($journal->transactionType, $data);
+ $data = $this->verifyNativeAmount($data, $accounts);
$amount = strval($data['amount']);
- if ($data['currency_id'] !== $journal->transaction_currency_id) {
- // user has entered amount in foreign currency.
- // amount in "our" currency is $data['exchanged_amount']:
- $amount = strval($data['exchanged_amount']);
- // other values must be stored as well:
- $data['original_amount'] = $data['amount'];
- $data['original_currency_id'] = $data['currency_id'];
-
- }
-
// unlink all categories, recreate them:
$journal->categories()->detach();
$journal->budgets()->detach();
From 8cdc1f00140e4b67bc26fd5c69efaa5118aaae37 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 12:59:14 +0200
Subject: [PATCH 047/103] Rename several twig files.
---
app/Http/Controllers/RuleController.php | 2 +-
resources/views/accounts/show.twig | 2 +-
resources/views/bills/show.twig | 2 +-
resources/views/budgets/no-budget.twig | 2 +-
resources/views/budgets/show.twig | 2 +-
resources/views/categories/no-category.twig | 2 +-
resources/views/categories/show.twig | 2 +-
resources/views/index.twig | 2 +-
.../list/{journals-tiny-tasker.twig => journals-tiny.twig} | 0
resources/views/list/{journals-tasker.twig => journals.twig} | 0
.../views/popup/list/{journals-tasker.twig => journals.twig} | 0
resources/views/popup/report/balance-amount.twig | 2 +-
resources/views/popup/report/budget-spent-amount.twig | 2 +-
resources/views/popup/report/category-entry.twig | 2 +-
resources/views/popup/report/expense-entry.twig | 2 +-
resources/views/popup/report/income-entry.twig | 2 +-
resources/views/reports/audit/report.twig | 2 +-
.../{journals-audit-tasker.twig => journals-audit.twig} | 0
resources/views/tags/show.twig | 2 +-
resources/views/transactions/index.twig | 2 +-
20 files changed, 16 insertions(+), 16 deletions(-)
rename resources/views/list/{journals-tiny-tasker.twig => journals-tiny.twig} (100%)
rename resources/views/list/{journals-tasker.twig => journals.twig} (100%)
rename resources/views/popup/list/{journals-tasker.twig => journals.twig} (100%)
rename resources/views/reports/partials/{journals-audit-tasker.twig => journals-audit.twig} (100%)
diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php
index a7247b7705..ba4dc6d208 100644
--- a/app/Http/Controllers/RuleController.php
+++ b/app/Http/Controllers/RuleController.php
@@ -306,7 +306,7 @@ class RuleController extends Controller
}
// Return json response
- $view = view('list.journals-tiny-tasker', ['transactions' => $matchingTransactions])->render();
+ $view = view('list.journals-tiny', ['transactions' => $matchingTransactions])->render();
return Response::json(['html' => $view, 'warning' => $warning]);
}
diff --git a/resources/views/accounts/show.twig b/resources/views/accounts/show.twig
index bedb9ee721..40da0b960c 100644
--- a/resources/views/accounts/show.twig
+++ b/resources/views/accounts/show.twig
@@ -86,7 +86,7 @@
{{ 'transactions'|_ }}
- {% include 'list.journals-tasker' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true} %}
+ {% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true} %}
{% if periods.count > 0 %}
- {% include 'list.journals-tasker' with {'journals': journals,'hideBudgets': true} %}
+ {% include 'list.journals' with {'journals': journals,'hideBudgets': true} %}
{% if periods.count > 0 %}
- {% include 'list.journals-tasker' with {hideBudgets:true, hideBills:true} %}
+ {% include 'list.journals' with {hideBudgets:true, hideBills:true} %}
{% if budgetLimit %}
- {% include 'list.journals-tasker' with {'journals': journals, 'hideCategories':true} %}
+ {% include 'list.journals' with {'journals': journals, 'hideCategories':true} %}
{% if periods.count > 0 %}
- {% include 'list.journals-tasker' with {hideCategories: true} %}
+ {% include 'list.journals' with {hideCategories: true} %}
{% if periods.count > 0 %}
- {% include 'list.journals-tiny-tasker' with {'transactions': data[0],'account': data[1]} %}
+ {% include 'list.journals-tiny' with {'transactions': data[0],'account': data[1]} %}
{% else %}
diff --git a/resources/views/list/journals-tiny-tasker.twig b/resources/views/list/journals-tiny.twig
similarity index 100%
rename from resources/views/list/journals-tiny-tasker.twig
rename to resources/views/list/journals-tiny.twig
diff --git a/resources/views/list/journals-tasker.twig b/resources/views/list/journals.twig
similarity index 100%
rename from resources/views/list/journals-tasker.twig
rename to resources/views/list/journals.twig
diff --git a/resources/views/popup/list/journals-tasker.twig b/resources/views/popup/list/journals.twig
similarity index 100%
rename from resources/views/popup/list/journals-tasker.twig
rename to resources/views/popup/list/journals.twig
diff --git a/resources/views/popup/report/balance-amount.twig b/resources/views/popup/report/balance-amount.twig
index 1f5bd820bb..426aab6d07 100644
--- a/resources/views/popup/report/balance-amount.twig
+++ b/resources/views/popup/report/balance-amount.twig
@@ -10,7 +10,7 @@
{% set hideSource = true %}
{% set hideBudget = true %}
- {% include 'popup/list/journals-tasker' %}
+ {% include 'popup/list/journals' %}
{% set hideBudget = true %}
- {% include 'popup/list/journals-tasker' %}
+ {% include 'popup/list/journals' %}
{% set hideCategory = true %}
- {% include 'popup/list/journals-tasker' %}
+ {% include 'popup/list/journals' %}
{% set hideDestination = true %}
- {% include 'popup/list/journals-tasker' %}
+ {% include 'popup/list/journals' %}
- {% include 'list/journals-tasker' %}
+ {% include 'list/journals' %}
{% if periods %}
- {% include 'list.journals-tasker' with {'journals': journals} %}
+ {% include 'list.journals' with {'journals': journals} %}
{% if periods.count > 0 %}
From ec1507d644d348c7682530ba0be04899d8ece354 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 12:59:27 +0200
Subject: [PATCH 048/103] Add some documentation [skip ci]
---
app/Generator/Chart/Basic/GeneratorInterface.php | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/app/Generator/Chart/Basic/GeneratorInterface.php b/app/Generator/Chart/Basic/GeneratorInterface.php
index 92b1b29d93..31deeb0a30 100644
--- a/app/Generator/Chart/Basic/GeneratorInterface.php
+++ b/app/Generator/Chart/Basic/GeneratorInterface.php
@@ -22,10 +22,15 @@ interface GeneratorInterface
{
/**
- * Will generate a (ChartJS) compatible array from the given input. Expects this format:
+ * Will generate a Chart JS compatible array from the given input. Expects this format
+ *
+ * Will take labels for all from first set.
*
* 0: [
* 'label' => 'label of set',
+ * 'type' => bar or line, optional
+ * 'yAxisID' => ID of yAxis, optional, will not be included when unused.
+ * 'fill' => if to fill a line? optional, will not be included when unused.
* 'entries' =>
* [
* 'label-of-entry' => 'value'
@@ -33,12 +38,16 @@ interface GeneratorInterface
* ]
* 1: [
* 'label' => 'label of another set',
+ * 'type' => bar or line, optional
+ * 'yAxisID' => ID of yAxis, optional, will not be included when unused.
+ * 'fill' => if to fill a line? optional, will not be included when unused.
* 'entries' =>
* [
* 'label-of-entry' => 'value'
* ]
* ]
*
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
*
* @param array $data
*
From c05f34437114fba7ad9c8d75f48a52ac1e1765ae Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 13:00:09 +0200
Subject: [PATCH 049/103] Code clean up [skip ci]
---
app/Http/Controllers/Transaction/SingleController.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index 27c7cdba77..eef9bd7ab4 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -250,8 +250,8 @@ class SingleController extends Controller
'source_account_name' => $sourceAccounts->first()->edit_name,
'destination_account_id' => $destinationAccounts->first()->id,
'destination_account_name' => $destinationAccounts->first()->edit_name,
- 'amount' => $journal->amountPositive(),
- 'currency' => $journal->transactionCurrency,
+ 'amount' => $journal->amountPositive(),
+ 'currency' => $journal->transactionCurrency,
// new custom fields:
'due_date' => $journal->dateAsString('due_date'),
@@ -261,8 +261,8 @@ class SingleController extends Controller
'notes' => $journal->getMeta('notes'),
// exchange rate fields
- 'native_amount' => $journal->amountPositive(),
- 'native_currency' => $journal->transactionCurrency,
+ 'native_amount' => $journal->amountPositive(),
+ 'native_currency' => $journal->transactionCurrency,
];
// if user has entered a foreign currency, update some fields
From 74664afa682b79099f4e02eb569207f05c7f259a Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 13:00:24 +0200
Subject: [PATCH 050/103] Was not able to remove opening balance.
---
.../Account/AccountRepository.php | 26 +++++++++++++------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 423efcd23e..122e8f7d5c 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -466,7 +466,12 @@ class AccountRepository implements AccountRepositoryInterface
*/
protected function storeInitialBalance(Account $account, array $data): TransactionJournal
{
- $amount = $data['openingBalance'];
+ $amount = strval($data['openingBalance']);
+
+ if (bccomp($amount, '0') === 0) {
+ return new TransactionJournal;
+ }
+
$name = $data['name'];
$currencyId = $data['currency_id'];
$opposing = $this->storeOpposingAccount($name);
@@ -487,12 +492,12 @@ class AccountRepository implements AccountRepositoryInterface
$firstAccount = $account;
$secondAccount = $opposing;
$firstAmount = $amount;
- $secondAmount = $amount * -1;
+ $secondAmount = bcmul($amount, '-1');
if ($data['openingBalance'] < 0) {
$firstAccount = $opposing;
$secondAccount = $account;
- $firstAmount = $amount * -1;
+ $firstAmount = bcmul($amount, '-1');
$secondAmount = $amount;
}
@@ -606,9 +611,15 @@ class AccountRepository implements AccountRepositoryInterface
protected function updateOpeningBalanceJournal(Account $account, TransactionJournal $journal, array $data): bool
{
$date = $data['openingBalanceDate'];
- $amount = $data['openingBalance'];
+ $amount = strval($data['openingBalance']);
$currencyId = intval($data['currency_id']);
+ if (bccomp($amount, '0') === 0) {
+ $journal->delete();
+
+ return true;
+ }
+
// update date:
$journal->date = $date;
$journal->transaction_currency_id = $currencyId;
@@ -621,7 +632,7 @@ class AccountRepository implements AccountRepositoryInterface
$transaction->save();
}
if ($account->id != $transaction->account_id) {
- $transaction->amount = $amount * -1;
+ $transaction->amount = bcmul($amount, '-1');
$transaction->save();
}
}
@@ -631,6 +642,7 @@ class AccountRepository implements AccountRepositoryInterface
}
+
/**
* @param array $data
*
@@ -638,9 +650,7 @@ class AccountRepository implements AccountRepositoryInterface
*/
protected function validOpeningBalanceData(array $data): bool
{
- if (isset($data['openingBalance']) && isset($data['openingBalanceDate'])
- && bccomp(strval($data['openingBalance']), '0') !== 0
- ) {
+ if (isset($data['openingBalance']) && isset($data['openingBalanceDate'])) {
Log::debug('Array has valid opening balance data.');
return true;
From 8273f467b6511f40e90d327ed0f78ad5cbd0abc0 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 13:00:43 +0200
Subject: [PATCH 051/103] Refactor some JS functions.
---
public/js/ff/charts.js | 6 +++---
public/js/ff/reports/category/month.js | 20 +++++++++++---------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js
index 35b99f0b00..fa0c8f049a 100644
--- a/public/js/ff/charts.js
+++ b/public/js/ff/charts.js
@@ -75,7 +75,7 @@ function lineChart(URI, container) {
"use strict";
var colorData = true;
- var options = defaultChartOptions;
+ var options = $.extend(true, {}, defaultChartOptions);
var chartType = 'line';
drawAChart(URI, container, chartType, options, colorData);
@@ -188,7 +188,7 @@ function columnChart(URI, container) {
"use strict";
console.log('Going to draw column chart for ' + URI + ' in ' + container);
var colorData = true;
- var options = defaultChartOptions;
+ var options = $.extend(true, {}, defaultChartOptions);
var chartType = 'bar';
drawAChart(URI, container, chartType, options, colorData);
@@ -224,7 +224,7 @@ function pieChart(URI, container) {
"use strict";
var colorData = false;
- var options = defaultPieOptions;
+ var options = $.extend(true, {}, defaultPieOptions);
var chartType = 'pie';
drawAChart(URI, container, chartType, options, colorData);
diff --git a/public/js/ff/reports/category/month.js b/public/js/ff/reports/category/month.js
index 84f3444d9b..e803ff3de7 100644
--- a/public/js/ff/reports/category/month.js
+++ b/public/js/ff/reports/category/month.js
@@ -15,19 +15,19 @@ $(function () {
drawChart();
$('#categories-in-pie-chart-checked').on('change', function () {
- redrawPieChart('categories-in-pie-chart', categoryIncomeUri);
+ redrawPieChart(categoryIncomeUri, 'categories-in-pie-chart');
});
$('#categories-out-pie-chart-checked').on('change', function () {
- redrawPieChart('categories-out-pie-chart', categoryExpenseUri);
+ redrawPieChart(categoryExpenseUri, 'categories-out-pie-chart');
});
$('#accounts-in-pie-chart-checked').on('change', function () {
- redrawPieChart('accounts-in-pie-chart', accountIncomeUri);
+ redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
});
$('#accounts-out-pie-chart-checked').on('change', function () {
- redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
+ redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
});
});
@@ -40,15 +40,17 @@ function drawChart() {
doubleYChart(mainUri, 'in-out-chart');
// draw pie chart of income, depending on "show other transactions too":
- redrawPieChart('categories-in-pie-chart', categoryIncomeUri);
- redrawPieChart('categories-out-pie-chart', categoryExpenseUri);
- redrawPieChart('accounts-in-pie-chart', accountIncomeUri);
- redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
+ redrawPieChart(categoryIncomeUri, 'categories-in-pie-chart');
+ redrawPieChart(categoryExpenseUri, 'categories-out-pie-chart');
+ redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
+ redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
+ stackedColumnChart(expenseAccountTimeUri, 'expense-time-chart');
+ stackedColumnChart(revenueAccountTimeUri, 'revenue-time-chart');
}
-function redrawPieChart(container, uri) {
+function redrawPieChart(uri, container) {
"use strict";
var checkbox = $('#' + container + '-checked');
From e1aebbe12b550cd91cd4891a3028d1b52e8837a2 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 13:01:24 +0200
Subject: [PATCH 052/103] Remove non-existing charts.
---
public/js/ff/reports/category/month.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/public/js/ff/reports/category/month.js b/public/js/ff/reports/category/month.js
index e803ff3de7..b07941a944 100644
--- a/public/js/ff/reports/category/month.js
+++ b/public/js/ff/reports/category/month.js
@@ -45,9 +45,6 @@ function drawChart() {
redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
- stackedColumnChart(expenseAccountTimeUri, 'expense-time-chart');
- stackedColumnChart(revenueAccountTimeUri, 'revenue-time-chart');
-
}
function redrawPieChart(uri, container) {
From 4ff5f33966a8480820e6a32ebc5c3debef3c84d0 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 2 Jun 2017 13:01:43 +0200
Subject: [PATCH 053/103] Prep for solid multi-currency configuration.
---
.../2017_06_02_105232_changes_for_v450.php | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 database/migrations/2017_06_02_105232_changes_for_v450.php
diff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.php
new file mode 100644
index 0000000000..f0f39c839d
--- /dev/null
+++ b/database/migrations/2017_06_02_105232_changes_for_v450.php
@@ -0,0 +1,42 @@
+decimal('foreign_amount', 22, 12)->after('amount');
+ }
+ );
+
+ // add foreign transaction currency id to transactions (is nullable):
+ Schema::table(
+ 'transactions', function (Blueprint $table) {
+ $table->integer('foreign_currency_id', false, true)->after('foreign_amount')->nullable();
+ $table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
+ }
+ );
+ }
+}
From 0868aac750cd7919c971df386be60675f8993bae Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 08:48:40 +0200
Subject: [PATCH 054/103] Small update for 4.5.0 SQL update.
---
database/migrations/2017_06_02_105232_changes_for_v450.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.php
index f0f39c839d..1f44bedf52 100644
--- a/database/migrations/2017_06_02_105232_changes_for_v450.php
+++ b/database/migrations/2017_06_02_105232_changes_for_v450.php
@@ -27,14 +27,14 @@ class ChangesForV450 extends Migration
// add "foreign_amount" to transactions
Schema::table(
'transactions', function (Blueprint $table) {
- $table->decimal('foreign_amount', 22, 12)->after('amount');
+ $table->decimal('foreign_amount', 22, 12)->nullable()->after('amount');
}
);
// add foreign transaction currency id to transactions (is nullable):
Schema::table(
'transactions', function (Blueprint $table) {
- $table->integer('foreign_currency_id', false, true)->after('foreign_amount')->nullable();
+ $table->integer('foreign_currency_id', false, true)->default(null)->after('foreign_amount')->nullable();
$table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
}
);
From d37b46effc500f469ea3b2954dac3b2913586361 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 08:48:54 +0200
Subject: [PATCH 055/103] Database upgrade routine.
---
app/Console/Commands/UpgradeDatabase.php | 52 ++++++++++++++++++++++--
1 file changed, 49 insertions(+), 3 deletions(-)
diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.php
index aa2656b712..2c3a20f3a0 100644
--- a/app/Console/Commands/UpgradeDatabase.php
+++ b/app/Console/Commands/UpgradeDatabase.php
@@ -32,6 +32,7 @@ use Illuminate\Database\QueryException;
use Log;
use Preferences;
use Schema;
+use Steam;
/**
* Class UpgradeDatabase
@@ -72,9 +73,54 @@ class UpgradeDatabase extends Command
$this->repairPiggyBanks();
$this->updateAccountCurrencies();
$this->updateJournalCurrencies();
+ $this->currencyInfoToTransactions();
$this->info('Firefly III database is up to date.');
}
+ /**
+ * Moves the currency id info to the transaction instead of the journal.
+ */
+ private function currencyInfoToTransactions()
+ {
+ $count = 0;
+ $expanded = 0;
+ $set = TransactionJournal::with('transactions')->get();
+ /** @var TransactionJournal $journal */
+ foreach ($set as $journal) {
+ /** @var Transaction $transaction */
+ foreach ($journal->transactions as $transaction) {
+ if (is_null($transaction->transaction_currency_id)) {
+ $transaction->transaction_currency_id = $journal->transaction_currency_id;
+ $transaction->save();
+ $count++;
+ }
+ }
+
+
+ // read and use the foreign amounts when present.
+ if ($journal->hasMeta('foreign_amount')) {
+ $amount = Steam::positive($journal->getMeta('foreign_amount'));
+
+ // update both transactions:
+ foreach ($journal->transactions as $transaction) {
+ $transaction->foreign_amount = $amount;
+ if (bccomp($transaction->amount, '0') === -1) {
+ // update with negative amount:
+ $transaction->foreign_amount = bcmul($amount, '-1');
+ }
+ // set foreign currency id:
+ $transaction->foreign_currency_id = intval($journal->getMeta('foreign_currency_id'));
+ $transaction->save();
+ }
+ $journal->deleteMeta('foreign_amount');
+ $journal->deleteMeta('foreign_currency_id');
+ }
+
+ }
+
+ $this->line(sprintf('Updated currency information for %d transactions', $count));
+ }
+
/**
* Migrate budget repetitions to new format.
*/
@@ -269,7 +315,7 @@ class UpgradeDatabase extends Command
$repository = app(CurrencyRepositoryInterface::class);
$notification = '%s #%d uses %s but should use %s. It has been updated. Please verify this in Firefly III.';
$transfer = 'Transfer #%d has been updated to use the correct currencies. Please verify this in Firefly III.';
- $driver = DB::connection()->getDriverName();
+ $driver = DB::connection()->getDriverName();
foreach ($types as $type => $operator) {
$query = TransactionJournal
@@ -282,10 +328,10 @@ class UpgradeDatabase extends Command
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
->where('transaction_types.type', $type)
->where('account_meta.name', 'currency_id');
- if($driver === 'postgresql') {
+ if ($driver === 'postgresql') {
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('cast(account_meta.data as int)'));
}
- if($driver !== 'postgresql') {
+ if ($driver !== 'postgresql') {
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'));
}
From 4ce4c3138c3d36164b3e6a7b887d57cd31b1fd88 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 08:49:22 +0200
Subject: [PATCH 056/103] Update export routine so currency information is
taken from the transaction.
---
app/Export/Collector/JournalExportCollector.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Export/Collector/JournalExportCollector.php b/app/Export/Collector/JournalExportCollector.php
index 175b405f79..b0e04e115e 100644
--- a/app/Export/Collector/JournalExportCollector.php
+++ b/app/Export/Collector/JournalExportCollector.php
@@ -303,7 +303,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
->leftJoin('accounts AS opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id')
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', 'transaction_types.id')
- ->leftJoin('transaction_currencies', 'transaction_journals.transaction_currency_id', '=', 'transaction_currencies.id')
+ ->leftJoin('transaction_currencies', 'transactions.transaction_currency_id', '=', 'transaction_currencies.id')
->whereIn('transactions.account_id', $accountIds)
->where('transaction_journals.user_id', $this->job->user_id)
->where('transaction_journals.date', '>=', $this->start->format('Y-m-d'))
@@ -338,7 +338,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
'transaction_journals.encrypted as journal_encrypted',
'transaction_journals.transaction_type_id',
'transaction_types.type as transaction_type',
- 'transaction_journals.transaction_currency_id',
+ 'transactions.transaction_currency_id',
'transaction_currencies.code AS transaction_currency_code',
]
From 771ebde295a23548321a4ba98059602e4159886f Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 08:49:37 +0200
Subject: [PATCH 057/103] Update journal collector so currency information is
taken from the transaction.
---
app/Helpers/Collector/JournalCollector.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php
index 56d53d7446..a85535d907 100644
--- a/app/Helpers/Collector/JournalCollector.php
+++ b/app/Helpers/Collector/JournalCollector.php
@@ -60,7 +60,6 @@ class JournalCollector implements JournalCollectorInterface
'transaction_journals.description',
'transaction_journals.date',
'transaction_journals.encrypted',
- 'transaction_currencies.code as transaction_currency_code',
'transaction_types.type as transaction_type_type',
'transaction_journals.bill_id',
'bills.name as bill_name',
@@ -71,6 +70,7 @@ class JournalCollector implements JournalCollectorInterface
'transactions.account_id',
'transactions.identifier',
'transactions.transaction_journal_id',
+ 'transaction_currencies.code as transaction_currency_code',
'accounts.name as account_name',
'accounts.encrypted as account_encrypted',
'account_types.type as account_type',
@@ -484,11 +484,11 @@ class JournalCollector implements JournalCollectorInterface
Log::debug('journalCollector::startQuery');
/** @var EloquentBuilder $query */
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
- ->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
+ ->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transactions.transaction_currency_id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
From 82e74a2afd98af278bf82fa31ef81339623cc27a Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:39:16 +0200
Subject: [PATCH 058/103] Big update to properly support multi currencies.
---
.../Transaction/MassController.php | 42 +++-
.../Transaction/SingleController.php | 40 ++--
.../Transaction/SplitController.php | 33 +--
.../Controllers/TransactionController.php | 11 +-
app/Import/ImportStorage.php | 1 +
app/Import/ImportValidator.php | 2 +
app/Models/Transaction.php | 33 ++-
app/Models/TransactionJournal.php | 41 ----
app/Providers/FireflyServiceProvider.php | 3 +-
.../Account/AccountRepository.php | 2 +
.../Journal/JournalRepository.php | 192 +++++++++++-------
app/Repositories/Journal/JournalTasker.php | 53 +++--
app/Support/Amount.php | 55 +----
app/Support/Binder/JournalList.php | 9 +-
.../Models/TransactionJournalTrait.php | 8 +
app/Support/Twig/Account.php | 63 ------
app/Support/Twig/AmountFormat.php | 109 ++++++++++
app/Support/Twig/General.php | 41 ----
app/Support/Twig/Transaction.php | 75 -------
database/factories/ModelFactory.php | 1 +
public/js/ff/transactions/single/edit.js | 5 +-
public/js/ff/transactions/split/edit.js | 20 ++
resources/lang/en_US/firefly.php | 1 +
resources/views/list/journals-tiny.twig | 6 +-
resources/views/list/journals.twig | 11 +-
resources/views/popup/list/journals.twig | 6 +-
.../reports/partials/journals-audit.twig | 6 +-
.../search/partials/transactions-large.twig | 13 +-
.../views/search/partials/transactions.twig | 6 +-
resources/views/transactions/mass-delete.twig | 3 +-
resources/views/transactions/mass/edit.twig | 13 +-
resources/views/transactions/show.twig | 30 ++-
resources/views/transactions/single/edit.twig | 4 +-
resources/views/transactions/split/edit.twig | 30 ++-
34 files changed, 470 insertions(+), 498 deletions(-)
delete mode 100644 app/Support/Twig/Account.php
create mode 100644 app/Support/Twig/AmountFormat.php
diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php
index 285a73f3e9..b0205f36af 100644
--- a/app/Http/Controllers/Transaction/MassController.php
+++ b/app/Http/Controllers/Transaction/MassController.php
@@ -19,6 +19,7 @@ use FireflyIII\Http\Requests\MassDeleteJournalRequest;
use FireflyIII\Http\Requests\MassEditJournalRequest;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
+use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@@ -126,8 +127,7 @@ class MassController extends Controller
$budgetRepository = app(BudgetRepositoryInterface::class);
$budgets = $budgetRepository->getBudgets();
- // skip transactions that have multiple destinations
- // or multiple sources:
+ // skip transactions that have multiple destinations, multiple sources or are an opening balance.
$filtered = new Collection;
$messages = [];
/**
@@ -146,6 +146,10 @@ class MassController extends Controller
$messages[] = trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]);
continue;
}
+ if ($journal->transactionType->type === TransactionType::OPENING_BALANCE) {
+ $messages[] = trans('firefly.cannot_edit_opening_balance');
+ continue;
+ }
$filtered->push($journal);
}
@@ -158,13 +162,21 @@ class MassController extends Controller
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'mass-edit');
- // set some values to be used in the edit routine:
+ // collect some useful meta data for the mass edit:
$filtered->each(
function (TransactionJournal $journal) {
- $journal->amount = $journal->amountPositive();
- $sources = $journal->sourceAccountList();
- $destinations = $journal->destinationAccountList();
- $journal->transaction_count = $journal->transactions()->count();
+ $transaction = $journal->positiveTransaction();
+ $currency = $transaction->transactionCurrency;
+ $journal->amount = floatval($transaction->amount);
+ $sources = $journal->sourceAccountList();
+ $destinations = $journal->destinationAccountList();
+ $journal->transaction_count = $journal->transactions()->count();
+ $journal->currency_symbol = $currency->symbol;
+ $journal->transaction_type_type = $journal->transactionType->type;
+
+ $journal->foreign_amount = floatval($transaction->foreign_amount);
+ $journal->foreign_currency = $transaction->foreignCurrency;
+
if (!is_null($sources->first())) {
$journal->source_account_id = $sources->first()->id;
$journal->source_account_name = $sources->first()->editname;
@@ -195,6 +207,7 @@ class MassController extends Controller
{
$journalIds = $request->get('journals');
$count = 0;
+
if (is_array($journalIds)) {
foreach ($journalIds as $journalId) {
$journal = $repository->find(intval($journalId));
@@ -208,6 +221,10 @@ class MassController extends Controller
$budgetId = $request->get('budget_id')[$journal->id] ?? 0;
$category = $request->get('category')[$journal->id];
$tags = $journal->tags->pluck('tag')->toArray();
+ $amount = round($request->get('amount')[$journal->id], 12);
+ $foreignAmount = isset($request->get('foreign_amount')[$journal->id]) ? round($request->get('foreign_amount')[$journal->id], 12) : null;
+ $foreignCurrencyId = isset($request->get('foreign_currency_id')[$journal->id]) ?
+ intval($request->get('foreign_currency_id')[$journal->id]) : null;
// build data array
$data = [
@@ -218,16 +235,20 @@ class MassController extends Controller
'source_account_name' => $sourceAccountName,
'destination_account_id' => intval($destAccountId),
'destination_account_name' => $destAccountName,
- 'amount' => round($request->get('amount')[$journal->id], 12),
- 'currency_id' => $journal->transaction_currency_id,
+ 'amount' => $foreignAmount,
+ 'native_amount' => $amount,
+ 'source_amount' => $amount,
'date' => new Carbon($request->get('date')[$journal->id]),
'interest_date' => $journal->interest_date,
'book_date' => $journal->book_date,
'process_date' => $journal->process_date,
'budget_id' => intval($budgetId),
+ 'currency_id' => $foreignCurrencyId,
+ 'foreign_amount' => $foreignAmount,
+ 'destination_amount' => $foreignAmount,
+ //'foreign_currency_id' => $foreignCurrencyId,
'category' => $category,
'tags' => $tags,
-
];
// call repository update function.
$repository->update($journal, $data);
@@ -235,6 +256,7 @@ class MassController extends Controller
$count++;
}
}
+
}
Preferences::mark();
Session::flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count]));
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index eef9bd7ab4..89de28d7d2 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -238,6 +238,7 @@ class SingleController extends Controller
$sourceAccounts = $journal->sourceAccountList();
$destinationAccounts = $journal->destinationAccountList();
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
+ $pTransaction = $journal->positiveTransaction();
$preFilled = [
'date' => $journal->dateAsString(),
'interest_date' => $journal->dateAsString('interest_date'),
@@ -250,8 +251,6 @@ class SingleController extends Controller
'source_account_name' => $sourceAccounts->first()->edit_name,
'destination_account_id' => $destinationAccounts->first()->id,
'destination_account_name' => $destinationAccounts->first()->edit_name,
- 'amount' => $journal->amountPositive(),
- 'currency' => $journal->transactionCurrency,
// new custom fields:
'due_date' => $journal->dateAsString('due_date'),
@@ -260,26 +259,36 @@ class SingleController extends Controller
'interal_reference' => $journal->getMeta('internal_reference'),
'notes' => $journal->getMeta('notes'),
- // exchange rate fields
- 'native_amount' => $journal->amountPositive(),
- 'native_currency' => $journal->transactionCurrency,
+ // amount fields
+ 'amount' => $pTransaction->amount,
+ 'source_amount' => $pTransaction->amount,
+ 'native_amount' => $pTransaction->amount,
+ 'destination_amount' => $pTransaction->foreign_amount,
+ 'currency' => $pTransaction->transactionCurrency,
+ 'source_currency' => $pTransaction->transactionCurrency,
+ 'native_currency' => $pTransaction->transactionCurrency,
+ 'foreign_currency' => !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency,
+ 'destination_currency' => !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency,
];
- // if user has entered a foreign currency, update some fields
- $foreignCurrencyId = intval($journal->getMeta('foreign_currency_id'));
- if ($foreignCurrencyId > 0) {
- // update some fields in pre-filled.
- // @codeCoverageIgnoreStart
- $preFilled['amount'] = $journal->getMeta('foreign_amount');
- $preFilled['currency'] = $this->currency->find(intval($journal->getMeta('foreign_currency_id')));
- // @codeCoverageIgnoreEnd
+ // amounts for withdrawals and deposits:
+ // (amount, native_amount, source_amount, destination_amount)
+ if (($journal->isWithdrawal() || $journal->isDeposit()) && !is_null($pTransaction->foreign_amount)) {
+ $preFilled['amount'] = $pTransaction->foreign_amount;
+ $preFilled['currency'] = $pTransaction->foreignCurrency;
}
- if ($journal->isWithdrawal() && $destinationAccounts->first()->accountType->type == AccountType::CASH) {
+ if ($journal->isTransfer() && !is_null($pTransaction->foreign_amount)) {
+ $preFilled['destination_amount'] = $pTransaction->foreign_amount;
+ $preFilled['destination_currency'] = $pTransaction->foreignCurrency;
+ }
+
+ // fixes for cash accounts:
+ if ($journal->isWithdrawal() && $destinationAccounts->first()->accountType->type === AccountType::CASH) {
$preFilled['destination_account_name'] = '';
}
- if ($journal->isDeposit() && $sourceAccounts->first()->accountType->type == AccountType::CASH) {
+ if ($journal->isDeposit() && $sourceAccounts->first()->accountType->type === AccountType::CASH) {
$preFilled['source_account_name'] = '';
}
@@ -319,6 +328,7 @@ class SingleController extends Controller
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
}
+
/** @var array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$this->attachments->saveAttachmentsForModel($journal, $files);
diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php
index c587129811..e6668bc43e 100644
--- a/app/Http/Controllers/Transaction/SplitController.php
+++ b/app/Http/Controllers/Transaction/SplitController.php
@@ -93,7 +93,7 @@ class SplitController extends Controller
}
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
- $currencies = ExpandedForm::makeSelectList($this->currencies->get());
+ $currencies = $this->currencies->get();
$assetAccounts = ExpandedForm::makeSelectList($this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]));
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
@@ -130,7 +130,6 @@ class SplitController extends Controller
*/
public function update(Request $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
-
if ($this->isOpeningBalance($journal)) {
return $this->redirectToAccount($journal);
}
@@ -179,7 +178,6 @@ class SplitController extends Controller
'journal_source_account_id' => $request->get('journal_source_account_id'),
'journal_source_account_name' => $request->get('journal_source_account_name'),
'journal_destination_account_id' => $request->get('journal_destination_account_id'),
- 'currency_id' => $request->get('currency_id'),
'what' => $request->get('what'),
'date' => $request->get('date'),
// all custom fields:
@@ -218,7 +216,6 @@ class SplitController extends Controller
'journal_source_account_id' => $request->old('journal_source_account_id', $sourceAccounts->first()->id),
'journal_source_account_name' => $request->old('journal_source_account_name', $sourceAccounts->first()->name),
'journal_destination_account_id' => $request->old('journal_destination_account_id', $destinationAccounts->first()->id),
- 'currency_id' => $request->old('currency_id', $journal->transaction_currency_id),
'destinationAccounts' => $destinationAccounts,
'what' => strtolower($journal->transactionTypeStr()),
'date' => $request->old('date', $journal->date),
@@ -253,14 +250,22 @@ class SplitController extends Controller
/** @var array $transaction */
foreach ($transactions as $index => $transaction) {
$set = [
- 'description' => $transaction['description'],
- 'source_account_id' => $transaction['source_account_id'],
- 'source_account_name' => $transaction['source_account_name'],
- 'destination_account_id' => $transaction['destination_account_id'],
- 'destination_account_name' => $transaction['destination_account_name'],
- 'amount' => round($transaction['destination_amount'], 12),
- 'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
- 'category' => $transaction['category'],
+ 'description' => $transaction['description'],
+ 'source_account_id' => $transaction['source_account_id'],
+ 'source_account_name' => $transaction['source_account_name'],
+ 'destination_account_id' => $transaction['destination_account_id'],
+ 'destination_account_name' => $transaction['destination_account_name'],
+ 'amount' => round($transaction['destination_amount'], 12),
+ 'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
+ 'category' => $transaction['category'],
+ 'transaction_currency_id' => $transaction['transaction_currency_id'],
+ 'transaction_currency_code' => $transaction['transaction_currency_code'],
+ 'transaction_currency_symbol' => $transaction['transaction_currency_symbol'],
+ 'foreign_amount' => round($transaction['foreign_destination_amount'], 12),
+ 'foreign_currency_id' => $transaction['foreign_currency_id'],
+ 'foreign_currency_code' => $transaction['foreign_currency_code'],
+ 'foreign_currency_symbol' => $transaction['foreign_currency_symbol'],
+
];
// set initial category and/or budget:
@@ -294,8 +299,12 @@ class SplitController extends Controller
'destination_account_id' => $transaction['destination_account_id'] ?? 0,
'destination_account_name' => $transaction['destination_account_name'] ?? '',
'amount' => round($transaction['amount'] ?? 0, 12),
+ 'foreign_amount' => !isset($transaction['foreign_amount']) ? null : round($transaction['foreign_amount'] ?? 0, 12),
'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
'category' => $transaction['category'] ?? '',
+ 'transaction_currency_id' => intval($transaction['transaction_currency_id']),
+ 'foreign_currency_id' => $transaction['foreign_currency_id'] ?? null,
+
];
}
Log::debug(sprintf('Found %d splits in request data.', count($return)));
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 1e838c5dec..5f6f12de2e 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -183,17 +183,8 @@ class TransactionController extends Controller
$transactions = $tasker->getTransactionsOverview($journal);
$what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
$subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
- $foreignCurrency = null;
- if ($journal->hasMeta('foreign_currency_id')) {
- // @codeCoverageIgnoreStart
- /** @var CurrencyRepositoryInterface $repository */
- $repository = app(CurrencyRepositoryInterface::class);
- $foreignCurrency = $repository->find(intval($journal->getMeta('foreign_currency_id')));
- // @codeCoverageIgnoreEnd
- }
-
- return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'foreignCurrency'));
+ return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions'));
}
diff --git a/app/Import/ImportStorage.php b/app/Import/ImportStorage.php
index 2d5524fcec..4f39086965 100644
--- a/app/Import/ImportStorage.php
+++ b/app/Import/ImportStorage.php
@@ -291,6 +291,7 @@ class ImportStorage
'user_id' => $entry->user->id,
'transaction_type_id' => $entry->fields['transaction-type']->id,
'bill_id' => $billId,
+ // TODO update this transaction currency reference.
'transaction_currency_id' => $entry->fields['currency']->id,
'description' => $entry->fields['description'],
'date' => $entry->fields['date-transaction'],
diff --git a/app/Import/ImportValidator.php b/app/Import/ImportValidator.php
index 3a3a373b2b..fd9981ec47 100644
--- a/app/Import/ImportValidator.php
+++ b/app/Import/ImportValidator.php
@@ -74,6 +74,7 @@ class ImportValidator
$entry = $this->setOpposingAccount($entry);
$entry = $this->cleanDescription($entry);
$entry = $this->setTransactionType($entry);
+ // TODO update this transaction currency reference.
$entry = $this->setTransactionCurrency($entry);
$newCollection->put($index, $entry);
@@ -383,6 +384,7 @@ class ImportValidator
*/
private function setTransactionCurrency(ImportEntry $entry): ImportEntry
{
+ // TODO update this transaction currency reference.
if (is_null($entry->fields['currency'])) {
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index ef5deeadcd..0e9ade0b30 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -26,7 +26,6 @@ use Watson\Validating\ValidatingTrait;
*/
class Transaction extends Model
{
-
/**
* The attributes that should be casted to native types.
*
@@ -42,16 +41,18 @@ class Transaction extends Model
'bill_name_encrypted' => 'boolean',
];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
- protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier'];
+ protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id','foreign_amount'];
protected $hidden = ['encrypted'];
protected $rules
= [
- 'account_id' => 'required|exists:accounts,id',
- 'transaction_journal_id' => 'required|exists:transaction_journals,id',
- 'description' => 'between:0,1024',
- 'amount' => 'required|numeric',
+ 'account_id' => 'required|exists:accounts,id',
+ 'transaction_journal_id' => 'required|exists:transaction_journals,id',
+ 'transaction_currency_id' => 'required|exists:transaction_currencies,id',
+ //'foreign_currency_id' => 'exists:transaction_currencies,id',
+ 'description' => 'between:0,1024',
+ 'amount' => 'required|numeric',
+ //'foreign_amount' => 'numeric',
];
- use SoftDeletes, ValidatingTrait;
/**
* @param Builder $query
@@ -74,6 +75,8 @@ class Transaction extends Model
return false;
}
+ use SoftDeletes, ValidatingTrait;
+
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
@@ -160,6 +163,22 @@ class Transaction extends Model
$this->attributes['amount'] = strval(round($value, 12));
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
+ public function transactionCurrency()
+ {
+ return $this->belongsTo('FireflyIII\Models\TransactionCurrency');
+ }
+
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
+ public function foreignCurrency()
+ {
+ return $this->belongsTo('FireflyIII\Models\TransactionCurrency','foreign_currency_id');
+ }
+
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 53506bc61d..cc0c00ef45 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -68,7 +68,6 @@ class TransactionJournal extends Model
= [
'user_id' => 'required|exists:users,id',
'transaction_type_id' => 'required|exists:transaction_types,id',
- 'transaction_currency_id' => 'required|exists:transaction_currencies,id',
'description' => 'required|between:1,1024',
'completed' => 'required|boolean',
'date' => 'required|date',
@@ -299,46 +298,6 @@ class TransactionJournal extends Model
return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00'));
}
- /**
- * @param EloquentBuilder $query
- */
- public function scopeExpanded(EloquentBuilder $query)
- {
- // left join transaction type:
- if (!self::isJoined($query, 'transaction_types')) {
- $query->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
- }
-
- // left join transaction currency:
- $query->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transaction_journals.transaction_currency_id');
-
- // extend group by:
- $query->groupBy(
- [
- 'transaction_journals.id',
- 'transaction_journals.created_at',
- 'transaction_journals.updated_at',
- 'transaction_journals.deleted_at',
- 'transaction_journals.user_id',
- 'transaction_journals.transaction_type_id',
- 'transaction_journals.bill_id',
- 'transaction_journals.transaction_currency_id',
- 'transaction_journals.description',
- 'transaction_journals.date',
- 'transaction_journals.interest_date',
- 'transaction_journals.book_date',
- 'transaction_journals.process_date',
- 'transaction_journals.order',
- 'transaction_journals.tag_count',
- 'transaction_journals.encrypted',
- 'transaction_journals.completed',
- 'transaction_types.type',
- 'transaction_currencies.code',
- ]
- );
- $query->with(['categories', 'budgets', 'attachments', 'bill', 'transactions']);
- }
-
/**
* @param EloquentBuilder $query
*/
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index ef4890bb7f..c9740f4bcf 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -44,6 +44,7 @@ use FireflyIII\Support\Navigation;
use FireflyIII\Support\Preferences;
use FireflyIII\Support\Steam;
use FireflyIII\Support\Twig\Account;
+use FireflyIII\Support\Twig\AmountFormat;
use FireflyIII\Support\Twig\General;
use FireflyIII\Support\Twig\Journal;
use FireflyIII\Support\Twig\PiggyBank;
@@ -79,7 +80,7 @@ class FireflyServiceProvider extends ServiceProvider
Twig::addExtension(new Translation);
Twig::addExtension(new Transaction);
Twig::addExtension(new Rule);
- Twig::addExtension(new Account);
+ Twig::addExtension(new AmountFormat);
}
/**
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 122e8f7d5c..7b594555b8 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -481,6 +481,7 @@ class AccountRepository implements AccountRepositoryInterface
[
'user_id' => $this->user->id,
'transaction_type_id' => $transactionType->id,
+ // TODO update this transaction currency reference.
'transaction_currency_id' => $currencyId,
'description' => 'Initial balance for "' . $account->name . '"',
'completed' => true,
@@ -622,6 +623,7 @@ class AccountRepository implements AccountRepositoryInterface
// update date:
$journal->date = $date;
+ // TODO update this transaction currency reference.
$journal->transaction_currency_id = $currencyId;
$journal->save();
// update transactions:
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index ef4820ac2e..9a28be284b 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -39,7 +39,6 @@ class JournalRepository implements JournalRepositoryInterface
{
/** @var User */
private $user;
-
/** @var array */
private $validMetaFields
= ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes', 'foreign_amount',
@@ -182,13 +181,12 @@ class JournalRepository implements JournalRepositoryInterface
$transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
$accounts = $this->storeAccounts($transactionType, $data);
$data = $this->verifyNativeAmount($data, $accounts);
- $currencyId = $data['currency_id'];
$amount = strval($data['amount']);
$journal = new TransactionJournal(
[
'user_id' => $this->user->id,
'transaction_type_id' => $transactionType->id,
- 'transaction_currency_id' => $currencyId,
+ 'transaction_currency_id' => $data['currency_id'], // no longer used.
'description' => $data['description'],
'completed' => 0,
'date' => $data['date'],
@@ -200,27 +198,32 @@ class JournalRepository implements JournalRepositoryInterface
$this->storeCategoryWithJournal($journal, $data['category']);
$this->storeBudgetWithJournal($journal, $data['budget_id']);
-
// store two transactions:
$one = [
- 'journal' => $journal,
- 'account' => $accounts['source'],
- 'amount' => bcmul($amount, '-1'),
- 'description' => null,
- 'category' => null,
- 'budget' => null,
- 'identifier' => 0,
+ 'journal' => $journal,
+ 'account' => $accounts['source'],
+ 'amount' => bcmul($amount, '-1'),
+ 'transaction_currency_id' => $data['currency_id'],
+ 'foreign_amount' => is_null($data['foreign_amount']) ? null : bcmul(strval($data['foreign_amount']), '-1'),
+ 'foreign_currency_id' => $data['foreign_currency_id'],
+ 'description' => null,
+ 'category' => null,
+ 'budget' => null,
+ 'identifier' => 0,
];
$this->storeTransaction($one);
$two = [
- 'journal' => $journal,
- 'account' => $accounts['destination'],
- 'amount' => $amount,
- 'description' => null,
- 'category' => null,
- 'budget' => null,
- 'identifier' => 0,
+ 'journal' => $journal,
+ 'account' => $accounts['destination'],
+ 'amount' => $amount,
+ 'transaction_currency_id' => $data['currency_id'],
+ 'foreign_amount' => $data['foreign_amount'],
+ 'foreign_currency_id' => $data['foreign_currency_id'],
+ 'description' => null,
+ 'category' => null,
+ 'budget' => null,
+ 'identifier' => 0,
];
$this->storeTransaction($two);
@@ -256,11 +259,14 @@ class JournalRepository implements JournalRepositoryInterface
{
// update actual journal:
- $journal->description = $data['description'];
- $journal->date = $data['date'];
- $accounts = $this->storeAccounts($journal->transactionType, $data);
- $data = $this->verifyNativeAmount($data, $accounts);
- $amount = strval($data['amount']);
+ $journal->description = $data['description'];
+ $journal->date = $data['date'];
+ $accounts = $this->storeAccounts($journal->transactionType, $data);
+ $data = $this->verifyNativeAmount($data, $accounts);
+ $data['amount'] = strval($data['amount']);
+ $data['foreign_amount'] = is_null($data['foreign_amount']) ? null : strval($data['foreign_amount']);
+
+ var_dump($data);
// unlink all categories, recreate them:
$journal->categories()->detach();
@@ -269,9 +275,11 @@ class JournalRepository implements JournalRepositoryInterface
$this->storeCategoryWithJournal($journal, $data['category']);
$this->storeBudgetWithJournal($journal, $data['budget_id']);
+ // negative because source loses money.
+ $this->updateSourceTransaction($journal, $accounts['source'], $data);
- $this->updateSourceTransaction($journal, $accounts['source'], bcmul($amount, '-1')); // negative because source loses money.
- $this->updateDestinationTransaction($journal, $accounts['destination'], $amount); // positive because destination gets money.
+ // positive because destination gets money.
+ $this->updateDestinationTransaction($journal, $accounts['destination'], $data);
$journal->save();
@@ -308,9 +316,8 @@ class JournalRepository implements JournalRepositoryInterface
public function updateSplitJournal(TransactionJournal $journal, array $data): TransactionJournal
{
// update actual journal:
- $journal->transaction_currency_id = $data['currency_id'];
- $journal->description = $data['journal_description'];
- $journal->date = $data['date'];
+ $journal->description = $data['journal_description'];
+ $journal->date = $data['date'];
$journal->save();
Log::debug(sprintf('Updated split journal #%d', $journal->id));
@@ -342,6 +349,7 @@ class JournalRepository implements JournalRepositoryInterface
// store each transaction.
$identifier = 0;
Log::debug(sprintf('Count %d transactions in updateSplitJournal()', count($data['transactions'])));
+
foreach ($data['transactions'] as $transaction) {
Log::debug(sprintf('Split journal update split transaction %d', $identifier));
$transaction = $this->appendTransactionData($transaction, $data);
@@ -564,30 +572,40 @@ class JournalRepository implements JournalRepositoryInterface
$accounts = $this->storeAccounts($journal->transactionType, $transaction);
// store transaction one way:
- $one = $this->storeTransaction(
+ $amount = bcmul(strval($transaction['amount']), '-1');
+ $foreignAmount = is_null($transaction['foreign_amount']) ? null : bcmul(strval($transaction['foreign_amount']), '-1');
+ $one = $this->storeTransaction(
[
- 'journal' => $journal,
- 'account' => $accounts['source'],
- 'amount' => bcmul(strval($transaction['amount']), '-1'),
- 'description' => $transaction['description'],
- 'category' => null,
- 'budget' => null,
- 'identifier' => $identifier,
+ 'journal' => $journal,
+ 'account' => $accounts['source'],
+ 'amount' => $amount,
+ 'transaction_currency_id' => $transaction['transaction_currency_id'],
+ 'foreign_amount' => $foreignAmount,
+ 'foreign_currency_id' => $transaction['foreign_currency_id'],
+ 'description' => $transaction['description'],
+ 'category' => null,
+ 'budget' => null,
+ 'identifier' => $identifier,
]
);
$this->storeCategoryWithTransaction($one, $transaction['category']);
$this->storeBudgetWithTransaction($one, $transaction['budget_id']);
// and the other way:
- $two = $this->storeTransaction(
+ $amount = strval($transaction['amount']);
+ $foreignAmount = is_null($transaction['foreign_amount']) ? null : strval($transaction['foreign_amount']);
+ $two = $this->storeTransaction(
[
- 'journal' => $journal,
- 'account' => $accounts['destination'],
- 'amount' => strval($transaction['amount']),
- 'description' => $transaction['description'],
- 'category' => null,
- 'budget' => null,
- 'identifier' => $identifier,
+ 'journal' => $journal,
+ 'account' => $accounts['destination'],
+ 'amount' => $amount,
+ 'transaction_currency_id' => $transaction['transaction_currency_id'],
+ 'foreign_amount' => $foreignAmount,
+ 'foreign_currency_id' => $transaction['foreign_currency_id'],
+ 'description' => $transaction['description'],
+ 'category' => null,
+ 'budget' => null,
+ 'identifier' => $identifier,
]
);
$this->storeCategoryWithTransaction($two, $transaction['category']);
@@ -603,16 +621,27 @@ class JournalRepository implements JournalRepositoryInterface
*/
private function storeTransaction(array $data): Transaction
{
+ $fields = [
+ 'transaction_journal_id' => $data['journal']->id,
+ 'account_id' => $data['account']->id,
+ 'amount' => $data['amount'],
+ 'foreign_amount' => $data['foreign_amount'],
+ 'transaction_currency_id' => $data['transaction_currency_id'],
+ 'foreign_currency_id' => $data['foreign_currency_id'],
+ 'description' => $data['description'],
+ 'identifier' => $data['identifier'],
+ ];
+
+
+ if (is_null($data['foreign_currency_id'])) {
+ unset($fields['foreign_currency_id']);
+ }
+ if (is_null($data['foreign_amount'])) {
+ unset($fields['foreign_amount']);
+ }
+
/** @var Transaction $transaction */
- $transaction = Transaction::create(
- [
- 'transaction_journal_id' => $data['journal']->id,
- 'account_id' => $data['account']->id,
- 'amount' => $data['amount'],
- 'description' => $data['description'],
- 'identifier' => $data['identifier'],
- ]
- );
+ $transaction = Transaction::create($fields);
Log::debug(sprintf('Transaction stored with ID: %s', $transaction->id));
@@ -675,22 +704,23 @@ class JournalRepository implements JournalRepositoryInterface
/**
* @param TransactionJournal $journal
* @param Account $account
- * @param string $amount
+ * @param array $data
*
* @throws FireflyException
*/
- private function updateDestinationTransaction(TransactionJournal $journal, Account $account, string $amount)
+ private function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data)
{
- // should be one:
$set = $journal->transactions()->where('amount', '>', 0)->get();
if ($set->count() != 1) {
- throw new FireflyException(
- sprintf('Journal #%d has an unexpected (%d) amount of transactions with an amount more than zero.', $journal->id, $set->count())
- );
+ throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
}
/** @var Transaction $transaction */
- $transaction = $set->first();
- $transaction->amount = $amount;
+ $transaction = $set->first();
+ $transaction->amount = app('steam')->positive($data['amount']);
+ $transaction->transaction_currency_id = $data['currency_id'];
+ $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : app('steam')->positive($data['foreign_amount']);
+ $transaction->foreign_currency_id = $data['foreign_currency_id'];
+
$transaction->account_id = $account->id;
$transaction->save();
@@ -699,26 +729,24 @@ class JournalRepository implements JournalRepositoryInterface
/**
* @param TransactionJournal $journal
* @param Account $account
- * @param string $amount
+ * @param array $data
*
* @throws FireflyException
*/
- private function updateSourceTransaction(TransactionJournal $journal, Account $account, string $amount)
+ private function updateSourceTransaction(TransactionJournal $journal, Account $account, array $data)
{
// should be one:
$set = $journal->transactions()->where('amount', '<', 0)->get();
if ($set->count() != 1) {
- throw new FireflyException(
- sprintf('Journal #%d has an unexpected (%d) amount of transactions with an amount less than zero.', $journal->id, $set->count())
- );
+ throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
}
/** @var Transaction $transaction */
- $transaction = $set->first();
- $transaction->amount = $amount;
- $transaction->account_id = $account->id;
+ $transaction = $set->first();
+ $transaction->amount = bcmul(app('steam')->positive($data['amount']), '-1');
+ $transaction->transaction_currency_id = $data['currency_id'];
+ $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1');
+ $transaction->foreign_currency_id = $data['foreign_currency_id'];
$transaction->save();
-
-
}
/**
@@ -777,8 +805,10 @@ class JournalRepository implements JournalRepositoryInterface
private function verifyNativeAmount(array $data, array $accounts): array
{
/** @var TransactionType $transactionType */
- $transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
- $submittedCurrencyId = $data['currency_id'];
+ $transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
+ $submittedCurrencyId = $data['currency_id'];
+ $data['foreign_amount'] = null;
+ $data['foreign_currency_id'] = null;
// which account to check for what the native currency is?
$check = 'source';
@@ -803,11 +833,17 @@ class JournalRepository implements JournalRepositoryInterface
}
break;
case TransactionType::TRANSFER:
- // source gets the original amount.
- $data['amount'] = strval($data['source_amount']);
- $data['currency_id'] = intval($accounts['source']->getMeta('currency_id'));
- $data['foreign_amount'] = strval($data['destination_amount']);
- $data['foreign_currency_id'] = intval($accounts['destination']->getMeta('currency_id'));
+ $sourceCurrencyId = intval($accounts['source']->getMeta('currency_id'));
+ $destinationCurrencyId = intval($accounts['destination']->getMeta('currency_id'));
+ $data['amount'] = strval($data['source_amount']);
+ $data['currency_id'] = intval($accounts['source']->getMeta('currency_id'));
+
+ if ($sourceCurrencyId !== $destinationCurrencyId) {
+ // accounts have different id's, save this info:
+ $data['foreign_amount'] = strval($data['destination_amount']);
+ $data['foreign_currency_id'] = $destinationCurrencyId;
+ }
+
break;
default:
throw new FireflyException(sprintf('Cannot handle %s in verifyNativeAmount()', $transactionType->type));
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
index b56abe0db8..bb0c8bcdd2 100644
--- a/app/Repositories/Journal/JournalTasker.php
+++ b/app/Repositories/Journal/JournalTasker.php
@@ -81,6 +81,8 @@ class JournalTasker implements JournalTaskerInterface
->leftJoin('account_types as source_account_types', 'source_accounts.account_type_id', '=', 'source_account_types.id')
->leftJoin('accounts as destination_accounts', 'destination.account_id', '=', 'destination_accounts.id')
->leftJoin('account_types as destination_account_types', 'destination_accounts.account_type_id', '=', 'destination_account_types.id')
+ ->leftJoin('transaction_currencies as native_currencies', 'transactions.transaction_currency_id', '=', 'native_currencies.id')
+ ->leftJoin('transaction_currencies as foreign_currencies', 'transactions.foreign_currency_id', '=', 'foreign_currencies.id')
->where('transactions.amount', '<', 0)
->whereNull('transactions.deleted_at')
->get(
@@ -91,12 +93,21 @@ class JournalTasker implements JournalTaskerInterface
'source_accounts.encrypted as account_encrypted',
'source_account_types.type as account_type',
'transactions.amount',
+ 'transactions.foreign_amount',
'transactions.description',
'destination.id as destination_id',
'destination.account_id as destination_account_id',
'destination_accounts.name as destination_account_name',
'destination_accounts.encrypted as destination_account_encrypted',
'destination_account_types.type as destination_account_type',
+ 'native_currencies.id as transaction_currency_id',
+ 'native_currencies.code as transaction_currency_code',
+ 'native_currencies.symbol as transaction_currency_symbol',
+
+ 'foreign_currencies.id as foreign_currency_id',
+ 'foreign_currencies.code as foreign_currency_code',
+ 'foreign_currencies.symbol as foreign_currency_symbol',
+
]
);
@@ -109,23 +120,31 @@ class JournalTasker implements JournalTaskerInterface
$budget = $entry->budgets->first();
$category = $entry->categories->first();
$transaction = [
- 'source_id' => $entry->id,
- 'source_amount' => $entry->amount,
- 'description' => $entry->description,
- 'source_account_id' => $entry->account_id,
- 'source_account_name' => Steam::decrypt(intval($entry->account_encrypted), $entry->account_name),
- 'source_account_type' => $entry->account_type,
- 'source_account_before' => $sourceBalance,
- 'source_account_after' => bcadd($sourceBalance, $entry->amount),
- 'destination_id' => $entry->destination_id,
- 'destination_amount' => bcmul($entry->amount, '-1'),
- 'destination_account_id' => $entry->destination_account_id,
- 'destination_account_type' => $entry->destination_account_type,
- 'destination_account_name' => Steam::decrypt(intval($entry->destination_account_encrypted), $entry->destination_account_name),
- 'destination_account_before' => $destinationBalance,
- 'destination_account_after' => bcadd($destinationBalance, bcmul($entry->amount, '-1')),
- 'budget_id' => is_null($budget) ? 0 : $budget->id,
- 'category' => is_null($category) ? '' : $category->name,
+ 'source_id' => $entry->id,
+ 'source_amount' => $entry->amount,
+ 'foreign_source_amount' => $entry->foreign_amount,
+ 'description' => $entry->description,
+ 'source_account_id' => $entry->account_id,
+ 'source_account_name' => Steam::decrypt(intval($entry->account_encrypted), $entry->account_name),
+ 'source_account_type' => $entry->account_type,
+ 'source_account_before' => $sourceBalance,
+ 'source_account_after' => bcadd($sourceBalance, $entry->amount),
+ 'destination_id' => $entry->destination_id,
+ 'destination_amount' => bcmul($entry->amount, '-1'),
+ 'foreign_destination_amount' => is_null($entry->foreign_amount) ? null : bcmul($entry->foreign_amount, '-1'),
+ 'destination_account_id' => $entry->destination_account_id,
+ 'destination_account_type' => $entry->destination_account_type,
+ 'destination_account_name' => Steam::decrypt(intval($entry->destination_account_encrypted), $entry->destination_account_name),
+ 'destination_account_before' => $destinationBalance,
+ 'destination_account_after' => bcadd($destinationBalance, bcmul($entry->amount, '-1')),
+ 'budget_id' => is_null($budget) ? 0 : $budget->id,
+ 'category' => is_null($category) ? '' : $category->name,
+ 'transaction_currency_id' => $entry->transaction_currency_id,
+ 'transaction_currency_code' => $entry->transaction_currency_code,
+ 'transaction_currency_symbol' => $entry->transaction_currency_symbol,
+ 'foreign_currency_id' => $entry->foreign_currency_id,
+ 'foreign_currency_code' => $entry->foreign_currency_code,
+ 'foreign_currency_symbol' => $entry->foreign_currency_symbol,
];
if ($entry->destination_account_type === AccountType::CASH) {
$transaction['destination_account_name'] = '';
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 32e42cf3bb..7d11d68b7d 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -17,6 +17,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
+use FireflyIII\Models\TransactionType;
use Illuminate\Support\Collection;
use Preferences as Prefs;
@@ -101,17 +102,6 @@ class Amount
return $format;
}
- /**
- * @param string $amount
- * @param bool $coloured
- *
- * @return string
- */
- public function format(string $amount, bool $coloured = true): string
- {
- return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
- }
-
/**
* This method will properly format the given number, in color or "black and white",
* as a currency, given two things: the currency required and the current locale.
@@ -159,49 +149,6 @@ class Amount
return $result;
}
- /**
- * Used in many places (unfortunately).
- *
- * @param string $currencyCode
- * @param string $amount
- * @param bool $coloured
- *
- * @return string
- */
- public function formatByCode(string $currencyCode, string $amount, bool $coloured = true): string
- {
- $currency = TransactionCurrency::where('code', $currencyCode)->first();
-
- return $this->formatAnything($currency, $amount, $coloured);
- }
-
- /**
- *
- * @param \FireflyIII\Models\TransactionJournal $journal
- * @param bool $coloured
- *
- * @return string
- */
- public function formatJournal(TransactionJournal $journal, bool $coloured = true): string
- {
- $currency = $journal->transactionCurrency;
-
- return $this->formatAnything($currency, $journal->amount(), $coloured);
- }
-
- /**
- * @param Transaction $transaction
- * @param bool $coloured
- *
- * @return string
- */
- public function formatTransaction(Transaction $transaction, bool $coloured = true)
- {
- $currency = $transaction->transactionJournal->transactionCurrency;
-
- return $this->formatAnything($currency, strval($transaction->amount), $coloured);
- }
-
/**
* @return Collection
*/
diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php
index cc31681323..3b5678f886 100644
--- a/app/Support/Binder/JournalList.php
+++ b/app/Support/Binder/JournalList.php
@@ -37,15 +37,8 @@ class JournalList implements BinderInterface
$ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = TransactionJournal::whereIn('transaction_journals.id', $ids)
- ->expanded()
->where('transaction_journals.user_id', auth()->user()->id)
- ->get(
- [
- 'transaction_journals.*',
- 'transaction_types.type AS transaction_type_type',
- 'transaction_currencies.code AS transaction_currency_code',
- ]
- );
+ ->get(['transaction_journals.*',]);
if ($object->count() > 0) {
return $object;
diff --git a/app/Support/Models/TransactionJournalTrait.php b/app/Support/Models/TransactionJournalTrait.php
index c9cea3ec49..0961fafbb4 100644
--- a/app/Support/Models/TransactionJournalTrait.php
+++ b/app/Support/Models/TransactionJournalTrait.php
@@ -213,6 +213,14 @@ trait TransactionJournalTrait
return 0;
}
+ /**
+ * @return Transaction
+ */
+ public function positiveTransaction(): Transaction
+ {
+ return $this->transactions()->where('amount', '>', 0)->first();
+ }
+
/**
* @return Collection
*/
diff --git a/app/Support/Twig/Account.php b/app/Support/Twig/Account.php
deleted file mode 100644
index d2a5520505..0000000000
--- a/app/Support/Twig/Account.php
+++ /dev/null
@@ -1,63 +0,0 @@
-formatAmountByAccount(),
- ];
-
- }
-
- /**
- * Will return "active" when a part of the route matches the argument.
- * ie. "accounts" will match "accounts.index".
- *
- * @return Twig_SimpleFunction
- */
- protected function formatAmountByAccount(): Twig_SimpleFunction
- {
- return new Twig_SimpleFunction(
- 'formatAmountByAccount', function (AccountModel $account, string $amount, bool $coloured = true): string {
- $currencyId = intval($account->getMeta('currency_id'));
- if ($currencyId === 0) {
- // Format using default currency:
- return AmountFacade::format($amount, $coloured);
- }
- $currency = TransactionCurrency::find($currencyId);
-
- return AmountFacade::formatAnything($currency, $amount, $coloured);
- }, ['is_safe' => ['html']]
- );
- }
-
-
-}
\ No newline at end of file
diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php
new file mode 100644
index 0000000000..eb06a98ebf
--- /dev/null
+++ b/app/Support/Twig/AmountFormat.php
@@ -0,0 +1,109 @@
+formatAmount(),
+ $this->formatAmountPlain(),
+ ];
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getFunctions(): array
+ {
+ return [
+ $this->formatAmountByAccount(),
+ ];
+
+ }
+
+ /**
+ * Returns the name of the extension.
+ *
+ * @return string The extension name
+ */
+ public function getName(): string
+ {
+ return 'FireflyIII\Support\Twig\AmountFormat';
+ }
+
+ /**
+ *
+ * @return Twig_SimpleFilter
+ */
+ protected function formatAmount(): Twig_SimpleFilter
+ {
+ return new Twig_SimpleFilter(
+ 'formatAmount', function (string $string): string {
+
+ return app('amount')->format($string);
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * Will format the amount by the currency related to the given account.
+ *
+ * @return Twig_SimpleFunction
+ */
+ protected function formatAmountByAccount(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'formatAmountByAccount', function (AccountModel $account, string $amount, bool $coloured = true): string {
+ $currencyId = intval($account->getMeta('currency_id'));
+ if ($currencyId === 0) {
+ // Format using default currency:
+ return app('amount')->format($amount, $coloured);
+ }
+ $currency = TransactionCurrency::find($currencyId);
+
+ return app('amount')->formatAnything($currency, $amount, $coloured);
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * @return Twig_SimpleFilter
+ */
+ protected function formatAmountPlain(): Twig_SimpleFilter
+ {
+ return new Twig_SimpleFilter(
+ 'formatAmountPlain', function (string $string): string {
+
+ return app('amount')->format($string, false);
+ }, ['is_safe' => ['html']]
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index 5db0ba95f6..9603e54e44 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -38,9 +38,6 @@ class General extends Twig_Extension
public function getFilters(): array
{
return [
- $this->formatAmount(),
- $this->formatAmountPlain(),
- $this->formatJournal(),
$this->balance(),
$this->formatFilesize(),
$this->mimeIcon(),
@@ -173,33 +170,6 @@ class General extends Twig_Extension
);
}
- /**
- *
- * @return Twig_SimpleFilter
- */
- protected function formatAmount(): Twig_SimpleFilter
- {
- return new Twig_SimpleFilter(
- 'formatAmount', function (string $string): string {
-
- return app('amount')->format($string);
- }, ['is_safe' => ['html']]
- );
- }
-
- /**
- * @return Twig_SimpleFilter
- */
- protected function formatAmountPlain(): Twig_SimpleFilter
- {
- return new Twig_SimpleFilter(
- 'formatAmountPlain', function (string $string): string {
-
- return app('amount')->format($string, false);
- }, ['is_safe' => ['html']]
- );
- }
-
/**
* @return Twig_SimpleFilter
*/
@@ -223,17 +193,6 @@ class General extends Twig_Extension
);
}
- /**
- * @return Twig_SimpleFilter
- */
- protected function formatJournal(): Twig_SimpleFilter
- {
- return new Twig_SimpleFilter(
- 'formatJournal', function (TransactionJournal $journal): string {
- return app('amount')->formatJournal($journal);
- }, ['is_safe' => ['html']]
- );
- }
/**
* @return Twig_SimpleFunction
diff --git a/app/Support/Twig/Transaction.php b/app/Support/Twig/Transaction.php
index d4b8e84850..a8d97c97f8 100644
--- a/app/Support/Twig/Transaction.php
+++ b/app/Support/Twig/Transaction.php
@@ -16,7 +16,6 @@ namespace FireflyIII\Support\Twig;
use Amount;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction as TransactionModel;
-use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionType;
use Steam;
use Twig_Extension;
@@ -30,49 +29,6 @@ use Twig_SimpleFunction;
*/
class Transaction extends Twig_Extension
{
-
- /**
- * @return Twig_SimpleFunction
- */
- public function formatAnything(): Twig_SimpleFunction
- {
- return new Twig_SimpleFunction(
- 'formatAnything', function (TransactionCurrency $currency, string $amount): string {
-
- return Amount::formatAnything($currency, $amount, true);
-
- }, ['is_safe' => ['html']]
- );
- }
-
- /**
- * @return Twig_SimpleFunction
- */
- public function formatAnythingPlain(): Twig_SimpleFunction
- {
- return new Twig_SimpleFunction(
- 'formatAnythingPlain', function (TransactionCurrency $currency, string $amount): string {
-
- return Amount::formatAnything($currency, $amount, false);
-
- }, ['is_safe' => ['html']]
- );
- }
-
- /**
- * @return Twig_SimpleFunction
- */
- public function formatByCode(): Twig_SimpleFunction
- {
- return new Twig_SimpleFunction(
- 'formatByCode', function (string $currencyCode, string $amount): string {
-
- return Amount::formatByCode($currencyCode, $amount, true);
-
- }, ['is_safe' => ['html']]
- );
- }
-
/**
* @return array
*/
@@ -91,17 +47,13 @@ class Transaction extends Twig_Extension
public function getFunctions(): array
{
$functions = [
- $this->formatAnything(),
- $this->formatAnythingPlain(),
$this->transactionSourceAccount(),
$this->transactionDestinationAccount(),
- $this->optionalJournalAmount(),
$this->transactionBudgets(),
$this->transactionIdBudgets(),
$this->transactionCategories(),
$this->transactionIdCategories(),
$this->splitJournalIndicator(),
- $this->formatByCode(),
];
return $functions;
@@ -117,33 +69,6 @@ class Transaction extends Twig_Extension
return 'transaction';
}
- /**
- * @return Twig_SimpleFunction
- */
- public function optionalJournalAmount(): Twig_SimpleFunction
- {
- return new Twig_SimpleFunction(
- 'optionalJournalAmount', function (int $journalId, string $transactionAmount, string $code, string $type): string {
- // get amount of journal:
- $amount = strval(TransactionModel::where('transaction_journal_id', $journalId)->whereNull('deleted_at')->where('amount', '<', 0)->sum('amount'));
- // display deposit and transfer positive
- if ($type === TransactionType::DEPOSIT || $type === TransactionType::TRANSFER) {
- $amount = bcmul($amount, '-1');
- }
-
- // not equal to transaction amount?
- if (bccomp($amount, $transactionAmount) !== 0 && bccomp($amount, bcmul($transactionAmount, '-1')) !== 0) {
- //$currency =
- return sprintf(' (%s)', Amount::formatByCode($code, $amount, true));
- }
-
- return '';
-
-
- }, ['is_safe' => ['html']]
- );
- }
-
/**
* @return Twig_SimpleFunction
*/
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
index 283a342b20..bd8d30b2a9 100644
--- a/database/factories/ModelFactory.php
+++ b/database/factories/ModelFactory.php
@@ -89,6 +89,7 @@ $factory->define(
'user_id' => 1,
'transaction_type_id' => 1,
'bill_id' => null,
+ // TODO update this transaction currency reference.
'transaction_currency_id' => 1,
'description' => $faker->words(3, true),
'date' => '2017-01-01',
diff --git a/public/js/ff/transactions/single/edit.js b/public/js/ff/transactions/single/edit.js
index 17f2d0a5c0..d608568c65 100644
--- a/public/js/ff/transactions/single/edit.js
+++ b/public/js/ff/transactions/single/edit.js
@@ -38,11 +38,12 @@ function updateInitialPage() {
$('#native_amount_holder').hide();
$('#amount_holder').hide();
- if (journalData.native_currency.id === journalData.currency.id) {
+
+ if (journalData.native_currency.id === journalData.destination_currency.id) {
$('#exchange_rate_instruction_holder').hide();
$('#destination_amount_holder').hide();
}
- if (journalData.native_currency.id !== journalData.currency.id) {
+ if (journalData.native_currency.id !== journalData.destination_currency.id) {
$('#exchange_rate_instruction_holder').show().find('p').text(getTransferExchangeInstructions());
}
diff --git a/public/js/ff/transactions/split/edit.js b/public/js/ff/transactions/split/edit.js
index a91c0a3422..a97739b122 100644
--- a/public/js/ff/transactions/split/edit.js
+++ b/public/js/ff/transactions/split/edit.js
@@ -166,11 +166,31 @@ function resetSplits() {
var input = $(v);
input.attr('name', 'transactions[' + i + '][amount]');
});
+
+ // ends with ][foreign_amount]
+ $.each($('input[name$="][foreign_amount]"]'), function (i, v) {
+ var input = $(v);
+ input.attr('name', 'transactions[' + i + '][foreign_amount]');
+ });
+
+ // ends with ][transaction_currency_id]
+ $.each($('input[name$="][transaction_currency_id]"]'), function (i, v) {
+ var input = $(v);
+ input.attr('name', 'transactions[' + i + '][transaction_currency_id]');
+ });
+
+ // ends with ][foreign_currency_id]
+ $.each($('input[name$="][foreign_currency_id]"]'), function (i, v) {
+ var input = $(v);
+ input.attr('name', 'transactions[' + i + '][foreign_currency_id]');
+ });
+
// ends with ][budget_id]
$.each($('select[name$="][budget_id]"]'), function (i, v) {
var input = $(v);
input.attr('name', 'transactions[' + i + '][budget_id]');
});
+
// ends with ][category]
$.each($('input[name$="][category]"]'), function (i, v) {
var input = $(v);
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index da1c9bcb43..54f7cbc4ae 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
diff --git a/resources/views/list/journals-tiny.twig b/resources/views/list/journals-tiny.twig
index 190d28cf37..63306fa102 100644
--- a/resources/views/list/journals-tiny.twig
+++ b/resources/views/list/journals-tiny.twig
@@ -14,10 +14,8 @@
{{ transaction.description }}
{% endif %}
-
- {{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
-
- {{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
+ {# TODO replace with new format code #}
+ XX.XX
{% endfor %}
diff --git a/resources/views/list/journals.twig b/resources/views/list/journals.twig
index db348d7acb..acd95000bb 100644
--- a/resources/views/list/journals.twig
+++ b/resources/views/list/journals.twig
@@ -64,14 +64,11 @@
{% if transaction.transaction_type_type == 'Transfer' %}
- {{ formatByCode(transaction.transaction_currency_code, steam_positive(transaction.transaction_amount)) }}
-
- {{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
+ {# TODO format amount of transaction. #}
+ {# TODO format: Amount of transaction (amount in foreign) / total (total foreign) #}
+ XX.XX
{% else %}
-
- {{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
-
- {{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
+ XX.XX
{% endif %}
diff --git a/resources/views/popup/list/journals.twig b/resources/views/popup/list/journals.twig
index d6f97dcc59..1177cce1f5 100644
--- a/resources/views/popup/list/journals.twig
+++ b/resources/views/popup/list/journals.twig
@@ -45,10 +45,8 @@
-
- {{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
-
- {{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
+ {# TODO replace with new format code #}
+ XX.XX
-
- {{ formatAnything(journal.transactionCurrency, transaction.destination_account_before) }}
- ⟶ {{ formatAnything(journal.transactionCurrency, transaction.destination_account_after) }}
+ {# TODO replace with new format code #}
+ XX.XX
{% if journal.transactiontype.type == 'Deposit' %}
- {{ formatAnything(journal.transactionCurrency, transaction.destination_amount) }}
+ {# TODO replace with new format code #}
+ XX.XX
{% endif %}
{% if journal.transactiontype.type == 'Withdrawal' %}
- {{ formatAnything(journal.transactionCurrency, transaction.source_amount) }}
+ {# TODO replace with new format code #}
+ XX.XX
{% endif %}
{% if journal.transactiontype.type == 'Transfer' %}
- {{ formatAnythingPlain(journal.transactionCurrency, transaction.destination_amount) }}
+ {# TODO replace with new format code #}
+ XX.XX
{% endif %}
diff --git a/resources/views/transactions/single/edit.twig b/resources/views/transactions/single/edit.twig
index 4ef0d2ceaa..fc09562117 100644
--- a/resources/views/transactions/single/edit.twig
+++ b/resources/views/transactions/single/edit.twig
@@ -64,9 +64,9 @@
{{ ExpandedForm.nonSelectableAmount('native_amount', data.native_amount, {currency: data.native_currency}) }}
- {{ ExpandedForm.nonSelectableAmount('source_amount', data.native_amount, {currency: data.native_currency }) }}
+ {{ ExpandedForm.nonSelectableAmount('source_amount', data.source_amount, {currency: data.source_currency }) }}
- {{ ExpandedForm.nonSelectableAmount('destination_amount', data.amount, {currency: data.currency }) }}
+ {{ ExpandedForm.nonSelectableAmount('destination_amount', data.destination_amount, {currency: data.destination_currency }) }}
{# ALWAYS SHOW DATE #}
{{ ExpandedForm.date('date',data['date']) }}
diff --git a/resources/views/transactions/split/edit.twig b/resources/views/transactions/split/edit.twig
index e78dffb4ab..a0420fe4c8 100644
--- a/resources/views/transactions/split/edit.twig
+++ b/resources/views/transactions/split/edit.twig
@@ -40,9 +40,6 @@
{# DESCRIPTION IS ALWAYS AVAILABLE #}
{{ ExpandedForm.text('journal_description', journal.description) }}
- {# CURRENCY IS NEW FOR SPLIT JOURNALS #}
- {{ ExpandedForm.select('currency_id', currencies, preFilled.currency_id) }}
-
{# show source if withdrawal or transfer #}
{% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
{{ ExpandedForm.select('journal_source_account_id', assetAccounts, preFilled.journal_source_account_id) }}
@@ -59,6 +56,7 @@
{% endif %}
{# TOTAL AMOUNT IS STATIC TEXT #}
+ {# TODO this does not reflect the actual currency (currencies) #}
{{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount ) }}
@@ -204,7 +202,7 @@
{{ trans('list.source') }}
{% endif %}
-
{{ trans('list.amount') }}
+
{{ trans('list.amount') }}
{# only withdrawal has budget #}
{% if preFilled.what == 'withdrawal' %}
@@ -234,7 +232,7 @@
{% endif %}
-
+ {# deposit has several source names #}
{% if preFilled.what == 'deposit' %}
{% endif %}
-
+ {# two fields for amount #}
-
+
+
{{ transaction.transaction_currency_symbol }}
+
+
+
+
+ {# foreign amount #}
+
+ {% if transaction.foreign_amount != null %}
+
+
{{ transaction.foreign_currency_symbol }}
+
+
+
+ {% endif %}
{% if preFilled.what == 'withdrawal' %}
From 3464ab1527f1a1c3fdff416ff5f88d19375fe7af Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:13 +0200
Subject: [PATCH 059/103] New translations firefly.php (Spanish)
---
resources/lang/es_ES/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/es_ES/firefly.php b/resources/lang/es_ES/firefly.php
index 3a45d7aa57..4d6a6fd94e 100644
--- a/resources/lang/es_ES/firefly.php
+++ b/resources/lang/es_ES/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
From 6c8e10255b99ace30780d70e01d71698ce00debe Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:17 +0200
Subject: [PATCH 060/103] New translations form.php (Spanish)
---
resources/lang/es_ES/form.php | 189 ++++++++++++++++++++++++++++++++++
1 file changed, 189 insertions(+)
create mode 100644 resources/lang/es_ES/form.php
diff --git a/resources/lang/es_ES/form.php b/resources/lang/es_ES/form.php
new file mode 100644
index 0000000000..20be49e75a
--- /dev/null
+++ b/resources/lang/es_ES/form.php
@@ -0,0 +1,189 @@
+ 'Bank name',
+ 'bank_balance' => 'Balance',
+ 'savings_balance' => 'Savings balance',
+ 'credit_card_limit' => 'Credit card limit',
+ 'automatch' => 'Match automatically',
+ 'skip' => 'Skip',
+ 'name' => 'Name',
+ 'active' => 'Active',
+ 'amount_min' => 'Minimum amount',
+ 'amount_max' => 'Maximum amount',
+ 'match' => 'Matches on',
+ 'repeat_freq' => 'Repeats',
+ 'journal_currency_id' => 'Currency',
+ 'currency_id' => 'Currency',
+ 'attachments' => 'Attachments',
+ 'journal_amount' => 'Amount',
+ 'journal_asset_source_account' => 'Asset account (source)',
+ 'journal_source_account_name' => 'Revenue account (source)',
+ 'journal_source_account_id' => 'Asset account (source)',
+ 'BIC' => 'BIC',
+ 'account_from_id' => 'From account',
+ 'account_to_id' => 'To account',
+ 'source_account' => 'Source account',
+ 'destination_account' => 'Destination account',
+ 'journal_destination_account_id' => 'Asset account (destination)',
+ 'asset_destination_account' => 'Asset account (destination)',
+ 'asset_source_account' => 'Asset account (source)',
+ 'journal_description' => 'Description',
+ 'note' => 'Notes',
+ 'split_journal' => 'Split this transaction',
+ 'split_journal_explanation' => 'Split this transaction in multiple parts',
+ 'currency' => 'Currency',
+ 'account_id' => 'Asset account',
+ 'budget_id' => 'Budget',
+ 'openingBalance' => 'Opening balance',
+ 'tagMode' => 'Tag mode',
+ 'tagPosition' => 'Tag location',
+ 'virtualBalance' => 'Virtual balance',
+ 'longitude_latitude' => 'Location',
+ 'targetamount' => 'Target amount',
+ 'accountRole' => 'Account role',
+ 'openingBalanceDate' => 'Opening balance date',
+ 'ccType' => 'Credit card payment plan',
+ 'ccMonthlyPaymentDate' => 'Credit card monthly payment date',
+ 'piggy_bank_id' => 'Piggy bank',
+ 'returnHere' => 'Return here',
+ 'returnHereExplanation' => 'After storing, return here to create another one.',
+ 'returnHereUpdateExplanation' => 'After updating, return here.',
+ 'description' => 'Description',
+ 'expense_account' => 'Expense account',
+ 'revenue_account' => 'Revenue account',
+ 'decimal_places' => 'Decimal places',
+ 'exchange_rate_instruction' => 'Foreign currencies',
+ 'exchanged_amount' => 'Exchanged amount',
+ 'source_amount' => 'Amount (source)',
+ 'destination_amount' => 'Amount (destination)',
+ 'native_amount' => 'Native amount',
+
+ 'revenue_account_source' => 'Revenue account (source)',
+ 'source_account_asset' => 'Source account (asset account)',
+ 'destination_account_expense' => 'Destination account (expense account)',
+ 'destination_account_asset' => 'Destination account (asset account)',
+ 'source_account_revenue' => 'Source account (revenue account)',
+ 'type' => 'Type',
+ 'convert_Withdrawal' => 'Convert withdrawal',
+ 'convert_Deposit' => 'Convert deposit',
+ 'convert_Transfer' => 'Convert transfer',
+
+
+ 'amount' => 'Amount',
+ 'date' => 'Date',
+ 'interest_date' => 'Interest date',
+ 'book_date' => 'Book date',
+ 'process_date' => 'Processing date',
+ 'category' => 'Category',
+ 'tags' => 'Tags',
+ 'deletePermanently' => 'Delete permanently',
+ 'cancel' => 'Cancel',
+ 'targetdate' => 'Target date',
+ 'tag' => 'Tag',
+ 'under' => 'Under',
+ 'symbol' => 'Symbol',
+ 'code' => 'Code',
+ 'iban' => 'IBAN',
+ 'accountNumber' => 'Account number',
+ 'has_headers' => 'Headers',
+ 'date_format' => 'Date format',
+ 'specifix' => 'Bank- or file specific fixes',
+ 'attachments[]' => 'Attachments',
+ 'store_new_withdrawal' => 'Store new withdrawal',
+ 'store_new_deposit' => 'Store new deposit',
+ 'store_new_transfer' => 'Store new transfer',
+ 'add_new_withdrawal' => 'Add a new withdrawal',
+ 'add_new_deposit' => 'Add a new deposit',
+ 'add_new_transfer' => 'Add a new transfer',
+ 'noPiggybank' => '(no piggy bank)',
+ 'title' => 'Title',
+ 'notes' => 'Notes',
+ 'filename' => 'File name',
+ 'mime' => 'Mime type',
+ 'size' => 'Size',
+ 'trigger' => 'Trigger',
+ 'stop_processing' => 'Stop processing',
+ 'start_date' => 'Start of range',
+ 'end_date' => 'End of range',
+ 'export_start_range' => 'Start of export range',
+ 'export_end_range' => 'End of export range',
+ 'export_format' => 'File format',
+ 'include_attachments' => 'Include uploaded attachments',
+ 'include_old_uploads' => 'Include imported data',
+ 'accounts' => 'Export transactions from these accounts',
+ 'delete_account' => 'Delete account ":name"',
+ 'delete_bill' => 'Delete bill ":name"',
+ 'delete_budget' => 'Delete budget ":name"',
+ 'delete_category' => 'Delete category ":name"',
+ 'delete_currency' => 'Delete currency ":name"',
+ 'delete_journal' => 'Delete transaction with description ":description"',
+ 'delete_attachment' => 'Delete attachment ":name"',
+ 'delete_rule' => 'Delete rule ":title"',
+ 'delete_rule_group' => 'Delete rule group ":title"',
+ 'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?',
+ 'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?',
+ 'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?',
+ 'rule_areYouSure' => 'Are you sure you want to delete the rule titled ":title"?',
+ 'ruleGroup_areYouSure' => 'Are you sure you want to delete the rule group titled ":title"?',
+ 'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?',
+ 'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?',
+ 'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?',
+ 'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?',
+ 'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?',
+ 'mass_journal_are_you_sure' => 'Are you sure you want to delete these transactions?',
+ 'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?',
+ 'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.',
+ 'mass_make_selection' => 'You can still prevent items from being deleted by removing the checkbox.',
+ 'delete_all_permanently' => 'Delete selected permanently',
+ 'update_all_journals' => 'Update these transactions',
+ 'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.|All :count transactions connected to this account will be deleted as well.',
+ 'also_delete_rules' => 'The only rule connected to this rule group will be deleted as well.|All :count rules connected to this rule group will be deleted as well.',
+ 'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.|All :count piggy bank connected to this account will be deleted as well.',
+ 'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.|All :count transactions connected to this bill will spared deletion.',
+ 'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.|All :count transactions connected to this budget will spared deletion.',
+ 'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.|All :count transactions connected to this category will spared deletion.',
+ 'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.|All :count transactions connected to this tag will spared deletion.',
+
+ 'email' => 'Email address',
+ 'password' => 'Password',
+ 'password_confirmation' => 'Password (again)',
+ 'blocked' => 'Is blocked?',
+ 'blocked_code' => 'Reason for block',
+
+
+ // admin
+ 'domain' => 'Domain',
+ 'single_user_mode' => 'Single user mode',
+ 'must_confirm_account' => 'New users must activate account',
+ 'is_demo_site' => 'Is demo site',
+
+
+ // import
+ 'import_file' => 'Import file',
+ 'configuration_file' => 'Configuration file',
+ 'import_file_type' => 'Import file type',
+ 'csv_comma' => 'A comma (,)',
+ 'csv_semicolon' => 'A semicolon (;)',
+ 'csv_tab' => 'A tab (invisible)',
+ 'csv_delimiter' => 'CSV field delimiter',
+ 'csv_import_account' => 'Default import account',
+ 'csv_config' => 'CSV import configuration',
+
+
+ 'due_date' => 'Due date',
+ 'payment_date' => 'Payment date',
+ 'invoice_date' => 'Invoice date',
+ 'internal_reference' => 'Internal reference',
+];
\ No newline at end of file
From e041a5e03705503b208923ddf99cc9546fe17a31 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:19 +0200
Subject: [PATCH 061/103] New translations help.php (Spanish)
---
resources/lang/es_ES/help.php | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 resources/lang/es_ES/help.php
diff --git a/resources/lang/es_ES/help.php b/resources/lang/es_ES/help.php
new file mode 100644
index 0000000000..61210ffe41
--- /dev/null
+++ b/resources/lang/es_ES/help.php
@@ -0,0 +1,33 @@
+ 'Welcome to Firefly III',
+ 'main-content-text' => 'Do yourself a favor and follow this short guide to make sure you know your way around.',
+ 'sidebar-toggle-title' => 'Sidebar to create stuff',
+ 'sidebar-toggle-text' => 'Hidden under the plus icon are all the buttons to create new stuff. Accounts, transactions, everything!',
+ 'account-menu-title' => 'All your accounts',
+ 'account-menu-text' => 'Here you can find all the accounts you\'ve made.',
+ 'budget-menu-title' => 'Budgets',
+ 'budget-menu-text' => 'Use this page to organise your finances and limit spending.',
+ 'report-menu-title' => 'Reports',
+ 'report-menu-text' => 'Check this out when you want a solid overview of your finances.',
+ 'transaction-menu-title' => 'Transactions',
+ 'transaction-menu-text' => 'All transactions you\'ve created can be found here.',
+ 'option-menu-title' => 'Options',
+ 'option-menu-text' => 'This is pretty self-explanatory.',
+ 'main-content-end-title' => 'The end!',
+ 'main-content-end-text' => 'Remember that every page has a small question mark at the right top. Click it to get help about the page you\'re on.',
+ 'index' => 'index',
+ 'home' => 'home',
+];
\ No newline at end of file
From 3cf53604a1c2fe501fcac5641cd9f0c0c6cd091c Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:31 +0200
Subject: [PATCH 062/103] New translations firefly.php (Portuguese, Brazilian)
---
resources/lang/pt_BR/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/pt_BR/firefly.php b/resources/lang/pt_BR/firefly.php
index 7d7ee85b8c..904c5a3ceb 100644
--- a/resources/lang/pt_BR/firefly.php
+++ b/resources/lang/pt_BR/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Dividir essa transferência',
'cannot_edit_multiple_source' => 'Você não pode editar transações parceladas #:id com a descrição ":description" porque ele contém várias contas de origem.',
'cannot_edit_multiple_dest' => 'Você não pode editar transações parceladas #:id com a descrição ":description" porque ele contém várias contas de destino.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'Você não selecionou nenhuma transação válida para editar.',
// import
From f7fde93ed24daeb02d89a25b8322f1bb482468a5 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:37 +0200
Subject: [PATCH 063/103] New translations firefly.php (Dutch)
---
resources/lang/nl_NL/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.php
index 2203382d99..186615f08a 100644
--- a/resources/lang/nl_NL/firefly.php
+++ b/resources/lang/nl_NL/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Splits deze overschrijving',
'cannot_edit_multiple_source' => 'Je kan transactie #:id met omschrijving ":description" niet splitsen, want deze bevat meerdere bronrekeningen.',
'cannot_edit_multiple_dest' => 'Je kan transactie #:id met omschrijving ":description" niet wijzigen, want deze bevat meerdere doelrekeningen.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'Je hebt geen geldige transacties geselecteerd.',
// import
From e45ffba0100da5370e762d83fb830e77658f13e8 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:39 +0200
Subject: [PATCH 064/103] New translations passwords.php (Spanish)
---
resources/lang/es_ES/passwords.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/es_ES/passwords.php b/resources/lang/es_ES/passwords.php
index 1dfc1a738c..f61f371a0d 100644
--- a/resources/lang/es_ES/passwords.php
+++ b/resources/lang/es_ES/passwords.php
@@ -16,4 +16,4 @@ return [
'sent' => 'Te enviamos un correo con el link para reestablecer tu contraseña!',
'reset' => 'Tu contraseña fue reestablecida!',
'blocked' => 'Buen intento.',
-];
+];
\ No newline at end of file
From e08fd399d20bf33a773e394a5ddeded0b6bd619b Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:40 +0200
Subject: [PATCH 065/103] New translations csv.php (Spanish)
---
resources/lang/es_ES/csv.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/lang/es_ES/csv.php b/resources/lang/es_ES/csv.php
index 47b611f81a..27143be1bc 100644
--- a/resources/lang/es_ES/csv.php
+++ b/resources/lang/es_ES/csv.php
@@ -9,7 +9,7 @@
* See the LICENSE file for details.
*/
-declare(strict_types = 1);
+declare(strict_types=1);
return [
@@ -77,4 +77,4 @@ return [
'column_tags-space' => 'Etiquetas (separadas por espacios)',
'column_account-number' => 'Caja de ahorro (número de cuenta)',
'column_opposing-number' => 'Cuenta opuesta (número de cuenta)',
-];
+];
\ No newline at end of file
From db2898dfe5243fd9e2122412d6ab321d3e47d437 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:44 +0200
Subject: [PATCH 066/103] New translations auth.php (Spanish)
---
resources/lang/es_ES/auth.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lang/es_ES/auth.php b/resources/lang/es_ES/auth.php
index 45d765e4fa..3f4e103f18 100644
--- a/resources/lang/es_ES/auth.php
+++ b/resources/lang/es_ES/auth.php
@@ -25,4 +25,4 @@ return [
'failed' => 'Las credenciales no coinciden con los registros.',
'throttle' => 'Demasiados intentos de inicio de sesión. Por favor reintente en :seconds segundos.',
-];
+];
\ No newline at end of file
From 3b2fe139025b0411fca8329af99cdf5a24fac06f Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:47 +0200
Subject: [PATCH 067/103] New translations firefly.php (Slovenian)
---
resources/lang/sl_SI/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/sl_SI/firefly.php b/resources/lang/sl_SI/firefly.php
index 8358bb5d84..c5edb42c52 100644
--- a/resources/lang/sl_SI/firefly.php
+++ b/resources/lang/sl_SI/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
From 9487a95c137dcc58e57192106fa00e291b1142ac Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:40:54 +0200
Subject: [PATCH 068/103] New translations firefly.php (Polish)
---
resources/lang/pl_PL/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/pl_PL/firefly.php b/resources/lang/pl_PL/firefly.php
index 25cf01b66a..e320c548e4 100644
--- a/resources/lang/pl_PL/firefly.php
+++ b/resources/lang/pl_PL/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Podziel ten transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'Nie wybrałeś żadnych poprawnych transakcji do edycji.',
// import
From a505406ee7f99488bab9f1d2ee7db4d072b071e3 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:41:03 +0200
Subject: [PATCH 069/103] New translations firefly.php (Chinese Traditional)
---
resources/lang/zh_TW/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/zh_TW/firefly.php b/resources/lang/zh_TW/firefly.php
index 47700e4be2..63f0e11527 100644
--- a/resources/lang/zh_TW/firefly.php
+++ b/resources/lang/zh_TW/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => '你不能修改描述為 ":description" 的分割交易 #:id 因為他有多個來源帳號。',
'cannot_edit_multiple_dest' => '你不能修改描述為 ":description" 的分割交易 #:id 因為他有多個目標帳號。',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
From 7801274d33091da2206ec84b4e29c028a78f0dc5 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:41:15 +0200
Subject: [PATCH 070/103] New translations firefly.php (German)
---
resources/lang/de_DE/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php
index e025b6a7c0..34873bd40c 100644
--- a/resources/lang/de_DE/firefly.php
+++ b/resources/lang/de_DE/firefly.php
@@ -963,6 +963,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?',
'split_this_transfer' => 'Diese Überweisung aufteilen',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
From 3838b2145952ed721c9dae6f761a8f203bcfeb69 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 13:41:19 +0200
Subject: [PATCH 071/103] New translations firefly.php (French)
---
resources/lang/fr_FR/firefly.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/lang/fr_FR/firefly.php b/resources/lang/fr_FR/firefly.php
index eebbf5c9bf..00cc9d9ad1 100644
--- a/resources/lang/fr_FR/firefly.php
+++ b/resources/lang/fr_FR/firefly.php
@@ -962,6 +962,7 @@ return [
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
+ 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
From a487c7b4b2f8a5f35be537c821b750e7ae1d56a0 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 4 Jun 2017 23:39:26 +0200
Subject: [PATCH 072/103] Make sure amounts are formatted, and fixed some
issues.
---
app/Helpers/Collector/JournalCollector.php | 13 +-
app/Helpers/Report/PopupReport.php | 2 +-
app/Http/Controllers/JsonController.php | 27 ++--
app/Http/Controllers/PiggyBankController.php | 24 ++-
.../Account/AccountRepository.php | 26 +++-
app/Repositories/Journal/JournalTasker.php | 4 +
.../PiggyBank/PiggyBankRepository.php | 4 +-
app/Support/Amount.php | 80 +++++++++-
app/Support/Twig/AmountFormat.php | 141 +++++++++++++++++-
resources/views/list/journals-tiny.twig | 3 +-
resources/views/list/journals.twig | 9 +-
resources/views/popup/list/journals.twig | 2 +-
.../reports/partials/journals-audit.twig | 3 +-
resources/views/transactions/mass-delete.twig | 5 +-
resources/views/transactions/show.twig | 29 +---
15 files changed, 301 insertions(+), 71 deletions(-)
diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php
index a85535d907..fb19073685 100644
--- a/app/Helpers/Collector/JournalCollector.php
+++ b/app/Helpers/Collector/JournalCollector.php
@@ -65,12 +65,22 @@ class JournalCollector implements JournalCollectorInterface
'bills.name as bill_name',
'bills.name_encrypted as bill_name_encrypted',
'transactions.id as id',
- 'transactions.amount as transaction_amount',
+
'transactions.description as transaction_description',
'transactions.account_id',
'transactions.identifier',
'transactions.transaction_journal_id',
+
+ 'transactions.amount as transaction_amount',
'transaction_currencies.code as transaction_currency_code',
+ 'transaction_currencies.symbol as transaction_currency_symbol',
+ 'transaction_currencies.decimal_places as transaction_currency_dp',
+
+ 'transactions.foreign_amount as transaction_foreign_amount',
+ 'foreign_currencies.code as foreign_currency_code',
+ 'foreign_currencies.symbol as foreign_currency_symbol',
+ 'foreign_currencies.decimal_places as foreign_currency_dp',
+
'accounts.name as account_name',
'accounts.encrypted as account_encrypted',
'account_types.type as account_type',
@@ -489,6 +499,7 @@ class JournalCollector implements JournalCollectorInterface
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transactions.transaction_currency_id')
+ ->leftJoin('transaction_currencies as foreign_currencies', 'foreign_currencies.id', 'transactions.foreign_currency_id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php
index f4d0a07d17..265c930e6c 100644
--- a/app/Helpers/Report/PopupReport.php
+++ b/app/Helpers/Report/PopupReport.php
@@ -187,7 +187,7 @@ class PopupReport implements PopupReportInterface
$journals = $journals->filter(
function (Transaction $transaction) use ($report) {
// get the destinations:
- $destinations = $transaction->destinationAccountList($transaction->transactionJournal)->pluck('id')->toArray();
+ $destinations = $transaction->transactionJournal->destinationAccountList()->pluck('id')->toArray();
// do these intersect with the current list?
return !empty(array_intersect($report, $destinations));
diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php
index c8e916e231..4449e17b01 100644
--- a/app/Http/Controllers/JsonController.php
+++ b/app/Http/Controllers/JsonController.php
@@ -116,10 +116,11 @@ class JsonController extends Controller
* Since both this method and the chart use the exact same data, we can suffice
* with calling the one method in the bill repository that will get this amount.
*/
- $amount = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
- $amount = bcmul($amount, '-1');
+ $amount = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
+ $amount = bcmul($amount, '-1');
+ $currency = Amount::getDefaultCurrency();
- $data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
+ $data = ['box' => 'bills-paid', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
return Response::json($data);
}
@@ -131,10 +132,11 @@ class JsonController extends Controller
*/
public function boxBillsUnpaid(BillRepositoryInterface $repository)
{
- $start = session('start', Carbon::now()->startOfMonth());
- $end = session('end', Carbon::now()->endOfMonth());
- $amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
- $data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
+ $start = session('start', Carbon::now()->startOfMonth());
+ $end = session('end', Carbon::now()->endOfMonth());
+ $amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
+ $currency = Amount::getDefaultCurrency();
+ $data = ['box' => 'bills-unpaid', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
return Response::json($data);
}
@@ -167,8 +169,9 @@ class JsonController extends Controller
->setTypes([TransactionType::DEPOSIT])
->withOpposingAccount();
- $amount = strval($collector->getJournals()->sum('transaction_amount'));
- $data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
+ $amount = strval($collector->getJournals()->sum('transaction_amount'));
+ $currency = Amount::getDefaultCurrency();
+ $data = ['box' => 'in', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
$cache->store($data);
return Response::json($data);
@@ -200,9 +203,9 @@ class JsonController extends Controller
$collector->setAllAssetAccounts()->setRange($start, $end)
->setTypes([TransactionType::WITHDRAWAL])
->withOpposingAccount();
- $amount = strval($collector->getJournals()->sum('transaction_amount'));
-
- $data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
+ $amount = strval($collector->getJournals()->sum('transaction_amount'));
+ $currency = Amount::getDefaultCurrency();
+ $data = ['box' => 'out', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
$cache->store($data);
return Response::json($data);
diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php
index 052900cba5..564ee720ae 100644
--- a/app/Http/Controllers/PiggyBankController.php
+++ b/app/Http/Controllers/PiggyBankController.php
@@ -276,18 +276,29 @@ class PiggyBankController extends Controller
*/
public function postAdd(Request $request, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
- $amount = $request->get('amount');
-
+ $amount = $request->get('amount');
+ $currency = Amount::getDefaultCurrency();
if ($repository->canAddAmount($piggyBank, $amount)) {
$repository->addAmount($piggyBank, $amount);
- Session::flash('success', strval(trans('firefly.added_amount_to_piggy', ['amount' => Amount::format($amount, false), 'name' => $piggyBank->name])));
+ Session::flash(
+ 'success', strval(
+ trans(
+ 'firefly.added_amount_to_piggy',
+ ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
+ )
+ )
+ );
Preferences::mark();
return redirect(route('piggy-banks.index'));
}
Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.');
- Session::flash('error', strval(trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)])));
+ Session::flash(
+ 'error', strval(
+ trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)])
+ )
+ );
return redirect(route('piggy-banks.index'));
}
@@ -302,10 +313,11 @@ class PiggyBankController extends Controller
public function postRemove(Request $request, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$amount = $request->get('amount');
+ $currency = Amount::getDefaultCurrency();
if ($repository->canRemoveAmount($piggyBank, $amount)) {
$repository->removeAmount($piggyBank, $amount);
Session::flash(
- 'success', strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::format($amount, false), 'name' => $piggyBank->name]))
+ 'success', strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => $piggyBank->name]))
);
Preferences::mark();
@@ -314,7 +326,7 @@ class PiggyBankController extends Controller
$amount = strval(round($request->get('amount'), 12));
- Session::flash('error', strval(trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)])));
+ Session::flash('error', strval(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/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 7b594555b8..bb9ace5034 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -481,7 +481,6 @@ class AccountRepository implements AccountRepositoryInterface
[
'user_id' => $this->user->id,
'transaction_type_id' => $transactionType->id,
- // TODO update this transaction currency reference.
'transaction_currency_id' => $currencyId,
'description' => 'Initial balance for "' . $account->name . '"',
'completed' => true,
@@ -502,9 +501,23 @@ class AccountRepository implements AccountRepositoryInterface
$secondAmount = $amount;
}
- $one = new Transaction(['account_id' => $firstAccount->id, 'transaction_journal_id' => $journal->id, 'amount' => $firstAmount]);
+ $one = new Transaction(
+ [
+ 'account_id' => $firstAccount->id,
+ 'transaction_journal_id' => $journal->id,
+ 'amount' => $firstAmount,
+ 'transaction_currency_id' => $currencyId,
+ ]
+ );
$one->save();// first transaction: from
- $two = new Transaction(['account_id' => $secondAccount->id, 'transaction_journal_id' => $journal->id, 'amount' => $secondAmount]);
+
+ $two = new Transaction(
+ [
+ 'account_id' => $secondAccount->id,
+ 'transaction_journal_id' => $journal->id,
+ 'amount' => $secondAmount,
+ 'transaction_currency_id' => $currencyId,]
+ );
$two->save(); // second transaction: to
Log::debug(sprintf('Stored two transactions, #%d and #%d', $one->id, $two->id));
@@ -623,18 +636,19 @@ class AccountRepository implements AccountRepositoryInterface
// update date:
$journal->date = $date;
- // TODO update this transaction currency reference.
$journal->transaction_currency_id = $currencyId;
$journal->save();
// update transactions:
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
if ($account->id == $transaction->account_id) {
- $transaction->amount = $amount;
+ $transaction->amount = $amount;
+ $transaction->transaction_currency_id = $currencyId;
$transaction->save();
}
if ($account->id != $transaction->account_id) {
- $transaction->amount = bcmul($amount, '-1');
+ $transaction->amount = bcmul($amount, '-1');
+ $transaction->transaction_currency_id = $currencyId;
$transaction->save();
}
}
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
index bb0c8bcdd2..5958b0ff1c 100644
--- a/app/Repositories/Journal/JournalTasker.php
+++ b/app/Repositories/Journal/JournalTasker.php
@@ -101,10 +101,12 @@ class JournalTasker implements JournalTaskerInterface
'destination_accounts.encrypted as destination_account_encrypted',
'destination_account_types.type as destination_account_type',
'native_currencies.id as transaction_currency_id',
+ 'native_currencies.decimal_places as transaction_currency_dp',
'native_currencies.code as transaction_currency_code',
'native_currencies.symbol as transaction_currency_symbol',
'foreign_currencies.id as foreign_currency_id',
+ 'foreign_currencies.decimal_places as foreign_currency_dp',
'foreign_currencies.code as foreign_currency_code',
'foreign_currencies.symbol as foreign_currency_symbol',
@@ -142,9 +144,11 @@ class JournalTasker implements JournalTaskerInterface
'transaction_currency_id' => $entry->transaction_currency_id,
'transaction_currency_code' => $entry->transaction_currency_code,
'transaction_currency_symbol' => $entry->transaction_currency_symbol,
+ 'transaction_currency_dp' => $entry->transaction_currency_dp,
'foreign_currency_id' => $entry->foreign_currency_id,
'foreign_currency_code' => $entry->foreign_currency_code,
'foreign_currency_symbol' => $entry->foreign_currency_symbol,
+ 'foreign_currency_dp' => $entry->foreign_currency_dp,
];
if ($entry->destination_account_type === AccountType::CASH) {
$transaction['destination_account_name'] = '';
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index e721c71b63..b5807a51f9 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -240,10 +240,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function getPiggyBanksWithAmount(): Collection
{
+ $currency = Amount::getDefaultCurrency();
$set = $this->getPiggyBanks();
foreach ($set as $piggy) {
$currentAmount = $piggy->currentRelevantRep()->currentamount ?? '0';
- $piggy->name = $piggy->name . ' (' . Amount::format($currentAmount, false) . ')';
+
+ $piggy->name = $piggy->name . ' (' . Amount::formatAnything($currency, $currentAmount, false) . ')';
}
return $set;
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 7d11d68b7d..c75630d0ab 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace FireflyIII\Support;
use FireflyIII\Exceptions\FireflyException;
-use FireflyIII\Models\Transaction;
+use FireflyIII\Models\Transaction as TransactionModel;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
@@ -28,6 +28,7 @@ use Preferences as Prefs;
*/
class Amount
{
+
/**
* bool $sepBySpace is $localeconv['n_sep_by_space']
* int $signPosn = $localeconv['n_sign_posn']
@@ -242,4 +243,81 @@ class Amount
'zero' => $positive,
];
}
+
+ /**
+ * @param TransactionJournal $journal
+ * @param bool $coloured
+ *
+ * @return string
+ */
+ public function journalAmount(TransactionJournal $journal, bool $coloured = true): string
+ {
+ $amounts = [];
+ $transactions = $journal->transactions()->where('amount', '>', 0)->get();
+ /** @var TransactionModel $transaction */
+ foreach ($transactions as $transaction) {
+ // model some fields to fit "transactionAmount()":
+ $transaction->transaction_amount = $transaction->amount;
+ $transaction->transaction_foreign_amount = $transaction->foreign_amount;
+ $transaction->transaction_type_type = $journal->transactionType->type;
+ $transaction->transaction_currency_symbol = $transaction->transactionCurrency->symbol;
+ $transaction->transaction_currency_dp = $transaction->transactionCurrency->decimal_places;
+ if (!is_null($transaction->foreign_currency_id)) {
+ $transaction->foreign_currency_symbol = $transaction->foreignCurrency->symbol;
+ $transaction->foreign_currency_dp = $transaction->foreignCurrency->decimal_places;
+ }
+
+ $amounts[] = $this->transactionAmount($transaction, $coloured);
+ }
+
+ return join(' / ', $amounts);
+
+ }
+
+ /**
+ * This formats a transaction, IF that transaction has been "collected" using the JournalCollector.
+ *
+ * @param TransactionModel $transaction
+ * @param bool $coloured
+ *
+ * @return string
+ */
+ public function transactionAmount(TransactionModel $transaction, bool $coloured = true): string
+ {
+ $amount = bcmul(app('steam')->positive(strval($transaction->transaction_amount)), '-1');
+ $format = '%s';
+
+ if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {
+ $amount = bcmul($amount, '-1');
+ }
+
+ if ($transaction->transaction_type_type === TransactionType::TRANSFER) {
+ $amount = app('steam')->positive($amount);
+ $coloured = false;
+ $format = '%s';
+ }
+
+ $currency = new TransactionCurrency;
+ $currency->symbol = $transaction->transaction_currency_symbol;
+ $currency->decimal_places = $transaction->transaction_currency_dp;
+ $str = sprintf($format, $this->formatAnything($currency, $amount, $coloured));
+
+
+ if (!is_null($transaction->transaction_foreign_amount)) {
+ $amount = strval($transaction->transaction_foreign_amount);
+
+ if ($transaction->transaction_type_type === TransactionType::TRANSFER) {
+ $amount = app('steam')->positive($amount);
+ $coloured = false;
+ $format = '%s';
+ }
+
+ $currency = new TransactionCurrency;
+ $currency->symbol = $transaction->foreign_currency_symbol;
+ $currency->decimal_places = $transaction->foreign_currency_dp;
+ $str .= ' (' . sprintf($format, $this->formatAnything($currency, $amount, $coloured)) . ')';
+ }
+
+ return $str;
+ }
}
diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php
index eb06a98ebf..cc4c45dc19 100644
--- a/app/Support/Twig/AmountFormat.php
+++ b/app/Support/Twig/AmountFormat.php
@@ -13,6 +13,7 @@ namespace FireflyIII\Support\Twig;
use FireflyIII\Models\Account as AccountModel;
+use FireflyIII\Models\Transaction as TransactionModel;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use Twig_Extension;
@@ -45,6 +46,12 @@ class AmountFormat extends Twig_Extension
{
return [
$this->formatAmountByAccount(),
+ $this->transactionAmount(),
+ $this->journalAmount(),
+ $this->formatDestinationAfter(),
+ $this->formatDestinationBefore(),
+ $this->formatSourceAfter(),
+ $this->formatSourceBefore(),
];
}
@@ -68,7 +75,9 @@ class AmountFormat extends Twig_Extension
return new Twig_SimpleFilter(
'formatAmount', function (string $string): string {
- return app('amount')->format($string);
+ $currency = app('amount')->getDefaultCurrency();
+
+ return app('amount')->formatAnything($currency, $string, true);
}, ['is_safe' => ['html']]
);
}
@@ -102,8 +111,136 @@ class AmountFormat extends Twig_Extension
return new Twig_SimpleFilter(
'formatAmountPlain', function (string $string): string {
- return app('amount')->format($string, false);
+ $currency = app('amount')->getDefaultCurrency();
+
+ return app('amount')->formatAnything($currency, $string, false);
}, ['is_safe' => ['html']]
);
}
+
+ /**
+ * @return Twig_SimpleFunction
+ */
+ protected function formatDestinationAfter(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'formatDestinationAfter', function (array $transaction): string {
+
+ // build fake currency for main amount.
+ $format = new TransactionCurrency;
+ $format->decimal_places = $transaction['transaction_currency_dp'];
+ $format->symbol = $transaction['transaction_currency_symbol'];
+ $string = app('amount')->formatAnything($format, $transaction['destination_account_after'], true);
+
+ // also append foreign amount for clarity:
+ if (!is_null($transaction['foreign_destination_amount'])) {
+ // build fake currency for foreign amount
+ $format = new TransactionCurrency;
+ $format->decimal_places = $transaction['foreign_currency_dp'];
+ $format->symbol = $transaction['foreign_currency_symbol'];
+ $string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_destination_amount'], true) . ')';
+ }
+
+
+ return $string;
+
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * @return Twig_SimpleFunction
+ */
+ protected function formatDestinationBefore(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'formatDestinationBefore', function (array $transaction): string {
+
+ // build fake currency for main amount.
+ $format = new TransactionCurrency;
+ $format->decimal_places = $transaction['transaction_currency_dp'];
+ $format->symbol = $transaction['transaction_currency_symbol'];
+
+ return app('amount')->formatAnything($format, $transaction['destination_account_before'], true);
+
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * @return Twig_SimpleFunction
+ */
+ protected function formatSourceAfter(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'formatSourceAfter', function (array $transaction): string {
+
+ // build fake currency for main amount.
+ $format = new TransactionCurrency;
+ $format->decimal_places = $transaction['transaction_currency_dp'];
+ $format->symbol = $transaction['transaction_currency_symbol'];
+ $string = app('amount')->formatAnything($format, $transaction['source_account_after'], true);
+
+ // also append foreign amount for clarity:
+ if (!is_null($transaction['foreign_source_amount'])) {
+ // build fake currency for foreign amount
+ $format = new TransactionCurrency;
+ $format->decimal_places = $transaction['foreign_currency_dp'];
+ $format->symbol = $transaction['foreign_currency_symbol'];
+ $string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_source_amount'], true) . ')';
+ }
+
+
+ return $string;
+
+
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * @return Twig_SimpleFunction
+ */
+ protected function formatSourceBefore(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'formatSourceBefore', function (array $transaction): string {
+
+ // build fake currency for main amount.
+ $format = new TransactionCurrency;
+ $format->decimal_places = $transaction['transaction_currency_dp'];
+ $format->symbol = $transaction['transaction_currency_symbol'];
+
+ return app('amount')->formatAnything($format, $transaction['source_account_before'], true);
+
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * @return Twig_SimpleFunction
+ */
+ protected function journalAmount(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'journalAmount', function (TransactionJournal $journal): string {
+
+ return app('amount')->journalAmount($journal, true);
+ }, ['is_safe' => ['html']]
+ );
+ }
+
+ /**
+ * @return Twig_SimpleFunction
+ */
+ protected function transactionAmount(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'transactionAmount', function (TransactionModel $transaction): string {
+
+ return app('amount')->transactionAmount($transaction, true);
+ }, ['is_safe' => ['html']]
+ );
+ }
+
}
\ No newline at end of file
diff --git a/resources/views/list/journals-tiny.twig b/resources/views/list/journals-tiny.twig
index 63306fa102..ed6ee40b30 100644
--- a/resources/views/list/journals-tiny.twig
+++ b/resources/views/list/journals-tiny.twig
@@ -14,8 +14,7 @@
{{ transaction.description }}
{% endif %}
- {# TODO replace with new format code #}
- XX.XX
+ {{ transactionAmount(transaction) }}
{% endfor %}
diff --git a/resources/views/list/journals.twig b/resources/views/list/journals.twig
index acd95000bb..02fd791df8 100644
--- a/resources/views/list/journals.twig
+++ b/resources/views/list/journals.twig
@@ -62,14 +62,7 @@
- {% if transaction.transaction_type_type == 'Transfer' %}
-
- {# TODO format amount of transaction. #}
- {# TODO format: Amount of transaction (amount in foreign) / total (total foreign) #}
- XX.XX
- {% else %}
- XX.XX
- {% endif %}
+ {{ transactionAmount(transaction) }}
- {# TODO replace with new format code #}
- XX.XX
+ {{ formatDestinationBefore(transaction) }} → {{ formatDestinationAfter(transaction) }}
- {% if journal.transactiontype.type == 'Deposit' %}
-
- {# TODO replace with new format code #}
- XX.XX
-
- {% endif %}
- {% if journal.transactiontype.type == 'Withdrawal' %}
-
- {# TODO replace with new format code #}
- XX.XX
-
- {% endif %}
- {% if journal.transactiontype.type == 'Transfer' %}
-
-
- {# TODO replace with new format code #}
- XX.XX
-
- {% endif %}
+ {{ journalAmount(journal) }}
{{ transactionIdBudgets(transaction.source_id) }}
From 0b47e5d05d6f3cea944f9a5a97318e0903f632e4 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 5 Jun 2017 07:03:20 +0200
Subject: [PATCH 073/103] Removed unnecessary variable.
---
app/Console/Commands/UpgradeDatabase.php | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.php
index 2c3a20f3a0..7a185d004b 100644
--- a/app/Console/Commands/UpgradeDatabase.php
+++ b/app/Console/Commands/UpgradeDatabase.php
@@ -82,9 +82,8 @@ class UpgradeDatabase extends Command
*/
private function currencyInfoToTransactions()
{
- $count = 0;
- $expanded = 0;
- $set = TransactionJournal::with('transactions')->get();
+ $count = 0;
+ $set = TransactionJournal::with('transactions')->get();
/** @var TransactionJournal $journal */
foreach ($set as $journal) {
/** @var Transaction $transaction */
From f72f8b03dff74c03025a2a897b78a844073bf2a8 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 5 Jun 2017 07:03:32 +0200
Subject: [PATCH 074/103] Catch empty currency preference
---
app/Support/Twig/AmountFormat.php | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php
index cc4c45dc19..ba7011f902 100644
--- a/app/Support/Twig/AmountFormat.php
+++ b/app/Support/Twig/AmountFormat.php
@@ -92,13 +92,17 @@ class AmountFormat extends Twig_Extension
return new Twig_SimpleFunction(
'formatAmountByAccount', function (AccountModel $account, string $amount, bool $coloured = true): string {
$currencyId = intval($account->getMeta('currency_id'));
- if ($currencyId === 0) {
- // Format using default currency:
- return app('amount')->format($amount, $coloured);
+
+ if ($currencyId !== 0) {
+ $currency = TransactionCurrency::find($currencyId);
+
+ return app('amount')->formatAnything($currency, $amount, $coloured);
}
- $currency = TransactionCurrency::find($currencyId);
+ $currency = app('amount')->getDefaultCurrency();
return app('amount')->formatAnything($currency, $amount, $coloured);
+
+
}, ['is_safe' => ['html']]
);
}
From 1dec270907ced01323fb5556e18b5c7ac17601ac Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 5 Jun 2017 07:37:53 +0200
Subject: [PATCH 075/103] These changes fix the tests.
---
app/Repositories/Journal/JournalTasker.php | 4 +-
database/factories/ModelFactory.php | 44 +++++++-----
.../Controllers/JsonControllerTest.php | 21 +++---
.../Transaction/SplitControllerTest.php | 72 +++++++++----------
4 files changed, 75 insertions(+), 66 deletions(-)
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
index 5958b0ff1c..5aacaa94ac 100644
--- a/app/Repositories/Journal/JournalTasker.php
+++ b/app/Repositories/Journal/JournalTasker.php
@@ -144,11 +144,11 @@ class JournalTasker implements JournalTaskerInterface
'transaction_currency_id' => $entry->transaction_currency_id,
'transaction_currency_code' => $entry->transaction_currency_code,
'transaction_currency_symbol' => $entry->transaction_currency_symbol,
- 'transaction_currency_dp' => $entry->transaction_currency_dp,
+ 'transaction_currency_dp' => $entry->transaction_currency_dp,
'foreign_currency_id' => $entry->foreign_currency_id,
'foreign_currency_code' => $entry->foreign_currency_code,
'foreign_currency_symbol' => $entry->foreign_currency_symbol,
- 'foreign_currency_dp' => $entry->foreign_currency_dp,
+ 'foreign_currency_dp' => $entry->foreign_currency_dp,
];
if ($entry->destination_account_type === AccountType::CASH) {
$transaction['destination_account_name'] = '';
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
index bd8d30b2a9..2727d4d86c 100644
--- a/database/factories/ModelFactory.php
+++ b/database/factories/ModelFactory.php
@@ -217,25 +217,31 @@ $factory->define(
$factory->define(
FireflyIII\Models\Transaction::class, function (Faker\Generator $faker) {
return [
- 'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
- 'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
- 'opposing_account_id' => $faker->numberBetween(1, 10),
- 'source_account_id' => $faker->numberBetween(1, 10),
- 'opposing_account_name' => $faker->words(3, true),
- 'description' => $faker->words(3, true),
- 'source_account_name' => $faker->words(3, true),
- 'destination_account_id' => $faker->numberBetween(1, 10),
- 'date' => new Carbon,
- 'destination_account_name' => $faker->words(3, true),
- 'amount' => strval($faker->randomFloat(2, -100, 100)),
- 'budget_id' => 0,
- 'category' => $faker->words(3, true),
- 'transaction_journal_id' => $faker->numberBetween(1, 10),
- 'journal_id' => $faker->numberBetween(1, 10),
- 'transaction_currency_code' => 'EUR',
- 'transaction_type_type' => 'Withdrawal',
- 'account_encrypted' => 0,
- 'account_name' => 'Some name',
+ 'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
+ 'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
+ 'opposing_account_id' => $faker->numberBetween(1, 10),
+ 'source_account_id' => $faker->numberBetween(1, 10),
+ 'opposing_account_name' => $faker->words(3, true),
+ 'description' => $faker->words(3, true),
+ 'source_account_name' => $faker->words(3, true),
+ 'destination_account_id' => $faker->numberBetween(1, 10),
+ 'date' => new Carbon,
+ 'destination_account_name' => $faker->words(3, true),
+ 'amount' => strval($faker->randomFloat(2, -100, 100)),
+ 'budget_id' => 0,
+ 'category' => $faker->words(3, true),
+ 'transaction_journal_id' => $faker->numberBetween(1, 10),
+ 'journal_id' => $faker->numberBetween(1, 10),
+ 'transaction_currency_code' => 'EUR',
+ 'transaction_type_type' => 'Withdrawal',
+ 'account_encrypted' => 0,
+ 'account_name' => 'Some name',
+ 'transaction_currency_id' => 1,
+ 'transaction_currency_symbol' => '€',
+ 'foreign_destination_amount' => null,
+ 'foreign_currency_id' => null,
+ 'foreign_currency_code' => null,
+ 'foreign_currency_symbol' => null,
];
}
);
\ No newline at end of file
diff --git a/tests/Feature/Controllers/JsonControllerTest.php b/tests/Feature/Controllers/JsonControllerTest.php
index 798575bbef..22c4152d77 100644
--- a/tests/Feature/Controllers/JsonControllerTest.php
+++ b/tests/Feature/Controllers/JsonControllerTest.php
@@ -21,7 +21,6 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
-use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
@@ -88,15 +87,17 @@ class JsonControllerTest extends TestCase
public function testBoxBillsPaid()
{
// mock stuff
+
$billRepos = $this->mock(BillRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$billRepos->shouldReceive('getBillsPaidInRange')->andReturn('-100');
$this->be($this->user());
+ $currency = Amount::getDefaultCurrency();
$response = $this->get(route('json.box.paid'));
$response->assertStatus(200);
- $response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'bills-paid']);
+ $response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'bills-paid']);
}
/**
@@ -105,6 +106,7 @@ class JsonControllerTest extends TestCase
public function testBoxBillsUnpaid()
{
// mock stuff
+
$billRepos = $this->mock(BillRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -112,9 +114,10 @@ class JsonControllerTest extends TestCase
$this->be($this->user());
+ $currency = Amount::getDefaultCurrency();
$response = $this->get(route('json.box.unpaid'));
$response->assertStatus(200);
- $response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'bills-unpaid']);
+ $response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'bills-unpaid']);
}
/**
@@ -123,8 +126,7 @@ class JsonControllerTest extends TestCase
public function testBoxIn()
{
// mock stuff
- $accountRepos = $this->mock(AccountRepositoryInterface::class);
- $tasker = $this->mock(AccountTaskerInterface::class);
+
$collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -139,9 +141,10 @@ class JsonControllerTest extends TestCase
$this->be($this->user());
+ $currency = Amount::getDefaultCurrency();
$response = $this->get(route('json.box.in'));
$response->assertStatus(200);
- $response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'in']);
+ $response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'in']);
}
/**
@@ -150,8 +153,7 @@ class JsonControllerTest extends TestCase
public function testBoxOut()
{
// mock stuff
- $accountRepos = $this->mock(AccountRepositoryInterface::class);
- $tasker = $this->mock(AccountTaskerInterface::class);
+
$collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -165,9 +167,10 @@ class JsonControllerTest extends TestCase
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
$this->be($this->user());
+ $currency = Amount::getDefaultCurrency();
$response = $this->get(route('json.box.out'));
$response->assertStatus(200);
- $response->assertExactJson(['amount' => Amount::format('100', false), 'amount_raw' => '100', 'box' => 'out']);
+ $response->assertExactJson(['amount' => Amount::formatAnything($currency, '100', false), 'amount_raw' => '100', 'box' => 'out']);
}
/**
diff --git a/tests/Feature/Controllers/Transaction/SplitControllerTest.php b/tests/Feature/Controllers/Transaction/SplitControllerTest.php
index 00c5a5b3c6..578802bc8c 100644
--- a/tests/Feature/Controllers/Transaction/SplitControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/SplitControllerTest.php
@@ -7,7 +7,7 @@
* See the LICENSE file for details.
*/
-declare(strict_types = 1);
+declare(strict_types=1);
namespace Tests\Feature\Controllers\Transaction;
@@ -32,37 +32,6 @@ use Tests\TestCase;
*/
class SplitControllerTest extends TestCase
{
- /**
- * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::edit
- * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::__construct
- * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::arrayFromJournal
- * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::getTransactionDataFromJournal
- */
- public function testEditSingle()
- {
-
- $currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
- $accountRepository = $this->mock(AccountRepositoryInterface::class);
- $budgetRepository = $this->mock(BudgetRepositoryInterface::class);
- $transactions = factory(Transaction::class, 1)->make();
- $tasker = $this->mock(JournalTaskerInterface::class);
-
- $currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
- $accountRepository->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])
- ->andReturn(new Collection)->once();
- $budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
- $tasker->shouldReceive('getTransactionsOverview')->andReturn($transactions->toArray());
-
-
- $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
- $this->be($this->user());
- $response = $this->get(route('transactions.split.edit', [$deposit->id]));
- $response->assertStatus(200);
- // has bread crumb
- $response->assertSee('');
- }
-
-
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SplitController::edit
* @covers \FireflyIII\Http\Controllers\Transaction\SplitController::__construct
@@ -104,6 +73,36 @@ class SplitControllerTest extends TestCase
$response->assertStatus(302);
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::edit
+ * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::__construct
+ * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::arrayFromJournal
+ * @covers \FireflyIII\Http\Controllers\Transaction\SplitController::getTransactionDataFromJournal
+ */
+ public function testEditSingle()
+ {
+
+ $currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
+ $accountRepository = $this->mock(AccountRepositoryInterface::class);
+ $budgetRepository = $this->mock(BudgetRepositoryInterface::class);
+ $transactions = factory(Transaction::class, 1)->make();
+ $tasker = $this->mock(JournalTaskerInterface::class);
+
+ $currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
+ $accountRepository->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])
+ ->andReturn(new Collection)->once();
+ $budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
+ $tasker->shouldReceive('getTransactionsOverview')->andReturn($transactions->toArray());
+
+
+ $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
+ $this->be($this->user());
+ $response = $this->get(route('transactions.split.edit', [$deposit->id]));
+ $response->assertStatus(200);
+ // has bread crumb
+ $response->assertSee('');
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SplitController::update
* @covers \FireflyIII\Http\Controllers\Transaction\SplitController::arrayFromInput
@@ -124,10 +123,11 @@ class SplitControllerTest extends TestCase
'tags' => '',
'transactions' => [
[
- 'description' => 'Split #1',
- 'source_account_name' => 'Job',
- 'amount' => 1591,
- 'category' => '',
+ 'description' => 'Split #1',
+ 'source_account_name' => 'Job',
+ 'transaction_currency_id' => 1,
+ 'amount' => 1591,
+ 'category' => '',
],
],
];
From 64831b4c86367ed85887f3ed86112d6a4a08e740 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 5 Jun 2017 08:31:22 +0200
Subject: [PATCH 076/103] Code cleanup and refactoring.
---
.../Events/StoredJournalEventHandler.php | 4 +
.../Events/UpdatedJournalEventHandler.php | 2 +
app/Http/Controllers/JsonController.php | 11 +-
.../Transaction/MassController.php | 6 +-
.../Transaction/SingleController.php | 6 +-
.../Transaction/SplitController.php | 6 +-
app/Mail/RegisteredUser.php | 3 +-
app/Providers/JournalServiceProvider.php | 32 +
.../Journal/JournalRepository.php | 597 +-----------------
.../Journal/JournalRepositoryInterface.php | 16 -
app/Repositories/Journal/JournalSupport.php | 361 +++++++++++
app/Repositories/Journal/JournalUpdate.php | 290 +++++++++
.../Journal/JournalUpdateInterface.php | 44 ++
app/Services/Currency/FixerIO.php | 2 +
.../Transaction/MassControllerTest.php | 4 +-
.../Transaction/SingleControllerTest.php | 4 +-
.../Transaction/SplitControllerTest.php | 4 +-
17 files changed, 769 insertions(+), 623 deletions(-)
create mode 100644 app/Repositories/Journal/JournalSupport.php
create mode 100644 app/Repositories/Journal/JournalUpdate.php
create mode 100644 app/Repositories/Journal/JournalUpdateInterface.php
diff --git a/app/Handlers/Events/StoredJournalEventHandler.php b/app/Handlers/Events/StoredJournalEventHandler.php
index 7a880fc699..6d266d0dda 100644
--- a/app/Handlers/Events/StoredJournalEventHandler.php
+++ b/app/Handlers/Events/StoredJournalEventHandler.php
@@ -42,6 +42,10 @@ class StoredJournalEventHandler
/**
* StoredJournalEventHandler constructor.
+ *
+ * @param PRI $repository
+ * @param JRI $journalRepository
+ * @param RGRI $ruleGroupRepository
*/
public function __construct(PRI $repository, JRI $journalRepository, RGRI $ruleGroupRepository)
{
diff --git a/app/Handlers/Events/UpdatedJournalEventHandler.php b/app/Handlers/Events/UpdatedJournalEventHandler.php
index 1cdadd6da8..e4ea75a008 100644
--- a/app/Handlers/Events/UpdatedJournalEventHandler.php
+++ b/app/Handlers/Events/UpdatedJournalEventHandler.php
@@ -35,6 +35,8 @@ class UpdatedJournalEventHandler
/**
* StoredJournalEventHandler constructor.
+ *
+ * @param RuleGroupRepositoryInterface $ruleGroupRepository
*/
public function __construct(RuleGroupRepositoryInterface $ruleGroupRepository)
{
diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php
index 4449e17b01..0313f57040 100644
--- a/app/Http/Controllers/JsonController.php
+++ b/app/Http/Controllers/JsonController.php
@@ -142,10 +142,9 @@ class JsonController extends Controller
}
/**
- * @param AccountTaskerInterface $accountTasker
- * @param AccountRepositoryInterface $repository
- *
* @return \Illuminate\Http\JsonResponse
+ * @internal param AccountTaskerInterface $accountTasker
+ * @internal param AccountRepositoryInterface $repository
*
*/
public function boxIn()
@@ -178,10 +177,10 @@ class JsonController extends Controller
}
/**
- * @param AccountTaskerInterface $accountTasker
- * @param AccountRepositoryInterface $repository
- *
* @return \Symfony\Component\HttpFoundation\Response
+ * @internal param AccountTaskerInterface $accountTasker
+ * @internal param AccountRepositoryInterface $repository
+ *
*/
public function boxOut()
{
diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php
index b0205f36af..0551bfafe8 100644
--- a/app/Http/Controllers/Transaction/MassController.php
+++ b/app/Http/Controllers/Transaction/MassController.php
@@ -23,6 +23,7 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
+use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use Illuminate\Support\Collection;
use Preferences;
use Session;
@@ -203,11 +204,10 @@ class MassController extends Controller
*
* @return mixed
*/
- public function update(MassEditJournalRequest $request, JournalRepositoryInterface $repository)
+ public function update(MassEditJournalRequest $request, JournalRepositoryInterface $repository, JournalUpdateInterface $updater)
{
$journalIds = $request->get('journals');
$count = 0;
-
if (is_array($journalIds)) {
foreach ($journalIds as $journalId) {
$journal = $repository->find(intval($journalId));
@@ -251,7 +251,7 @@ class MassController extends Controller
'tags' => $tags,
];
// call repository update function.
- $repository->update($journal, $data);
+ $updater->update($journal, $data);
$count++;
}
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index 89de28d7d2..bdd4de6a21 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -27,6 +27,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
+use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Log;
use Preferences;
@@ -366,11 +367,12 @@ class SingleController extends Controller
/**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
+ * @param JournalUpdateInterface $updater
* @param TransactionJournal $journal
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
- public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
+ public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, JournalUpdateInterface $updater, TransactionJournal $journal)
{
// @codeCoverageIgnoreStart
if ($this->isOpeningBalance($journal)) {
@@ -379,7 +381,7 @@ class SingleController extends Controller
// @codeCoverageIgnoreEnd
$data = $request->getJournalData();
- $journal = $repository->update($journal, $data);
+ $journal = $updater->update($journal, $data);
/** @var array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$this->attachments->saveAttachmentsForModel($journal, $files);
diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php
index e6668bc43e..2514574fe1 100644
--- a/app/Http/Controllers/Transaction/SplitController.php
+++ b/app/Http/Controllers/Transaction/SplitController.php
@@ -25,6 +25,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
+use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use Illuminate\Http\Request;
use Log;
use Preferences;
@@ -124,18 +125,19 @@ class SplitController extends Controller
/**
* @param Request $request
* @param JournalRepositoryInterface $repository
+ * @param JournalUpdateInterface $updater
* @param TransactionJournal $journal
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
- public function update(Request $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
+ public function update(Request $request, JournalRepositoryInterface $repository, JournalUpdateInterface $updater, TransactionJournal $journal)
{
if ($this->isOpeningBalance($journal)) {
return $this->redirectToAccount($journal);
}
$data = $this->arrayFromInput($request);
- $journal = $repository->updateSplitJournal($journal, $data);
+ $journal = $updater->updateSplitJournal($journal, $data);
/** @var array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
// save attachments:
diff --git a/app/Mail/RegisteredUser.php b/app/Mail/RegisteredUser.php
index f48ddfe6d5..924aa883de 100644
--- a/app/Mail/RegisteredUser.php
+++ b/app/Mail/RegisteredUser.php
@@ -17,7 +17,8 @@ class RegisteredUser extends Mailable
/**
* Create a new message instance.
*
- * @return void
+ * @param string $address
+ * @param string $ip
*/
public function __construct(string $address, string $ip)
{
diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php
index 42ff742255..7c65845e93 100644
--- a/app/Providers/JournalServiceProvider.php
+++ b/app/Providers/JournalServiceProvider.php
@@ -20,6 +20,8 @@ use FireflyIII\Repositories\Journal\JournalRepository;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTasker;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
+use FireflyIII\Repositories\Journal\JournalUpdate;
+use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -50,8 +52,12 @@ class JournalServiceProvider extends ServiceProvider
$this->registerRepository();
$this->registerTasker();
$this->registerCollector();
+ $this->registerUpdater();
}
+ /**
+ *
+ */
private function registerCollector()
{
$this->app->bind(
@@ -69,6 +75,9 @@ class JournalServiceProvider extends ServiceProvider
);
}
+ /**
+ *
+ */
private function registerRepository()
{
$this->app->bind(
@@ -86,6 +95,29 @@ class JournalServiceProvider extends ServiceProvider
);
}
+ /**
+ *
+ */
+ private function registerUpdater()
+ {
+ $this->app->bind(
+ JournalUpdateInterface::class,
+ function (Application $app) {
+ /** @var JournalUpdateInterface $tasker */
+ $update = app(JournalUpdate::class);
+
+ if ($app->auth->check()) {
+ $update->setUser(auth()->user());
+ }
+
+ return $update;
+ }
+ );
+ }
+
+ /**
+ *
+ */
private function registerTasker()
{
$this->app->bind(
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 9a28be284b..85746ec174 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -13,12 +13,7 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\Journal;
-use DB;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
-use FireflyIII\Models\AccountType;
-use FireflyIII\Models\Budget;
-use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
@@ -40,10 +35,7 @@ class JournalRepository implements JournalRepositoryInterface
/** @var User */
private $user;
/** @var array */
- private $validMetaFields
- = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes', 'foreign_amount',
- 'foreign_currency_id',
- ];
+ private $validMetaFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes'];
/**
* @param TransactionJournal $journal
@@ -179,8 +171,8 @@ class JournalRepository implements JournalRepositoryInterface
// find transaction type.
/** @var TransactionType $transactionType */
$transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
- $accounts = $this->storeAccounts($transactionType, $data);
- $data = $this->verifyNativeAmount($data, $accounts);
+ $accounts = JournalSupport::storeAccounts($this->user, $transactionType, $data);
+ $data = JournalSupport::verifyNativeAmount($data, $accounts);
$amount = strval($data['amount']);
$journal = new TransactionJournal(
[
@@ -195,8 +187,8 @@ class JournalRepository implements JournalRepositoryInterface
$journal->save();
// store stuff:
- $this->storeCategoryWithJournal($journal, $data['category']);
- $this->storeBudgetWithJournal($journal, $data['budget_id']);
+ JournalSupport::storeCategoryWithJournal($journal, $data['category']);
+ JournalSupport::storeBudgetWithJournal($journal, $data['budget_id']);
// store two transactions:
$one = [
@@ -211,7 +203,7 @@ class JournalRepository implements JournalRepositoryInterface
'budget' => null,
'identifier' => 0,
];
- $this->storeTransaction($one);
+ JournalSupport::storeTransaction($one);
$two = [
'journal' => $journal,
@@ -226,7 +218,7 @@ class JournalRepository implements JournalRepositoryInterface
'identifier' => 0,
];
- $this->storeTransaction($two);
+ JournalSupport::storeTransaction($two);
// store tags
@@ -249,152 +241,6 @@ class JournalRepository implements JournalRepositoryInterface
}
- /**
- * @param TransactionJournal $journal
- * @param array $data
- *
- * @return TransactionJournal
- */
- public function update(TransactionJournal $journal, array $data): TransactionJournal
- {
-
- // update actual journal:
- $journal->description = $data['description'];
- $journal->date = $data['date'];
- $accounts = $this->storeAccounts($journal->transactionType, $data);
- $data = $this->verifyNativeAmount($data, $accounts);
- $data['amount'] = strval($data['amount']);
- $data['foreign_amount'] = is_null($data['foreign_amount']) ? null : strval($data['foreign_amount']);
-
- var_dump($data);
-
- // unlink all categories, recreate them:
- $journal->categories()->detach();
- $journal->budgets()->detach();
-
- $this->storeCategoryWithJournal($journal, $data['category']);
- $this->storeBudgetWithJournal($journal, $data['budget_id']);
-
- // negative because source loses money.
- $this->updateSourceTransaction($journal, $accounts['source'], $data);
-
- // positive because destination gets money.
- $this->updateDestinationTransaction($journal, $accounts['destination'], $data);
-
- $journal->save();
-
- // update tags:
- if (isset($data['tags']) && is_array($data['tags'])) {
- $this->updateTags($journal, $data['tags']);
- }
-
- // update meta fields:
- $result = $journal->save();
- if ($result) {
- foreach ($data as $key => $value) {
- if (in_array($key, $this->validMetaFields)) {
- $journal->setMeta($key, $value);
- continue;
- }
- Log::debug(sprintf('Could not store meta field "%s" with value "%s" for journal #%d', json_encode($key), json_encode($value), $journal->id));
- }
-
- return $journal;
- }
-
- return $journal;
- }
-
- /**
- * Same as above but for transaction journal with multiple transactions.
- *
- * @param TransactionJournal $journal
- * @param array $data
- *
- * @return TransactionJournal
- */
- public function updateSplitJournal(TransactionJournal $journal, array $data): TransactionJournal
- {
- // update actual journal:
- $journal->description = $data['journal_description'];
- $journal->date = $data['date'];
- $journal->save();
- Log::debug(sprintf('Updated split journal #%d', $journal->id));
-
- // unlink all categories:
- $journal->categories()->detach();
- $journal->budgets()->detach();
-
- // update meta fields:
- $result = $journal->save();
- if ($result) {
- foreach ($data as $key => $value) {
- if (in_array($key, $this->validMetaFields)) {
- $journal->setMeta($key, $value);
- continue;
- }
- Log::debug(sprintf('Could not store meta field "%s" with value "%s" for journal #%d', json_encode($key), json_encode($value), $journal->id));
- }
- }
-
-
- // update tags:
- if (isset($data['tags']) && is_array($data['tags'])) {
- $this->updateTags($journal, $data['tags']);
- }
-
- // delete original transactions, and recreate them.
- $journal->transactions()->delete();
-
- // store each transaction.
- $identifier = 0;
- Log::debug(sprintf('Count %d transactions in updateSplitJournal()', count($data['transactions'])));
-
- foreach ($data['transactions'] as $transaction) {
- Log::debug(sprintf('Split journal update split transaction %d', $identifier));
- $transaction = $this->appendTransactionData($transaction, $data);
- $this->storeSplitTransaction($journal, $transaction, $identifier);
- $identifier++;
- }
-
- $journal->save();
-
- return $journal;
- }
-
- /**
- * When the user edits a split journal, each line is missing crucial data:
- *
- * - Withdrawal lines are missing the source account ID
- * - Deposit lines are missing the destination account ID
- * - Transfers are missing both.
- *
- * We need to append the array.
- *
- * @param array $transaction
- * @param array $data
- *
- * @return array
- */
- private function appendTransactionData(array $transaction, array $data): array
- {
- switch ($data['what']) {
- case strtolower(TransactionType::TRANSFER):
- case strtolower(TransactionType::WITHDRAWAL):
- $transaction['source_account_id'] = intval($data['journal_source_account_id']);
- break;
- }
-
- switch ($data['what']) {
- case strtolower(TransactionType::TRANSFER):
- case strtolower(TransactionType::DEPOSIT):
- $transaction['destination_account_id'] = intval($data['journal_destination_account_id']);
- break;
- }
-
- return $transaction;
- }
-
/**
*
* * Remember: a balancingAct takes at most one expense and one transfer.
@@ -422,433 +268,4 @@ class JournalRepository implements JournalRepositoryInterface
return true;
}
-
- /**
- * @param TransactionType $type
- * @param array $data
- *
- * @return array
- * @throws FireflyException
- */
- private function storeAccounts(TransactionType $type, array $data): array
- {
- $accounts = [
- 'source' => null,
- 'destination' => null,
- ];
-
- Log::debug(sprintf('Going to store accounts for type %s', $type->type));
- switch ($type->type) {
- case TransactionType::WITHDRAWAL:
- $accounts = $this->storeWithdrawalAccounts($data);
- break;
-
- case TransactionType::DEPOSIT:
- $accounts = $this->storeDepositAccounts($data);
-
- break;
- case TransactionType::TRANSFER:
- $accounts['source'] = Account::where('user_id', $this->user->id)->where('id', $data['source_account_id'])->first();
- $accounts['destination'] = Account::where('user_id', $this->user->id)->where('id', $data['destination_account_id'])->first();
- break;
- default:
- throw new FireflyException(sprintf('Did not recognise transaction type "%s".', $type->type));
- }
-
- if (is_null($accounts['source'])) {
- Log::error('"source"-account is null, so we cannot continue!', ['data' => $data]);
- throw new FireflyException('"source"-account is null, so we cannot continue!');
- }
-
- if (is_null($accounts['destination'])) {
- Log::error('"destination"-account is null, so we cannot continue!', ['data' => $data]);
- throw new FireflyException('"destination"-account is null, so we cannot continue!');
-
- }
-
-
- return $accounts;
- }
-
- /**
- * @param TransactionJournal $journal
- * @param int $budgetId
- */
- private function storeBudgetWithJournal(TransactionJournal $journal, int $budgetId)
- {
- if (intval($budgetId) > 0 && $journal->transactionType->type === TransactionType::WITHDRAWAL) {
- /** @var \FireflyIII\Models\Budget $budget */
- $budget = Budget::find($budgetId);
- $journal->budgets()->save($budget);
- }
- }
-
- /**
- * @param Transaction $transaction
- * @param int $budgetId
- */
- private function storeBudgetWithTransaction(Transaction $transaction, int $budgetId)
- {
- if (intval($budgetId) > 0 && $transaction->transactionJournal->transactionType->type !== TransactionType::TRANSFER) {
- /** @var \FireflyIII\Models\Budget $budget */
- $budget = Budget::find($budgetId);
- $transaction->budgets()->save($budget);
- }
- }
-
- /**
- * @param TransactionJournal $journal
- * @param string $category
- */
- private function storeCategoryWithJournal(TransactionJournal $journal, string $category)
- {
- if (strlen($category) > 0) {
- $category = Category::firstOrCreateEncrypted(['name' => $category, 'user_id' => $journal->user_id]);
- $journal->categories()->save($category);
- }
- }
-
- /**
- * @param Transaction $transaction
- * @param string $category
- */
- private function storeCategoryWithTransaction(Transaction $transaction, string $category)
- {
- if (strlen($category) > 0) {
- $category = Category::firstOrCreateEncrypted(['name' => $category, 'user_id' => $transaction->transactionJournal->user_id]);
- $transaction->categories()->save($category);
- }
- }
-
- /**
- * @param array $data
- *
- * @return array
- */
- private function storeDepositAccounts(array $data): array
- {
- Log::debug('Now in storeDepositAccounts().');
- $destinationAccount = Account::where('user_id', $this->user->id)->where('id', $data['destination_account_id'])->first(['accounts.*']);
-
- Log::debug(sprintf('Destination account is #%d ("%s")', $destinationAccount->id, $destinationAccount->name));
-
- if (strlen($data['source_account_name']) > 0) {
- $sourceType = AccountType::where('type', 'Revenue account')->first();
- $sourceAccount = Account::firstOrCreateEncrypted(
- ['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => $data['source_account_name'], 'active' => 1]
- );
-
- Log::debug(sprintf('source account name is "%s", account is %d', $data['source_account_name'], $sourceAccount->id));
-
- return [
- 'source' => $sourceAccount,
- 'destination' => $destinationAccount,
- ];
- }
-
- Log::debug('source_account_name is empty, so default to cash account!');
-
- $sourceType = AccountType::where('type', AccountType::CASH)->first();
- $sourceAccount = Account::firstOrCreateEncrypted(
- ['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => 'Cash account', 'active' => 1]
- );
-
- return [
- 'source' => $sourceAccount,
- 'destination' => $destinationAccount,
- ];
- }
-
- /**
- * @param TransactionJournal $journal
- * @param array $transaction
- * @param int $identifier
- *
- * @return Collection
- */
- private function storeSplitTransaction(TransactionJournal $journal, array $transaction, int $identifier): Collection
- {
- // store source and destination accounts (depends on type)
- $accounts = $this->storeAccounts($journal->transactionType, $transaction);
-
- // store transaction one way:
- $amount = bcmul(strval($transaction['amount']), '-1');
- $foreignAmount = is_null($transaction['foreign_amount']) ? null : bcmul(strval($transaction['foreign_amount']), '-1');
- $one = $this->storeTransaction(
- [
- 'journal' => $journal,
- 'account' => $accounts['source'],
- 'amount' => $amount,
- 'transaction_currency_id' => $transaction['transaction_currency_id'],
- 'foreign_amount' => $foreignAmount,
- 'foreign_currency_id' => $transaction['foreign_currency_id'],
- 'description' => $transaction['description'],
- 'category' => null,
- 'budget' => null,
- 'identifier' => $identifier,
- ]
- );
- $this->storeCategoryWithTransaction($one, $transaction['category']);
- $this->storeBudgetWithTransaction($one, $transaction['budget_id']);
-
- // and the other way:
- $amount = strval($transaction['amount']);
- $foreignAmount = is_null($transaction['foreign_amount']) ? null : strval($transaction['foreign_amount']);
- $two = $this->storeTransaction(
- [
- 'journal' => $journal,
- 'account' => $accounts['destination'],
- 'amount' => $amount,
- 'transaction_currency_id' => $transaction['transaction_currency_id'],
- 'foreign_amount' => $foreignAmount,
- 'foreign_currency_id' => $transaction['foreign_currency_id'],
- 'description' => $transaction['description'],
- 'category' => null,
- 'budget' => null,
- 'identifier' => $identifier,
- ]
- );
- $this->storeCategoryWithTransaction($two, $transaction['category']);
- $this->storeBudgetWithTransaction($two, $transaction['budget_id']);
-
- return new Collection([$one, $two]);
- }
-
- /**
- * @param array $data
- *
- * @return Transaction
- */
- private function storeTransaction(array $data): Transaction
- {
- $fields = [
- 'transaction_journal_id' => $data['journal']->id,
- 'account_id' => $data['account']->id,
- 'amount' => $data['amount'],
- 'foreign_amount' => $data['foreign_amount'],
- 'transaction_currency_id' => $data['transaction_currency_id'],
- 'foreign_currency_id' => $data['foreign_currency_id'],
- 'description' => $data['description'],
- 'identifier' => $data['identifier'],
- ];
-
-
- if (is_null($data['foreign_currency_id'])) {
- unset($fields['foreign_currency_id']);
- }
- if (is_null($data['foreign_amount'])) {
- unset($fields['foreign_amount']);
- }
-
- /** @var Transaction $transaction */
- $transaction = Transaction::create($fields);
-
- Log::debug(sprintf('Transaction stored with ID: %s', $transaction->id));
-
- if (!is_null($data['category'])) {
- $transaction->categories()->save($data['category']);
- }
-
- if (!is_null($data['budget'])) {
- $transaction->categories()->save($data['budget']);
- }
-
- return $transaction;
-
- }
-
- /**
- * @param array $data
- *
- * @return array
- */
- private function storeWithdrawalAccounts(array $data): array
- {
- Log::debug('Now in storeWithdrawalAccounts().');
- $sourceAccount = Account::where('user_id', $this->user->id)->where('id', $data['source_account_id'])->first(['accounts.*']);
-
- Log::debug(sprintf('Source account is #%d ("%s")', $sourceAccount->id, $sourceAccount->name));
-
- if (strlen($data['destination_account_name']) > 0) {
- $destinationType = AccountType::where('type', AccountType::EXPENSE)->first();
- $destinationAccount = Account::firstOrCreateEncrypted(
- [
- 'user_id' => $this->user->id,
- 'account_type_id' => $destinationType->id,
- 'name' => $data['destination_account_name'],
- 'active' => 1,
- ]
- );
-
- Log::debug(sprintf('destination account name is "%s", account is %d', $data['destination_account_name'], $destinationAccount->id));
-
- return [
- 'source' => $sourceAccount,
- 'destination' => $destinationAccount,
- ];
- }
- Log::debug('destination_account_name is empty, so default to cash account!');
- $destinationType = AccountType::where('type', AccountType::CASH)->first();
- $destinationAccount = Account::firstOrCreateEncrypted(
- ['user_id' => $this->user->id, 'account_type_id' => $destinationType->id, 'name' => 'Cash account', 'active' => 1]
- );
-
- return [
- 'source' => $sourceAccount,
- 'destination' => $destinationAccount,
- ];
-
-
- }
-
- /**
- * @param TransactionJournal $journal
- * @param Account $account
- * @param array $data
- *
- * @throws FireflyException
- */
- private function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data)
- {
- $set = $journal->transactions()->where('amount', '>', 0)->get();
- if ($set->count() != 1) {
- throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
- }
- /** @var Transaction $transaction */
- $transaction = $set->first();
- $transaction->amount = app('steam')->positive($data['amount']);
- $transaction->transaction_currency_id = $data['currency_id'];
- $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : app('steam')->positive($data['foreign_amount']);
- $transaction->foreign_currency_id = $data['foreign_currency_id'];
-
- $transaction->account_id = $account->id;
- $transaction->save();
-
- }
-
- /**
- * @param TransactionJournal $journal
- * @param Account $account
- * @param array $data
- *
- * @throws FireflyException
- */
- private function updateSourceTransaction(TransactionJournal $journal, Account $account, array $data)
- {
- // should be one:
- $set = $journal->transactions()->where('amount', '<', 0)->get();
- if ($set->count() != 1) {
- throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
- }
- /** @var Transaction $transaction */
- $transaction = $set->first();
- $transaction->amount = bcmul(app('steam')->positive($data['amount']), '-1');
- $transaction->transaction_currency_id = $data['currency_id'];
- $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1');
- $transaction->foreign_currency_id = $data['foreign_currency_id'];
- $transaction->save();
- }
-
- /**
- * @param TransactionJournal $journal
- * @param array $array
- *
- * @return bool
- */
- private function updateTags(TransactionJournal $journal, array $array): bool
- {
- // create tag repository
- /** @var TagRepositoryInterface $tagRepository */
- $tagRepository = app(TagRepositoryInterface::class);
-
-
- // find or create all tags:
- $tags = [];
- $ids = [];
- foreach ($array as $name) {
- if (strlen(trim($name)) > 0) {
- $tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
- $tags[] = $tag;
- $ids[] = $tag->id;
- }
- }
-
- // delete all tags connected to journal not in this array:
- if (count($ids) > 0) {
- DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete();
- }
- // if count is zero, delete them all:
- if (count($ids) == 0) {
- DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete();
- }
-
- // connect each tag to journal (if not yet connected):
- /** @var Tag $tag */
- foreach ($tags as $tag) {
- Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));
- $tagRepository->connect($journal, $tag);
- }
-
- return true;
- }
-
- /**
- * This method checks the data array and the given accounts to verify that the native amount, currency
- * and possible the foreign currency and amount are properly saved.
- *
- * @param array $data
- * @param array $accounts
- *
- * @return array
- * @throws FireflyException
- */
- private function verifyNativeAmount(array $data, array $accounts): array
- {
- /** @var TransactionType $transactionType */
- $transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
- $submittedCurrencyId = $data['currency_id'];
- $data['foreign_amount'] = null;
- $data['foreign_currency_id'] = null;
-
- // which account to check for what the native currency is?
- $check = 'source';
- if ($transactionType->type === TransactionType::DEPOSIT) {
- $check = 'destination';
- }
- switch ($transactionType->type) {
- case TransactionType::DEPOSIT:
- case TransactionType::WITHDRAWAL:
- // continue:
- $nativeCurrencyId = intval($accounts[$check]->getMeta('currency_id'));
-
- // does not match? Then user has submitted amount in a foreign currency:
- if ($nativeCurrencyId !== $submittedCurrencyId) {
- // store amount and submitted currency in "foreign currency" fields:
- $data['foreign_amount'] = $data['amount'];
- $data['foreign_currency_id'] = $submittedCurrencyId;
-
- // overrule the amount and currency ID fields to be the original again:
- $data['amount'] = strval($data['native_amount']);
- $data['currency_id'] = $nativeCurrencyId;
- }
- break;
- case TransactionType::TRANSFER:
- $sourceCurrencyId = intval($accounts['source']->getMeta('currency_id'));
- $destinationCurrencyId = intval($accounts['destination']->getMeta('currency_id'));
- $data['amount'] = strval($data['source_amount']);
- $data['currency_id'] = intval($accounts['source']->getMeta('currency_id'));
-
- if ($sourceCurrencyId !== $destinationCurrencyId) {
- // accounts have different id's, save this info:
- $data['foreign_amount'] = strval($data['destination_amount']);
- $data['foreign_currency_id'] = $destinationCurrencyId;
- }
-
- break;
- default:
- throw new FireflyException(sprintf('Cannot handle %s in verifyNativeAmount()', $transactionType->type));
- }
-
- return $data;
- }
}
diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php
index 028f2d52d7..a25ee4fa23 100644
--- a/app/Repositories/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/Journal/JournalRepositoryInterface.php
@@ -95,20 +95,4 @@ interface JournalRepositoryInterface
*/
public function store(array $data): TransactionJournal;
- /**
- * @param TransactionJournal $journal
- * @param array $data
- *
- * @return TransactionJournal
- */
- public function update(TransactionJournal $journal, array $data): TransactionJournal;
-
- /**
- * @param TransactionJournal $journal
- * @param array $data
- *
- * @return TransactionJournal
- */
- public function updateSplitJournal(TransactionJournal $journal, array $data): TransactionJournal;
-
}
diff --git a/app/Repositories/Journal/JournalSupport.php b/app/Repositories/Journal/JournalSupport.php
new file mode 100644
index 0000000000..cb930ccf18
--- /dev/null
+++ b/app/Repositories/Journal/JournalSupport.php
@@ -0,0 +1,361 @@
+ null,
+ 'destination' => null,
+ ];
+
+ Log::debug(sprintf('Going to store accounts for type %s', $type->type));
+ switch ($type->type) {
+ case TransactionType::WITHDRAWAL:
+ $accounts = self::storeWithdrawalAccounts($user, $data);
+ break;
+
+ case TransactionType::DEPOSIT:
+ $accounts = self::storeDepositAccounts($user, $data);
+
+ break;
+ case TransactionType::TRANSFER:
+ $accounts['source'] = Account::where('user_id', $user->id)->where('id', $data['source_account_id'])->first();
+ $accounts['destination'] = Account::where('user_id', $user->id)->where('id', $data['destination_account_id'])->first();
+ break;
+ default:
+ throw new FireflyException(sprintf('Did not recognise transaction type "%s".', $type->type));
+ }
+
+ if (is_null($accounts['source'])) {
+ Log::error('"source"-account is null, so we cannot continue!', ['data' => $data]);
+ throw new FireflyException('"source"-account is null, so we cannot continue!');
+ }
+
+ if (is_null($accounts['destination'])) {
+ Log::error('"destination"-account is null, so we cannot continue!', ['data' => $data]);
+ throw new FireflyException('"destination"-account is null, so we cannot continue!');
+
+ }
+
+
+ return $accounts;
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param int $budgetId
+ */
+ public static function storeBudgetWithJournal(TransactionJournal $journal, int $budgetId)
+ {
+ if (intval($budgetId) > 0 && $journal->transactionType->type === TransactionType::WITHDRAWAL) {
+ /** @var \FireflyIII\Models\Budget $budget */
+ $budget = Budget::find($budgetId);
+ $journal->budgets()->save($budget);
+ }
+ }
+
+ /**
+ * @param Transaction $transaction
+ * @param int $budgetId
+ */
+ public static function storeBudgetWithTransaction(Transaction $transaction, int $budgetId)
+ {
+ if (intval($budgetId) > 0 && $transaction->transactionJournal->transactionType->type !== TransactionType::TRANSFER) {
+ /** @var \FireflyIII\Models\Budget $budget */
+ $budget = Budget::find($budgetId);
+ $transaction->budgets()->save($budget);
+ }
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param string $category
+ */
+ public static function storeCategoryWithJournal(TransactionJournal $journal, string $category)
+ {
+ if (strlen($category) > 0) {
+ $category = Category::firstOrCreateEncrypted(['name' => $category, 'user_id' => $journal->user_id]);
+ $journal->categories()->save($category);
+ }
+ }
+
+ /**
+ * @param Transaction $transaction
+ * @param string $category
+ */
+ public static function storeCategoryWithTransaction(Transaction $transaction, string $category)
+ {
+ if (strlen($category) > 0) {
+ $category = Category::firstOrCreateEncrypted(['name' => $category, 'user_id' => $transaction->transactionJournal->user_id]);
+ $transaction->categories()->save($category);
+ }
+ }
+
+ /**
+ * @param User $user
+ * @param array $data
+ *
+ * @return array
+ */
+ public static function storeDepositAccounts(User $user, array $data): array
+ {
+ Log::debug('Now in storeDepositAccounts().');
+ $destinationAccount = Account::where('user_id', $user->id)->where('id', $data['destination_account_id'])->first(['accounts.*']);
+
+ Log::debug(sprintf('Destination account is #%d ("%s")', $destinationAccount->id, $destinationAccount->name));
+
+ if (strlen($data['source_account_name']) > 0) {
+ $sourceType = AccountType::where('type', 'Revenue account')->first();
+ $sourceAccount = Account::firstOrCreateEncrypted(
+ ['user_id' => $user->id, 'account_type_id' => $sourceType->id, 'name' => $data['source_account_name'], 'active' => 1]
+ );
+
+ Log::debug(sprintf('source account name is "%s", account is %d', $data['source_account_name'], $sourceAccount->id));
+
+ return [
+ 'source' => $sourceAccount,
+ 'destination' => $destinationAccount,
+ ];
+ }
+
+ Log::debug('source_account_name is empty, so default to cash account!');
+
+ $sourceType = AccountType::where('type', AccountType::CASH)->first();
+ $sourceAccount = Account::firstOrCreateEncrypted(
+ ['user_id' => $user->id, 'account_type_id' => $sourceType->id, 'name' => 'Cash account', 'active' => 1]
+ );
+
+ return [
+ 'source' => $sourceAccount,
+ 'destination' => $destinationAccount,
+ ];
+ }
+
+ /**
+ * @param User $user
+ * @param array $data
+ *
+ * @return array
+ */
+ public static function storeWithdrawalAccounts(User $user, array $data): array
+ {
+ Log::debug('Now in storeWithdrawalAccounts().');
+ $sourceAccount = Account::where('user_id', $user->id)->where('id', $data['source_account_id'])->first(['accounts.*']);
+
+ Log::debug(sprintf('Source account is #%d ("%s")', $sourceAccount->id, $sourceAccount->name));
+
+ if (strlen($data['destination_account_name']) > 0) {
+ $destinationType = AccountType::where('type', AccountType::EXPENSE)->first();
+ $destinationAccount = Account::firstOrCreateEncrypted(
+ [
+ 'user_id' => $user->id,
+ 'account_type_id' => $destinationType->id,
+ 'name' => $data['destination_account_name'],
+ 'active' => 1,
+ ]
+ );
+
+ Log::debug(sprintf('destination account name is "%s", account is %d', $data['destination_account_name'], $destinationAccount->id));
+
+ return [
+ 'source' => $sourceAccount,
+ 'destination' => $destinationAccount,
+ ];
+ }
+ Log::debug('destination_account_name is empty, so default to cash account!');
+ $destinationType = AccountType::where('type', AccountType::CASH)->first();
+ $destinationAccount = Account::firstOrCreateEncrypted(
+ ['user_id' => $user->id, 'account_type_id' => $destinationType->id, 'name' => 'Cash account', 'active' => 1]
+ );
+
+ return [
+ 'source' => $sourceAccount,
+ 'destination' => $destinationAccount,
+ ];
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param array $array
+ *
+ * @return bool
+ */
+ public static function updateTags(TransactionJournal $journal, array $array): bool
+ {
+ // create tag repository
+ /** @var TagRepositoryInterface $tagRepository */
+ $tagRepository = app(TagRepositoryInterface::class);
+
+
+ // find or create all tags:
+ $tags = [];
+ $ids = [];
+ foreach ($array as $name) {
+ if (strlen(trim($name)) > 0) {
+ $tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
+ $tags[] = $tag;
+ $ids[] = $tag->id;
+ }
+ }
+
+ // delete all tags connected to journal not in this array:
+ if (count($ids) > 0) {
+ DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete();
+ }
+ // if count is zero, delete them all:
+ if (count($ids) == 0) {
+ DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete();
+ }
+
+ // connect each tag to journal (if not yet connected):
+ /** @var Tag $tag */
+ foreach ($tags as $tag) {
+ Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));
+ $tagRepository->connect($journal, $tag);
+ }
+
+ return true;
+ }
+
+ /**
+ * This method checks the data array and the given accounts to verify that the native amount, currency
+ * and possible the foreign currency and amount are properly saved.
+ *
+ * @param array $data
+ * @param array $accounts
+ *
+ * @return array
+ * @throws FireflyException
+ */
+ public static function verifyNativeAmount(array $data, array $accounts): array
+ {
+ /** @var TransactionType $transactionType */
+ $transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
+ $submittedCurrencyId = $data['currency_id'];
+ $data['foreign_amount'] = null;
+ $data['foreign_currency_id'] = null;
+
+ // which account to check for what the native currency is?
+ $check = 'source';
+ if ($transactionType->type === TransactionType::DEPOSIT) {
+ $check = 'destination';
+ }
+ switch ($transactionType->type) {
+ case TransactionType::DEPOSIT:
+ case TransactionType::WITHDRAWAL:
+ // continue:
+ $nativeCurrencyId = intval($accounts[$check]->getMeta('currency_id'));
+
+ // does not match? Then user has submitted amount in a foreign currency:
+ if ($nativeCurrencyId !== $submittedCurrencyId) {
+ // store amount and submitted currency in "foreign currency" fields:
+ $data['foreign_amount'] = $data['amount'];
+ $data['foreign_currency_id'] = $submittedCurrencyId;
+
+ // overrule the amount and currency ID fields to be the original again:
+ $data['amount'] = strval($data['native_amount']);
+ $data['currency_id'] = $nativeCurrencyId;
+ }
+ break;
+ case TransactionType::TRANSFER:
+ $sourceCurrencyId = intval($accounts['source']->getMeta('currency_id'));
+ $destinationCurrencyId = intval($accounts['destination']->getMeta('currency_id'));
+ $data['amount'] = strval($data['source_amount']);
+ $data['currency_id'] = intval($accounts['source']->getMeta('currency_id'));
+
+ if ($sourceCurrencyId !== $destinationCurrencyId) {
+ // accounts have different id's, save this info:
+ $data['foreign_amount'] = strval($data['destination_amount']);
+ $data['foreign_currency_id'] = $destinationCurrencyId;
+ }
+
+ break;
+ default:
+ throw new FireflyException(sprintf('Cannot handle %s in verifyNativeAmount()', $transactionType->type));
+ }
+
+ return $data;
+ }
+
+ /**
+ * @param array $data
+ *
+ * @return Transaction
+ */
+ public static function storeTransaction(array $data): Transaction
+ {
+ $fields = [
+ 'transaction_journal_id' => $data['journal']->id,
+ 'account_id' => $data['account']->id,
+ 'amount' => $data['amount'],
+ 'foreign_amount' => $data['foreign_amount'],
+ 'transaction_currency_id' => $data['transaction_currency_id'],
+ 'foreign_currency_id' => $data['foreign_currency_id'],
+ 'description' => $data['description'],
+ 'identifier' => $data['identifier'],
+ ];
+
+
+ if (is_null($data['foreign_currency_id'])) {
+ unset($fields['foreign_currency_id']);
+ }
+ if (is_null($data['foreign_amount'])) {
+ unset($fields['foreign_amount']);
+ }
+
+ /** @var Transaction $transaction */
+ $transaction = Transaction::create($fields);
+
+ Log::debug(sprintf('Transaction stored with ID: %s', $transaction->id));
+
+ if (!is_null($data['category'])) {
+ $transaction->categories()->save($data['category']);
+ }
+
+ if (!is_null($data['budget'])) {
+ $transaction->categories()->save($data['budget']);
+ }
+
+ return $transaction;
+
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/Journal/JournalUpdate.php b/app/Repositories/Journal/JournalUpdate.php
new file mode 100644
index 0000000000..0be4ac53a5
--- /dev/null
+++ b/app/Repositories/Journal/JournalUpdate.php
@@ -0,0 +1,290 @@
+user = $user;
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param array $data
+ *
+ * @return TransactionJournal
+ */
+ public function update(TransactionJournal $journal, array $data): TransactionJournal
+ {
+
+ // update actual journal:
+ $journal->description = $data['description'];
+ $journal->date = $data['date'];
+ $accounts = JournalSupport::storeAccounts($this->user, $journal->transactionType, $data);
+ $data = JournalSupport::verifyNativeAmount($data, $accounts);
+ $data['amount'] = strval($data['amount']);
+ $data['foreign_amount'] = is_null($data['foreign_amount']) ? null : strval($data['foreign_amount']);
+
+ // unlink all categories, recreate them:
+ $journal->categories()->detach();
+ $journal->budgets()->detach();
+
+ JournalSupport::storeCategoryWithJournal($journal, $data['category']);
+ JournalSupport::storeBudgetWithJournal($journal, $data['budget_id']);
+
+ // negative because source loses money.
+ $this->updateSourceTransaction($journal, $accounts['source'], $data);
+
+ // positive because destination gets money.
+ $this->updateDestinationTransaction($journal, $accounts['destination'], $data);
+
+ $journal->save();
+
+ // update tags:
+ if (isset($data['tags']) && is_array($data['tags'])) {
+ JournalSupport::updateTags($journal, $data['tags']);
+ }
+
+ // update meta fields:
+ $result = $journal->save();
+ if ($result) {
+ foreach ($data as $key => $value) {
+ if (in_array($key, $this->validMetaFields)) {
+ $journal->setMeta($key, $value);
+ continue;
+ }
+ Log::debug(sprintf('Could not store meta field "%s" with value "%s" for journal #%d', json_encode($key), json_encode($value), $journal->id));
+ }
+
+ return $journal;
+ }
+
+ return $journal;
+ }
+
+ /**
+ * Same as above but for transaction journal with multiple transactions.
+ *
+ * @param TransactionJournal $journal
+ * @param array $data
+ *
+ * @return TransactionJournal
+ */
+ public function updateSplitJournal(TransactionJournal $journal, array $data): TransactionJournal
+ {
+ // update actual journal:
+ $journal->description = $data['journal_description'];
+ $journal->date = $data['date'];
+ $journal->save();
+ Log::debug(sprintf('Updated split journal #%d', $journal->id));
+
+ // unlink all categories:
+ $journal->categories()->detach();
+ $journal->budgets()->detach();
+
+ // update meta fields:
+ $result = $journal->save();
+ if ($result) {
+ foreach ($data as $key => $value) {
+ if (in_array($key, $this->validMetaFields)) {
+ $journal->setMeta($key, $value);
+ continue;
+ }
+ Log::debug(sprintf('Could not store meta field "%s" with value "%s" for journal #%d', json_encode($key), json_encode($value), $journal->id));
+ }
+ }
+
+
+ // update tags:
+ if (isset($data['tags']) && is_array($data['tags'])) {
+ JournalSupport::updateTags($journal, $data['tags']);
+ }
+
+ // delete original transactions, and recreate them.
+ $journal->transactions()->delete();
+
+ // store each transaction.
+ $identifier = 0;
+ Log::debug(sprintf('Count %d transactions in updateSplitJournal()', count($data['transactions'])));
+
+ foreach ($data['transactions'] as $transaction) {
+ Log::debug(sprintf('Split journal update split transaction %d', $identifier));
+ $transaction = $this->appendTransactionData($transaction, $data);
+ $this->storeSplitTransaction($journal, $transaction, $identifier);
+ $identifier++;
+ }
+
+ $journal->save();
+
+ return $journal;
+ }
+
+ /**
+ * When the user edits a split journal, each line is missing crucial data:
+ *
+ * - Withdrawal lines are missing the source account ID
+ * - Deposit lines are missing the destination account ID
+ * - Transfers are missing both.
+ *
+ * We need to append the array.
+ *
+ * @param array $transaction
+ * @param array $data
+ *
+ * @return array
+ */
+ private function appendTransactionData(array $transaction, array $data): array
+ {
+ switch ($data['what']) {
+ case strtolower(TransactionType::TRANSFER):
+ case strtolower(TransactionType::WITHDRAWAL):
+ $transaction['source_account_id'] = intval($data['journal_source_account_id']);
+ break;
+ }
+
+ switch ($data['what']) {
+ case strtolower(TransactionType::TRANSFER):
+ case strtolower(TransactionType::DEPOSIT):
+ $transaction['destination_account_id'] = intval($data['journal_destination_account_id']);
+ break;
+ }
+
+ return $transaction;
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param array $transaction
+ * @param int $identifier
+ *
+ * @return Collection
+ */
+ private function storeSplitTransaction(TransactionJournal $journal, array $transaction, int $identifier): Collection
+ {
+ // store source and destination accounts (depends on type)
+ $accounts = JournalSupport::storeAccounts($this->user, $journal->transactionType, $transaction);
+
+ // store transaction one way:
+ $amount = bcmul(strval($transaction['amount']), '-1');
+ $foreignAmount = is_null($transaction['foreign_amount']) ? null : bcmul(strval($transaction['foreign_amount']), '-1');
+ $one = JournalSupport::storeTransaction(
+ [
+ 'journal' => $journal,
+ 'account' => $accounts['source'],
+ 'amount' => $amount,
+ 'transaction_currency_id' => $transaction['transaction_currency_id'],
+ 'foreign_amount' => $foreignAmount,
+ 'foreign_currency_id' => $transaction['foreign_currency_id'],
+ 'description' => $transaction['description'],
+ 'category' => null,
+ 'budget' => null,
+ 'identifier' => $identifier,
+ ]
+ );
+ JournalSupport::storeCategoryWithTransaction($one, $transaction['category']);
+ JournalSupport::storeBudgetWithTransaction($one, $transaction['budget_id']);
+
+ // and the other way:
+ $amount = strval($transaction['amount']);
+ $foreignAmount = is_null($transaction['foreign_amount']) ? null : strval($transaction['foreign_amount']);
+ $two = JournalSupport::storeTransaction(
+ [
+ 'journal' => $journal,
+ 'account' => $accounts['destination'],
+ 'amount' => $amount,
+ 'transaction_currency_id' => $transaction['transaction_currency_id'],
+ 'foreign_amount' => $foreignAmount,
+ 'foreign_currency_id' => $transaction['foreign_currency_id'],
+ 'description' => $transaction['description'],
+ 'category' => null,
+ 'budget' => null,
+ 'identifier' => $identifier,
+ ]
+ );
+ JournalSupport::storeCategoryWithTransaction($two, $transaction['category']);
+ JournalSupport::storeBudgetWithTransaction($two, $transaction['budget_id']);
+
+ return new Collection([$one, $two]);
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param Account $account
+ * @param array $data
+ *
+ * @throws FireflyException
+ */
+ private function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data)
+ {
+ $set = $journal->transactions()->where('amount', '>', 0)->get();
+ if ($set->count() != 1) {
+ throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
+ }
+ /** @var Transaction $transaction */
+ $transaction = $set->first();
+ $transaction->amount = app('steam')->positive($data['amount']);
+ $transaction->transaction_currency_id = $data['currency_id'];
+ $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : app('steam')->positive($data['foreign_amount']);
+ $transaction->foreign_currency_id = $data['foreign_currency_id'];
+
+ $transaction->account_id = $account->id;
+ $transaction->save();
+
+ }
+
+ /**
+ * @param TransactionJournal $journal
+ * @param Account $account
+ * @param array $data
+ *
+ * @throws FireflyException
+ */
+ private function updateSourceTransaction(TransactionJournal $journal, Account $account, array $data)
+ {
+ // should be one:
+ $set = $journal->transactions()->where('amount', '<', 0)->get();
+ if ($set->count() != 1) {
+ throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
+ }
+ /** @var Transaction $transaction */
+ $transaction = $set->first();
+ $transaction->amount = bcmul(app('steam')->positive($data['amount']), '-1');
+ $transaction->transaction_currency_id = $data['currency_id'];
+ $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1');
+ $transaction->foreign_currency_id = $data['foreign_currency_id'];
+ $transaction->save();
+ }
+
+}
\ No newline at end of file
diff --git a/app/Repositories/Journal/JournalUpdateInterface.php b/app/Repositories/Journal/JournalUpdateInterface.php
new file mode 100644
index 0000000000..21f6f80c85
--- /dev/null
+++ b/app/Repositories/Journal/JournalUpdateInterface.php
@@ -0,0 +1,44 @@
+first();
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
+ $updater = $this->mock(JournalUpdateInterface::class);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $repository->shouldReceive('update')->once();
+ $updater->shouldReceive('update')->once();
$repository->shouldReceive('find')->once()->andReturn($deposit);
diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.php
index 56bd1041bf..b396a961db 100644
--- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php
@@ -23,6 +23,7 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
+use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
@@ -269,6 +270,7 @@ class SingleControllerTest extends TestCase
// mock
$this->expectsEvents(UpdatedTransactionJournal::class);
+ $updater = $this->mock(JournalUpdateInterface::class);
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = new TransactionJournal();
@@ -278,7 +280,7 @@ class SingleControllerTest extends TestCase
$journal->transactionType()->associate($type);
- $repository->shouldReceive('update')->andReturn($journal);
+ $updater->shouldReceive('update')->andReturn($journal);
$repository->shouldReceive('first')->times(2)->andReturn(new TransactionJournal);
$this->session(['transactions.edit.uri' => 'http://localhost']);
diff --git a/tests/Feature/Controllers/Transaction/SplitControllerTest.php b/tests/Feature/Controllers/Transaction/SplitControllerTest.php
index 578802bc8c..c6cf00eb07 100644
--- a/tests/Feature/Controllers/Transaction/SplitControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/SplitControllerTest.php
@@ -21,6 +21,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
+use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Tests\TestCase;
@@ -134,7 +135,8 @@ class SplitControllerTest extends TestCase
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
- $repository->shouldReceive('updateSplitJournal')->andReturn($deposit);
+ $updater = $this->mock(JournalUpdateInterface::class);
+ $updater->shouldReceive('updateSplitJournal')->andReturn($deposit);
$repository->shouldReceive('first')->times(2)->andReturn(new TransactionJournal);
$attachmentRepos = $this->mock(AttachmentHelperInterface::class);
$attachmentRepos->shouldReceive('saveAttachmentsForModel');
From c4039b53e66c3b000694bf324d3ae005ea5ec21d Mon Sep 17 00:00:00 2001
From: James Cole
Date: Mon, 5 Jun 2017 11:12:50 +0200
Subject: [PATCH 077/103] Various code cleanup.
---
app/Events/StoredTransactionJournal.php | 4 +-
app/Events/UpdatedTransactionJournal.php | 2 +-
.../Chart/Basic/ChartJsGenerator.php | 2 +-
app/Generator/Report/Support.php | 1 -
.../Events/UpdatedJournalEventHandler.php | 4 +-
app/Handlers/Events/UserEventHandler.php | 2 +
app/Helpers/Attachments/AttachmentHelper.php | 3 +-
app/Helpers/Collector/JournalCollector.php | 2 +-
app/Helpers/Filter/InternalTransferFilter.php | 2 +-
app/Http/Controllers/AccountController.php | 4 +-
.../Controllers/Chart/AccountController.php | 3 +-
.../Controllers/Chart/CategoryController.php | 14 +--
.../Chart/CategoryReportController.php | 1 -
.../Controllers/Chart/ReportController.php | 4 +-
app/Http/Controllers/JavascriptController.php | 8 +-
.../Controllers/Json/ExchangeController.php | 1 -
app/Http/Controllers/JsonController.php | 1 -
app/Http/Controllers/PiggyBankController.php | 15 ++--
.../Report/OperationsController.php | 3 -
.../Transaction/MassController.php | 1 -
.../Transaction/SingleController.php | 11 ++-
.../Transaction/SplitController.php | 10 +--
.../Controllers/TransactionController.php | 9 +-
app/Http/Requests/AccountFormRequest.php | 26 +++---
app/Http/breadcrumbs.php | 8 +-
app/Import/ImportStorage.php | 1 -
app/Import/ImportValidator.php | 2 -
app/Mail/RegisteredUser.php | 8 +-
app/Mail/RequestedNewPassword.php | 12 +--
app/Models/Transaction.php | 30 +++----
app/Models/TransactionJournal.php | 33 +++----
app/Providers/FireflyServiceProvider.php | 2 +-
app/Providers/JournalServiceProvider.php | 40 ++++-----
.../Account/AccountRepositoryInterface.php | 10 +--
.../Journal/JournalRepository.php | 1 -
app/Repositories/Journal/JournalSupport.php | 86 +++++++++----------
app/Repositories/Journal/JournalUpdate.php | 4 +-
.../PiggyBank/PiggyBankRepository.php | 4 +-
app/Support/Amount.php | 2 +-
.../Models/TransactionJournalTrait.php | 79 ++++++++++++++++-
app/Support/Twig/Transaction.php | 1 -
public/js/ff/budgets/show.js | 2 +-
public/js/ff/categories/show.js | 3 -
public/js/ff/charts.js | 1 -
public/js/ff/tags/show.js | 2 +
public/js/ff/transactions/single/common.js | 12 +--
public/js/ff/transactions/single/create.js | 8 +-
public/js/ff/transactions/single/edit.js | 3 +-
resources/views/emails/footer-html.twig | 2 +-
resources/views/emails/footer-text.twig | 2 +-
50 files changed, 274 insertions(+), 217 deletions(-)
diff --git a/app/Events/StoredTransactionJournal.php b/app/Events/StoredTransactionJournal.php
index d1d6805cd2..e67cfbe2cc 100644
--- a/app/Events/StoredTransactionJournal.php
+++ b/app/Events/StoredTransactionJournal.php
@@ -26,9 +26,9 @@ class StoredTransactionJournal extends Event
use SerializesModels;
- /** @var TransactionJournal */
+ /** @var TransactionJournal */
public $journal;
- /** @var int */
+ /** @var int */
public $piggyBankId;
/**
diff --git a/app/Events/UpdatedTransactionJournal.php b/app/Events/UpdatedTransactionJournal.php
index ce21810bc2..2390a13d75 100644
--- a/app/Events/UpdatedTransactionJournal.php
+++ b/app/Events/UpdatedTransactionJournal.php
@@ -26,7 +26,7 @@ class UpdatedTransactionJournal extends Event
use SerializesModels;
- /** @var TransactionJournal */
+ /** @var TransactionJournal */
public $journal;
/**
diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php
index b63f9e9c01..4649e0722d 100644
--- a/app/Generator/Chart/Basic/ChartJsGenerator.php
+++ b/app/Generator/Chart/Basic/ChartJsGenerator.php
@@ -112,7 +112,7 @@ class ChartJsGenerator implements GeneratorInterface
// sort by value, keep keys.
asort($data);
- $index = 0;
+ $index = 0;
foreach ($data as $key => $value) {
// make larger than 0
diff --git a/app/Generator/Report/Support.php b/app/Generator/Report/Support.php
index 563e72f12b..674b31f7d6 100644
--- a/app/Generator/Report/Support.php
+++ b/app/Generator/Report/Support.php
@@ -15,7 +15,6 @@ namespace FireflyIII\Generator\Report;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
-use Log;
/**
diff --git a/app/Handlers/Events/UpdatedJournalEventHandler.php b/app/Handlers/Events/UpdatedJournalEventHandler.php
index e4ea75a008..17303c9134 100644
--- a/app/Handlers/Events/UpdatedJournalEventHandler.php
+++ b/app/Handlers/Events/UpdatedJournalEventHandler.php
@@ -23,7 +23,7 @@ use FireflyIII\Support\Events\BillScanner;
/**
* @codeCoverageIgnore
- *
+ *
* Class UpdatedJournalEventHandler
*
* @package FireflyIII\Handlers\Events
@@ -54,7 +54,7 @@ class UpdatedJournalEventHandler
{
// get all the user's rule groups, with the rules, order by 'order'.
$journal = $updatedJournalEvent->journal;
- $groups = $this->repository->getActiveGroups($journal->user);
+ $groups = $this->repository->getActiveGroups($journal->user);
/** @var RuleGroup $group */
foreach ($groups as $group) {
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index 4b02a2a455..0259c403e5 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -74,6 +74,7 @@ class UserEventHandler
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
+
// @codeCoverageIgnoreEnd
return true;
@@ -106,6 +107,7 @@ class UserEventHandler
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
+
// @codeCoverageIgnoreEnd
return true;
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index 3189055bb2..58cf4da50e 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -20,7 +20,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Storage;
use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Log;
+
/**
* Class AttachmentHelper
*
@@ -202,6 +202,7 @@ class AttachmentHelper implements AttachmentHelperInterface
/**
* @codeCoverageIgnore
+ *
* @param UploadedFile $file
*
* @return bool
diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php
index fb19073685..2fbc389eab 100644
--- a/app/Helpers/Collector/JournalCollector.php
+++ b/app/Helpers/Collector/JournalCollector.php
@@ -499,7 +499,7 @@ class JournalCollector implements JournalCollectorInterface
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transactions.transaction_currency_id')
- ->leftJoin('transaction_currencies as foreign_currencies', 'foreign_currencies.id', 'transactions.foreign_currency_id')
+ ->leftJoin('transaction_currencies as foreign_currencies', 'foreign_currencies.id', 'transactions.foreign_currency_id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
diff --git a/app/Helpers/Filter/InternalTransferFilter.php b/app/Helpers/Filter/InternalTransferFilter.php
index 7e8d71588e..24b4b9727c 100644
--- a/app/Helpers/Filter/InternalTransferFilter.php
+++ b/app/Helpers/Filter/InternalTransferFilter.php
@@ -26,7 +26,7 @@ use Log;
*/
class InternalTransferFilter implements FilterInterface
{
- /** @var array */
+ /** @var array */
private $accounts = [];
/**
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 8e248a1628..362b2fd14b 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -293,8 +293,8 @@ class AccountController extends Controller
$periods = $this->getPeriodOverview($account);
}
- $count = 0;
- $loop = 0;
+ $count = 0;
+ $loop = 0;
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at loop start.');
while ($count === 0 && $loop < 3) {
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index 38bd1f3345..2a48a2876d 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -14,7 +14,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
-use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -336,7 +335,7 @@ class AccountController extends Controller
/**
* @param Account $account
- * @param Carbon $start
+ * @param Carbon $start
*
* @return \Illuminate\Http\JsonResponse
* @throws FireflyException
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index d330a9b363..e4301ee034 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -277,10 +277,10 @@ class CategoryController extends Controller
*/
public function specificPeriod(CategoryRepositoryInterface $repository, Category $category, Carbon $date)
{
- $range = Preferences::get('viewRange', '1M')->data;
- $start = Navigation::startOfPeriod($date, $range);
- $end = Navigation::endOfPeriod($date, $range);
- $data = $this->makePeriodChart($repository, $category, $start, $end);
+ $range = Preferences::get('viewRange', '1M')->data;
+ $start = Navigation::startOfPeriod($date, $range);
+ $end = Navigation::endOfPeriod($date, $range);
+ $data = $this->makePeriodChart($repository, $category, $start, $end);
return Response::json($data);
}
@@ -336,9 +336,9 @@ class CategoryController extends Controller
$sum = bcadd($spent, $earned);
$label = trim(Navigation::periodShow($start, '1D'));
- $chartData[0]['entries'][$label] = round(bcmul($spent, '-1'),12);
- $chartData[1]['entries'][$label] = round($earned,12);
- $chartData[2]['entries'][$label] = round($sum,12);
+ $chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 12);
+ $chartData[1]['entries'][$label] = round($earned, 12);
+ $chartData[2]['entries'][$label] = round($sum, 12);
$start->addDay();
diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php
index 572a8a3432..653996cf5d 100644
--- a/app/Http/Controllers/Chart/CategoryReportController.php
+++ b/app/Http/Controllers/Chart/CategoryReportController.php
@@ -16,7 +16,6 @@ namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
-use FireflyIII\Generator\Report\Category\MonthReportGenerator;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\NegativeAmountFilter;
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 1452192fe3..3310a0b64b 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -104,7 +104,7 @@ class ReportController extends Controller
$cache->addProperty($accounts);
$cache->addProperty($end);
if ($cache->has()) {
- //return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get()); // @codeCoverageIgnore
}
Log::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
$format = Navigation::preferredCarbonLocalizedFormat($start, $end);
@@ -250,7 +250,7 @@ class ReportController extends Controller
$cache->addProperty($accounts);
$cache->addProperty($end);
if ($cache->has()) {
- // return $cache->get(); // @codeCoverageIgnore
+ return $cache->get(); // @codeCoverageIgnore
}
$currentStart = clone $start;
diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php
index e5e7fb0651..1ad10422c2 100644
--- a/app/Http/Controllers/JavascriptController.php
+++ b/app/Http/Controllers/JavascriptController.php
@@ -34,7 +34,7 @@ class JavascriptController extends Controller
* @param AccountRepositoryInterface $repository
* @param CurrencyRepositoryInterface $currencyRepository
*
- * @return $this
+ * @return \Illuminate\Http\Response
*/
public function accounts(AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)
{
@@ -63,7 +63,7 @@ class JavascriptController extends Controller
/**
* @param CurrencyRepositoryInterface $repository
*
- * @return $this
+ * @return \Illuminate\Http\Response
*/
public function currencies(CurrencyRepositoryInterface $repository)
{
@@ -71,8 +71,8 @@ class JavascriptController extends Controller
$data = ['currencies' => [],];
/** @var TransactionCurrency $currency */
foreach ($currencies as $currency) {
- $currencyId = $currency->id;
- $entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
+ $currencyId = $currency->id;
+ $entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$data['currencies'][$currencyId] = $entry;
}
diff --git a/app/Http/Controllers/Json/ExchangeController.php b/app/Http/Controllers/Json/ExchangeController.php
index e96cae05e8..79f88acf2c 100644
--- a/app/Http/Controllers/Json/ExchangeController.php
+++ b/app/Http/Controllers/Json/ExchangeController.php
@@ -41,7 +41,6 @@ class ExchangeController extends Controller
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
$rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date);
- $amount = null;
if (is_null($rate->id)) {
Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
$preferred = env('EXCHANGE_RATE_SERVICE', config('firefly.preferred_exchange_service'));
diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php
index 0313f57040..e86536bc7b 100644
--- a/app/Http/Controllers/JsonController.php
+++ b/app/Http/Controllers/JsonController.php
@@ -20,7 +20,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
-use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php
index 564ee720ae..f4dc60cee9 100644
--- a/app/Http/Controllers/PiggyBankController.php
+++ b/app/Http/Controllers/PiggyBankController.php
@@ -296,8 +296,8 @@ class PiggyBankController extends Controller
Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.');
Session::flash(
'error', strval(
- trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)])
- )
+ trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)])
+ )
);
return redirect(route('piggy-banks.index'));
@@ -312,12 +312,13 @@ class PiggyBankController extends Controller
*/
public function postRemove(Request $request, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
- $amount = $request->get('amount');
+ $amount = $request->get('amount');
$currency = Amount::getDefaultCurrency();
if ($repository->canRemoveAmount($piggyBank, $amount)) {
$repository->removeAmount($piggyBank, $amount);
Session::flash(
- 'success', strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => $piggyBank->name]))
+ 'success',
+ strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => $piggyBank->name]))
);
Preferences::mark();
@@ -326,7 +327,11 @@ class PiggyBankController extends Controller
$amount = strval(round($request->get('amount'), 12));
- Session::flash('error', strval(trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)])));
+ Session::flash(
+ 'error', strval(
+ 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/Report/OperationsController.php b/app/Http/Controllers/Report/OperationsController.php
index 5081ba6554..59643b578d 100644
--- a/app/Http/Controllers/Report/OperationsController.php
+++ b/app/Http/Controllers/Report/OperationsController.php
@@ -15,10 +15,7 @@ namespace FireflyIII\Http\Controllers\Report;
use Carbon\Carbon;
-use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Http\Controllers\Controller;
-use FireflyIII\Models\Transaction;
-use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php
index 0551bfafe8..61d2a0fa43 100644
--- a/app/Http/Controllers/Transaction/MassController.php
+++ b/app/Http/Controllers/Transaction/MassController.php
@@ -246,7 +246,6 @@ class MassController extends Controller
'currency_id' => $foreignCurrencyId,
'foreign_amount' => $foreignAmount,
'destination_amount' => $foreignAmount,
- //'foreign_currency_id' => $foreignCurrencyId,
'category' => $category,
'tags' => $tags,
];
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index bdd4de6a21..67e2c7cb19 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -273,7 +273,7 @@ class SingleController extends Controller
];
// amounts for withdrawals and deposits:
- // (amount, native_amount, source_amount, destination_amount)
+ // amount, native_amount, source_amount, destination_amount
if (($journal->isWithdrawal() || $journal->isDeposit()) && !is_null($pTransaction->foreign_amount)) {
$preFilled['amount'] = $pTransaction->foreign_amount;
$preFilled['currency'] = $pTransaction->foreignCurrency;
@@ -365,14 +365,13 @@ class SingleController extends Controller
}
/**
- * @param JournalFormRequest $request
- * @param JournalRepositoryInterface $repository
- * @param JournalUpdateInterface $updater
- * @param TransactionJournal $journal
+ * @param JournalFormRequest $request
+ * @param JournalUpdateInterface $updater
+ * @param TransactionJournal $journal
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
- public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, JournalUpdateInterface $updater, TransactionJournal $journal)
+ public function update(JournalFormRequest $request, JournalUpdateInterface $updater, TransactionJournal $journal)
{
// @codeCoverageIgnoreStart
if ($this->isOpeningBalance($journal)) {
diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php
index 2514574fe1..fa899d6bff 100644
--- a/app/Http/Controllers/Transaction/SplitController.php
+++ b/app/Http/Controllers/Transaction/SplitController.php
@@ -23,7 +23,6 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
-use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use FireflyIII\Repositories\Journal\JournalUpdateInterface;
use Illuminate\Http\Request;
@@ -123,14 +122,13 @@ class SplitController extends Controller
/**
- * @param Request $request
- * @param JournalRepositoryInterface $repository
- * @param JournalUpdateInterface $updater
- * @param TransactionJournal $journal
+ * @param Request $request
+ * @param JournalUpdateInterface $updater
+ * @param TransactionJournal $journal
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
- public function update(Request $request, JournalRepositoryInterface $repository, JournalUpdateInterface $updater, TransactionJournal $journal)
+ public function update(Request $request, JournalUpdateInterface $updater, TransactionJournal $journal)
{
if ($this->isOpeningBalance($journal)) {
return $this->redirectToAccount($journal);
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 5f6f12de2e..2ac6a55db8 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -18,7 +18,6 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Models\TransactionJournal;
-use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use FireflyIII\Support\CacheProperties;
@@ -179,10 +178,10 @@ class TransactionController extends Controller
return $this->redirectToAccount($journal);
}
- $events = $tasker->getPiggyBankEvents($journal);
- $transactions = $tasker->getTransactionsOverview($journal);
- $what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
- $subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
+ $events = $tasker->getPiggyBankEvents($journal);
+ $transactions = $tasker->getTransactionsOverview($journal);
+ $what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
+ $subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions'));
diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php
index 90b8eb760d..bf24b65418 100644
--- a/app/Http/Requests/AccountFormRequest.php
+++ b/app/Http/Requests/AccountFormRequest.php
@@ -38,19 +38,19 @@ class AccountFormRequest extends Request
public function getAccountData(): array
{
return [
- 'name' => $this->string('name'),
- 'active' => $this->boolean('active'),
- 'accountType' => $this->string('what'),
- 'currency_id' => $this->integer('currency_id'),
- 'virtualBalance' => $this->float('virtualBalance'),
- 'iban' => $this->string('iban'),
- 'BIC' => $this->string('BIC'),
- 'accountNumber' => $this->string('accountNumber'),
- 'accountRole' => $this->string('accountRole'),
- 'openingBalance' => $this->float('openingBalance'),
- 'openingBalanceDate' => $this->date('openingBalanceDate'),
- 'ccType' => $this->string('ccType'),
- 'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'),
+ 'name' => $this->string('name'),
+ 'active' => $this->boolean('active'),
+ 'accountType' => $this->string('what'),
+ 'currency_id' => $this->integer('currency_id'),
+ 'virtualBalance' => $this->float('virtualBalance'),
+ 'iban' => $this->string('iban'),
+ 'BIC' => $this->string('BIC'),
+ 'accountNumber' => $this->string('accountNumber'),
+ 'accountRole' => $this->string('accountRole'),
+ 'openingBalance' => $this->float('openingBalance'),
+ 'openingBalanceDate' => $this->date('openingBalanceDate'),
+ 'ccType' => $this->string('ccType'),
+ 'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'),
];
}
diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php
index 1b98afd9b4..5668c16162 100644
--- a/app/Http/breadcrumbs.php
+++ b/app/Http/breadcrumbs.php
@@ -81,7 +81,7 @@ Breadcrumbs::register(
if ($moment !== 'all') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end]));
}
@@ -726,16 +726,16 @@ Breadcrumbs::register(
Breadcrumbs::register(
'tags.show', function (BreadCrumbGenerator $breadcrumbs, Tag $tag, string $moment, Carbon $start, Carbon $end) {
$breadcrumbs->parent('tags.index');
- $breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id], $moment));
+ $breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id, $moment]));
if ($moment === 'all') {
- $breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id], $moment));
+ $breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id, $moment]));
}
if ($moment !== 'all') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
- $breadcrumbs->push($title, route('tags.show', [$tag->id], $moment));
+ $breadcrumbs->push($title, route('tags.show', [$tag->id, $moment]));
}
}
);
diff --git a/app/Import/ImportStorage.php b/app/Import/ImportStorage.php
index 4f39086965..2d5524fcec 100644
--- a/app/Import/ImportStorage.php
+++ b/app/Import/ImportStorage.php
@@ -291,7 +291,6 @@ class ImportStorage
'user_id' => $entry->user->id,
'transaction_type_id' => $entry->fields['transaction-type']->id,
'bill_id' => $billId,
- // TODO update this transaction currency reference.
'transaction_currency_id' => $entry->fields['currency']->id,
'description' => $entry->fields['description'],
'date' => $entry->fields['date-transaction'],
diff --git a/app/Import/ImportValidator.php b/app/Import/ImportValidator.php
index fd9981ec47..3a3a373b2b 100644
--- a/app/Import/ImportValidator.php
+++ b/app/Import/ImportValidator.php
@@ -74,7 +74,6 @@ class ImportValidator
$entry = $this->setOpposingAccount($entry);
$entry = $this->cleanDescription($entry);
$entry = $this->setTransactionType($entry);
- // TODO update this transaction currency reference.
$entry = $this->setTransactionCurrency($entry);
$newCollection->put($index, $entry);
@@ -384,7 +383,6 @@ class ImportValidator
*/
private function setTransactionCurrency(ImportEntry $entry): ImportEntry
{
- // TODO update this transaction currency reference.
if (is_null($entry->fields['currency'])) {
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
diff --git a/app/Mail/RegisteredUser.php b/app/Mail/RegisteredUser.php
index 924aa883de..a693fb13e1 100644
--- a/app/Mail/RegisteredUser.php
+++ b/app/Mail/RegisteredUser.php
@@ -12,18 +12,18 @@ class RegisteredUser extends Mailable
/** @var string */
public $address;
/** @var string */
- public $ip;
+ public $userIp;
/**
* Create a new message instance.
*
* @param string $address
- * @param string $ip
+ * @param string $userIp
*/
- public function __construct(string $address, string $ip)
+ public function __construct(string $address, string $userIp)
{
$this->address = $address;
- $this->ip = $ip;
+ $this->userIp = $userIp;
}
/**
diff --git a/app/Mail/RequestedNewPassword.php b/app/Mail/RequestedNewPassword.php
index b97a47c50f..cdda5b9858 100644
--- a/app/Mail/RequestedNewPassword.php
+++ b/app/Mail/RequestedNewPassword.php
@@ -10,20 +10,20 @@ class RequestedNewPassword extends Mailable
{
use Queueable, SerializesModels;
/** @var string */
- public $ip;
- /** @var string */
public $url;
+ /** @var string */
+ public $userIp;
/**
* RequestedNewPassword constructor.
*
* @param string $url
- * @param string $ip
+ * @param string $userIp
*/
- public function __construct(string $url, string $ip)
+ public function __construct(string $url, string $userIp)
{
- $this->url = $url;
- $this->ip = $ip;
+ $this->url = $url;
+ $this->userIp = $userIp;
}
/**
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 0e9ade0b30..c9b139d485 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -32,7 +32,7 @@ class Transaction extends Model
* @var array
*/
protected $casts
- = [
+ = [
'created_at' => 'date',
'updated_at' => 'date',
'deleted_at' => 'date',
@@ -40,18 +40,18 @@ class Transaction extends Model
'encrypted' => 'boolean', // model does not have these fields though
'bill_name_encrypted' => 'boolean',
];
- protected $dates = ['created_at', 'updated_at', 'deleted_at'];
- protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id','foreign_amount'];
- protected $hidden = ['encrypted'];
+ protected $dates = ['created_at', 'updated_at', 'deleted_at'];
+ protected $fillable
+ = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',
+ 'foreign_amount'];
+ protected $hidden = ['encrypted'];
protected $rules
- = [
+ = [
'account_id' => 'required|exists:accounts,id',
'transaction_journal_id' => 'required|exists:transaction_journals,id',
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
- //'foreign_currency_id' => 'exists:transaction_currencies,id',
'description' => 'between:0,1024',
'amount' => 'required|numeric',
- //'foreign_amount' => 'numeric',
];
/**
@@ -101,6 +101,14 @@ class Transaction extends Model
return $this->belongsToMany('FireflyIII\Models\Category');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
+ public function foreignCurrency()
+ {
+ return $this->belongsTo('FireflyIII\Models\TransactionCurrency', 'foreign_currency_id');
+ }
+
/**
* @param $value
*
@@ -171,14 +179,6 @@ class Transaction extends Model
return $this->belongsTo('FireflyIII\Models\TransactionCurrency');
}
- /**
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
- */
- public function foreignCurrency()
- {
- return $this->belongsTo('FireflyIII\Models\TransactionCurrency','foreign_currency_id');
- }
-
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index cc0c00ef45..bfb4de8bdc 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -19,6 +19,7 @@ use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Models\TransactionJournalTrait;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Log;
@@ -66,12 +67,12 @@ class TransactionJournal extends Model
/** @var array */
protected $rules
= [
- 'user_id' => 'required|exists:users,id',
- 'transaction_type_id' => 'required|exists:transaction_types,id',
- 'description' => 'required|between:1,1024',
- 'completed' => 'required|boolean',
- 'date' => 'required|date',
- 'encrypted' => 'required|boolean',
+ 'user_id' => 'required|exists:users,id',
+ 'transaction_type_id' => 'required|exists:transaction_types,id',
+ 'description' => 'required|between:1,1024',
+ 'completed' => 'required|boolean',
+ 'date' => 'required|date',
+ 'encrypted' => 'required|boolean',
];
/**
@@ -114,7 +115,7 @@ class TransactionJournal extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
- public function budgets()
+ public function budgets(): BelongsToMany
{
return $this->belongsToMany('FireflyIII\Models\Budget');
}
@@ -122,7 +123,7 @@ class TransactionJournal extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
- public function categories()
+ public function categories(): BelongsToMany
{
return $this->belongsToMany('FireflyIII\Models\Category');
}
@@ -203,7 +204,7 @@ class TransactionJournal extends Model
/**
* @return bool
*/
- public function isDeposit()
+ public function isDeposit(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::DEPOSIT;
@@ -216,7 +217,7 @@ class TransactionJournal extends Model
*
* @return bool
*/
- public function isOpeningBalance()
+ public function isOpeningBalance(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::OPENING_BALANCE;
@@ -229,7 +230,7 @@ class TransactionJournal extends Model
*
* @return bool
*/
- public function isTransfer()
+ public function isTransfer(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::TRANSFER;
@@ -242,7 +243,7 @@ class TransactionJournal extends Model
*
* @return bool
*/
- public function isWithdrawal()
+ public function isWithdrawal(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::WITHDRAWAL;
@@ -254,7 +255,7 @@ class TransactionJournal extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
- public function piggyBankEvents()
+ public function piggyBankEvents(): HasMany
{
return $this->hasMany('FireflyIII\Models\PiggyBankEvent');
}
@@ -266,7 +267,7 @@ class TransactionJournal extends Model
*
* @return bool
*/
- public function save(array $options = [])
+ public function save(array $options = []): bool
{
$count = $this->tags()->count();
$this->tag_count = $count;
@@ -404,9 +405,9 @@ class TransactionJournal extends Model
}
/**
- * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ * @return HasMany
*/
- public function transactions()
+ public function transactions(): HasMany
{
return $this->hasMany('FireflyIII\Models\Transaction');
}
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index c9740f4bcf..f9d3ea1976 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -52,11 +52,11 @@ use FireflyIII\Support\Twig\Rule;
use FireflyIII\Support\Twig\Transaction;
use FireflyIII\Support\Twig\Translation;
use FireflyIII\Validation\FireflyValidator;
+use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Twig;
use TwigBridge\Extension\Loader\Functions;
use Validator;
-use Illuminate\Foundation\Application;
/**
* Class FireflyServiceProvider
diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php
index 7c65845e93..7fcabbe606 100644
--- a/app/Providers/JournalServiceProvider.php
+++ b/app/Providers/JournalServiceProvider.php
@@ -95,26 +95,6 @@ class JournalServiceProvider extends ServiceProvider
);
}
- /**
- *
- */
- private function registerUpdater()
- {
- $this->app->bind(
- JournalUpdateInterface::class,
- function (Application $app) {
- /** @var JournalUpdateInterface $tasker */
- $update = app(JournalUpdate::class);
-
- if ($app->auth->check()) {
- $update->setUser(auth()->user());
- }
-
- return $update;
- }
- );
- }
-
/**
*
*/
@@ -134,4 +114,24 @@ class JournalServiceProvider extends ServiceProvider
}
);
}
+
+ /**
+ *
+ */
+ private function registerUpdater()
+ {
+ $this->app->bind(
+ JournalUpdateInterface::class,
+ function (Application $app) {
+ /** @var JournalUpdateInterface $tasker */
+ $update = app(JournalUpdate::class);
+
+ if ($app->auth->check()) {
+ $update->setUser(auth()->user());
+ }
+
+ return $update;
+ }
+ );
+ }
}
diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php
index e444fcada0..a9e04b03d6 100644
--- a/app/Repositories/Account/AccountRepositoryInterface.php
+++ b/app/Repositories/Account/AccountRepositoryInterface.php
@@ -36,11 +36,6 @@ interface AccountRepositoryInterface
*/
public function count(array $types): int;
- /**
- * @return Account
- */
- public function getCashAccount(): Account;
-
/**
* Moved here from account CRUD.
*
@@ -103,6 +98,11 @@ interface AccountRepositoryInterface
*/
public function getActiveAccountsByType(array $types): Collection;
+ /**
+ * @return Account
+ */
+ public function getCashAccount(): Account;
+
/**
* Returns the date of the very last transaction in this account.
*
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 85746ec174..d8402430a1 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -15,7 +15,6 @@ namespace FireflyIII\Repositories\Journal;
use FireflyIII\Models\Account;
use FireflyIII\Models\Tag;
-use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
diff --git a/app/Repositories/Journal/JournalSupport.php b/app/Repositories/Journal/JournalSupport.php
index cb930ccf18..1c77c44124 100644
--- a/app/Repositories/Journal/JournalSupport.php
+++ b/app/Repositories/Journal/JournalSupport.php
@@ -170,6 +170,49 @@ class JournalSupport
];
}
+ /**
+ * @param array $data
+ *
+ * @return Transaction
+ */
+ public static function storeTransaction(array $data): Transaction
+ {
+ $fields = [
+ 'transaction_journal_id' => $data['journal']->id,
+ 'account_id' => $data['account']->id,
+ 'amount' => $data['amount'],
+ 'foreign_amount' => $data['foreign_amount'],
+ 'transaction_currency_id' => $data['transaction_currency_id'],
+ 'foreign_currency_id' => $data['foreign_currency_id'],
+ 'description' => $data['description'],
+ 'identifier' => $data['identifier'],
+ ];
+
+
+ if (is_null($data['foreign_currency_id'])) {
+ unset($fields['foreign_currency_id']);
+ }
+ if (is_null($data['foreign_amount'])) {
+ unset($fields['foreign_amount']);
+ }
+
+ /** @var Transaction $transaction */
+ $transaction = Transaction::create($fields);
+
+ Log::debug(sprintf('Transaction stored with ID: %s', $transaction->id));
+
+ if (!is_null($data['category'])) {
+ $transaction->categories()->save($data['category']);
+ }
+
+ if (!is_null($data['budget'])) {
+ $transaction->categories()->save($data['budget']);
+ }
+
+ return $transaction;
+
+ }
+
/**
* @param User $user
* @param array $data
@@ -315,47 +358,4 @@ class JournalSupport
return $data;
}
-
- /**
- * @param array $data
- *
- * @return Transaction
- */
- public static function storeTransaction(array $data): Transaction
- {
- $fields = [
- 'transaction_journal_id' => $data['journal']->id,
- 'account_id' => $data['account']->id,
- 'amount' => $data['amount'],
- 'foreign_amount' => $data['foreign_amount'],
- 'transaction_currency_id' => $data['transaction_currency_id'],
- 'foreign_currency_id' => $data['foreign_currency_id'],
- 'description' => $data['description'],
- 'identifier' => $data['identifier'],
- ];
-
-
- if (is_null($data['foreign_currency_id'])) {
- unset($fields['foreign_currency_id']);
- }
- if (is_null($data['foreign_amount'])) {
- unset($fields['foreign_amount']);
- }
-
- /** @var Transaction $transaction */
- $transaction = Transaction::create($fields);
-
- Log::debug(sprintf('Transaction stored with ID: %s', $transaction->id));
-
- if (!is_null($data['category'])) {
- $transaction->categories()->save($data['category']);
- }
-
- if (!is_null($data['budget'])) {
- $transaction->categories()->save($data['budget']);
- }
-
- return $transaction;
-
- }
}
\ No newline at end of file
diff --git a/app/Repositories/Journal/JournalUpdate.php b/app/Repositories/Journal/JournalUpdate.php
index 0be4ac53a5..ff438369a2 100644
--- a/app/Repositories/Journal/JournalUpdate.php
+++ b/app/Repositories/Journal/JournalUpdate.php
@@ -258,8 +258,7 @@ class JournalUpdate implements JournalUpdateInterface
$transaction->transaction_currency_id = $data['currency_id'];
$transaction->foreign_amount = is_null($data['foreign_amount']) ? null : app('steam')->positive($data['foreign_amount']);
$transaction->foreign_currency_id = $data['foreign_currency_id'];
-
- $transaction->account_id = $account->id;
+ $transaction->account_id = $account->id;
$transaction->save();
}
@@ -284,6 +283,7 @@ class JournalUpdate implements JournalUpdateInterface
$transaction->transaction_currency_id = $data['currency_id'];
$transaction->foreign_amount = is_null($data['foreign_amount']) ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1');
$transaction->foreign_currency_id = $data['foreign_currency_id'];
+ $transaction->account_id = $account->id;
$transaction->save();
}
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index b5807a51f9..6c05daa897 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -241,11 +241,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
public function getPiggyBanksWithAmount(): Collection
{
$currency = Amount::getDefaultCurrency();
- $set = $this->getPiggyBanks();
+ $set = $this->getPiggyBanks();
foreach ($set as $piggy) {
$currentAmount = $piggy->currentRelevantRep()->currentamount ?? '0';
- $piggy->name = $piggy->name . ' (' . Amount::formatAnything($currency, $currentAmount, false) . ')';
+ $piggy->name = $piggy->name . ' (' . Amount::formatAnything($currency, $currentAmount, false) . ')';
}
return $set;
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index c75630d0ab..d90a1a2de4 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -292,7 +292,7 @@ class Amount
}
if ($transaction->transaction_type_type === TransactionType::TRANSFER) {
- $amount = app('steam')->positive($amount);
+ $amount = app('steam')->positive($amount);
$coloured = false;
$format = '%s';
}
diff --git a/app/Support/Models/TransactionJournalTrait.php b/app/Support/Models/TransactionJournalTrait.php
index 0961fafbb4..847ead3232 100644
--- a/app/Support/Models/TransactionJournalTrait.php
+++ b/app/Support/Models/TransactionJournalTrait.php
@@ -15,16 +15,21 @@ namespace FireflyIII\Support\Models;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Transaction;
+use FireflyIII\Models\TransactionJournalMeta;
+use FireflyIII\Rules\Triggers\TransactionType;
use FireflyIII\Support\CacheProperties;
use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
+use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
/**
* Class TransactionJournalTrait
*
- * @property int $id
- * @method Collection transactions()
- * @method bool isWithdrawal()
+ * @property int $id
+ * @property Carbon $date
+ * @property string $transaction_type_type
+ * @property TransactionType $transactionType
*
* @package FireflyIII\Support\Models
*/
@@ -91,6 +96,16 @@ trait TransactionJournalTrait
return 0;
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
+ abstract public function budgets(): BelongsToMany;
+
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
+ abstract public function categories(): BelongsToMany;
+
/**
* @return string
*/
@@ -180,6 +195,19 @@ trait TransactionJournalTrait
return $list;
}
+ /**
+ *
+ * @param string $name
+ *
+ * @return string
+ */
+ abstract public function getMeta(string $name);
+
+ /**
+ * @return bool
+ */
+ abstract public function isDeposit(): bool;
+
/**
* @param Builder $query
* @param string $table
@@ -201,6 +229,29 @@ trait TransactionJournalTrait
return false;
}
+ /**
+ *
+ * @return bool
+ */
+ abstract public function isOpeningBalance(): bool;
+
+ /**
+ *
+ * @return bool
+ */
+ abstract public function isTransfer(): bool;
+
+ /**
+ *
+ * @return bool
+ */
+ abstract public function isWithdrawal(): bool;
+
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ abstract public function piggyBankEvents(): HasMany;
+
/**
* @return int
*/
@@ -221,6 +272,23 @@ trait TransactionJournalTrait
return $this->transactions()->where('amount', '>', 0)->first();
}
+ /**
+ * Save the model to the database.
+ *
+ * @param array $options
+ *
+ * @return bool
+ */
+ abstract public function save(array $options = []): bool;
+
+ /**
+ * @param string $name
+ * @param $value
+ *
+ * @return TransactionJournalMeta
+ */
+ abstract public function setMeta(string $name, $value): TransactionJournalMeta;
+
/**
* @return Collection
*/
@@ -281,4 +349,9 @@ trait TransactionJournalTrait
return $typeStr;
}
+
+ /**
+ * @return HasMany
+ */
+ abstract public function transactions(): HasMany;
}
diff --git a/app/Support/Twig/Transaction.php b/app/Support/Twig/Transaction.php
index a8d97c97f8..3774940216 100644
--- a/app/Support/Twig/Transaction.php
+++ b/app/Support/Twig/Transaction.php
@@ -13,7 +13,6 @@ declare(strict_types=1);
namespace FireflyIII\Support\Twig;
-use Amount;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction as TransactionModel;
use FireflyIII\Models\TransactionType;
diff --git a/public/js/ff/budgets/show.js b/public/js/ff/budgets/show.js
index 9d276150df..1852c5b6cd 100644
--- a/public/js/ff/budgets/show.js
+++ b/public/js/ff/budgets/show.js
@@ -8,7 +8,7 @@
* See the LICENSE file for details.
*/
-/** global: budgetChartUri,budgetLimitID */
+/** global: budgetChartUri, expenseCategoryUri, expenseAssetUri, expenseExpenseUri */
$(function () {
"use strict";
diff --git a/public/js/ff/categories/show.js b/public/js/ff/categories/show.js
index 9efadd8828..ed564154d9 100644
--- a/public/js/ff/categories/show.js
+++ b/public/js/ff/categories/show.js
@@ -13,10 +13,7 @@
$(function () {
"use strict";
- console.log('Getting charts');
columnChart(everything, 'category-everything');
-
- console.log('Specific: ' + specific);
columnChart(specific, 'specific-period');
});
\ No newline at end of file
diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js
index fa0c8f049a..5e5bf17ce0 100644
--- a/public/js/ff/charts.js
+++ b/public/js/ff/charts.js
@@ -186,7 +186,6 @@ function doubleYNonStackedChart(URI, container) {
*/
function columnChart(URI, container) {
"use strict";
- console.log('Going to draw column chart for ' + URI + ' in ' + container);
var colorData = true;
var options = $.extend(true, {}, defaultChartOptions);
var chartType = 'bar';
diff --git a/public/js/ff/tags/show.js b/public/js/ff/tags/show.js
index e7142191a9..0cf25a8a26 100644
--- a/public/js/ff/tags/show.js
+++ b/public/js/ff/tags/show.js
@@ -6,6 +6,8 @@
* See the LICENSE file for details.
*/
+/** global: zoomLevel, latitude, longitude, google, doPlaceMarker */
+
/*
Some vars as prep for the map:
*/
diff --git a/public/js/ff/transactions/single/common.js b/public/js/ff/transactions/single/common.js
index 0fd23dd6ac..d164754235 100644
--- a/public/js/ff/transactions/single/common.js
+++ b/public/js/ff/transactions/single/common.js
@@ -6,6 +6,8 @@
* See the LICENSE file for details.
*/
+/** global: Modernizr, accountInfo, currencyInfo, accountInfo, transferInstructions, what */
+
$(document).ready(function () {
"use strict";
setCommonAutocomplete();
@@ -73,7 +75,6 @@ function selectsForeignCurrency() {
var nativeCurrencyId = parseInt(accountInfo[selectedAccountId].preferredCurrency);
if (foreignCurrencyId !== nativeCurrencyId) {
- console.log('User has selected currency #' + foreignCurrencyId + ' and this is different from native currency #' + nativeCurrencyId);
// the input where the native amount is entered gets the symbol for the native currency:
$('.non-selectable-currency-symbol').text(currencyInfo[nativeCurrencyId].symbol);
@@ -90,7 +91,6 @@ function selectsForeignCurrency() {
}
if (foreignCurrencyId === nativeCurrencyId) {
- console.log('User has selected currency #' + foreignCurrencyId + ' and this is equal to native currency #' + nativeCurrencyId + ' (phew).');
$('#exchange_rate_instruction_holder').hide();
$('#native_amount_holder').hide();
}
@@ -110,7 +110,6 @@ function convertForeignToNative() {
var date = $('#ffInput_date').val();
var amount = $('#ffInput_amount').val();
var uri = 'json/rate/' + foreignCurrencyCode + '/' + nativeCurrencyCode + '/' + date + '?amount=' + amount;
- console.log('Will grab ' + uri);
$.get(uri).done(updateNativeAmount);
}
@@ -119,8 +118,6 @@ function convertForeignToNative() {
* @param data
*/
function updateNativeAmount(data) {
- console.log('Returned data:');
- console.log(data);
$('#ffInput_native_amount').val(data.amount);
}
@@ -158,12 +155,10 @@ function validateCurrencyForTransfer() {
$('#source_amount_holder').show().find('.non-selectable-currency-symbol').text(sourceSymbol);
if (sourceCurrency === destinationCurrency) {
- console.log('Both accounts accept #' + sourceCurrency);
$('#destination_amount_holder').hide();
$('#amount_holder').hide();
return;
}
- console.log('Source accepts #' + sourceCurrency + ', destination #' + destinationCurrency);
$('#ffInput_exchange_rate_instruction').text(getTransferExchangeInstructions());
$('#exchange_rate_instruction_holder').show();
$('input[name="source_amount"]').val($('input[name="amount"]').val());
@@ -191,7 +186,6 @@ function convertSourceToDestination() {
var amount = $('#ffInput_source_amount').val();
$('#ffInput_amount').val(amount);
var uri = 'json/rate/' + sourceCurrencyCode + '/' + destinationCurrencyCode + '/' + date + '?amount=' + amount;
- console.log('Will grab ' + uri);
$.get(uri).done(updateDestinationAmount);
}
@@ -200,7 +194,5 @@ function convertSourceToDestination() {
* @param data
*/
function updateDestinationAmount(data) {
- console.log('Returned data:');
- console.log(data);
$('#ffInput_destination_amount').val(data.amount);
}
\ No newline at end of file
diff --git a/public/js/ff/transactions/single/create.js b/public/js/ff/transactions/single/create.js
index f74263d899..c98759b9b9 100644
--- a/public/js/ff/transactions/single/create.js
+++ b/public/js/ff/transactions/single/create.js
@@ -6,7 +6,7 @@
* See the LICENSE file for details.
*/
-/** global: what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, middleCrumbUrl,exchangeRateInstructions */
+/** global: currencyInfo, accountInfo, what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, middleCrumbUrl,exchangeRateInstructions, convertForeignToNative, convertSourceToDestination, selectsForeignCurrency, accountInfo */
$(document).ready(function () {
"use strict";
@@ -64,8 +64,6 @@ function updateNativeCurrency() {
var newAccountId = getAccountId();
var nativeCurrencyId = accountInfo[newAccountId].preferredCurrency;
- console.log('User selected account #' + newAccountId + '. Native currency is #' + nativeCurrencyId);
-
$('.currency-option[data-id="' + nativeCurrencyId + '"]').click();
$('[data-toggle="dropdown"]').parent().removeClass('open');
if (what !== 'transfer') {
@@ -107,6 +105,7 @@ function updateForm() {
var srcName = $('#ffInput_source_account_name');
switch (what) {
+
case 'withdrawal':
// show source_id and dest_name
document.getElementById('source_account_id_holder').style.display = 'block';
@@ -178,6 +177,8 @@ function updateForm() {
}
document.getElementById('piggy_bank_id_holder').style.display = showPiggies;
break;
+ default:
+ break;
}
updateNativeCurrency();
}
@@ -232,4 +233,5 @@ function getAccountId() {
if (what === "deposit" || what === "transfer") {
return $('select[name="destination_account_id"]').val();
}
+ return undefined;
}
diff --git a/public/js/ff/transactions/single/edit.js b/public/js/ff/transactions/single/edit.js
index d608568c65..05c2132260 100644
--- a/public/js/ff/transactions/single/edit.js
+++ b/public/js/ff/transactions/single/edit.js
@@ -8,7 +8,7 @@
* See the LICENSE file for details.
*/
-/** global: what, Modernizr */
+/** global: what, Modernizr, selectsForeignCurrency, convertForeignToNative, validateCurrencyForTransfer, convertSourceToDestination, journalData, journal, accountInfo, exchangeRateInstructions, currencyInfo */
$(document).ready(function () {
"use strict";
@@ -79,6 +79,7 @@ function getAccountId() {
}
alert('Cannot handle ' + journal.transaction_type.type);
+ return undefined;
}
/**
diff --git a/resources/views/emails/footer-html.twig b/resources/views/emails/footer-html.twig
index 6f4f219380..935128c2aa 100644
--- a/resources/views/emails/footer-html.twig
+++ b/resources/views/emails/footer-html.twig
@@ -6,7 +6,7 @@
- PS: This message was sent because a request from IP {{ ip }} triggered it.
+ PS: This message was sent because a request from IP {{ ip }} {{ userIp }} triggered it.