In inventory result page, items are shown in a JS DataTable. A column is not sortable for no reason.
Created attachment 65413 [details] [review] Bug 19021 - inventory column not sortable In inventory result page, items are shown in a JS DataTable. A column is not sortable for no reason. This patch removes code that sets column not sortable, maybe some changes in table made it obsolete. Test plan : - perform inventory - look at result table => Without patch second column is not sortable => With patch all columns are sortable
Created attachment 65417 [details] [review] Bug 19021 - inventory column sorting In inventory result page, items are shown in a JS DataTable. For an inventory with barcode file second column is not sortable for no reason. For an inventory without barcode file first column is not sortable but since it is the default sort order the sorting icon is still displayed. This patch corrects by setting default sort order on barcode column. Test plan : - perform inventory with barcode file - look at result table - table is sorted by barcode => Without patch second column is not sortable => With patch all columns are sortable - perform inventory without barcode file - look at result table => Without patch first column show sort icon and table is not sorted by barcode => With patch first column is not sortable and table is sorted by barcode
Oh I see, this JS code is usefull for inventory without barcode file. I have correct patch and renamed bug a little
Created attachment 65424 [details] [review] [SIGNED-OFF] Bug 19021 - inventory column sorting In inventory result page, items are shown in a JS DataTable. For an inventory with barcode file second column is not sortable for no reason. For an inventory without barcode file first column is not sortable but since it is the default sort order the sorting icon is still displayed. This patch corrects by setting default sort order on barcode column. Test plan : - perform inventory with barcode file - look at result table - table is sorted by barcode => Without patch second column is not sortable => With patch all columns are sortable - perform inventory without barcode file - look at result table => Without patch first column show sort icon and table is not sorted by barcode => With patch first column is not sortable and table is sorted by barcode Signed-off-by: Owen Leonard <oleonard@myacpl.org>
> => With patch first column is not sortable and table is sorted by barcode When performing an inventory without a barcode file we are essentially generating a shelf list, shouldn't callnumber (or cn_sort ideally) be the default sort here? Even when comparing to a barcode file I think we should probably be sorting by callnumber in our results
Created attachment 67138 [details] [review] Bug 19021 - inventory column sorting In inventory result page, items are shown in a JS DataTable. For an inventory with barcode file second column is not sortable for no reason. For an inventory without barcode file first column is not sortable but since it is the default sort order the sorting icon is still displayed. This patch corrects by setting default sort order on callnumber column. Test plan : - perform inventory with barcode file - look at result table - table is sorted by callnumber => Without patch second column is not sortable => With patch all columns are sortable - perform inventory without barcode file - look at result table => Without patch first column show sort icon and table is not sorted by callnumber => With patch first column is not sortable and table is sorted by callnumber
(In reply to Nick Clemens from comment #5) > > => With patch first column is not sortable and table is sorted by barcode > > When performing an inventory without a barcode file we are essentially > generating a shelf list, shouldn't callnumber (or cn_sort ideally) be the > default sort here? > > Even when comparing to a barcode file I think we should probably be sorting > by callnumber in our results Makes sens to me, I have pushed new patch. Using cn_sort is I think possible but needs some dev so it would be in another bug report. Regards ;)
Created attachment 67804 [details] [review] Bug 19021 - inventory column sorting In inventory result page, items are shown in a JS DataTable. For an inventory with barcode file second column is not sortable for no reason. For an inventory without barcode file first column is not sortable but since it is the default sort order the sorting icon is still displayed. This patch corrects by setting default sort order on callnumber column. Test plan : - perform inventory with barcode file - look at result table - table is sorted by callnumber => Without patch second column is not sortable => With patch all columns are sortable - perform inventory without barcode file - look at result table => Without patch first column show sort icon and table is not sorted by callnumber => With patch first column is not sortable and table is sorted by callnumber Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 68715 [details] [review] Bug 19021 - inventory column sorting In inventory result page, items are shown in a JS DataTable. For an inventory with barcode file second column is not sortable for no reason. For an inventory without barcode file first column is not sortable but since it is the default sort order the sorting icon is still displayed. This patch corrects by setting default sort order on callnumber column. Test plan : - perform inventory with barcode file - look at result table - table is sorted by callnumber => Without patch second column is not sortable => With patch all columns are sortable - perform inventory without barcode file - look at result table => Without patch first column show sort icon and table is not sorted by callnumber => With patch first column is not sortable and table is sorted by callnumber Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Pushed to master for 17.11, thanks to everybody involved!
(In reply to Nick Clemens from comment #5) > > => With patch first column is not sortable and table is sorted by barcode > > When performing an inventory without a barcode file we are essentially > generating a shelf list, shouldn't callnumber (or cn_sort ideally) be the > default sort here? > > Even when comparing to a barcode file I think we should probably be sorting > by callnumber in our results Just found this problem in the wild, so I'm glad you piped up about call number last year, Nick!
Oh the "Export to CSV file" doesn't sort by call number though. I'll look at master to see if that's still an issue...
(In reply to David Cook from comment #12) > Oh the "Export to CSV file" doesn't sort by call number though. I'll look at > master to see if that's still an issue... OK it should be sorting using cn_sort as per commit 885c68e269419813dafde37fbeb32052e16974a1. I'll investigate more and stop spamming here...
I need to do more investigation, but here's the relevant SQL query: SELECT items.itemnumber, barcode, itemcallnumber, items.cn_sort, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, ccode FROM items LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber WHERE ccode = ? AND items.homebranch = ? ORDER BY items.cn_sort, itemcallnumber, title I have different items with the same itemcallnumber values but different cn_sort values, so they get sorted into different parts of the list, which are completely not intuitive to the user. This patch's template fix remedies that on the user interface but not in the exported shelf list. I'm going to check into this more this afternoon...
I'm not very familiar with this code, but I think this might actually be a data issue rather than a code issue. I had 2 items with near identical itemcallnumbers but very different cn_sort values: AL AH 616.951 SEX 2013 - 616_951000000000000_SEX_2013 AL AH 616.951 SEX 2010 - AL_AH_616_951000000000000_SEX_2010 I've just edited the first item in the staff client and it's changed 616_951000000000000_SEX_2013 to AL_AH_616_951000000000000_SEX_2013. I'm trying to find the code responsible for generating the cn_sort value, but I'm guessing that the code must have changed at some point, and the database upgrade script didn't re-run the cn_sort re-generation en masse, which is fair enough since that would be a big task for some libraries. I'm going to run touch_all_items.pl and see if it solves my problem without applying the patch on this bug report...
Running touch_all_items.pl did the trick. Now everything is sorting correctly by cn_sort even without this patch. I'll open up a separate bugzilla issue regarding this...