https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36154

--- Comment #61 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 203649
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203649&action=edit
Bug 36154: (QA follow-up) Rework cover-image-plugin integration around the
existing .cover-slider contract

QA review of this patchset (and live testing with the community's BDS
Covers plugin, https://github.com/PTFS-Europe/koha-plugin-addBDSCovers)
found that none of the five templates this bug touches actually let a
cover-image plugin render anything:

- virtualshelves/shelves.tt, opac-user.tt (checkouts/overdues), and
  opac-readingrecord.tt each rendered a bare <td> for the plugin-only
  case, with no id/class/data attribute a plugin's JS could use to find
  the row. Koha already has an established contract for this -- a
  ".cover-slider"/".cover-slides" container carrying data-biblionumber,
  used by cover-images.inc (OPAC lists/results) and catalogue/results.tt
  (staff search results) -- that this patchset never reused. Confirmed
  with the BDS Covers plugin installed: the "Cover" column/header
  appeared and the plugin's <script> was present in the page, but the
  cell stayed empty because there was nothing for the script to target.
- shelfbrowser.inc had a second, unrelated regression: a static <img>
  was added inside the local-cover div, which used to be populated
  purely by KOHA.LocalCover.GetCoverFromBibnumber(). That JS reads the
  div's whole class attribute as the biblionumber, so once the div was
  no longer empty it fired a second, malformed request per item
  (.../opac-image.pl?biblionumber=73 thumbnail-shelfbrowser) and left
  a broken image and a "No cover image available" message shown at the
  same time. Confirmed via network capture while paging through the
  shelf browser with OPACLocalCoverImages and the plugin both enabled.
- svc/shelfbrowser.tt printed the plugin's script without the `| $raw`
  filter Koha's QA tooling requires (koha-qa.pl: filters/missing_filter).
- shelves.tt referenced an img_title variable that nothing in the file
  ever set, so the tooltip on the local cover thumbnail was always
  empty (a leftover from copying shelfbrowser.inc's pattern without its
  earlier `[% img_title = ... %]` assignment).

This patch:
- Wraps the plugin/Local/Custom cover markup in virtualshelves/shelves.tt
  in a `.cover-slider.cover-slides[data-biblionumber]` container,
  matching catalogue/results.tt's existing intranet pattern.
- Wraps the Amazon/Google/Custom/Syndetics cover markup in opac-user.tt
  (checkouts and overdues) and opac-readingrecord.tt in the same
  `.cover-slider.cover-slides[data-biblionumber]` container OPAC pages
  already use via cover-images.inc, without changing any of the
  existing per-source behaviour.
- Reverts the static <img> added to shelfbrowser.inc's local-cover div,
  restoring the original JS-driven rendering (the plugin case there
  already works via the pre-existing .shelfbrowser_cover anchor, so no
  further change was needed for that element).
- Adds the missing `| $raw` filter in svc/shelfbrowser.tt.
- Removes the dangling img_title reference in shelves.tt (the markup it
  was on has been replaced by the cover-images.inc-style pattern above).

Test plan:
1. Enable plugins (<enable_plugins> in koha-conf.xml) and install/enable
   a cover-image plugin implementing intranet_cover_images and/or
   opac_cover_images (the community's koha-plugin-addBDSCovers is a
   convenient real one; see bug 32680 comment 2 for a copy).
2. With LocalCoverImages, CustomCoverImages and all other cover-image
   sources left at their default (off) and only the plugin enabled:
   a. Staff list view: add a title with an ISBN to a list and view it.
      The "Cover" column appears and the plugin's cover now renders
      inside it (verify via "View page source" / devtools if the
      plugin's image host isn't reachable from your test network).
   b. OPAC "Your summary" and "Your reading history": check out and/or
      return that title, then confirm the plugin's cover renders on
      both pages.
   c. OPAC shelf browser ("Browse shelf" from the detail page): confirm
      covers render, including after using the Previous/Next
      pagination inside the shelf browser widget.
3. Re-enable LocalCoverImages/CustomCoverImages (staff and OPAC) and
   confirm those still render exactly as before in all of the above
   (regression check) -- local and custom covers should appear
   alongside, not instead of, the plugin's.
4. Specifically for the shelf-browser regression: with
   OPACLocalCoverImages on and a title with a local cover image, open
   the shelf browser and click "Next"/"Previous" repeatedly. Confirm
   each item shows at most one image (no duplicate/broken image plus a
   simultaneous "No cover image available" message), and check the
   browser's network tab for no malformed
   opac-image.pl?biblionumber=<n>%20thumbnail-shelfbrowser requests.
5. koha-qa.pl -c 5

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to