Bug 15337 - Koha Item Type sorted by Codes instead of Descriptions
Summary: Koha Item Type sorted by Codes instead of Descriptions
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-09 10:32 UTC by Iming Chan
Modified: 2017-06-14 22:05 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 15337: Add tests to ensure that GetItemTypes will return element ordered by desc (1.76 KB, patch)
2016-01-05 14:29 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15337: Make itemtypes retrieved with GetItemTypes ordered by descriptions (1.72 KB, patch)
2016-01-05 14:29 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15337: Add tests to ensure that GetItemTypes will return element ordered by desc (1.91 KB, patch)
2016-01-05 17:06 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15337: Make itemtypes retrieved with GetItemTypes ordered by descriptions (1.87 KB, patch)
2016-01-05 17:07 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 15337: Add tests to ensure that GetItemTypes will return element ordered by desc (1.98 KB, patch)
2016-01-11 20:14 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 15337: Make itemtypes retrieved with GetItemTypes ordered by descriptions (1.93 KB, patch)
2016-01-11 20:19 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 Iming Chan 2015-12-09 10:32:54 UTC
When adding items (holdings), options on the dropdown list for Koha Item Type needs to be sorted by headings themselves not linked Codes.
Comment 1 Jonathan Druart 2016-01-05 14:29:27 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2016-01-05 14:29:30 UTC Comment hidden (obsolete)
Comment 3 Marc Véron 2016-01-05 17:05:18 UTC
Testing:
Without patches: 
 - Order in dropdown list of Koha item types is wrong (not alphabetically).
 - t/db_dependent/Koha.t passes green

With first patch (tests):
 - t/db_dependent/Koha.t does not pass (not ok 10 - GetItemTypes test)
   (as expected)

With second patch applied:
 - Order in dropdown is alphabetically
   (as expected)
 - t/db_dependent/Koha.t passes green
   (as expected)

Going to sign off.
Comment 4 Marc Véron 2016-01-05 17:06:36 UTC Comment hidden (obsolete)
Comment 5 Marc Véron 2016-01-05 17:07:32 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2016-01-06 21:12:07 UTC
Hi Jonathan, this doesn't appear to work for me. I changed the english and the default description of my BK itemtype to "Z" - but it still appears first in list when adding a new item?
Comment 7 Jonathan Druart 2016-01-07 10:04:02 UTC
(In reply to Katrin Fischer from comment #6)
> Hi Jonathan, this doesn't appear to work for me. I changed the english and
> the default description of my BK itemtype to "Z" - but it still appears
> first in list when adding a new item?

Cannot recreate that.
I have changed my "CD" description to "Z", then go to 
/cataloguing/additem.pl?op=edititem&biblionumber=1986&itemnumber=2990#edititem

I have my 995$r set as
r 	type de document et support matériel 	Tab:10, | Koha field: items.itype, Not repeatable, Mandatory, | Auth value:itemtypes
Comment 8 Katrin Fischer 2016-01-07 10:27:01 UTC
Hm, I will try and test again. Not sure what's going wrong. Another last idea - mine was not mandatory. I think that changes the look of the drop down a bit.
Comment 9 Katrin Fischer 2016-01-10 23:43:46 UTC
I have no idea why, but 'Zooks' stays on top of list in the edit item screen no matter what I do. :(
Comment 10 Jonathan Druart 2016-01-11 08:28:15 UTC
Could you try to debug around cataloguing/additem.pl l.178 to 190?
The GetItemTypes subroutine is called to construct the item types. $itemtypes should be an arrayref of item types, ordered by descriptions.
Comment 11 Katrin Fischer 2016-01-11 20:10:05 UTC
I think it must have been some hidden whitespace. I reentered all descriptions, didn't notice an additional space, but after that - it works.
Comment 12 Katrin Fischer 2016-01-11 20:14:24 UTC
Created attachment 46497 [details] [review]
[PASSED QA] Bug 15337: Add tests to ensure that GetItemTypes will return element ordered by desc

See comment #3
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2016-01-11 20:19:13 UTC
Created attachment 46498 [details] [review]
[PASSED QA] Bug 15337: Make itemtypes retrieved with GetItemTypes ordered by descriptions

Prior to this patch, the itemtypes were displayed ordered by the code
(itemtypes.itemtype DB column).
This patch will make them displayed by the description displayed (the
translated description).

Test plan:
0/ Do not apply this patch set
1/ Confirm that the itemtypes are displayed ordered by code (when adding
an item, cataloguing/additem.pl)
2/ Confirm that t/db_dependent/Koha.t does not pass
3/ Apply the test patch
4/ Confirm that t/db_dependent/Koha.t pass
5/ Confirm that the itemtypes are not displayed by description (on
additem.pl)

See comment #3
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Brendan Gallagher 2016-01-13 19:29:54 UTC
Pushed to master - thanks
Comment 15 Julian Maurice 2016-01-25 12:17:57 UTC
Patches pushed to 3.22.x, will be in 3.22.2