koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha catalogue/ISBDdetail.pl catalogue/MARCdeta... [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha catalogue/ISBDdetail.pl catalogue/MARCdeta... [rel_3_0]
Date: Fri, 12 Jan 2007 18:05:44 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        07/01/12 18:05:44

Modified files:
        catalogue      : ISBDdetail.pl MARCdetail.pl detail.pl 
        koha-tmpl/intranet-tmpl/prog/en/catalogue: MARCdetail.tmpl 
        koha-tmpl/intranet-tmpl/prog/en/includes: action-catalogue.inc 

Log message:
        fix a little pb when the biblio is a subscription.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/ISBDdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.5&r2=1.2.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/MARCdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.7&r2=1.5.2.8
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/detail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.12&r2=1.6.2.13
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.14&r2=1.3.2.15
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=1.1.2.3

Patches:
Index: catalogue/ISBDdetail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/ISBDdetail.pl,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -u -b -r1.2.2.5 -r1.2.2.6
--- catalogue/ISBDdetail.pl     12 Jan 2007 14:14:14 -0000      1.2.2.5
+++ catalogue/ISBDdetail.pl     12 Jan 2007 18:05:43 -0000      1.2.2.6
@@ -34,7 +34,6 @@
 
 =cut
 
-
 use strict;
 require Exporter;
 use C4::Auth;
@@ -45,107 +44,149 @@
 use C4::Koha;
 use C4::Biblio;
 use C4::Branch; # GetBranchDetail
+use C4::Serials;    # CountSubscriptionFromBiblionumber
+
+
+#---- Internal function
+
+sub get_authorised_value_desc ($$$$$$$) {
+    my ( $itemtype, $tagslib, $tag, $subfield, $value, $framework, $dbh ) = @_;
+
+    #---- branch
+    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
+        return GetBranchDetail($value)->{branchname};
+    }
 
-my $query=new CGI;
+    #---- itemtypes
+    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
+        my $itemtypedef = getitemtypeinfo($itemtype);
+        return $itemtypedef->{description};
+    }
 
-my $dbh=C4::Context->dbh;
+    #---- "true" authorized value
+    my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
 
-my $biblionumber=$query->param('biblionumber');
+    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
+    }
+}
+# ------
+
+
+my $query = new CGI;
+my $dbh = C4::Context->dbh;
+
+my $biblionumber = $query->param('biblionumber');
 my $itemtype = &MARCfind_frameworkcode($biblionumber);
-my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
+my $tagslib      = &MARCgettagslib( $dbh, 1, $itemtype );
+
+my $record = GetMarcBiblio($biblionumber);
 
-my $record = GetMarcBiblio( $biblionumber );
 # open template
-my ($template, $loggedinuser, $cookie)
-        = get_template_and_user({template_name => "catalogue/ISBDdetail.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name => "catalogue/ISBDdetail.tmpl",
                  query => $query,
                  type => "intranet",
                  debug => 1,
-                 });
+    }
+);
 
 my $ISBD = C4::Context->preference('ISBD');
+
 # my @blocs = split /\@/,$ISBD;
 # my @fields = $record->fields();
 my $res;
+
 # foreach my $bloc (@blocs) {
 #     $bloc =~ s/\n//g;
-    my $bloc = $ISBD;
-    my $blocres;
-    foreach my $isbdfield (split /#/,$bloc) {
-#         $isbdfield= /(.?.?.?)/;
+my $bloc = $ISBD;
+my $blocres;
+foreach my $isbdfield ( split /#/, $bloc ) {
+
+    #         $isbdfield= /(.?.?.?)/;
         $isbdfield =~ /(\d\d\d)\|(.*)\|(.*)\|(.*)/;
-        my $fieldvalue=$1;
-        my $textbefore=$2;
-        my $analysestring=$3;
-        my $textafter=$4;
-#         warn "==> $1 / $2 / $3 / $4";
-#         my $fieldvalue=substr($isbdfield,0,3);
-        if ($fieldvalue>0) {
+    my $fieldvalue    = $1;
+    my $textbefore    = $2;
+    my $analysestring = $3;
+    my $textafter     = $4;
+
+    #         warn "==> $1 / $2 / $3 / $4";
+    #         my $fieldvalue=substr($isbdfield,0,3);
+    if ( $fieldvalue > 0 ) {
+
     #         warn "ERROR IN ISBD DEFINITION at : $isbdfield" unless 
$fieldvalue;
-#             warn "FV : $fieldvalue";
-            my $hasputtextbefore=0;
-            foreach my $field ($record->field($fieldvalue)) {
+   #             warn "FV : $fieldvalue";
+        my $hasputtextbefore = 0;
+        foreach my $field ( $record->field($fieldvalue) ) {
                 my $calculated = $analysestring;
                 my $tag = $field->tag();
-                if ($tag<10) {
-                } else {
+            if ( $tag < 10 ) {
+            }
+            else {
                     my @subf = $field->subfields;
-                    for my $i (0..$#subf) {
+                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;
+                    my $subfieldvalue =
+                      get_authorised_value_desc( $itemtype,$tagslib, $tag, 
$subf[$i][0],
+                        $subf[$i][1], '', $dbh );
+                    my $tagsubf = $tag . $subfieldcode;
+                    $calculated =~
+s/\{(.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue\{$1$tagsubf$2\}$2/g;
                     }
+
                     # field builded, store the result
-                    if ($calculated && !$hasputtextbefore) { # put textbefore 
if not done
-                        $blocres .=$textbefore;
-                        $hasputtextbefore=1
+                if ( $calculated && !$hasputtextbefore )
+                {    # put textbefore if not done
+                    $blocres .= $textbefore;
+                    $hasputtextbefore = 1;
                     }
+
                     # remove punctuation at start
                     $calculated =~ s/^( |;|:|\.|-)*//g;
-                    $blocres.=$calculated;
+                $blocres .= $calculated;
                 }
             }
-            $blocres .=$textafter if $hasputtextbefore;
-        } else {
-            $blocres.=$isbdfield;
+        $blocres .= $textafter if $hasputtextbefore;
         }
+    else {
+        $blocres .= $isbdfield;
     }
-    $res.=$blocres;
+}
+$res .= $blocres;
+
 # }
 $res =~ s/\{(.*?)\}//g;
 $res =~ s/\\n/\n/g;
 $res =~ s/\n/<br\/>/g;
+
 # remove empty ()
 $res =~ s/\(\)//g;
-$template->param(ISBD => $res,
-                biblionumber => $biblionumber);
-
-output_html_with_http_headers $query, $cookie, $template->output;
 
-sub get_authorised_value_desc ($$$$$) {
-   my($tag, $subfield, $value, $framework, $dbh) = @_;
+my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
 
-   #---- branch
-    if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
-       return GetBranchDetail($value)->{branchname};
-    }
+if ($subscriptionsnumber) {
+    my $subscriptions     = GetSubscriptionsFromBiblionumber($biblionumber);
+    my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'};
+    $template->param(
+        subscriptionsnumber => $subscriptionsnumber,
+        subscriptiontitle   => $subscriptiontitle,
+    );
+}
 
-   #---- itemtypes
-   if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
-           my $itemtypedef = getitemtypeinfo($itemtype);
-       return $itemtypedef->{description};
-    }
+$template->param (
+    ISBD                => $res,
+    biblionumber        => $biblionumber,
+);
 
-   #---- "true" authorized value
-   my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
+output_html_with_http_headers $query, $cookie, $template->output;
 
-   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: catalogue/MARCdetail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/MARCdetail.pl,v
retrieving revision 1.5.2.7
retrieving revision 1.5.2.8
diff -u -b -r1.5.2.7 -r1.5.2.8
--- catalogue/MARCdetail.pl     14 Dec 2006 15:41:54 -0000      1.5.2.7
+++ catalogue/MARCdetail.pl     12 Jan 2007 18:05:43 -0000      1.5.2.8
@@ -43,7 +43,6 @@
 
 =cut
 
-
 use strict;
 require Exporter;
 use C4::Auth;
@@ -55,225 +54,301 @@
 use MARC::Record;
 use C4::Biblio;
 use C4::Acquisition;
-use C4::Serials; #uses getsubscriptionsfrombiblionumber
+use C4::Serials;    #uses getsubscriptionsfrombiblionumber 
GetSubscriptionsFromBiblionumber
+
+#---- Internal function ---
+sub get_authorised_value_desc ($$$$$$) {
+    my ( $tagslib, $tag, $subfield, $value, $framework, $dbh ) = @_;
 
-my $query=new CGI;
+    #---- branch
+    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
+
+        #       return GetBranchDetail($value)->{branchname};
+    }
+
+    #---- itemtypes
+    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
+
+        #          my $itemtypedef = getitemtypeinfo($itemtype);
+        #      return $itemtypedef->{description};
+    }
+
+    #---- "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
+    }
+}
 
-my $dbh=C4::Context->dbh;
+#---------
 
-my $biblionumber=$query->param('biblionumber');
+my $query        = new CGI;
+my $dbh          = C4::Context->dbh;
+my $biblionumber = $query->param('biblionumber');
 my $itemtype = $query->param('frameworkcode');
-my $popup = $query->param('popup'); # if set to 1, then don't insert links, 
it's just to show the biblio
+my $popup        =
+  $query->param('popup')
+  ;    # if set to 1, then don't insert links, it's just to show the biblio
+my $subscriptionid = $query->param('subscriptionid');
 
-my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
+my $tagslib = &MARCgettagslib( $dbh, 1, $itemtype );
 
 my $record = GetMarcBiblio($biblionumber);
+
 # open template
-my ($template, $loggedinuser, $cookie)
-        = get_template_and_user({template_name => "catalogue/MARCdetail.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "catalogue/MARCdetail.tmpl",
                  query => $query,
                  type => "intranet",
                  authnotrequired => 0,
-                 flagsrequired => {catalogue => 1},
+        flagsrequired   => { catalogue => 1 },
                  debug => 1,
-                 });
+    }
+);
 
 #Getting the list of all frameworks
-my $queryfwk =$dbh->prepare("select frameworktext, frameworkcode from 
biblio_framework");
+my $queryfwk =
+  $dbh->prepare("select frameworktext, frameworkcode from biblio_framework");
 $queryfwk->execute;
 my %select_fwk;
 my @select_fwk;
 my $curfwk;
-push @select_fwk,"Default";
+push @select_fwk, "Default";
 $select_fwk{"Default"} = "Default";
-while (my ($description, $fwk) =$queryfwk->fetchrow) {
+
+while ( my ( $description, $fwk ) = $queryfwk->fetchrow ) {
     push @select_fwk, $fwk;
     $select_fwk{$fwk} = $description;
 }
-$curfwk=$itemtype;
-my $framework=CGI::scrolling_list( -name     => 'Frameworks',
+$curfwk = $itemtype;
+my $framework = CGI::scrolling_list(
+    -name     => 'Frameworks',
             -id => 'Frameworks',
             -default => $curfwk,
             -OnChange => 'Changefwk(this);',
             -values   => address@hidden,
             -labels   => \%select_fwk,
             -size     => 1,
-            -multiple => 0 );
+    -multiple => 0
+);
+
+$template->param( framework => $framework );
 
-$template->param( framework => $framework);
 # fill arrays
-my @loop_data =();
+my @loop_data = ();
 my $tag;
+
 # loop through each tab 0 through 9
-for (my $tabloop = 0; $tabloop<=10;$tabloop++) {
-# loop through each tag
+for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) {
+
+    # loop through each tag
     my @fields = $record->fields();
-    my @loop_data =();
+    my @loop_data = ();
     my @subfields_data;
+
     # deal with leader
-    unless ($tagslib->{'000'}->{'@'}->{tab}  ne $tabloop) { #  or 
($tagslib->{'000'}->{'@'}->{hidden}==(-7|-4|-3|-2|2|3|5|8))) {
+    unless ( $tagslib->{'000'}->{'@'}->{tab} ne $tabloop )
+    {    #  or ($tagslib->{'000'}->{'@'}->{hidden}==(-7|-4|-3|-2|2|3|5|8))) {
         my %subfield_data;
-        $subfield_data{marc_lib}=$tagslib->{'000'}->{'@'}->{lib};
-        $subfield_data{marc_value}=$record->leader();
-        $subfield_data{marc_subfield}='@';
-        $subfield_data{marc_tag}='000';
-        push(@subfields_data, \%subfield_data);
+        $subfield_data{marc_lib}      = $tagslib->{'000'}->{'@'}->{lib};
+        $subfield_data{marc_value}    = $record->leader();
+        $subfield_data{marc_subfield} = '@';
+        $subfield_data{marc_tag}      = '000';
+        push( @subfields_data, \%subfield_data );
         my %tag_data;
-            $tag_data{tag}='000 -'. $tagslib->{'000'}->{lib};
+        $tag_data{tag} = '000 -' . $tagslib->{'000'}->{lib};
         my @tmp = @subfields_data;
         $tag_data{subfield} = address@hidden;
-        push (@loop_data, \%tag_data);
+        push( @loop_data, \%tag_data );
         undef @subfields_data;
     }
-    my @fields = $record->fields();
-    for (my $x_i=0;$x_i<=$#fields;$x_i++) {
+    @fields = $record->fields();
+    for ( my $x_i = 0 ; $x_i <= $#fields ; $x_i++ ) {
+
         # if tag <10, there's no subfield, use the "@" trick
-        if ($fields[$x_i]->tag()<10) {
-            next if ($tagslib->{$fields[$x_i]->tag()}->{'@'}->{tab}  ne 
$tabloop);
-            next if ($tagslib->{$fields[$x_i]->tag()}->{'@'}->{hidden});
+        if ( $fields[$x_i]->tag() < 10 ) {
+            next
+              if (
+                $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{tab} ne $tabloop );
+            next if ( $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{hidden} );
             my %subfield_data;
-            
$subfield_data{marc_lib}=$tagslib->{$fields[$x_i]->tag()}->{'@'}->{lib};
-            $subfield_data{marc_value}=$fields[$x_i]->data();
-            $subfield_data{marc_subfield}='@';
-            $subfield_data{marc_tag}=$fields[$x_i]->tag();
-            push(@subfields_data, \%subfield_data);
-        } else {
-            my @subf=$fields[$x_i]->subfields;
+            $subfield_data{marc_lib} =
+              $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{lib};
+            $subfield_data{marc_value}    = $fields[$x_i]->data();
+            $subfield_data{marc_subfield} = '@';
+            $subfield_data{marc_tag}      = $fields[$x_i]->tag();
+            push( @subfields_data, \%subfield_data );
+        }
+        else {
+            my @subf = $fields[$x_i]->subfields;
+
     # loop through each subfield
-            for my $i (0..$#subf) {
+            for my $i ( 0 .. $#subf ) {
                 $subf[$i][0] = "@" unless $subf[$i][0];
-                next if 
($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{tab}  ne $tabloop);
-                next if 
($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{hidden});
+                next
+                  if (
+                    $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{tab}
+                    ne $tabloop );
+                next
+                  if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }
+                    ->{hidden} );
                 my %subfield_data;
-                
$subfield_data{short_desc}=substr($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{lib},0,20);
-                
$subfield_data{long_desc}=$tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{lib};
-                
$subfield_data{link}=$tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{link};
+                $subfield_data{short_desc} = substr(
+                    $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] 
}->{lib},
+                    0, 20
+                );
+                $subfield_data{long_desc} =
+                  $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{lib};
+                $subfield_data{link} =
+                  $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{link};
+
 #                 warn "tag : ".$tagslib->{$fields[$x_i]->tag()}." subfield 
:".$tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}."lien koha? : 
"$subfield_data{link};
-                if ($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{isurl}) 
{
-                    $subfield_data{marc_value}="<a 
href=\"$subf[$i][1]\">$subf[$i][1]</a>";
-                } elsif 
($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{kohafield} eq 
"biblioitems.isbn") {
+                if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }
+                    ->{isurl} )
+                {
+                    $subfield_data{marc_value} =
+                      "<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
+                }
+                elsif ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }
+                    ->{kohafield} eq "biblioitems.isbn" )
+                {
+
 #                    warn " tag : ".$tagslib->{$fields[$x_i]->tag()}." 
subfield :".$tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}. "ISBN : 
".$subf[$i][1]."PosttraitementISBN :".DisplayISBN($subf[$i][1]);
-                    $subfield_data{marc_value}=DisplayISBN($subf[$i][1]);
-                } else {
-                    if 
($tagslib->{$fields[$x_i]->tag()}->{$subf[$i][0]}->{authtypecode}) {
-                        $subfield_data{authority}=$fields[$x_i]->subfield(9);
+                    $subfield_data{marc_value} = DisplayISBN( $subf[$i][1] );
                     }
-                    
$subfield_data{marc_value}=get_authorised_value_desc($fields[$x_i]->tag(), 
$subf[$i][0], $subf[$i][1], '', $dbh);
+                else {
+                    if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }
+                        ->{authtypecode} )
+                    {
+                        $subfield_data{authority} = $fields[$x_i]->subfield(9);
                 }
-                $subfield_data{marc_subfield}=$subf[$i][0];
-                $subfield_data{marc_tag}=$fields[$x_i]->tag();
-                push(@subfields_data, \%subfield_data);
+                    $subfield_data{marc_value} =
+                      get_authorised_value_desc( $tagslib, 
$fields[$x_i]->tag(),
+                        $subf[$i][0], $subf[$i][1], '', $dbh );
             }
+                $subfield_data{marc_subfield} = $subf[$i][0];
+                $subfield_data{marc_tag}      = $fields[$x_i]->tag();
+                push( @subfields_data, \%subfield_data );
         }
-        if ($#subfields_data==0) {
-            $subfields_data[0]->{marc_lib}='';
-            $subfields_data[0]->{marc_subfield}='';
         }
-        if ($#subfields_data>=0) {
+        if ( $#subfields_data == 0 ) {
+            $subfields_data[0]->{marc_lib}      = '';
+            $subfields_data[0]->{marc_subfield} = '';
+        }
+        if ( $#subfields_data >= 0 ) {
             my %tag_data;
-            if ($fields[$x_i]->tag() eq $fields[$x_i-1]->tag()) {
-                $tag_data{tag}="";
-            } else {
-                if (C4::Context->preference('hide_marc')) {
-                    $tag_data{tag}=$tagslib->{$fields[$x_i]->tag()}->{lib};
-                } else {
-                $tag_data{tag}=$fields[$x_i]->tag().' -'. 
$tagslib->{$fields[$x_i]->tag()}->{lib};
+            if ( $fields[$x_i]->tag() eq $fields[ $x_i - 1 ]->tag() ) {
+                $tag_data{tag} = "";
+            }
+            else {
+                if ( C4::Context->preference('hide_marc') ) {
+                    $tag_data{tag} = $tagslib->{ $fields[$x_i]->tag() }->{lib};
+                }
+                else {
+                    $tag_data{tag} =
+                        $fields[$x_i]->tag() . ' -'
+                      . $tagslib->{ $fields[$x_i]->tag() }->{lib};
                 }
             }
             my @tmp = @subfields_data;
             $tag_data{subfield} = address@hidden;
-            push (@loop_data, \%tag_data);
+            push( @loop_data, \%tag_data );
             undef @subfields_data;
         }
     }
-    $template->param($tabloop."XX" =>address@hidden);
+    $template->param( $tabloop . "XX" => address@hidden );
 }
+
 # now, build item tab !
 # the main difference is that datas are in lines and not in columns : thus, we 
build the <th> first, then the values...
 # loop through each tag
 # warning : we may have differents number of columns in each row. Thus, we 
first build a hash, complete it if necessary
 # then construct template.
 my @fields = $record->fields();
-my %witness; #---- stores the list of subfields used at least once, with the 
"meaning" of the code
+my %witness
+  ; #---- stores the list of subfields used at least once, with the "meaning" 
of the code
 my @big_array;
 foreach my $field (@fields) {
-    next if ($field->tag()<10);
-    my @subf=$field->subfields;
+    next if ( $field->tag() < 10 );
+    my @subf = $field->subfields;
     my %this_row;
-# loop through each subfield
-    for my $i (0..$#subf) {
-        next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  ne 10);
-        next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden});
-        $witness{$subf[$i][0]} = 
$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
-        $this_row{$subf[$i][0]} =$subf[$i][1];
+
+    # loop through each subfield
+    for my $i ( 0 .. $#subf ) {
+        next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{tab} ne 10 );
+        next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{hidden} );
+        $witness{ $subf[$i][0] } =
+          $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib};
+        $this_row{ $subf[$i][0] } = $subf[$i][1];
     }
     if (%this_row) {
-        push(@big_array, \%this_row);
+        push( @big_array, \%this_row );
     }
 }
-my ($holdingbrtagf,$holdingbrtagsubf) = 
&MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$itemtype);
address@hidden = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} 
@big_array;
+my ( $holdingbrtagf, $holdingbrtagsubf ) =
+  &MARCfind_marc_from_kohafield( $dbh, "items.holdingbranch", $itemtype );
address@hidden =
+  sort { $a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf} } @big_array;
 
 #fill big_row with missing datas
-foreach my $subfield_code  (keys(%witness)) {
-    for (my $i=0;$i<=$#big_array;$i++) {
-        $big_array[$i]{$subfield_code}="&nbsp;" unless 
($big_array[$i]{$subfield_code});
+foreach my $subfield_code ( keys(%witness) ) {
+    for ( my $i = 0 ; $i <= $#big_array ; $i++ ) {
+        $big_array[$i]{$subfield_code} = "&nbsp;"
+          unless ( $big_array[$i]{$subfield_code} );
     }
 }
+
 # now, construct template !
 my @item_value_loop;
 my @header_value_loop;
-for (my $i=0;$i<=$#big_array; $i++) {
+for ( my $i = 0 ; $i <= $#big_array ; $i++ ) {
     my $items_data;
-    foreach my $subfield_code (keys(%witness)) {
-        $items_data .="<td>".$big_array[$i]{$subfield_code}."</td>";
+    foreach my $subfield_code ( keys(%witness) ) {
+        $items_data .= "<td>" . $big_array[$i]{$subfield_code} . "</td>";
     }
     my %row_data;
     $row_data{item_value} = $items_data;
-    push(@item_value_loop,\%row_data);
+    push( @item_value_loop, \%row_data );
 }
-foreach my $subfield_code (keys(%witness)) {
+foreach my $subfield_code ( keys(%witness) ) {
     my %header_value;
     $header_value{header_value} = $witness{$subfield_code};
-    push(@header_value_loop, \%header_value);
+    push( @header_value_loop, \%header_value );
 }
 
 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
-$template->param(item_loop => address@hidden,
+
+if ($subscriptionsnumber) {
+    my $subscriptions = GetSubscriptionsFromBiblionumber($biblionumber);
+    my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'};
+    $template->param(
+        subscriptiontitle   => $subscriptiontitle,
+        subscriptionsnumber => $subscriptionsnumber,
+    );
+}
+
+$template->param (
+    item_loop               => address@hidden,
                         item_header_loop => address@hidden,
                         biblionumber => $biblionumber,
-                        subscriptionsnumber => $subscriptionsnumber,
                         popup => $popup,
                         hide_marc => C4::Context->preference('hide_marc'),
-                        intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
+    intranetcolorstylesheet =>
+      C4::Context->preference("intranetcolorstylesheet"),
         intranetstylesheet => C4::Context->preference("intranetstylesheet"),
         IntranetNav => C4::Context->preference("IntranetNav"),
-                        );
-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" ) {
- #          my $itemtypedef = getitemtypeinfo($itemtype);
- #      return $itemtypedef->{description};
-    }
-
-   #---- "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;

Index: catalogue/detail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/detail.pl,v
retrieving revision 1.6.2.12
retrieving revision 1.6.2.13
diff -u -b -r1.6.2.12 -r1.6.2.13
--- catalogue/detail.pl 6 Dec 2006 09:14:25 -0000       1.6.2.12
+++ catalogue/detail.pl 12 Jan 2007 18:05:43 -0000      1.6.2.13
@@ -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.12 2006/12/06 09:14:25 toins Exp $
+# $Id: detail.pl,v 1.6.2.13 2007/01/12 18:05:43 toins Exp $
 
 use strict;
 require Exporter;
@@ -44,8 +44,8 @@
 my $dat = &GetBiblioData($biblionumber);
 #coping with subscriptions
 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
-my @subscriptions       =
-  GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
+my @subscriptions       = GetSubscriptions( $dat->{title}, $dat->{issn}, 
$biblionumber );
+
 my @subs;
 foreach my $subscription (@subscriptions) {
     my %cell;
@@ -91,10 +91,10 @@
 
 $template->param(
     ITEM_RESULTS        => address@hidden,
-    subscriptionsnumber => $subscriptionsnumber,
     biblionumber        => $biblionumber,
     subscriptions => address@hidden,
     subscriptionsnumber => $subscriptionsnumber,
+    subscriptiontitle   => $dat->{title},
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;

Index: koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl,v
retrieving revision 1.3.2.14
retrieving revision 1.3.2.15
diff -u -b -r1.3.2.14 -r1.3.2.15
--- koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl   11 Jan 2007 
17:09:46 -0000      1.3.2.14
+++ koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl   12 Jan 2007 
18:05:43 -0000      1.3.2.15
@@ -6,7 +6,7 @@
 
 <!-- TMPL_UNLESS name="popup" -->
     <h1>
-        Biblionumber : <!-- TMPL_VAR NAME="biblionumber" -->
+        MARC biblio : <!-- TMPL_VAR NAME="biblionumber" -->
     </h1>
     
 <!-- TMPL_INCLUDE NAME="action-catalogue.inc" -->

Index: koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/includes/Attic/action-catalogue.inc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc       12 Jan 
2007 14:27:44 -0000      1.1.2.2
+++ koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc       12 Jan 
2007 18:05:43 -0000      1.1.2.3
@@ -35,7 +35,7 @@
                     Print
                 </a>
                 <!-- TMPL_IF name="subscriptionsnumber" -->
-                <a 
href="/cgi-bin/koha/serials/serials-home.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" -->">
+                <a 
href="/cgi-bin/koha/serials/serials-home.pl?searched=1&title_filter=<!-- 
TMPL_VAR NAME="subscriptiontitle" -->">
                     Subscription(s)
                 </a>
                 <!-- /TMPL_IF -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]