From eaa82972f4f4f6a0dfa11e59966b399682a11575 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Fri, 5 Apr 2019 15:13:36 -0300
Subject: [PATCH] Bug 22068: (QA follow-up) Return meaningful error codes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 opac/opac-article-request-cancel.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/opac/opac-article-request-cancel.pl b/opac/opac-article-request-cancel.pl
index 0305808a4b..ef9f75345d 100755
--- a/opac/opac-article-request-cancel.pl
+++ b/opac/opac-article-request-cancel.pl
@@ -41,10 +41,14 @@ my $id = $query->param('id');
 
 if ( $id ) {
     my $ar = Koha::ArticleRequests->find( $id );
-    if ( !$ar || $ar->borrowernumber != $borrowernumber ) {
+    if ( !$ar ) {
         print $query->redirect("/cgi-bin/koha/errors/404.pl");
         exit;
     }
+    elsif ( $ar->borrowernumber != $borrowernumber ) {
+        print $query->redirect("/cgi-bin/koha/errors/403.pl");
+        exit;
+    }
 
     $ar->cancel();
 }
-- 
2.21.0