Merging from rel-1-2 to trunk

This commit is contained in:
tonnesen 2002-10-28 20:02:57 +00:00
parent 6e9e3cf3ab
commit c16a952963
8 changed files with 103 additions and 22 deletions

View File

@ -22,6 +22,9 @@ use strict;
require Exporter;
#use C4::InterfaceCDK;
use C4::Context;
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
@ -46,7 +49,7 @@ The functions in this module handle sending text to a printer.
=cut
@ISA = qw(Exporter);
@EXPORT = qw(&remoteprint &printslip);
@EXPORT = qw(&remoteprint &printreserve &printslip);
=item remoteprint
@ -71,10 +74,8 @@ from C<&currentissues>.
# FIXME - It'd be nifty if this could generate pretty PostScript.
sub remoteprint {
my ($env,$items,$borrower)=@_;
#open (FILE,">/tmp/olwen");
#print FILE "queue $env->{'queue'}";
#close FILE;
#debug_msg($env,"In print");
(return) unless (C4::Context->preference('printcirculationslips'));
my $file=time; # FIXME - Not used
my $queue = $env->{'queue'};
# FIXME - If 'queue' is undefined or empty, then presumably it should
@ -91,7 +92,7 @@ sub remoteprint {
# This is a reasonable assumption, but only because every other
# printing package has a wrapper script called 'lpr'. It'd still
# be better to be able to customize this.
open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$queue!\n";
open(PRINTER, "| lpr -P $queue > /dev/null") or die "Couldn't write to queue:$queue!\n";
}
# print $queue;
#open (FILE,">/tmp/$file");
@ -126,6 +127,47 @@ sub remoteprint {
#system("lpr /tmp/$file");
}
sub printreserve {
my($env, $branchname, $bordata, $itemdata)=@_;
my $file=time;
my $printer = $env->{'printer'};
(return) unless (C4::Context->preference('printreserveslips'));
if ($printer eq "" || $printer eq 'nulllp') {
open (PRINTER,">>/tmp/kohares");
} else {
open (PRINTER, "| lpr -P $printer >/dev/null") or die "Couldn't write to queue:$!\n";
}
my @da = localtime(time());
my $todaysdate = "$da[2]:$da[1] $da[3]/$da[4]/$da[5]";
#(1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
my $slip = <<"EOF";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date: $todaysdate;
ITEM RESERVED:
$itemdata->{'title'} ($itemdata->{'author'})
barcode: $itemdata->{'barcode'}
COLLECT AT: $branchname
BORROWER:
$bordata->{'surname'}, $bordata->{'firstname'}
card number: $bordata->{'cardnumber'}
Phone: $bordata->{'phone'}
$bordata->{'streetaddress'}
$bordata->{'suburb'}
$bordata->{'town'}
$bordata->{'emailaddress'}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EOF
print PRINTER $slip;
close PRINTER;
return $slip;
}
=item printslip
&printslip($env, $text)
@ -142,10 +184,11 @@ will print to the file F</tmp/kohares>.
sub printslip {
my($env, $slip)=@_;
my $printer = $env->{'printer'};
(return) unless (C4::Context->preference('printcirculationslips'));
if ($printer eq "" || $printer eq 'nulllp') {
open (PRINTER,">/tmp/kohares");
} else {
open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n";
open (PRINTER, "| lpr -P $printer >/dev/null") or die "Couldn't write to queue:$!\n";
}
print PRINTER $slip;
close PRINTER;

View File

@ -3,13 +3,13 @@ use HTML::Template;
use strict;
require Exporter;
use C4::Database;
use C4::Output; # contains picktemplate
use C4::Output; # contains gettemplate
use CGI;
use C4::Auth;
my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
my $template=gettemplate("intranet-main.tmpl");
my $template = gettemplate("intranet-main.tmpl");
print "Content-Type: text/html\n\n", $template->output;

View File

@ -8,13 +8,19 @@ use C4::Auth;
my $query=new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1);
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');
$template->param(biblionumber => $biblionumber);
# change back when ive fixed request.pl
@ -31,6 +37,15 @@ for (my $i = 1; $i < $authorcount; $i++) {
$dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
} # for
my $norequests = 1;
foreach my $itm (@items) {
$norequests = 0 unless $itm->{'notforloan'};
}
$template->param(norequests => $norequests);
my @results;
$results[0]=$dat;

View File

@ -8,7 +8,11 @@ use C4::Auth; # checkauth
my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1);
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1, $flagsrequired);
my $template = gettemplate("opac-main.tmpl", "opac");

View File

@ -7,7 +7,11 @@ use CGI;
use C4::Auth;
my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query ,1);
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query ,1, $flagsrequired);
my $template = gettemplate("opac-search.tmpl", "opac");

View File

@ -8,7 +8,10 @@ use C4::Output; # now contains gettemplate
my $query=new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1);
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1, $flagsrequired);
my $template = gettemplate ("opac-searchresults.tmpl", "opac");
@ -59,8 +62,7 @@ my $count;
my $startfrom = $query->param('startfrom');
my $subjectitems=$query->param('subjectitems');
if ($subjectitems) {
my $blah;
@results = subsearch(\$blah,$subjectitems, $num, $startfrom);
@results = subsearch($env,$subjectitems, $num, $startfrom);
$count = $#results+1;
} else {
($count, @results) = catalogsearch($env,'',\%search,$num,$startfrom);

View File

@ -3,7 +3,6 @@ use strict;
require Exporter;
use CGI;
use C4::Search; # borrdata
use C4::Output; # gettemplate
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
@ -12,7 +11,10 @@ use C4::Reserves2;
my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
my $template = gettemplate("opac-user.tmpl", "opac");
@ -27,8 +29,13 @@ $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'});
if ($borr->{'amountoutstanding'} > 5) {
$borr->{'amountoverfive'} = 1;
} else {
$borr->{'amountoverfive'} = 0;
}
if (5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
$borr->{'amountoverzero'} = 1;
}
if ($borr->{'amountoutstanding'} < 0) {
$borr->{'amountlessthanzero'} = 1;
$borr->{'amountoutstanding'} = -1*($borr->{'amountoutstanding'});
}
$borr->{'amountoutstanding'} = sprintf "\$%.02f", $borr->{'amountoutstanding'};
@ -47,14 +54,14 @@ foreach my $key (keys %$issues) {
my $issue = $issues->{$key};
$issue->{'date_due'} = slashifyDate($issue->{'date_due'});
if ($issue->{'overdue'}) {
$issue->{'status'} = "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";
$issue->{'status'} .= " Reserved";
}
my ($charges, $itemtype) = calc_charges(undef, undef, $issue->{'itemnumber'}, $borrowernumber);
$issue->{'charges'} = $charges;
@ -67,6 +74,9 @@ $template->param(issues_count => $count);
# now the reserved items....
my ($rcount, $reserves) = FindReserves(undef, $borrowernumber);
foreach my $res (@$reserves) {
$res->{'reservedate'} = slashifyDate($res->{'reservedate'});
}
$template->param(RESERVES => $reserves);
$template->param(reserves_count => $rcount);

View File

@ -12,7 +12,10 @@ use C4::Circulation::Circ2;
my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
my $flagsrequired;
$flagsrequired->{borrow}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
# get borrower information ....
my $borrowernumber = getborrowernumber($loggedinuser);