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