Skip to content

Commit

Permalink
Merge pull request #83 from nodum/master
Browse files Browse the repository at this point in the history
Extract Division from request @ financialtransaction/Transactions
  • Loading branch information
stephangroen authored Oct 24, 2016
2 parents 5655911 + b63318c commit a0a1dc5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Picqer/Financials/Exact/Query/Findable.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public function findId($code, $key='Code'){

public function filter($filter, $expand = '', $select = '', $system_query_options = null)
{
$originalDivision = $this->connection()->getDivision();

if ($this->isFillable('Division') && preg_match("@Division[\t\r\n ]+eq[\t\r\n ]+([0-9]+)@i", $filter, $divisionId)) {
$this->connection()->setDivision($divisionId[1]); // Fix division
}

$request = [
'$filter' => $filter
];
Expand All @@ -71,6 +77,10 @@ public function filter($filter, $expand = '', $select = '', $system_query_option

$result = $this->connection()->get($this->url, $request);

if (!empty($divisionId)) {
$this->connection()->setDivision($originalDivision); // Restore division
}

return $this->collectionFromResult($result);
}

Expand Down

0 comments on commit a0a1dc5

Please sign in to comment.