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 806-812
sub CancelHold {
Link Here
|
806 |
my $reserve_id = $cgi->param('item_id'); |
806 |
my $reserve_id = $cgi->param('item_id'); |
807 |
my $hold = Koha::Holds->find( $reserve_id ); |
807 |
my $hold = Koha::Holds->find( $reserve_id ); |
808 |
return { code => 'RecordNotFound' } unless $hold; |
808 |
return { code => 'RecordNotFound' } unless $hold; |
809 |
return { code => 'RecordNotFound' } unless ($hold->borrowernumber == $borrowernumber); |
809 |
|
|
|
810 |
# Check if reserve belongs to the borrower and if it is in a state which allows cancellation |
811 |
return { code => 'BorrowerCannotCancelHold' } unless CanReserveBeCanceledFromOpac( $reserve_id, $borrowernumber ); |
810 |
|
812 |
|
811 |
$hold->cancel; |
813 |
$hold->cancel; |
812 |
|
814 |
|
813 |
- |
|
|