|
Lines 27-65
Koha::Patron::Attribute::Types Object set class
Link Here
|
| 27 |
|
27 |
|
| 28 |
=head1 API |
28 |
=head1 API |
| 29 |
|
29 |
|
| 30 |
=head2 Class Methods |
30 |
=head2 Internal methods |
| 31 |
|
31 |
|
| 32 |
=cut |
32 |
=cut |
| 33 |
|
33 |
|
| 34 |
=head3 Koha::Patron::Attribute::Types->search(); |
34 |
=head3 _type |
| 35 |
|
|
|
| 36 |
my @attribute_types = Koha::Patron::Attribute::Types->search($params); |
| 37 |
|
| 38 |
=cut |
| 39 |
|
| 40 |
sub search { |
| 41 |
my ( $self, $params, $attributes ) = @_; |
| 42 |
|
| 43 |
my $branchcode = $params->{branchcode}; |
| 44 |
delete( $params->{branchcode} ); |
| 45 |
|
| 46 |
my $or = |
| 47 |
$branchcode |
| 48 |
? { |
| 49 |
'-or' => [ |
| 50 |
'borrower_attribute_types_branches.b_branchcode' => undef, |
| 51 |
'borrower_attribute_types_branches.b_branchcode' => $branchcode, |
| 52 |
] |
| 53 |
} |
| 54 |
: {}; |
| 55 |
my $join = $branchcode ? { join => 'borrower_attribute_types_branches' } : {}; |
| 56 |
$attributes //= {}; |
| 57 |
$attributes = { %$attributes, %$join }; |
| 58 |
return $self->SUPER::search( { %$params, %$or, }, $attributes ); |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
=head3 type |
| 63 |
|
35 |
|
| 64 |
=cut |
36 |
=cut |
| 65 |
|
37 |
|
| 66 |
- |
|
|