Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix amount in tag list [skip ci]
James Coleb935e323402b
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 8aedbd44d2..5b771bd9cf 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -60,13 +60,13 @@ use Watson\Validating\ValidatingTrait;* @method static \FireflyIII\Models\TransactionJournal onDate($date)* @method static \FireflyIII\Models\TransactionJournal transactionTypes($types)* @method static \FireflyIII\Models\TransactionJournal withRelevantData()- * @property-read mixed $expense_account- * @property string account_encrypted- * @property bool joinedTransactions- * @property bool joinedTransactionTypes- * @property mixed account_id- * @property mixed name- * @property mixed symbol+ * @property-read mixed $expense_account+ * @property string account_encrypted+ * @property bool joinedTransactions+ * @property bool joinedTransactionTypes+ * @property mixed account_id+ * @property mixed name+ * @property mixed symbol*/class TransactionJournal extends Model{@@ -219,6 +219,22 @@ class TransactionJournal extends Model}+ /**+ * @return string+ */+ public function getCorrectAmountAttribute()+ {++ switch ($this->transactionType->type) {+ case 'Deposit':+ return $this->transactions()->where('amount', '>', 0)->first()->amount;+ case 'Withdrawal':+ return $this->transactions()->where('amount', '<', 0)->first()->amount;+ }++ return '0';+ }+/*** @codeCoverageIgnore* @return \Illuminate\Database\Eloquent\Relations\HasMany@@ -379,7 +395,7 @@ class TransactionJournal extends Modelpublic function scopeWithRelevantData(EloquentBuilder $query){$query->with(- ['transactions' => function(HasMany $q) {+ ['transactions' => function (HasMany $q) {$q->orderBy('amount', 'ASC');}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']);diff --git a/resources/twig/list/journals.twig b/resources/twig/list/journals.twigindex 78812ceda0..44df7e1abb 100644--- a/resources/twig/list/journals.twig+++ b/resources/twig/list/journals.twig@@ -57,7 +57,7 @@{% if not hideTags %}{{ relevantTags(journal)|raw }}{% else %}- {{ journal.correctedActualAmount|formatAmount }}+ {{ journal.correctAmount|formatAmount }}{% endif %}</td><td>