Lines 25-31
use C4::Items qw( get_hostitemnumbers_of );
Link Here
|
25 |
use C4::Circulation qw( CanBookBeRenewed barcodedecode CanBookBeIssued AddRenewal ); |
25 |
use C4::Circulation qw( CanBookBeRenewed barcodedecode CanBookBeIssued AddRenewal ); |
26 |
use C4::Accounts; |
26 |
use C4::Accounts; |
27 |
use C4::Biblio qw( GetMarcBiblio ); |
27 |
use C4::Biblio qw( GetMarcBiblio ); |
28 |
use C4::Reserves qw( CanBookBeReserved IsAvailableForItemLevelRequest CalculatePriority AddReserve CanItemBeReserved ); |
28 |
use C4::Reserves qw( CanBookBeReserved IsAvailableForItemLevelRequest CalculatePriority AddReserve CanItemBeReserved CanReserveBeCanceledFromOpac); |
29 |
use C4::Context; |
29 |
use C4::Context; |
30 |
use C4::Auth; |
30 |
use C4::Auth; |
31 |
use CGI qw ( -utf8 ); |
31 |
use CGI qw ( -utf8 ); |
Lines 937-943
sub CancelHold {
Link Here
|
937 |
my $reserve_id = $cgi->param('item_id'); |
937 |
my $reserve_id = $cgi->param('item_id'); |
938 |
my $hold = Koha::Holds->find( $reserve_id ); |
938 |
my $hold = Koha::Holds->find( $reserve_id ); |
939 |
return { code => 'RecordNotFound' } unless $hold; |
939 |
return { code => 'RecordNotFound' } unless $hold; |
940 |
return { code => 'RecordNotFound' } unless ($hold->borrowernumber == $borrowernumber); |
940 |
|
|
|
941 |
# Check if reserve belongs to the borrower and if it is in a state which allows cancellation |
942 |
return { code => 'BorrowerCannotCancelHold' } unless CanReserveBeCanceledFromOpac( $reserve_id, $borrowernumber ); |
941 |
|
943 |
|
942 |
$hold->cancel; |
944 |
$hold->cancel; |
943 |
|
945 |
|
944 |
- |
|
|