Bug 10982: fix link to IFLA UNIMARC documentation in Cataloging
authorFrédéric Demians <f.demians@tamil.fr>
Wed, 2 Oct 2013 08:53:30 +0000 (10:53 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 22 Oct 2013 05:23:51 +0000 (05:23 +0000)
In Cataloging, a ? opens a documentation page on IFLA web site. The current
implementation rely on the tag tab to select the appropriate IFLA
documentation web page. It doesn't work when UNIMARC tag are displayed
in a tab which digit is different for tag first digit.

To reproduce the bug:

  - Modify default framework, put all 200 subfields in tab 1
  - Add a new biblio record
  - Click on ? on 200 field
   => Wrong IFLA page is opened

Apply the patch and retry...

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Simple fix. Work as described. No koha-qa errors

Test on UNIMARC install
1) Switched all 2xx tags to tab 1
2) press any 2xx ?, wrong page
3) patch applied
4) links are now correct

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt

index fc6cf23..cbe0a39 100644 (file)
@@ -108,11 +108,11 @@ function PopupZ3950() {
     } 
 }
 
-function PopupMARCFieldDoc(field, blocknumber) {
+function PopupMARCFieldDoc(field) {
     [% IF ( marcflavour == 'MARC21' ) %]
         _MARC21FieldDoc(field);
     [% ELSIF ( marcflavour == 'UNIMARC' ) %]
-        _UNIMARCFieldDoc(field, blocknumber);
+        _UNIMARCFieldDoc(field);
     [% END %]
 }
 
@@ -126,21 +126,24 @@ function _MARC21FieldDoc(field) {
     }
 }
 
-function _UNIMARCFieldDoc(field, blocknumber) {
+function _UNIMARCFieldDoc(field) {
     /* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but
        seems to be the only version available that can be linked to per tag.  More recent
        versions of the UNIMARC standard are available on the IFLA website only as
        PDFs!
     */
-    if(field == 0) {
-        window.open("http://archive.ifla.org/VI/3/p1996-1/uni.htm");
-    } else if (field < 100) {
-        window.open("http://archive.ifla.org/VI/3/p1996-1/uni"+blocknumber+".htm#b" + ("000"+field).slice(-3));
-    } else if (field < 900) {
-        window.open("http://archive.ifla.org/VI/3/p1996-1/uni"+blocknumber+".htm#" + ("000"+field).slice(-3));
+    var url;
+    if (field == 0) {
+        url = "http://archive.ifla.org/VI/3/p1996-1/uni.htm";
     } else {
-        window.open("http://archive.ifla.org/VI/3/p1996-1/uni9.htm");
+        var first = field.substring(0,1);
+        url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#";
+        if (first == 0) url = url + "b";
+        url = first == 9
+              ? "http://archive.ifla.org/VI/3/p1996-1/uni9.htm"
+              : url + field;
     }
+    window.open(url);
 }
 
 /*
@@ -466,7 +469,7 @@ function Changefwk(FwkList) {
                 <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
             [% ELSE %]
                 <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]
-                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;">&nbsp;?</a>[% END %]
+                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]'); return false;">&nbsp;?</a>[% END %]
                 </span>
             [% END %]
                 [% IF ( innerloo.fixedfield ) %]