[Koha-patches] [PATCH] Cleanup SCO - OPAC self checkout

Joe Atzberger joe.atzberger at liblime.com
Wed Jun 3 08:24:16 CEST 2009


~ vestigial broken scripts and templates removed
~ meaningless dependencies removed
~ Focus handling issues resolved for cross-browsers
~ Timeout only invoked for non-first screen.  This keeps the refresh from
flooding the logs continuously for no purpose.
~ two halves of "validuser" conditional linked in TMPL
~ elsif's used for $op conditionals

The focus should now appear on the "Return to Account Summary" button during errors.
The user can scan anything (w/ carriage return) and get back to the first screen.
Also, special functionality is added for the magic barcode "__KOHA_NEW_CIRC__".
This effectively ends the patron session and logs them out so the next patron can begin.
The purpose is for patrons to avoid having to use a keyboard at all, if libraries
print and have this special barcode available for patrons at the SCO station.

Enhancement was requested by Plano Independent School District.
---
 .../opac-tmpl/prog/en/modules/sco/circulation.tmpl |  172 ------
 koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl  |   16 +-
 .../opac-tmpl/prog/en/modules/sco/sco-circ.tmpl    |  109 ----
 .../opac-tmpl/prog/en/modules/sco/sco-main.tmpl    |   92 +++--
 opac/sco/abort.pl                                  |   38 --
 opac/sco/help.pl                                   |   36 +-
 opac/sco/printer.pl                                |  556 --------------------
 opac/sco/sco-circ.pl                               |  211 --------
 opac/sco/sco-main.pl                               |  143 +++---
 9 files changed, 146 insertions(+), 1227 deletions(-)
 delete mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/sco/circulation.tmpl
 delete mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-circ.tmpl
 delete mode 100755 opac/sco/abort.pl
 delete mode 100755 opac/sco/printer.pl
 delete mode 100755 opac/sco/sco-circ.pl

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/circulation.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/circulation.tmpl
deleted file mode 100644
index ffdf677..0000000
--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/circulation.tmpl
+++ /dev/null
@@ -1,172 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Koha Self Checkout</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/sco.css" />
-<script type="text/javascript" language="JavaScript">
-    <!-- Hide from old browsers
-    function openWindow(targeturl, windowname) {
-        newwin =
-        window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable")
-    }
-    function focusOnFirst (){
-        document.forms[1].elements[0].focus();
-    }
-
-    function abort(){
-        window.open("/cgi-bin/koha/sco/abort.pl","aborting","height=5,width=5");
-    }
-    // end hiding -->
-</script>
-</head>
-<body onload="focusOnFirst();" onblur="self.focus();">
-<!-- TMPL_IF name="loggedinusername" -->
-<h3><!-- TMPL_VAR NAME="libraryname" --> Self Checkout System</h3>
-
-<div id="main">
-<div class="form">
-<!-- TMPL_IF NAME="dbarred" -->
-<div class="error"><h3>Sorry, checkout cannot proceed</h3>
-There is a problem with your account.  Please ask for help at the circulation desk.
-<div id="abort"><form method="get" action="/cgi-bin/koha/sco/abort.pl">
-<input type="submit" value="Please Click Here to Exit" class="complete"  /></form></div>
-</div>
-<!-- /TMPL_IF --><!-- /TMPL_IF -->
-
-
-
-<!-- TMPL_IF name="question" -->
-	<div class="error">
-		<h3>Issuing Question</h3>
-		<p>Attempting to issue <!-- TMPL_VAR name="title" escape="html" -->
-							by <!-- TMPL_VAR name="author" --> to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" -->.</p>
-							<p><!-- TMPL_VAR name="question" --></p>
-          <form action="/cgi-bin/koha/sco/circulation.pl" method="get">
-            <input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->" />
-            <input type="hidden" name="barcode" value="<!-- TMPL_VAR name="barcode" -->" />
-            <input type="hidden" name="questionnumber" value="<!-- TMPL_VAR name="questionnumber" -->" />
-            <input type="hidden" name="day" value="<!-- TMPL_VAR name="day" -->" />
-            <input type="hidden" name="month" value="<!-- TMPL_VAR name="month" -->" />
-            <input type="hidden" name="year" value="<!-- TMPL_VAR name="year" -->" />
-            <input type="hidden" name="stickyduedate" value="<!-- TMPL_VAR name="stickyduedate" -->" />
-            <input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->" />
-            <input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->">
-            <!-- TMPL_LOOP NAME="responseloop" -->
-              <input type="hidden" name="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="value" -->" />
-            <!-- /TMPL_LOOP -->
-            <input type="hidden" name="answer" value="Y" />
-            <input type="submit" value="  Yes  " class="confirm">
-          </form>
-
-          <form action="/cgi-bin/koha/sco/circulation.pl" method="get">
-            <input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->" />
-            <input type="hidden" name="barcode" value="<!-- TMPL_VAR name="barcode" -->" />
-            <input type="hidden" name="questionnumber" value="<!-- TMPL_VAR name="questionnumber" -->" />
-            <input type="hidden" name="day" value="<!-- TMPL_VAR name="day" -->" />
-            <input type="hidden" name="month" value="<!-- TMPL_VAR name="month" -->" />
-            <input type="hidden" name="year" value="<!-- TMPL_VAR name="year" -->" />
-            <input type="hidden" name="stickyduedate" value="<!-- TMPL_VAR name="stickyduedate" -->" />
-            <input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->" />
-            <input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->" />
-            <!-- TMPL_LOOP NAME="responseloop" -->
-             <input type="hidden" name="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="value" -->" />
-            <!-- /TMPL_LOOP -->
-            <input type="hidden" name="answer" value="N" />
-            <input type="submit" value=" No " class="reject">
-          </form>
-	</div>
-	<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="rejected" -->
-	<div class="error">
-		<h3>Error Issuing Book</h3>
-		<!-- TMPL_VAR name="rejected" -->
-	</div>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="message" -->
-	<div class="error">
-		<h3>No borrower matched <!-- TMPL_VAR name="message" --></h3>
-	</div>
-<!-- /TMPL_IF -->
-
-
-<!-- TMPL_IF name="loggedinusername" -->
-<!-- TMPL_UNLESS NAME="dbarred" --><div id="complete">
-<form method="get" action="/cgi-bin/koha/sco/printer.pl"><input type="submit"
-value="Click Here to 
-Complete Transaction" class="complete" /></form>
-</div>
-<form method="post" action="/cgi-bin/koha/sco/circulation.pl">
-<h4>Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR name="cardnumber" -->)</h4>
-<label
-for="barcode">Enter the item barcode:</label> <input id="barcode"
-name="barcode" size="14" maxlength="14" class="unfocus" onfocus="this.className='focus';" onblur="this.className='unfocus';" /> <input
-type="submit" value="Submit" class="submit" /><input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->" /><input type="hidden" name="branch" value="<!-- TMPL_VAR name="branch" -->" /><input type="hidden" name="printer" value="<!-- TMPL_VAR name="printer" -->" /><input type="hidden" name="print" value="maybe" /><!-- TMPL_IF name="CHARGES" --><input type="hidden" name="charges" value="yes" /><input type="hidden" name="oldamount" value="<!-- TMPL_VAR name="amountold" -->" />
-					<!-- /TMPL_IF -->
-</form>
-<!-- Begin Code Added By Suneeta Polisetty -->
-<script language="JavaScript">
-function callPrint()
-{
-	//var receipt = window.open('/opac-tmpl/default/en/sco/receipt.html');
-      var receipt = window.open('/cgi-bin/koha/sco/printer.pl');
-
-      receipt.document.open();
-      receipt.document.close();
-      receipt.print();
-      receipt.close();
-}
-
-function closeThis()
-{
-   // Begin code modified by Christina Lee
-   javascript:window.opener.location='/cgi-bin/koha/sco/sco-main.pl?logout.x=1';
-   // End code modified by Christina Lee
-   self.close();
-}
-</script> 
-
-<!-- End Code Added By Suneeta Polisetty--><!-- /TMPL_UNLESS -->
-</div>
-
-<!-- TMPL_IF name="todayissues" -->
-<table>
-     <caption>Today's Issues</caption>  
-	<tr>
-		<!-- <th>Bar Code</th> --><th colspan="2">Title</th><th>Author</th><th>Call No.</th><th>Due Date</th>
-	</tr>
-	<!-- TMPL_LOOP name="todayissues" -->
-	 <tr>
-	 	
-		<td><img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" align="left" title="<!-- TMPL_VAR NAME="itemtype" -->" alt="" /></td>
-	 	<!-- <td><!-- TMPL_VAR NAME="barcode" --></td> -->
-	    <td><!-- TMPL_VAR NAME="title" escape="html" --></td>
-	    <td><!-- TMPL_VAR NAME="author" --></td>
-		<td><!-- TMPL_VAR NAME="classification" --></td><td><!-- TMPL_VAR NAME="dd" --></td>		
-	</tr>
-	<!-- /TMPL_LOOP -->
-</table>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="previssues" -->
-	<table>
-	<caption>Previous Issues</caption>
-		<tr>
-			<!-- <th>Bar Code</th> --><th colspan="2">Title</th><th>Author</th><th>Call No.</th><th>Due Date</th> 
-		</tr>
-	<!-- TMPL_LOOP name="previssues" -->
-	    <tr>
-			
-			<!-- <td><!-- TMPL_VAR NAME="barcode" --></td> -->
-			<td><img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" align="left" title="<!-- TMPL_VAR NAME="itemtype" -->" alt="" /></td>
-			<td><!-- TMPL_VAR NAME="title" escape="html" --></td>
-			<td><!-- TMPL_IF NAME="author" --><!-- TMPL_VAR NAME="author" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td>
-			<td><!-- TMPL_IF NAME="classification" --><!-- TMPL_VAR NAME="classification" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td><td><!-- TMPL_IF NAME="od" --><font color="red"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="dd" --><!-- TMPL_IF NAME="od" --></font><!-- /TMPL_IF --></td>
-		</tr><!-- /TMPL_LOOP --></table>
-<!-- /TMPL_IF --></div>
-<!-- /TMPL_IF -->
-</body>
-</html>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl
index ba4f665..01abb42 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl
@@ -3,14 +3,12 @@
 <meta name="generator" content="Koha <!-- TMPL_VAR NAME="Version" -->" /> <!-- leave this for stats -->
 <link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" />
 
-<!-- <script type="text/javascript" src="<TMPL_VAR NAME="themelang">/js/sco.js"></script> -->
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/sco.css" />
 </head>
 <body>
 <div id="doc" class="yui-t7">
-   <div id="bd">
-	<div class="yui-g">
-
+  <div id="bd">
+    <div class="yui-g">
 
 <h1>Self Checkout Help</h1>
 
@@ -18,7 +16,7 @@
 is not behaving as expected, you may want to refer to this guide to get
 yourself started.</p>
 
-<h3>Step One: Enter your user id    </h3>
+<h3>Step One: Enter your user id</h3>
 <p>Enter your User ID, and click the submit button (or press the enter key).</p>
 
 <h3>Step Two: Scan the barcode for each item, one at a time</h3>
@@ -26,11 +24,11 @@ yourself started.</p>
 The checked-out item should appear in your issues list.
 The Submit button only needs to be clicked if you enter the barcode manually.</p>
 
-<h3>Step Three: Click the 'Click here if done' link when done.</h3>
+<h3>Step Three: Click the 'Click here if done' link when done</h3>
 
-<div class="button">
-<a href="javascript:history.go(-1)">Return to the Self-Checkout</a>
-</div>
+    <div class="button">
+        <a href="javascript:history.go(-1)">Return to the Self-Checkout</a>
+    </div>
 
 </div></div></div>
 </body>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-circ.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-circ.tmpl
deleted file mode 100644
index 6c2a2b6..0000000
--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-circ.tmpl
+++ /dev/null
@@ -1,109 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Koha Self Checkout</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/sco.css" />
-<script type="text/javascript" language="JavaScript">
-    <!-- Hide from old browsers
-    function openWindow(targeturl, windowname) {
-        newwin =
-        window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable")
-    }
-    function focusOnFirst (){
-        document.forms[1].elements[0].focus();
-    }
-
-    function abort(){
-        window.open("/cgi-bin/koha/sco/abort.pl","aborting","height=5,width=5");
-    }
-    // end hiding -->
-</script>
-</head>
-<body onload="focusOnFirst();" onblur="self.focus();">
-
-<!-- TMPL_IF name="loggedinusername" -->
-<h3><!-- TMPL_VAR NAME="libraryname" --> Self Checkout System</h3>
-
-<div id="main">
-<div class="form">
-<!-- TMPL_IF NAME="dbarred" -->
-<div class="error"><h3>Sorry, checkout cannot proceed</h3>
-There is a problem with your account.  Please ask for help at the circulation desk.
-<div id="abort"><form method="get" action="#">
-<input type="submit" value="Please Click Here to Exit" class="complete" onclick="self.close();"  /></form></div>
-</div>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="confirm" -->
-	<div class="error">
-		<h3>Warning:</h3>
-		<p>Attempting to issue <!-- TMPL_VAR name="title" escape="html" --> <br />
-			to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" -->.</p>
-		<p><!-- TMPL_VAR name="confirm" --></p>
-		<form action="/cgi-bin/koha/sco/sco-circ.pl" method="get">
-		  <input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->" />
-		  <input type="hidden" name="barcode" value="<!-- TMPL_VAR name="barcode" -->" />
-		  <input type="button" name="confirmed" value="Confirm?" />
-		  <input type="button" name="cancel" value="Cancel" />
-		</form>
-	</div>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="impossible" -->
-	<div class="error">
-		<h3>Error Issuing Book</h3>
-		<!-- TMPL_VAR name="impossible" -->
-	</div>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="message" -->
-	<div class="error">
-		<h3>No borrower matched <!-- TMPL_VAR name="message" --></h3>
-	</div>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_UNLESS NAME="dbarred" -->
-<div id="complete">
-<form method="get" action="/cgi-bin/koha/sco/abort.pl"><input type="submit" value="Click Here to End Transaction" class="complete" onclick="self.close();" />
-</form>
-</div>
-<form method="post" action="/cgi-bin/koha/sco/sco-circ.pl">
-<h4>Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR name="cardnumber" -->)</h4>
-<label for="barcode">Scan a new item or enter its barcode:</label> 
-<input id="barcode" name="barcode" size="14" maxlength="14" class="unfocus" onfocus="this.className='focus';" onblur="this.className='unfocus';" /> 
-<input type="submit" value="Submit" class="submit" />
-<input type="hidden" name="borrnumber" value="<!-- TMPL_VAR name="borrowernumber" -->" />
-</form>
-<!-- /TMPL_UNLESS -->
-<!-- /TMPL_IF -->
-
-<div id="borrowerdetails">
-<!-- TMPL_IF NAME="issues_count" -->
-<div class="table"><table><caption>Issues <span class="count">(<!-- TMPL_VAR NAME="issues_count" --> total)</span></caption>
-<!-- ISSUES TABLE ROWS -->
-<tr><th colspan="2">Title</th><th>Call No.</th><th>Due</th><th>Renew</th><th>Fines</th></tr>
-<!-- TMPL_LOOP NAME="ISSUES" -->
-<!-- TMPL_IF NAME="overdue" --><tr class="overdue"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-<td><!-- TMPL_IF NAME="itemtypeimages" --> <img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" alt="<!-- TMPL_VAR NAME="description" -->" title="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --></td>
-<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 --><a href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a><span class="item-details">
-<!-- TMPL_VAR NAME="author" --></span></td>
-<td><!-- TMPL_VAR NAME="classification" --></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" -->
-<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 -->
-</td>
-<td><!-- TMPL_IF NAME="charges" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td></tr>
-<!-- /TMPL_LOOP -->
-</table>
-</div>
-</div> <!-- borrowerdetails -->
-
-</div>
-<!-- /TMPL_IF -->
-</body>
-</html>
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 2efaedb..39a64a9 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
@@ -3,24 +3,51 @@
 <meta name="generator" content="Koha <!-- TMPL_VAR NAME="Version" -->" /> <!-- leave this for stats -->
 <link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" />
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/jquery.js"></script>
-<script type="text/javascript" src="<TMPL_VAR NAME="themelang">/js/sco.js"></script>
 <script type="text/javascript">//<![CDATA[
-	$(document).ready(function(){
-		sco_init(1);
-		$(".unfocus").focus();
-	});
+function sco_init(valid_session) {
+    if (valid_session == 1) {
+        setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",120000); // TODO: syspref for timeout
+    }
+}
+function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
+    // alert("dofocus called");
+    $(".focus:last").select();
+}
+
+function checkout_confirm(patronid) {
+    var   barcode = $("#barcode").val();
+    // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
+    if (! barcode) { dofocus(); return false; }    // no barcode
+    if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode 
+        window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
+        return false;
+    }
+    if (this.valid_session == 0) {
+        // probably should force logout like above ? --atz 6/09
+        if (confirm('Session has expired.  Click \'OK\' to continue processing this item.  Click Cancel if you are not ' + patronid)){
+            this.op.value='logout';
+            this.patronid.value='';
+        }
+    }
+    return true;
+}
+
+$(document).ready(function() {
+    <!-- TMPL_IF    NAME="patronid" --> sco_init(1);
+    <!-- TMPL_ELSIF NAME="timedout" --> sco_init(1);
+    <!-- /TMPL_IF -->
+});
 //]]>
 </script>
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/css/sco.css" />
 </head>
-<body>
+<body onload="dofocus();">
 
 <div id="doc" class="yui-t7">
 
-<div id="masthead"><h1><!-- TMPL_VAR NAME="LibraryName" --> Self Checkout System </h1></div>
-
-   <div id="bd">
-	<div class="yui-g">
+<div id="masthead"><h1><!-- TMPL_VAR NAME="LibraryName" --> Self Checkout System</h1></div>
+<div id="bd">
+    <div class="yui-g">
 
 <!-- TMPL_IF NAME="impossible" --><!-- We tried to issue, but failed. -->
 <div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, This item cannot be checked out at this station.  </p>
@@ -33,7 +60,7 @@
 <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
 <input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
 <!-- /TMPL_IF -->
-<input type="submit" name= "confirm" value="Return to Account Summary" class="back" />
+<input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" />
 </div>
 <!-- /TMPL_IF -->
 <!-- TMPL_IF NAME="confirm" --><!-- We need to confirm the issue.. -->
@@ -44,7 +71,7 @@
 <input type="hidden" id="op" name="op" value="checkout" />
 <input type="hidden" name="patronid" value="<!-- TMPL_VAR NAME="patronid" -->" />
 <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
-<input type="hidden" id="confirmation"  name="confirmed" value=""  />
+<input type="hidden" id="confirmation"  name="confirmed" value="" />
 <!-- TMPL_IF NAME="renew" -->
 <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
 <!-- /TMPL_IF -->
@@ -67,8 +94,9 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 <!-- TMPL_UNLESS NAME="hide_main" -->
 	<div class="sco_head">
 	<!-- TMPL_UNLESS NAME="validuser" --> 
-	<h3> <!-- TMPL_VAR NAME="libraryname" --> Self Checkout </h3>
+	<h3>Self Checkout</h3>
 	<!-- /TMPL_UNLESS -->
+
 	<div id="checkouthelp">
 		<a href="/cgi-bin/koha/sco/help.pl">HELP</a> with the self checkout system
 	</div>
@@ -79,31 +107,21 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 	<!-- /TMPL_IF -->
 	</div>
 	<!-- TMPL_IF NAME="nouser" -->
-	<div class="error"><h4>Sorry</h4><p>The userid <!-- TMPL_VAR NAME="patronid" --> was not found in the database.  Please try again.</p></div>
+	<div class="error"><h4>Sorry</h4><p>The userid <strong><!-- TMPL_VAR NAME="patronid" --></strong> was not found in the database.  Please try again.</p></div>
 	<br />
 	<!-- /TMPL_IF -->
 	<!-- /TMPL_IF -->
+
 	<!-- TMPL_IF NAME="timedout" -->
 	<div class="error"><h4>Sorry</h4><p>Your session has timed out due to inactivity.  Please sign in.</p></div>
 	<br />
 	<!-- /TMPL_IF -->
-	<!-- TMPL_UNLESS NAME="validuser" -->
-	<div class="sco_entry" >
-	<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>
-	</div>
-	<!-- /TMPL_UNLESS -->
 	<!-- TMPL_IF NAME="validuser" -->
 	<div id="newcheckout" class="sco_entry">
-	<form id="mainform" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit=" if(this.valid_session == 0) { if(confirm('Session has expired.  Click \'OK\' to continue processing this item.  Click Cancel if you are not <!-- TMPL_VAR NAME="patronid" -->.')){ this.op.value='logout'; this.patronid.value=''; } return true;}; " >
+	<form id="mainform" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('<!-- TMPL_VAR NAME='patronid' -->');">
 	<fieldset><legend> Check out or return an item: </legend>
 	<label for="barcode">Scan a new item or enter its barcode:</label>
-	<input id="barcode" name="barcode" size="20" class="unfocus" onfocus="this.className='focus';" onblur="this.className='unfocus';" />
+	<input id="barcode" name="barcode" size="20" class="focus" />
 	<input type="hidden" name="op" value="checkout" />
 	<input type="hidden" name="patronid" value="<!-- TMPL_VAR name="patronid" -->" />
 	<input type="hidden" name="valid_session" value="1" />
@@ -120,9 +138,10 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 
 	<!-- TMPL_LOOP NAME="ISSUES" -->
 	<!-- TMPL_UNLESS name="__odd__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_UNLESS -->
+    <!-- FIXME: yet another jacket image breakpoint -->
 	<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">
 	<!-- TMPL_VAR NAME="author" --></span> (<!-- TMPL_VAR NAME="barcode" -->)</td>
-	<td><!-- TMPL_IF NAME="itemcallnumber" --> <!-- TMPL_VAR NAME="itemcallnumber" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td>
+	<td><!-- TMPL_VAR NAME="itemcallnumber" DEFAULT="&nbsp;" --></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>
     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post">
@@ -130,11 +149,11 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
     <input type="hidden" name="patronid" value="<!-- TMPL_VAR NAME="patronid" -->" />
     <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
     <input type="hidden" id="confirmation"  name="confirmed" value=""  />
-	<!-- TMPL_IF NAME="norenew" -->
+        <!-- TMPL_IF NAME="norenew" -->
         <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
-	<!-- TMPL_ELSE  -->
+        <!-- TMPL_ELSE  -->
         <input type="button" value="Renew Item" <!-- TMPL_UNLESS NAME="renew" --> name="confirm"<!-- /TMPL_UNLESS --> class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
-    <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
     </form>
 	</td>
 	<!-- TMPL_UNLESS NAME="nofines" --><td><!-- TMPL_IF NAME="charges" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td><!-- /TMPL_UNLESS --></tr>
@@ -145,11 +164,20 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 	<h3>You currently have nothing checked out.</h3>
 	<!-- /TMPL_IF -->
 	</div> <!-- borrowerdetails -->
+	<!-- TMPL_ELSE --><!-- not validuser -->
+	<div class="sco_entry" >
+	<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="focus" 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>
+	</div>
 	<!-- /TMPL_IF -->
 <!-- /TMPL_UNLESS --> <!-- ( / hide main) -->	
 	
 	</div>
-
 	</div>
 </div>
 <!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
diff --git a/opac/sco/abort.pl b/opac/sco/abort.pl
deleted file mode 100755
index 12a2487..0000000
--- a/opac/sco/abort.pl
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/perl
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Output;
-use C4::Auth;
-use HTML::Template::Pro;
-
-
-my $query = new CGI;
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => 'sco/abort.tmpl',
-			     query => $query,
-			     type => "opac",
-			     authnotrequired => 0,
-			     flagsrequired => {circulate => "circulate_remaining_permissions"},
-
-			     });
-
-output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/opac/sco/help.pl b/opac/sco/help.pl
index bde37d9..b2cbd00 100755
--- a/opac/sco/help.pl
+++ b/opac/sco/help.pl
@@ -1,28 +1,26 @@
 #!/usr/bin/perl
-# This code has been modified by Trendsetters (originally from circulation.pl)
+#
+# This code  (originally from circulation.pl) has been modified by:
+#   Trendsetters, 
+#   dan, and
+#   Christina Lee.
+
 use strict;
+use warnings;
 use CGI;
 
-use C4::Auth;
-use C4::Output;
-use HTML::Template::Pro;
+use C4::Auth   qw(get_template_and_user);
+use C4::Output qw(output_html_with_http_headers);
 
-# begin code modifed by dan
 my $query = new CGI;
-my ($template, $borrowernumber, $cookie) 
-#Begin code modified by Christina Lee
-# function comes from C4::Auth
-    = get_template_and_user({template_name => "sco/help.tmpl",
-#End code modified by Christina Lee
-			     query => $query,
-			     type => "opac",
-			     authnotrequired => 1,
-			     flagsrequired => {circulate => "circulate_remaining_permissions"},
-			     debug => 1,
-			     });
-# end code modified by dan
-
+my ($template, $borrowernumber, $cookie) = get_template_and_user({
+    template_name => "sco/help.tmpl",
+    query => $query,
+     type => "opac",
+    debug => 1,
+    authnotrequired => 1,
+      flagsrequired => {circulate => "circulate_remaining_permissions"},
+});
 
-# function comes from C4::Interface::CGI::Output
 output_html_with_http_headers $query, $cookie, $template->output;
 
diff --git a/opac/sco/printer.pl b/opac/sco/printer.pl
deleted file mode 100755
index c75220c..0000000
--- a/opac/sco/printer.pl
+++ /dev/null
@@ -1,556 +0,0 @@
-#!/usr/bin/perl
-#this code has been modified (slightly) by Trendsetters (originally from circulation.pl)
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
-#written 8/5/2002 by Finlay
-#script to execute issuing of books
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Circulation;
-use C4::Search;
-use C4::Output;
-use C4::Print;
-use DBI;
-use C4::Authsco;
-use C4::Output;
-use C4::Koha;
-use HTML::Template::Pro;
-use C4::Dates;
-
-my $query=new CGI;
-#my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
-#	($query, 0, { circulate => 1 });
-
-my ($template, $loggedinuser, $cookie) = get_template_and_user
-    ({
-#Begin code modified by Christina Lee
-	template_name	=> 'sco/receipt.tmpl',
-	query		=> $query,
-	type		=> "opac",
-	authnotrequired	=> 0,
-	flagsrequired	=> { circulate => "circulate_remaining_permissions" },
-# End Code Modified by Christina Lee
-    });
-
-#Begin code by Christina Lee--Sets variable $borr equal to loggedinuser's data
-my ($borr, $flags) = getpatroninformation(undef, $loggedinuser);
-# End code by Christina Lee
-
-my %env;
-my $linecolor1='#339999';
-my $linecolor2='white';
-
-my $branches = getbranches();
-my $printers = getprinters(\%env);
-
-my $branch = "APL"; #getbranch($query, $branches);
-my $printer = getprinter($query, $printers);
-
-
-#set up cookie.....
-my $branchcookie;
-my $printercookie;
-if ($query->param('setcookies')) {
-	$branchcookie  = $query->cookie(-name=>'branch',  -value=>"$branch",  -expires=>'+1y');
-	$printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
-}
-
-$env{'branchcode'}=$branch;
-$env{'printer'}=$printer;
-$env{'queue'}=$printer;
-
-my @datearr = localtime(time());
-# FIXME - Could just use POSIX::strftime("%Y%m%d", localtime);
-my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", ($datearr[3]));
-#warn $todaysdate;
-
-################# Start code modified by Christina Lee###########################
-# get borrower information ....
-#my ($borr, $flags) = getpatroninformation(undef, $loggedinusername);
-#my @bordat;
-#$bordat[0] = $borr;
-
-#$template->param(BORROWER_INFO => \@bordat);
-
-######################End code modified by christina Lee############################
-
-my $message;
-my $borrowerslist;
-# if there is a list of find borrowers....
-my $findborrower = $query->param('findborrower');
-if ($findborrower) {
-	my ($count,$borrowers)=BornameSearch(\%env,$findborrower,'web');
-	my @borrowers=@$borrowers;
-	if ($#borrowers == -1) {
-		$query->param('findborrower', '');
-		$message =  "'$findborrower'";
-	} elsif ($#borrowers == 0) {
-		$query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
-		$query->param('barcode','');
-	} else {
-		$borrowerslist = \@borrowers;
-	}
-}
-
-
-my $borrowernumber = $query->param('borrnumber');
-my $bornum = $query->param('borrnumber');
-# check and see if we should print
-my $print=$query->param('print');
-my $barcode = $query->param('barcode');
-if ($barcode eq ''  && $print eq 'maybe'){
-	$print = 'yes';
-}
-if ($print eq 'yes' && $borrowernumber ne ''){
-	printslip(\%env,$borrowernumber);
-	$query->param('borrnumber','');
-	$borrowernumber='';
-}
-
-# get the borrower information.....
-my $borrower;
-my $flags;
-if ($borrowernumber) {
-    ($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
-}
-
-# get the responses to any questions.....
-my %responses;
-foreach (sort $query->param) {
-	if ($_ =~ /response-(\d*)/) {
-		$responses{$1} = $query->param($_);
-	}
-}
-if (my $qnumber = $query->param('questionnumber')) {
-	$responses{$qnumber} = $query->param('answer');
-}
-
-
-my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer);
-#Begin code edited by Christina Lee
-#my $barc = 123456789;
-my $barc = cuecatbarcodedecode($barcode);
-
-(my $year, my $month, my $day) = set_duedate($barc);
-#End code edited by Christina Lee
-
-# if the barcode is set
-if ($barcode) {
-	$barcode = cuecatbarcodedecode($barcode);
- 
-#note: edit code here --Christina Lee
-	my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
-	unless ($invalidduedate) {
-		$env{'datedue'}=$datedue;
-		my @time=localtime();
-		my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
-		($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message)
-					= issuebook(\%env, $borr, $barcode, \%responses, $date);
-	}
-}
-
-# reload the borrower info for the sake of reseting the flags.....
-if ($borrowernumber) {
-	($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
-}
-
-##################################################################################
-# HTML code....
-
-my %responseform;
-my @responsearray;
-foreach (keys %responses) {
-#    $responsesform.="<input type=hidden name=response-$_ value=$responses{$_}>\n";
-    $responseform{'name'}=$_;
-    $responseform{'value'}=$responses{$_};
-    push @responsearray,\%responseform;
-}
-my $questionform;
-my $stickyduedate;
-if ($question) {
-    $stickyduedate=$query->param('stickyduedate');
-}
-
-
-# Barcode entry box, with hidden inputs attached....
-
-# FIXME - How can we move this HTML into the template?  Can we create
-# arrays of the months, dates, etc and use <TMPL_LOOP> in the template to 
-# output the data that's getting built here?
-my $counter = 1;
-my $dayoptions = '';
-my $monthoptions = '';
-my $yearoptions = '';
-for (my $i=1; $i<32; $i++) {
-    my $selected='';
-    if (($query->param('stickyduedate')) && ($day==$i)) {
-	$selected='selected';
-    }
-    $dayoptions.="<option value=$i $selected>$i";
-}
-foreach (('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) {
-    my $selected='';
-    if (($query->param('stickyduedate')) && ($month==$counter)) {
-		$selected='selected';
-    }
-    $monthoptions.="<option value=$counter $selected>$_";
-    $counter++;
-}
-for (my $i=$datearr[5]+1900; $i<$datearr[5]+1905; $i++) {
-    my $selected='';
-    if (($query->param('stickyduedate')) && ($year==$i)) {
-		$selected='selected';
-    }
-    $yearoptions.="<option value=$i $selected>$i";
-}
-my $selected='';
-($query->param('stickyduedate')) && ($selected='checked');
-
-
-# make the issued books table.....
-my $todaysissues='';
-my $previssues='';
-my @realtodayissues;
-my @realprevissues;
-my $allowborrow;
-my $hash;
-# Begin code altered by christina Lee
-if ($borr) {
-    ($borr, $flags,$hash) = getpatroninformation(\%env,$loggedinuser,0);
-# End code altered by Christina Lee
-    $allowborrow= $hash->{'borrow'};
-    my @todaysissues;
-    my @previousissues;
-# Begin code altered by Christina Lee
-    my $issueslist = getissues($borr);
-# End code altered by Christina Lee
-    foreach my $it (keys %$issueslist) {
-	my $issuedate = $issueslist->{$it}->{'timestamp'};
-	$issuedate = substr($issuedate, 0, 8);
-	if ($todaysdate == $issuedate) {
-	    push @todaysissues, $issueslist->{$it};
-	} else {
-	    push @previousissues, $issueslist->{$it};
-	}
-    }
-	my $tcolor = '';
-	my $pcolor = '';
-	my $od = '';
-	foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){        
-		my $dd = $book->{'date_due'};
-		my $datedue = $book->{'date_due'};
-		$dd=format_date($dd);
-		$datedue=~s/-//g;
-		if ($datedue < $todaysdate) {
-			$od = 'true';
-			$dd="$dd\n";
-		}
-		$tcolor = ($tcolor eq $linecolor1) ? $linecolor2 : $linecolor1;
-		$book->{'od'}=$od;
-		$book->{'dd'}=$dd;
-		$book->{'tcolor'}=$tcolor;
-	        if ($book->{'author'} eq ''){
-		    $book->{'author'}=' ';
-		}
-		push @realtodayissues,$book;
-	}
-    
-
-    # FIXME - For small and private libraries, it'd be nice if this
-    # table included a "Return" link next to each book, so that you
-    # don't have to remember the book's bar code and type it in on the
-    # "Returns" page.
-
-    # This is in the template now, so its possible for a small library to make that link in their
-    # template
-
-    foreach my $book (sort {$a->{'date_due'} cmp $b->{'date_due'}} @previousissues){
-		my $dd = $book->{'date_due'};
-		my $datedue = $book->{'date_due'};
-		$dd=format_date($dd);
-		my $pcolor = '';
-		my $od = '';
-		$datedue=~s/-//g;
-		if ($datedue < $todaysdate) {
-			$od = 'true';
-		    $dd="$dd\n";
-		}
-		$pcolor = ($pcolor eq $linecolor1) ? $linecolor2 : $linecolor1;
-		$book->{'dd'}=$dd; 
-		$book->{'od'}=$od;
-		$book->{'tcolor'}=$pcolor;
-		if ($book->{'author'} eq ''){
-		    $book->{'author'}=' ';
-		}    
-		push @realprevissues,$book
-	}
-}
-
-my @values;
-my %labels;
-my $CGIselectborrower;
-if ($borrowerslist) {
-	foreach (sort {$a->{'surname'}.$a->{'firstname'} cmp $b->{'surname'}.$b->{'firstname'}} @$borrowerslist){
-		push @values,$_->{'borrowernumber'};
-		$labels{$_->{'borrowernumber'}} ="$_->{'surname'}, $_->{'firstname'} ($_->{'cardnumber'})";
-	}
-	$CGIselectborrower=CGI::scrolling_list( -name     => 'borrnumber',
-				-values   => \@values,
-				-labels   => \%labels,
-				-size     => 7,
-				-multiple => 0 );
-}
-#title
-
-my ($patrontable, $flaginfotable) = patrontable($borrower);
-my $amountold=$flags->{'CHARGES'}->{'message'};
-my @temp=split(/\$/,$amountold);
-$amountold=$temp[1];
-$template->param(
-		findborrower => $findborrower,
-		borrower => $borrower,
-		borrowernumber => $borrowernumber,
-		branch => $branch,
-		printer => $printer,
-		branchname => $branches->{$branch}->{'branchname'},
-		printername => $printers->{$printer}->{'printername'},
-		allowborrow =>$allowborrow,
-		#question form
-		question => $question,
-		title => $iteminformation->{'title'},
-		author => $iteminformation->{'author'},
-#Begin code by Christina Lee
-		firstname => $borr->{'firstname'},
-		surname => $borr->{'surname'},
-		categorycode => $borr->{'categorycode'},
-		streetaddress => $borr->{'streetaddress'},
-		city => $borr->{'city'},
-		phone => $borr->{'phone'},
-		cardnumber => $borr->{'cardnumber'},
-#End code by Christina Lee
-		question => $question,
-		barcode => $barcode,
-		questionnumber => $questionnumber,
-		dayoptions => $dayoptions,
-		monthoptions => $monthoptions,
-		yearoptions => $yearoptions,
-		stickyduedate => $stickyduedate,
-		rejected => $rejected,
-		message => $message,
-		CGIselectborrower => $CGIselectborrower,
-		amountold => $amountold,
-		todayissues => \@realtodayissues,
-		previssues => \@realprevissues,
-		responseloop => \@responsearray,
-		month=>$month,
-		day=>$day,
-		year=>$year
-);
-
-if ($branchcookie) {
-    $cookie=[$cookie, $branchcookie, $printercookie];
-}
-
-output_html_with_http_headers $query, $cookie, $template->output;
-
-####################################################################
-# Extra subroutines,,,
-
-sub cuecatbarcodedecode {
-    my ($barcode) = @_;
-    chomp($barcode);
-    my @fields = split(/\./,$barcode);
-    my @results = map(decode($_), @fields[1..$#fields]);
-    if ($#results == 2){
-  		return $results[2];
-    } else {
-		return $barcode;
-    }
-}
-
-sub fixdate {
-    my ($year, $month, $day) = @_;
-    if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
-		$env{'datedue'}='';
-		return(undef,undef);
-    } 
-	
-# FIXME - Can we set two flags here, one that says 'invalidduedate', so that 
-# the template can check for it, and then one for a particular message?
-# Ex: <TMPL_IF NAME="invalidduedate">  <TMPL_IF NAME="daysinFeb">
-# Invalid Due Date Specified. Book was not issued.  Never that many days
-# in February! </TMPL_IF> </TMPL_IF>
-
-    my ($date);
-	my ($invalidduedate) = "Invalid Due Date Specified. Book was not issued. ";
-	if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
-	    $invalidduedate .= "<p>\n";
-	} else {
-	    if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
-			$invalidduedate .= "Only 30 days in $month month.<p>\n";
-	    } elsif (($day > 29) && ($month == 2)) {
-			$invalidduedate .= "Never that many days in February!<p>\n";
-	    } elsif (($month == 2) && ($day > 28) && (($year%4) && ((!($year%100) || ($year%400))))) {
-			$invalidduedate .= "$year is not a leap year.<p>\n";
-	    } else {
-			$date="$year-$month-$day";
-	    }
-	}
-    return ($date, $invalidduedate);
-}
-
-
-sub patrontable {
-    my ($borrower) = @_;
-    my $flags = $borrower->{'flags'};
-    my $flaginfotable='';
-    my $flaginfotext;
-    #my $flaginfotext='';
-    my $flag;
-    my $color='';
-    foreach $flag (sort keys %$flags) {
-    	warn $flag;
-#    	my @itemswaiting='';
-	($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
-	$flags->{$flag}->{'message'}=~s/\n/<br>/g;
-	if ($flags->{$flag}->{'noissues'}) {
-		$template->param(
-			noissues => 'true',
-			color => $color,
-		);
-		if ($flag eq 'GNA'    ){ $template->param(    gna => 'true'); }
-		if ($flag eq 'LOST'   ){ $template->param(   lost => 'true'); }
-		if ($flag eq 'DBARRED'){ $template->param(dbarred => 'true'); }
-		if ($flag eq 'CHARGES'){
-			$template->param(
-				charges => 'true',
-				chargesmsg => $flags->{'CHARGES'}->{'message'}
-			);
-		}
-	} else {
-		if ($flag eq 'CHARGES') {
-			$template->param(
-				charges => 'true',
-				chargesmsg => $flags->{'CHARGES'}->{'message'}
-			 );
-		}
-	    if ($flag eq 'WAITING') {
-			my $items=$flags->{$flag}->{'itemlist'};
-		        my @itemswaiting;
-			foreach my $item (@$items) {
-				my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
-				$iteminformation->{'branchname'} = $branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
-				push @itemswaiting, $iteminformation;
-			}
-			$template->param(
-				waiting => 'true',
-				waitingmsg => $flags->{'WAITING'}->{'message'},
-				itemswaiting => \@itemswaiting,
-			 );
-		}
-		if ($flag eq 'ODUES') {
-			$template->param(
-				odues => 'true',
-				oduesmsg => $flags->{'ODUES'}->{'message'}
-			 );
-
-			my $items=$flags->{$flag}->{'itemlist'};
-			my $lcolor=$color;
-			my @itemswaiting;
-			foreach my $item (@$items) {
-				$lcolor = ($lcolor eq $linecolor1) ? $linecolor2 : $linecolor1;
-				my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
-				push @itemswaiting, $iteminformation;
-			}
-			if ($query->param('module') ne 'returns'){
-				$template->param( nonreturns => 'true' );
-			}
-		}
-		if ($flag eq 'NOTES') {
-			$template->param(
-				notes => 'true',
-				notesmsg => $flags->{'NOTES'}->{'message'}
-			);
-		}
-	}
-    }
-    return($patrontable, $flaginfotext);
-}
-
-
-# FIXME - This clashes with &C4::Print::printslip
-sub printslip {
-    my ($env,$borrowernumber)=@_;
-    my ($borrower, $flags) = getpatroninformation($env,$borrowernumber,0);
-    $env->{'todaysissues'}=1;
-    my ($borrowerissues) = currentissues($env, $borrower);
-    $env->{'nottodaysissues'}=1;
-    $env->{'todaysissues'}=0;
-    my ($borroweriss2) = currentissues($env, $borrower);
-    $env->{'nottodaysissues'}=0;
-    my $i=0;
-    my @issues;
-    foreach (sort {$a <=> $b} keys %$borrowerissues) {
-		$issues[$i]=$borrowerissues->{$_};
-		$issues[$i]->{'date_due'} = C4::Dates->new($issues[$i]->{'date_due'},'iso')->output;
-		# convert to syspref style date
-		$i++;
-    }
-    foreach (sort {$a <=> $b} keys %$borroweriss2) {
-		$issues[$i]=$borroweriss2->{$_};
-		$issues[$i]->{'date_due'} = C4::Dates->new($issues[$i]->{'date_due'},'iso')->output;
-		# convert to syspref style date
-		$i++;
-	}
-    remoteprint($env,\@issues,$borrower);
-}
-
-# Begin code added by Christina Lee
-sub set_duedate
-{
-	my $loanlength;
-	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare ("select loanlength from biblioitems, biblio,itemtypes, items where barcode = ? and biblio.biblionumber = biblioitems.biblionumber and biblioitems.biblionumber = items.biblionumber and biblioitems.itemtype=itemtypes.itemtype;"); 
-	$sth->execute($barc);
-	while (my @val = $sth->fetchrow_array()) {
-		$loanlength = @val[0];
-	}
-	my ($s, $min, $hr, $mday, $mo, $year, $wday, $yday) = localtime(time + $loanlength * 86400);
-
-	#adjust month and date for output
-	$year -= 100;
-	$mo++;
-	return ($year, $mo, $mday);
-}
-
-sub get_due_date {
-	# This function is clearly unfinished. Don't rely on it yet.
-	my $duedate;
-	my $dbh = C4::Context->dbh;
-}
-
-# End code added by Christina Lee
-
-# Local Variables:
-# tab-width: 8
-# End:
-
diff --git a/opac/sco/sco-circ.pl b/opac/sco/sco-circ.pl
deleted file mode 100755
index 8d46c19..0000000
--- a/opac/sco/sco-circ.pl
+++ /dev/null
@@ -1,211 +0,0 @@
-#!/usr/bin/perl
-# code modified by Trendsetters (from original circulation.pl)
-# Please use 8-character tabs for this file (indents are every 4 characters)
-#
-#  rychi edit: we're just trying to issue some books. 'Trendsetters' code mostly deleted.
-#    Note:  This is incomplete; implemented for a library that trusts its users and  has no fines;
-#    as such, there are some circ functions that are missing and tests that are skipped.
-#    
-#    The issuer is a special user
-#  with borrowerflag 'selfcheck' set.  The borrower has been authenticated.
-#  We're going to post a barcode with a form, and check that barcode for issuability.
-#  If it's issuable, we issue it.  If there's an error, we call a popup.
-#
-
-# Copyright  2006 
-# # This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Circulation;
-use C4::Search;
-use DBI;
-use C4::Auth;
-use C4::Output;
-use C4::Koha;
-use HTML::Template::Pro;
-use C4::Dates;
-
-my $query=new CGI;
-
-#my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
-#	($query, 0, { circulate => 1 });
-#  loggedinuser is the 'selfchaeckout user'.
-my ($template, $loggedinuser, $cookie) = get_template_and_user({
-	template_name	=> 'sco/sco-circ.tmpl',
-	query		=> $query,
-	type		=> "opac",
-	authnotrequired	=> 0,
-	flagsrequired	=> { circulate => "circulate_remaining_permissions" },
-    });
-
-my $issuerid = $loggedinuser;
-my ( $userid, $op, $barcode, $confirmed )= $query->param("userid", "op", "barcode", "confirmed" );
-my $env ;
-my %confirmation_strings = ( RENEW_ISSUE => "This item is already checked out to you.  Renew it?", );
-my $cnt = 0;
-
-my ($issuer, $flags) = getpatroninformation(undef,undef, $issuerid);
-my $item = getiteminformation(undef,undef,$barcode);
-
-if ($op eq "finish") {
-	$query->param( userid => undef );
-} elsif ($userid) {  
-
-   my $env = {branchcode =>  $issuer->{'branchcode'} }; 
-   warn "here's the branchcode: ".$issuer->{branchcode};
-   my ($borrower, $flags) = getpatroninformation(undef,undef, $userid);
-   my $bornum = $borrower->{borrowernumber};
-   
-   my $borrowerissues = [];
-   my $issues = currentissues( $env, $borrower);
-   
-   foreach (%$issues) {
-   	$borrowerissues->[$cnt]->{issued} = $_ ;
-	$cnt++;
-   }
-   $cnt=0;
-   $template->param( OVERDUES => $borrower->{ODUES} ,
-   			ISSUES => $borrowerissues,
-			);
-
-   if ($op eq "checkout" ) {
-      my ($impossible,$needconfirm) = canbookbeissued(undef,$borrower,$barcode);
-      if ($impossible) {
-         my ($issue_error) = keys %$impossible ;
-         $template->param( impossible => $issue_error );
-      } elsif ($needconfirm->{RENEW_ISSUE} ) {
-      	  if ( $confirmed ) {
-            renewbook($env,$bornum,$item->{itemnumber},"");
-          } else {
-	   $template->param( confirm => $confirmation_strings{RENEW_ISSUE} );
-          }
-      } elsif ($needconfirm && !$confirmed ) {
-         my ($confirmation) = keys %$needconfirm ;      
-	 $template->param( impossible => $confirmation );
-      } else {
-         issuebook($env,$bornum,$barcode,"");
-      }
-
-#getiteminformation(undef,undef,$item);
-
-   } else {
-
-}
-			
-# reload the borrower info for the sake of reseting the flags.....
-#	if ($borrowernumber) {
-#		($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
-#	}
-} else {
-	$template->param( noauth => 1, );
-}
-
-output_html_with_http_headers $query, $cookie, $template->output;
-
-
-#sub patrontable {
-#    my ($borrower) = @_;
-#    my $flags = $borrower->{'flags'};
-#    my $flaginfotable='';
-#    my $flaginfotext;
-#    #my $flaginfotext='';
-#    my $flag;
-#    my $color='';
-#    foreach $flag (sort keys %$flags) {
-#    	warn $flag;
-##    	my @itemswaiting='';
-#	($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
-#	$flags->{$flag}->{'message'}=~s/\n/<br>/g;
-#	if ($flags->{$flag}->{'noissues'}) {
-#		$template->param(
-#			noissues => 'true',
-#			color => $color,
-#			 );
-#		if ($flag eq 'GNA'){
-#			$template->param(
-#				gna => 'true'
-#				);
-#			}
-#		if ($flag eq 'LOST'){
-#			$template->param(
-#				lost => 'true'
-#			);
-#			}
-#		if ($flag eq 'DBARRED'){
-#			$template->param(
-#				dbarred => 'true'
-#			);
-#			}
-#		if ($flag eq 'CHARGES') {
-#			$template->param(
-#				charges => 'true',
-#				chargesmsg => $flags->{'CHARGES'}->{'message'}
-#				 );
-#		}
-#	} else {
-#		 if ($flag eq 'CHARGES') {
-#			$template->param(
-#				charges => 'true',
-#				chargesmsg => $flags->{'CHARGES'}->{'message'}
-#			 );
-#		}
-#	    	if ($flag eq 'WAITING') {
-#			my $items=$flags->{$flag}->{'itemlist'};
-#		        my @itemswaiting;
-#			foreach my $item (@$items) {
-#			my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
-#			$iteminformation->{'branchname'} = $branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
-#			push @itemswaiting, $iteminformation;
-#			}
-#			$template->param(
-#				waiting => 'true',
-#				waitingmsg => $flags->{'WAITING'}->{'message'},
-#				itemswaiting => \@itemswaiting,
-#				 );
-#		}
-#		if ($flag eq 'ODUES') {
-#			$template->param(
-#				odues => 'true',
-#				oduesmsg => $flags->{'ODUES'}->{'message'}
-#				 );
-#
-#			my $items=$flags->{$flag}->{'itemlist'};
-#			my $currentcolor=$color;
-#			{
-#			my $color=$currentcolor;
-#			    my @itemswaiting;
-#			foreach my $item (@$items) {
-#				($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
-#				my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
-#				push @itemswaiting, $iteminformation;
-#			}
-#			}
-#			if ($query->param('module') ne 'returns'){
-#				$template->param( nonreturns => 'true' );
-#			}
-#		}
-#		if ($flag eq 'NOTES') {
-#			$template->param(
-#				notes => 'true',
-#				notesmsg => $flags->{'NOTES'}->{'message'}
-#				 );
-#		}
-#	}
-#    }
-#    return($patrontable, $flaginfotext);
-#}
-
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index d212746..984aded 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -1,38 +1,43 @@
 #!/usr/bin/perl
+#
 # 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
-# issue items to that borrower.
 #
+# We're in a controlled environment; we trust the user.
+# So the selfcheck station will accept a patronid and issue items to that borrower.
+# FIXME: NOT really a controlled environment...  We're on the internet!
+#
+# The checkout permission comes form the CGI cookie/session of a staff user.
+# The patron is not really logging in here in the same way as they do on the
+# rest of the OPAC.  So don't confuse loggedinuser with the patron user.
+#
+# FIXME: inputfocus not really used in TMPL
+
 use strict;
 use warnings;
 
 use CGI;
 
-#use C4::Authsco;
 use C4::Auth;
 use C4::Koha;
 use C4::Circulation;
 use C4::Reserves;
-use C4::Search;
 use C4::Output;
 use C4::Members;
-#use HTML::Template::Pro;
 use C4::Dates;
 use C4::Biblio;
 use C4::Items;
 
 my $query = new CGI;
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "sco/sco-main.tmpl",
-                             query => $query,
-                             type => "opac",
-                             authnotrequired => 0,
-                             flagsrequired => { circulate => "circulate_remaining_permissions" },
-                             debug => 0,
-                             });
-my $dbh = C4::Context->dbh;
+my ($template, $loggedinuser, $cookie) = get_template_and_user({
+    template_name   => "sco/sco-main.tmpl",
+    authnotrequired => 0,
+      flagsrequired => { circulate => "circulate_remaining_permissions" },
+    query => $query,
+    type  => "opac",
+    debug => 1,
+});
 
 my $issuerid = $loggedinuser;
 my ($op, $patronid, $barcode, $confirmed, $timedout) = (
@@ -45,43 +50,38 @@ my ($op, $patronid, $barcode, $confirmed, $timedout) = (
 
 my %confirmation_strings = ( RENEW_ISSUE => "This item is already checked out to you.  Return it?", );
 my $issuenoconfirm = 1; #don't need to confirm on issue.
-my $cnt = 0;
 #warn "issuerid: " . $issuerid;
-my ($issuer) = GetMemberDetails($issuerid);
-my $item = GetItem(undef,$barcode);
-my $borrower;
-($borrower) = GetMemberDetails(undef,$patronid);
+my $issuer   = GetMemberDetails($issuerid);
+my $item     = GetItem(undef,$barcode);
+my $borrower = GetMemberDetails(undef,$patronid);
 
 my $branch = $issuer->{branchcode};
 my $confirm_required = 0;
 my $return_only = 0;
-#warn "issuer cardnum: " . $issuer->{cardnumber};
-#warn "cardnumber= ".$borrower->{cardnumber};
+#warn "issuer cardnumber: " .   $issuer->{cardnumber};
+#warn "patron cardnumber: " . $borrower->{cardnumber};
 if ($op eq "logout") {
-        $query->param( patronid => undef );
+    $query->param( patronid => undef );
 }
-
-
-if ( $op eq "returnbook" ) {
+elsif ( $op eq "returnbook" ) {
     my ($doreturn) = AddReturn( $barcode, $branch );
-
     #warn "returnbook: " . $doreturn;
-    ($borrower) = GetMemberDetails( undef, $patronid );
+    $borrower = GetMemberDetails( undef, $patronid );   # update borrower
 }
-
-if ( $op eq "checkout" ) {
+elsif ( $op eq "checkout" ) {
     my $impossible  = {};
     my $needconfirm = {};
     if ( !$confirmed ) {
         ( $impossible, $needconfirm ) = CanBookBeIssued( $borrower, $barcode );
     }
-    $confirm_required = scalar( keys(%$needconfirm) );
+    $confirm_required = scalar keys %$needconfirm;
 
     #warn "confirm_required: " . $confirm_required ;
-    if ( scalar( keys(%$impossible) ) ) {
+    if (scalar keys %$impossible) {
 
         #  warn "impossible: numkeys: " . scalar (keys(%$impossible));
-        my ($issue_error) = keys %$impossible;
+        warn join " ", keys %$impossible;
+        my $issue_error = (keys %$impossible)[0];
 
         # FIXME  we assume only one error.
         $template->param(
@@ -89,7 +89,6 @@ if ( $op eq "checkout" ) {
             title      => $item->{title},
             hide_main  => 1,
         );
-
         #warn "issue_error: " . $issue_error ;
         if ( $issue_error eq "NO_MORE_RENEWALS" ) {
             $return_only = 1;
@@ -100,11 +99,9 @@ if ( $op eq "checkout" ) {
         }
     } elsif ( $needconfirm->{RENEW_ISSUE} ) {
         if ($confirmed) {
-
             #warn "renewing";
             AddRenewal( $borrower, $item->{itemnumber} );
         } else {
-
             #warn "renew confirmation";
             $template->param(
                 renew               => 1,
@@ -115,26 +112,22 @@ if ( $op eq "checkout" ) {
             );
         }
     } elsif ( $confirm_required && !$confirmed ) {
-
         #warn "failed confirmation";
-        my ($confirmation) = keys %$needconfirm;
         $template->param(
-            impossible => $confirmation,
+            impossible => (keys %$needconfirm)[0],
             hide_main  => 1,
         );
     } else {
         if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
-                                                  #warn "issuing book?";
+            # warn "issuing book?";
             AddIssue( $borrower, $barcode );
-
-            #    ($borrower, $flags) = getpatroninformation(undef,undef, $patronid);
-
-            #    $template->param( patronid => $patronid,
-            #			validuser => 1,
-            #			);
+            # ($borrower, $flags) = getpatroninformation(undef,undef, $patronid);
+            # $template->param(
+            #   patronid => $patronid,
+            #   validuser => 1,
+            # );
         } else {
             $confirm_required = 1;
-
             #warn "issue confirmation";
             $template->param(
                 confirm    => "Issuing title: " . $item->{title},
@@ -144,51 +137,39 @@ if ( $op eq "checkout" ) {
             );
         }
     }
-}    # op=checkout
+} # $op
 
 if ($borrower->{cardnumber}) {
-
-#   warn "here's the issuer's  branchcode: ".$issuer->{branchcode};
-#   warn "here's the user's  branchcode: ".$borrower->{branchcode};
-	my $bornum = $borrower->{borrowernumber};
-	my $borrowername = $borrower->{firstname} . " " . $borrower->{surname};
-	my @issues;
-
+#   warn "issuer's  branchcode: " .   $issuer->{branchcode};
+#   warn   "user's  branchcode: " . $borrower->{branchcode};
+    my $borrowername = sprintf "%s %s", ($borrower->{firstname} || ''), ($borrower->{surname} || '');
+    my @issues;
     my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
     foreach my $it (@$issueslist) {
-
-        my ( $renewokay, $renewerror ) =
-                CanBookBeIssued( $borrower, $it->{'barcode'}, '', '' );
+        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 => \@issues,,
-			patronid => $patronid ,
-			noitemlinks => 1 ,
-		);
-   $cnt = 0;
-   my $inputfocus;
-   if ($return_only ==1) {
-      $inputfocus = 'returnbook' ;
-   }elsif ($confirm_required == 1) {
-      $inputfocus = 'confirm' ;
-   } else {
-      $inputfocus = 'barcode' ;
-   }
-
-$template->param( inputfocus => $inputfocus,
+    $template->param(
+        validuser => 1,
+        borrowername => $borrowername,
+        issues_count => scalar(@issues),
+        ISSUES => \@issues,
+        patronid => $patronid,
+        noitemlinks => 1 ,
+    );
+    my $inputfocus = ($return_only      == 1) ? 'returnbook' :
+                     ($confirm_required == 1) ? 'confirm'    : 'barcode' ;
+    $template->param(
+        inputfocus => $inputfocus,
 		nofines => 1,
-		);
-
+    );
 } else {
-
- $template->param( patronid => $patronid,  nouser => $patronid,
- 			inputfocus => 'patronid', );
+    $template->param(
+        patronid   => $patronid,
+        nouser     => $patronid,
+    );
 }
 
 output_html_with_http_headers $query, $cookie, $template->output;
-- 
1.5.6.5



More information about the Koha-patches mailing list