Bug 17247: Check if patron is restricted in HoldItem and HoldTitle
authorArthur Suzuki <arthur.suzuki@biblibre.com>
Mon, 13 May 2019 09:29:50 +0000 (11:29 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 15 Oct 2019 13:10:54 +0000 (14:10 +0100)
Test plan:
Make sure a restricted patron cannot hold a title or item through ILS-DI.
Response from the WebService should be "PatronDebarred".

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/ILSDI/Services.pm

index 049ddcf..fbc77e3 100644 (file)
@@ -688,6 +688,9 @@ sub HoldTitle {
     my $patron = Koha::Patrons->find( $borrowernumber );
     return { code => 'PatronNotFound' } unless $patron;
 
+    # If borrower is debarred return an error code
+    return { code => 'PatronDebarred' } if $patron->is_debarred;
+
     # Get the biblio record, or return an error code
     my $biblionumber = $cgi->param('bib_id');
     my $biblio = Koha::Biblios->find( $biblionumber );
@@ -773,6 +776,9 @@ sub HoldItem {
     my $patron = Koha::Patrons->find( $borrowernumber );
     return { code => 'PatronNotFound' } unless $patron;
 
+    # If borrower is debarred return an error code
+    return { code => 'PatronDebarred' } if $patron->is_debarred;
+
     # Get the biblio or return an error code
     my $biblionumber = $cgi->param('bib_id');
     my $biblio = Koha::Biblios->find( $biblionumber );