Hi Koha community

Just came across a weird thing about the way Koha handle the ability to cancel reserves via opac user account.

There is 2 steps:
  - Displaying of the "cancel" button. Which depends on Koha::Hold->is_cancelable method,
  - the cancellation itself, which depends on C4::Reserves::CanReserveBeCanceledFromOpac

The problem is that the 2 sub do not behave the same. Just see:

sub is_cancelable {
    my ($self) = @_;                                                               
   
    return 1 unless $self->is_found();
    return 0 if $self->is_in_transit();                                            
    return 1 if $self->is_waiting();                                               
    return 0;                                                                      
}


sub CanReserveBeCanceledFromOpac {
    my ($reserve_id, $borrowernumber) = @_;

    return unless $reserve_id and $borrowernumber;
    my $reserve = Koha::Holds->find($reserve_id);

    return 0 unless $reserve->borrowernumber == $borrowernumber;
    return 0 if ( $reserve->found eq 'W' ) or ( $reserve->found eq 'T' );

    return 1;

}


A concrete example is that if i want to cancel a waiting reserve, i can see the button, but it does nothing. I think this should be fixed, but which sub is the right one?

Regards

Alex
Biblibre