1 package Koha::Patron::HouseboundVisits;
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use Koha::Patron::HouseboundVisit;
23 use base qw(Koha::Objects);
27 Koha::Patron::HouseboundVisits - Koha Patron HouseboundVisits Object class
31 HouseboundVisits class used primarily by members/housebound.pl.
35 Standard Koha::Objects definitions, and additional methods.
43 =head3 special_search;
45 my @houseboundVisits = Koha::HouseboundVisits->special_search($params, $attributes);
47 Perform a search for housebound visits. This method overrides standard search
48 to prefetch deliverers and choosers as we always need them anyway.
50 If $attributes contains a prefetch entry, we defer to it, otherwise we add the
51 prefetch attribute and also augment $params with explicit 'me.' prefixes.
53 This is intended to make search behave as most people would expect it to
56 Should the user want to do complicated searches involving joins, without
57 specifying their own prefetch, the naive 'me.' augmentation will break in
58 hilarious ways. In this case the user should supply their own prefetch
64 my ( $self, $params, $attributes ) = @_;
65 unless (exists $attributes->{prefetch}) {
66 # No explicit prefetch has been passed in -> automatic optimisation.
67 $attributes->{prefetch} = [
68 'chooser_brwnumber', 'deliverer_brwnumber'
70 # So we must ensure our $params use the 'me.' prefix.
71 my $oldparams = $params;
73 while (my ($k, $v) = each %{$oldparams}) {
74 if ($k =~ /^me\..*/) {
77 $params->{"me." . $k} = $v;
81 $self->SUPER::search($params, $attributes);
89 return 'HouseboundVisit';
93 return 'Koha::Patron::HouseboundVisit';
100 Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>