Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #12860
James Cole3bad4defa8fa
diff --git a/changelog.md b/changelog.mdindex 4260b82dcc..c7e16a1f67 100644--- a/changelog.md+++ b/changelog.md@@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).### Fixed- [Issue 12878](https://github.com/firefly-iii/firefly-iii/issues/12878) (Reconciling Accounts directly from Assets Account page causes 404) reported by @DipeshAggarwal+- #12860### Securitydiff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.jsindex 8bea6ded2a..934f8ecfcf 100644--- a/resources/assets/v3/js/pages/dashboard/dashboard.js+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js@@ -117,7 +117,7 @@ const comps = {};function loadPage(comps) {- console.log("loadPage");+ // console.log("loadPage");Object.keys(comps).forEach((comp) => {let data = comps[comp]();Alpine.data(comp, () => data);@@ -128,11 +128,11 @@ function loadPage(comps) {// wait for load until bootstrapped event is received.document.addEventListener("firefly-iii-bootstrapped", () => {- console.log("Loaded through event listener.");+ // console.log("Loaded through event listener.");loadPage(comps);});// or is bootstrapped before event is triggered.if (window.bootstrapped) {- console.log("Loaded through window variable.");+ // console.log("Loaded through window variable.");loadPage(comps);}diff --git a/resources/assets/v3/js/pages/exchange-rates/index.js b/resources/assets/v3/js/pages/exchange-rates/index.jsindex 93239c0e13..dd19a8a0ac 100644--- a/resources/assets/v3/js/pages/exchange-rates/index.js+++ b/resources/assets/v3/js/pages/exchange-rates/index.js@@ -71,22 +71,22 @@ const comps = {};function loadPage(comps) {- console.log("loadPage");+ // console.log("loadPage");Object.keys(comps).forEach((comp) => {let data = comps[comp]();Alpine.data(comp, () => data);- console.log(comp);+ // console.log(comp);});Alpine.start();}// wait for load until bootstrapped event is received.document.addEventListener("firefly-iii-bootstrapped", () => {- console.log("Loaded through event listener.");+ // console.log("Loaded through event listener.");loadPage(comps);});// or is bootstrapped before event is triggered.if (window.bootstrapped) {- console.log("Loaded through window variable.");+ // console.log("Loaded through window variable.");loadPage(comps);}diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.jsindex 1945a845d1..dbec94bfec 100644--- a/resources/assets/v3/js/pages/transactions/create.js+++ b/resources/assets/v3/js/pages/transactions/create.js@@ -70,6 +70,7 @@ import { keyUpFromSource } from "./shared/keyup-from-source.js";import { keyUpFromDestination } from "./shared/keyup-from-destination.js";import { keyUpFromDescription } from "./shared/keyup-from-description.js";import focusFirstInput from "../../shared/focus-first-input.js";+import filterForeignCurrencies from "./shared/filter-foreign-currencies.js";window.enableDates = false;@@ -224,42 +225,7 @@ let create = function () {autoStep: autoStep,respondToTabSwitch: respondToTabSwitch,loadTransactionLinks: loadTransactionLinks,-- filterForeignCurrencies(code) {- console.log('filterForeignCurrencies("' + code + '")');- let list = [];- let currency;- for (let i in this.formData.enabledCurrencies) {- if (Object.hasOwn(this.formData.enabledCurrencies, i)) {- let current = this.formData.enabledCurrencies[i];- if (current.code === code) {- currency = current;- }- }- }- list.push(currency);- this.formData.foreignCurrencies = list;- // is he source account currency anyway:- if (1 === list.length && list[0].code === this.entries[0].source_account.currency_code) {- // console.log(- // "Foreign currency is same as source currency. Disable foreign amount.",- // );- this.formBehaviour.foreignCurrencyEnabled = false;- }- if (1 === list.length && list[0].code !== this.entries[0].source_account.currency_code) {- // console.log(- // "Foreign currency is NOT same as source currency. Enable foreign amount.",- // );- this.formBehaviour.foreignCurrencyEnabled = true;- }-- // this also forces the currency_code on ALL entries.- for (let i in this.entries) {- if (Object.hasOwn(this.entries, i)) {- this.entries[i].foreign_currency_code = code;- }- }- },+ filterForeignCurrencies: filterForeignCurrencies,addedSplit() {this.addAllAutocompleteToForm();@@ -270,7 +236,7 @@ let create = function () {processUpload() {// console.log("Now in processUpload()");this.formStates.storedAttachments = true;- this.showMessageOrRedirectUser();+ this.showMessageOrRedirectUser('create.js processUpload');},clearDescription(index) {this.entries[index].description = "";@@ -312,7 +278,7 @@ let create = function () {alpine_name: attributes.name,// disabled: false,};- console.log("Now detect", field, this.entries[0][field]);+ // console.log("Now detect", field, this.entries[0][field]);this.detectTransactionType();});return;@@ -439,7 +405,7 @@ let create = function () {return;}- this.showMessageOrRedirectUser();+ this.showMessageOrRedirectUser('save Post>then submission');}).catch((error) => {this.formStates.isSubmitting = true;diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.jsindex 555059046b..487fd385ae 100644--- a/resources/assets/v3/js/pages/transactions/edit.js+++ b/resources/assets/v3/js/pages/transactions/edit.js@@ -71,6 +71,7 @@ import { autoStep } from "./shared/auto-step.js";import { respondToTabSwitch } from "./shared/respond-to-tab-switch.js";import Alpine from "alpinejs";import focusFirstInput from "../../shared/focus-first-input.js";+import filterForeignCurrencies from "./shared/filter-foreign-currencies.js";window.enableDates = false;@@ -205,6 +206,7 @@ let transactions = function () {addTabListener: addTabListener,autoStep: autoStep,respondToTabSwitch: respondToTabSwitch,+ filterForeignCurrencies: filterForeignCurrencies,// part of the account selection auto-complete@@ -220,11 +222,11 @@ let transactions = function () {},changedDestinationAccount() {- console.warn("changedDestinationAccount, event is not used");+ this.detectTransactionType();},changedSourceAccount() {- console.warn("changedSourceAccount, event is not used");+ this.detectTransactionType();},getTags(index) {@@ -287,7 +289,7 @@ let transactions = function () {// the Autocomplete library and Alpine breaks for some reason.tagSelect = document.getElementById("tags_" + i);if (null !== tagSelect) {- console.log("Is not null.");+ // console.log("Is not null.");for (let j in this.entries[i].tags) {if (Object.hasOwn(this.entries[i].tags, j)) {tagSelect.options.add(@@ -345,6 +347,7 @@ let transactions = function () {// add some event listenersdocument.addEventListener("upload-success", () => {+ // console.log('Trigger on event "upload-success"');this.processUpload();document.querySelectorAll("input[type=file]").forEach((input) => (input.value = ""));});@@ -356,7 +359,8 @@ let transactions = function () {// TODO is a duplicateprocessUpload() {- this.showMessageOrRedirectUser();+ this.formStates.storedAttachments = true;+ this.showMessageOrRedirectUser('edit.js processUpload');},// submit the transaction form.@@ -426,7 +430,7 @@ let transactions = function () {}// if not, respond to user options:- this.showMessageOrRedirectUser();+ this.showMessageOrRedirectUser('edit.js save Put submission');}).catch((error) => {console.error(error);diff --git a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.jsindex 3d801c68c8..d984b969e9 100644--- a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js+++ b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js@@ -63,7 +63,7 @@ export function addAllAutocompleteToForm() {filters.destination = [this.entries[0].source_account.type];}}- console.log("Filters for autocomplete: ", filters);+ // console.log("Filters for autocomplete: ", filters);const urls = getUrls();setTimeout(() => {diff --git a/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js b/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.jsindex ba9e5c461e..44808d8399 100644--- a/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js+++ b/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js@@ -36,7 +36,7 @@ export function detectTransactionType() {// this also locks the amount into the amount of the source account// and the foreign amount (if different) in that of the destination account.- console.log("filter down currencies for transfer:");+ // console.log("filter down currencies for transfer:");this.determineAmountCurrency(this.entries[0].source_account.account_currency_code);this.filterForeignCurrencies(this.entries[0].destination_account.account_currency_code);@@ -60,11 +60,7 @@ export function detectTransactionType() {}if (["Debt", "Loan", "Mortgage"].includes(sourceType) && "Expense account" === destType) {this.groupProperties.transactionType = "withdrawal";- // console.log(- // '[c] Transaction type is detected to be "' +- // this.groupProperties.transactionType +- // '".',- // );+ console.log('[c] Transaction type is detected to be "' + this.groupProperties.transactionType + '".',);this.determineAmountCurrency(this.entries[0].source_account.account_currency_code);this.disableSplitInputs();return;@@ -73,22 +69,14 @@ export function detectTransactionType() {// deposits:if ("Revenue account" === sourceType && ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)) {this.groupProperties.transactionType = "deposit";- // console.log(- // 'Transaction type is detected to be "' +- // this.groupProperties.transactionType +- // '".',- // );+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".',);this.disableSplitInputs();this.determineAmountCurrency(this.entries[0].destination_account.account_currency_code);return;}if ("unknown" === sourceType && ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)) {this.groupProperties.transactionType = "deposit";- // console.log(- // 'Transaction type is detected to be "' +- // this.groupProperties.transactionType +- // '".',- // );+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".',);this.determineAmountCurrency(this.entries[0].destination_account.account_currency_code);this.disableSplitInputs();return;@@ -103,11 +91,7 @@ export function detectTransactionType() {}if (["Debt", "Loan", "Mortgage"].includes(sourceType) && "Asset account" === destType) {this.groupProperties.transactionType = "deposit";- // console.log(- // 'Transaction type is detected to be "' +- // this.groupProperties.transactionType +- // '".',- // );+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".',);this.determineAmountCurrency(this.entries[0].destination_account.account_currency_code);this.disableSplitInputs();return;diff --git a/resources/assets/v3/js/pages/transactions/shared/filter-foreign-currencies.js b/resources/assets/v3/js/pages/transactions/shared/filter-foreign-currencies.jsnew file mode 100644index 0000000000..531fa4eb65--- /dev/null+++ b/resources/assets/v3/js/pages/transactions/shared/filter-foreign-currencies.js@@ -0,0 +1,55 @@+/*+ * filter-foreign-currencies.js+ * Copyright (c) 2026 [email protected]+ *+ * This file is part of Firefly III (https://github.com/firefly-iii).+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ */++export default function filterForeignCurrencies(code) {+ // console.log('filterForeignCurrencies("' + code + '")');+ let list = [];+ let currency;+ for (let i in this.formData.enabledCurrencies) {+ if (Object.hasOwn(this.formData.enabledCurrencies, i)) {+ let current = this.formData.enabledCurrencies[i];+ if (current.code === code) {+ currency = current;+ }+ }+ }+ list.push(currency);+ this.formData.foreignCurrencies = list;+ // is he source account currency anyway:+ if (1 === list.length && list[0].code === this.entries[0].source_account.currency_code) {+ // console.log(+ // "Foreign currency is same as source currency. Disable foreign amount.",+ // );+ this.formBehaviour.foreignCurrencyEnabled = false;+ }+ if (1 === list.length && list[0].code !== this.entries[0].source_account.currency_code) {+ // console.log(+ // "Foreign currency is NOT same as source currency. Enable foreign amount.",+ // );+ this.formBehaviour.foreignCurrencyEnabled = true;+ }++ // this also forces the currency_code on ALL entries.+ for (let i in this.entries) {+ if (Object.hasOwn(this.entries, i)) {+ this.entries[i].foreign_currency_code = code;+ }+ }+}diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.jsindex 1d4bb76386..696cf47266 100644--- a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js+++ b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js@@ -55,7 +55,7 @@ export function parseFromEntries(entries, originals, transactionType) {// datescurrent.date = entry.date;if (i > 0 && !!returnArray[0]) {- console.log("Overrule date for entry ", i, " with ", returnArray[0].date);+ // console.log("Overrule date for entry ", i, " with ", returnArray[0].date);current.date = returnArray[0].date;}diff --git a/resources/assets/v3/js/pages/transactions/shared/process-attachments.js b/resources/assets/v3/js/pages/transactions/shared/process-attachments.jsindex 9ee2db2fe2..2826d12dfd 100644--- a/resources/assets/v3/js/pages/transactions/shared/process-attachments.js+++ b/resources/assets/v3/js/pages/transactions/shared/process-attachments.js@@ -21,6 +21,7 @@import AttachmentPost from "../../../api/model/attachment/post.js";let uploadFiles = function (fileData) {+ // console.log('Now in uploadFiles');let count = fileData.length;let uploads = 0;let hasError = false;@@ -84,17 +85,14 @@ export function processAttachments(groupId, transactions) {for (const key in attachments) {if (Object.hasOwn(attachments, key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {for (const fileKey in attachments[key].files) {- if (- Object.hasOwn(attachments[key].files, fileKey) &&- /^0$|^[1-9]\d*$/.test(fileKey) &&- fileKey <= 4294967294- ) {+ if (Object.hasOwn(attachments[key].files, fileKey) && /^0$|^[1-9]\d*$/.test(fileKey) && fileKey <= 4294967294) {// include journal thing.toBeUploaded.push({journal: transactions[key].transaction_journal_id,file: attachments[key].files[fileKey],});count++;+ // console.log('Add file to the upload array.', fileKey);}}}diff --git a/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js b/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.jsindex b400f467a1..ee0ad2455d 100644--- a/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js+++ b/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js@@ -20,17 +20,18 @@import i18next from "i18next";-export function showMessageOrRedirectUser() {+export function showMessageOrRedirectUser(sourceOfCall) {+ console.log('Called showMessageOrRedirectUser("' + sourceOfCall + '")');if (false === this.formStates.storedGroup) {- console.error("Not yet stored group, return false.");+ console.warn("The transaction group is not yet stored, return and do nothing.");return;}if (false === this.formStates.storedAttachments) {- console.error("Not yet stored attachments, return false.");+ console.warn("Attachment(s) is/are not yet stored, return and do nothing.");return;}if (false === this.formStates.storedLinks) {- console.error("Not yet stored links, return false.");+ console.warn("The transaction link(s) is/are not yet stored, return and do nothing.");return;}// disable all messages: