|
Lines 46-66
sub list {
Link Here
|
| 46 |
|
46 |
|
| 47 |
return try { |
47 |
return try { |
| 48 |
|
48 |
|
| 49 |
my $query = {}; |
49 |
my $query = {}; |
| 50 |
my $restricted = $c->param('restricted'); |
50 |
my $restricted = $c->param('restricted'); |
| 51 |
$c->req->params->remove('restricted'); |
51 |
$c->req->params->remove('restricted'); |
| 52 |
$query->{debarred} = { '!=' => undef } |
52 |
$query->{debarred} = { '!=' => undef } |
| 53 |
if $restricted; |
53 |
if $restricted; |
| 54 |
|
54 |
|
|
|
55 |
my $owes_less_than = $c->param('owes_less_than'); |
| 56 |
my $owes_more_than = $c->param('owes_more_than'); |
| 57 |
$c->req->params->remove('owes_less_than')->remove('owes_more_than'); |
| 58 |
|
| 55 |
my $patrons_rs = Koha::Patrons->search($query); |
59 |
my $patrons_rs = Koha::Patrons->search($query); |
| 56 |
my $patrons = $c->objects->search( $patrons_rs ); |
60 |
|
|
|
61 |
if ( defined $owes_less_than || defined $owes_more_than ) { |
| 62 |
|
| 63 |
$patrons_rs = $patrons_rs->filter_by_amount_owed( |
| 64 |
{ |
| 65 |
less_than => $owes_less_than, |
| 66 |
more_than => $owes_more_than, |
| 67 |
} |
| 68 |
); |
| 69 |
} |
| 57 |
|
70 |
|
| 58 |
return $c->render( |
71 |
return $c->render( |
| 59 |
status => 200, |
72 |
status => 200, |
| 60 |
openapi => $patrons |
73 |
openapi => $c->objects->search($patrons_rs), |
| 61 |
); |
74 |
); |
| 62 |
} |
75 |
} catch { |
| 63 |
catch { |
|
|
| 64 |
$c->unhandled_exception($_); |
76 |
$c->unhandled_exception($_); |
| 65 |
}; |
77 |
}; |
| 66 |
} |
78 |
} |