3 # Copyright ByWater Solutions 2014
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 use C4
::Context
qw(preference);
28 use Koha
::DateUtils
qw(dt_from_string);
30 use base
qw(Koha::Object);
34 Koha::Hold - Koha Hold object class
42 =head3 waiting_expires_on
44 Returns a DateTime for the date a waiting holds expires on.
45 Returns undef if the system peference ReservesMaxPickUpDelay is not set.
46 Returns undef if the hold is not waiting ( found = 'W' ).
50 sub waiting_expires_on
{
53 my $found = $self->found;
54 return unless $found && $found eq 'W';
56 my $ReservesMaxPickUpDelay = C4
::Context
->preference('ReservesMaxPickUpDelay');
57 return unless $ReservesMaxPickUpDelay;
59 my $dt = dt_from_string
( $self->waitingdate() );
61 $dt->add( days
=> $ReservesMaxPickUpDelay );
68 Returns true if hold is a waiting hold
75 my $found = $self->found;
76 return $found && $found eq 'W';
81 Returns the related Koha::Biblio object for this hold
88 $self->{_biblio
} ||= Koha
::Biblios
->find( $self->biblionumber() );
90 return $self->{_biblio
};
95 Returns the related Koha::Item object for this Hold
102 $self->{_item
} ||= Koha
::Items
->find( $self->itemnumber() );
104 return $self->{_item
};
109 Returns the related Koha::Branch object for this Hold
116 $self->{_branch
} ||= Koha
::Branches
->find( $self->branchcode() );
118 return $self->{_branch
};
131 Kyle M Hall <kyle@bywatersolutions.com>