use Koha::Items;
use Koha::Libraries;
use Koha::Old::Holds;
+use Koha::Calendar;
use base qw(Koha::Object);
=cut
+=head3 age
+
+returns the number of days since a hold was placed, optionally
+using the calendar
+
+my $age = $hold->age( $use_calendar );
+
+=cut
+
+sub age {
+ my ( $self, $use_calendar ) = @_;
+
+ my $today = dt_from_string;
+ my $age;
+
+ if ( $use_calendar ) {
+ my $calendar = Koha::Calendar->new( branchcode => $self->branchcode );
+ $age = $calendar->days_between( dt_from_string( $self->reservedate ), $today );
+ }
+ else {
+ $age = $today->delta_days( dt_from_string( $self->reservedate ) );
+ }
+
+ $age = $age->in_units( 'days' );
+
+ return $age;
+}
+
=head3 suspend_hold
my $hold = $hold->suspend_hold( $suspend_until_dt );
=cut
+# FIXME Should be renamed with ->patron
sub borrower {
my ($self) = @_;
$self->cancellationdate(dt_from_string);
$self->priority(0);
$self->_move_to_old;
- $self->delete;
+ $self->SUPER::delete(); # Do not add a DELETE log
# now fix the priority on the others....
C4::Reserves::_FixPriority({ biblionumber => $self->biblionumber });