Bugzilla – Attachment 125420 Details for
Bug 29015
Add option to limit Holds Queue report by shelving location / collection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29015: Add options for itemtype, collection, and shelving location to view_holdsqueue.pl
Bug-29015-Add-options-for-itemtype-collection-and-.patch (text/plain), 7.64 KB, created by
Kyle M Hall (khall)
on 2021-09-28 16:13:46 UTC
(
hide
)
Description:
Bug 29015: Add options for itemtype, collection, and shelving location to view_holdsqueue.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-09-28 16:13:46 UTC
Size:
7.64 KB
patch
obsolete
>From f46af849b1560e9d464c547376f35306e0108504 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 14 Sep 2021 19:29:27 +0000 >Subject: [PATCH] Bug 29015: Add options for itemtype, collection, and shelving > location to view_holdsqueue.pl > >This patch makes the code for itemtypeslimit work, and adds options for shelving location and collection code > >This also remove the 'post' method from the form to allow easy bookmarking > >To test: >1 - Add holds to your system >2 - Run the holds queue builder >3 - Browse to Circulation->Holds queue >4 - Note the library dropdown >5 - Apply patch >6 - Reload and note new options >7 - Test that both limits and 'All' options work as expected >8 - Note that description at top includes options when selected > "### items found for All libraries and item type:(Books)" > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > C4/HoldsQueue.pm | 23 ++++++++++++---- > circ/view_holdsqueue.pl | 13 ++++++++-- > .../prog/en/includes/html_helpers.inc | 10 +++++++ > .../prog/en/modules/circ/view_holdsqueue.tt | 26 ++++++++++++++++++- > 4 files changed, 64 insertions(+), 8 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 06b0b2a2ef..f3c7614750 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -122,14 +122,14 @@ sub UpdateTransportCostMatrix { > > =head2 GetHoldsQueueItems > >- GetHoldsQueueItems($branch); >+ GetHoldsQueueItems({ branchlimit => $branch, itemtypeslimit => $itype, ccodeslimit => $ccode, locationslimit => $location ); > > Returns hold queue for a holding branch. If branch is omitted, then whole queue is returned > > =cut > > sub GetHoldsQueueItems { >- my ($branchlimit) = @_; >+ my $params = shift; > my $dbh = C4::Context->dbh; > > my @bind_params = (); >@@ -143,10 +143,23 @@ sub GetHoldsQueueItems { > JOIN biblio USING (biblionumber) > LEFT JOIN biblioitems USING (biblionumber) > LEFT JOIN items USING ( itemnumber) >+ WHERE 1=1 > /; >- if ($branchlimit) { >- $query .=" WHERE tmp_holdsqueue.holdingbranch = ?"; >- push @bind_params, $branchlimit; >+ if ($params->{branchlimit}) { >+ $query .="AND tmp_holdsqueue.holdingbranch = ? "; >+ push @bind_params, $params->{branchlimit}; >+ } >+ if( $params->{itemtypeslimit} ) { >+ $query .=" AND items.itype = ? "; >+ push @bind_params, $params->{itemtypeslimit}; >+ } >+ if( $params->{ccodeslimit} ) { >+ $query .=" AND items.ccode = ? "; >+ push @bind_params, $params->{ccodeslimit}; >+ } >+ if( $params->{locationslimit} ) { >+ $query .=" AND items.location = ? "; >+ push @bind_params, $params->{locationslimit}; > } > $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate"; > my $sth = $dbh->prepare($query); >diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl >index 81b900ba2a..b7070fd7a1 100755 >--- a/circ/view_holdsqueue.pl >+++ b/circ/view_holdsqueue.pl >@@ -44,15 +44,24 @@ my $params = $query->Vars; > my $run_report = $params->{'run_report'}; > my $branchlimit = $params->{'branchlimit'}; > my $itemtypeslimit = $params->{'itemtypeslimit'}; >+my $ccodeslimit = $params->{'ccodeslimit'}; >+my $locationslimit = $params->{'locationslimit'}; > > if ( $run_report ) { >- # XXX GetHoldsQueueItems() does not support $itemtypeslimit! >- my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit); >+ my $items = GetHoldsQueueItems({ >+ branchlimit => $branchlimit, >+ itemtypeslimit => $itemtypeslimit, >+ ccodeslimit => $ccodeslimit, >+ locationslimit => $locationslimit >+ }); > for my $item ( @$items ) { > $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} ); > } > $template->param( > branchlimit => $branchlimit, >+ itemtypeslimit => $itemtypeslimit, >+ ccodeslimit => $ccodeslimit, >+ locationslimit => $locationslimit, > total => scalar @$items, > itemsloop => $items, > run_report => $run_report, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index 86eab2547f..f408f0f750 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -47,6 +47,16 @@ > [% END %] > [% END %] > >+[% BLOCK options_for_authorised_values %] >+ [% FOREACH av IN authorised_values %] >+ [% IF av.authorised_value == selected_av %] >+ <option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option> >+ [% ELSE %] >+ <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option> >+ [% END %] >+ [% END %] >+[% END %] >+ > [% BLOCK options_for_item_types %] > [% FOREACH itemtype IN itemtypes %] > [% IF itemtype.itemtype == selected_itemtype %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >index 564ab5f54f..6c9e5ffea1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >@@ -65,6 +65,9 @@ > [% IF ( total ) %] > <div class="results">[% total | html %] items found for > [% IF ( branchlimit ) %][% Branches.GetName( branchlimit ) | html %][% ELSE %]All libraries[% END %] >+ [% IF ( itemtypeslimit ) %] and item type:([% ItemTypes.GetDescription( itemtypeslimit ) | html %])[% END %] >+ [% IF ( ccodeslimit ) %] and collection code:([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode' authorised_value = ccodeslimit ) | html %])[% END %] >+ [% IF ( locationslimit ) %] and shelving location:([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location' authorised_value = locationslimit ) | html %])[% END %] > </div> > [% ELSE %] > <div class="dialog message">No items found.</div> >@@ -200,7 +203,7 @@ > [% END %] > > [% UNLESS ( total ) %] >-<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post"> >+<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl"> > <fieldset class="rows"> > <ol> > <li> >@@ -210,6 +213,27 @@ > [% PROCESS options_for_libraries libraries => Branches.all( only_from_group => 1 ) %] > </select> > </li> >+ <li> >+ <label for="itemtypeslimit">Item type: </label> >+ <select name="itemtypeslimit" id="itemtypeslimit"> >+ <option value="">All</option> >+ [% PROCESS options_for_item_types itemtypes => ItemTypes.Get() %] >+ </select> >+ </li> >+ <li> >+ <label for="ccodeslimit">Collection code: </label> >+ <select name="ccodeslimit" id="ccodeslimit"> >+ <option value="">All</option> >+ [% PROCESS options_for_authorised_values authorised_values => AuthorisedValues.GetAuthValueDropbox( 'CCODE' ) %] >+ </select> >+ </li> >+ <li> >+ <label for="locationsslimit">Shelving location: </label> >+ <select name="locationslimit" id="ccodeslimit"> >+ <option value="">All</option> >+ [% PROCESS options_for_authorised_values authorised_values => AuthorisedValues.GetAuthValueDropbox( 'LOC' ) %] >+ </select> >+ </li> > </ol></fieldset> > <fieldset class="action"> <input type="submit" value="Submit" /> > <input type="hidden" name="run_report" value="1" /></fieldset> >-- >2.30.1 (Apple Git-130)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29015
:
124871
|
124881
|
124883
|
124903
|
124907
|
124908
|
124909
|
124910
|
124915
|
124916
|
124917
|
124918
|
125419
|
125420
|
125421
|
125422
|
125423
|
127191
|
127192
|
127193
|
127194
|
127195
|
127196
|
127197
|
127198
|
127261