<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Koha community<br>
    <br>
    Just came across a weird thing about the way Koha handle the ability
    to cancel reserves via opac user account.<br>
    <br>
    There is 2 steps:<br>
      - Displaying of the "cancel" button. Which depends on
    Koha::Hold->is_cancelable method,<br>
      - the cancellation itself, which depends on
    C4::Reserves::CanReserveBeCanceledFromOpac<br>
    <br>
    The problem is that the 2 sub do not behave the same. Just see:<br>
    <br>
    <font size="-1"><i>sub is_cancelable {</i><i><br>
      </i><i>    my ($self) =
        @_;                                                               
      </i><i><br>
      </i><i>    </i><i><br>
      </i><i>    <b>return 1 unless $self->is_found();</b></i><i><br>
      </i><i>    return 0 if
        $self->is_in_transit();                                            
      </i><i><br>
      </i><i>    <b>return 1 if $self->is_waiting(); </b>                                              
      </i><i><br>
      </i><i>    return
        0;                                                                      
      </i><i><br>
      </i><i>}</i></font><br>
    <br>
    <font size="-1"><i>sub CanReserveBeCanceledFromOpac {</i><i><br>
      </i><i>    my ($reserve_id, $borrowernumber) = @_;</i><i><br>
      </i><i><br>
      </i><i>    return unless $reserve_id and $borrowernumber;</i><i><br>
      </i><i>    my $reserve = Koha::Holds->find($reserve_id);</i><i><br>
      </i><i><br>
      </i><i>    return 0 unless $reserve->borrowernumber ==
        $borrowernumber;</i><i><br>
      </i><i>    <b>return 0 if ( $reserve->found eq 'W' ) or (
          $reserve->found eq 'T' );</b></i><i><br>
      </i><i><br>
      </i><i>    return 1;</i><i><br>
      </i><i><br>
      </i><i>}</i></font><br>
    <br>
    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?<br>
    <br>
    Regards<br>
    <br>
    Alex<br>
    Biblibre<br>
    <br>
    <br>
  </body>
</html>