Skip to content

Firefly III: a personal finances manager

Simplified account name for cash accounts.

James Cole14934367d8fd
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index f7cb8e10bb..0708263271 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -159,20 +159,12 @@ class TransactionController extends Controller
if ($journal->transactionType->type == 'Withdrawal') {
$preFilled['account_id'] = $journal->source_account->id;
- $preFilled['expense_account'] = $journal->destination_account->name;
+ $preFilled['expense_account'] = $journal->destination_account->name_for_editform;
} else {
$preFilled['account_id'] = $journal->destination_account->id;
- $preFilled['revenue_account'] = $journal->source_account->name;
+ $preFilled['revenue_account'] = $journal->source_account->name_for_editform;
}
- if ($journal->destination_account->accountType->type == 'Cash account') {
- $preFilled['expense_account'] = '';
- }
- if ($journal->source_account->accountType->type == 'Cash account') {
- $preFilled['revenue_account'] = '';
- }
-
-
$preFilled['account_from_id'] = $journal->source_account->id;
$preFilled['account_to_id'] = $journal->destination_account->id;
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 8a9f1f80fd..a09825c266 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -180,6 +180,20 @@ class Account extends Model
return $value;
}
+ /**
+ *
+ * @return string
+ */
+ public function getNameForEditformAttribute()
+ {
+ $name = $this->name;
+ if ($this->accountType->type == 'Cash account') {
+ $name = '';
+ }
+
+ return $name;
+ }
+
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany