Skip to content

Firefly III: a personal finances manager

Fix https://github.com/orgs/firefly-iii/discussions/9576

James Cole115e3435af45
diff --git a/config/translations.php b/config/translations.php
index 8bbe20401d..f273a40c2d 100644
--- a/config/translations.php
+++ b/config/translations.php
@@ -146,6 +146,7 @@ return [
'select_source_account',
'split_transaction_title',
'errors_submission',
+ 'is_reconciled',
'split',
'single_split',
'transaction_stored_link',
diff --git a/resources/assets/v1/src/components/exchange-rates/Rates.vue b/resources/assets/v1/src/components/exchange-rates/Rates.vue
index 04678f0eb4..502fe7dd6b 100644
--- a/resources/assets/v1/src/components/exchange-rates/Rates.vue
+++ b/resources/assets/v1/src/components/exchange-rates/Rates.vue
@@ -203,16 +203,16 @@ export default {
return ('' === this.rates[index].rate && '' === this.rates[index].inverse) || this.updating;
},
updateRate: function (index) {
- console.log('Update!');
- console.log(this.rates[index].key);
+ // console.log('Update!');
+ // console.log(this.rates[index].key);
let parts = this.spliceKey(this.rates[index].key);
if (0 === parts.length) {
return;
}
if ('' !== this.rates[index].rate) {
// update rate
- console.log('Rate is ' + this.rates[index].rate);
- console.log('ID is ' + this.rates[index].rate_id);
+ // console.log('Rate is ' + this.rates[index].rate);
+ // console.log('ID is ' + this.rates[index].rate_id);
this.updating = true;
axios.put("./api/v2/exchange-rates/" + this.rates[index].rate_id, {rate: this.rates[index].rate})
.then(() => {
@@ -221,8 +221,8 @@ export default {
}
if ('' !== this.rates[index].inverse) {
// update inverse
- console.log('Inverse is ' + this.rates[index].inverse);
- console.log('Inverse ID is ' + this.rates[index].inverse_id);
+ // console.log('Inverse is ' + this.rates[index].inverse);
+ // console.log('Inverse ID is ' + this.rates[index].inverse_id);
this.updating = true;
axios.put("./api/v2/exchange-rates/" + this.rates[index].inverse_id, {rate: this.rates[index].inverse})
.then(() => {
@@ -231,12 +231,12 @@ export default {
}
},
deleteRate: function (index) {
- console.log(this.rates[index].key);
+ // console.log(this.rates[index].key);
let parts = this.spliceKey(this.rates[index].key);
if (0 === parts.length) {
return;
}
- console.log(parts);
+ // console.log(parts);
// delete A to B
axios.delete("./api/v2/exchange-rates/rates/" + parts.from + '/' + parts.to + '?date=' + format(parts.date, 'yyyy-MM-dd'));
@@ -271,7 +271,7 @@ export default {
}
});
axios.get("./api/v2/currencies/" + this.to_code).then((response) => {
- console.log(response.data.data);
+ // console.log(response.data.data);
this.to = {
id: response.data.data.id,
code: response.data.data.attributes.code,
@@ -295,16 +295,16 @@ export default {
let rate_id = current.id;
let inverse_id = '0';
let key = from_code + '_' + to_code + '_' + format(date, 'yyyy-MM-dd');
- console.log('Key is now "' + key + '"');
+ // console.log('Key is now "' + key + '"');
// perhaps the returned rate is actually the inverse rate.
if (from_code === this.to_code && to_code === this.from_code) {
- console.log('Inverse rate found!');
+ // console.log('Inverse rate found!');
key = to_code + '_' + from_code + '_' + format(date, 'yyyy-MM-dd');
rate = '';
inverse = current.attributes.rate;
inverse_id = current.id;
- console.log('Key updated to "' + key + '"');
+ // console.log('Key updated to "' + key + '"');
}
if (!this.tempRates.hasOwnProperty(key)) {
diff --git a/resources/assets/v1/src/components/form/Checkbox.vue b/resources/assets/v1/src/components/form/Checkbox.vue
index 42919dd315..3d05fa8acb 100644
--- a/resources/assets/v1/src/components/form/Checkbox.vue
+++ b/resources/assets/v1/src/components/form/Checkbox.vue
@@ -59,7 +59,7 @@ export default {
},
methods: {
handleInput() {
- console.log(this.active);
+ // console.log(this.active);
this.$emit('input', this.active);
},
},
diff --git a/resources/assets/v1/src/components/transactions/CreateTransaction.vue b/resources/assets/v1/src/components/transactions/CreateTransaction.vue
index 3de8fb6f66..dce7508969 100644
--- a/resources/assets/v1/src/components/transactions/CreateTransaction.vue
+++ b/resources/assets/v1/src/components/transactions/CreateTransaction.vue
@@ -887,7 +887,7 @@ export default {
deleteTransaction: function (index, event) {
event.preventDefault();
- console.log('Remove transaction.');
+ // console.log('Remove transaction.');
this.transactions.splice(index, 1);
},
limitSourceType: function (type) {
diff --git a/resources/assets/v1/src/components/transactions/EditTransaction.vue b/resources/assets/v1/src/components/transactions/EditTransaction.vue
index ed39dc47f0..92d9a257a3 100644
--- a/resources/assets/v1/src/components/transactions/EditTransaction.vue
+++ b/resources/assets/v1/src/components/transactions/EditTransaction.vue
@@ -154,6 +154,10 @@
:transactionType="transactionType"
v-bind:title="$t('form.foreign_amount')"
></foreign-amount>
+ <reconciled v-show="isReconciled"
+ v-model="transaction.reconciled"
+ :error="transaction.errors.reconciled"
+ ></reconciled>
</div>
<div class="col-lg-4">
<budget
@@ -455,6 +459,7 @@ export default {
transaction_journal_id: transaction.transaction_journal_id,
description: transaction.description,
date: transaction.date.substring(0, 16),
+ reconciled: transaction.reconciled,
amount: this.roundNumber(this.positiveAmount(transaction.amount), transaction.currency_decimal_places),
category: transaction.category_name,
errors: {
@@ -464,6 +469,7 @@ export default {
amount: [],
date: [],
budget_id: [],
+ reconciled: [],
bill_id: [],
foreign_amount: [],
category: [],
@@ -540,7 +546,7 @@ export default {
// }
},
convertData: function () {
- console.log('start of convertData');
+ // console.log('start of convertData');
let data = {
'apply_rules': this.applyRules,
'fire_webhooks': this.fireWebhooks,
@@ -578,7 +584,7 @@ export default {
if ('deposit' === transactionType) {
currencyId = this.transactions[0].destination_account.currency_id;
}
- console.log('Overruled currency ID to ' + currencyId);
+ // console.log('Overruled currency ID to ' + currencyId);
for (let key in this.transactions) {
if (this.transactions.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
@@ -586,7 +592,7 @@ export default {
}
}
//console.log(data);
- console.log('end of convertData');
+ // console.log('end of convertData');
return data;
},
convertDataRow(row, index, transactionType, currencyId) {
@@ -615,7 +621,7 @@ export default {
// }
row.currency_id = currencyId;
- console.log('Final currency ID = ' + currencyId);
+ // console.log('Final currency ID = ' + currencyId);
date = row.date;
if (index > 0) {
@@ -676,6 +682,8 @@ export default {
row.amount = String(row.amount).replace(',', '.');
}
+ // console.log('Reconciled is ' + row.reconciled);
+
currentArray =
{
transaction_journal_id: row.transaction_journal_id,
@@ -688,6 +696,8 @@ export default {
source_id: sourceId,
source_name: sourceName,
+ reconciled: row.reconciled,
+
destination_id: destId,
destination_name: destName,
@@ -726,7 +736,7 @@ export default {
if (parseInt(row.piggy_bank) > 0) {
currentArray.piggy_bank_id = parseInt(row.piggy_bank);
}
- if(this.isReconciled && !this.storeAsNew) {
+ if(this.isReconciled && !this.storeAsNew && true === row.reconciled) {
// drop content from array:
delete currentArray.source_id;
delete currentArray.source_name;
@@ -738,11 +748,14 @@ export default {
delete currentArray.currency_id;
currentArray.reconciled = true;
}
+ if(true === row.isReconciled) {
+ this.isReconciled = false;
+ }
return currentArray;
},
submit: function (e) {
- console.log('Submit!');
+ // console.log('Submit!');
let button = $(e.currentTarget);
button.prop("disabled", true);
@@ -751,26 +764,26 @@ export default {
let uri = './api/v1/transactions/' + groupId + '?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
let method = 'PUT';
if (this.storeAsNew) {
- console.log('storeAsNew');
+ // console.log('storeAsNew');
// other links.
uri = './api/v1/transactions?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
method = 'POST';
}
const data = this.convertData();
- console.log('POST!');
+ // console.log('POST!');
axios({
method: method,
url: uri,
data: data,
}).then(response => {
- console.log('Response!');
+ // console.log('Response!');
if (0 === this.collectAttachmentData(response)) {
const title = response.data.data.attributes.group_title ?? response.data.data.attributes.transactions[0].description;
this.redirectUser(response.data.data.id, title);
}
button.removeAttr('disabled');
}).catch(error => {
- console.log('Error :(');
+ // console.log('Error :(');
// give user errors things back.
// something something render errors.
this.parseErrors(error.response.data);
@@ -779,11 +792,11 @@ export default {
if (e) {
e.preventDefault();
}
- console.log('DONE with method.');
+ // console.log('DONE with method.');
},
redirectUser(groupId, title) {
- console.log('Now in redirectUser');
+ // console.log('Now in redirectUser');
if (this.returnAfter) {
this.setDefaultErrors();
// do message if update or new:
@@ -801,11 +814,11 @@ export default {
window.location.href = window.previousUrl + '?transaction_group_id=' + groupId + '&message=updated';
}
}
- console.log('End of redirectUser');
+ // console.log('End of redirectUser');
},
collectAttachmentData(response) {
- console.log('Now incollectAttachmentData()');
+ // console.log('Now incollectAttachmentData()');
let groupId = response.data.data.id;
// array of all files to be uploaded:
@@ -837,7 +850,7 @@ export default {
}
}
let count = toBeUploaded.length;
- console.log('Found ' + toBeUploaded.length + ' attachments.');
+ // console.log('Found ' + toBeUploaded.length + ' attachments.');
// loop all uploads.
for (const key in toBeUploaded) {
@@ -863,7 +876,7 @@ export default {
})(toBeUploaded[key], key, this);
}
}
- console.log('Done with collectAttachmentData()');
+ // console.log('Done with collectAttachmentData()');
return count;
},
@@ -963,6 +976,7 @@ export default {
foreign_amount: [],
category: [],
piggy_bank: [],
+ reconciled: [],
tags: [],
// custom fields:
custom_errors: {
@@ -1060,6 +1074,7 @@ export default {
case 'budget_id':
case 'bill_id':
case 'description':
+ case 'reconciled':
case 'tags':
this.transactions[transactionIndex].errors[fieldName] = errors.errors[key];
break;
@@ -1106,6 +1121,7 @@ export default {
bill_id: [],
foreign_amount: [],
category: [],
+ reconciled: [],
piggy_bank: [],
tags: [],
// custom fields:
diff --git a/resources/assets/v1/src/components/transactions/Reconciled.vue b/resources/assets/v1/src/components/transactions/Reconciled.vue
new file mode 100644
index 0000000000..a8d9d52ed3
--- /dev/null
+++ b/resources/assets/v1/src/components/transactions/Reconciled.vue
@@ -0,0 +1,75 @@
+<!--
+ - Reconciled.vue
+ - Copyright (c) 2025 [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/.
+ -->
+
+
+<template>
+ <div class="form-group" v-bind:class="{ 'has-error': hasError()}">
+ <div class="col-sm-8 col-sm-offset-4 text-sm">
+
+ </div>
+ <label ref="cur" class="col-sm-4 control-label">
+ {{ $t('firefly.is_reconciled') }}
+ </label>
+ <div class="col-sm-8">
+ <div class="checkbox">
+ <label>
+ <input name="create_another" @input="handleInput" type="checkbox" v-model="reconciled">
+ </label>
+ </div>
+ </div>
+ <ul v-for="error in this.error" class="list-unstyled">
+ <li class="text-danger">{{ error }}</li>
+ </ul>
+ </div>
+</template>
+
+<script>
+
+export default {
+ name: "Reconciled",
+ props: {
+ value: Boolean,
+ error: Array
+ },
+ data() {
+ return {
+ reconciled: this.value
+ }
+ },
+ watch: {
+ reconciled: function () {
+ // console.log('reconciled is ' + this.reconciled);
+ this.$emit('input', this.reconciled);
+ },
+ },
+ methods: {
+ handleInput(e) {
+
+ },
+ hasError: function () {
+ return this.error.length > 0;
+ },
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/resources/assets/v1/src/components/transactions/Tags.vue b/resources/assets/v1/src/components/transactions/Tags.vue
index 83bf53bc3c..38fd9e534b 100644
--- a/resources/assets/v1/src/components/transactions/Tags.vue
+++ b/resources/assets/v1/src/components/transactions/Tags.vue
@@ -74,13 +74,13 @@ export default {
},
methods: {
update(newTags) {
- console.log('update', newTags);
+ // console.log('update', newTags);
this.autocompleteItems = [];
this.tags = newTags;
this.$emit('input', this.tags);
},
clearTags() {
- console.log('clearTags');
+ // console.log('clearTags');
this.tags = [];
this.$emit('input', this.tags);
@@ -89,7 +89,7 @@ export default {
return this.error.length > 0;
},
initItems() {
- console.log('Now in initItems');
+ // console.log('Now in initItems');
if (this.tag.length < 2) {
return;
}
diff --git a/resources/assets/v1/src/components/webhooks/Edit.vue b/resources/assets/v1/src/components/webhooks/Edit.vue
index c91982619c..779c74ee73 100644
--- a/resources/assets/v1/src/components/webhooks/Edit.vue
+++ b/resources/assets/v1/src/components/webhooks/Edit.vue
@@ -124,7 +124,7 @@ export default {
},
downloadWebhook: function (id) {
axios.get('./api/v1/webhooks/' + id).then(response => {
- console.log(response.data.data.attributes);
+ // console.log(response.data.data.attributes);
this.title = response.data.data.attributes.title;
this.id = parseInt(response.data.data.id);
diff --git a/resources/assets/v1/src/components/webhooks/Show.vue b/resources/assets/v1/src/components/webhooks/Show.vue
index 32f9f74980..c0ea77431b 100644
--- a/resources/assets/v1/src/components/webhooks/Show.vue
+++ b/resources/assets/v1/src/components/webhooks/Show.vue
@@ -290,7 +290,7 @@ export default {
}
let journalId = parseInt(prompt('Enter a transaction ID'));
if (journalId !== null && journalId > 0 && journalId <= 16777216) {
- console.log('OK 1');
+ // console.log('OK 1');
this.disabledTrigger = true;
// disable button. Add informative message.
//let button = $('#triggerButton');
@@ -300,7 +300,7 @@ export default {
// TODO actually trigger the webhook.
axios.post('./api/v1/webhooks/' + this.id + '/trigger-transaction/' + journalId, {});
//button.prop('disabled', false).removeClass('disabled');
- console.log('OK 2');
+ // console.log('OK 2');
// set a time-outs.
this.loading = true;
@@ -308,7 +308,7 @@ export default {
this.getWebhook();
this.disabledTrigger = false;
}, 2000);
- console.log('OK 3');
+ // console.log('OK 3');
}
@@ -363,7 +363,7 @@ export default {
},
downloadWebhook: function () {
axios.get('./api/v1/webhooks/' + this.id).then(response => {
- console.log(response.data.data.attributes);
+ // console.log(response.data.data.attributes);
this.edit_url = './webhooks/edit/' + this.id;
this.delete_url = './webhooks/delete/' + this.id;
this.title = response.data.data.attributes.title;
diff --git a/resources/assets/v1/src/edit_transaction.js b/resources/assets/v1/src/edit_transaction.js
index 6425fcdf3f..79f09cd638 100644
--- a/resources/assets/v1/src/edit_transaction.js
+++ b/resources/assets/v1/src/edit_transaction.js
@@ -31,6 +31,7 @@ import PiggyBank from "./components/transactions/PiggyBank";
import Tags from "./components/transactions/Tags";
import Category from "./components/transactions/Category";
import Amount from "./components/transactions/Amount";
+import Reconciled from "./components/transactions/Reconciled";
import ForeignAmountSelect from "./components/transactions/ForeignAmountSelect";
import TransactionType from "./components/transactions/TransactionType";
import AccountSelect from "./components/transactions/AccountSelect";
@@ -63,6 +64,7 @@ Vue.component('tags', Tags);
Vue.component('category', Category);
Vue.component('amount', Amount);
Vue.component('foreign-amount', ForeignAmountSelect);
+Vue.component('reconciled', Reconciled);
Vue.component('transaction-type', TransactionType);
Vue.component('account-select', AccountSelect);
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 95c3efc98a..782a48939e 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -1677,7 +1677,8 @@ return [
'list_all_attachments' => 'List of all attachments',
// transaction index
- 'is_reconciled_fields_dropped' => 'Because this transaction is reconciled, you will not be able to update the accounts, nor the amount(s).',
+ 'is_reconciled_fields_dropped' => 'Because this transaction is reconciled, you will not be able to update the accounts, nor the amount(s) unless you remove the reconciliation flag.',
+ 'is_reconciled' => 'Is reconciled',
'title_expenses' => 'Expenses',
'title_withdrawal' => 'Expenses',
'title_revenue' => 'Revenue / income',