From c16a95296343058b73d1d85c71dc45dcd45f3570 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Mon, 28 Oct 2002 20:02:57 +0000 Subject: [PATCH] Merging from rel-1-2 to trunk --- C4/Print.pm | 57 ++++++++++++++++++++++++++++++++++++++++------ mainpage.pl | 4 ++-- opac/opac-detail.pl | 17 +++++++++++++- opac/opac-main.pl | 6 ++++- opac/opac-search.pl | 6 ++++- opac/opac-searchresults.pl | 8 ++++--- opac/opac-user.pl | 22 +++++++++++++----- opac/opac-userupdate.pl | 5 +++- 8 files changed, 103 insertions(+), 22 deletions(-) diff --git a/C4/Print.pm b/C4/Print.pm index 54dc13518a..46b5bf2cde 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -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<¤tissues>. # 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. 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; diff --git a/mainpage.pl b/mainpage.pl index 45e4d53f8d..78c7080b6d 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -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; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 11c3ee41b7..ce5362e1cc 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -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; diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 1c615a7910..c030609759 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -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"); diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 200531c45f..824190457d 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -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"); diff --git a/opac/opac-searchresults.pl b/opac/opac-searchresults.pl index e29c380291..999a866a9f 100755 --- a/opac/opac-searchresults.pl +++ b/opac/opac-searchresults.pl @@ -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); diff --git a/opac/opac-user.pl b/opac/opac-user.pl index fe0f7e22a4..d1aa63eefe 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -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'} = "OVERDUE"; } 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); diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl index 08b5d971cd..3fda4a9ab1 100755 --- a/opac/opac-userupdate.pl +++ b/opac/opac-userupdate.pl @@ -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); -- 2.11.0