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 return unless $self->found() eq 'W';
55 my $ReservesMaxPickUpDelay = C4::Context->preference('ReservesMaxPickUpDelay');
56 return unless $ReservesMaxPickUpDelay;
58 my $dt = dt_from_string( $self->waitingdate() );
60 $dt->add( days => $ReservesMaxPickUpDelay );
67 Returns true if hold is a waiting hold
74 return $self->found() eq 'W';
79 Returns the related Koha::Biblio object for this hold
86 $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
88 return $self->{_biblio};
93 Returns the related Koha::Item object for this Hold
100 $self->{_item} ||= Koha::Items->find( $self->itemnumber() );
102 return $self->{_item};
107 Returns the related Koha::Branch object for this Hold
114 $self->{_branch} ||= Koha::Branches->find( $self->branchcode() );
116 return $self->{_branch};
129 Kyle M Hall <kyle@bywatersolutions.com>