Lines 4-26
use Modern::Perl;
Link Here
|
4 |
|
4 |
|
5 |
use Mojo::Base 'Mojolicious::Controller'; |
5 |
use Mojo::Base 'Mojolicious::Controller'; |
6 |
|
6 |
|
7 |
use C4::Members; |
7 |
use Koha::Borrowers; |
8 |
|
8 |
|
9 |
sub list_borrowers { |
9 |
sub list_borrowers { |
10 |
my ($c, $args, $cb) = @_; |
10 |
my ($c, $args, $cb) = @_; |
11 |
|
11 |
|
12 |
my $borrowers = C4::Members::Search; |
12 |
my $borrowers = Koha::Borrowers->search; |
13 |
|
13 |
|
14 |
$c->$cb($borrowers, 200); |
14 |
$c->$cb($borrowers->unblessed, 200); |
15 |
} |
15 |
} |
16 |
|
16 |
|
17 |
sub get_borrower { |
17 |
sub get_borrower { |
18 |
my ($c, $args, $cb) = @_; |
18 |
my ($c, $args, $cb) = @_; |
19 |
|
19 |
|
20 |
my $borrower = C4::Members::GetMemberDetails($args->{borrowernumber}); |
20 |
my $borrower = Koha::Borrowers->find($args->{borrowernumber}); |
21 |
|
21 |
|
22 |
if ($borrower) { |
22 |
if ($borrower) { |
23 |
return $c->$cb($borrower, 200); |
23 |
return $c->$cb($borrower->unblessed, 200); |
24 |
} |
24 |
} |
25 |
|
25 |
|
26 |
$c->$cb({error => "Borrower not found"}, 404); |
26 |
$c->$cb({error => "Borrower not found"}, 404); |
27 |
- |
|
|