Permalink
Browse files

Merging from rel-1-2 to trunk

  • Loading branch information...
1 parent 6e9e3cf commit c16a95296343058b73d1d85c71dc45dcd45f3570 tonnesen committed Oct 28, 2002
Showing with 103 additions and 22 deletions.
  1. +50 −7 C4/Print.pm
  2. +2 −2 mainpage.pl
  3. +16 −1 opac/opac-detail.pl
  4. +5 −1 opac/opac-main.pl
  5. +5 −1 opac/opac-search.pl
  6. +5 −3 opac/opac-searchresults.pl
  7. +16 −6 opac/opac-user.pl
  8. +4 −1 opac/opac-userupdate.pl
View
@@ -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
@@ -3,13 +3,13 @@
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
@@ -8,13 +8,19 @@
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 @@
$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
@@ -8,7 +8,11 @@
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
@@ -7,7 +7,11 @@
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");
@@ -8,7 +8,10 @@
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 $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
@@ -3,7 +3,6 @@
require Exporter;
use CGI;
-use C4::Search; # borrdata
use C4::Output; # gettemplate
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
@@ -12,7 +11,10 @@
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 @@
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 @@
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 @@
# 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);
@@ -12,7 +12,10 @@
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);

0 comments on commit c16a952

Please sign in to comment.