[Koha-cvs] koha koha-tmpl/intranet-tmpl/ccfls/en/members/m... [dev_week]

Kyle Hall kyle.m.hall at gmail.com
Thu May 10 16:50:32 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Kyle Hall <kylemhall>	07/05/10 14:50:32

Added files:
	koha-tmpl/intranet-tmpl/ccfls/en/members: 
	                                          memberOverdues-print.tmpl 
	                                          memberOverdues.tmpl 
	members        : memberOverdues.pl 

Log message:
	Added a page that only lists overdue items.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues-print.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/members/memberOverdues.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1

Patches:
Index: koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues-print.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues-print.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues-print.tmpl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues-print.tmpl	10 May 2007 14:50:32 -0000	1.1.2.1
@@ -0,0 +1,43 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Summary for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- TMPL_INCLUDE NAME="doc-head-close-print.inc" -->
+
+<!-- main site -->
+<div id="main">
+<h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=<!-- TMPL_VAR NAME="cardnumber" -->">Account Summary: <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</a></h3>
+
+<ul><li><!-- TMPL_VAR NAME="streetaddress" --></li><li><!-- TMPL_VAR NAME="city" -->, <!-- TMPL_VAR NAME="zipcode" --></li>
+<li><!-- TMPL_IF NAME="phone" --><!-- TMPL_VAR NAME="phone" --><!-- TMPL_ELSE -->(no phone number on file)<!-- /TMPL_IF --></li>
+<li><!-- TMPL_IF NAME="emailaddress" --><!-- TMPL_VAR NAME="emailaddress" --><!-- TMPL_ELSE -->(no email on file)<!-- /TMPL_IF --></li>
+</ul>
+
+<table>
+	<caption>Overdue Items</caption>
+	<thead>
+	<tr>
+		<th>Title</th>
+		<th>Author</th>
+		<th>Format</th>
+		<th>Replacement Cost</th>
+		<th>Date Due</th>
+	</tr>
+	</thead>
+	<tfoot><tr><td colspan="3">Total Replacement Cost:</td><td class="sum"><!-- TMPL_VAR NAME="totalprice" --></td><td colspan="3">&nbsp;</td></tr></tfoot>
+<tbody>
+	<!-- TMPL_loop name="issueloop" -->
+	<tr<!-- TMPL_IF name="red" --> class="overdue"</TMPL_IF>>
+		<td>
+		<!-- TMPL_VAR NAME="title" -->
+		<a href="/cgi-bin/koha/detail.pl?item=<!-- TMPL_VAR NAME="itemnumber" -->&amp;bib=<!-- TMPL_VAR NAME="biblionumber" -->&amp;bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->">
+		</a>
+		</td>
+		<td><!-- TMPL_VAR NAME="author" --></td>
+		<td><!-- TMPL_VAR NAME="itemtype" --></td>
+		<td class="credit"><!-- TMPL_VAR NAME="price" --></td>
+		<td><!-- TMPL_VAR NAME="date_due" --></td>
+	</tr>
+	<!-- /TMPL_LOOP -->
+	</tbody>
+	</table>
+	
+</div>
+
+<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->

Index: koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues.tmpl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/members/memberOverdues.tmpl	10 May 2007 14:50:32 -0000	1.1.2.1
@@ -0,0 +1,172 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-members.inc" -->
+
+<div id="subTab-1">
+	<a href="/cgi-bin/koha/members/members-home.pl">
+		<img src="<!-- TMPL_VAR NAME='themelang' -->/images/subTab-members-search-selected.png" border="0" />
+	</a>
+</div>
+
+<div id="subTab-2">
+	<a href="/cgi-bin/koha/members/memberentry.pl?actionType=Add">
+		<img src="<!-- TMPL_VAR NAME='themelang' -->/images/subTab-members-addMember-unselected.png" border="0" />
+	</a>
+</div>
+
+<div id="subTab-3">
+	<a href="/cgi-bin/koha/members/memberentry.pl?categorycode=I&actionType=Add">
+		<img src="<!-- TMPL_VAR NAME='themelang' -->/images/subTab-members-addOrganization-unselected.png" border="0" />
+	</a>
+</div>
+
+<dl class="bodyPane">
+<dt class="bodyPane">Overdue Items for <!-- TMPL_VAR name="surname" -->, <!-- TMPL_VAR name="firstname" --> (<!-- TMPL_VAR name="cardnumber" -->)
+</dt>
+<dd class="bodyPane">
+
+<!-- main site -->
+<div id="main">
+<h1>
+  <a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->"><!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR name="cardnumber" -->)</a>
+  <span class="print"><a href="/cgi-bin/koha/members/memberOverdues.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->&amp;print=page">(Print Overdue Items Summary)</a></span>
+</h1>
+
+<div class="tabitem">
+
+<!-- TMPL_UNLESS NAME="unvalidlibrarian"--><form action="/cgi-bin/koha/readingrec.pl?bornum=<!-- TMPL_VAR name="bornum" -->" ><input type="hidden" name="bornum" value="<!-- TMPL_VAR name="bornum" -->"><input type="submit" class="submit" value="Reading Record"></form><!-- /TMPL_UNLESS -->
+
+</div>
+
+<!-- TMPL_IF NAME="flagged" -->	<div class="details">
+	<ul>
+		<!-- TMPL_IF NAME="debarred" --><li>Patron is <span class="error">restricted</span>. <form class="inline compactNOT" action="/cgi-bin/koha/members/setdebar.pl" method="post"><input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR name="borrowernumber" -->" /><input type="hidden" name="status" value="0" /><input type="submit" class="submit" value="Lift Restriction" /></form></li><!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="gonenoaddress" --><li>Patron's <span class="error">address is in doubt</span>.</li><!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="lost" --><li>Patron's card has been reported <span class="error">lost</span>.</li><!-- /TMPL_IF -->
+	</ul>
+<!-- TMPL_IF name="borrowernotes" --><dl><dt>Notes:</dt> <dd class="error"><!-- TMPL_VAR name="borrowernotes" --></dd></dl><!-- /TMPL_IF --></div>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="failedRenewals"-->
+  <p><font color="red"><strong><!-- TMPL_VAR name="failedRenewals" --> Item(s) Were Unable To Be Renewed.</strong></font></p>
+<!-- /TMPL_IF -->
+
+<div class="compact">
+<table>
+<tr><th>Name:</th><td><!-- TMPL_IF name="IS_ADULT" --><!-- TMPL_IF NAME="title" -->[<!-- TMPL_VAR name="title" -->]. <!-- /TMPL_IF --> <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> <!-- TMPL_IF NAME="initials" -->(<!-- TMPL_VAR name="initials" -->)<!-- /TMPL_IF --><!-- /TMPL_IF --></td><td rowspan="6"><!-- TMPL_IF NAME="patronimages" --><img src="/patronimages/<!-- TMPL_VAR NAME="cardnumber" -->.<!-- TMPL_VAR NAME="patronimages" -->" alt="" border="0" /><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td></tr>
+		<tr><th>Mailing Address:</th><td><!-- TMPL_IF NAME="streetaddress" --><!-- TMPL_VAR name="streetaddress" --><br /><!-- /TMPL_IF -->
+<!-- TMPL_VAR name="city" -->, <!-- TMPL_VAR name="zipcode" --></td></tr>
+                <!-- TMPL_IF NAME="othernames" --><tr><th>Municipality:</th<td><!-- TMPL_VAR name="othernames" --></td></tr> <!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="physstreet" --><tr><th>Street Address:</th><td><!-- TMPL_VAR name="physstreet" --><br /><!-- TMPL_VAR name="streetcity" -->, <!-- TMPL_VAR name="homezipcode" --></td></tr><!-- /TMPL_IF -->
+		<!-- TMPL_UNLESS name="I" -->
+		<tr><th>Home Phone: </th><td><!-- TMPL_IF NAME="phone" --><!-- TMPL_VAR name="phone" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td></tr><!-- /TMPL_UNLESS -->
+		<!-- TMPL_IF NAME="phoneday" --><tr><th>Work Phone: </th><td><!-- TMPL_VAR name="phoneday" --></td></tr><!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="faxnumber" --><tr><th>Fax: </th><td><!-- TMPL_VAR name="faxnumber" --></td></tr><!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="emailaddress" --><tr><th>E-mail:</th><td><a href="mailto:<!-- TMPL_VAR name="emailaddress" -->"><!-- TMPL_VAR name="emailaddress" --></a></td></tr><!-- /TMPL_IF -->
+	<!-- TMPL_UNLESS name="I" -->
+			<tr><th>Date of Birth:</th><td><!-- TMPL_IF NAME="dateofbirth" --><!-- TMPL_VAR name="dateofbirth" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td></tr>
+<!-- HIDE FOR CCFLS
+			<tr><th>Sex:</th><td><!-- TMPL_IF NAME="sex" --><!-- TMPL_VAR name="sex" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td></tr><!-- /TMPL_UNLESS -->
+-->
+</table></div>
+<div class="compact">
+	<table>
+<!-- HIDE FOR CCFLS
+		<tr><th>Member Number:</th><td><!-- TMPL_VAR name="borrowernumber" --></td></tr>
+-->
+		<tr><th>Category:</th><td><!-- TMPL_VAR name="categorycode" --></td></tr>
+		<tr><th>Registration Branch:</th><td><!-- TMPL_VAR name="branchcode" --></td></tr>
+		<!-- TMPL_IF name="printethnicityline" -->
+			<tr><th>Ethnicity:</th><td><!-- TMPL_VAR name="ethnicity" -->, <!-- TMPL_VAR name="ethnotes" --></td></tr>
+	<!-- /TMPL_IF -->
+			<!-- TMPL_IF NAME="sort1" -->
+			<tr><th>Drivers License Number : </th><td><!-- TMPL_VAR name="sort1" --></td></tr>
+		<!-- /TMPL_IF -->
+</table>
+</div>
+
+<div class="compact">
+<table>
+		<!-- TMPL_IF NAME="borrowernotes" -->
+		<tr><th>Circulation Note: <p>(appears in Circulation)</p></th> 
+		<td><p class="notes"><!-- TMPL_VAR name="borrowernotes" --></p></td></tr>
+		<!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="textmessaging" --><tr><th>Patron Message:<p>(appears in OPAC)</p></th><td><!-- TMPL_VAR name="textmessaging" --></td></tr><!-- /TMPL_IF -->
+</table></div>
+<div class="compact">
+<table>
+			<tr><th><!-- TMPL_UNLESS name="I" -->Alternate<!-- /TMPL_UNLESS --> Contact:</th> 
+			<td>
+				<!-- TMPL_UNLESS name="I" --><ul><li>Name: <!-- /TMPL_UNLESS --><!-- TMPL_VAR name="contactname" --><!-- TMPL_UNLESS name="I" --></li><!-- /TMPL_UNLESS -->
+				<!-- TMPL_UNLESS name="I" --><li>Phone: <!-- TMPL_VAR name="altphone" --></li>
+				<li>Relationship: <!-- TMPL_VAR name="altrelationship" --></li>
+		<!-- /TMPL_UNLESS -->
+		<!-- TMPL_IF NAME="altnotes" --><li>Notes: <!-- TMPL_VAR name="altnotes" --></li><!-- /TMPL_IF -->
+				<!-- TMPL_UNLESS name="I" --></ul><!-- /TMPL_UNLESS --></td></tr>
+
+		<!-- TMPL_UNLESS name="I" -->
+		
+			<!-- TMPL_IF name="isguarantee" -->
+
+				<!-- TMPL_IF NAME="guaranteeloop" --><tr><th>Guarantees:</th><td><ul><!-- TMPL_LOOP name="guaranteeloop" --><li><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR name="borrowernumber" -->"><!-- TMPL_VAR name=name --> - <!-- TMPL_VAR name="cardnumber" --></a></li><!-- /TMPL_LOOP --></ul></td></tr><!-- /TMPL_IF -->
+
+			<!-- TMPL_ELSE -->
+
+<!-- TMPL_IF name="guarantorborrowernumber" --><tr><th>Guarantor:</th>
+					<td><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR name="guarantorborrowernumber" -->"><!-- TMPL_VAR name="guarantorcardnumber" --></a></td></tr><!-- /TMPL_IF -->
+
+			<!-- /TMPL_IF -->
+			
+		<!-- /TMPL_UNLESS -->
+</table>
+</div><div class="data">
+<table>
+	<caption>Fines &amp; Charges</caption>
+		
+		<tr>
+			<!-- TMPL_IF name="totaldue" --><th>Total Due:</th><td>$<!-- TMPL_VAR name="totaldue" --></td></tr><!-- TMPL_ELSE --><td>No Outstanding Charges</td><!-- /TMPL_IF --></table>
+
+</div>
+
+<form class="inline" action="/cgi-bin/koha/renewscript.pl" method="post">
+	<input type="hidden" name="bornum" value="<!-- TMPL_VAR name="bornum" -->" />
+<table>
+	<caption>Items On Loan</caption>
+	<thead>
+	<tr>
+		<th>Title</th>
+		<th>Call Number</th>
+		<th>Due</th>
+		<th>Itemtype</th>
+		<!-- Hide from NPL --><th>Charge</th><!-- /Hide from NPL -->
+		<th>Price</th>
+	</tr>
+	</thead>
+	<tfoot><tr><td colspan="4">Total Replacement Cost:</td><td class="sum"><!-- TMPL_VAR name="totalprice" --></td><td colspan="3">&nbsp;</td></tr></tfoot>
+<tbody>
+<!-- TMPL_IF NAME="issueloop" -->	<!-- TMPL_LOOP name="issueloop" -->
+	<tr>
+		<td><!-- TMPL_IF name="red" --><font color="red"><!-- /TMPL_IF -->
+		<!-- TMPL_VAR name="title" --><!-- TMPL_IF name="red" --></font><!-- /TMPL_IF -->
+		<a href="/cgi-bin/koha/detail.pl?item=<!-- TMPL_VAR name="itemnumber" -->&amp;bib=<!-- TMPL_VAR name="biblionumber" -->&amp;bi=<!-- TMPL_VAR name="biblioitemnumber" -->">
+			<!-- TMPL_VAR name="barcode" -->
+		</a>
+		</td>
+		<td><!-- TMPL_VAR name="itemcallnumber" --></td>
+		<td><!-- TMPL_VAR name="date_due" --></td>
+		<td><!-- TMPL_VAR name="itemtype" --></td>
+		<td class="credit"><!-- TMPL_VAR name="charge" --></td>
+		<td class="credit"><!-- TMPL_VAR name="price" --></td>
+	</tr>
+	<!-- /TMPL_LOOP --><!-- TMPL_ELSE --><tr><td colspan="7">Patron has no Overdue Items.</td></tr><!-- /TMPL_IF -->
+	</tbody>
+	</table>
+</form>
+
+</div>
+
+
+</dd>
+</dl>
+</body>
+</html>
\ No newline at end of file

Index: members/memberOverdues.pl
===================================================================
RCS file: members/memberOverdues.pl
diff -N members/memberOverdues.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ members/memberOverdues.pl	10 May 2007 14:50:32 -0000	1.1.2.1
@@ -0,0 +1,241 @@
+#!/usr/bin/perl
+
+# $Id: memberOverdues.pl,v 1.1.2.1 2007/05/10 14:50:32 kylemhall Exp $
+
+# script to do a borrower enquiry/bring up borrower details etc
+# Displays all the details about a borrower
+# written 20/12/99 by chris at katipo.co.nz
+# last modified 21/1/2000 by chris at katipo.co.nz
+# modified 31/1/2001 by chris at katipo.co.nz
+#   to not allow items on request to be renewed
+#
+# needs html removed and to use the C4::Output more, but its tricky
+#
+
+
+# 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 C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Interface::CGI::Template;
+use CGI;
+use C4::Search;
+use Date::Manip;
+use C4::Date;
+use C4::Reserves2;
+use C4::Circulation::Circ2;
+use C4::Koha;
+use HTML::Template;
+
+my $dbh = C4::Context->dbh;
+
+my $input = new CGI;
+
+my $print = $input->param('print');
+my $template_name;
+if ( $print eq "page" ) {
+  $template_name = "members/memberOverdues-print.tmpl";
+} else {
+  $template_name = "members/memberOverdues.tmpl";
+}
+
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => $template_name,
+			     query => $input,
+			     type => "intranet",
+			     authnotrequired => 0,
+			     flagsrequired => {borrowers => 1},
+			     debug => 1,
+			     });
+
+#Script recieves failed renewals in the syntax renewFailure1 = itemnumber, renewFailure2 = itemnumber, etc.
+#Loop through renewal failures and push them on the array @renewFailures
+my @renewFailures;
+my $renewFailuresCount = 0;
+my $renewFailuresIndex = 1; #Starts with 1 because screwy things can happen with string comparisons and 0
+my $keepGoing = 1;
+while ( $keepGoing ) {
+  my $renewFailure = $input->param('renewFailure' . $renewFailuresIndex);
+  if ( $renewFailure ) {
+    push( @renewFailures, $renewFailure );
+    $renewFailuresCount++;
+    $renewFailuresIndex++;
+  } else {
+    $keepGoing = 0;
+  }
+}
+if ( $renewFailuresCount ) {
+  $template->param( failedrenewals => $renewFailuresCount );
+}
+
+
+my $bornum=$input->param('bornum');
+
+#start the page and read in includes
+
+my $data=borrdata('',$bornum);
+
+$template->param($data->{'categorycode'} => 1); # in template <TMPL_IF name="I"> => instutitional (A for Adult & C for children)
+
+$data->{'dateenrolled'} = format_date($data->{'dateenrolled'});
+$data->{'expiry'} = format_date($data->{'expiry'});
+$data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
+$data->{'IS_ADULT'} = ($data->{'categorycode'} ne 'I');
+
+#Find the current date in the format MM/DD/YYYY to check if the account's expiry is past the current date.
+#If it *is* past the expiration date, add the Template variable 'expired' => 1
+#Note to other devs: If there is a simpler and cleaner way to do this, by all mean replace it.
+my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
+my $year = 1900 + $yearOffset;
+$month++;
+if ($month < 10) {$month = '0' . $month;}
+if ($dayOfMonth < 10) {$dayOfMonth = '0' . $dayOfMonth;}
+my $currentDate = $year . $month . $dayOfMonth;
+
+my $expiry = format_date($data->{'expiry'});
+my @expArray = split('/', $expiry);
+my $expiryDate = $expArray[2] . $expArray[0] . $expArray[1];
+
+if ( $expiryDate < $currentDate ) {
+  $data->{'expired'} = 1;
+}
+#End of check for card expiration
+
+
+if($data->{'debarred'} || $data->{'gonenoaddress'} || $data->{'lost'} || $data->{'borrowernotes'}){
+	$template->param(flagged =>1);
+}
+
+$data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
+
+$data->{&expand_sex_into_predicate($data->{'sex'})} = 1;
+
+if ($data->{'categorycode'} eq 'C'){
+	my $data2=borrdata('',$data->{'guarantor'});
+	$data->{'streetaddress'}=$data2->{'streetaddress'};
+	$data->{'city'}=$data2->{'city'};
+	$data->{'physstreet'}=$data2->{'physstreet'};
+	$data->{'streetcity'}=$data2->{'streetcity'};
+	$data->{'phone'}=$data2->{'phone'};
+	$data->{'phoneday'}=$data2->{'phoneday'};
+	$data->{'zipcode'} = $data2->{'zipcode'};
+}
+
+
+if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
+	$template->param(printethnicityline => 1);
+}
+
+if ($data->{'categorycode'} ne 'C'){
+	$template->param(isguarantee => 1);
+	# FIXME
+	# It looks like the $i is only being returned to handle walking through
+	# the array, which is probably better done as a foreach loop.
+	#
+	my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
+	my @guaranteedata;
+	for (my $i=0;$i<$count;$i++){
+		push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'},
+					cardnumber => $guarantees->[$i]->{'cardnumber'},
+					name => $guarantees->[$i]->{'firstname'} . " " . $guarantees->[$i]->{'surname'}});
+	}
+	$template->param(guaranteeloop => \@guaranteedata);
+
+} else {
+	my ($guarantor)=findguarantor($data->{'borrowernumber'});
+	unless ($guarantor->{'borrowernumber'} == 0){
+		$template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'});
+	}
+}
+
+#Independant branches management
+my $unvalidlibrarian = ((C4::Context->preference("IndependantBranches")) && (C4::Context->userenv->{flags}!=1) && ($data->{'branchcode'} ne C4::Context->userenv->{branch}));
+
+my %bor;
+$bor{'borrowernumber'}=$bornum;
+
+# Converts the branchcode to the branch name
+$data->{'branchcode'} = &getbranchname($data->{'branchcode'});
+
+# Converts the categorycode to the description
+$data->{'categorycode'} = &getborrowercategory($data->{'categorycode'});
+
+my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
+
+my ($count,$issue)=borrissues($bornum);
+my $today=ParseDate('today');
+my @issuedata;
+my $totalprice = 0;
+for (my $i=0;$i<$count;$i++){
+	my $datedue=ParseDate($issue->[$i]{'date_due'});
+	$issue->[$i]{'date_due'} = format_date($issue->[$i]{'date_due'});
+	my %row = %{$issue->[$i]};
+	$totalprice += $issue->[$i]{'replacementprice'};
+	$row{'replacementprice'}=$issue->[$i]{'replacementprice'};
+	if ($datedue < $today){
+		$row{'red'}=1; #print "<font color=red>";
+		#find the charge for an item
+		# FIXME - This is expecting
+		# &C4::Circulation::Renewals2::calc_charges, but it's getting
+		# &C4::Circulation::Circ2::calc_charges, which only returns one
+		# element, so itemtype isn't being set.
+		# But &C4::Circulation::Renewals2::calc_charges doesn't appear to
+		# return the correct item type either (or a properly-formatted
+		# charge, for that matter).
+		my ($charge,$itemtype)=calc_charges($dbh,$issue->[$i]{'itemnumber'},$bornum);
+		$row{'itemtype'}=&ItemType($itemtype);
+		$row{'charge'}= sprintf("%.2f",$charge);
+
+		push (@issuedata, \%row);
+	}
+
+}
+
+my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
+
+my @reservedata;
+foreach my $reserveline (@$reserves) {
+	$reserveline->{'reservedate2'} = format_date($reserveline->{'reservedate'});
+	my $restitle;
+	my %row = %$reserveline;
+	if ($reserveline->{'constrainttype'} eq 'o'){
+		$restitle=getreservetitle($reserveline->{'biblionumber'},$reserveline->{'borrowernumber'},$reserveline->{'reservedate'},$reserveline->{'rtimestamp'});
+		%row =  (%row , %$restitle) if $restitle;
+	}
+	push (@reservedata, \%row);
+}
+
+$template->param($data);
+$template->param(
+		 bornum          => $bornum,
+		 totalprice =>sprintf("%.2f",$totalprice),
+		 totaldue => sprintf("%.2f",$total),
+		 issueloop       => \@issuedata,
+		 unvalidlibrarian => $unvalidlibrarian,
+		 reserveloop     => \@reservedata,
+		 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+		IntranetNav => C4::Context->preference("IntranetNav"),
+		patronimages => C4::Context->preference("patronimages"),
+		intranetreadinghistory => C4::Context->preference("intranetreadinghistory"),
+		 );
+
+output_html_with_http_headers $input, $cookie, $template->output;





More information about the Koha-cvs mailing list