-##################################################################################
-# HTML code....
-# title....
-my $title = <<"EOF";
-<FONT SIZE=6><em>Circulation: Returns</em></FONT><br>
-<b>Branch:</b> $branches->{$branch}->{'branchname'}  
-<b>Printer:</b> $printers->{$printer}->{'printername'}<br>
-<a href=selectbranchprinter.pl>Change Settings</a>
-<input type=hidden name=branch value=$branch>
-<input type=hidden name=printer value=$printer>
-<p>
-EOF
-
-my $links = <<"EOF";
-<table align="right"><tr><td>
-<a href=circulation.pl>
-<img src="/images/button-issues.gif" width="99" height="42" border="0" alt="Issues"></a>
- <a href=branchtransfers.pl>
-<img src="/images/button-transfers.gif" width="127" height="42" border="0" alt="Issues"></a>
-</td></tr></table>
-EOF
-
-
-my $itemtable;
-if ($iteminformation) {
- $itemtable = <<"EOF";
-<table border=1 cellpadding=5 cellspacing=0>
-<tr><th bgcolor=$headerbackgroundcolor background=$backgroundimage>
-<font color=black>Returned Item Information</font></th></tr>
-<tr><td>
-Title: $iteminformation->{'title'}<br>
-<!--Hlt decided they dont want these showing, uncoment the html to make it work
-
-Author: $iteminformation->{'author'}<br>
-Barcode: <a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}
-&type=intra onClick="openWindow(this, 'Item', 480, 640)">$iteminformation->{'barcode'}</a><br>
-Date Due: $iteminformation->{'date_due'}-->
-</td></tr>
-</table>
-EOF
-}
-
-# Barcode entry box, with hidden inputs attached....
-my $barcodeentrytext = << "EOF";
-<form method=post action=/cgi-bin/koha/circ/returns.pl>
-<table border=1 cellpadding=5 cellspacing=0>
-<tr><td colspan=2 bgcolor=$headerbackgroundcolor align=center background=$backgroundimage>
-<font color=black><b>Enter Book Barcode</b></font></td></tr>
-<tr><td>Item Barcode:</td><td><input name=barcode size=10></td></tr>
-</table>
-$ritext
-</form>
-EOF
-
-
-if ($messages->{'ResFound'}) {
- my $res = $messages->{'ResFound'};
- my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
- my ($borr) = getpatroninformation(\%env, $res->{'borrowernumber'}, 0);
- my $name = $borr->{'surname'}." ".$borr->{'title'}." ".$borr->{'firstname'};
- my $number = "<a href=/cgi-bin/koha/moremember.pl?bornum=$borr->{'borrowernumber'} onClick='openWindow(this,'Member', 480, 640)'>$borr->{'cardnumber'}</a>";
- my ($iteminfo) = getiteminformation(\%env, 0, $barcode);
-
- if ($res->{'ResFound'} eq "Waiting") {
- $reservetext = <<"EOF";
-<font color='red' size='+2'>Item marked Waiting:</font><br>
- Item $iteminfo->{'title'} ($iteminfo->{'author'}) <br>
-is marked waiting at <b>$branchname</b> for $name ($number).
-<center><form method=post action='returns.pl'>
-$ritext
-<input type=hidden name=barcode value=0>
-<input type=submit value="OK">
-</form></center>
-EOF
- }
- if ($res->{'ResFound'} eq "Reserved") {
- my @da = localtime(time());
- my $todaysdate = sprintf ("%0.2d", ($da[3]+1))."/".sprintf ("%0.2d", ($da[4]+1))."/".($da[5]+1900);
- my $slip = <<"EOF";
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Date: $todaysdate;
-
-ITEM RESERVED:
-$iteminfo->{'title'} ($iteminfo->{'author'})
-barcode: $iteminfo->{'barcode'}
-itemtype: $iteminfo->{'itemtype'}
-
-COLLECT AT: $branchname
-
-BORROWER:
-$borr->{'title'} $borr->{'firstname'} $borr->{'surname'}
-card number: $borr->{'cardnumber'}
-Phone: $borr->{'phone'}
-$borr->{'streetaddress'}
-$borr->{'suburb'}
-$borr->{'town'}
-$borr->{'emailaddress'}
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-EOF
-
- $reservetext = <<"EOF";
-<font color='red' size='+2'>Reserve found:</font> Item: $iteminfo->{'title'} ($iteminfo->{'author'}) <br>
-for $name ($number) to be collected at <b>$branchname</b>.
-<table cellpadding=5 cellspacing=0>
-<tr><td valign="top">Change status to waiting and print
-<a href="" onClick='alert(document.forms[0].resslip.value); return false'>slip</a>?: </td>
-<td valign="top">
-<form method=post action='returns.pl'>
-$ritext
-<input type=hidden name=itemnumber value=$res->{'itemnumber'}>
-<input type=hidden name=borrowernumber value=$res->{'borrowernumber'}>
-<input type=hidden name=resbarcode value=$barcode>
-<input type=hidden name=resslip value="$slip">
-<input type=submit value="Print">
-</form>
-</td></tr>
-</table>
-EOF
+ }
+ if ( $res->{'ResFound'} eq "Reserved" ) {
+ my @da = localtime( time() );
+ my $todaysdate =
+ sprintf( "%0.2d", ( $da[3] + 1 ) ) . "/"
+ . sprintf( "%0.2d", ( $da[4] + 1 ) ) . "/"
+ . ( $da[5] + 1900 );
+ $template->param(
+ found => 1,
+ branchname => $branches->{ $res->{'branchcode'} }->{'branchname'},
+ reserved => 1,
+ today => $todaysdate,
+ itemnumber => $res->{'itemnumber'},
+ itemtitle => $iteminfo->{'title'},
+ itemauthor => $iteminfo->{'author'},
+ itembarcode => $iteminfo->{'barcode'},
+ itemtype => $iteminfo->{'itemtype'},
+ itembiblionumber => $iteminfo->{'biblionumber'},
+ borsurname => $borr->{'surname'},
+ bortitle => $borr->{'title'},
+ borfirstname => $borr->{'firstname'},
+ bornum => $res->{'borrowernumber'},
+ borcnum => $borr->{'cardnumber'},
+ borphone => $borr->{'phone'},
+ borstraddress => $borr->{'streetaddress'},
+ borsub => $borr->{'suburb'},
+ borcity => $borr->{'city'},
+ borzip => $borr->{'zipcode'},
+ boremail => $borr->{'emailadress'},
+ barcode => $barcode
+ );