From ba4fa69c6c3e9a2c5c1b9123b286bfbe287a9891 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 19 Dec 2024 17:00:30 +0000 Subject: [PATCH] Bug 38010: Change how interface details are displayed --- Koha/Acquisition/Bookseller.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Koha/Acquisition/Bookseller.pm b/Koha/Acquisition/Bookseller.pm index da9c98c86b5..daf5948019a 100644 --- a/Koha/Acquisition/Bookseller.pm +++ b/Koha/Acquisition/Bookseller.pm @@ -222,6 +222,36 @@ sub to_api_mapping { }; } + +=head3 to_api + + my $json = $av->to_api; + +Overloaded method that returns a JSON representation of the Koha::Acquisition::Bookseller object, +suitable for API output. + +=cut + +sub to_api { + my ( $self, $params ) = @_; + + my $response = $self->SUPER::to_api($params); + my $overrides = {}; + + if ( $self->interfaces ) { + my $interfaces = $self->interfaces->as_list; + my @updated_interfaces; + foreach my $interface ( @{$interfaces} ) { + $interface->password( $interface->plain_text_password ); + push @updated_interfaces, $interface->unblessed; + } + $overrides->{interfaces} = ( \@updated_interfaces ); + } + + return { %$response, %$overrides }; +} + + =head2 Internal methods =head3 _type -- 2.39.5 (Apple Git-154)