From ae4052fc63ff06365e3682b89f47db434339ef3e Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Wed, 16 Oct 2013 17:20:14 +0300 Subject: [PATCH] Bug 8074 - Define default library for holds to pull report Modified the BIG SQL in pendingreserves.pl to limit the hold requests shown by the items.holdingbranch. The behaviour mimics IndependentBranches behaviour. Also added a branch picker to circ/pendingreserves.tt with an optional Show all requests-option. Changed the form from post to get so librarians can bookmark the page. Made stuff localizable! --- circ/pendingreserves.pl | 25 ++++++++++ .../prog/en/modules/circ/pendingreserves.tt | 54 ++++++++++++++-------- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 0110deb..0f95609 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -40,6 +40,7 @@ use Date::Calc qw/Today Add_Delta_YMD/; my $input = new CGI; my $startdate=$input->param('from'); my $enddate=$input->param('to'); +my $branchLimiter = $input->param('branchLimiter'); my $run_report = ( not defined $input->param('run_report') ) ? 1 : $input->param('run_report'); my $theme = $input->param('theme'); # only used if allowthemeoverride is set @@ -88,6 +89,11 @@ if (!defined($enddate) or $enddate eq "") { $enddate = format_date($d); } +if (! defined $branchLimiter) { + $branchLimiter = C4::Context->userenv->{branch}; +} + + my @reservedata; if ( $run_report ) { my $dbh = C4::Context->dbh; @@ -152,6 +158,14 @@ if ( $run_report ) { # GROUP BY reserves.biblionumber allows only items that are not checked out, else multiples occur when # multiple patrons have a hold on an item + #Always show just the requests that can be fulfilled from userenv or the desired branch. + if ($branchLimiter ne '_ShowAll') { + $strsth .= " AND items.holdingbranch=? "; + push @query_params, $branchLimiter; + } + else { + #Show all requests if $branchLimiter eq '_ShowAll' + } if (C4::Context->preference('IndependentBranches')){ $strsth .= " AND items.holdingbranch=? "; @@ -196,6 +210,16 @@ if ( $run_report ) { } $sth->finish; } +##Prepare the custom branches loop containing the _ShowAll entry to show all requests. +my $branchloop; +if ($branchLimiter eq '_ShowAll') { + $branchloop = C4::Branch::GetBranchesLoop(); + unshift @$branchloop, { branchcode => '_ShowAll', branchname => 'Show all requests', selected => '1', value => '_ShowAll'}; +} +else { + $branchloop = C4::Branch::GetBranchesLoop($branchLimiter); + unshift @$branchloop, { branchcode => '_ShowAll', branchname => 'Show all requests', selected => '0', value => '_ShowAll'}; +} $template->param( todaysdate => format_date($todaysdate), @@ -206,6 +230,7 @@ $template->param( "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, HoldsToPullStartDate=> C4::Context->preference('HoldsToPullStartDate')||TWO_DAYS, HoldsToPullEndDate => C4::Context->preference('ConfirmFutureHolds')||0, + branchloop => $branchloop, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index 18b3db3..b87845f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -158,25 +158,41 @@ $(document).ready(function() {
-
-
-

Refine results

-
    -
  1. - - -
  2. -
  3. - -
  4. -
-

(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% IF ( HoldsToPullEndDate ) %][% HoldsToPullEndDate %] days ahead[% ELSE %]today[% END %], set other date ranges as needed. )

-
-
+ +
+

Refine results

+
    +
  1. + + +
  2. +
  3. + +
  4. +
+

(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% IF ( HoldsToPullEndDate ) %][% HoldsToPullEndDate %] days ahead[% ELSE %]today[% END %], set other date ranges as needed. )

+ + +
+
-- 1.8.1.2