From 5957cf5ff86051038b596e8e49db3315cc99e520 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:37:40 +0100 Subject: [PATCH 001/151] Remove space. [skip ci] --- resources/lang/en_US/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 024a0e22ac..b6aceb646d 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -854,7 +854,7 @@ return [ '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_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.', From 176c44e2b9944a8d9021860d50b0aa11587a2360 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:38:08 +0100 Subject: [PATCH 002/151] Remove newline [skip ci] --- app/Http/Controllers/Transaction/ConvertController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php index 0a182cf2b3..efae285b27 100644 --- a/app/Http/Controllers/Transaction/ConvertController.php +++ b/app/Http/Controllers/Transaction/ConvertController.php @@ -173,7 +173,6 @@ class ConvertController extends Controller $joined = $sourceType->type . '-' . $destinationType->type; switch ($joined) { default: - throw new FireflyException('Cannot handle ' . $joined); // @codeCoverageIgnore case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: // one $destination = $sourceAccount; From 46c9967a68cd6aa600161163220cdf867b9ce3d2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:40:23 +0100 Subject: [PATCH 003/151] New translations firefly.php (Portuguese, Brazilian) --- resources/lang/pt_BR/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/pt_BR/firefly.php b/resources/lang/pt_BR/firefly.php index d28429962d..55bc416748 100644 --- a/resources/lang/pt_BR/firefly.php +++ b/resources/lang/pt_BR/firefly.php @@ -854,7 +854,7 @@ return [ 'tag_title_nothing' => 'Tags padrões', 'tag_title_balancingAct' => 'Saldo das tags', 'tag_title_advancePayment' => 'Tags de pagamento do adiantamento', - 'tags_introduction' => 'Geralmente tags são palavras singulares, projetadas para rapidamente agrupar itens usando coisas como caro, conta ou para a festa. Em Firefly III, tags podem ter propriedades mais como uma data, descrição e localização. Isso permite que você una as operações de uma forma mais significativa. Por exemplo, você poderia fazer uma tag chamada ceia de Natal com amigos e adicionar informações sobre o restaurante. Tais tags são "singulares", só use-as para uma ocasião única, talvez com várias transações.', + '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 agrupam transações, que torna possível armazenar os reembolsos (no caso você empreste dinheiro para os outros) e outros "balancetes" onde as despesas são somadas (os pagamentos na sua TV nova) ou onde as despesas e depósitos estão anulando uns aos outros (compra algo com dinheiro guardado). Isso é tudo para você. Usando tags à moda antiga claro é sempre possível.', 'tags_start' => 'Crie uma tag para começar ou insira tags ao criar novas transações.', From ecfb5e4711336cefcd8988d0c0f4b9db556e626b Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:40:26 +0100 Subject: [PATCH 004/151] New translations firefly.php (Polish) --- resources/lang/pl_PL/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/pl_PL/firefly.php b/resources/lang/pl_PL/firefly.php index 41aa764eb8..b4bc54902f 100644 --- a/resources/lang/pl_PL/firefly.php +++ b/resources/lang/pl_PL/firefly.php @@ -854,7 +854,7 @@ return [ 'tag_title_nothing' => 'Domyślne tagi', '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_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.', From c0aad385cd3a7f3428514b1c56060b0e15b6afba Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:40:33 +0100 Subject: [PATCH 005/151] New translations firefly.php (German) --- resources/lang/de_DE/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index df1d621931..4ab31f014a 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -855,7 +855,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'tag_title_nothing' => 'Standard-Tags', 'tag_title_balancingAct' => 'Ausgleich Tags', 'tag_title_advancePayment' => 'Vorauszahlung Tags', - 'tags_introduction' => 'In der Regel sind Tags einzelne Worte, erdacht um Einträge mit Begriffen wie Ausgaben, Rechnungen oder Partyvorbereitung schnell zusammenzufassen. In Firefly III können Tags weitere Eigenschaften wie ein Datum, eine Beschreibung und einen Ort enthalten. Dieses erlaubt es Ihnen Transaktionen in sinnvoller Weise miteinander zu verknüpfen. Zum Beispiel können Sie einen Tag mit dem Titel Weihnachtsessen mit Freunden erstellen und Informationen über das Restaurant hinzufügen. Solche Tags sind "einzigartig", sie werden nur für einen Anlass genutzt, enthalten aber eventuell mehrere Transaktionen.', + '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.', From 6b8ec544c18edeb24a8dc1ff8e819497eb75af21 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:40:44 +0100 Subject: [PATCH 006/151] New translations firefly.php (Spanish) --- resources/lang/es_ES/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/es_ES/firefly.php b/resources/lang/es_ES/firefly.php index 5e7b466870..35529bd959 100644 --- a/resources/lang/es_ES/firefly.php +++ b/resources/lang/es_ES/firefly.php @@ -854,7 +854,7 @@ return [ '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_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.', From 55fcb97a10cc8399f39c582220acdad6edcca41a Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:40:50 +0100 Subject: [PATCH 007/151] New translations firefly.php (Dutch) --- resources/lang/nl_NL/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.php index bdf2483bcb..dcf794bdea 100644 --- a/resources/lang/nl_NL/firefly.php +++ b/resources/lang/nl_NL/firefly.php @@ -854,7 +854,7 @@ return [ 'tag_title_nothing' => 'Standaard tags', 'tag_title_balancingAct' => 'Balancerende tags', 'tag_title_advancePayment' => 'Vooruitbetaalde tags', - 'tags_introduction' => 'Normaal gesproken zijn tags enkele woorden, gebruikt om gerelateerde zaken snel aan elkaar te plakken. dure-aanschaf, rekening, feestje. In Firefly III hebben tags meer betekenis en kan je er een datum, omschrijving en locatie aan geven. Daarmee kan je je transacties op een wat zinvollere manier aan elkaar koppelen. Je kan bijvoorbeeld een tag Kerstdiner maken en informatie over het restaurant meenemen. Zulke tags zijn enkelvoudig; je gebruikt ze maar bij één gelegenheid.', + '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' => 'Omdat tags transacties groeperen kan je er teruggaves, vergoedingen en andere geldzaken mee aanduiden, zolang de transacties elkaar "opheffen". Hoe je dit aanpakt is aan jou. De gewone manier kan natuurlijk ook.', 'tags_start' => 'Maak hieronder een tag, of voer nieuwe tags in als je nieuwe transacties maakt.', From 14ef6b753cca3c5a72c9b01b0d4cbb9f248dde74 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:40:56 +0100 Subject: [PATCH 008/151] New translations firefly.php (Russian) --- resources/lang/ru_RU/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/ru_RU/firefly.php b/resources/lang/ru_RU/firefly.php index 5e7b466870..35529bd959 100644 --- a/resources/lang/ru_RU/firefly.php +++ b/resources/lang/ru_RU/firefly.php @@ -854,7 +854,7 @@ return [ '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_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.', From 292b3672e21aff451f2d54e2ef65ff1bec5564cb Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:41:14 +0100 Subject: [PATCH 009/151] New translations firefly.php (Chinese Traditional, Hong Kong) --- resources/lang/zh_HK/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/zh_HK/firefly.php b/resources/lang/zh_HK/firefly.php index 5e7b466870..35529bd959 100644 --- a/resources/lang/zh_HK/firefly.php +++ b/resources/lang/zh_HK/firefly.php @@ -854,7 +854,7 @@ return [ '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_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.', From 91125d20efe15367e23c3c0adef3e736692eb5f3 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:41:19 +0100 Subject: [PATCH 010/151] New translations firefly.php (Croatian) --- resources/lang/hr_HR/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/hr_HR/firefly.php b/resources/lang/hr_HR/firefly.php index 5e7b466870..35529bd959 100644 --- a/resources/lang/hr_HR/firefly.php +++ b/resources/lang/hr_HR/firefly.php @@ -854,7 +854,7 @@ return [ '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_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.', From 789412ee6a63a8701f54ebae9a71a90e62d188b0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:41:28 +0100 Subject: [PATCH 011/151] New translations firefly.php (Chinese Traditional) --- resources/lang/zh_TW/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/zh_TW/firefly.php b/resources/lang/zh_TW/firefly.php index 41ef313fb7..4f58590d02 100644 --- a/resources/lang/zh_TW/firefly.php +++ b/resources/lang/zh_TW/firefly.php @@ -854,7 +854,7 @@ return [ 'tag_title_nothing' => '預設標籤', 'tag_title_balancingAct' => '抵銷行為標籤', 'tag_title_advancePayment' => '預付款標籤', - 'tags_introduction' => '標籤通常是一些方便分類的短語,例如 很貴賬單 或者 派對用品。 在 Firefly III 裡,標籤可以有不同的屬性,例如日期、描述、或位置。這能方便你更有意義地把交易分類。例如,你可以建立一個 與朋友一起吃聖誕大餐的標籤,並加上餐廳的資訊。這類的標籤標籤是 「即棄」 的,你只會在一次事件中使用它,而標籤可能有多個交易。', + '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_start' => '要開始使用,請新增標籤或在建立新交易紀錄時輸入標籤。', From 9a033ac62a546e8ac257899a968ecdc0f13fd021 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 8 Mar 2017 20:41:39 +0100 Subject: [PATCH 012/151] New translations firefly.php (French) --- resources/lang/fr_FR/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/fr_FR/firefly.php b/resources/lang/fr_FR/firefly.php index 152407d963..88fc43f9cb 100644 --- a/resources/lang/fr_FR/firefly.php +++ b/resources/lang/fr_FR/firefly.php @@ -854,7 +854,7 @@ return [ 'tag_title_nothing' => 'Tags par défaut', 'tag_title_balancingAct' => 'Balancing act tags', 'tag_title_advancePayment' => 'Tags de paiement anticipé', - 'tags_introduction' => 'Les tags sont généralement des mots au singulier, conçus pour grouper rapidement des éléments en utilisant des mots comme cher, factures ou pour-fêtes. Dans Firefly III, les tags peuvent avoir plus de propriétés comme une date, la description et l’emplacement. Cela vous permet de réunir des opérations de façon plus significative. Par exemple, vous pourriez faire un tag appelé Dîner de Noël avec des amis et ajouter des informations sur le restaurant. Ces tags sont au singulier, vous devez seulement les utiliser pour une occasion unique, peut-être avec plusieurs opérations.', + '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' => 'Les tags groupent des opérations ensemble, ce qui permet de stocker des remboursements (dans le cas où vous avancer de l\'argent aux autres) et d\'autres types "d\'équilibres" où résumer les dépenses (les remboursements de votre nouvelle TV) ou quand les dépenses et les dépôts s\'annulent les uns les autres (achat de quelque chose avec de l\'argent mis de coté). C\'est comme vous souhaitez. Utiliser les tags à l\'ancienne est toujours possible.', 'tags_start' => 'Create a tag to get started or enter tags when creating new transactions.', From 0e59f7433cd80189410d6ed11fa6746b125f1efb Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 9 Mar 2017 08:19:05 +0100 Subject: [PATCH 013/151] Code and tests for #615 --- .../Transaction/MassController.php | 19 ++-- resources/views/transactions/mass/edit.twig | 89 ++++++++++++------- .../Transaction/MassControllerTest.php | 5 ++ 3 files changed, 72 insertions(+), 41 deletions(-) diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index 0457d4d677..dfff2e24b7 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -14,13 +14,13 @@ declare(strict_types = 1); namespace FireflyIII\Http\Controllers\Transaction; use Carbon\Carbon; -use ExpandedForm; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\MassDeleteJournalRequest; use FireflyIII\Http\Requests\MassEditJournalRequest; use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Support\Collection; use Preferences; @@ -118,8 +118,13 @@ class MassController extends Controller $subTitle = trans('firefly.mass_edit_journals'); /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class); - $accountList = ExpandedForm::makeSelectList($repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])); + $repository = app(AccountRepositoryInterface::class); + $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); + + // get budgets + /** @var BudgetRepositoryInterface $budgetRepository */ + $budgetRepository = app(BudgetRepositoryInterface::class); + $budgets = $budgetRepository->getBudgets(); // skip transactions that have multiple destinations // or multiple sources: @@ -177,7 +182,7 @@ class MassController extends Controller $journals = $filtered; - return view('transactions.mass.edit', compact('journals', 'subTitle', 'accountList')); + return view('transactions.mass.edit', compact('journals', 'subTitle', 'accounts', 'budgets')); } /** @@ -200,7 +205,7 @@ class MassController extends Controller $sourceAccountName = $request->get('source_account_name')[$journal->id] ?? ''; $destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0; $destAccountName = $request->get('destination_account_name')[$journal->id] ?? ''; - $budgetId = $journal->budgets->first() ? $journal->budgets->first()->id : 0; + $budgetId = $request->get('budget_id')[$journal->id] ?? 0; $category = $request->get('category')[$journal->id]; $tags = $journal->tags->pluck('tag')->toArray(); @@ -214,12 +219,12 @@ class MassController extends Controller 'destination_account_id' => intval($destAccountId), 'destination_account_name' => $destAccountName, 'amount' => round($request->get('amount')[$journal->id], 12), - 'currency_id' => intval($request->get('amount_currency_id_amount_' . $journal->id)), + 'currency_id' => $journal->transaction_currency_id, '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' => $budgetId, + 'budget_id' => intval($budgetId), 'category' => $category, 'tags' => $tags, diff --git a/resources/views/transactions/mass/edit.twig b/resources/views/transactions/mass/edit.twig index f4dfb503a9..4f47734b4d 100644 --- a/resources/views/transactions/mass/edit.twig +++ b/resources/views/transactions/mass/edit.twig @@ -22,66 +22,87 @@   - {{ trans('list.description') }} + {{ trans('list.description') }} {{ trans('list.amount') }} {{ trans('list.date') }} {{ trans('list.from') }} {{ trans('list.to') }} {{ trans('list.category') }} + {{ trans('list.budget') }} {% for journal in journals %} {% if journal.transaction_count == 2 %} - - - - + {# LINK TO EDIT FORM #} + - - - - - - {{ ExpandedForm.amountSmall('amount_'~journal.id, journal.amount, {'name' : 'amount['~journal.id~']', 'currency' : journal.transactionCurrency}) }} - - - - + {# DESCRIPTION #} + +
+ {{ journal.transactionCurrency.symbol }} + +
- + + + {# DATE #} + + + + {# SOURCE ACCOUNT ID FOR TRANSFER OR WITHDRAWAL #} {% if journal.transaction_type_type == 'Transfer' or journal.transaction_type_type == 'Withdrawal' %} - {{ Form.select('source_account_id['~journal.id~']', accountList, journal.source_account_id, {'class': 'form-control'}) }} + {% else %} - - {{ Form.input('text', 'source_account_name['~journal.id~']', journal.source_account_name, {'class': 'form-control', 'placeholder': trans('form.revenue_account')}) }} + {# SOURCE ACCOUNT NAME FOR DEPOSIT #} + {% endif %} - - {% if journal.transaction_type_type == 'Transfer' or journal.transaction_type_type == 'Deposit' %} - - {{ Form.select('destination_account_id['~journal.id~']', accountList, journal.destination_account_id, {'class': 'form-control'}) }} + {# DESTINATION ACCOUNT NAME FOR TRANSFER AND DEPOSIT #} + {% else %} - - - {{ Form.input('text', 'destination_account_name['~journal.id~']', journal.destination_account_name, {'class': 'form-control', 'placeholder': trans('form.expense_account')}) }} + {# DESTINATION ACCOUNT NAME FOR EXPENSE #} + {% endif %} - + {# category #} - {{ Form.input('text', 'category['~journal.id~']', journal.categories[0].name, {'class': 'form-control', 'placeholder': trans('form.category')}) }} + + + {# budget #} + + {% if journal.transaction_type_type == 'Withdrawal' %} + + {% endif %} {% endif %} diff --git a/tests/Feature/Controllers/Transaction/MassControllerTest.php b/tests/Feature/Controllers/Transaction/MassControllerTest.php index 342380be36..c662c2c6b5 100644 --- a/tests/Feature/Controllers/Transaction/MassControllerTest.php +++ b/tests/Feature/Controllers/Transaction/MassControllerTest.php @@ -16,6 +16,7 @@ use DB; use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Support\Collection; use Log; @@ -77,6 +78,10 @@ class MassControllerTest extends TestCase $repository = $this->mock(AccountRepositoryInterface::class); $repository->shouldReceive('getAccountsByType')->once()->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection); + // mock more stuff: + $budgetRepos = $this->mock(BudgetRepositoryInterface::class); + $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection); + $transfers = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->take(2)->get()->pluck('id')->toArray(); $this->be($this->user()); From bf138670e85d5ab9c4ece7010edea4c10198e900 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 9 Mar 2017 08:20:49 +0100 Subject: [PATCH 014/151] New translations firefly.php (Dutch) --- resources/lang/nl_NL/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.php index dcf794bdea..bdf2483bcb 100644 --- a/resources/lang/nl_NL/firefly.php +++ b/resources/lang/nl_NL/firefly.php @@ -854,7 +854,7 @@ return [ 'tag_title_nothing' => 'Standaard tags', 'tag_title_balancingAct' => 'Balancerende tags', 'tag_title_advancePayment' => 'Vooruitbetaalde 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_introduction' => 'Normaal gesproken zijn tags enkele woorden, gebruikt om gerelateerde zaken snel aan elkaar te plakken. dure-aanschaf, rekening, feestje. In Firefly III hebben tags meer betekenis en kan je er een datum, omschrijving en locatie aan geven. Daarmee kan je je transacties op een wat zinvollere manier aan elkaar koppelen. Je kan bijvoorbeeld een tag Kerstdiner maken en informatie over het restaurant meenemen. Zulke tags zijn enkelvoudig; je gebruikt ze maar bij één gelegenheid.', 'tags_group' => 'Omdat tags transacties groeperen kan je er teruggaves, vergoedingen en andere geldzaken mee aanduiden, zolang de transacties elkaar "opheffen". Hoe je dit aanpakt is aan jou. De gewone manier kan natuurlijk ook.', 'tags_start' => 'Maak hieronder een tag, of voer nieuwe tags in als je nieuwe transacties maakt.', From 61007a95a601d4599c069afad26816d1225bc805 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 9 Mar 2017 20:54:18 +0100 Subject: [PATCH 015/151] Initial code for #595, transactions with no budget --- app/Http/Controllers/BudgetController.php | 118 ++++++++++++++++++---- resources/views/budgets/no-budget.twig | 58 ++++++++++- routes/web.php | 2 +- 3 files changed, 158 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index a9ac2a2749..6802b9b235 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -24,9 +24,12 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\CacheProperties; use Illuminate\Http\Request; use Illuminate\Support\Collection; +use Log; +use Navigation; use Preferences; use Response; use View; @@ -191,27 +194,66 @@ class BudgetController extends Controller * * @return View */ - public function noBudget(Request $request) + public function noBudget(Request $request, string $moment = '') { - /** @var Carbon $start */ - $start = session('start', Carbon::now()->startOfMonth()); - /** @var Carbon $end */ - $end = session('end', Carbon::now()->endOfMonth()); + // default values: + $range = Preferences::get('viewRange', '1M')->data; + $start = null; + $end = null; + $periods = new Collection; + + // prep for "all" view. + if ($moment === 'all') { + $subTitle = trans('firefly.all_journals_without_budget'); + } + + // prep for "specific date" view. + if (strlen($moment) > 0 && $moment !== 'all') { + $start = new Carbon($moment); + $end = Navigation::endOfPeriod($start, $range); + $subTitle = trans( + 'firefly.without_budget_between', + ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] + ); + $periods = $this->noBudgetPeriodEntries(); + } + + // prep for current period + if (strlen($moment) === 0) { + $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); + $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range)); + $periods = $this->noBudgetPeriodEntries(); + $subTitle = trans( + 'firefly.without_budget_between', + ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] + ); + } + $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); - $subTitle = trans( - 'firefly.without_budget_between', - ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] - ); - // collector - /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class); - $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutBudget(); - $journals = $collector->getPaginatedJournals(); - $journals->setPath('/budgets/list/noBudget'); + $count = 0; + $loop = 0; + // grab journals, but be prepared to jump a period back to get the right ones: + Log::info('Now at no-budget loop start.'); + while ($count === 0 && $loop < 3) { + $loop++; + Log::info('Count is zero, search for journals.'); + /** @var JournalCollectorInterface $collector */ + $collector = app(JournalCollectorInterface::class); + $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutBudget(); + $journals = $collector->getPaginatedJournals(); + $journals->setPath('/budgets/list/no-budget'); + $count = $journals->getCollection()->count(); + if ($count === 0) { + $start->subDay(); + $start = Navigation::startOfPeriod($start, $range); + $end = Navigation::endOfPeriod($start, $range); + Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d'))); + } + } - return view('budgets.no-budget', compact('journals', 'subTitle')); + return view('budgets.no-budget', compact('journals', 'subTitle', 'periods', 'start', 'end')); } /** @@ -405,7 +447,6 @@ class BudgetController extends Controller return $return; } - /** * @param Budget $budget * @param Carbon $start @@ -442,4 +483,47 @@ class BudgetController extends Controller return $set; } + /** + * @return Collection + */ + private function noBudgetPeriodEntries(): Collection + { + $repository = app(JournalRepositoryInterface::class); + $first = $repository->first(); + $start = $first->date ?? new Carbon; + $range = Preferences::get('viewRange', '1M')->data; + $start = Navigation::startOfPeriod($start, $range); + $end = Navigation::endOfX(new Carbon, $range); + $entries = new Collection; + + // properties for cache + $cache = new CacheProperties; + $cache->addProperty($start); + $cache->addProperty($end); + $cache->addProperty('no-budget-period-entries'); + + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + + Log::debug('Going to get period expenses and incomes.'); + while ($end >= $start) { + $end = Navigation::startOfPeriod($end, $range); + $currentEnd = Navigation::endOfPeriod($end, $range); + + // count journals without budget in this period: + /** @var JournalCollectorInterface $collector */ + $collector = app(JournalCollectorInterface::class); + $collector->setAllAssetAccounts()->setRange($end, $currentEnd)->withoutBudget(); + $journals = $collector->getJournals()->count(); + $dateStr = $end->format('Y-m-d'); + $dateName = Navigation::periodShow($end, $range); + $entries->push([$dateStr, $dateName, $journals, clone $end]); + $end = Navigation::subtractPeriod($end, $range, 1); + } + $cache->store($entries); + + return $entries; + } + } diff --git a/resources/views/budgets/no-budget.twig b/resources/views/budgets/no-budget.twig index e8e1f0809b..83ef89391e 100644 --- a/resources/views/budgets/no-budget.twig +++ b/resources/views/budgets/no-budget.twig @@ -5,19 +5,73 @@ {% endblock %} {% block content %} + + {# upper show-all instruction #} + {% if periods.count > 0 %} + + {% endif %} +
-
+

{{ subTitle }}

-
+
{% include 'list.journals-tasker' with {'journals': journals} %} + {% if periods.count > 0 %} +

+ + {{ 'show_all_no_filter'|_ }} +

+ {% else %} +

+ + {{ 'show_the_current_period_and_overview'|_ }} +

+ {% endif %}
+ + {% if periods.count > 0 %} +
+ {% for entry in periods %} + {% if entry[2] > 0 %} +
+ +
+ + + + + +
{{ 'transactions'|_ }}{{ entry[2] }}
+
+
+ {% endif %} + {% endfor %} +
+ {% endif %} +
+ {# lower show-all instruction #} + {% if periods.count > 0 %} + + {% endif %} + {% endblock %} {% block scripts %} diff --git a/routes/web.php b/routes/web.php index 201351db87..36571253d9 100755 --- a/routes/web.php +++ b/routes/web.php @@ -144,7 +144,7 @@ Route::group( Route::get('delete/{budget}', ['uses' => 'BudgetController@delete', 'as' => 'delete']); Route::get('show/{budget}', ['uses' => 'BudgetController@show', 'as' => 'show']); Route::get('show/{budget}/{budgetlimit}', ['uses' => 'BudgetController@showByBudgetLimit', 'as' => 'show.limit']); - Route::get('list/no-budget', ['uses' => 'BudgetController@noBudget', 'as' => 'no-budget']); + Route::get('list/no-budget/{moment?}', ['uses' => 'BudgetController@noBudget', 'as' => 'no-budget']); Route::post('income', ['uses' => 'BudgetController@postUpdateIncome', 'as' => 'income.post']); Route::post('store', ['uses' => 'BudgetController@store', 'as' => 'store']); From db6e6dfe4a3417453670df1ae3fead13035f0464 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 9 Mar 2017 21:05:37 +0100 Subject: [PATCH 016/151] Fix tests for #595 --- app/Http/Controllers/BudgetController.php | 6 +- resources/lang/en_US/firefly.php | 1 + .../Controllers/BudgetControllerTest.php | 71 ++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 6802b9b235..6437e97a33 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -191,10 +191,11 @@ class BudgetController extends Controller /** * @param Request $request + * @param string $moment * * @return View */ - public function noBudget(Request $request, string $moment = '') + public function noBudget(Request $request, JournalRepositoryInterface $repository, string $moment = '') { // default values: $range = Preferences::get('viewRange', '1M')->data; @@ -205,6 +206,9 @@ class BudgetController extends Controller // prep for "all" view. if ($moment === 'all') { $subTitle = trans('firefly.all_journals_without_budget'); + $first = $repository->first(); + $start = $first->date ?? new Carbon; + $end = new Carbon; } // prep for "specific date" view. diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index b6aceb646d..c33e58cfd8 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -115,6 +115,7 @@ return [ 'multi_select_no_selection' => 'None selected', 'multi_select_all_selected' => 'All selected', 'multi_select_filter_placeholder' => 'Find..', + 'all_journals_without_budget' => 'All transactions without a budget', // repeat frequencies: diff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.php index d6d0882781..fca3c8dc29 100644 --- a/tests/Feature/Controllers/BudgetControllerTest.php +++ b/tests/Feature/Controllers/BudgetControllerTest.php @@ -142,6 +142,7 @@ class BudgetControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\BudgetController::noBudget + * @covers \FireflyIII\Http\Controllers\BudgetController::noBudgetPeriodEntries * @dataProvider dateRangeProvider * * @param string $range @@ -151,10 +152,11 @@ class BudgetControllerTest extends TestCase // mock stuff $collector = $this->mock(JournalCollectorInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); + $journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setRange')->andReturnSelf(); + $collector->shouldReceive('getJournals')->andReturn(new Collection); $collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setPage')->andReturnSelf(); $collector->shouldReceive('withoutBudget')->andReturnSelf(); @@ -172,6 +174,73 @@ class BudgetControllerTest extends TestCase $response->assertSee('