Summary: | Sort profiles alphabetically when staging MARC records for import | ||
---|---|---|---|
Product: | Koha | Reporter: | Lucas Gass (lukeg) <lucas> |
Component: | Tools | Assignee: | Lucas Gass (lukeg) <lucas> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | barbara.johnson, florian.bontemps, kyle, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
22.05.00
|
|
Circulation function: | |||
Attachments: |
Bug 29946: Sort Marc profiles alphabetically
Bug 29946: Sort Marc profiles alphabetically Bug 29946: Sort Marc profiles alphabetically Bug 29946: Sort Marc profiles alphabetically Bug 29946: Sort Marc profiles alphabetically |
Description
Lucas Gass (lukeg)
2022-01-25 18:45:19 UTC
Created attachment 129813 [details] [review] Bug 29946: Sort Marc profiles alphabetically To test: 1- Go to Tools > Stage MARC records for import 2- You'll need a MARC file, choose one and hit 'Upload file' 3- Create many Profiles with different names. I used ( ATop, ZTop, JTop, STop, etc. ) 4- Notice that the profiles sort in the order in which you create them 5- Apply patch 6- Try steps 1-2 again 7- Now the dropdown should be sorted alphabetically 8- Make a few more profiles and make sure they are being inserted in the right order alphabetically Created attachment 130249 [details] [review] Bug 29946: Sort Marc profiles alphabetically To test: 1- Go to Tools > Stage MARC records for import 2- You'll need a MARC file, choose one and hit 'Upload file' 3- Create many Profiles with different names. I used ( ATop, ZTop, JTop, STop, etc. ) 4- Notice that the profiles sort in the order in which you create them 5- Apply patch 6- Try steps 1-2 again 7- Now the dropdown should be sorted alphabetically 8- Make a few more profiles and make sure they are being inserted in the right order alphabetically Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> I am sorry, but while this works for A-z and therefor for English, it doesn't work for other languages like German with Umlauts or French with accents/diacritics. If you enter for example a description starting with Á, it will sort at the end, instead of as A. I think we need to use a sort that accounts for that and that we already have that in Koha - using cmp instead of >? (In reply to Katrin Fischer from comment #3) > I am sorry, but while this works for A-z and therefor for English, it > doesn't work for other languages like German with Umlauts or French with > accents/diacritics. If you enter for example a description starting with Á, > it will sort at the end, instead of as A. > > I think we need to use a sort that accounts for that and that we already > have that in Koha - using cmp instead of >? Since we fetch this profiles from /api/v1/import_batch_profiles I think we need a way to sort these, with accents/diacritics, in JavaScript instead of Perl. I think localeCompare might be the answer: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare Created attachment 132200 [details] [review] Bug 29946: Sort Marc profiles alphabetically To test: 1- Go to Tools > Stage MARC records for import 2- You'll need a MARC file, choose one and hit 'Upload file' 3- Create many Profiles with different names. Add some that include accents/diacritics. 4- Notice that the profiles sort in the order in which you create them 5- Apply patch 6- Try steps 1-2 again 7- Now the dropdown should be sorted alphabetically 8- Make a few more profiles and make sure they are being inserted in the right order alphabetically, including the profiles containing accents/diacritics. I was able to create profiles using different accents and diacritics. And the sorting worked correctly. But I did run into problems with the following scenario. I tried to create several similarly named profiles such as the two sets listed below. I could only save one profile from each set. It seems that it isn't able to differentiate between a letter with and without accent marks. etest ètest étest abooks äbooks ábooks (In reply to Barbara Johnson from comment #6) > I was able to create profiles using different accents and diacritics. And > the sorting worked correctly. > > But I did run into problems with the following scenario. I tried to create > several similarly named profiles such as the two sets listed below. I could > only save one profile from each set. It seems that it isn't able to > differentiate between a letter with and without accent marks. > > etest > ètest > étest > > abooks > äbooks > ábooks I see what you mean. This happens with or without this patch. It also seems unrelated to diacritics as I can add a profile with a name like 'abook' but then I will get the error if I try 'Abook' or 'aBook'. In the error logs I see: [WARN] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'abook' for key 'u_import_batch_profiles__name' at /kohadevbox/koha/Koha/Object.pm line 170 Maybe we should file a separate bug for that issue? Created attachment 132240 [details] [review] Bug 29946: Sort Marc profiles alphabetically To test: 1- Go to Tools > Stage MARC records for import 2- You'll need a MARC file, choose one and hit 'Upload file' 3- Create many Profiles with different names. Add some that include accents/diacritics. 4- Notice that the profiles sort in the order in which you create them 5- Apply patch 6- Try steps 1-2 again 7- Now the dropdown should be sorted alphabetically 8- Make a few more profiles and make sure they are being inserted in the right order alphabetically, including the profiles containing accents/diacritics. Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> Yes, that does sound like a separate issue. Everything worked as described with this patch so I am signing off on it. Created attachment 133139 [details] [review] Bug 29946: Sort Marc profiles alphabetically To test: 1- Go to Tools > Stage MARC records for import 2- You'll need a MARC file, choose one and hit 'Upload file' 3- Create many Profiles with different names. Add some that include accents/diacritics. 4- Notice that the profiles sort in the order in which you create them 5- Apply patch 6- Try steps 1-2 again 7- Now the dropdown should be sorted alphabetically 8- Make a few more profiles and make sure they are being inserted in the right order alphabetically, including the profiles containing accents/diacritics. Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Works, qa script happy, code looks good, passing QA :) Pushed to master for 22.05, thanks to everybody involved [U+1F984] |