Bug 33585

Summary: Remove javascript code duplication in shelf browser
Product: Koha Reporter: Virgil Dupras <virgil.dupras>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Initial patch

Description Virgil Dupras 2023-04-21 15:41:51 UTC
Created attachment 150056 [details] [review]
Initial patch

The handling of JS "previous" and "next" links in the shelf browser duplicate non-trivial code, which increases the chances for accidental bugs and makes the integration of other cover providers harder than it should (that is, duplication is propagated to each further provider).

This patch removes that duplication by harmonizing the "itemnumber" data element attached to the buttons and by making the jquery selector apply to both buttons at once.

Test Plan:

1) Apply patch.
2) Open the detail page of a document with enough adjacent documents to have a more-than-full shelf.
3) Open the shelf for the document. 
4) Click previous and check that the handler still does its thing as expected.
5) Same thing for Next.

I'm new to Koha (and perl) and its development workflow, I hope that this bug report doesn't break too many rules.