Skip to content

Firefly III: a personal finances manager

Expand query, let's see what happens.

James Cole1423d5b3141c
diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php
index 34db15cdb0..5f39c72dd0 100644
--- a/app/Helpers/Report/ReportQuery.php
+++ b/app/Helpers/Report/ReportQuery.php
@@ -279,12 +279,15 @@ class ReportQuery implements ReportQueryInterface
$ids[] = $account->id;
}
- // only get deposits not to a shared account
- // and transfers to a shared account.
-
// OR is a deposit
// OR is a transfer FROM a shared account to NOT a shared account.
//
+ // New idea: from the perspective of a shared account,
+ // a transfer from a not-shared account is income!
+ // so:
+ // OR is a transfer from NOT a shared account to a shared account.
+
+
$query->where(
function (Builder $query) {
@@ -300,6 +303,13 @@ class ReportQuery implements ReportQueryInterface
$q->where('acm_to.data', '!=', '"sharedAsset"');
}
);
+ $query->orWhere(
+ function (Builder $q) {
+ $q->where('transaction_types.type', TransactionType::TRANSFER);
+ $q->where('acm_from.data', '!=', '"sharedAsset"');
+ $q->where('acm_to.data', '=', '"sharedAsset"');
+ }
+ );
}
);