Bug 24957 - OpenLibrarySearch shouldnt display if nothing is returned
Summary: OpenLibrarySearch shouldnt display if nothing is returned
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-23 18:27 UTC by Lucas Gass
Modified: 2021-03-09 12:41 UTC (History)
3 users (show)

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


Attachments
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned (1.19 KB, patch)
2020-04-21 20:12 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned (1.25 KB, patch)
2020-04-21 20:58 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned (1.31 KB, patch)
2020-04-22 22:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14957: Merge rules system for merging of MARC records (91.14 KB, patch)
2021-03-09 09:26 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14957: Updated schema files (2.73 KB, patch)
2021-03-09 09:26 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 14957: fix context for batchmod and batchimport (4.54 KB, patch)
2021-03-09 09:26 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2020-03-23 18:27:50 UTC
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.
Comment 1 Heather 2020-03-23 19:24:46 UTC
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.
Comment 2 Lucas Gass 2020-04-21 20:00:39 UTC
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.
Comment 3 Lucas Gass 2020-04-21 20:12:29 UTC
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.
Comment 4 ByWater Sandboxes 2020-04-21 20:58:28 UTC
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>
Comment 5 Heather 2020-04-21 21:02:06 UTC
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!
Comment 6 Katrin Fischer 2020-04-22 22:39:36 UTC
Hi Heather, thx for testing this! Hope it will be only the first to be followed by many more :)
Comment 7 Katrin Fischer 2020-04-22 22:44:05 UTC
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>
Comment 8 Heather 2020-04-23 20:14:13 UTC
It was actually fun, Katrin!  I'll be looking for more to do in the future!!
Comment 9 Katrin Fischer 2020-04-24 20:23:21 UTC
(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!
Comment 10 Martin Renvoize 2020-04-27 10:24:48 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 11 Joy Nelson 2020-05-08 20:57:24 UTC
Backported to 19.11.x for 19.11.06
Comment 12 Lucas Gass 2020-05-14 21:04:06 UTC
backported to 19.05.x for 19.05.11
Comment 13 Martin Renvoize 2021-03-09 09:26:38 UTC
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>
Comment 14 Martin Renvoize 2021-03-09 09:26:41 UTC
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>
Comment 15 Martin Renvoize 2021-03-09 09:26:44 UTC
Created attachment 117961 [details] [review]
Bug 14957: fix context for batchmod and batchimport

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>