Lines 25-31
use C4::Items;
Link Here
|
25 |
use C4::Circulation; |
25 |
use C4::Circulation; |
26 |
use C4::Accounts; |
26 |
use C4::Accounts; |
27 |
use C4::Biblio; |
27 |
use C4::Biblio; |
28 |
use C4::Reserves qw(AddReserve CanBookBeReserved CanItemBeReserved IsAvailableForItemLevelRequest); |
28 |
use C4::Reserves qw(AddReserve CanBookBeReserved CanItemBeReserved IsAvailableForItemLevelRequest CanReserveBeCanceledFromOpac); |
29 |
use C4::Context; |
29 |
use C4::Context; |
30 |
use C4::AuthoritiesMarc; |
30 |
use C4::AuthoritiesMarc; |
31 |
use XML::Simple; |
31 |
use XML::Simple; |
Lines 849-855
sub CancelHold {
Link Here
|
849 |
my $reserve_id = $cgi->param('item_id'); |
849 |
my $reserve_id = $cgi->param('item_id'); |
850 |
my $hold = Koha::Holds->find( $reserve_id ); |
850 |
my $hold = Koha::Holds->find( $reserve_id ); |
851 |
return { code => 'RecordNotFound' } unless $hold; |
851 |
return { code => 'RecordNotFound' } unless $hold; |
852 |
return { code => 'RecordNotFound' } unless ($hold->borrowernumber == $borrowernumber); |
852 |
|
|
|
853 |
# Check if reserve belongs to the borrower and if it is in a state which allows cancellation |
854 |
return { code => 'BorrowerCannotCancelHold' } unless CanReserveBeCanceledFromOpac( $reserve_id, $borrowernumber ); |
853 |
|
855 |
|
854 |
$hold->cancel; |
856 |
$hold->cancel; |
855 |
|
857 |
|
856 |
- |
|
|