View | Details | Raw Unified | Return to bug 18856
Collapse All | Expand All

(-)a/Koha/Hold.pm (-6 / +4 lines)
Lines 228-236 sub is_in_transit { Link Here
228
228
229
Returns true if hold is a cancelable hold
229
Returns true if hold is a cancelable hold
230
230
231
Holds may be canceled if they not found, or
231
Holds may be only canceled if they are found.
232
are found and waiting. A hold found but in
232
233
transit cannot be canceled.
233
This is used from the OPAC.
234
234
235
=cut
235
=cut
236
236
Lines 238-246 sub is_cancelable { Link Here
238
    my ($self) = @_;
238
    my ($self) = @_;
239
239
240
    return 1 unless $self->is_found();
240
    return 1 unless $self->is_found();
241
    return 0 if $self->is_in_transit();
241
    return 0; # if ->is_in_transit or if ->is_waiting
242
    return 1 if $self->is_waiting();
243
    return 0;
244
}
242
}
245
243
246
=head3 is_at_destination
244
=head3 is_at_destination
(-)a/t/db_dependent/Hold.t (-4 / +3 lines)
Lines 123-133 ok( !$hold->is_in_transit, 'The hold is not in transit' ); Link Here
123
123
124
# Test method is_cancelable
124
# Test method is_cancelable
125
$hold->found(undef);
125
$hold->found(undef);
126
ok( $hold->is_cancelable(), "Unfound hold is cancelable" );
126
is( $hold->is_cancelable, 1, "Unfound hold is cancelable" );
127
$hold->found('W');
127
$hold->found('W');
128
ok( $hold->is_cancelable, "Waiting hold is cancelable" );
128
is( $hold->is_cancelable, 0, "Waiting hold is not cancelable" );
129
$hold->found('T');
129
$hold->found('T');
130
ok( !$hold->is_cancelable, "In transit hold is not cancelable" );
130
is( $hold->is_cancelable, 0, "In transit hold is not cancelable" );
131
131
132
# Test method is_at_destination
132
# Test method is_at_destination
133
$hold->found(undef);
133
$hold->found(undef);
134
- 

Return to bug 18856