diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm index f831e4b75b..5669ab6086 100644 --- a/Koha/AuthorisedValue.pm +++ b/Koha/AuthorisedValue.pm @@ -132,6 +132,26 @@ sub is_integer_only { return $self->_result->category->is_integer_only; } +=head3 to_api + + my $json = $av->to_api; + +Overloaded method that returns a JSON representation of the Koha::AuthorisedValue object, +suitable for API output. + +=cut + +sub to_api { + my ( $self, $params ) = @_; + + my $response = $self->SUPER::to_api($params); + my $overrides = {}; + + $overrides->{description} = $self->lib // q{}; + + return { %$response, %$overrides }; +} + =head2 Internal methods =head3 _check_is_integer_only