[Koha-patches] [PATCH] [SIGNED-OFF] Bug 6982 - Don't show MARC tag documentation links for NORMARC

Katrin Fischer Katrin.Fischer.83 at web.de
Mon Oct 17 21:01:54 CEST 2011


From: Magnus Enger <magnus at enger.priv.no>

Links to UNIMARC documentation were being shown when marcflavour =
NORMARC. This patch hides the doc link functionality for NORMARC
by hiding:
1. The checkbox for turning doc links on/off
2. The hyperlinked questionmarks

This patch does not hide e.g. the JavaScript functions related to
the doc link functionality, in order to make it easy to add
doc links for NORMARC in the future (hopefully).

The doc link functionality was passing a variable called MARC21
(based on the contents of the marcflavour syspref) to the
template and testing the value of this to decide if MARC21 or
UNIMARC doc links were to be shown. I have replaced this variable
with he standard/full marcflavour syspref, in order to make it
possible to test for more then two MARC dialects.

To test:
- Set the marcflavour syspref to MARC21, NORMARC and UNIMARC, one
  after the other.
- Check that correct doc links are shown for MARC21 and UNIMARC
  on the cataloguing screen, and that no checkbox and no doc links
  are displayed for NORMARC.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
Works as described - thx for the great test plan!
---
 cataloguing/addbiblio.pl                           |    8 ++------
 .../prog/en/modules/cataloguing/addbiblio.tt       |   13 +++++++------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index ee0662a..1a82989 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -1075,16 +1075,12 @@ elsif ( $op eq "delete" ) {
 }
 
 $template->param( title => $record->title() ) if ( $record ne "-1" );
-if (C4::Context->preference("marcflavour") eq "MARC21"){
-    $template->param(MARC21 => 1);
-}
-
-
 $template->param(
     popup => $mode,
     frameworkcode => $frameworkcode,
     itemtype => $frameworkcode,
-    borrowernumber => $loggedinuser
+    borrowernumber => $loggedinuser, 
+    marcflavour => C4::Context->preference("marcflavour"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
index 8155be1..65feefb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
@@ -78,9 +78,9 @@ function PopupZ3950() {
 }
 
 function PopupMARCFieldDoc(field, blocknumber) {
-    [% IF ( MARC21 ) %]
+    [% IF ( marcflavour == 'MARC21' ) %]
         _MARC21FieldDoc(field);
-    [% ELSE %]
+    [% ELSIF ( marcflavour == 'UNIMARC' ) %]
         _UNIMARCFieldDoc(field, blocknumber);
     [% END %]
 }
@@ -664,10 +664,10 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
         <div id="yui-main">
         <div class="yui-g">
 
-
-
 <h1>[% IF ( biblionumber ) %]Editing <em>[% title |html %]</em> (Record Number [% biblionumber %])</h1>[% ELSE %]Add MARC Record</h1>[% END %]
+[% IF marcflavour != 'NORMARC' %]
 <div><input type="checkbox" name="marcDocsSelect" id="marcDocsSelect" checked="true" /> Show MARC tag documentation links<br/></div>
+[% END %]
 
 [% UNLESS ( number ) %]
     <!-- show duplicate warning on tab 0 only -->
@@ -825,8 +825,9 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
             	[% IF advancedMARCEditor %]
 		<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 %]<a class="marcdocs"
-                 onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;">&nbsp;?</a></span>
+                 <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]
+                 [% IF marcflavour != 'NORMARC' %]<a class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;">&nbsp;?</a>[% END %]
+                 </span>
 		[% END %]
                 [% IF ( innerloo.fixedfield ) %]
 	                <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator1 %]" />
-- 
1.7.5.4



More information about the Koha-patches mailing list