Bug 28828

Summary: Bug 22399 breaks unimarc_field_4XX.tt and marc21_linking_section.tt value builders
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: CatalogingAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, katrin.fischer, kyle, m.de.rooy, nick, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28829
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28738
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.03,20.11.09
Bug Depends on: 22399    
Bug Blocks:    
Attachments: Bug 28828: (Bug 22399 follow-up) impact on value_builder/unimarc_field_4XX.tt
Bug 28828: Bug 22399 impact on value_builder/unimarc_field_4XX.tt
Bug 28828: Bug 22399 impact on value_builder/unimarc_field_4XX.tt
Bug 28828: (Alternate) find closest ul for valuebuilders
Bug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders
Bug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders

Description Fridolin Somers 2021-08-07 01:35:04 UTC
Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript code does not do its job anymore.
This is because a div is added and this call is now wrong :
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');
It needs one more parent.
Comment 1 Fridolin Somers 2021-08-07 01:43:38 UTC
Created attachment 123591 [details] [review]
Bug 28828: (Bug 22399 follow-up) impact on value_builder/unimarc_field_4XX.tt

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript code does not do its job anymore.
This is because a div is added and this call is now wrong :
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');
It needs one more parent.

Test plan :
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value
Comment 2 Fridolin Somers 2021-08-07 01:53:32 UTC
Created attachment 123592 [details] [review]
Bug 28828: Bug 22399 impact on value_builder/unimarc_field_4XX.tt

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript code does not do its job anymore.
This is because a div is added and this call is now wrong :
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');
It needs one more parent.

Test plan :
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value
Comment 3 David Nind 2021-08-07 11:47:51 UTC
Created attachment 123594 [details] [review]
Bug 28828: Bug 22399 impact on value_builder/unimarc_field_4XX.tt

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript code does not do its job anymore.
This is because a div is added and this call is now wrong :
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');
It needs one more parent.

Test plan :
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Nick Clemens 2021-08-09 12:14:16 UTC
Created attachment 123642 [details] [review]
Bug 28828: (Alternate) find closest ul for valuebuilders

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript code does not do its job anymore.
This is because a div is added and this call is now wrong :
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');
It needs one more parent.

Test plan 1:
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value

Test plan 2:
1) Use a MARC_21 DB
2) Define plugin mnarc21_linking_section.pl on 773$t
3) Make sure 773$t and other subfields are visible in intranet/editor
4) Create a new record in basic cataloging editor
5) Click on value builder in 773$t
6) Search fro a record
7) Click on "Choose"
=> Without patch fields are not fileld
=> With patch subfields are correctly filled
Comment 5 Nick Clemens 2021-08-09 12:15:02 UTC
Looks like a second plugin is affected - I use 'closest' rather than several 'parentNode' as I think it makes the change clearer - what do you think Frido?
Comment 6 Katrin Fischer 2021-08-09 13:18:07 UTC
Bug 28738 is also affected - would love some help there simplifying the JS.
Comment 7 Katrin Fischer 2021-08-10 10:41:28 UTC
Created attachment 123666 [details] [review]
Bug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders

Find closest ul for value builders.

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript
code does not do its job anymore.
This is because a div is added and this call is now wrong:
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');

Test plan 1:
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value

Test plan 2:
1) Use a MARC_21 DB
2) Define plugin marc21_linking_section.pl on 773$t
3) Make sure 773$t and other subfields are visible in intranet/editor
4) Create a new record in basic cataloging editor
5) Click on value builder in 773$t
6) Search fro a record
7) Click on "Choose"
=> Without patch fields are not fileld
=> With patch subfields are correctly filled

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2021-08-10 10:42:42 UTC
Hi Frido or David, could one of you have a final look here? I've chosen Nick's alternate and changed the bug title to reflect that this now fixes 2 different value builders.
Comment 9 David Nind 2021-08-10 13:15:22 UTC
Created attachment 123687 [details] [review]
Bug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders

Find closest ul for value builders.

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript
code does not do its job anymore.
This is because a div is added and this call is now wrong:
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');

Test plan 1:
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value

Test plan 2:
1) Use a MARC_21 DB
2) Define plugin marc21_linking_section.pl on 773$t
3) Make sure 773$t and other subfields are visible in intranet/editor
4) Create a new record in basic cataloging editor
5) Click on value builder in 773$t
6) Search fro a record
7) Click on "Choose"
=> Without patch fields are not fileld
=> With patch subfields are correctly filled

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2021-08-10 13:17:07 UTC
(In reply to Katrin Fischer from comment #8)
> Hi Frido or David, could one of you have a final look here? I've chosen
> Nick's alternate and changed the bug title to reflect that this now fixes 2
> different value builders.

I have run through the updated test plan and everything works as expected.
Comment 11 Katrin Fischer 2021-08-10 13:18:30 UTC
Thanks a lot David!
Comment 12 Jonathan Druart 2021-08-11 11:24:30 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 13 Kyle M Hall 2021-08-13 11:36:28 UTC
Pushed to 21.05.x for 21.05.03
Comment 14 Fridolin Somers 2021-08-13 20:11:35 UTC
Pushed to 20.11.x for 20.11.09
Comment 15 Victor Grousset/tuxayo 2021-08-16 21:08:54 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.
Comment 16 Katrin Fischer 2021-08-29 13:09:48 UTC
*** Bug 28738 has been marked as a duplicate of this bug. ***