From 2fb123d2db925633822e10c0aff5ea4f36466655 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 5 Jul 2024 12:10:16 +0000 Subject: [PATCH] Bug 37262: Fix for unmapped tablename filtering Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Edit: amended to tidy the new code (tcohen) Signed-off-by: Katrin Fischer --- Koha/REST/V1/ExtendedAttributeTypes.pm | 6 +++++- api/v1/swagger/paths/extended_attribute_types.yaml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/ExtendedAttributeTypes.pm b/Koha/REST/V1/ExtendedAttributeTypes.pm index 1cc402d704..528197ad0c 100644 --- a/Koha/REST/V1/ExtendedAttributeTypes.pm +++ b/Koha/REST/V1/ExtendedAttributeTypes.pm @@ -53,9 +53,13 @@ sub list { return try { my $additional_fields_set = Koha::AdditionalFields->new; - if ($resource_type) { + if ( $resource_type && $resource_to_table->{$resource_type} ) { $additional_fields_set = $additional_fields_set->search( { tablename => $resource_to_table->{$resource_type} } ); + } elsif ($resource_type) { + $additional_fields_set = $additional_fields_set->search( { tablename => $resource_type } ); + } else { + $additional_fields_set = $additional_fields_set->search(); } return $c->render( diff --git a/api/v1/swagger/paths/extended_attribute_types.yaml b/api/v1/swagger/paths/extended_attribute_types.yaml index f96049f1ed..f49d54b91e 100644 --- a/api/v1/swagger/paths/extended_attribute_types.yaml +++ b/api/v1/swagger/paths/extended_attribute_types.yaml @@ -17,6 +17,9 @@ - basket - invoice - order + - subscription + - accountlines:credit + - accountlines:debit - $ref: "../swagger.yaml#/parameters/match" - $ref: "../swagger.yaml#/parameters/order_by" - $ref: "../swagger.yaml#/parameters/page" -- 2.39.5