Skip to content

Commit

Permalink
Merge pull request #94 from ggoffy/master
Browse files Browse the repository at this point in the history
bugs in filter by status
  • Loading branch information
ggoffy authored Feb 19, 2023
2 parents 6cfda0a + 9195902 commit 58b19ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
14 changes: 4 additions & 10 deletions outputs.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,9 @@
case 'csv':
case 'xlsx':
//$creator = ('' != $GLOBALS['xoopsUser']->getVar('name')) ? $GLOBALS['xoopsUser']->getVar('name') : $GLOBALS['xoopsUser']->getVar('uname');
$filename = date('Ymd_H_i_s_', \time()) . \_MA_WGSIMPLEACC_TRANSACTIONS . '.' . $outType;

$filterYear = Request::getInt('filterYear');
$filterMonthFrom = Request::getInt('filterMonthFrom');
$filterYearFrom = Request::getInt('filterYearFrom');
$filterMonthTo = Request::getInt('filterMonthTo');
$filterYearTo = Request::getInt('filterYearTo', date('Y'));
$traStatus = Request::getArray('tra_status');
$traDesc = Request::getString('tra_desc');
$filename = date('Ymd_H_i_s_', \time()) . \_MA_WGSIMPLEACC_TRANSACTIONS . '.' . $outType;
$traStatus = Request::getArray('tra_status');
$traDesc = Request::getString('tra_desc');

// Add data
$crTransactions = new \CriteriaCompo();
Expand All @@ -201,7 +195,7 @@
if ($accId > 0) {
$crTransactions->add(new \Criteria('tra_accid', $accId));
}
if (\count($traStatus) > 0) {
if (\count($traStatus) > 0 && '' !== (string)$traStatus[0]) {
$critStatus = '(' . \implode(',', $traStatus) . ')';
$crTransactions->add(new \Criteria('tra_status', $critStatus, 'IN'));
} else {
Expand Down
15 changes: 7 additions & 8 deletions transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@
$dateTo = \DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('filterTo'))->getTimestamp();
}
$filterInvalid = Request::getInt('filterInvalid');
$traStatus = '';
$status = Request::getString('tra_status'); // status from pagination
if ('' === $status) {
$traStatus = Request::getArray('filterStatus'); // status from form filter
} elseif ($traId > 0) {
$traStatus = \explode('_', $status);
$traStatus = [];
if (Request::hasVar('filterStatus')) {
$traStatus = Request::getArray('filterStatus');
} else {
$traStatus = \explode('_', Request::getString('tra_status'));
}
$traDesc = Request::getString('tra_desc');
$sortBy = Request::getString('sortby', 'tra_id');
Expand Down Expand Up @@ -139,7 +138,7 @@
if ($cliId > 0) {
$crTransactions->add(new \Criteria('tra_cliid', $cliId));
}
if (\count($traStatus) > 0) {
if (\count($traStatus) > 0 && '' !== (string)$traStatus[0]) {
$critStatus = '(' . \implode(',', $traStatus) . ')';
$crTransactions->add(new \Criteria('tra_status', $critStatus, 'IN'));
} else {
Expand Down Expand Up @@ -583,7 +582,7 @@
if ($accId > 0) {
$crTransactions->add(new \Criteria('tra_accid', $accId));
}
if (\count($traStatus) > 0) {
if (\count($traStatus) > 0 && '' !== (string)$traStatus[0]) {
$critStatus = '(' . \implode(',', $traStatus) . ')';
$crTransactions->add(new \Criteria('tra_status', $critStatus, 'IN'));
}
Expand Down

0 comments on commit 58b19ce

Please sign in to comment.