From 86ee8ee38450e7561e76d30d2efad630c90edc2f Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Mon, 24 Mar 2008 04:07:51 -0500 Subject: [PATCH] Add print slip to hold confirmation dialog. Signed-off-by: Joshua Ferraro --- C4/Reserves.pm | 37 ++++++++++ circ/hold-transfer-slip.pl | 67 +++++++++++++++++++ circ/pendingreserves.pl | 33 ++++++--- .../en/includes/doc-head-close-receipt.inc | 4 ++ .../en/modules/circ/hold-transfer-slip.tmpl | 33 +++++++++ .../prog/en/modules/circ/returns.tmpl | 13 ++++ 6 files changed, 176 insertions(+), 11 deletions(-) create mode 100755 circ/hold-transfer-slip.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close-receipt.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tmpl diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 2588b04e7d..6fedf23f12 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -94,6 +94,7 @@ BEGIN { &GetReservesToBranch &GetReserveCount &GetReserveFee + &GetReserveInfo &GetOtherReserves @@ -1038,6 +1039,42 @@ sub ModReserveMinusPriority { $sth_upd->finish; } +=item GetReserveInfo + +&GetReserveInfo($borrowernumber,$biblionumber); + + Get item and borrower details for a current hold. + Current implementation this query should have a single result. +=cut + +sub GetReserveInfo { + my ( $borrowernumber, $biblionumber ) = @_; + my $dbh = C4::Context->dbh; + my $strsth="SELECT reservedate, reservenotes, reserves.borrowernumber, + reserves.biblionumber, reserves.branchcode, + notificationdate, reminderdate, priority, found, + firstname, surname, phone, + email, address, address2, + cardnumber, city, zipcode, + biblio.title, biblio.author, + items.holdingbranch, items.itemcallnumber, items.itemnumber, + barcode, notes + FROM reserves left join items + ON items.itemnumber=reserves.itemnumber , + borrowers, biblio + WHERE + reserves.borrowernumber=? && + reserves.biblionumber=? && + reserves.borrowernumber=borrowers.borrowernumber && + reserves.biblionumber=biblio.biblionumber "; + my $sth = $dbh->prepare($strsth); + $sth->execute($borrowernumber,$biblionumber); + + my $data = $sth->fetchrow_hashref; + return $data; + +} + =item _FixPriority &_FixPriority($biblio,$borrowernumber,$rank); diff --git a/circ/hold-transfer-slip.pl b/circ/hold-transfer-slip.pl new file mode 100755 index 0000000000..16327842ec --- /dev/null +++ b/circ/hold-transfer-slip.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl + + +# Copyright 2008 LibLime +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use C4::Context; +use C4::Output; +use CGI; +use C4::Auth; +use C4::Reserves; +use C4::Branch; +use C4::Dates qw/format_date format_date_in_iso/; + +use vars qw($debug); + +BEGIN { + $debug = $ENV{DEBUG} || 0; +} + +my $input = new CGI; +my $biblionumber = $input->param('biblionumber'); +my $borrowernumber = $input->param('borrowernumber'); +my $transfer = $input->param('transfer'); + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/hold-transfer-slip.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => 1 }, + debug => $debug, + } +); + +my $reserveinfo = GetReserveInfo($borrowernumber,$biblionumber ); +my $pulldate = C4::Dates->new(); +use Data::Dumper; +warn Dumper($reserveinfo); +$reserveinfo->{'pulldate'} = $pulldate->output(); +$reserveinfo->{'branchname'} = GetBranchName($reserveinfo->{'branchcode'}); +$reserveinfo->{'transferrequired'} = $transfer; + +$template->param( reservedata => [ $reserveinfo ] , + ); + +output_html_with_http_headers $input, $cookie, $template->output; + + + + diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index b454644f55..7ce7015f59 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -33,14 +33,18 @@ BEGIN { my $input = new CGI; my $order = $input->param('order'); -my $startdate=$input->param('from'); -my $enddate=$input->param('to'); - +my $startdate = $input->param('from'); +my $enddate = $input->param('to'); my $theme = $input->param('theme'); # only used if allowthemeoverride is set +my $op = $input->param('op'); +my $biblionumber = $input->param('biblionumber'); +my $borrowernumber = $input->param('borrowernumber'); + +my $tmpl_name = ($op eq 'slip') ? "circ/hold-transfer-slip.tmpl" : "circ/pendingreserves.tmpl" ; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "circ/pendingreserves.tmpl", + template_name => $tmpl_name, query => $input, type => "intranet", authnotrequired => 0, @@ -50,7 +54,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my $duedate; -my $borrowernumber; my $itemnum; my $data1; my $data2; @@ -58,10 +61,11 @@ my $data3; my $name; my $phone; my $email; -my $biblionumber; my $title; my $author; - +warn $op; +warn $biblionumber; +warn $borrowernumber; my @datearr = localtime( time() ); my $todaysdate = ( 1900 + $datearr[5] ) . '-' @@ -69,11 +73,15 @@ my $todaysdate = . sprintf( "%0.2d", $datearr[3] ); my $dbh = C4::Context->dbh; -my ($sqlorderby, $sqldatewhere) = ("",""); +my ($sqlorderby, $sqldatewhere, $sqlwhowhere) = ("","",""); $debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate); -$sqldatewhere .= " AND reservedate >= " . $dbh->quote(format_date_in_iso($startdate)) if ($startdate) ; -$sqldatewhere .= " AND reservedate <= " . $dbh->quote(format_date_in_iso($enddate)) if ($enddate) ; - +if ($op eq 'slip') { + $sqlwhowhere .= " && reserves.borrowernumber = " . $dbh->quote($borrowernumber) ; + $sqlwhowhere .= " && reserves.biblionumber = " . $dbh->quote($biblionumber) ; +} else { + $sqldatewhere .= " AND reservedate >= " . $dbh->quote(format_date_in_iso($startdate)) if ($startdate) ; + $sqldatewhere .= " AND reservedate <= " . $dbh->quote(format_date_in_iso($enddate)) if ($enddate) ; +} if ($order eq "borrower") { $sqlorderby = " order by borrower, reservedate"; } elsif ($order eq "biblio") { @@ -106,6 +114,7 @@ my $strsth = LEFT JOIN borrowers ON reserves.borrowernumber=borrowers.borrowernumber LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber WHERE reserves.found is NULL + $sqlwhowhere $sqldatewhere AND items.itemnumber NOT IN (SELECT itemnumber FROM issues) AND reserves.itemnumber is NULL"; @@ -114,6 +123,8 @@ if (C4::Context->preference('IndependantBranches')){ $strsth .= " AND items.holdingbranch=? "; } $strsth .= $sqlorderby; +warn $strsth; + my $sth = $dbh->prepare($strsth); if (C4::Context->preference('IndependantBranches')){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close-receipt.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close-receipt.inc new file mode 100644 index 0000000000..0491a89c2c --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close-receipt.inc @@ -0,0 +1,4 @@ + +/includes/favicon.ico" type="image/x-icon" /> +/css/print.css" /> + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tmpl new file mode 100644 index 0000000000..173d3bbdec --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tmpl @@ -0,0 +1,33 @@ + +Koha -- Circulation: Transfers + + + +
+ +
Date:
+

Transfer to Hold in

+ +
+ +

,

+ +
    +
  • +
  • +

  • +
    +
  • +
  • +
+
+

RESERVED ITEM

+

+
+

+ + + + +
+ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl index 6fc1664de3..105c10ff88 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl @@ -1,5 +1,10 @@ Koha › Circulation › Check In <!-- TMPL_VAR Name="title" --> + @@ -36,6 +41,8 @@ " /> " /> +
+
@@ -59,6 +66,8 @@

+
+ " value="" /> " value="" /> @@ -92,6 +101,8 @@ +
+ " value="" /> " value="" /> @@ -176,6 +187,8 @@ +
+ -- 2.39.5