From 2adbba2626c66dce67d740d572707fbc4f7d7510 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 23 Oct 2023 10:00:01 -1000 Subject: [PATCH] Bug 35139: [ALTERNATE] Filter holds to pull on holding library and add 'View all libraries' link Like previous patch but with impact on items.holdingbranch --- circ/pendingreserves.pl | 18 ++++++++++++++++-- .../prog/en/modules/circ/pendingreserves.tt | 8 ++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index c474c98615..de2f1ee162 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -42,6 +42,7 @@ my $theme = $input->param('theme'); # only used if allowthemeoverride is set my $op = $input->param('op') || ''; my $borrowernumber = $input->param('borrowernumber'); my $reserve_id = $input->param('reserve_id'); +my $all_branches = $input->param('allbranches') || ''; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -181,8 +182,18 @@ if ( !C4::Context->preference('AllowHoldsOnDamagedItems') ){ $where{'itembib.damaged'} = 0; } -if ( C4::Context->only_my_library() ){ - $where{'me.branchcode'} = C4::Context->userenv->{'branch'}; +if ( C4::Context->preference('IndependentBranches') ) { + undef $all_branches; +} else { + my $all_branches_link = '/cgi-bin/koha/circ/pendingreserves.pl?allbranches=1'; + $all_branches_link .= '&from=' . $startdate if $startdate; + $all_branches_link .= '&to=' . $enddate if $enddate; + $template->param( all_branches_link => $all_branches_link ) unless $all_branches; +} +if ($all_branches) { + $template->param( allbranches => 1 ); +} else { + $where{'itembib.holdingbranch'} = C4::Context->userenv->{'branch'}; } # get all distinct unfulfilled reserves @@ -196,6 +207,9 @@ my @biblionumbers = $holds->get_column('biblionumber'); my $all_items; if ( $holds->count ) { foreach my $item ( $holds->get_items_that_can_fill ) { + unless ($all_branches) { + next unless $item->holdingbranch eq C4::Context->userenv->{'branch'}; + } push @{ $all_items->{ $item->biblionumber } }, $item; } } 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 af7c47b588..f03fbbf828 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -58,6 +58,11 @@ [% END %]

Holds to pull placed between [% from | $KohaDates %] and [% to | $KohaDates %]

+

+ [% IF all_branches_link %] + View all libraries + [% END %] +

Reported on [% todaysdate | $KohaDates %]

The following holds have not been filled. Please retrieve them and check them in.

@@ -187,6 +192,7 @@
+ [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] [% IF hold_cancellation %] @@ -212,6 +218,7 @@ [% IF hold.itemnumber %] + [% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %] @@ -264,6 +271,7 @@
+

Refine results

    -- 2.42.0