[Koha-cvs] koha C4/Biblio.pm catalogue/detail.pl koha-tmpl... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Wed Dec 6 10:14:25 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/12/06 09:14:25

Modified files:
	C4             : Biblio.pm 
	catalogue      : detail.pl 
	koha-tmpl/intranet-tmpl/prog/en/catalogue: detail.tmpl 

Log message:
	Correct the link to the MARC subjects.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.178.2.33&r2=1.178.2.34
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/detail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.11&r2=1.6.2.12
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/detail.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.13&r2=1.2.2.14

Patches:
Index: C4/Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.178.2.33
retrieving revision 1.178.2.34
diff -u -b -r1.178.2.33 -r1.178.2.34
--- C4/Biblio.pm	5 Dec 2006 11:35:29 -0000	1.178.2.33
+++ C4/Biblio.pm	6 Dec 2006 09:14:25 -0000	1.178.2.34
@@ -33,7 +33,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.178.2.33 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.178.2.34 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 @ISA = qw( Exporter );
 
@@ -1537,39 +1537,34 @@
     }
 
     my @marcsubjcts;
-    my $subjct   = "";
-    my $subfield = "";
-    my $marcsubjct;
 
     foreach my $field ( $record->fields ) {
         next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
         my @subfields = $field->subfields();
-        my $counter = 0;
-        my @link_loop;
+        my $link;
+        my $label = "su:";
+        my $flag = 0;
         for my $subject_subfield ( @subfields ) {
+            warn Data::Dumper::Dumper($subject_subfield);
             my $code      = $subject_subfield->[0];
-            my $value     = $subject_subfield->[1];
-            my $linkvalue = $value;
-            $linkvalue    =~ s/(\(|\))//g;
-            my $operator = " and " unless $counter == 0;
-            push @link_loop,
-              {
-                link => $linkvalue,
-                operator => $operator,
-                KohaAuthNumber => ($code == 9)?(1):(0)
-              };
-            my $separator = C4::Context->preference("authoritysep")
-              unless $counter == 0;
+            $label .= $subject_subfield->[1] . " and su-to:" unless ( $code == 9 );
+            if ( $code == 9 ) {
+                $link = "Koha-Auth-Number:".$subject_subfield->[1];
+                $flag = 1;
+            }
+            elsif ( ! $flag ) {
+                $link = $label;
+                $link =~ s/ and\ssu-to:$//;
+            }
+        }
+        $label =~ s/su/ /g;
+        $label =~ s/://g;
+        $label =~ s/-to//g;
+        $label =~ s/and//g;
             push @marcsubjcts,
               {
-                tag            => $field->tag(),
-                code           => $code,
-                value          => $value,
-                link_loop      => \@link_loop,
-                separator      => $separator,
-                KohaAuthNumber => ($code == 9)?(1):(0)
-              };
-            $counter++;
+            label => $label,
+            link  => $link
         }
     }
     return \@marcsubjcts;
@@ -1585,8 +1580,8 @@
     my ( $record, $marcflavour ) = @_;
     my ( $mintag, $maxtag );
     if ( $marcflavour eq "MARC21" ) {
-        $mintag = "";    # FIXME
-        $maxtag = "";    # FIXME
+        $mintag = "100";
+        $maxtag = "111"; 
     }
     else {    # assume unimarc if not marc21
         $mintag = "700";
@@ -3577,8 +3572,11 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.178.2.33 2006/12/05 11:35:29 toins Exp $
+# $Id: Biblio.pm,v 1.178.2.34 2006/12/06 09:14:25 toins Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.178.2.34  2006/12/06 09:14:25  toins
+# Correct the link to the MARC subjects.
+#
 # Revision 1.178.2.33  2006/12/05 11:35:29  toins
 # Biblio.pm cleaned.
 # additionalauthors, bibliosubject, bibliosubtitle tables are now unused.

Index: catalogue/detail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/detail.pl,v
retrieving revision 1.6.2.11
retrieving revision 1.6.2.12
diff -u -b -r1.6.2.11 -r1.6.2.12
--- catalogue/detail.pl	5 Dec 2006 13:38:41 -0000	1.6.2.11
+++ catalogue/detail.pl	6 Dec 2006 09:14:25 -0000	1.6.2.12
@@ -15,7 +15,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: detail.pl,v 1.6.2.11 2006/12/05 13:38:41 tipaul Exp $
+# $Id: detail.pl,v 1.6.2.12 2006/12/06 09:14:25 toins Exp $
 
 use strict;
 require Exporter;
@@ -76,17 +76,13 @@
     my $record           = GetMarcBiblio($biblionumber);
     my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
     my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
-    
     my $marcsubjctsarray         = GetMarcSubjects( $record, $marcflavour );
-#     my @marcsubjctsarray;
-#     foreach ( $subjects ) {
-#         if ( $_->{"code"} eq 'a' ) {
-#             push @marcsubjctsarray , $_;
-#         }
-#     }
-    $template->param( MARCNOTES   => $marcnotesarray,
+
+    $template->param(
+        MARCNOTES   => $marcnotesarray,
     MARCSUBJCTS => $marcsubjctsarray,
-    MARCAUTHORS => $marcauthorsarray );
+        MARCAUTHORS => $marcauthorsarray
+    );
 
 my @results = ( $dat, );
 foreach ( keys %{$dat} ) {
@@ -99,6 +95,6 @@
     biblionumber        => $biblionumber,
     subscriptions => \@subs,
     subscriptionsnumber => $subscriptionsnumber,
-            );
+);
 
 output_html_with_http_headers $query, $cookie, $template->output;

Index: koha-tmpl/intranet-tmpl/prog/en/catalogue/detail.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/detail.tmpl,v
retrieving revision 1.2.2.13
retrieving revision 1.2.2.14
diff -u -b -r1.2.2.13 -r1.2.2.14
--- koha-tmpl/intranet-tmpl/prog/en/catalogue/detail.tmpl	5 Dec 2006 13:38:41 -0000	1.2.2.13
+++ koha-tmpl/intranet-tmpl/prog/en/catalogue/detail.tmpl	6 Dec 2006 09:14:25 -0000	1.2.2.14
@@ -67,8 +67,8 @@
             <p><label><b>Additional Author:</b></label>
                 <!-- TMPL_LOOP NAME="MARCAUTHORS" -->
                 <a href="/cgi-bin/koha/catalogue/search.pl?q=au:<!-- TMPL_VAR NAME="a" -->">
-                    <!-- TMPL_VAR NAME="a" -->&nbsp;
-                </a> --
+                    <!-- TMPL_VAR NAME="a" -->
+                </a>&nbsp;
                 <!-- /TMPL_LOOP -->
             </p>
         <!-- /TMPL_IF -->
@@ -78,8 +78,8 @@
         <!-- TMPL_IF name="publishercode" -->
             <p><label><b>Published by :</b></label>
                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pu:<!-- TMPL_VAR NAME="publishercode"">
-                    <!-- TMPL_VAR NAME="publishercode" -->&nbsp;
-                </a>
+                    <!-- TMPL_VAR NAME="publishercode" -->
+                </a>&nbsp;
             </p>
         <!-- /TMPL_IF -->
         <!-- TMPL_IF name="publicationyear" -->
@@ -107,18 +107,8 @@
             <p><label><b>Subjects: </b></label></p>
             <p>
                 <!-- TMPL_LOOP NAME="MARCSUBJCTS" -->
-                    <!-- TMPL_UNLESS NAME="KohaAuthNumber" -->
-                        <!-- TMPL_IF NAME="link_loop" -->
-                            <a href="/cgi-bin/koha/catalogue/search.pl?q=su:<!-- TMPL_VAR NAME="value" ESCAPE="URL"--><!-- TMPL_LOOP NAME="link_loop" --><!-- TMPL_VAR NAME="operator"--><!-- TMPL_IF NAME="KohaAuthNumber" --> koha-internal-code:<!--TMPL_VAR NAME="link"--><!-- TMPL_ELSE -->su-to:<!--TMPL_VAR NAME="link"--><!-- /TMPL_IF --><!-- /TMPL_LOOP -->">
-                                <!-- TMPL_VAR NAME="value" -->&nbsp;
-                            </a>
-                        <!-- TMPL_ELSE -->
-                            <a href="/cgi-bin/koha/catalogue/search.pl?q=su:<!-- TMPL_VAR NAME="value" ESCAPE="URL"-->">
-                                <!-- TMPL_VAR NAME="value" -->&nbsp;
-                            </a>
-                        <!-- /TMPL_IF -->
-                    <!-- /TMPL_UNLESS -->
-                    &nbsp;<!-- TMPL_VAR NAME="separator" -->&nbsp;
+                    <a href="/cgi-bin/koha/catalogue/search.pl?q=<!-- TMPL_VAR NAME="link" ESCAPE="URL"-->"><!-- TMPL_VAR NAME="label" --></a>
+                    &nbsp;
                 <!-- /TMPL_LOOP -->
             </p>
         <!-- /TMPL_IF -->





More information about the Koha-cvs mailing list