Bug 23281: Cleanup Koha::Patron::Attribute::Types->search

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2019-07-08 15:23:09 -03:00 committed by Martin Renvoize
parent 90b48c2c48
commit e31cddf8b0
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 30 deletions

View File

@ -27,39 +27,11 @@ Koha::Patron::Attribute::Types Object set class
=head1 API
=head2 Class Methods
=head2 Internal methods
=cut
=head3 Koha::Patron::Attribute::Types->search();
my @attribute_types = Koha::Patron::Attribute::Types->search($params);
=cut
sub search {
my ( $self, $params, $attributes ) = @_;
my $branchcode = $params->{branchcode};
delete( $params->{branchcode} );
my $or =
$branchcode
? {
'-or' => [
'borrower_attribute_types_branches.b_branchcode' => undef,
'borrower_attribute_types_branches.b_branchcode' => $branchcode,
]
}
: {};
my $join = $branchcode ? { join => 'borrower_attribute_types_branches' } : {};
$attributes //= {};
$attributes = { %$attributes, %$join };
return $self->SUPER::search( { %$params, %$or, }, $attributes );
}
=head3 type
=head3 _type
=cut