[Koha-cvs] CVS: koha/opac opac-detail.pl,1.14.2.1,1.14.2.2 opac-ISBDdetail.pl,1.5,1.5.2.1 opac-MARCdetail.pl,1.4,1.4.2.1

Paul POULAIN tipaul at users.sourceforge.net
Thu Feb 3 16:25:31 CET 2005


Update of /cvsroot/koha/koha/opac
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20652/opac

Modified Files:
      Tag: rel_2_2
	opac-detail.pl opac-ISBDdetail.pl opac-MARCdetail.pl 
Log Message:
show text instead of code for itemtypes, authorized values...

Index: opac-detail.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-detail.pl,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -C2 -r1.14.2.1 -r1.14.2.2
*** opac-detail.pl	11 Jan 2005 15:24:14 -0000	1.14.2.1
--- opac-detail.pl	3 Feb 2005 15:25:28 -0000	1.14.2.2
***************
*** 36,40 ****
  $dat->{'additional'}=$addauthor->[0]->{'author'};
  for (my $i = 1; $i < $authorcount; $i++) {
!         $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
  } # for
  
--- 36,40 ----
  $dat->{'additional'}=$addauthor->[0]->{'author'};
  for (my $i = 1; $i < $authorcount; $i++) {
!         $dat->{'additional'} .= " ; " . $addauthor->[$i]->{'author'};
  } # for
  
***************
*** 75,76 ****
--- 75,77 ----
  
  output_html_with_http_headers $query, $cookie, $template->output;
+ 

Index: opac-ISBDdetail.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-ISBDdetail.pl,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -r1.5 -r1.5.2.1
*** opac-ISBDdetail.pl	12 Nov 2004 16:27:33 -0000	1.5
--- opac-ISBDdetail.pl	3 Feb 2005 15:25:28 -0000	1.5.2.1
***************
*** 110,114 ****
  					for my $i (0..$#subf) {
  						my $subfieldcode = $subf[$i][0];
! 						my $subfieldvalue = $subf[$i][1];
  						my $tagsubf = $tag.$subfieldcode;
  						$calculated =~ s/\{(.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue\{$1$tagsubf$2\}$2/g;
--- 110,114 ----
  					for my $i (0..$#subf) {
  						my $subfieldcode = $subf[$i][0];
! 						my $subfieldvalue = get_authorised_value_desc($tag, $subf[$i][0], $subf[$i][1], '', $dbh);
  						my $tagsubf = $tag.$subfieldcode;
  						$calculated =~ s/\{(.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue\{$1$tagsubf$2\}$2/g;
***************
*** 141,142 ****
--- 141,167 ----
  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 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
+    }
+ }

Index: opac-MARCdetail.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-MARCdetail.pl,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -r1.4 -r1.4.2.1
*** opac-MARCdetail.pl	15 Jul 2004 09:43:23 -0000	1.4
--- opac-MARCdetail.pl	3 Feb 2005 15:25:28 -0000	1.4.2.1
***************
*** 112,116 ****
  					$subfield_data{marc_value}="<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
  				} else {
! 					$subfield_data{marc_value}=$subf[$i][1];
  				}
  				$subfield_data{marc_subfield}=$subf[$i][0];
--- 112,116 ----
  					$subfield_data{marc_value}="<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
  				} else {
! 					$subfield_data{marc_value}=get_authorised_value_desc($field->tag(), $subf[$i][0], $subf[$i][1], '', $dbh);
  				}
  				$subfield_data{marc_subfield}=$subf[$i][0];
***************
*** 181,182 ****
--- 181,207 ----
  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 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
+    }
+ }





More information about the Koha-cvs mailing list