Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix various bugs (very descriptive I know)
James Cole7bd1041820e8
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.phpindex e0100ee705..7f9b1af72a 100644--- a/app/Repositories/PiggyBank/PiggyBankRepository.php+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php@@ -73,7 +73,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface*/public function find(int $piggyBankId): ?PiggyBank{- $piggyBank = $this->user->piggyBanks()->find($piggyBankId);+ return $this->user->piggyBanks()->find($piggyBankId);}/**diff --git a/frontend/src/components/transactions/Create.vue b/frontend/src/components/transactions/Create.vueindex f29b53103c..29d81bb016 100644--- a/frontend/src/components/transactions/Create.vue+++ b/frontend/src/components/transactions/Create.vue@@ -234,7 +234,7 @@ export default {return axios.post(url, data);},handleSubmissionResponse: function (response) {- //console.log('In handleSubmissionResponse()');+ console.log('In handleSubmissionResponse()');// save some meta data:this.returnedGroupId = parseInt(response.data.data.id);this.returnedGroupTitle = null === response.data.data.attributes.group_title ? response.data.data.attributes.transactions[0].description : response.data.data.attributes.group_title;@@ -282,11 +282,14 @@ export default {if (response.journals.hasOwnProperty(i) && /^0$|^[1-9]\d*$/.test(i) && i <= 4294967294) {let journalId = response.journals[i];let hasAttachments = submission.transactions[i].attachments;- // console.log('Decided that ' + journalId);- // console.log(hasAttachments);+ console.log('Decided that ' + journalId);+ console.log(hasAttachments);if (hasAttachments) {- // console.log('upload!');+ console.log('upload!');this.updateField({index: i, field: 'transaction_journal_id', value: journalId});+ // set upload trigger?+ this.updateField({index: i, field: 'uploadTrigger', value: true});+ //this.transactions[i].uploadTrigger = true;anyAttachments = true;}}@@ -302,11 +305,12 @@ export default {this.updateField({index: payload.index, field: 'attachments', value: true});},finaliseSubmission: function () {+ console.log('finaliseSubmission');if (0 === this.submittedAttachments) {- // console.log('submittedAttachments = ' + this.submittedAttachments);+ console.log('submittedAttachments = ' + this.submittedAttachments);return;}- //console.log('In finaliseSubmission');+ console.log('In finaliseSubmission');if (false === this.createAnother) {window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.returnedGroupId + '&message=created';return;@@ -318,7 +322,7 @@ export default {this.errorMessage = '';this.successMessage = this.$t('firefly.transaction_stored_link', {ID: this.returnedGroupId, title: this.returnedGroupTitle});}-+ console.log('here we are');// enable flags:this.enableSubmit = true;this.submittedTransaction = false;@@ -359,7 +363,7 @@ export default {*/submitTransaction: function (event) {event.preventDefault();- // console.log('submitTransaction()');+ console.log('submitTransaction()');// disable the submit button:this.enableSubmit = false;diff --git a/frontend/src/components/transactions/Edit.vue b/frontend/src/components/transactions/Edit.vueindex 00b39950e6..d6e0fb6f2f 100644--- a/frontend/src/components/transactions/Edit.vue+++ b/frontend/src/components/transactions/Edit.vue@@ -298,7 +298,7 @@ export default {if (0 === index) {this.transactionType = array.type.charAt(0).toUpperCase() + array.type.slice(1);-// See reference nr. 5+ // See reference nr. 5this.sourceAllowedTypes = [array.source_type];this.destinationAllowedTypes = [array.destination_type];this.date = array.date.substring(0, 16);@@ -384,14 +384,14 @@ export default {}// add meta data to promise context.promises.push(Promise.resolve(- {- link: link,- journalId: journalId,- opposingId: opposingId,- index: index,- direction: linkDirection- }- ));+ {+ link: link,+ journalId: journalId,+ opposingId: opposingId,+ index: index,+ direction: linkDirection+ }+ ));// get stuff from the API:@@ -533,7 +533,7 @@ export default {this.transactions.push(newTransaction);},submitTransaction: function (event) {- // console.log('submitTransaction()');+ console.log('submitTransaction()');event.preventDefault();this.enableSubmit = false;let submission = {transactions: []};@@ -559,7 +559,7 @@ export default {// loop each transaction (edited by the user):// console.log('Start of loop submitTransaction');for (let i in this.transactions) {- // console.log('Index ' + i);+ console.log('Index ' + i);if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\d*$/.test(i) && i <= 4294967294) {// console.log('Has index ' + i);// original transaction present:@@ -573,17 +573,21 @@ export default {// source and destination are overruled in some cases:if (i > 0) {+ console.log('i > 0');diff.type = this.transactionType.toLowerCase();if ('deposit' === this.transactionType.toLowerCase() || 'transfer' === this.transactionType.toLowerCase()) {// set destination to be whatever is in transaction zero:- currentTransaction.destination_account_name = this.originalTransactions[0].destination_account_name;- currentTransaction.destination_account_id = this.originalTransactions[0].destination_account_id;+ // of the edited transaction+ currentTransaction.destination_account_name = this.transactions[0].destination_account_name;+ currentTransaction.destination_account_id = this.transactions[0].destination_account_id;+ console.log('Destination is now: #' + currentTransaction.destination_account_id + ': ' + currentTransaction.destination_account_name);}if ('withdrawal' === this.transactionType.toLowerCase() || 'transfer' === this.transactionType.toLowerCase()) {// set source to be whatever is in transaction zero:- currentTransaction.source_account_name = this.originalTransactions[0].source_account_name;- currentTransaction.source_account_id = this.originalTransactions[0].source_account_id;+ currentTransaction.source_account_name = this.transactions[0].source_account_name;+ currentTransaction.source_account_id = this.transactions[0].source_account_id;+ console.log('Source is now: #' + currentTransaction.source_account_id + ': ' + currentTransaction.source_account_name);}}@@ -607,11 +611,11 @@ export default {// console.log('we skip!');continue;}- if ('foreign_currency_id' === submissionFieldName && 0 === currentTransaction[fieldName] ) {+ if ('foreign_currency_id' === submissionFieldName && 0 === currentTransaction[fieldName]) {// console.log('we skip!');continue;}- if ('foreign_currency_id' === submissionFieldName && '0' === currentTransaction[fieldName] ) {+ if ('foreign_currency_id' === submissionFieldName && '0' === currentTransaction[fieldName]) {// console.log('we skip!');continue;}@@ -666,7 +670,7 @@ export default {if (typeof currentTransaction.selectedAttachments !== 'undefined' && true === currentTransaction.selectedAttachments) {shouldUpload = true;}- if(true === shouldSubmit) {+ if (true === shouldSubmit) {// set the date to whatever the date is:diff.date = this.date;}@@ -695,12 +699,13 @@ export default {},submitData: function (shouldSubmit, submission) {- // console.log('submitData');- // console.log(submission);+ console.log('submitData');+ console.log(submission);if (!shouldSubmit) {// console.log('No need to submit transaction.');return Promise.resolve({});}+const url = './api/v1/transactions/' + this.groupId;return axios.put(url, submission);@@ -730,7 +735,7 @@ export default {}}journals = journals.reverse();- return Promise.resolve({journals:journals});+ return Promise.resolve({journals: journals});},submitLinks: function (shouldSubmit) {//console.log('submitLinks()');