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 935-941
sub CancelHold {
Link Here
|
935 |
my $reserve_id = $cgi->param('item_id'); |
935 |
my $reserve_id = $cgi->param('item_id'); |
936 |
my $hold = Koha::Holds->find( $reserve_id ); |
936 |
my $hold = Koha::Holds->find( $reserve_id ); |
937 |
return { code => 'RecordNotFound' } unless $hold; |
937 |
return { code => 'RecordNotFound' } unless $hold; |
938 |
return { code => 'RecordNotFound' } unless ($hold->borrowernumber == $borrowernumber); |
938 |
|
|
|
939 |
# Check if reserve belongs to the borrower and if it is in a state which allows cancellation |
940 |
return { code => 'BorrowerCannotCancelHold' } unless CanReserveBeCanceledFromOpac( $reserve_id, $borrowernumber ); |
939 |
|
941 |
|
940 |
$hold->cancel; |
942 |
$hold->cancel; |
941 |
|
943 |
|
942 |
- |
|
|