Changed the reconciledSet to provide an option for returning partially reconciled results. This keeps the same behavior so as not to break anything (although I can only think of paid rents that might suffer).

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@462 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 21:07:00 +00:00
parent c4cc3ea812
commit 44e4477d38

View File

@@ -249,8 +249,9 @@ OPTION 2
return $query;
}
function reconciledSet($set, $query = null, $unrec = false) {
$this->prEnter(compact('set', 'query', 'unrec'));
function reconciledSet($set, $query = null, $unrec = false, $if_rec_include_partial = false) {
//$this->prFunctionLevel(16);
$this->prEnter(compact('set', 'query', 'unrec', 'if_rec_include_partial'));
$lquery = $this->reconciledSetQuery($set, $query);
$result = $this->find('all', $lquery);
@@ -268,14 +269,17 @@ OPTION 2
// Since HAVING isn't a builtin feature of CakePHP,
// we'll have to post-process to get the desired entries
if ($entry['StatementEntry']['balance'] == 0) {
if (!$unrec)
$resultset[] = $entry;
}
else {
if ($unrec)
$resultset[] = $entry;
}
if ($entry['StatementEntry']['balance'] == 0)
$reconciled = true;
elseif ($entry['StatementEntry']['reconciled'] == 0)
$reconciled = false;
else // Partial payment; depends on unrec
$reconciled = (!$unrec && $if_rec_include_partial);
// Add to the set, if it's been requested
if ($reconciled == !$unrec)
$resultset[] = $entry;
}
return $this->prReturn(array('entries' => $resultset,