Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug 7455: Authority subfields are cloned in the wrong field (follow-u…

…p 2)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Passed-QA-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
  • Loading branch information...
commit 7cf5e2e954b8874b5ddc3d9ecb1bf50ed0b11293 1 parent eabe698
Fridolyn SOMERS authored jcamins committed
2  authorities/authorities.pl
@@ -199,7 +199,7 @@ sub create_input {
199 199 class=\"input_marceditor\"
200 200 tabindex=\"1\" \/>
201 201 <a href=\"#\" class=\"buttonDot\"
202   - onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
  202 + onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."','auth'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
203 203 ";
204 204 # it's a plugin field
205 205 }
25 cataloguing/addbiblio.pl
@@ -372,7 +372,8 @@ sub create_input {
372 372 # it's a thesaurus / authority field
373 373 }
374 374 elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
375   - if (C4::Context->preference("BiblioAddsAuthorities")) {
  375 + # when authorities auto-creation is allowed, do not set readonly
  376 + my $is_readonly = !C4::Context->preference("BiblioAddsAuthorities");
376 377 $subfield_data{marc_value} =
377 378 "<input type=\"text\"
378 379 id=\"".$subfield_data{id}."\"
@@ -381,26 +382,12 @@ sub create_input {
381 382 class=\"input_marceditor readonly\"
382 383 tabindex=\"1\"
383 384 size=\"67\"
384   - maxlength=\"".$subfield_data{maxlength}."\"
385   - \/>
  385 + maxlength=\"".$subfield_data{maxlength}."\"".
  386 + ($is_readonly ? "readonly=\"readonly\"" : "").
  387 + "\/>
386 388 <span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\"
387   - onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
388   - ";
389   - } else {
390   - $subfield_data{marc_value} =
391   - "<input type=\"text\"
392   - id=\"".$subfield_data{id}."\"
393   - name=\"".$subfield_data{id}."\"
394   - value=\"$value\"
395   - class=\"input_marceditor readonly\"
396   - tabindex=\"1\"
397   - size=\"67\"
398   - maxlength=\"".$subfield_data{maxlength}."\"
399   - readonly=\"readonly\"
400   - \/><span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\"
401   - onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
  389 + onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."','biblio'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
402 390 ";
403   - }
404 391 # it's a plugin field
405 392 }
406 393 elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) {
5 koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js
@@ -33,7 +33,8 @@ function getTagInputnameFilter(tagsubfieldid){
33 33 return tagsubfield;
34 34 }
35 35
36   -function openAuth(tagsubfieldid,authtype) {
  36 +// if source is "auth", we are editing an authority otherwise it is a biblio
  37 +function openAuth(tagsubfieldid,authtype,source) {
37 38 // let's take the base of tagsubfield information (removing the indexes and the codes
38 39 var element=document.getElementById(tagsubfieldid);
39 40 var tagsubfield=getTagInputnameFilter(tagsubfieldid);
@@ -50,7 +51,7 @@ function openAuth(tagsubfieldid,authtype) {
50 51 }
51 52 }
52 53 }
53   - newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
  54 + newin=window.open("../authorities/auth_finder.pl?source="+source+"&authtypecode="+authtype+"&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
54 55 }
55 56
56 57 function ExpandField(index) {
38 koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
@@ -102,44 +102,6 @@ function Check(){
102 102 }
103 103 }
104 104
105   -
106   -// returns the subfieldcode based upon subfieldid writing
107   -function getSubfieldcode(tagsubfieldid){
108   - // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0
109   - return tagsubfieldid.substr(3+3+4+8-1,1);
110   -}
111   -
112   -// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes)
113   -// returns the filter
114   -function getTagInputnameFilter(tagsubfieldid){
115   - var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));
116   - var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_"));
117   - tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
118   - tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
119   - tagsubfield=tagsubfield+"_."+tagcode;
120   - return tagsubfield;
121   -}
122   -
123   -function openAuth(tagsubfieldid,authtype) {
124   - // let's take the base of tagsubfield information (removing the indexes and the codes
125   - var element=document.getElementById(tagsubfieldid);
126   - var tagsubfield=getTagInputnameFilter(tagsubfieldid);
127   - var elementsubfcode=getSubfieldcode(element.name);
128   - var mainmainstring=element.value;
129   - var mainstring="";
130   - var inputs = element.parentNode.parentNode.getElementsByTagName("input");
131   -
132   - for (var myindex =0; myindex<inputs.length;myindex++){
133   - if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
134   - var subfieldcode=getSubfieldcode(inputs[myindex].name);
135   - if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
136   - mainstring=inputs[myindex].value+" "+mainstring;
137   - }
138   - }
139   - }
140   - newin=window.open("../authorities/auth_finder.pl?source=auth&authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
141   -}
142   -
143 105 function AddField(field,cntrepeatfield) {
144 106 document.forms['f'].op.value = "addfield";
145 107 document.forms['f'].addfield_field.value=field;

0 comments on commit 7cf5e2e

Please sign in to comment.
Something went wrong with that request. Please try again.