From b412f17bac6470776ca85ce4879330b49fceefd3 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 20 Jan 2020 09:48:03 -0300 Subject: [PATCH] Bug 24459: Make ->to_api pass $params through This patch makes the to_api method in Koha::Acquisition::Inovice and Koha::Patron pass the passed parameters to the base class to_api method. This is required for things like embedding related objects. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Patron.t \ t/db_dependent/Koha/Acquisition/Invoice.t => FAIL: Tests fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- Koha/Acquisition/Invoice.pm | 4 ++-- Koha/Patron.pm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Koha/Acquisition/Invoice.pm b/Koha/Acquisition/Invoice.pm index 2432d18039..111f2644af 100644 --- a/Koha/Acquisition/Invoice.pm +++ b/Koha/Acquisition/Invoice.pm @@ -39,9 +39,9 @@ suitable for API output. =cut sub to_api { - my ( $self ) = @_; + my ( $self, $params ) = @_; - my $json = $self->SUPER::to_api; + my $json = $self->SUPER::to_api( $params ); $json->{closed} = ( $self->closedate ) ? Mojo::JSON->true diff --git a/Koha/Patron.pm b/Koha/Patron.pm index f48e67a696..8e3af0b2d4 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1558,9 +1558,9 @@ suitable for API output. =cut sub to_api { - my ( $self ) = @_; + my ( $self, $params ) = @_; - my $json_patron = $self->SUPER::to_api; + my $json_patron = $self->SUPER::to_api( $params ); $json_patron->{restricted} = ( $self->is_debarred ) ? Mojo::JSON->true -- 2.11.0