[Bug 23680] New: Perl string '0' evaluated as javascript boolean triggers window.close() when should not
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Bug ID: 23680 Summary: Perl string '0' evaluated as javascript boolean triggers window.close() when should not Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Staff Client Assignee: koha-bugs@lists.koha-community.org Reporter: glasklas@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com In cataloging_additem.inc the javascript variable "popup" is generated as: var popup = '[% popup | html %]'; So popup will be either '0' or '1'. '0' is a truthy value in javascript, so popup will always be evaluated as true making this condition: if( popup && op != 'saveitem' ){ window.close(); } in cataloging_additem.js (incorrectly) true for every operation except saveitem. A windows can only be closed by javascript in certain conditions (don't know if all browsers behave exactly the same), but for window.close() to actually close the window it needs to be opened in new window/tab. So to reproduce this bug go to a bibliographic record, expand the "New" menu, and open "New item" in new tab. It should immediately close, which this patch should fix. -- 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=23680 --- Comment #1 from David Gustafsson <glasklas@gmail.com> --- Created attachment 93166 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93166&action=edit Bug 23680: Incorrect conversion of Perl boolean to js A Perl boolean value is on the server side converted to a JS string (resulting in the values '0' or '1). Since the string '0' is a truthy value in JS this incorrectly triggers window.close() on the client in many instances, for example when adding a new item. To test: 1. Go to a bibliographic record in the staff client. 2. Expand the "New" menu and open "New item" in new tab. 3. The new tab will immediately close. 4. Apply the patch. 5. Perform steps 1-2 again. 6. The tab should now remain open. Sponsored-by: Gothenburg University Library -- 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=23680 --- Comment #2 from David Gustafsson <glasklas@gmail.com> --- I think this bug was introduced in Bug 21091. -- 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=23680 David Gustafsson <glasklas@gmail.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=23680 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. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #93166|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 93176 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93176&action=edit Bug 23680: Incorrect conversion of Perl boolean to js A Perl boolean value is on the server side converted to a JS string (resulting in the values '0' or '1). Since the string '0' is a truthy value in JS this incorrectly triggers window.close() on the client in many instances, for example when adding a new item. To test: 1. Go to a bibliographic record in the staff client. 2. Expand the "New" menu and open "New item" in new tab. 3. The new tab will immediately close. 4. Apply the patch. 5. Perform steps 1-2 again. 6. The tab should now remain open. Sponsored-by: Gothenburg University Library Signed-off-by: David Nind <david@davidnind.com> -- 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=23680 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #4 from David Nind <david@davidnind.com> --- I tested this with the latest Firefox and Google Chrome browsers on Ubuntu 18.04. With pop ups allowed for both browsers: - On Firefox the behaviour identified didn't occur, that is: the window opened fine in a new tab (both before and after the patch) - On Google Chrome the behaviour identified occurred and the patch fixed it. -- 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=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |glasklas@gmail.com |ity.org | CC| |katrin.fischer@bsz-bw.de --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Please don't forget to assign the bug to you when you start working on it! -- 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=23680 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=23680 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to David Nind from comment #4)
I tested this with the latest Firefox and Google Chrome browsers on Ubuntu 18.04.
With pop ups allowed for both browsers:
- On Firefox the behaviour identified didn't occur, that is: the window opened fine in a new tab (both before and after the patch)
- On Google Chrome the behaviour identified occurred and the patch fixed it.
Thx for the hints about Browsers, David! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> 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=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #93176|0 |1 is obsolete| | --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 93563 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93563&action=edit Bug 23680: Incorrect conversion of Perl boolean to js A Perl boolean value is on the server side converted to a JS string (resulting in the values '0' or '1). Since the string '0' is a truthy value in JS this incorrectly triggers window.close() on the client in many instances, for example when adding a new item. To test: 1. Go to a bibliographic record in the staff client. 2. Expand the "New" menu and open "New item" in new tab. 3. The new tab will immediately close. 4. Apply the patch. 5. Perform steps 1-2 again. 6. The tab should now remain open. Sponsored-by: Gothenburg University Library Signed-off-by: David Nind <david@davidnind.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=23680 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |19.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marka@pobox.com --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 23782 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |felicia.beaudry@equinoxinit | |iative.org --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 23490 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Perl string '0' evaluated |Can't open 'Edit items' or |as javascript boolean |'Add item' links in new tab |triggers window.close() |- tab is closed immediately |when should not | --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- 2 duplicates filed already - changing bug title to make it more readable. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_19_05_candidate CC| |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=23680 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Version(s)|19.11.00 |19.11.00,19.05.05 released in| | Status|Pushed to master |Pushed to stable --- Comment #12 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Pushed to 19.05.x for 19.05.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=24011 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes a problem where release notes| |the pop-up window or tab | |immediately closes when | |attempting to edit or add a | |bibliographic item. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23680 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=24040 CC| |kelly@bywatersolutions.com --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 24040 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org