Lines 34-39
use Koha::Libraries;
Link Here
|
34 |
use Koha::Old::Holds; |
34 |
use Koha::Old::Holds; |
35 |
use Koha::Calendar; |
35 |
use Koha::Calendar; |
36 |
|
36 |
|
|
|
37 |
use Koha::Exceptions::Hold; |
38 |
|
37 |
use base qw(Koha::Object); |
39 |
use base qw(Koha::Object); |
38 |
|
40 |
|
39 |
=head1 NAME |
41 |
=head1 NAME |
Lines 85-100
sub suspend_hold {
Link Here
|
85 |
|
87 |
|
86 |
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; |
88 |
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; |
87 |
|
89 |
|
88 |
if ( $self->is_waiting ) { # We can't suspend waiting holds |
90 |
if ( $self->is_found ) { # We can't suspend found holds |
89 |
carp "Unable to suspend waiting hold!"; |
91 |
if ( $self->is_waiting ) { |
90 |
return $self; |
92 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'W' ); |
|
|
93 |
} |
94 |
elsif ( $self->is_in_transit ) { |
95 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'T' ); |
96 |
} |
97 |
else { |
98 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( |
99 |
'Unhandled data exception on found hold (id=' |
100 |
. $self->id |
101 |
. ', found=' |
102 |
. $self->found |
103 |
. ')' ); |
104 |
} |
91 |
} |
105 |
} |
92 |
|
106 |
|
93 |
$self->suspend(1); |
107 |
$self->suspend(1); |
94 |
$self->suspend_until( $date ); |
108 |
$self->suspend_until($date); |
95 |
$self->store(); |
109 |
$self->store(); |
96 |
|
110 |
|
97 |
logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper($self->unblessed) ) |
111 |
logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper( $self->unblessed ) ) |
98 |
if C4::Context->preference('HoldsLog'); |
112 |
if C4::Context->preference('HoldsLog'); |
99 |
|
113 |
|
100 |
return $self; |
114 |
return $self; |
101 |
- |
|
|