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')" > +
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 @@ + + + + + + + + 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',