Canceling reserves via opac

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Canceling reserves via opac

Alex Arnaud
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



_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

Re: Canceling reserves via opac

barton
Alex,

A borrower should not be allowed to cancel a waiting hold; that would leave items orphaned on the holds shelf.

Cancelling waiting holds was removed from the OPAC, but the button was not.  See discussion in


On Tue, Nov 7, 2017 at 5:25 AM, Alex Arnaud <[hidden email]> wrote:
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



_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/