Skip to content

Commit

Permalink
fix: bug 37496 item barcodes should go to specific item
Browse files Browse the repository at this point in the history
  • Loading branch information
phette23 committed Oct 8, 2024
1 parent 51be8ed commit d045f9e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions admin-js/catalog-detail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Bug 37496: Restore parameter to limit to details of one item
if (location.pathname.match('/cgi-bin/koha/catalogue/detail.pl')) {
// holdings table not available on page load
setTimeout(() => {
console.log($('#holdings_table'))
// barcode is literally the only <td> with no unique classname :eyeroll:
$('#holdings_table td > a[href^="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber="]').each(function (idx, el) {
console.log(el)
// parse item id from item#### fragment at end of link
const url = new URL(el.href)
const item = url.hash.match(/#item(\d+)/)[1]
if (item) {
url.searchParams.set('item', item)
$(this).attr('href', url.toString())
}
})
}, 1000)
}

0 comments on commit d045f9e

Please sign in to comment.