[Bug 28196] New: In page anchors on additem.pl don't always go to the right place
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Bug ID: 28196 Summary: In page anchors on additem.pl don't always go to the right place Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Searching Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org To recreate: -Do a search within the staff client -Click on any results and go to the detail page -Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnumber=117#edititem&searchid=scs_1619109565224' This URL has the '#edititem' anchor in it, but since it is in between 2 other params and the '&searchid=' param has been appended after the anchor it doesn't work. If you edit the URL manually to be this order it will work: /cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnumber=117&searchid=scs_1619109565224#edititem The anchor must go last. This is an annoyance to librarians, particularly for records with lots items attached to it. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #1 from Lucas Gass <lucas@bywatersolutions.com> --- Some more info. about the hierarchical structure of URLs: https://tools.ietf.org/html/rfc3986#section-3 The anchor being the least important needs to be last -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #2 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 120027 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=120027&action=edit Bug 28196: make sure hash is always appended last To test: -Do a search within the staff client -Click on any results and go to the detail page -Click the edit button on any item in that record, you will be taken to the edit item screen but you will not be taken to the <h2 id="edititem"> placeholder -Apply patch and try again -This time when taken to the edit item screen you should be placed right at the <h2 id="edititem"> placeholder -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #3 from Lucas Gass <lucas@bywatersolutions.com> --- My patch fixes the problem by changing browser.js. Perhaps a better solution would be to add the searchid into the links inside each of the templates that call browser.js. It seems to only be called in a handful of templates: root@kohadevbox:koha(master)$ git grep 'Asset.js("js/browser.js")' koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt: [% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt:[% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt:[% Asset.js("js/browser.js") | $raw %] koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt: [% Asset.js("js/browser.js") | $raw %] -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lucas@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org --- Comment #4 from Phil Ringnalda <phil@chetcolibrary.org> --- Since we don't support Internet Explorer, why not use the URL object, and let it do the work of parsing for you? Something like (untested, so I'll probably typo something) let parsedurl = new URL($(this).attr('href')); parsedurl.searchParams.set('searchid',me.searchid); window.location = parsedurl.href; Bonus advantage: if searchParams.set() sees that someone has screwed up and the URL already has two searchid params in it, it'll set one and delete the other, while doing it by hand would be adding a third. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #5 from Lucas Gass <lucas@bywatersolutions.com> --- (In reply to Phil Ringnalda from comment #4)
Since we don't support Internet Explorer, why not use the URL object, and let it do the work of parsing for you?
Something like (untested, so I'll probably typo something)
let parsedurl = new URL($(this).attr('href')); parsedurl.searchParams.set('searchid',me.searchid); window.location = parsedurl.href;
Bonus advantage: if searchParams.set() sees that someone has screwed up and the URL already has two searchid params in it, it'll set one and delete the other, while doing it by hand would be adding a third.
Thanks Phil, As far as I understand it new URL() with a single argument must include an absolute path. You can give it a relative URL, but in that case you must always pass the base URL as the 2nd argument. If I'm wrong I am happy for someone to let me know of provide an alternate patch! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #6 from Phil Ringnalda <phil@chetcolibrary.org> --- Sorry, let parsedurl = new URL($(this).attr('href'),document.baseURI); - I didn't actually look at what $(this).attr('href') was. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Hakam Almotlak <hakam.almotlak@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hakam.almotlak@inLibro.com --- Comment #7 from Hakam Almotlak <hakam.almotlak@inLibro.com> --- without the patch the problem exist when you try to search within the catalogues but it does not exist when you search for a catalogue then you try to edit an item from the same catalogue. after the patch it does not fix the problem. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #120027|0 |1 is obsolete| | --- Comment #8 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 122352 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122352&action=edit Bug 28196: make sure URL hash is appended last TO test: 1 Do a search within the staff client 2 Click on any results and go to the detail page 3 Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnumber=117#edititem&searchid=scs_1619109565224' 4 Apply patch 5 Do steps 1 & 2 again Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnum ber=117&searchid=scs_1619109565224#edititem' 6. If they URL hash is last the anchor should work and you'll be placed on the h2 element with and ID of edititem -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122352|0 |1 is obsolete| | --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 122384 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122384&action=edit Bug 28196: make sure URL hash is appended last TO test: 1 Do a search within the staff client 2 Click on any results and go to the detail page 3 Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnumber=117#edititem&searchid=scs_1619109565224' 4 Apply patch 5 Do steps 1 & 2 again Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnum ber=117&searchid=scs_1619109565224#edititem' 6. If they URL hash is last the anchor should work and you'll be placed on the h2 element with and ID of edititem Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Eric Bégin <eric.begin@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|hakam.almotlak@inLibro.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122384|0 |1 is obsolete| | --- Comment #10 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 122747 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122747&action=edit Bug 28196: make sure URL hash is appended last TO test: 1 Do a search within the staff client 2 Click on any results and go to the detail page 3 Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnumber=117#edititem&searchid=scs_1619109565224' 4 Apply patch 5 Do steps 1 & 2 again Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnum ber=117&searchid=scs_1619109565224#edititem' 6. If they URL hash is last the anchor should work and you'll be placed on the h2 element with and ID of edititem Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA CC| |nick@bywatersolutions.com --- Comment #11 from Nick Clemens <nick@bywatersolutions.com> --- Oops, this breaks item editing, the form now has values like: <input type="hidden" name="itemnumber" value="974searchid=scs_1625837723086"> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #12 from Phil Ringnalda <phil@chetcolibrary.org> --- Created attachment 152478 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152478&action=edit Bug 28196: Insert searchid in URL correctly, so it doesn't follow the hash Test plan: 1. Search the catalog in the staff client for anything which will return at least two results 2. Click on any result to go to the bib detail page 3. Click the edit button for any item attached to the bib 4. Verify that the loaded URL contains &searchid=scs_(a number), and that the URL ends with #edititem 5. Make any change to the item, save, verify that your change was made -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|lucas@bywatersolutions.com |phil@chetcolibrary.org --- Comment #13 from Phil Ringnalda <phil@chetcolibrary.org> --- One handy feature of using searchParams.set rather than concatenating strings to form a URL is that you don't have to remember to include the ampersand. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122747|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152478|0 |1 is obsolete| | --- Comment #14 from Sam Lau <samalau@gmail.com> --- Created attachment 152686 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152686&action=edit Bug 28196: Insert searchid in URL correctly, so it doesn't follow the hash Test plan: 1. Search the catalog in the staff client for anything which will return at least two results 2. Click on any result to go to the bib detail page 3. Click the edit button for any item attached to the bib 4. Verify that the loaded URL contains &searchid=scs_(a number), and that the URL ends with #edititem 5. Make any change to the item, save, verify that your change was made Signed-off-by: Sam Lau <samalau@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |katrin.fischer@bsz-bw.de |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152686|0 |1 is obsolete| | --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 153295 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=153295&action=edit Bug 28196: Insert searchid in URL correctly, so it doesn't follow the hash Test plan: 1. Search the catalog in the staff client for anything which will return at least two results 2. Click on any result to go to the bib detail page 3. Click the edit button for any item attached to the bib 4. Verify that the loaded URL contains &searchid=scs_(a number), and that the URL ends with #edititem 5. Make any change to the item, save, verify that your change was made Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|23.11.00 |23.11.00,23.05.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #17 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Thanks for all the hard work! Pushed to 23.05.x for the next release -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.11.00,23.05.02 |23.11.00,23.05.02,22.11.08 released in| | Status|Pushed to stable |Pushed to oldstable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196 --- Comment #18 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Nice work everyone! Pushed to oldstable for 22.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org