From d9b1b11b7b1e9bddd63085600216f07c803e398e Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Tue, 28 Mar 2017 14:21:29 -0400
Subject: [PATCH] Bug 18251 - (QA Followup) Add 'renew' operation and check
 renewal vs checkout

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 6 +++---
 opac/sco/sco-main.pl                                     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
index a8ab8ce..736412a 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
@@ -114,7 +114,7 @@
 
                             [% UNLESS ( renew ) %]
                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
-                                    <input type="hidden" name="op" value="checkout" />
+                                    <input type="hidden" name="op" value="renew" />
                                     <input type="hidden" name="patronid" value="[% patronid %]" />
                                     <input type="hidden" name="barcode" value="[% barcode %]" />
                                     <input type="hidden" name="confirmed" value="1" />
@@ -122,7 +122,7 @@
                                   </form>
                             [% ELSE %]
                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
-                                    <input type="hidden" name="op" value="checkout" />
+                                    <input type="hidden" name="op" value="renew" />
                                     <input type="hidden" name="patronid" value="[% patronid %]" />
                                     <input type="hidden" name="barcode" value="[% barcode %]" />
                                     <input type="hidden" name="confirmed" value="1" />
@@ -278,7 +278,7 @@
                                                         <input type="hidden" name="patronid" value="[% patronid %]" />
                                                         <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
                                                         [% IF ISSUE.can_be_renewed %]
-                                                            <input type="hidden" name="op" value="checkout" />
+                                                            <input type="hidden" name="op" value="renew" />
                                                             <input type="hidden" name="confirmed" value="1" />
                                                             [% UNLESS ( ISSUE.renew ) %]
                                                                 <input type="submit" value="Renew item"  name="confirm  " class="btn renew" />
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index 721399d..79ea689 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -135,7 +135,7 @@ elsif ( $op eq "returnbook" && $allowselfcheckreturns ) {
     $template->param( returned => $doreturn );
     $borrower = GetMember( cardnumber => $patronid );
 }
-elsif ( $op eq "checkout" ) {
+elsif ( $op eq "checkout" || $op eq 'renew' ) {
     my $impossible  = {};
     my $needconfirm = {};
     if ( !$confirmed ) {
@@ -174,7 +174,7 @@ elsif ( $op eq "checkout" ) {
                 barcode    => $barcode,
             );
         }
-    } elsif ( $needconfirm->{RENEW_ISSUE} ) {
+    } elsif ( $needconfirm->{RENEW_ISSUE} || $op eq 'renew' ) {
         if ($confirmed) {
             #warn "renewing";
             AddRenewal( $borrower, $item->{itemnumber} );
-- 
2.9.3