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 under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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>