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 <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2020-01-20 09:48:03 -03:00 committed by Martin Renvoize
parent e003a3c164
commit 1e52cb442b
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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