Bug 39971: Add query param

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2025-05-21 13:27:37 +00:00 committed by Lucas Gass
parent 20e00d408f
commit 9a4e6a87df
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 3 additions and 1 deletions

View File

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