[Koha-cvs] CVS: koha/opac opac-readingrecord.pl,NONE,1.1.2.1 opac-userdetails.pl,NONE,1.1.2.1 opac-searchresults.pl,1.1.2.7,1.1.2.8 opac-user.pl,1.1.2.8,1.1.2.9

Finlay Thompson finlayt at users.sourceforge.net
Tue Nov 26 05:40:05 CET 2002


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

Modified Files:
      Tag: rel-1-2
	opac-searchresults.pl opac-user.pl 
Added Files:
      Tag: rel-1-2
	opac-readingrecord.pl opac-userdetails.pl 
Log Message:

Added the reading record and users details scripts. and fixed a few little things in the other two.


--- NEW FILE ---
#!/usr/bin/perl
use strict;
require Exporter;
use CGI;

use C4::Auth;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Search;

my $query = new CGI;
my ($template, $borrowernumber, $cookie) 
    = get_template_and_user({template_name => "opac-readingrecord.tmpl",
			     query => $query,
			     type => "opac",
			     authnotrequired => 0,
			     flagsrequired => {borrow => 1},
			     debug => 1,
			     });

# get borrower information ....
my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);


$template->param($borr);

# get the record
my $order=$query->param('order');
my $order2=$order;
if ($order2 eq ''){
  $order2="date_due desc";
}
my $limit=$query->param('limit');
if ($limit eq 'full'){
  $limit=0;
} else {
  $limit=50;
}
my ($count,$issues)=allissues($borrowernumber,$order2,$limit);

# add the row parity
my $num = 0;
foreach my $row (@$issues) {
    $row->{'even'} = 1 if $num % 2 == 0;
    $row->{'odd'} = 1 if $num % 2 == 1;
    $num++;
}

$template->param(count => $count);
$template->param(READING_RECORD => $issues);


print $query->header(-cookie => $cookie), $template->output;


--- NEW FILE ---
#!/usr/bin/perl
use strict;
require Exporter;
use CGI;

use C4::Auth;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Search;

my $query = new CGI;
my ($template, $borrowernumber, $cookie) 
    = get_template_and_user({template_name => "opac-userdetails.tmpl",
			     query => $query,
			     type => "opac",
			     authnotrequired => 0,
			     flagsrequired => {borrow => 1},
			     debug => 1,
			     });

# get borrower information ....
my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);

$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
$borr->{'expiry'}       = slashifyDate($borr->{'expiry'});
$borr->{'dateofbirth'}  = slashifyDate($borr->{'dateofbirth'});
$borr->{'ethnicity'}    = fixEthnicity($borr->{'ethnicity'});


$template->param($borr);

print $query->header(-cookie => $cookie), $template->output;


Index: opac-searchresults.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-searchresults.pl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -r1.1.2.7 -r1.1.2.8
*** opac-searchresults.pl	14 Nov 2002 22:14:52 -0000	1.1.2.7
--- opac-searchresults.pl	26 Nov 2002 04:40:02 -0000	1.1.2.8
***************
*** 61,65 ****
  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;
***************
*** 67,74 ****
  my $subjectitems=$query->param('subjectitems');
  if ($subjectitems) {
!     @results = subsearch($env,$subjectitems, $num, $startfrom);
      $count = $#results+1;
  } else {
!     ($count, @results) = catalogsearch($env,'',\%search,$num,$startfrom);
  }
  
--- 67,74 ----
  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);
  }
  

Index: opac-user.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-user.pl,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -r1.1.2.8 -r1.1.2.9
*** opac-user.pl	14 Nov 2002 22:14:52 -0000	1.1.2.8
--- opac-user.pl	26 Nov 2002 04:40:02 -0000	1.1.2.9
***************
*** 16,19 ****
--- 16,20 ----
  			     authnotrequired => 0,
  			     flagsrequired => {borrow => 1},
+ 			     debug => 1,
  			     });
  
***************
*** 47,60 ****
  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'});
--- 48,58 ----
  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'});
***************
*** 64,67 ****
--- 62,78 ----
      my ($charges, $itemtype) = calc_charges(undef, undef, $issue->{'itemnumber'}, $borrowernumber);
      $issue->{'charges'} = $charges;
+ 
+     my $publictype = $issue->{'publictype'};
+     $issue->{$publictype} = 1;
+ 
+ 
+     if ($issue->{'overdue'}) {
+ 	push @overdues, $issue;
+ 	foreach my $k (keys %$issue) {warn "$k : $issue->{$k}";}
+ 	$overdues_count++;
+ 	$issue->{'status'} = "<font color='red'>OVERDUE</font>";
+     } else {
+ 	$issue->{'status'} = "Issued";
+     }
      push @issuedat, $issue;
      $count++;
***************
*** 71,78 ****
--- 82,98 ----
  $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'};
  }
  
***************
*** 80,84 ****
  $template->param(reserves_count => $rcount);
  
- my $branches = getbranches();
  my @waiting;
  my $wcount = 0;
--- 100,103 ----
***************
*** 91,95 ****
  }
  
! $template->param(WAITING => \@waiting);
  $template->param(waiting_count => $wcount);
  
--- 110,114 ----
  }
  
! # $template->param(WAITING => \@waiting);
  $template->param(waiting_count => $wcount);
  





More information about the Koha-cvs mailing list