Bug 17780 - When choose an author in authority results new window shows a blank screen
Summary: When choose an author in authority results new window shows a blank screen
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Oleg Vasylenko
QA Contact: Testopia
URL:
Keywords:
Depends on: 13501 18119
Blocks: 22242
  Show dependency treegraph
 
Reported: 2016-12-15 10:52 UTC by George Veranis
Modified: 2019-01-31 08:11 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
authority results choose (171.96 KB, image/png)
2016-12-15 10:52 UTC, George Veranis
Details
Bug 17780: JS structure check fix (1.59 KB, patch)
2017-01-24 16:11 UTC, Oleg Vasylenko
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17780 - When choose an author in authority results new window shows a blank screen (1.64 KB, patch)
2017-02-15 07:12 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17780 - When choose an author in authority results new window shows a blank screen (1.69 KB, patch)
2017-02-15 08:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17780: Add a comment to explain the line (1.40 KB, patch)
2017-02-15 08:12 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description George Veranis 2016-12-15 10:52:32 UTC
Created attachment 58199 [details]
authority results choose

When a librarian open the authority window to search , find one or more results and try to choose a result then a new window is open and show a blank screen and stop. 
If we return to our cataloguing form then the authority has passed but the blank screen is remain.
Comment 1 Owen Leonard 2016-12-15 16:16:25 UTC
It is expected that a new blank window pops up, but it is supposed to then close itself. I would expect that a JavaScript error is causing the window not to close.

This works for me in master and 16.05.x, so I wonder if you have some custom JavaScript in intranetuserjs which might be causing a problem?
Comment 2 George Veranis 2016-12-19 14:10:38 UTC
No the installation is clean and is on 16.11 . 

on console log I have the following 
 Uncaught TypeError: Cannot read property 'match' of null(…) cataloging.js:106
the problem is that on line 106 is trying to match with id and select2 not produce select with id ,
and I add this on select2.min.js in order select has id attribute and not fail
"<div class='select2-drop select2-display-none' id='select2-display-none-"+Math.floor(Date.now() /1000)+"'>","   <div class='select2-searc
h' id='select-search-"+Math.floor(Date.now() / 1000)+"'>",

but then I have another problem with select2 which not bind on click for cloned field there I tried a lot to solve it but without success at yet. 

If I'm correct 16.05 not use select2 and yes works perfect !
Comment 3 José Anjos 2016-12-19 16:15:25 UTC
The same is happening with me.
Blank window needs to be manually closed.
Koha version: 16.11 + mariaDB + Ubuntu 16.04
Comment 4 Oleg Vasylenko 2017-01-24 16:11:52 UTC
Created attachment 59513 [details] [review]
Bug 17780: JS structure check fix

Select2 (Bug 13501) introduced divs and inputs that broke some assumptions about the expected HTML structure.
This patch checks if input has name attribute, because some inputs in Select2 have not.

Blank screen happens on page blinddetail-biblio-search.pl because when the script works with field that has Select2 as one of the subfields, it finds some structures, that have no required attributes.

To test:
Try to add info from the authorities to field that has subfield with Select2 (subfield with authorised values on Koha 16.11+). For example, in UNIMARC installations that should be 700, 701, 702
Comment 5 Oleg Vasylenko 2017-01-25 10:20:10 UTC
Steps to Reproduce: 
1. Open some book in the editor or create new (cataloguing/addbiblio.pl)
2. Add info to authority-controlled subfield. One of the subfields of this field should be thesaurus driven → subfield with Select2 (In UNIMARC that could be 700-702)

Actual Results: 
 — data from the authority record does not added
 — blinddetail-biblio-search.pl with white screen is opened, and does not close

Expected Results: 
Info from the authority record shoul be added to appropriate subfields

Additional Information:
This happens because Select2 adds some inputs, that do not have NAME property. 
The following patch adds check for the needed attribute existance.
Comment 6 Josef Moravec 2017-02-15 07:12:26 UTC
Created attachment 60238 [details] [review]
[SIGNED-OFF] Bug 17780 - When choose an author in authority results new window shows a blank screen

Select2 (Bug 13501) introduced divs and inputs that broke some assumptions about the expected HTML structure.
This patch checks if input has name attribute, because some inputs in Select2 have not.

To test:
Try to add info from the authorities to field that has subfield with Select2 (subfield with authorised values on Koha 16.11+)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Jonathan Druart 2017-02-15 08:12:24 UTC
Created attachment 60241 [details] [review]
Bug 17780 - When choose an author in authority results new window shows a blank screen

Select2 (Bug 13501) introduced divs and inputs that broke some assumptions about the expected HTML structure.
This patch checks if input has name attribute, because some inputs in Select2 have not.

To test:
Try to add info from the authorities to field that has subfield with Select2 (subfield with authorised values on Koha 16.11+)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 8 Jonathan Druart 2017-02-15 08:12:28 UTC
Created attachment 60242 [details] [review]
Bug 17780: Add a comment to explain the line

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 9 Jonathan Druart 2017-02-15 08:13:01 UTC
To recreate the issue the select2 should be placed before $9!
Comment 10 Kyle M Hall 2017-02-15 11:17:42 UTC
Pushed to master for 17.05, thanks Oleg, Jonathan!
Comment 11 Katrin Fischer 2017-02-19 18:54:28 UTC
These patches have been pushed to 16.11.x and will be in 16.11.04.
Comment 12 Mason James 2017-02-22 23:14:54 UTC
Pushed to 16.05.x, for 16.05.10 release