[Koha-patches] [PATCH] Add branch selection for pending reserves.pl
darrellulm at smfpl.org
darrellulm at smfpl.org
Mon Sep 29 18:34:14 CEST 2008
From: root <root at debian.local>
---
circ/pendingreserves.pl | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl
index 135cf07..22bf38d 100755
--- a/circ/pendingreserves.pl
+++ b/circ/pendingreserves.pl
@@ -31,11 +31,13 @@ use C4::Auth;
use C4::Dates qw/format_date format_date_in_iso/;
use C4::Debug;
use Date::Calc qw/Today Add_Delta_YMD/;
+use C4::Branch; # GetBranches
my $input = new CGI;
my $order = $input->param('order');
my $startdate=$input->param('from');
my $enddate=$input->param('to');
+my $branchlimit=$input->param('branchlimit');
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
@@ -63,6 +65,21 @@ my $biblionumber;
my $title;
my $author;
+# getting all branches.
+my $branches = GetBranches;
+my $branch = C4::Context->userenv->{"branchname"};
+my @branchloop;
+foreach my $thisbranch ( keys %$branches ) {
+ my $selected = 1 if $thisbranch eq $branch;
+ my %row = (
+ value => $thisbranch,
+ selected => $selected,
+ branchname => $branches->{$thisbranch}->{'branchname'},
+ );
+ push @branchloop, \%row;
+}
+
+
my ( $year, $month, $day ) = Today();
my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day);
my $yesterdaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -1));
@@ -155,10 +172,15 @@ AND notforloan = 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0
# multiple patrons have a hold on an item
-if (C4::Context->preference('IndependantBranches')){
+if (C4::Context->preference('IndependantBranches')) {
$strsth .= " AND items.holdingbranch=? ";
push @query_params, C4::Context->userenv->{'branch'};
}
+elsif ( $branchlimit ne "ALL" ) {
+ $strsth .= " AND items.holdingbranch=? ";
+ push @query_params, $branchlimit;
+}
+
$strsth .= " GROUP BY reserves.biblionumber " . $sqlorderby;
my $sth = $dbh->prepare($strsth);
@@ -256,6 +278,7 @@ $template->param(
from => $startdate,
to => $enddate,
reserveloop => \@reservedata,
+ branchloop => \@branchloop,
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
dateformat => C4::Context->preference("dateformat"),
--
1.5.6
More information about the Koha-patches
mailing list