Summary: | opac-MARCdetail: Can't call method "metadata" on an undefined value | ||
---|---|---|---|
Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
Component: | OPAC | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | CLOSED FIXED | QA Contact: | Katrin Fischer <katrin.fischer> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, fridolin.somers, jonathan.druart, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: |
This fixes the display of the MARC view page when a record does not exist - it now redirects to the 404 (page not found) page. Previously, it generated an error trace, where the normal and ISBD view pages redirected to the 404 (page not found) page.
|
|
Version(s) released in: |
23.11.00,23.05.06
|
Circulation function: | |
Attachments: |
Bug 35266: Fix biblio check in opac-MARCdetail
Bug 35266: Fix biblio check in opac-MARCdetail Bug 35266: Fix biblio check in opac-MARCdetail |
Description
Marcel de Rooy
2023-11-06 13:15:06 UTC
Created attachment 158518 [details] [review] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 158576 [details] [review] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> I tried without the patch, but got the 404 - can you please check? http://localhost:8080/cgi-bin/koha/opac-MARCdetail?biblionumber=11111199999 I still see: Can't call method "metadata" on an undefined value at /usr/share/koha/opac/opac-MARCdetail.pl line 95 You need to restart Plack. And perhaps clear the browser cache? This is how I tested (using KTD): 1. In the OPAC, attempt to view a record that does not exist - normal view: . http://127.0.0.1:8080/cgi-bin/koha/opac-detail.pl?biblionumber=9999 => redirected to the 404 page 2. In the OPAC, attempt to view a record that does not exist - ISBD view: . 127.0.0.1:8080/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=9999 => redirected to the 404 page 3. In the OPAC, attempt to view a record that does not exist - MARC view: . 127.0.0.1:8080/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=9999 => Get an error trace: Can't call method "metadata" on an undefined value at /kohadevbox/koha/opac/opac-MARCdetail.pl line 95 .... 4. Apply the patch, restart_all, fresh browser (cache cleared). 5. Repeat step 3 => now redirected to the 404 page, no error trace (In reply to Katrin Fischer from comment #3) > I tried without the patch, but got the 404 - can you please check? > > http://localhost:8080/cgi-bin/koha/opac-MARCdetail?biblionumber=11111199999 This URL ↑↑ goes to opac-MARCdetail but it should be opac-MARCdetail.pl Created attachment 158977 [details] [review] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> JD amended patch: Use ternary op Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.06 |