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

This commit is contained in:
finlayt 2002-12-04 22:25:01 +00:00
parent 2ee268c632
commit 2b8ef90945
13 changed files with 454 additions and 149 deletions

View File

@ -11,16 +11,16 @@ use C4::Circulation::Circ2;
use C4::Auth;
my $query = new CGI;
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
my $template = gettemplate("opac-account.tmpl", "opac");
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 $borrowernumber = getborrowernumber($loggedinuser);
my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
my @bordat;
@ -40,9 +40,17 @@ for (my $i=0;$i<$numaccts;$i++){
}
}
# 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 );
$template->param( loggedinuser => $loggedinuser );
print "Content-Type: text/html\n\n", $template->output;
print $query->header(-cookie => $cookie), $template->output;

View File

@ -1,23 +1,18 @@
#!/usr/bin/perl
use strict;
require Exporter;
use C4::Output; # contains gettemplate
use CGI;
use C4::Search;
use C4::Auth;
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 ($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');
$template->param(biblionumber => $biblionumber);
@ -40,40 +35,22 @@ for (my $i = 1; $i < $authorcount; $i++) {
my $norequests = 1;
foreach my $itm (@items) {
$norequests = 0 unless $itm->{'notforloan'};
$itm->{$itm->{'publictype'}} = 1;
}
$template->param(norequests => $norequests);
my @results;
$results[0]=$dat;
my @results = ($dat,);
my $resultsarray=\@results;
my $itemsarray=\@items;
my $webarray=\@webbiblioitems;
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);
$template->param(WEB_RESULTS => $webarray);
$template->param(SITE_RESULTS => $sitearray);
print "Content-Type: text/html\n\n", $template->output;
print $query->header(-cookie => $cookie), $template->output;

View File

@ -4,19 +4,16 @@ require Exporter;
use CGI;
use HTML::Template;
use C4::Output; # gettemplate
use C4::Auth; # checkauth
use C4::Auth; # get_template_and_user
my $query = new CGI;
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "opac-main.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
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;
print $query->header(-cookie => $cookie), $template->output;

18
opac/opac-membership.pl Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
use strict;
require Exporter;
use CGI;
use C4::Auth; # get_template_and_user
my $query = new CGI;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "opac-membership.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
flagsrequired => {borrow => 1},
});
print $query->header(-cookie => $cookie), $template->output;

54
opac/opac-readingrecord.pl Executable file
View File

@ -0,0 +1,54 @@
#!/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;

25
opac/opac-renew.pl Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/perl
#written 18/1/2000 by chris@katipo.co.nz
# adapted for use in the hlt opac by finlay@katipo.co.nz 29/11/2002
#script to renew items from the web
use CGI;
use C4::Circulation::Renewals2;
my $query = new CGI;
my $itemnumber = $query->param('item');
my $borrowernumber = $query->param("bornum");
my %env;
my $status = renewstatus(\%env,$borrowernumber,$itemnumber);
if ($status == 1){
renewbook(\%env,$borrowernumber,$itemnumber);
}
if ($query->param('from') eq 'opac_user') {
print $query->redirect("/cgi-bin/koha/opac-user.pl");
}

View File

@ -4,21 +4,22 @@ require Exporter;
use CGI;
use C4::Search;
use C4::Output; # gettemplate
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Reserves2;
my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
my $template = gettemplate("opac-reserve.tmpl", "opac");
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 $borrowernumber = getborrowernumber($loggedinuser);
my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
my @bordat;
$bordat[0] = $borr;
@ -33,6 +34,8 @@ $template->param($bibdata);
# get the rank number....
my ($rank,$reserves) = FindReserves($biblionumber);
$template->param(reservecount => $rank);
foreach my $res (@$reserves) {
if ($res->{'found'} eq 'W') {
$rank--;
@ -53,6 +56,7 @@ $template->param(branchname => $branches->{$branch}->{'branchname'});
# make branch selection options...
my $branchoptions = '';
my @branches;
foreach my $br (keys %$branches) {
(next) unless $branches->{$br}->{'IS'};
my $selected = "";
@ -60,45 +64,154 @@ foreach my $br (keys %$branches) {
$selected = "selected";
}
$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);
#get the bibitem data....
my ($count,@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>";
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;
}
}
$barcodestext = substr($barcodestext, 0, -4);
$bibitem->{'copies'} = $barcodestext;
}
$template->param(ITEMS => \@duedates);
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) ;
}
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];
}
@data = @tempdata;
} elsif ($query->param('placereserve')) {
# here we actually do the reserveration....
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'};
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title);
warn "reserve created\n";
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 {
$template->param(selectbibitems => 1);
# 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.
@ -106,5 +219,5 @@ if ($query->param('bibitemsselected')) {
$template->param(BIBLIOITEMS => \@data);
$template->param(loggedinuser => $loggedinuser);
print "Content-Type: text/html\n\n", $template->output;
print $query->header(-cookie => $cookie), $template->output;

View File

@ -2,19 +2,31 @@
use strict;
require Exporter;
use C4::Output;
use CGI;
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 $flagsrequired;
$flagsrequired->{borrow}=1;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "opac-search.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
flagsrequired => {borrow => 1},
});
my ($loggedinuser, $cookie, $sessionID) = checkauth($query ,1, $flagsrequired);
my $template = gettemplate("opac-search.tmpl", "opac");
$template->param(classlist => $classlist);
$template->param(loggedinuser => $loggedinuser);
print "Content-Type: text/html\n\n", $template->output;
print $query->header(-cookie => $cookie), $template->output;

View File

@ -4,23 +4,22 @@ require Exporter;
use CGI;
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");
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "opac-searchresults.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
flagsrequired => {borrow => 1},
});
my $subject=$query->param('subject');
if ($subject) {
$template->param(subjectsearch => $subject);
}
@ -33,15 +32,20 @@ my @fields = ('keyword', 'subject', 'author', 'illustrator', 'itemnumber', 'isbn
# 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}};
$searchdesc .= "$field = $search{$field}, ";
}
}
$search{'ttype'} = $query->param('ttype');
push @$forminputs, {field => 'ttype', value => $search{'ttype'}};
@ -56,18 +60,19 @@ $template->param(FORMINPUTS => $forminputs);
# do the searchs ....
my $env;
$env->{itemcount}=1;
my $num=10;
my $number_of_results = 20;
my @results;
my $count;
my $startfrom = $query->param('startfrom');
my $subjectitems=$query->param('subjectitems');
if ($subjectitems) {
@results = subsearch($env,$subjectitems, $num, $startfrom);
@results = subsearch($env,$subjectitems, $number_of_results, $startfrom);
$count = $#results+1;
} else {
($count, @results) = catalogsearch($env,'',\%search,$num,$startfrom);
($count, @results) = catalogsearch($env,'',\%search,$number_of_results,$startfrom);
}
my $num = 1;
foreach my $res (@results) {
my @items = ItemInfo(undef, $res->{'biblionumber'}, "intra");
my $norequests = 1;
@ -75,6 +80,10 @@ foreach my $res (@results) {
$norequests = 0 unless $itm->{'notforloan'};
}
$res->{'norequests'} = $norequests;
# set up the even odd elements....
$res->{'even'} = 1 if $num % 2 == 0;
$res->{'odd'} = 1 if $num % 2 == 1;
$num++;
}
@ -102,7 +111,6 @@ $template->param(prevstartfrom => $prevstartfrom);
$template->param(searchdesc => $searchdesc);
$template->param(SEARCH_RESULTS => $resultsarray);
$template->param(loggedinuser => $loggedinuser);
my $numbers;
@$numbers = ();
@ -117,7 +125,5 @@ if ($count>10) {
$template->param(numbers => $numbers);
$template->param(loggedinuser => $loggedinuser);
print $query->header(-cookie => $cookie), $template->output;

30
opac/opac-sidebar.pl Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
use strict;
require Exporter;
use CGI;
use C4::Auth; # get_template_and_user
my $query = new CGI;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "loggedin.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
flagsrequired => {borrow => 1},
});
my @inputs =();
foreach my $name (param $query) {
(next) if ($name eq 'userid' || $name eq 'password');
my $value = $query->param($name);
push @inputs, {name => $name , value => $value};
}
$template->param(INPUTS => \@inputs);
my $self_url = $query->url(-absolute => 1);
$template->param(url => $self_url);
print $query->header(-cookie => $cookie), $template->output;

View File

@ -3,23 +3,24 @@ use strict;
require Exporter;
use CGI;
use C4::Output; # gettemplate
use C4::Auth; # checkauth, getborrowernumber.
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 $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
my $template = gettemplate("opac-user.tmpl", "opac");
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 $borrowernumber = getborrowernumber($loggedinuser);
my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
@ -44,27 +45,53 @@ my @bordat;
$bordat[0] = $borr;
$template->param(BORROWER_INFO => \@bordat);
$template->param(borrowernumber => $borrowernumber);
#get issued items ....
my $issues = getissues($borr);
my $count=0;
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'});
if ($issue->{'overdue'}) {
$issue->{'status'} = "<font color='red'>OVERDUE</font>";
} else {
$issue->{'status'} = "Issued";
}
# check for reserves
# check for reserves
my ($restype, $res) = CheckReserves($issue->{'itemnumber'});
if ($restype) {
$issue->{'status'} .= " Reserved";
$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';
}
}
my ($charges, $itemtype) = calc_charges(undef, undef, $issue->{'itemnumber'}, $borrowernumber);
$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++;
}
@ -72,16 +99,24 @@ foreach my $key (keys %$issues) {
$template->param(ISSUES => \@issuedat);
$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'};
}
$template->param(RESERVES => $reserves);
$template->param(reserves_count => $rcount);
my $branches = getbranches();
my @waiting;
my $wcount = 0;
foreach my $res (@$reserves) {
@ -92,8 +127,8 @@ foreach my $res (@$reserves) {
}
}
$template->param(WAITING => \@waiting);
# $template->param(WAITING => \@waiting);
$template->param(waiting_count => $wcount);
$template->param(loggedinuser => $loggedinuser);
print "Content-Type: text/html\n\n", $template->output;
print $query->header(-cookie => $cookie), $template->output;

33
opac/opac-userdetails.pl Executable file
View File

@ -0,0 +1,33 @@
#!/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;

View File

@ -4,7 +4,6 @@ require Exporter;
use CGI;
use Mail::Sendmail;
use C4::Output; # gettemplate
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
use C4::Circulation::Circ2;
@ -12,13 +11,16 @@ use C4::Circulation::Circ2;
my $query = new CGI;
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
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 $borrowernumber = getborrowernumber($loggedinuser);
my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
@ -53,8 +55,6 @@ EOF
}
}
my $template = gettemplate("opac-userupdate.tmpl", "opac");
$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
$borr->{'expiry'} = slashifyDate($borr->{'expiry'});
@ -67,7 +67,4 @@ $bordat[0] = $borr;
$template->param(BORROWER_INFO => \@bordat);
$template->param(loggedinuser => $loggedinuser);
print "Content-Type: text/html\n\n", $template->output;
print $query->header(-cookie => $cookie), $template->output;