If you turn on OpenLibrarySearch results are often not returned and only the text "Open Library:" displays. Firstly, if there is nothing to return we should display nothing. Secondly, it does look like any of these records do return data but the API has changed, I think. Koha checks to see if "items: []" has length and returns false if this is true. But I am finding many records where the data seems to be present: (https://openlibrary.org/api/volumes/brief/json/id:0;isbn:067002662X;lccn:__2012035454) but items contains nothing. I don't know anything about the OpenLibrary API, but perhaps it has changed. TO RECREATE: 1. turn on OpenLibrarySearch 2. go to the opac results page and opac details page and see many records that just display "Open Library: " and nothing else.
This search in our 19.05 catalog shows several items with the text "Open Library: " where OpenLibrary actually has the item: https://keys.bywatersolutions.com/cgi-bin/koha/opac-search.pl?q=cachalot E.g., also, these records: https://keys.bywatersolutions.com/cgi-bin/koha/opac-detail.pl?biblionumber=13955&query_desc=cachalot https://keys.bywatersolutions.com/cgi-bin/koha/opac-detail.pl?biblionumber=13954&query_desc=fiction From those records in our catalog you can select "More searches," and the "Open Library..." search, you are taken to the Open Library where there are copies to borrow.
Upon further review I don't think the API has changed. According to https://openlibrary.org/dev/docs/api/read, if items is empty "Thw list may be empty if nothing's available." So when no items are available we should not display the ol_readapi_book class in the search results or details. If we do all that displays is 'Open Library:' with nothing else. That seems confusing.
Created attachment 103417 [details] [review] Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned TO TEST: 1. Turn on OpenLibrarySearch 2. Do an OPAC search that returns results that have results with Open Library results and some that do not. 3. Notice results that return nothing simpliy say "Open Library:" with nothing afterwards. 4. Some results return a png from OpenLibrary or "Not found" 5. Apply patch and look at records again. 6. The results that return nothing for OpenLibrary API should now to hidden.
Created attachment 103419 [details] [review] Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned TO TEST: 1. Turn on OpenLibrarySearch 2. Do an OPAC search that returns results that have results with Open Library results and some that do not. 3. Notice results that return nothing simpliy say "Open Library:" with nothing afterwards. 4. Some results return a png from OpenLibrary or "Not found" 5. Apply patch and look at records again. 6. The results that return nothing for OpenLibrary API should now to hidden. Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
I used a sandbox and was able to re-create the problem with the keyword search: first Some of the results had the problem display, "Open Library: " and some results displayed "Open Library: Not found," and there was also the correct display, "Open Library Read Now." I then applied the patch, and the problematic "Open Library: " disappeared--there were still some libraries that said, "Open Library: Not found" and a record with the correct display, "Open Library Read Now." So I went ahead and signed off, because the problematic display disappeared. But this is my first real sign off, so please comment to let me know if I missed something, or if the "Open Library: Not found" should have also disappeared. Thanks!
Hi Heather, thx for testing this! Hope it will be only the first to be followed by many more :)
Created attachment 103518 [details] [review] Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned TO TEST: 1. Turn on OpenLibrarySearch 2. Do an OPAC search that returns results that have results with Open Library results and some that do not. 3. Notice results that return nothing simpliy say "Open Library:" with nothing afterwards. 4. Some results return a png from OpenLibrary or "Not found" 5. Apply patch and look at records again. 6. The results that return nothing for OpenLibrary API should now to hidden. Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
It was actually fun, Katrin! I'll be looking for more to do in the future!!
(In reply to Heather from comment #8) > It was actually fun, Katrin! I'll be looking for more to do in the future!! Glad to hear that :) Don't hesitate to get in touch (on IRC or by email) if you need any help!
Nice work everyone! Pushed to master for 20.05
Backported to 19.11.x for 19.11.06
backported to 19.05.x for 19.05.11
Created attachment 117959 [details] [review] Bug 14957: Merge rules system for merging of MARC records Add a rule based system for merging MARC records to for example prevent field data from being overwritten. To test: 1. Apply this patch. 2. Log in to staff client. 3. Enable new syspref MARCMergeRules. 4. Click the new link "MARC merge rules" in the "Catalog" section of the Koha administration page. 5. Create a new rule: Module: source, Filter: *, Tag: 245, Preset: Protect. 6. Clicking "Edit" should allow you to edit corresponding rule. 7. Clicking "Delete" should remove corresponding rule after confirmation. 8. Selecting one or more rules followed by clicking "Delete selected" should remove all selected rules after confirmation. 9. Try creating a rule with tag set to "**", the other options does not matter. Verify that saving this rule produces an error message complaining about invalid tag regular expression. 10. Try creating a rule with tag set to "008" (or other control field) and set Appended: Append and Removed: Skip, the other options does not matter. Verify that saving this rule produces an error message complaining about invalid combination of actions for control field. 11. With the 245 rule in step 5 in place, edit a bibliographic record, change 245a for example (which should be Title for MARC21) and save. 12. Verify that the changes has not been saved. 13. Create a new rule: Module: source, Filter: intranet, Tag: 245, Preset: Overwrite. 14. Repeat step 12, and verify that the changes has now been saved. 15. Run tests in t/db_dependent/Biblio/MarcMergeRules.t and very that all tests pass. Sponsored-by: Halland County Library Sponsored-by: Catalyst IT Sponsored-by: Gothenburg University Library Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 117960 [details] [review] Bug 14957: Updated schema files Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 117961 [details] [review] Bug 14957: fix context for batchmod and batchimport Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>