[Koha-cvs] koha C4/Biblio.pm opac/opac-ISBDdetail.pl opac/... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Mon Feb 5 17:50:02 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	07/02/05 16:50:02

Modified files:
	C4             : Biblio.pm 
	opac           : opac-ISBDdetail.pl opac-MARCdetail.pl 

Log message:
	fix a mod_perl bug:
	There was a global var modified into an internal function in {MARC|ISBD}detail.pl.
	Moving this function in Biblio.pm

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.178.2.57&r2=1.178.2.58
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-ISBDdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.16.2.9&r2=1.16.2.10
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-MARCdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.14.2.9&r2=1.14.2.10

Patches:
Index: C4/Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.178.2.57
retrieving revision 1.178.2.58
diff -u -b -r1.178.2.57 -r1.178.2.58
--- C4/Biblio.pm	25 Jan 2007 09:37:58 -0000	1.178.2.57
+++ C4/Biblio.pm	5 Feb 2007 16:50:01 -0000	1.178.2.58
@@ -33,7 +33,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.178.2.57 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.178.2.58 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 @ISA = qw( Exporter );
 
@@ -59,6 +59,7 @@
   &GetItemFromBarcode
   &getitemsbybiblioitem
   &get_itemnumbers_of
+  &GetAuthorisedValueDesc
   &GetXmlBiblio
 );
 
@@ -1455,6 +1456,44 @@
     return $marcxml;
 }
 
+=head2 GetAuthorisedValueDesc
+
+my $subfieldvalue =get_authorised_value_desc(
+    $tag, $subf[$i][0],$subf[$i][1], '', $taglib);
+
+=cut
+
+sub GetAuthorisedValueDesc {
+    my ( $tag, $subfield, $value, $framework, $tagslib ) = @_;
+    my $dbh = C4::Context->dbh;
+    
+    #---- branch
+    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
+        return C4::Branch::GetBranchName($value);
+    }
+
+    #---- itemtypes
+    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
+        return getitemtypeinfo($value);
+    }
+
+    #---- "true" authorized value
+    my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
+
+    if ( $category ne "" ) {
+        my $sth =
+          $dbh->prepare(
+            "select lib from authorised_values where category = ? and authorised_value = ?"
+          );
+        $sth->execute( $category, $value );
+        my $data = $sth->fetchrow_hashref;
+        return $data->{'lib'};
+    }
+    else {
+        return $value;    # if nothing is found return the original value
+    }
+}
+
 =head2 MARCgetitem
 
 Returns MARC::Record of the item passed in parameter.
@@ -3654,8 +3693,13 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.178.2.57 2007/01/25 09:37:58 tipaul Exp $
+# $Id: Biblio.pm,v 1.178.2.58 2007/02/05 16:50:01 toins Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.178.2.58  2007/02/05 16:50:01  toins
+# fix a mod_perl bug:
+# There was a global var modified into an internal function in {MARC|ISBD}detail.pl.
+# Moving this function in Biblio.pm
+#
 # Revision 1.178.2.57  2007/01/25 09:37:58  tipaul
 # removing warn
 #

Index: opac/opac-ISBDdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-ISBDdetail.pl,v
retrieving revision 1.16.2.9
retrieving revision 1.16.2.10
diff -u -b -r1.16.2.9 -r1.16.2.10
--- opac/opac-ISBDdetail.pl	31 Jan 2007 16:28:06 -0000	1.16.2.9
+++ opac/opac-ISBDdetail.pl	5 Feb 2007 16:50:01 -0000	1.16.2.10
@@ -17,21 +17,20 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: opac-ISBDdetail.pl,v 1.16.2.9 2007/01/31 16:28:06 tipaul Exp $
+# $Id: opac-ISBDdetail.pl,v 1.16.2.10 2007/02/05 16:50:01 toins Exp $
 
 =head1 NAME
 
-MARCdetail.pl : script to show a biblio in MARC format
+opac-ISBDdetail.pl : script to show a biblio in ISBD format
 
 
 =head1 DESCRIPTION
 
 This script needs a biblionumber as parameter 
 
-It shows the biblio in a (nice) MARC format depending on MARC
-parameters tables.
+It shows the biblio
 
-The template is in <templates_dir>/catalogue/MARCdetail.tmpl.
+The template is in <templates_dir>/catalogue/ISBDdetail.tmpl.
 this template must be divided into 11 "tabs".
 
 The first 10 tabs present the biblio, the 11th one presents
@@ -56,7 +55,7 @@
 use C4::Review;
 use C4::Serials;    # uses getsubscriptionfrom biblionumber
 use C4::Koha;       # use getitemtypeinfo
-use C4::Branch;     # use GetBranchName
+use C4::Members;    # GetMember
 
 my $query = new CGI;
 
@@ -136,8 +135,8 @@
                 for my $i ( 0 .. $#subf ) {
                     my $subfieldcode  = $subf[$i][0];
                     my $subfieldvalue =
-                      get_authorised_value_desc( $tag, $subf[$i][0],
-                        $subf[$i][1], '', $dbh );
+                      GetAuthorisedValueDesc( $tag, $subf[$i][0],
+                        $subf[$i][1], '', $tagslib );
                     my $tagsubf = $tag . $subfieldcode;
                     $calculated =~
 s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g;
@@ -230,33 +229,3 @@
 }
 
 output_html_with_http_headers $query, $cookie, $template->output;
-
-sub get_authorised_value_desc ($$$$$) {
-    my ( $tag, $subfield, $value, $framework, $dbh ) = @_;
-
-    #---- branch
-    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
-        return GetBranchName($value);
-    }
-
-    #---- itemtypes
-    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
-        return getitemtypeinfo($value);
-    }
-
-    #---- "true" authorized value
-    my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
-
-    if ( $category ne "" ) {
-        my $sth =
-          $dbh->prepare(
-"select lib from authorised_values where category = ? and authorised_value = ?"
-          );
-        $sth->execute( $category, $value );
-        my $data = $sth->fetchrow_hashref;
-        return $data->{'lib'};
-    }
-    else {
-        return $value;    # if nothing is found return the original value
-    }
-}

Index: opac/opac-MARCdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-MARCdetail.pl,v
retrieving revision 1.14.2.9
retrieving revision 1.14.2.10
diff -u -b -r1.14.2.9 -r1.14.2.10
--- opac/opac-MARCdetail.pl	10 Jan 2007 10:52:58 -0000	1.14.2.9
+++ opac/opac-MARCdetail.pl	5 Feb 2007 16:50:01 -0000	1.14.2.10
@@ -161,8 +161,8 @@
                         $subfield_data{authority} = $fields[$x_i]->subfield(9);
                     }
                     $subfield_data{marc_value} =
-                      get_authorised_value_desc( $fields[$x_i]->tag(),
-                        $subf[$i][0], $subf[$i][1], '', $dbh );
+                      GetAuthorisedValueDesc( $fields[$x_i]->tag(),
+                        $subf[$i][0], $subf[$i][1], '', $tagslib );
                 }
                 $subfield_data{marc_subfield} = $subf[$i][0];
                 $subfield_data{marc_tag}      = $fields[$x_i]->tag();
@@ -227,8 +227,8 @@
         }
         else {
             $this_row{ $subf[$i][0] } =
-              get_authorised_value_desc( $field->tag(), $subf[$i][0],
-                $subf[$i][1], '', $dbh );
+              GetAuthorisedValueDesc( $field->tag(), $subf[$i][0],
+                $subf[$i][1], '', $tagslib );
         }
     }
     if (%this_row) {
@@ -276,36 +276,5 @@
     item_header_loop => \@header_value_loop,
     biblionumber     => $biblionumber,
 );
-output_html_with_http_headers $query, $cookie, $template->output;
-
-sub get_authorised_value_desc ($$$$$) {
-    my ( $tag, $subfield, $value, $framework, $dbh ) = @_;
-
-    #---- branch
-    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
-
-        #       return GetBranchDetail($value)->{branchname};
-    }
-
-    #---- itemtypes
-    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
-
-        #       return ItemType($value);
-    }
-
-    #---- "true" authorized value
-    my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
 
-    if ( $category ne "" ) {
-        my $sth =
-          $dbh->prepare(
-"select lib from authorised_values where category = ? and authorised_value = ?"
-          );
-        $sth->execute( $category, $value );
-        my $data = $sth->fetchrow_hashref;
-        return $data->{'lib'};
-    }
-    else {
-        return $value;    # if nothing is found return the original value
-    }
-}
+output_html_with_http_headers $query, $cookie, $template->output;





More information about the Koha-cvs mailing list