[Koha-patches] [PATCH] fix for bug-2923, corrects renew status in SCO

Mason James mason.loves.sushi at gmail.com
Thu Jan 22 23:04:50 CET 2009


 - removes unneeded  HTML::Template::Pro
 - some indent/newline tidies



---
 C4/Circulation.pm                                  |    2 +-
 .../opac-tmpl/prog/en/modules/sco/sco-main.tmpl    |   11 ++++--
 opac/sco/sco-main.pl                               |   36 +++++++++++--------
 3 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 372b5e8..7c88dc7 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -792,7 +792,7 @@ sub CanBookBeIssued {
     elsif ($issue->{borrowernumber}) {
 
         # issued to someone else
-        my $currborinfo = GetMemberDetails( $issue->{borrowernumber} );
+        my $currborinfo =    C4::Members::GetMemberDetails( $issue->{borrowernumber} );
 
 #        warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
         $needsconfirmation{ISSUED_TO_ANOTHER} =
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl
index 2b085fa..39c4922 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl
@@ -92,6 +92,7 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 	<form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
 	<fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
 	<input type="text" id="patronid" class="unfocus" size="20" name="patronid" />
+
  	<!-- TMPL_LOOP NAME="INPUTS" --><input type="hidden" name="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="value" -->"><!-- /TMPL_LOOP -->
 	<input type="hidden" name="op" value="login" />
  	<input	type="submit" value="Submit" class="submit" /></fieldset></form>
@@ -116,6 +117,7 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 	<table><caption>Issues for <!-- TMPL_VAR NAME='borrowername' --> <span class="count">(<!-- TMPL_VAR NAME="issues_count" --> total)</span></caption>
 	<!-- ISSUES TABLE ROWS -->
 	<tr><th>Title</th><th>Call No.</th><th>Due</th><th>Renew</th><!-- TMPL_UNLESS NAME="nofines" --><th>Fines</th><!-- /TMPL_UNLESS --></tr>
+
 	<!-- TMPL_LOOP NAME="ISSUES" -->
 	<!-- TMPL_UNLESS name="__odd__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_UNLESS -->
 	<td><!-- TMPL_IF NAME="amazonimages" --> <!-- TMPL_IF NAME="isbn" --><a href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><img src="http://images.amazon.com/images/P/<!-- TMPL_VAR name="isbn" -->.01.THUMBZZZ.jpg" alt="Book Cover Image" class="thumbnail" /></a><!-- /TMPL_IF --> <!-- /TMPL_IF --><!-- TMPL_UNLESS NAME="noitemlinks" --><a href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a><!-- TMPL_ELSE --><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong><!-- /TMPL_UNLESS --><span class="item-details">
@@ -123,10 +125,13 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 	<td><!-- TMPL_IF NAME="itemcallnumber" --> <!-- TMPL_VAR NAME="itemcallnumber" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td>
 	<!-- TMPL_IF NAME="overdue" --><td class="overdue"><!-- TMPL_VAR NAME="date_due" --></td><!-- TMPL_ELSE --><td><!-- TMPL_VAR NAME="date_due" --></td><!-- /TMPL_IF -->
 	<td>
-	<!-- TMPL_IF NAME="status" -->
+	<!-- TMPL_IF NAME="status" --> 	<!-- FIXME? where does 'status' come from? -->
 	<a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=<!-- TMPL_VAR NAME="itemnumber" -->&amp;bornum=<!-- TMPL_VAR NAME="borrowernumber" -->">Renew</a>
-	<!-- TMPL_ELSE -->
-	Not renewable<!-- /TMPL_IF -->
+	<!-- TMPL_ELSIF NAME="norenew" -->
+	Not renewable
+	<!-- TMPL_ELSE  -->
+	Renewable
+    <!-- /TMPL_IF -->
 	</td>
 	<!-- TMPL_UNLESS NAME="nofines" --><td><!-- TMPL_IF NAME="charges" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td><!-- /TMPL_UNLESS --></tr>
 	<!-- /TMPL_LOOP -->
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index e7ff367..62d8760 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -2,7 +2,7 @@
 # This code has been modified by Trendsetters (originally from opac-user.pl)
 # This code has been modified by rch
 # We're going to authenticate a self-check user.  we'll add a flag to borrowers 'selfcheck'
-# We're in a controlled environment; we trust the user. so the selfcheck station will accept a patronid and 
+# We're in a controlled environment; we trust the user. so the selfcheck station will accept a patronid and
 # issue items to that borrower.
 #
 use strict;
@@ -18,7 +18,7 @@ use C4::Reserves;
 use C4::Search;
 use C4::Output;
 use C4::Members;
-use HTML::Template::Pro;
+#use HTML::Template::Pro;
 use C4::Dates;
 use C4::Biblio;
 use C4::Items;
@@ -30,7 +30,7 @@ my ($template, $loggedinuser, $cookie)
                              type => "opac",
                              authnotrequired => 0,
                              flagsrequired => { circulate => "circulate_remaining_permissions" },
-                             debug => 1,
+                             debug => 0,
                              });
 my $dbh = C4::Context->dbh;
 
@@ -39,8 +39,8 @@ my ($op, $patronid, $barcode, $confirmed, $timedout) = (
     $query->param("op")         || '',
     $query->param("patronid")   || '',
     $query->param("barcode")    || '',
-    $query->param( "confirmed") || '',
-    $query->param( "timedout")  || '', #not actually using this...
+    $query->param("confirmed")  || '',
+    $query->param("timedout")   || '', #not actually using this...
 );
 
 my %confirmation_strings = ( RENEW_ISSUE => "This item is already checked out to you.  Return it?", );
@@ -65,7 +65,7 @@ if ($op eq "logout") {
      #warn "returnbook: " . $doreturn;
     ($borrower) = GetMemberDetails(undef, $patronid);
   }
-  
+
   if ($op eq "checkout" ) {
 	my $impossible = {};
 	my $needconfirm = {};
@@ -113,7 +113,7 @@ if ($op eq "logout") {
       	    #warn "issuing book?";
             AddIssue($borrower,$barcode);
 	#    ($borrower, $flags) = getpatroninformation(undef,undef, $patronid);
-		
+
        #    $template->param( patronid => $patronid,
 #			validuser => 1,
 #			);
@@ -136,14 +136,20 @@ if ($borrower->{cardnumber}) {
 	my $bornum = $borrower->{borrowernumber};
 	my $borrowername = $borrower->{firstname} . " " . $borrower->{surname};
 	my @issues;
-	my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'});
-	foreach my $it ( @$issueslist ) {
-		push @issues, $it;
-		$cnt++;
-	}
-   $template->param(  validuser => 1,  
+
+    my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
+    foreach my $it (@$issueslist) {
+
+        my ( $renewokay, $renewerror ) =
+                CanBookBeIssued( $borrower, $it->{'barcode'}, '', '' );
+        $it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'} == 1;
+        push @issues, $it;
+        $cnt++;
+    }
+
+   $template->param(  validuser => 1,
    			borrowername => $borrowername,
-			issues_count => $cnt, 
+			issues_count => $cnt,
 			ISSUES => \@issues,,
 			patronid => $patronid ,
 			noitemlinks => 1 ,
@@ -156,7 +162,7 @@ if ($borrower->{cardnumber}) {
       $inputfocus = 'confirm' ;
    } else {
       $inputfocus = 'barcode' ;
-    }
+   }
 
 $template->param( inputfocus => $inputfocus,
 		nofines => 1,
-- 
1.5.6.5




More information about the Koha-patches mailing list