[Koha-cvs] CVS: koha/opac opac-membership.pl,1.1,1.2 opac-readingrecord.pl,1.1,1.2 opac-renew.pl,1.1,1.2 opac-sidebar.pl,1.1,1.2 opac-userdetails.pl,1.1,1.2 opac-account.pl,1.2,1.3 opac-detail.pl,1.5,1.6 opac-main.pl,1.4,1.5 opac-reserve.pl,1.3,1.4 opac-search.pl,1.4,1.5 opac-searchresults.pl,1.5,1.6 opac-user.pl,1.4,1.5 opac-userupdate.pl,1.4,1.5

Finlay Thompson finlayt at users.sourceforge.net
Wed Dec 4 23:27:26 CET 2002


Update of /cvsroot/koha/koha/opac
In directory sc8-pr-cvs1:/tmp/cvs-serv1459

Modified Files:
	opac-account.pl opac-detail.pl opac-main.pl opac-reserve.pl 
	opac-search.pl opac-searchresults.pl opac-user.pl 
	opac-userupdate.pl 
Added Files:
	opac-membership.pl opac-readingrecord.pl opac-renew.pl 
	opac-sidebar.pl opac-userdetails.pl 
Log Message:

merged in changes from the rel-1-2 branch into the main branch. Some of the default templates are a bit broken now....







Index: opac-account.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-account.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** opac-account.pl	28 Oct 2002 21:44:33 -0000	1.2
--- opac-account.pl	4 Dec 2002 22:25:01 -0000	1.3
***************
*** 12,25 ****
  
  my $query = new CGI;
! 
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
! 
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
! 
! my $template = gettemplate("opac-account.tmpl", "opac");
  
  # get borrower information ....
- my $borrowernumber = getborrowernumber($loggedinuser);
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  
--- 12,25 ----
  
  my $query = new CGI;
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-account.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 0,
! 			     flagsrequired => {borrow => 1},
! 			     debug => 1,
! 			     });
  
  # get borrower information ....
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  
***************
*** 41,48 ****
  }
  
  $template->param( ACCOUNT_LINES => $accts );
  
  $template->param( total => $total );
  
! $template->param( loggedinuser => $loggedinuser );
! print "Content-Type: text/html\n\n", $template->output; 
--- 41,56 ----
  }
  
+ # add the row parity
+ my $num = 0;
+ foreach my $row (@$accts) {
+     $row->{'even'} = 1 if $num % 2 == 0;
+     $row->{'odd'} = 1 if $num % 2 == 1;
+     $num++;
+ }
+ 
+ 
  $template->param( ACCOUNT_LINES => $accts );
  
  $template->param( total => $total );
  
! print $query->header(-cookie => $cookie), $template->output; 

Index: opac-detail.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-detail.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** opac-detail.pl	28 Oct 2002 20:03:02 -0000	1.5
--- opac-detail.pl	4 Dec 2002 22:25:04 -0000	1.6
***************
*** 2,6 ****
  use strict;
  require Exporter;
- use C4::Output;  # contains gettemplate
  use CGI;
  use C4::Search;
--- 2,5 ----
***************
*** 8,22 ****
  
  my $query=new CGI;
! 
! 
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
! 
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1, $flagsrequired);
! 
! 
! my $template = gettemplate ("opac-detail.tmpl", "opac");
! 
! $template->param(loggedinuser => $loggedinuser);
  
  my $biblionumber=$query->param('bib');
--- 7,17 ----
  
  my $query=new CGI;
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-detail.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 1,
! 			     flagsrequired => {borrow => 1},
! 			     });
  
  my $biblionumber=$query->param('bib');
***************
*** 41,53 ****
  foreach my $itm (@items) {
      $norequests = 0 unless $itm->{'notforloan'};
  }
  
  $template->param(norequests => $norequests);
  
! 
! 
! my @results;
! 
! $results[0]=$dat;
  
  my $resultsarray=\@results;
--- 36,45 ----
  foreach my $itm (@items) {
      $norequests = 0 unless $itm->{'notforloan'};
+     $itm->{$itm->{'publictype'}} = 1;
  }
  
  $template->param(norequests => $norequests);
  
! my @results = ($dat,);
  
  my $resultsarray=\@results;
***************
*** 56,74 ****
  my $sitearray=\@websites;
  
- 
- my $startfrom=$query->param('startfrom');
- ($startfrom) || ($startfrom=0);
- 
- my $count=1;
- 
- # now to get the items into a hash we can use and whack that thru
- $template->param(startfrom => $startfrom+1);
- $template->param(endat => $startfrom+20);
- $template->param(numrecords => $count);
- my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20);
- my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0);
- $template->param(nextstartfrom => $nextstartfrom);
- $template->param(prevstartfrom => $prevstartfrom);
- 
  $template->param(BIBLIO_RESULTS => $resultsarray);
  $template->param(ITEM_RESULTS => $itemsarray);
--- 48,51 ----
***************
*** 76,79 ****
  $template->param(SITE_RESULTS => $sitearray);
  
! print "Content-Type: text/html\n\n", $template->output;
  
--- 53,56 ----
  $template->param(SITE_RESULTS => $sitearray);
  
! print $query->header(-cookie => $cookie), $template->output;
  

Index: opac-main.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-main.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** opac-main.pl	12 Nov 2002 16:42:32 -0000	1.4
--- opac-main.pl	4 Dec 2002 22:25:12 -0000	1.5
***************
*** 5,22 ****
  use HTML::Template;
  
! use C4::Output;       # gettemplate
! use C4::Auth;         # checkauth
  
  my $query = new CGI;
  
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
  
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1, $flagsrequired);
! 
! 
! my $template = gettemplate("opac-main.tmpl", "opac");
! 
! $template->param(loggedinuser => $loggedinuser);
! 
! print "Content-Type: text/html\n\n", $template->output;
--- 5,19 ----
  use HTML::Template;
  
! use C4::Auth;       # get_template_and_user
  
  my $query = new CGI;
  
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-main.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 1,
! 			     flagsrequired => {borrow => 1},
! 			 });
  
! print $query->header(-cookie => $cookie), $template->output;

Index: opac-reserve.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** opac-reserve.pl	13 Oct 2002 10:45:59 -0000	1.3
--- opac-reserve.pl	4 Dec 2002 22:25:33 -0000	1.4
***************
*** 5,9 ****
  
  use C4::Search;
- use C4::Output;       # gettemplate
  use C4::Auth;         # checkauth, getborrowernumber.
  use C4::Koha;
--- 5,8 ----
***************
*** 12,23 ****
  
  my $query = new CGI;
! 
! 
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
! 
! my $template = gettemplate("opac-reserve.tmpl", "opac");
  
  # get borrower information ....
- my $borrowernumber = getborrowernumber($loggedinuser);
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  my @bordat;
--- 11,24 ----
  
  my $query = new CGI;
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-reserve.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 0,
! 			     flagsrequired => {borrow => 1},
! 			     debug => 1,
! 			     });
  
  # get borrower information ....
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  my @bordat;
***************
*** 34,37 ****
--- 35,40 ----
  # get the rank number....
  my ($rank,$reserves) = FindReserves($biblionumber);
+ $template->param(reservecount => $rank);
+ 
  foreach my $res (@$reserves) {
      if ($res->{'found'} eq 'W') {
***************
*** 54,57 ****
--- 57,61 ----
  # make branch selection options...
  my $branchoptions = '';
+ my @branches;
  foreach my $br (keys %$branches) {
      (next) unless $branches->{$br}->{'IS'};
***************
*** 61,103 ****
      }
      $branchoptions .= "<option value=$br $selected>$branches->{$br}->{'branchname'}</option>\n";
  }
  $template->param( branchoptions => $branchoptions);
  
  
! #get the bibitem data....
! my ($count, at data) = bibitems($biblionumber);
  
! foreach my $bibitem (@data) {
!     my @barcodes = barcodes($bibitem->{'biblioitemnumber'});
!     my $barcodestext = "";
!     foreach my $num (@barcodes) {
! 	my $message = $num->{'itemlost'} == 1 ? "(lost)" :
! 	    $num->{'itemlost'} == 2 ? "(long overdue)" : "($branches->{$num->{'holdingbranch'}}->{'branchname'})";
! 	$barcodestext .= "$num->{'barcode'} $message <br>";
!     }
!     $barcodestext = substr($barcodestext, 0, -4);
!     $bibitem->{'copies'} = $barcodestext;
  }
  
  
  
! my @reqbibs = $query->param('reqbib');
! if ($query->param('bibitemsselected')) {
!     $template->param(bibitemsselected => 1);
!     my @tempdata;
!     foreach my $bibitem (@data) {
! 	foreach my $reqbib (@reqbibs){
! 	    push @tempdata, $bibitem if ($bibitem->{'biblioitemnumber'} == $reqbib) ;
  	}
      }
-     @data = @tempdata;
- } elsif ($query->param('placereserve')) {
- # here we actually do the reserveration....
-     my $title = $bibdata->{'title'};
-     CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title);
-     warn "reserve created\n";
      print $query->redirect("/cgi-bin/koha/opac-user.pl");
  } else {
!     $template->param(selectbibitems => 1);
  }
  # check that you can actually make the reserve.
--- 65,216 ----
      }
      $branchoptions .= "<option value=$br $selected>$branches->{$br}->{'branchname'}</option>\n";
+     push @branches, {branchcode => $br, branchname => $branches->{$br}->{'branchname'}, selected => $selected};
  }
  $template->param( branchoptions => $branchoptions);
+ $template->param(BRANCHES => \@branches);
+ 
+ #### THIS IS A BIT OF A HACK BECAUSE THE BIBLIOITEMS DATA IS A LITTLE MESSED UP!
+ # get the itemtype data....
+ my @items = ItemInfo(undef, $biblionumber, 'opac');
+ my @temp;
+ foreach my $itm (@items) {
+     push @temp, $itm if $itm->{'itemtype'};
+ }
+ @items = @temp;
+ my $itemcount = @items;
+ $template->param(itemcount => $itemcount);
+ 
+ my %types;
+ my %itemtypes;
+ my @duedates;
+ foreach my $itm (@items) {
+     push @duedates, {date_due => slashifyDate($itm->{'date_due'})} if defined $itm->{'date_due'};
+     $itm->{$itm->{'publictype'}} = 1;
+     my $fee  = CalcReserveFee(undef, $borrowernumber, $itm->{'biblionumber'},'a',($itm->{'biblioitemnumber'}));
+     $fee = sprintf "%.02f", $fee;
+     $itm->{'reservefee'} = $fee;
+     my $pty = $itm->{'publictype'};
+     $itemtypes{$itm->{'itemtype'}} = $itm;
+     unless ($types {$pty}) {
+ 	$types{$pty}->{'count'} = 1;
+ 	$types{$pty}->{$itm->{'itemtype'}} = 1;
+ 	push @{$types{$pty}->{'items'}}, $itm;
+     } else {
+ 	unless ($types{$pty}->{$itm->{'itemtype'}}) {
+ 	    $types{$pty}->{'count'}++;
+ 	    $types{$pty}->{$itm->{'itemtype'}} = 1;
+ 	    push @{$types{$pty}->{'items'}}, $itm;
+ 	}
+     }
+ }
  
  
! $template->param(ITEMS => \@duedates);
  
! my $width = keys %types;
! my @publictypes = sort {$b->{'count'} <=> $a->{'count'}} values %types;
! my $typecount;
! foreach my $pt (@publictypes) {
!     $typecount += $pt->{'count'};
  }
+ $template->param(onlyone => 1) if $typecount == 1;
  
+ my @typerows;
+ for (my $rownum=0;$rownum<$publictypes[0]->{'count'} ;$rownum++) {
+     my @row;
+     foreach my $pty (@publictypes) {
+ 	my @items = @{$pty->{'items'}};
+ 	push @row, $items[$rownum] if defined $items[$rownum];
+     }
+     my $last = @row; 
+     $row[$last-1]->{'last'} =1 if $last == $width; 
+     my $fill = ($width - $last)*2;
+     $fill-- if $fill;
+     push @typerows, {ROW => \@row, fill => $fill};
+ }
+ $template->param(TYPE_ROWS => \@typerows);
+ $width = 2*$width -1;
+ $template->param(totalwidth => 2*$width-1);
+ 
+ if ($query->param('item_types_selected')) {
+ # this is what happens after the itemtypes have been selected. Stage 2
+     my @itemtypes = $query->param('itemtype');
+     my $fee = 0;
+     my $proceed = 0;
+     if (@itemtypes) {
+ 	my %newtypes;
+ 	foreach my $itmtype (@itemtypes) {
+ 	    $newtypes{$itmtype} = $itemtypes{$itmtype};
+ 	}
+ 	my @types = values %newtypes;
+ 	$template->param(TYPES => \@types);
+ 	foreach my $type (@itemtypes) {
+ 	    my @reqbibs;
+ 	    foreach my $item (@items) {
+ 		if ($item->{'itemtype'} eq $type) {
+ 		    push @reqbibs, $item->{'biblioitemnumber'};
+ 		}
+ 	    }
+ 	    $fee += CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',\@reqbibs);
+ 	}
+ 	$proceed = 1;
+     } elsif ($query->param('all')) {
+ 	$template->param(all => 1);
+ 	$fee = 1;
+ 	$proceed = 1;
+     }
+     if ($proceed) {
+ 	$fee = sprintf "%.02f", $fee;
+ 	$template->param(fee => $fee);
+ 	$template->param(item_types_selected => 1);
+     } else {
+ 	$template->param(message => 1);
+ 	$template->param(no_items_selected => 1);
+     }
  
  
! } elsif ($query->param('place_reserve')) {
! # here we actually do the reserveration. Stage 3.
!     my $title = $bibdata->{'title'};
!     my @itemtypes = $query->param('itemtype');
!     foreach my $type (@itemtypes) {
! 	my @reqbibs;
! 	foreach my $item (@items) {
! 	    if ($item->{'itemtype'} eq $type) {
! 		push @reqbibs, $item->{'biblioitemnumber'};
! 	    }
  	}
+ 	CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title);
+     }
+     if ($query->param('all')) {
+ 	CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef, $rank,'',$title);
      }
      print $query->redirect("/cgi-bin/koha/opac-user.pl");
  } else {
! # Here we check that the borrower can actually make reserves Stage 1.
!     my $noreserves = 0;
!     if ($borr->{'amountoutstanding'} > 5) {
!   	my $amount = sprintf "\$%.02f", $borr->{'amountoutstanding'};
! 	$template->param(message => 1);
! 	$noreserves = 1;
! 	$template->param(too_much_oweing => $amount);
!     }
!     my ($resnum, $reserves) = FindReserves(undef, $borrowernumber); 
!     $template->param(RESERVES => $reserves);
!     if ($resnum >= $MAXIMUM_NUMBER_OF_RESERVES) {
! 	$template->param(message => 1);
! 	$noreserves = 1;
! 	$template->param(too_many_reserves => $resnum);
!     }
!     foreach my $res (@$reserves) {
! 	if ($res->{'biblionumber'} == $biblionumber) {
! 	    $template->param(message => 1);
! 	    $noreserves = 1;
! 	    $template->param(already_reserved => 1);
! 	}
!     }
!     unless ($noreserves) {
! 	$template->param(select_item_types => 1);
!     }
  }
  # check that you can actually make the reserve.
***************
*** 107,110 ****
  $template->param(BIBLIOITEMS => \@data);
  
! $template->param(loggedinuser => $loggedinuser);
! print "Content-Type: text/html\n\n", $template->output;
--- 220,223 ----
  $template->param(BIBLIOITEMS => \@data);
  
! 
! print $query->header(-cookie => $cookie), $template->output;

Index: opac-search.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-search.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** opac-search.pl	28 Oct 2002 20:03:08 -0000	1.4
--- opac-search.pl	4 Dec 2002 22:25:40 -0000	1.5
***************
*** 3,20 ****
  require Exporter;
  
- use C4::Output;
- use CGI;
  use C4::Auth;
  
! my $query = new CGI;
  
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
  
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query ,1, $flagsrequired);
  
- my $template = gettemplate("opac-search.tmpl", "opac");
  
! $template->param(loggedinuser => $loggedinuser);
  
! print "Content-Type: text/html\n\n", $template->output;
--- 3,32 ----
  require Exporter;
  
  use C4::Auth;
+ use CGI;
+ use C4::Database;
  
! my $classlist='';
  
! my $dbh=C4Connect;
! my $sth=$dbh->prepare("select groupname,itemtypes from itemtypesearchgroups order by groupname");
! $sth->execute;
! while (my ($groupname,$itemtypes) = $sth->fetchrow) {
!     $classlist.="<option value=\"$itemtypes\">$groupname\n";
! }
! 
! 
! my $query = new CGI;
  
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-search.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 1,
! 			     flagsrequired => {borrow => 1},
! 			 });
  
  
! $template->param(classlist => $classlist);
  
! print $query->header(-cookie => $cookie), $template->output;

Index: opac-searchresults.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-searchresults.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** opac-searchresults.pl	28 Oct 2002 20:03:09 -0000	1.5
--- opac-searchresults.pl	4 Dec 2002 22:25:42 -0000	1.6
***************
*** 5,20 ****
  use C4::Search;
  use C4::Auth;
- use C4::Output; # now contains gettemplate
  
  my $query=new CGI;
  
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
! 
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1, $flagsrequired);
! 
! 
! my $template = gettemplate ("opac-searchresults.tmpl", "opac");
! 
  
  
--- 5,18 ----
  use C4::Search;
  use C4::Auth;
  
  my $query=new CGI;
  
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-searchresults.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 1,
! 			     flagsrequired => {borrow => 1},
! 			 });
  
  
***************
*** 22,25 ****
--- 20,24 ----
  
  
+ 
  if ($subject) {
      $template->param(subjectsearch => $subject);
***************
*** 34,41 ****
--- 33,44 ----
  # collect all the fields ...
  my %search;
+ 
  my $forminputs;
  my $searchdesc = '';
  foreach my $field (@fields) {
      $search{$field} = $query->param($field);
+     if ($field eq 'keyword'){
+ 	$search{$field} = $query->param('words') unless $search{$field};
+     }
      if ($search{$field}) {
  	push @$forminputs, {field => $field, value => $search{$field}};
***************
*** 43,46 ****
--- 46,50 ----
      }
  }
+ 
  $search{'ttype'} = $query->param('ttype');
  push @$forminputs, {field => 'ttype', value => $search{'ttype'}};
***************
*** 57,61 ****
  my $env;
  $env->{itemcount}=1;
! my $num=10;
  my @results;
  my $count;
--- 61,65 ----
  my $env;
  $env->{itemcount}=1;
! my $number_of_results = 20;
  my @results;
  my $count;
***************
*** 63,72 ****
  my $subjectitems=$query->param('subjectitems');
  if ($subjectitems) {
!     @results = subsearch($env,$subjectitems, $num, $startfrom);
      $count = $#results+1;
  } else {
!     ($count, @results) = catalogsearch($env,'',\%search,$num,$startfrom);
  }
  
  foreach my $res (@results) {
      my @items = ItemInfo(undef, $res->{'biblionumber'}, "intra");
--- 67,77 ----
  my $subjectitems=$query->param('subjectitems');
  if ($subjectitems) {
!     @results = subsearch($env,$subjectitems, $number_of_results, $startfrom);
      $count = $#results+1;
  } else {
!     ($count, @results) = catalogsearch($env,'',\%search,$number_of_results,$startfrom);
  }
  
+ my $num = 1;
  foreach my $res (@results) {
      my @items = ItemInfo(undef, $res->{'biblionumber'}, "intra");
***************
*** 76,79 ****
--- 81,88 ----
      }
      $res->{'norequests'} = $norequests;
+     # set up the even odd elements....
+     $res->{'even'} = 1 if $num % 2 == 0;
+     $res->{'odd'} = 1 if $num % 2 == 1;
+     $num++;
  }
  
***************
*** 103,107 ****
  $template->param(searchdesc => $searchdesc);
  $template->param(SEARCH_RESULTS => $resultsarray);
- $template->param(loggedinuser => $loggedinuser);
  
  my $numbers;
--- 112,115 ----
***************
*** 117,122 ****
  
  $template->param(numbers => $numbers);
- 
- $template->param(loggedinuser => $loggedinuser);
  
  print $query->header(-cookie => $cookie), $template->output;
--- 125,128 ----

Index: opac-user.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-user.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** opac-user.pl	28 Oct 2002 20:03:09 -0000	1.4
--- opac-user.pl	4 Dec 2002 22:25:55 -0000	1.5
***************
*** 4,24 ****
  use CGI;
  
! use C4::Output;       # gettemplate
! use C4::Auth;         # checkauth, getborrowernumber.
  use C4::Koha;
  use C4::Circulation::Circ2;
  use C4::Reserves2;
  
  my $query = new CGI;
! 
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
! 
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
! 
! my $template = gettemplate("opac-user.tmpl", "opac");
  
  # get borrower information ....
- my $borrowernumber = getborrowernumber($loggedinuser);
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  
--- 4,25 ----
  use CGI;
  
! use C4::Auth;
  use C4::Koha;
  use C4::Circulation::Circ2;
+ use C4::Circulation::Renewals2;
  use C4::Reserves2;
+ use C4::Search;
  
  my $query = new CGI;
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-user.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 0,
! 			     flagsrequired => {borrow => 1},
! 			     debug => 1,
! 			     });
  
  # get borrower information ....
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  
***************
*** 45,69 ****
  
  $template->param(BORROWER_INFO => \@bordat);
  
  #get issued items ....
  my $issues = getissues($borr);
  
! my $count=0;
  my @issuedat;
  foreach my $key (keys %$issues) {
      my $issue = $issues->{$key};
      $issue->{'date_due'}  = slashifyDate($issue->{'date_due'});
!     if ($issue->{'overdue'}) {
! 	$issue->{'status'} = "<font color='red'>OVERDUE</font>";
!     } else {
! 	$issue->{'status'} = "Issued";
!     }
! # check for reserves
      my ($restype, $res) = CheckReserves($issue->{'itemnumber'});
      if ($restype) {
! 	$issue->{'status'} .= " Reserved";
      }
-     my ($charges, $itemtype) = calc_charges(undef, undef, $issue->{'itemnumber'}, $borrowernumber);
      $issue->{'charges'} = $charges;
      push @issuedat, $issue;
      $count++;
--- 46,96 ----
  
  $template->param(BORROWER_INFO => \@bordat);
+ $template->param(borrowernumber => $borrowernumber);
  
  #get issued items ....
  my $issues = getissues($borr);
  
! my $count = 0;
! my $overdues_count = 0;
! my @overdues;
  my @issuedat;
  foreach my $key (keys %$issues) {
      my $issue = $issues->{$key};
      $issue->{'date_due'}  = slashifyDate($issue->{'date_due'});
! 
!     # check for reserves
      my ($restype, $res) = CheckReserves($issue->{'itemnumber'});
      if ($restype) {
! 	$issue->{'reserved'} = 1;
!     }
! 
!     my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);
!     my $charges = 0;
!     foreach my $ac (@$accts) {
! 	if ($ac->{'itemnumber'} == $issue->{'itemnumber'}) {
! 	    $charges += $ac->{'amountoutstanding'} if $ac->{'accounttype'} eq 'F'; 
! 	    $charges += $ac->{'amountoutstanding'} if $ac->{'accounttype'} eq 'L';
! 	} 
      }
      $issue->{'charges'} = $charges;
+ 
+     # get publictype for icon
+     
+     my $publictype = $issue->{'publictype'};
+     $issue->{$publictype} = 1;
+ 
+     # check if item is renewable
+     my %env;
+     my $status = renewstatus(\%env,$borrowernumber, $issue->{'itemnumber'});
+ 
+     $issue->{'renewable'} = $status;
+     
+     if ($issue->{'overdue'}) {
+ 	push @overdues, $issue;
+ 	$overdues_count++;
+ 	$issue->{'overdue'} = 1;
+     } else {
+ 	$issue->{'issued'} = 1;
+     }
      push @issuedat, $issue;
      $count++;
***************
*** 73,80 ****
--- 100,116 ----
  $template->param(issues_count => $count);
  
+ $template->param(OVERDUES => \@overdues);
+ $template->param(overdues_count => $overdues_count);
+ 
+ my $branches = getbranches();
+ 
  # now the reserved items....
  my ($rcount, $reserves) = FindReserves(undef, $borrowernumber);
  foreach my $res (@$reserves) {
      $res->{'reservedate'}  = slashifyDate($res->{'reservedate'});
+     my $publictype = $res->{'publictype'};
+     $res->{$publictype} = 1;
+     $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
+     $res->{'branch'} = $branches->{$res->{'branchcode'}}->{'branchname'};
  }
  
***************
*** 82,86 ****
  $template->param(reserves_count => $rcount);
  
- my $branches = getbranches();
  my @waiting;
  my $wcount = 0;
--- 118,121 ----
***************
*** 93,99 ****
  }
  
! $template->param(WAITING => \@waiting);
  $template->param(waiting_count => $wcount);
  
! $template->param(loggedinuser => $loggedinuser);
! print "Content-Type: text/html\n\n", $template->output;
--- 128,134 ----
  }
  
! # $template->param(WAITING => \@waiting);
  $template->param(waiting_count => $wcount);
  
! print $query->header(-cookie => $cookie), $template->output;
! 

Index: opac-userupdate.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-userupdate.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** opac-userupdate.pl	28 Oct 2002 20:03:10 -0000	1.4
--- opac-userupdate.pl	4 Dec 2002 22:26:08 -0000	1.5
***************
*** 5,9 ****
  use Mail::Sendmail;
  
- use C4::Output;       # gettemplate
  use C4::Auth;         # checkauth, getborrowernumber.
  use C4::Koha;
--- 5,8 ----
***************
*** 13,23 ****
  my $query = new CGI;
  
! my $flagsrequired;
! $flagsrequired->{borrow}=1;
! 
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
  
  # get borrower information ....
- my $borrowernumber = getborrowernumber($loggedinuser);
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  
--- 12,25 ----
  my $query = new CGI;
  
! my ($template, $borrowernumber, $cookie) 
!     = get_template_and_user({template_name => "opac-userupdate.tmpl",
! 			     query => $query,
! 			     type => "opac",
! 			     authnotrequired => 0,
! 			     flagsrequired => {borrow => 1},
! 			     debug => 1,
! 			     });
  
  # get borrower information ....
  my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
  
***************
*** 54,59 ****
  }
  
- my $template = gettemplate("opac-userupdate.tmpl", "opac");
- 
  
  $borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
--- 56,59 ----
***************
*** 68,73 ****
  $template->param(BORROWER_INFO => \@bordat);
  
! 
! $template->param(loggedinuser => $loggedinuser);
! 
! print "Content-Type: text/html\n\n", $template->output;
--- 68,70 ----
  $template->param(BORROWER_INFO => \@bordat);
  
! print $query->header(-cookie => $cookie), $template->output;





More information about the Koha-cvs mailing list