This commit is contained in:
James Cole
2019-12-20 07:15:40 +01:00
parent 91172611d4
commit adb32ceed8
25 changed files with 133 additions and 46 deletions

View File

@@ -162,6 +162,7 @@ class AccountValidator
$result = $this->validateOBSource($accountId, $accountName);
break;
case TransactionType::RECONCILIATION:
Log::debug('Calling validateReconciliationSource');
$result = $this->validateReconciliationSource($accountId);
break;
}
@@ -437,19 +438,41 @@ class AccountValidator
*/
private function validateReconciliationDestination(?int $accountId): bool
{
Log::debug('Now in validateReconciliationDestination');
if (null === $accountId) {
Log::debug('Return FALSE');
return false;
}
$result = $this->accountRepository->findNull($accountId);
$types = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::RECONCILIATION];
if (null === $result) {
$this->destError = (string)trans('validation.deposit_dest_bad_data', ['id' => $accountId, 'name' => '']);
Log::debug('Return FALSE');
return false;
}
// $types depends on type of source:
$types = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
// if source is reconciliation, destination can't be.
if (null !== $this->source && AccountType::RECONCILIATION === $this->source->accountType->type) {
$types = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
}
// if source is not reconciliation, destination MUST be.
if (null !== $this->source
&& in_array(
$this->source->accountType->type, [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], true
)) {
$types = [AccountType::RECONCILIATION];
}
if (in_array($result->accountType->type, $types, true)) {
$this->destination = $result;
Log::debug('Return TRUE');
return true;
}
$this->destError = (string)trans('validation.deposit_dest_wrong_type');
Log::debug('Return FALSE');
return false;
}
@@ -461,20 +484,23 @@ class AccountValidator
*/
private function validateReconciliationSource(?int $accountId): bool
{
Log::debug('In validateReconciliationSource');
if (null === $accountId) {
Log::debug('Return FALSE');
return false;
}
$result = $this->accountRepository->findNull($accountId);
$types = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::RECONCILIATION];
if (null === $result) {
Log::debug('Return FALSE');
return false;
}
if (in_array($result->accountType->type, $types, true)) {
$this->source = $result;
Log::debug('Return TRUE');
return true;
}
Log::debug('Return FALSE');
return false;
}

2
public/v1/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -58,12 +58,12 @@
//console.log('Dest "' + this.destination.name + '"');
if (!transactionType && !this.source.name && !this.destination.name) {
$(this.$refs.cur).text('');
return;
}
if(null === transactionType) {
transactionType = '';
}
if ('' === transactionType && '' !== this.source.currency_name) {
$(this.$refs.cur).text(this.source.currency_name);
return;
@@ -72,7 +72,9 @@
$(this.$refs.cur).text(this.destination.currency_name);
return;
}
if (transactionType === 'Withdrawal' || transactionType === 'Transfer') {
if (transactionType.toLowerCase() === 'withdrawal' ||
transactionType.toLowerCase() === 'reconciliation' ||
transactionType.toLowerCase() === 'transfer') {
$(this.$refs.cur).text(this.source.currency_name);
return;
}

View File

@@ -83,28 +83,46 @@
>
</transaction-description>
<account-select v-if="transactionType.toLowerCase() !== 'reconciliation'"
inputName="source[]"
v-bind:title="$t('firefly.source_account')"
:accountName="transaction.source_account.name"
:accountTypeFilters="transaction.source_account.allowed_types"
:transactionType="transactionType"
:index="index"
v-on:clear:value="clearSource(index)"
v-on:select:account="selectedSourceAccount(index, $event)"
:error="transaction.errors.source_account"
inputName="source[]"
v-bind:title="$t('firefly.source_account')"
:accountName="transaction.source_account.name"
:accountTypeFilters="transaction.source_account.allowed_types"
:transactionType="transactionType"
:index="index"
v-on:clear:value="clearSource(index)"
v-on:select:account="selectedSourceAccount(index, $event)"
:error="transaction.errors.source_account"
></account-select>
<div class="form-group" v-if="transactionType.toLowerCase() === 'reconciliation'">
<div class="col-sm-12">
<p id="ffInput_source" class="form-control-static">
<em>
{{ $t('firefly.source_account_reconciliation') }}
</em>
</p>
</div>
</div>
<account-select v-if="transactionType.toLowerCase() !== 'reconciliation'"
inputName="destination[]"
v-bind:title="$t('firefly.destination_account')"
:accountName="transaction.destination_account.name"
:accountTypeFilters="transaction.destination_account.allowed_types"
:transactionType="transactionType"
:index="index"
v-on:clear:value="clearDestination(index)"
v-on:select:account="selectedDestinationAccount(index, $event)"
:error="transaction.errors.destination_account"
inputName="destination[]"
v-bind:title="$t('firefly.destination_account')"
:accountName="transaction.destination_account.name"
:accountTypeFilters="transaction.destination_account.allowed_types"
:transactionType="transactionType"
:index="index"
v-on:clear:value="clearDestination(index)"
v-on:select:account="selectedDestinationAccount(index, $event)"
:error="transaction.errors.destination_account"
></account-select>
<standard-date v-if="transactionType.toLowerCase() !== 'reconciliation'"
<div class="form-group" v-if="transactionType.toLowerCase() === 'reconciliation'">
<div class="col-sm-12">
<p id="ffInput_dest" class="form-control-static">
<em>
{{ $t('firefly.destination_account_reconciliation') }}
</em>
</p>
</div>
</div>
<standard-date
v-model="transaction.date"
:index="index"
:error="transaction.errors.date"
@@ -129,7 +147,7 @@
:error="transaction.errors.amount"
:transactionType="transactionType"
></amount>
<foreign-amount
<foreign-amount v-if="transactionType.toLowerCase() !== 'reconciliation'"
:source="transaction.source_account"
:destination="transaction.destination_account"
v-model="transaction.foreign_amount"
@@ -185,7 +203,7 @@
{{ $t('firefly.after_update_create_another') }}
</label>
</div>
<div class="checkbox">
<div class="checkbox" v-if="transactionType.toLowerCase() !== 'reconciliation'">
<label>
<input v-model="storeAsNew" name="store_as_new" type="checkbox">
{{ $t('firefly.store_as_new') }}

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(\u017e\u00e1dn\u00e9)",
"no_piggy_bank": "(no piggy bank)",
"description": "Popis",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "\u00darokov\u00e9 datum",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(Keine)",
"no_piggy_bank": "(kein Sparschwein)",
"description": "Beschreibung",
"split_transaction_title_help": "Wenn Sie eine Splittbuchung anlegen, muss es eine eindeutige Beschreibung f\u00fcr alle Aufteilungen der Buchung geben."
"split_transaction_title_help": "Wenn Sie eine Splittbuchung anlegen, muss es eine eindeutige Beschreibung f\u00fcr alle Aufteilungen der Buchung geben.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Zinstermin",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(\u03c4\u03af\u03c0\u03bf\u03c4\u03b1)",
"no_piggy_bank": "(no piggy bank)",
"description": "Description",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "\u0397\u03bc\u03b5\u03c1\u03bf\u03bc\u03b7\u03bd\u03af\u03b1 \u03c4\u03bf\u03ba\u03b9\u03c3\u03bc\u03bf\u03cd",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(none)",
"no_piggy_bank": "(no piggy bank)",
"description": "Description",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Interest date",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(ninguno)",
"no_piggy_bank": "(sin alcanc\u00eda)",
"description": "Descripci\u00f3n",
"split_transaction_title_help": "Si crea una transacci\u00f3n dividida, debe existir una descripci\u00f3n global para todas las divisiones de la transacci\u00f3n."
"split_transaction_title_help": "Si crea una transacci\u00f3n dividida, debe existir una descripci\u00f3n global para todas las divisiones de la transacci\u00f3n.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Fecha de inter\u00e9s",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(aucun)",
"no_piggy_bank": "(aucune tirelire)",
"description": "Description",
"split_transaction_title_help": "Si vous cr\u00e9ez une op\u00e9ration ventil\u00e9e, il doit y avoir une description globale pour chaque fraction de l'op\u00e9ration."
"split_transaction_title_help": "Si vous cr\u00e9ez une op\u00e9ration ventil\u00e9e, il doit y avoir une description globale pour chaque fraction de l'op\u00e9ration.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Date de l\u2019int\u00e9r\u00eat",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(nincs)",
"no_piggy_bank": "(no piggy bank)",
"description": "Le\u00edr\u00e1s",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Kamatfizet\u00e9si id\u0151pont",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(none)",
"no_piggy_bank": "(no piggy bank)",
"description": "Deskripsi",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Tanggal bunga",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(nessuna)",
"no_piggy_bank": "(nessun salvadanaio)",
"description": "Descrizione",
"split_transaction_title_help": "Se crei una transazione suddivisa, \u00e8 necessario che ci sia una descrizione globale per tutte le suddivisioni della transazione."
"split_transaction_title_help": "Se crei una transazione suddivisa, \u00e8 necessario che ci sia una descrizione globale per tutte le suddivisioni della transazione.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Data interesse",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(ingen)",
"no_piggy_bank": "(no piggy bank)",
"description": "Beskrivelse",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Rentedato",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(geen)",
"no_piggy_bank": "(geen spaarpotje)",
"description": "Omschrijving",
"split_transaction_title_help": "Als je een gesplitste transactie maakt, moet er een algemene beschrijving zijn voor alle splitsingen van de transactie."
"split_transaction_title_help": "Als je een gesplitste transactie maakt, moet er een algemene beschrijving zijn voor alle splitsingen van de transactie.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Rentedatum",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(\u017cadne)",
"no_piggy_bank": "(brak skarbonki)",
"description": "Opis",
"split_transaction_title_help": "Je\u015bli tworzysz podzielon\u0105 transakcj\u0119, musi ona posiada\u0107 globalny opis dla wszystkich podzia\u0142\u00f3w w transakcji."
"split_transaction_title_help": "Je\u015bli tworzysz podzielon\u0105 transakcj\u0119, musi ona posiada\u0107 globalny opis dla wszystkich podzia\u0142\u00f3w w transakcji.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Data odsetek",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(nenhum)",
"no_piggy_bank": "(nenhum cofrinho)",
"description": "Descri\u00e7\u00e3o",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Data de interesse",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(nici unul)",
"no_piggy_bank": "(no piggy bank)",
"description": "Descriere",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Data de interes",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(\u043d\u0435\u0442)",
"no_piggy_bank": "(\u043d\u0435\u0442 \u043a\u043e\u043f\u0438\u043b\u043a\u0438)",
"description": "\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435",
"split_transaction_title_help": "\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0435\u0451 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445."
"split_transaction_title_help": "\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0435\u0451 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "\u0414\u0430\u0442\u0430 \u0432\u044b\u043f\u043b\u0430\u0442\u044b",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(Ingen)",
"no_piggy_bank": "(ingen spargris)",
"description": "Beskrivning",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "R\u00e4ntedatum",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(Yok)",
"no_piggy_bank": "(no piggy bank)",
"description": "A\u00e7\u0131klama",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "Faiz tarihi",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "\uff08\u7a7a\uff09",
"no_piggy_bank": "\uff08\u65e0\u5b58\u94b1\u7f50\uff09",
"description": "\u63cf\u8ff0",
"split_transaction_title_help": "\u5982\u679c\u60a8\u521b\u5efa\u4e86\u4e00\u4e2a\u5206\u5272\u4ea4\u6613\uff0c\u4ea4\u6613\u7684\u6240\u6709\u5206\u5272\u9879\u90fd\u5fc5\u987b\u6709\u5168\u5c40\u63cf\u8ff0\u3002"
"split_transaction_title_help": "\u5982\u679c\u60a8\u521b\u5efa\u4e86\u4e00\u4e2a\u5206\u5272\u4ea4\u6613\uff0c\u4ea4\u6613\u7684\u6240\u6709\u5206\u5272\u9879\u90fd\u5fc5\u987b\u6709\u5168\u5c40\u63cf\u8ff0\u3002",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "\u5229\u7387\u65e5\u671f",

View File

@@ -29,7 +29,9 @@
"none_in_select_list": "(\u7a7a)",
"no_piggy_bank": "(no piggy bank)",
"description": "\u63cf\u8ff0",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction."
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"destination_account_reconciliation": "You can't edit the destination account of a reconciliation transaction.",
"source_account_reconciliation": "You can't edit the source account of a reconciliation transaction."
},
"form": {
"interest_date": "\u5229\u7387\u65e5\u671f",

View File

@@ -127,7 +127,9 @@ return [
'spent_in_specific_double' => 'Spent in account(s) ":account"',
'earned_in_specific_double' => 'Earned in account(s) ":account"',
'source_account' => 'Source account',
'source_account_reconciliation' => 'You can\'t edit the source account of a reconciliation transaction.',
'destination_account' => 'Destination account',
'destination_account_reconciliation' => 'You can\'t edit the destination account of a reconciliation transaction.',
'sum_of_expenses_in_budget' => 'Spent total in budget ":budget"',
'left_in_budget_limit' => 'Left to spend according to budgeting',
'current_period' => 'Current period',

View File

@@ -181,6 +181,7 @@ return [
'deposit_source_bad_data' => 'Could not find a valid source account when searching for ID ":id" or name ":name".',
'deposit_dest_need_data' => 'Need to get a valid destination account ID and/or valid destination account name to continue.',
'deposit_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".',
'deposit_dest_wrong_type' => 'The submitted destination account is not of the right type.',
'transfer_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.',
'transfer_source_bad_data' => 'Could not find a valid source account when searching for ID ":id" or name ":name".',