Fix a query.

This commit is contained in:
James Cole
2015-12-11 16:39:33 +01:00
parent ad01891a67
commit 7480dc4a19

View File

@@ -360,16 +360,18 @@ class ReportQuery implements ReportQueryInterface
} }
$query = $this->queryJournalsWithTransactions($start, $end); $query = $this->queryJournalsWithTransactions($start, $end);
$query->where( $query->where(
function (Builder $query) { function (Builder $query) {
$query->where( $query->where(
function (Builder $q) { // only get withdrawals not from a shared account function (Builder $q) { // only get withdrawals from any account:
$q->where('transaction_types.type', TransactionType::WITHDRAWAL); $q->where('transaction_types.type', TransactionType::WITHDRAWAL);
$q->where('acm_from.data', '!=', '"sharedAsset"'); //$q->where('acm_from.data', '!=', '"sharedAsset"');
} }
); );
$query->orWhere( $query->orWhere(
function (Builder $q) { // and transfers from a shared account. function (Builder $q) { // and transfers from a shared account to a not-shared account.
$q->where('transaction_types.type', TransactionType::TRANSFER); $q->where('transaction_types.type', TransactionType::TRANSFER);
$q->where('acm_to.data', '=', '"sharedAsset"'); $q->where('acm_to.data', '=', '"sharedAsset"');
$q->where('acm_from.data', '!=', '"sharedAsset"'); $q->where('acm_from.data', '!=', '"sharedAsset"');