diff --git a/Koha/REST/V1/Patron.pm b/Koha/REST/V1/Patron.pm index b97a154308..477980e0fa 100644 --- a/Koha/REST/V1/Patron.pm +++ b/Koha/REST/V1/Patron.pm @@ -28,7 +28,7 @@ sub list { my $patrons = Koha::Patrons->search; - $c->$cb($patrons->unblessed, 200); + $c->$cb($patrons, 200); } sub get { @@ -41,7 +41,7 @@ sub get { return $c->$cb({error => "Patron not found"}, 404); } - return $c->$cb($patron->unblessed, 200); + return $c->$cb($patron, 200); } 1; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 1fe3988360..ac414b4453 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1343,6 +1343,11 @@ __PACKAGE__->belongs_to( { borrowernumber => "guarantorid" }, ); +__PACKAGE__->add_columns( + '+lost' => { is_boolean => 1 }, + '+gonenoaddress' => { is_boolean => 1 } +); + sub koha_objects_class { 'Koha::Patrons'; } diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t index f4b9410712..6b3f51faf9 100644 --- a/t/db_dependent/api/v1/patrons.t +++ b/t/db_dependent/api/v1/patrons.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 20; +use Test::More tests => 21; use Test::Mojo; use t::lib::TestBuilder; @@ -52,7 +52,8 @@ my $borrower = $builder->build({ branchcode => $branchcode, categorycode => $categorycode, flags => 0, - guarantorid => $guarantor->{borrowernumber}, + lost => 1, + guarantorid => $guarantor->{borrowernumber}, } }); @@ -127,6 +128,7 @@ $tx->req->cookies({name => 'CGISESSID', value => $session->id}); $t->request_ok($tx) ->status_is(200) ->json_is('/borrowernumber' => $borrower->{ borrowernumber }) - ->json_is('/surname' => $borrower->{ surname }); + ->json_is('/surname' => $borrower->{ surname }) + ->json_is('/lost' => 1 ); $dbh->rollback;