Bug 18904: (follow-up) Rebase onto 14769
authorNick Clemens <nick@bywatersolutions.com>
Fri, 6 Apr 2018 12:30:16 +0000 (12:30 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 12 Apr 2018 13:50:37 +0000 (10:50 -0300)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: simplified if-then-else around cur_field.setIndicator[12].

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

authorities/blinddetail-biblio-search.pl
koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt

index 0afeb96..f8ae22b 100755 (executable)
@@ -112,6 +112,8 @@ if ($authid) {
     $template->param( "clear" => 1 );
 }
 
+
+
 $template->param(
     authid          => $authid ? $authid : "",
     index           => $index,
@@ -122,6 +124,8 @@ $template->param(
     indicator2      => $indicator2,
     SUBFIELD_LOOP   => \@subfield_loop,
     tag_number      => $tag_number,
+    rancor          => $index =~ /rancor$/,
 );
 
+
 output_html_with_http_headers $query, $cookie, $template->output;
index ca547ec..df72d10 100644 (file)
@@ -171,7 +171,7 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
             if ( !field ) return;
             if ( authInfo[field.tag] == undefined ) return;
             authtype = authInfo[field.tag].authtypecode;
-            index = 'rancor';
+            index = 'tag_'+field.tag+'_rancor';
             var mainmainstring = '';
             if( field.getSubfields( authInfo[field.tag].subfield ).length != 0 ){
                 mainmainstring += field.getSubfields( authInfo[field.tag].subfield )[0].text;
index f57667c..f1613e8 100644 (file)
             </div>
         </div>
 
-
 [% MACRO jsinclude BLOCK %]
     <script type="text/javascript">
         $(document).ready(function(){
-            [% IF tag_number == 'rancor' %]
+            [% IF rancor %]
             function RancorReplaceField( new_text, ind_1, ind_2 ){
                 var cur_field = opener.opener.jQuery(".CodeMirror")[0].CodeMirror.marceditor.getCurrentField();
                 cur_field.setText(new_text);
-                cur_field.setIndicator1(ind_1);
-                cur_field.setIndicator2(ind_2);
+                [% IF update_ind1 %]cur_field.setIndicator1(ind_1);[% END %]
+                [% IF update_ind2 %]cur_field.setIndicator2(ind_2);[% END %]
                 return true;
             }
                 [% IF ( clear ) %]
@@ -47,7 +46,6 @@
             } catch(e) {
                 return;
             }
-
             var field_start = whichfield.parentNode.parentNode;
 
             // Sets the good number of form fields for the specified subfield
                     i++;
                 });
             }
-
             [% UNLESS ( clear ) %]
                 [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
                     SetSubfieldValues(
                     [% END %]
                     );
                 [% END %]
-            [% END %]
                 var indicators = field_start.getElementsByClassName('indicator flat');
                 [% IF update_ind1 %]
                     indicators[0].value="[% indicator1 %]";