Expand query, let's see what happens.

This commit is contained in:
James Cole 2015-12-12 12:36:36 +01:00
parent 152d0eb1d0
commit 1423d5b314

View File

@ -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"');
}
);
}
);