Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Introduce clone and edit button.
James Coled632c1c7fc1d
diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.phpindex aa0b5ea285..9aa1d0d39e 100644--- a/app/Http/Controllers/Transaction/CreateController.php+++ b/app/Http/Controllers/Transaction/CreateController.php@@ -89,6 +89,10 @@ class CreateController extends Controllersession()->flash('success', trans('firefly.stored_journal', ['description' => $title]));session()->flash('success_url', $link);+ if('edit' === $request->get('redirect')) {+ return response()->json(['redirect' => route('transactions.edit', [$newGroup->id])]);+ }+return response()->json(['redirect' => route('transactions.show', [$newGroup->id])]);}}diff --git a/composer.lock b/composer.lockindex 214c235c1e..b6d92a0c99 100644--- a/composer.lock+++ b/composer.lock@@ -2996,16 +2996,16 @@},{"name": "league/flysystem",- "version": "3.17.0",+ "version": "3.18.0","source": {"type": "git","url": "https://github.com/thephpleague/flysystem.git",- "reference": "bd4c9b26849d82364119c68429541f1631fba94b"+ "reference": "015633a05aee22490495159237a5944091d8281e"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/bd4c9b26849d82364119c68429541f1631fba94b",- "reference": "bd4c9b26849d82364119c68429541f1631fba94b",+ "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/015633a05aee22490495159237a5944091d8281e",+ "reference": "015633a05aee22490495159237a5944091d8281e","shasum": ""},"require": {@@ -3034,7 +3034,7 @@"google/cloud-storage": "^1.23","microsoft/azure-storage-blob": "^1.1","phpseclib/phpseclib": "^3.0.14",- "phpstan/phpstan": "^0.12.26",+ "phpstan/phpstan": "^1.10","phpunit/phpunit": "^9.5.11|^10.0","sabre/dav": "^4.3.1"},@@ -3070,7 +3070,7 @@],"support": {"issues": "https://github.com/thephpleague/flysystem/issues",- "source": "https://github.com/thephpleague/flysystem/tree/3.17.0"+ "source": "https://github.com/thephpleague/flysystem/tree/3.18.0"},"funding": [{@@ -3082,20 +3082,20 @@"type": "github"}],- "time": "2023-10-05T20:15:05+00:00"+ "time": "2023-10-20T17:59:40+00:00"},{"name": "league/flysystem-local",- "version": "3.16.0",+ "version": "3.18.0","source": {"type": "git","url": "https://github.com/thephpleague/flysystem-local.git",- "reference": "ec7383f25642e6fd4bb0c9554fc2311245391781"+ "reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/ec7383f25642e6fd4bb0c9554fc2311245391781",- "reference": "ec7383f25642e6fd4bb0c9554fc2311245391781",+ "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e7381ef7643f658b87efb7dbe98fe538fb1bbf32",+ "reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32","shasum": ""},"require": {@@ -3130,7 +3130,7 @@],"support": {"issues": "https://github.com/thephpleague/flysystem-local/issues",- "source": "https://github.com/thephpleague/flysystem-local/tree/3.16.0"+ "source": "https://github.com/thephpleague/flysystem-local/tree/3.18.0"},"funding": [{@@ -3142,7 +3142,7 @@"type": "github"}],- "time": "2023-08-30T10:23:59+00:00"+ "time": "2023-10-19T20:07:13+00:00"},{"name": "league/fractal",@@ -3216,16 +3216,16 @@},{"name": "league/mime-type-detection",- "version": "1.13.0",+ "version": "1.14.0","source": {"type": "git","url": "https://github.com/thephpleague/mime-type-detection.git",- "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96"+ "reference": "b6a5854368533df0295c5761a0253656a2e52d9e"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96",- "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96",+ "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e",+ "reference": "b6a5854368533df0295c5761a0253656a2e52d9e","shasum": ""},"require": {@@ -3256,7 +3256,7 @@"description": "Mime-type detection for Flysystem","support": {"issues": "https://github.com/thephpleague/mime-type-detection/issues",- "source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0"+ "source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0"},"funding": [{@@ -3268,7 +3268,7 @@"type": "tidelift"}],- "time": "2023-08-05T12:09:49+00:00"+ "time": "2023-10-17T14:13:20+00:00"},{"name": "league/oauth2-server",@@ -5571,35 +5571,35 @@},{"name": "spatie/flare-client-php",- "version": "1.4.2",+ "version": "1.4.3","source": {"type": "git","url": "https://github.com/spatie/flare-client-php.git",- "reference": "5f2c6a7a0d2c1d90c12559dc7828fd942911a544"+ "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5f2c6a7a0d2c1d90c12559dc7828fd942911a544",- "reference": "5f2c6a7a0d2c1d90c12559dc7828fd942911a544",+ "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec",+ "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec","shasum": ""},"require": {- "illuminate/pipeline": "^8.0|^9.0|^10.0",+ "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0","nesbot/carbon": "^2.62.1","php": "^8.0","spatie/backtrace": "^1.5.2",- "symfony/http-foundation": "^5.0|^6.0",- "symfony/mime": "^5.2|^6.0",- "symfony/process": "^5.2|^6.0",- "symfony/var-dumper": "^5.2|^6.0"+ "symfony/http-foundation": "^5.2|^6.0|^7.0",+ "symfony/mime": "^5.2|^6.0|^7.0",+ "symfony/process": "^5.2|^6.0|^7.0",+ "symfony/var-dumper": "^5.2|^6.0|^7.0"},"require-dev": {- "dms/phpunit-arraysubset-asserts": "^0.3.0",- "pestphp/pest": "^1.20",+ "dms/phpunit-arraysubset-asserts": "^0.5.0",+ "pestphp/pest": "^1.20|^2.0","phpstan/extension-installer": "^1.1","phpstan/phpstan-deprecation-rules": "^1.0","phpstan/phpstan-phpunit": "^1.0",- "spatie/phpunit-snapshot-assertions": "^4.0"+ "spatie/phpunit-snapshot-assertions": "^4.0|^5.0"},"type": "library","extra": {@@ -5629,7 +5629,7 @@],"support": {"issues": "https://github.com/spatie/flare-client-php/issues",- "source": "https://github.com/spatie/flare-client-php/tree/1.4.2"+ "source": "https://github.com/spatie/flare-client-php/tree/1.4.3"},"funding": [{@@ -5637,20 +5637,20 @@"type": "github"}],- "time": "2023-07-28T08:07:24+00:00"+ "time": "2023-10-17T15:54:07+00:00"},{"name": "spatie/ignition",- "version": "1.11.2",+ "version": "1.11.3","source": {"type": "git","url": "https://github.com/spatie/ignition.git",- "reference": "48b23411ca4bfbc75c75dfc638b6b36159c375aa"+ "reference": "3d886de644ff7a5b42e4d27c1e1f67c8b5f00044"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/spatie/ignition/zipball/48b23411ca4bfbc75c75dfc638b6b36159c375aa",- "reference": "48b23411ca4bfbc75c75dfc638b6b36159c375aa",+ "url": "https://api.github.com/repos/spatie/ignition/zipball/3d886de644ff7a5b42e4d27c1e1f67c8b5f00044",+ "reference": "3d886de644ff7a5b42e4d27c1e1f67c8b5f00044","shasum": ""},"require": {@@ -5659,19 +5659,19 @@"php": "^8.0","spatie/backtrace": "^1.5.3","spatie/flare-client-php": "^1.4.0",- "symfony/console": "^5.4|^6.0",- "symfony/var-dumper": "^5.4|^6.0"+ "symfony/console": "^5.4|^6.0|^7.0",+ "symfony/var-dumper": "^5.4|^6.0|^7.0"},"require-dev": {- "illuminate/cache": "^9.52",+ "illuminate/cache": "^9.52|^10.0|^11.0","mockery/mockery": "^1.4",- "pestphp/pest": "^1.20",+ "pestphp/pest": "^1.20|^2.0","phpstan/extension-installer": "^1.1","phpstan/phpstan-deprecation-rules": "^1.0","phpstan/phpstan-phpunit": "^1.0","psr/simple-cache-implementation": "*",- "symfony/cache": "^6.0",- "symfony/process": "^5.4|^6.0",+ "symfony/cache": "^5.4|^6.0|^7.0",+ "symfony/process": "^5.4|^6.0|^7.0","vlucas/phpdotenv": "^5.5"},"suggest": {@@ -5720,7 +5720,7 @@"type": "github"}],- "time": "2023-09-19T15:29:52+00:00"+ "time": "2023-10-18T14:09:40+00:00"},{"name": "spatie/laravel-html",@@ -10064,16 +10064,16 @@},{"name": "phpstan/phpstan",- "version": "1.10.38",+ "version": "1.10.39","source": {"type": "git","url": "https://github.com/phpstan/phpstan.git",- "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691"+ "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691",- "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691",+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4",+ "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4","shasum": ""},"require": {@@ -10122,7 +10122,7 @@"type": "tidelift"}],- "time": "2023-10-06T14:19:14+00:00"+ "time": "2023-10-17T15:46:26+00:00"},{"name": "phpstan/phpstan-deprecation-rules",diff --git a/public/v1/js/ff/list/groups.js b/public/v1/js/ff/list/groups.jsindex 1edfe24d0f..bdb0ad8c94 100644--- a/public/v1/js/ff/list/groups.js+++ b/public/v1/js/ff/list/groups.js@@ -24,6 +24,7 @@ $(document).ready(function () {updateListButtons();addSort();$('.clone-transaction').click(cloneTransaction);+ $('.clone-transaction-and-edit').click(cloneTransactionAndEdit);});var fixHelper = function (e, tr) {@@ -242,3 +243,18 @@ function cloneTransaction(e) {});return false;}++function cloneTransactionAndEdit(e) {+ var button = $(e.currentTarget);+ var groupId = parseInt(button.data('id'));++ $.post(cloneAndEditUrl, {+ id: groupId+ }).done(function (data) {+ // lame but it works+ location.href = data.redirect;+ }).fail(function () {+ console.error('I failed :(');+ });+ return false;+}diff --git a/public/v1/js/ff/search/index.js b/public/v1/js/ff/search/index.jsindex 6d26fbd683..d39395aa29 100644--- a/public/v1/js/ff/search/index.js+++ b/public/v1/js/ff/search/index.js@@ -48,4 +48,5 @@ function presentSearchResults(data) {updateListButtons();// want to clone?$('.clone-transaction').click(cloneTransaction);-}\ No newline at end of file+ $('.clone-transaction-and-edit').click(cloneTransactionAndEdit);+}diff --git a/public/v1/js/ff/transactions/show.js b/public/v1/js/ff/transactions/show.jsindex 0762e2d2f0..ad4ce3c1e1 100644--- a/public/v1/js/ff/transactions/show.js+++ b/public/v1/js/ff/transactions/show.js@@ -22,6 +22,7 @@ $(function () {"use strict";$('.link-modal').click(getLinkModal);$('.clone-transaction').click(cloneTransaction);+ $('.clone-transaction-and-edit').click(cloneTransactionAndEdit);$('#linkJournalModal').on('shown.bs.modal', function () {makeAutoComplete();})@@ -94,3 +95,18 @@ function cloneTransaction(e) {});return false;}++function cloneTransactionAndEdit(e) {+ var button = $(e.currentTarget);+ var groupId = parseInt(button.data('id'));++ $.post(cloneAndEditUrl, {+ id: groupId+ }).done(function (data) {+ // lame but it works+ location.href = data.redirect;+ }).fail(function () {+ console.error('I failed :(');+ });+ return false;+}diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 832a7f369a..2f5d4b7b95 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -33,6 +33,7 @@ return ['split' => 'Split','single_split' => 'Split','clone' => 'Clone',+ 'clone_and_edit' => 'Clone and edit','confirm_action' => 'Confirm action','last_seven_days' => 'Last seven days','last_thirty_days' => 'Last thirty days',@@ -1981,6 +1982,7 @@ return ['first_split_overrules_destination' => 'The first split may overrule the destination account','spent_x_of_y' => 'Spent {amount} of {total}',+// new user:'welcome' => 'Welcome to Firefly III!','submit' => 'Submit',diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twigindex 0b10ec219f..3818bcfd6b 100644--- a/resources/views/list/groups.twig+++ b/resources/views/list/groups.twig@@ -87,6 +87,8 @@class="fa fa-fw fa-trash"></span> {{ 'delete'|_ }}</a></li><li><a href="#" data-id="{{ group.id }}" class="clone-transaction"><spanclass="fa fa-copy fa-fw"></span> {{ 'clone'|_ }}</a></li>+ <li><a href="#" data-id="{{ group.id }}" class="clone-transaction-and-edit"><span+ class="fa fa-copy fa-fw"></span> {{ 'clone_and_edit'|_ }}</a></li></ul></div></td>@@ -257,6 +259,8 @@class="fa fa-fw fa-trash"></span> {{ 'delete'|_ }}</a></li><li><a href="#" data-id="{{ group.id }}" class="clone-transaction"><spanclass="fa fa-copy fa-fw"></span> {{ 'clone'|_ }}</a></li>+ <li><a href="#" data-id="{{ group.id }}" class="clone-transaction-and-edit"><span+ class="fa fa-copy fa-fw"></span> {{ 'clone_and_edit'|_ }}</a></li><li><a href="{{ route('rules.create-from-journal', [transaction.transaction_journal_id]) }}"><spanclass="fa fa-fw fa-random"></span> {{ 'create_rule_from_transaction'|_ }}@@ -317,4 +321,5 @@</table><script type="text/javascript" nonce="{{ JS_NONCE }}">var cloneGroupUrl = '{{ route('transactions.clone') }}';+ var cloneAndEditUrl = '{{ route('transactions.clone') }}?redirect=edit';</script>diff --git a/resources/views/search/index.twig b/resources/views/search/index.twigindex 94a4f88f3f..b48dfd069e 100644--- a/resources/views/search/index.twig+++ b/resources/views/search/index.twig@@ -151,6 +151,7 @@var searchUrl = "{{ route('search.search') }}?page={{ page }}";var searchPage = {{ page }};var cloneGroupUrl = '{{ route('transactions.clone') }}';+ var cloneAndEditUrl = '{{ route('transactions.clone') }}?redirect=edit';</script>{# required for groups.twig #}<script type="text/javascript" src="v1/js/ff/list/groups.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twigindex c126d55379..9ca97e5d35 100644--- a/resources/views/transactions/show.twig+++ b/resources/views/transactions/show.twig@@ -47,6 +47,8 @@<li role="separator" class="divider"></li><li><a href="#" class="clone-transaction" data-id="{{ transactionGroup.id }}"><spanclass="fa fa-copy"></span> {{ 'clone'|_ }}</a></li>+ <li><a href="#" class="clone-transaction-and-edit" data-id="{{ transactionGroup.id }}"><span+ class="fa fa-copy"></span> {{ 'clone_and_edit'|_ }}</a></li>{% endif %}</ul>@@ -246,6 +248,8 @@<li role="separator" class="divider"></li><li><a href="#" data-id="{{ transactionGroup.id }}" class="clone-transaction"><spanclass="fa fa-copy"></span> {{ 'clone'|_ }}</a></li>+ <li><a href="#" data-id="{{ transactionGroup.id }}" class="clone-transaction-and-edit"><span+ class="fa fa-copy"></span> {{ 'clone_and_edit'|_ }}</a></li>{% endif %}<li><a href="#" class="link-modal"@@ -498,6 +502,7 @@var acURL = '{{ route('api.v1.autocomplete.transactions-with-id') }}';var groupURL = '{{ route('transactions.show',['%GROUP%']) }}';var cloneGroupUrl = '{{ route('transactions.clone') }}';+ var cloneAndEditUrl = '{{ route('transactions.clone') }}?redirect=edit';$('.switch-link').on('click', switchLink);var switchLinkUrl = '{{ route('transactions.link.switch') }}';