From 81d9bba703f503eafaf0a2f3d887072a088436d2 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 21 May 2025 13:27:37 +0000 Subject: [PATCH] Bug 39971: Add query param Signed-off-by: David Nind --- Koha/Patron/Attribute/Types.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/Patron/Attribute/Types.pm b/Koha/Patron/Attribute/Types.pm index 405e50ea20..d74b5551d4 100644 --- a/Koha/Patron/Attribute/Types.pm +++ b/Koha/Patron/Attribute/Types.pm @@ -42,6 +42,7 @@ Params: $template - The template object to be populated with patron attributes. $attributes - Arrayref of hashrefs containing patron attribute data. $op - Operation type, such as 'duplicate', used to handle unique attributes. + $query - Query to filter attributes e.g. { mandatory => 1 }. =cut @@ -49,9 +50,10 @@ sub patron_attributes_form { my $template = shift; my $attributes = shift; my $op = shift; + my $query = shift // {}; my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; - my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits( {}, {}, $library_id ); + my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits( $query, {}, $library_id ); if ( $attribute_types->count == 0 ) { $template->param( no_patron_attribute_types => 1 ); return; -- 2.39.5