@@ -, +, @@ -------------------------------- -Put a reserve for a borrower -Try to cancel the reserve providing another borrowernumber as argument -Try to cancel the reserve providing the borrowernumber the reserve is -Put a new reserve with a pickup branch != from the homebranch -Transfer the item to the pickup branch (reserve status = Transit) -Try to cancel the reserve (with proper borrowernumber) -Checkout the reserved item in the pickup branch (reserve status = -Try to cancel the reserve (with proper borrowernumber) -------------------------------- -Put a reserve for a borrower -Try to cancel the reserve providing another borrowernumber as argument -Try to cancel the reserve providing the borrowernumber the reserve is -Put a new reserve with a pickup branch != from the homebranch -Transfer the item to the pickup branch (reserve status = Transit) -Try to cancel the reserve (with proper borrowernumber) -Checkout the reserved item in the pickup branch (reserve status = -Try to cancel the reserve (with proper borrowernumber) --- C4/ILSDI/Services.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/C4/ILSDI/Services.pm +++ a/C4/ILSDI/Services.pm @@ -25,7 +25,7 @@ use C4::Items qw( get_hostitemnumbers_of ); use C4::Circulation qw( CanBookBeRenewed barcodedecode CanBookBeIssued AddRenewal ); use C4::Accounts; use C4::Biblio qw( GetMarcBiblio ); -use C4::Reserves qw( CanBookBeReserved IsAvailableForItemLevelRequest CalculatePriority AddReserve CanItemBeReserved ); +use C4::Reserves qw( CanBookBeReserved IsAvailableForItemLevelRequest CalculatePriority AddReserve CanItemBeReserved CanReserveBeCanceledFromOpac); use C4::Context; use C4::Auth; use CGI qw ( -utf8 ); @@ -935,7 +935,9 @@ sub CancelHold { my $reserve_id = $cgi->param('item_id'); my $hold = Koha::Holds->find( $reserve_id ); return { code => 'RecordNotFound' } unless $hold; - return { code => 'RecordNotFound' } unless ($hold->borrowernumber == $borrowernumber); + + # Check if reserve belongs to the borrower and if it is in a state which allows cancellation + return { code => 'BorrowerCannotCancelHold' } unless CanReserveBeCanceledFromOpac( $reserve_id, $borrowernumber ); $hold->cancel; --