@@ -, +, @@ - Adding is_boolean => 1 to the relevant columns on the Borrower.pm schema file. - Tweaking the controller class for the /patrons endpoint so it doesn't use the $object(s)->unblessed call but just let the Mojo::JSON library pick out TO_JSON implementation instead on rendering the output. - It adds a new test for booleans. - Have 17927 applied - Run: $ prove t/db_dependent/api/v1/patrons.t - Apply this patches - Run: $ prove t/db_dependent/api/v1/patrons.t - Sign off! :-D --- Koha/REST/V1/Patron.pm | 4 ++-- Koha/Schema/Result/Borrower.pm | 5 +++++ t/db_dependent/api/v1/patrons.t | 8 +++++--- 3 files changed, 12 insertions(+), 5 deletions(-) --- a/Koha/REST/V1/Patron.pm +++ a/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; --- a/Koha/Schema/Result/Borrower.pm +++ a/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'; } --- a/t/db_dependent/api/v1/patrons.t +++ a/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; --