[Koha-patches] [PATCH] kohabug 1621 - add subtitle to main results and details pages

Galen Charlton galen.charlton at liblime.com
Tue May 13 19:32:06 CEST 2008


Including the subtitle in search results and OPAC and staff
details templates.  The subtitle is expected to be in the
MARC subfield that is mapped to the (now nonexistant) column
bibliosubtitle.subtitle.

This is a fairly hackish patch that is meant to be minimally
disruptive while allowing subtitles to be displayed for those
not using the experimental XSLT bib display feature.  It
does *not* cover all cases where you have a MARC
record and want to display its subtitle.

UNIMARC notes: at the moment, none of the fr-FR UNIMARC
frameworks appear to be map any subfields to bibliosubtitle.subtitle.
This could be changed, but caveat programmer: the UNIMARC 200$e
is repeatable (meaning that get_koha_field_from_marc will put in ' | '
between multiple subtitles) and one may want to also include the
200$d (parallel title).  A GetMarcSubtitle routine may be in order
if absolutely necessary.

This points to a long-term need to make display of MARC (and later, hopefully,
non-MARC) bib records more flexible - the XSLT feature is one approach;
there may be others.
---
 C4/Search.pm                                       |    1 +
 catalogue/detail.pl                                |    4 +++-
 .../prog/en/modules/catalogue/detail.tmpl          |    2 +-
 opac/opac-detail.pl                                |    2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index 45a4a06..8dcfe4b 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1242,6 +1242,7 @@ sub searchResults {
     for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) {
         my $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] );
         my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, '' );
+        $oldbiblio->{subtitle} = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $marcrecord, '');
         $oldbiblio->{result_number} = $i + 1;
 
         # add imageurl to itemtype if there is one
diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 0eb3304..f753e66 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -57,6 +57,7 @@ my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
 my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
+my $subtitle         = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $record, '');
 
 # Get Branches, Itemtypes and Locations
 my $branches = GetBranches();
@@ -157,7 +158,8 @@ $template->param( norequests => $norequests );
         MARCNOTES   => $marcnotesarray,
         MARCSUBJCTS => $marcsubjctsarray,
         MARCAUTHORS => $marcauthorsarray,
-        MARCSERIES  => $marcseriesarray
+        MARCSERIES  => $marcseriesarray,
+        subtitle    => $subtitle,
     );
 
 my @results = ( $dat, );
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
index 1603b26..3f97394 100755
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
@@ -56,7 +56,7 @@ function verify_images() {
     <!-- TMPL_IF NAME="AmazonContent" --><div class="yui-gb"><!-- TMPL_ELSE --><div class="yui-g"><!-- /TMPL_IF -->
     <div id="catalogue_detail_biblio" class="yui-u first">
         
-    <h3><!-- TMPL_VAR NAME="title" --></h3> 
+    <h3><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></h3> 
             <!-- TMPL_UNLESS NAME="item-level_itypes" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="<!-- TMPL_VAR NAME="description" -->" title="<!-- TMPL_VAR NAME="description" -->"><!-- /TMPL_UNLESS -->
             <!-- TMPL_IF name="volume" --> <!-- TMPL_VAR name="volume" --><!-- /TMPL_IF -->
             <!-- TMPL_IF name="volumedesc" -->, <!-- TMPL_VAR name="volumedesc" --><!-- /TMPL_IF --> <!-- TMPL_IF NAME="number" --> <!-- TMPL_VAR NAME="number" --> <!-- /TMPL_IF -->
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index d881bba..3c72873 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -163,6 +163,7 @@ my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
 my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
 my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
 my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
+my $subtitle         = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $record, '');
 
     $template->param(
                      MARCNOTES               => $marcnotesarray,
@@ -176,6 +177,7 @@ my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
                      itemdata_enumchron      => $itemfields{enumchron},
                      itemdata_copynumber     => $itemfields{copynumber},
                      authorised_value_images => $biblio_authorised_value_images,
+                     subtitle                => $subtitle,
     );
 
 foreach ( keys %{$dat} ) {
-- 
1.5.5.rc0.16.g02b00




More information about the Koha-patches mailing list