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

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

Return to bug 18856