Browse Source

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>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Nick Clemens 2 years ago
committed by Jonathan Druart
parent
commit
2a6af1a6bd
  1. 23
      C4/HoldsQueue.pm
  2. 13
      circ/view_holdsqueue.pl
  3. 10
      koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc
  4. 26
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt

23
C4/HoldsQueue.pm

@ -114,14 +114,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 = ();
@ -135,10 +135,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);

13
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,

10
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 %]

26
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>

Loading…
Cancel
Save