Bug 19915: Use cn_sort values for getting inventory items

To test:
1 - Catalog an item under LCC with callnumber GT95
2 - cn_sort should calculate as GT0095
3 - Go to inventory tool
4 - Enter a range that should have your item e.g LC GT90 to GT100
5 - Item is not returned
6 - Apply patch
7 - Item should be returned
8 - Verify things otherwise work as expected

Signed-off-by: Anne-Claire Bernaudin <anne-claire.bernaudin@univ-rennes1.fr>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

https://bugs.koha-community.org/show_bug.cgi?id=19905

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit d2ce727e26)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2018-01-04 15:00:28 +00:00 committed by Martin Renvoize
parent 39acd694ca
commit 09ef59cf79
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
3 changed files with 30 additions and 5 deletions

View File

@ -803,6 +803,7 @@ sub GetItemsForInventory {
my ( $parameters ) = @_;
my $minlocation = $parameters->{'minlocation'} // '';
my $maxlocation = $parameters->{'maxlocation'} // '';
my $class_source = $parameters->{'class_source'} // C4::Context->preference('DefaultClassificationSource');
my $location = $parameters->{'location'} // '';
my $itemtype = $parameters->{'itemtype'} // '';
my $ignoreissued = $parameters->{'ignoreissued'} // '';
@ -817,6 +818,9 @@ sub GetItemsForInventory {
my $dbh = C4::Context->dbh;
my ( @bind_params, @where_strings );
my $min_cnsort = GetClassSort($class_source,undef,$minlocation);
my $max_cnsort = GetClassSort($class_source,undef,$maxlocation);
my $select_columns = q{
SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber
};
@ -836,13 +840,13 @@ sub GetItemsForInventory {
}
if ($minlocation) {
push @where_strings, 'itemcallnumber >= ?';
push @bind_params, $minlocation;
push @where_strings, 'items.cn_sort >= ?';
push @bind_params, $min_cnsort;
}
if ($maxlocation) {
push @where_strings, 'itemcallnumber <= ?';
push @bind_params, $maxlocation;
push @where_strings, 'items.cn_sort <= ?';
push @bind_params, $max_cnsort;
}
if ($datelastseen) {

View File

@ -82,7 +82,18 @@
<input type="text" name="minlocation" id="minlocation" value="[% minlocation | html %]" /> (items.itemcallnumber) </li>
<li><label for="maxlocation">...and: </label>
<input type="text" name="maxlocation" id="maxlocation" value="[% maxlocation | html %]" />
</li>
<li>
<label for="class_source">Callnumber classification scheme</label>
<select name="class_source">
[% FOREACH class_source IN class_sources %]
[% IF class_source.cn_source == pref_class %]
<option value="[% class_source.cn_source | html %]" selected="selected">[% class_source.description | html %] (default)</option>
[% ELSE %]
<option value="[% class_source.cn_source | html %]">[% class_source.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
</ol>
</fieldset>

View File

@ -39,10 +39,12 @@ use Koha::Biblios;
use Koha::DateUtils;
use Koha::AuthorisedValues;
use Koha::BiblioFrameworks;
use Koha::ClassSources;
use List::MoreUtils qw( none );
my $minlocation=$input->param('minlocation') || '';
my $maxlocation=$input->param('maxlocation');
my $class_source=$input->param('class_source');
$maxlocation=$minlocation.'Z' unless ( $maxlocation || ! $minlocation );
my $location=$input->param('location') || '';
my $ignoreissued=$input->param('ignoreissued');
@ -116,6 +118,10 @@ for my $authvfield (@$statuses) {
}
}
my @class_sources = Koha::ClassSources->search();
my $pref_class = C4::Context->preference("DefaultClassificationSource");
$template->param(
authorised_values => \@authorised_value_list,
today => dt_from_string,
@ -129,6 +135,8 @@ $template->param(
compareinv2barcd => $compareinv2barcd,
uploadedbarcodesflag => $uploadbarcodes ? 1 : 0,
ignore_waiting_holds => $ignore_waiting_holds,
class_sources => \@class_sources,
pref_class => $pref_class
);
# Walk through uploaded barcodes, report errors, mark as seen, check in
@ -225,6 +233,7 @@ if ( $op && ( !$uploadbarcodes || $compareinv2barcd )) {
( $inventorylist ) = GetItemsForInventory({
minlocation => $minlocation,
maxlocation => $maxlocation,
class_source => $class_source,
location => $location,
ignoreissued => $ignoreissued,
datelastseen => $datelastseen,
@ -240,6 +249,7 @@ if( @scanned_items ) {
( $rightplacelist ) = GetItemsForInventory({
minlocation => $minlocation,
maxlocation => $maxlocation,
class_source => $class_source,
location => $location,
ignoreissued => undef,
datelastseen => undef,