Bug 28738

Summary: Value builder marc21_linking_section.pl for creating 77x is broken
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: CatalogingAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: m.de.rooy, nick
Version: 20.05   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28828
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 22399    
Bug Blocks:    

Description Katrin Fischer 2021-07-22 14:46:41 UTC
This is quite a neat plugin to create links between records that usually works on all 7xx. But in latest 20.11 (and possibly higher up as my research turned up no changes), this is broken.

To test:
* link marc21_linking_section.pl as value builder to 773 a or another 77x subfield.
* Make sure some of the important subfields like a, t, w, etc. are visible in your framework
* Create a new record within that framework within the standard editor
* Look for your 7xx subfield with the plugin and click the plugin icon
* Search for the record to link
* Click on choose
* Verify a new window opens and the subfields are not filled in the framework
Comment 1 Katrin Fischer 2021-07-22 14:49:21 UTC
Sometimes the additional window closes, but no information is transferred to the framework fields.
Comment 2 Katrin Fischer 2021-07-22 15:06:18 UTC
Ok, another revelation: If I like it to $a and there is an author, the author will be filled in. But $t with the title remains empty.

So the issue appears to be related to filling in multiple subfields from one plugin.
Comment 3 Katrin Fischer 2021-07-22 15:23:16 UTC
There is a syntax error in the plugin pop up shown in the console:
Uncaught SyntaxError: expected expression, got '%'

            function finish() {
                opener.document.f.field_value[[ % index % ]].value = document.f_pop.result.value;
                self.close();
                return false;
            }
Comment 4 Katrin Fischer 2021-07-22 16:38:02 UTC
I fixed the JavaScript error, but still no luck.
Comment 5 Katrin Fischer 2021-07-22 18:22:28 UTC
OK, adding another parentNode here, seems to do the trick:
                var subfields = whichfield.parentNode.parentNode.parentNode.getElementsByTagName('input');
Comment 6 Nick Clemens 2021-08-09 13:23:21 UTC
I fix both on 22399 with my version

'closest' rather than several 'parentNode'
Comment 7 Katrin Fischer 2021-08-09 14:18:23 UTC
(In reply to Nick Clemens from comment #6)
> I fix both on 22399 with my version
> 
> 'closest' rather than several 'parentNode'

Sorry, not seeing it there - can you explain a bit more?
Comment 8 Nick Clemens 2021-08-09 14:23:29 UTC
(In reply to Katrin Fischer from comment #7)
> (In reply to Nick Clemens from comment #6)
> > I fix both on 22399 with my version
> > 
> > 'closest' rather than several 'parentNode'
> 
> Sorry, not seeing it there - can you explain a bit more?

Oops, 28828
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28828
Comment 9 Katrin Fischer 2021-08-10 10:25:15 UTC
Nick provided a fix on bug 28828.

*** This bug has been marked as a duplicate of bug 22399 ***
Comment 10 Katrin Fischer 2021-08-29 13:09:48 UTC

*** This bug has been marked as a duplicate of bug 28828 ***