Bug 19915 - Inventory tool doesn't use cn_sort for callnumber ranges
Summary: Inventory tool doesn't use cn_sort for callnumber ranges
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Marcel de Rooy
URL:
Keywords:
: 14983 (view as bug list)
Depends on: 19929
Blocks:
  Show dependency treegraph
 
Reported: 2018-01-04 14:59 UTC by Nick Clemens
Modified: 2020-11-12 15:07 UTC (History)
13 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch brings the inventory tool inline with other pages displaying data sorted by callnumbers by also adopting the use of cn_sort for sorting.
Version(s) released in:


Attachments
Bug 19915 - Unit test (2.25 KB, patch)
2018-01-04 15:05 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915 - Use cn_sort values for getting inventory items (6.17 KB, patch)
2018-01-04 15:05 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915 - Unit test (2.25 KB, patch)
2018-01-09 12:01 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915 - Use cn_sort values for getting inventory items (6.25 KB, patch)
2018-01-09 12:01 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915 - Unit test (2.25 KB, patch)
2018-03-15 13:27 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915 - Use cn_sort values for getting inventory items (6.24 KB, patch)
2018-03-15 13:27 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915 - Unit test (2.33 KB, patch)
2018-03-16 08:16 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 19915 - Use cn_sort values for getting inventory items (6.31 KB, patch)
2018-03-16 08:16 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 19915: Only show class sources in use (696 bytes, patch)
2018-06-18 13:01 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Add unit test to GetItemsForInventory.t (2.49 KB, patch)
2018-07-06 10:12 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t (3.09 KB, patch)
2018-07-06 10:12 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19915: Use cn_sort values for getting inventory items (5.74 KB, patch)
2018-07-06 10:12 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19915: Only show class sources in use (793 bytes, patch)
2018-07-06 10:12 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19915: Add unit test to GetItemsForInventory.t (2.46 KB, patch)
2018-11-01 14:46 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t (3.06 KB, patch)
2018-11-01 14:46 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Use cn_sort values for getting inventory items (5.76 KB, patch)
2018-11-01 14:46 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Only show class sources in use (760 bytes, patch)
2018-11-01 14:46 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Don't delete in tests (1.70 KB, patch)
2018-11-01 14:46 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Make behaviour syspref controlled (12.33 KB, patch)
2018-11-01 14:46 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Add unit test to GetItemsForInventory.t (2.81 KB, patch)
2019-01-04 18:38 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t (2.77 KB, patch)
2019-01-04 18:38 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Use cn_sort values for getting inventory items (5.82 KB, patch)
2019-01-04 18:38 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Only show class sources in use (815 bytes, patch)
2019-01-04 18:38 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Don't delete in tests (1.79 KB, patch)
2019-01-04 18:39 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: (follow-up) Fix test count from rebase (792 bytes, patch)
2019-01-04 18:39 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19915: Add unit test to GetItemsForInventory.t (2.87 KB, patch)
2019-02-02 17:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t (2.82 KB, patch)
2019-02-02 17:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 19915: Use cn_sort values for getting inventory items (5.88 KB, patch)
2019-02-02 17:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 19915: Only show class sources in use (873 bytes, patch)
2019-02-02 17:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 19915: Don't delete in tests (1.85 KB, patch)
2019-02-02 17:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 19915: (follow-up) Fix test count from rebase (850 bytes, patch)
2019-02-02 17:06 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2018-01-04 14:59:56 UTC
When doing an inventory a range of GT90 to GT100 for LC callnumbers the results won't include GT95

We should convert the numbers and use the cn_sort column for fetching items
Comment 1 Nick Clemens 2018-01-04 15:05:50 UTC
Created attachment 70274 [details] [review]
Bug 19915 - Unit test

prove -v t/db_dependent/Items/GetItemsForInventory.t
Comment 2 Nick Clemens 2018-01-04 15:05:52 UTC
Created attachment 70275 [details] [review]
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
Comment 3 Nick Clemens 2018-01-04 15:08:14 UTC
*** Bug 14983 has been marked as a duplicate of this bug. ***
Comment 4 Marcel de Rooy 2018-01-04 15:49:20 UTC
+my $schema = Koha::Database->new()->schema();
+my @class_sources = $schema->resultset('ClassSource')->search();


Koha::Object ?
Comment 5 Nick Clemens 2018-01-09 12:01:52 UTC
Created attachment 70338 [details] [review]
Bug 19915 - Unit test

prove -v t/db_dependent/Items/GetItemsForInventory.t
Comment 6 Nick Clemens 2018-01-09 12:01:55 UTC
Created attachment 70339 [details] [review]
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
Comment 7 abernaud 2018-03-15 10:23:09 UTC
After applying the patch, at http://pro.user10-koha.sandbox.biblibre.eu/cgi-bin/koha/tools/inventory.pl

I get the following error message :

Software error:

Can't locate Koha/ClassificationSources.pm in @INC (you may need to install the Koha::ClassificationSources module) (@INC contains: /home/koha/src /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /home/koha/src/tools/inventory.pl line 42.
BEGIN failed--compilation aborted at /home/koha/src/tools/inventory.pl line 42.

For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error.
Comment 8 Nick Clemens 2018-03-15 13:27:39 UTC
Created attachment 72950 [details] [review]
Bug 19915 - Unit test

prove -v t/db_dependent/Items/GetItemsForInventory.t
Comment 9 Nick Clemens 2018-03-15 13:27:43 UTC
Created attachment 72951 [details] [review]
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
Comment 10 Nick Clemens 2018-03-15 13:30:35 UTC
Did you make sure to apply the dependencies
Comment 11 abernaud 2018-03-15 14:04:58 UTC
Tested with the dependencies : doesn't work better...
Anne-Claire
Comment 12 Nick Clemens 2018-03-15 15:08:14 UTC
The test plan here uses numbers valid for LC callnumbers. I think you will need to find a valid callnumber range if using a different classification source
Comment 13 abernaud 2018-03-16 08:12:23 UTC
Works fine when having the right classification scheme defined in the syspref DefaultClassificationSource :)
Comment 14 Biblibre Sandboxes 2018-03-16 08:16:11 UTC
Patch tested with a sandbox, by Anne-Claire Bernaudin <anne-claire.bernaudin@univ-rennes1.fr>
Comment 15 Biblibre Sandboxes 2018-03-16 08:16:43 UTC
Created attachment 72988 [details] [review]
Bug 19915 - Unit test

prove -v t/db_dependent/Items/GetItemsForInventory.t

Signed-off-by: Anne-Claire Bernaudin <anne-claire.bernaudin@univ-rennes1.fr>
Comment 16 Biblibre Sandboxes 2018-03-16 08:16:46 UTC
Created attachment 72989 [details] [review]
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>
Comment 17 Katrin Fischer 2018-04-22 17:50:01 UTC
Hi Nick,

I am a little confused about the need for the new classification source pull down on the inventory form. Some questions:

1) Why is it needed?
2) Should we not only show the classification sources marked as 'in use'?
3) Why can't I unset it?
4) Is it supposed to limit the search? Because when I select LOC classification, items are found, although they don't have a classification source set.
Comment 18 Nick Clemens 2018-06-18 12:59:54 UTC
(In reply to Katrin Fischer from comment #17)
> Hi Nick,
> 
> I am a little confused about the need for the new classification source pull
> down on the inventory form. Some questions:
> 
> 1) Why is it needed?
We need to know which source to use for converting the callnumbers entered, currently we test against unconverted callnumbers which doesn't work for manyschemes, the reanges won't be returned correctly

> 2) Should we not only show the classification sources marked as 'in use'?

Good idea, I will followup

> 3) Why can't I unset it?

Even when cn_source is not set for an item it uses the default, unsetting it shouldn't be necessary

> 4) Is it supposed to limit the search? Because when I select LOC
> classification, items are found, although they don't have a classification
> source set.

It doesn't limit the search per se, it just converts the range to the correct values for cn_sort
Comment 19 Nick Clemens 2018-06-18 13:01:39 UTC
Created attachment 76120 [details] [review]
Bug 19915: Only show class sources in use
Comment 20 Marcel de Rooy 2018-07-06 10:09:37 UTC
I would suggest to add release notes. If people did not really care about such things as classification schemes, they might be up for a surprise when their data is not consistent in that area.
Comment 21 Marcel de Rooy 2018-07-06 10:12:27 UTC
Created attachment 76721 [details] [review]
Bug 19915: Add unit test to GetItemsForInventory.t

prove -v t/db_dependent/Items/GetItemsForInventory.t

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Moved the betwen typo edit back here.
Comment 22 Marcel de Rooy 2018-07-06 10:12:34 UTC
Created attachment 76722 [details] [review]
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t

Standard edits like modules, schema, Koha objects instead of DBIC.
Removing unneeded autoflush.
Moving initial test to a first subtest.
No need to clear issues if you clear items.
Adding a FIXME for OldWay; would be nice to remove that code..

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 23 Marcel de Rooy 2018-07-06 10:12:39 UTC
Created attachment 76723 [details] [review]
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>
Comment 24 Marcel de Rooy 2018-07-06 10:12:45 UTC
Created attachment 76724 [details] [review]
Bug 19915: Only show class sources in use

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 25 Marcel de Rooy 2018-07-06 10:13:54 UTC
No blocker for me, but adding an option to control the switch from callnumber to cn_sort might be handy for some people?
Comment 26 Eric Phetteplace 2018-07-06 15:12:48 UTC
(In reply to Marcel de Rooy from comment #25)
> No blocker for me, but adding an option to control the switch from
> callnumber to cn_sort might be handy for some people?

What is the use case for sorting by callnumber? I cannot think of a reason one would want to sort by a non-normalized call number. Especially for inventory purposes, having a sort that supposedly matches your shelves is the only useful one, unless I'm missing something.
Comment 27 Katrin Fischer 2018-07-06 15:34:02 UTC
Koha libraries might have migrated without filling the classification source subfield which would result in an empty cn_sort. Also, as we only have a limited selection of filing rules available, maybe there are use cases where a simple sort works better? Not sure about that, but it feels like almost every library here has their own homegrown classification scheme.
Comment 28 Nick Clemens 2018-08-08 20:46:29 UTC
I talked with enough people to agree this must be optional - will provide a followup
Comment 29 David Cook 2018-10-31 23:20:27 UTC
I am so confused by this bug.

Isn't the inventory already sorting by call number?
Comment 30 Carl 2018-10-31 23:48:51 UTC
Yes, it's sorted by call number but that does not sort correctly.  It should be sorted by items.cn_sort which will sort correctly.
Comment 31 David Cook 2018-11-01 03:52:15 UTC
(In reply to Carl from comment #30)
> Yes, it's sorted by call number but that does not sort correctly.  It should
> be sorted by items.cn_sort which will sort correctly.

I am certain that I just looked at this a couple months ago and it was using the normalized call numbers.

I had an issue where the normalized call numbers were wrong for old records, but after re-generating the values, all was well. Let me see if I can find any details on that issue I had...
Comment 32 David Cook 2018-11-01 03:53:43 UTC
Here we go...

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21447
Comment 33 David Cook 2018-11-01 03:56:04 UTC
(In reply to David Cook from comment #32)
> Here we go...
> 
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21447

I wish that I had written that bug report better.

In hindsight, I think maybe #19915 fixes the underlying problem that I observed, which means that both the list view and export views should be fixed after these changes...
Comment 34 Nick Clemens 2018-11-01 14:46:20 UTC
Created attachment 81816 [details] [review]
Bug 19915: Add unit test to GetItemsForInventory.t

prove -v t/db_dependent/Items/GetItemsForInventory.t

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Moved the betwen typo edit back here.



Current patch-complexity: Small patch
Comment 35 Nick Clemens 2018-11-01 14:46:24 UTC
Created attachment 81817 [details] [review]
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t

Standard edits like modules, schema, Koha objects instead of DBIC.
Removing unneeded autoflush.
Moving initial test to a first subtest.
No need to clear issues if you clear items.
Adding a FIXME for OldWay; would be nice to remove that code..

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 36 Nick Clemens 2018-11-01 14:46:29 UTC
Created attachment 81818 [details] [review]
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>
Comment 37 Nick Clemens 2018-11-01 14:46:34 UTC
Created attachment 81819 [details] [review]
Bug 19915: Only show class sources in use

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 38 Nick Clemens 2018-11-01 14:46:38 UTC
Created attachment 81820 [details] [review]
Bug 19915: Don't delete in tests
Comment 39 Nick Clemens 2018-11-01 14:46:47 UTC
Created attachment 81821 [details] [review]
Bug 19915: Make behaviour syspref controlled

To test:
0 - Apply patch, run updatedatabase
1 - Catalog an item under LCC classification source with callnumber GT95
2 - Check db, cn_sort should calculate as GT0095
    SELECT cn_sort FROM items where callnumber="GT95";
3 - Catalog an item under LCC classification source with callnumber
GT101
4 - Check db, cn_sort should calculate as GT0101
    SELECT cn_sort FROM items where callnumber="GT101";
5 - Go to inventory tool
6 - Enter a range from GT90 to GT100
7 - Neither item is not returned
8 - Enter range from GT100 to GT90
9 - Second item is returned
10 - Set UseCNSortForInventory to 'Use'
11 - Go to invenotry tool
12 - Enter a range from GT90 to GT100
13 - The first item is returned, the second is not
14 - Enter a range from GT100 to GT90
15 - Neither item is returned
16 - prove -v t/db_dependent/Items/GetItemsForInventory.t
Comment 40 Martin Renvoize 2018-11-13 10:32:20 UTC
In bug 21629 we corrected a similar case where we changed from callnumber to cn_sort sorting, but we did not require a system preference to enable/disable that change.

I personally don't feel we should require the system preference here either.. or at least we should be consistent elsewhere if we are going to introduce such a preference...

Can we push this back to the mailing list for comment?
Comment 41 Nick Clemens 2018-11-14 12:03:26 UTC
(In reply to Martin Renvoize from comment #40)
> In bug 21629 we corrected a similar case where we changed from callnumber to
> cn_sort sorting, but we did not require a system preference to
> enable/disable that change.
> 
> I personally don't feel we should require the system preference here
> either.. or at least we should be consistent elsewhere if we are going to
> introduce such a preference...
> 
> Can we push this back to the mailing list for comment?

I think the concern was some migrations where the cn_sort may not be populated or not populated correctly. I am fine either way (would prefer without the switch, it would highlight data that should be fixed)

I will email the lists.
Comment 42 Katrin Fischer 2018-12-05 12:33:24 UTC
After giving this some more thought I think we should make using cn_sort the default behaviour without a configuration option.

Just a thought: would it be hard to use itemcallnumber if cn_sort is empty/not set? That might give some flexibility.

It might be nice to add a script to help people populating this field if it was somehow missed during migration or set to a wrong value, but that is out of scope here for sure!
Comment 43 Nick Clemens 2019-01-04 18:38:44 UTC
Created attachment 83644 [details] [review]
Bug 19915: Add unit test to GetItemsForInventory.t

prove -v t/db_dependent/Items/GetItemsForInventory.t

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Moved the betwen typo edit back here.

https://bugs.koha-community.org/show_bug.cgi?id=19905
Comment 44 Nick Clemens 2019-01-04 18:38:48 UTC
Created attachment 83645 [details] [review]
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t

Standard edits like modules, schema, Koha objects instead of DBIC.
Removing unneeded autoflush.
Moving initial test to a first subtest.
No need to clear issues if you clear items.
Adding a FIXME for OldWay; would be nice to remove that code..

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

https://bugs.koha-community.org/show_bug.cgi?id=19905
Comment 45 Nick Clemens 2019-01-04 18:38:52 UTC
Created attachment 83646 [details] [review]
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
Comment 46 Nick Clemens 2019-01-04 18:38:56 UTC
Created attachment 83647 [details] [review]
Bug 19915: Only show class sources in use

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

https://bugs.koha-community.org/show_bug.cgi?id=19905
Comment 47 Nick Clemens 2019-01-04 18:39:00 UTC
Created attachment 83648 [details] [review]
Bug 19915: Don't delete in tests

https://bugs.koha-community.org/show_bug.cgi?id=19905
Comment 48 Nick Clemens 2019-01-04 18:39:04 UTC
Created attachment 83649 [details] [review]
Bug 19915: (follow-up) Fix test count from rebase

https://bugs.koha-community.org/show_bug.cgi?id=19905
Comment 49 Nick Clemens 2019-01-04 18:41:09 UTC
(In reply to Katrin Fischer from comment #42)
> Just a thought: would it be hard to use itemcallnumber if cn_sort is
> empty/not set? That might give some flexibility.

We could, but I am afraid ti wouldn't help since the range passed into the template is transformed using the classification rules - so an untransformed callnumebr would likely remain outside the range
 
> It might be nice to add a script to help people populating this field if it
> was somehow missed during migration or set to a wrong value, but that is out
> of scope here for sure!

Thank you, file a bug and we can look at a future time :-)
Comment 50 Katrin Fischer 2019-02-02 16:57:29 UTC
 
> > It might be nice to add a script to help people populating this field if it
> > was somehow missed during migration or set to a wrong value, but that is out
> > of scope here for sure!
> 
> Thank you, file a bug and we can look at a future time :-)

Done: bug 22263
Comment 51 Katrin Fischer 2019-02-02 17:06:14 UTC
Created attachment 84665 [details] [review]
Bug 19915: Add unit test to GetItemsForInventory.t

prove -v t/db_dependent/Items/GetItemsForInventory.t

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Moved the betwen typo edit back here.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 52 Katrin Fischer 2019-02-02 17:06:19 UTC
Created attachment 84666 [details] [review]
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t

Standard edits like modules, schema, Koha objects instead of DBIC.
Removing unneeded autoflush.
Moving initial test to a first subtest.
No need to clear issues if you clear items.
Adding a FIXME for OldWay; would be nice to remove that code..

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>
Comment 53 Katrin Fischer 2019-02-02 17:06:24 UTC
Created attachment 84667 [details] [review]
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>
Comment 54 Katrin Fischer 2019-02-02 17:06:30 UTC
Created attachment 84668 [details] [review]
Bug 19915: Only show class sources in use

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>
Comment 55 Katrin Fischer 2019-02-02 17:06:34 UTC
Created attachment 84669 [details] [review]
Bug 19915: Don't delete in tests

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 56 Katrin Fischer 2019-02-02 17:06:40 UTC
Created attachment 84670 [details] [review]
Bug 19915: (follow-up) Fix test count from rebase

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 57 Nick Clemens 2019-02-04 17:43:15 UTC
Awesome work all!

Pushed to master for 19.05
Comment 58 Martin Renvoize 2019-02-11 13:39:58 UTC
Pushed to 18.11.x for 18.11.03
Comment 59 Lucas Gass 2019-02-12 18:41:32 UTC
cant cleanly apply this patchset to 18.05.x. won't backport
Comment 60 Eric Phetteplace 2020-06-14 20:25:05 UTC
Perhaps this is a problem with cn_sort itself or something else but I've noticed that our inventory _still_ doesn't sort correctly. Here is an example for one of our locations with call numbers B0 - B30:

- B 29 V55 1998
- B29 .C55 2008
- B29 .L24 1983
- B29 .L264 1998
- B29 .P666 2004

I've had a JS hack in place, originally for addressing this bug, but I've never been able to remove it because of problems like the above. This is the correct sort after the hack is applied:

- B29 .C55 2008
- B29 .L24 1983
- B29 .L264 1998
- B29 .P666 2004
- B 29 V55 1998

It's also what I see if I run a query like

SELECT itemnumber, cn_sort, itemcallnumber
FROM items
WHERE homebranch = 'OAK'
AND items.itemcallnumber LIKE 'B29%'
OR items.itemcallnumber LIKE 'B%29%'
OR items.itemcallnumber LIKE ' B29%'
OR items.itemcallnumber LIKE ' B%29%'
ORDER BY cn_sort

itemnumber	cn_sort	itemcallnumber
72613	B0029 C55 02008	B29 .C55 2008
59337	B0029 L24 01983	B29 .L24 1983
69756	B0029 L264 01998	B29 .L264 1998
65867	B0029 P666 02004	B29 .P666 2004
40918	B0029 V55 01998	B 29 V55 1998

Why is my report sorted correctly, but not the inventory page? It leads me to believe that the inventory page isn't really sorting by cn_sort.