Bug 28812 - Authority tag editor only copies $a from record to search form
Summary: Authority tag editor only copies $a from record to search form
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Didier Gautheron
QA Contact: Testopia
URL:
Keywords:
Depends on: 7882
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-04 14:51 UTC by Didier Gautheron
Modified: 2021-09-20 09:20 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.04,20.11.10


Attachments
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor (1.45 KB, patch)
2021-08-26 13:58 UTC, Didier Gautheron
Details | Diff | Splinter Review
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor (1.50 KB, patch)
2021-08-27 12:24 UTC, George Veranis
Details | Diff | Splinter Review
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor (1.55 KB, patch)
2021-08-29 13:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 28812: Improve robustness of selector (1.12 KB, patch)
2021-08-30 12:44 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 Didier Gautheron 2021-08-04 14:51:42 UTC
Steps to reproduce:

1- Create a notice with a 700$a and 700$d
2- Click on Tag Editor
3- Only 700$a is copied


Expect result:
same as 19.11 all other subfields should be copied.

There's now one more level in HTML tree and koha-tmpl/intranet-tmpl/prog/js/cataloging.js:openAuth()  selects the wrong node.


To check: still working in 
authorities/authorities.pl


====
diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
index f126c86de2..35cbe499ae 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
@@ -43,8 +43,8 @@ function openAuth(tagsubfieldid,authtype,source) {
     var elementsubfcode=getSubfieldCode(element.name);
     var mainmainstring=element.value;
     var mainstring = new Array();
-    var inputs = element.parentNode.parentNode.getElementsByTagName("input");
 
+    var inputs = element.parentNode.parentNode.parentNode.getElementsByTagName("input");
     for (var myindex =0; myindex<inputs.length;myindex++){
         if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
             var subfieldcode=getSubfieldCode(inputs[myindex].name);
Comment 1 Jonathan Druart 2021-08-06 09:46:00 UTC
Didier, are you going to submit a patch with your proposed changes?
Comment 2 Didier Gautheron 2021-08-06 10:33:13 UTC
Yes but I have to double check first it doesn't break in authorities/authorities.pl
Comment 3 Katrin Fischer 2021-08-10 10:29:29 UTC
This reads quite similar to bug 28738 - maybe a similar fix would work?
Comment 4 Katrin Fischer 2021-08-10 10:47:07 UTC
I can't reproduce this issue on master?
Comment 5 Katrin Fischer 2021-08-10 10:52:03 UTC
Maybe I am testing the wrong thing. 

Do you mean copying a repeatable field or are we talking about the authority linker?
Authority editor or editing bibliographic records?
Comment 6 Fridolin Somers 2021-08-26 05:59:43 UTC
See also Bug 28853 maybe
Comment 7 Didier Gautheron 2021-08-26 13:15:03 UTC
(In reply to Katrin Fischer from comment #5)
> Maybe I am testing the wrong thing. 
> 
> Do you mean copying a repeatable field or are we talking about the authority
> linker?
> Authority editor or editing bibliographic records?
Authority search Window.


1- Create a notice with a 700$a and 700$d
2- Click on 700 $a field Tag Editor 
3- Only 700$a is copied in search windows eg /authorities/auth_finder.pl pop up

4- Apply patch 
5- Redo 2
6- as in 19.11 700$a is copied in 'Search main heading ($a only)' and $d is copied in 'Search main heading'
Comment 8 Jonathan Druart 2021-08-26 13:37:18 UTC
(In reply to Didier Gautheron from comment #7)
> 4- Apply patch 

Which one? :)
Comment 9 Didier Gautheron 2021-08-26 13:58:55 UTC
Created attachment 124116 [details] [review]
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor

To test:
1- Create a notice with a 700$a and 700$d
2- Click on 700 $a field Tag Editor
3- Only 700$a is copied in search windows eg /authorities/auth_finder.pl pop up
4- Apply patch
5- Redo 2
6- 700$a is copied in 'Search main heading ($a only)' and $d is copied in 'Search main heading'
Comment 10 Didier Gautheron 2021-08-26 14:04:22 UTC
(In reply to Jonathan Druart from comment #8)
> (In reply to Didier Gautheron from comment #7)
> > 4- Apply patch 
> 
> Which one? :)

The one I forgot to add :)
Comment 11 George Veranis 2021-08-27 12:24:05 UTC
Created attachment 124175 [details] [review]
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor

To test:
1- Create a notice with a 700$a and 700$d
2- Click on 700 $a field Tag Editor
3- Only 700$a is copied in search windows eg /authorities/auth_finder.pl pop up
4- Apply patch
5- Redo 2
6- 700$a is copied in 'Search main heading ($a only)' and $d is copied in 'Search main heading'

Signed-off-by: George Veranis <gveranis@dataly.gr>
Comment 12 Katrin Fischer 2021-08-29 13:07:58 UTC
Created attachment 124232 [details] [review]
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor

To test:
1- Create a notice with a 700$a and 700$d
2- Click on 700 $a field Tag Editor
3- Only 700$a is copied in search windows eg /authorities/auth_finder.pl pop up
4- Apply patch
5- Redo 2
6- 700$a is copied in 'Search main heading ($a only)' and $d is copied in 'Search main heading'

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2021-08-29 13:11:12 UTC
The proposed fix definitely works and fixes a bad bug.

Bug 28828 is about the same issue and fount a slightly different solution that might be a little less prone to problems with future changes.
Comment 14 Jonathan Druart 2021-08-30 12:44:39 UTC
Created attachment 124241 [details] [review]
Bug 28812: Improve robustness of selector

Use the same fix as bug 28828.
Comment 15 Jonathan Druart 2021-08-30 15:12:11 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 16 Kyle M Hall 2021-09-03 14:43:58 UTC
Pushed to 21.05.x for 21.05.04
Comment 17 Fridolin Somers 2021-09-07 07:00:08 UTC
Pushed to 20.11.x, will be in 20.11.10
Comment 18 Victor Grousset/tuxayo 2021-09-20 09:20:43 UTC
testing this on 20.05.x to backport:

- create a new record with 700$a and 700$d populated
- save
- edit same record
- go back to 700$a
- open the Tag Editor
- only the value of 700$a goes in "Search main heading ($a only): "
- only the value of 700$d goes in "Search main heading: "

Same with an without the patch

Is what is happening expected?
yes: so 20.05.x isn't affected
no: there is an issue even with the patch

Am I actually testing the right thing?