[Koha-patches] [PATCH] Fix for Bug 4885 - Only 1 ISBN shows in non-XSL detail view
Chris Nighswonger
cnighswonger at foundations.edu
Fri Jan 14 14:57:53 CET 2011
This patch does not apply clean to 3.2.x. Please fixup and resubmit w/
[3.2.x] in the subject line.
cnighs at li24-93:~/koha.3.2.test (3.2.x *+)$ git status
# On branch 3.2.x
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: catalogue/detail.pl
# modified: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
# modified: koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
# modified: opac/opac-detail.pl
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: C4/Biblio.pm
On Thu, Jan 13, 2011 at 4:31 PM, Katrin Fischer
<Katrin.Fischer.83 at web.de> wrote:
> From: Owen Leonard <oleonard at myacpl.org>
>
> Fixed by doing a pretty dumb copy of GetMarcNotes. Functional,
> but it could be there is a more efficient way to do it given
> we want one repeating tag rather than a range of tags?
>
> Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
> - fixed small typo in opac-detail
> - corrected isbd punctuation in opac-detail
> - tested with 0, 1, 2, 3 isbns in 020, MARC21
> ---
> C4/Biblio.pm | 41 ++++++++++++++++++++
> catalogue/detail.pl | 2 +
> .../prog/en/modules/catalogue/detail.tmpl | 8 +++-
> .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 8 +++-
> opac/opac-detail.pl | 2 +
> 5 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/C4/Biblio.pm b/C4/Biblio.pm
> index 879dd0a..232ffb3 100644
> --- a/C4/Biblio.pm
> +++ b/C4/Biblio.pm
> @@ -69,6 +69,7 @@ BEGIN {
>
> &GetMarcControlnumber
> &GetMarcNotes
> + &GetMarcISBN
> &GetMarcSubjects
> &GetMarcBiblio
> &GetMarcAuthors
> @@ -1277,6 +1278,46 @@ sub GetMarcControlnumber {
> return $controlnumber;
> }
>
> +=head2 GetMarcISBN
> +
> + $marcisbnsarray = GetMarcISBN( $record, $marcflavour );
> +
> +Get all ISBNs from the MARC record and returns them in an array.
> +ISBNs stored in differents places depending on MARC flavour
> +
> +=cut
> +
> +sub GetMarcISBN {
> + my ( $record, $marcflavour ) = @_;
> + my $scope;
> + if ( $marcflavour eq "MARC21" ) {
> + $scope = '020';
> + } else { # assume unimarc if not marc21
> + $scope = '010';
> + }
> + my @marcisbns;
> + my $isbn = "";
> + my $tag = "";
> + my $marcisbn;
> + foreach my $field ( $record->field($scope) ) {
> + my $value = $field->as_string();
> + if ( $isbn ne "" ) {
> + $marcisbn = { marcisbn => $isbn, };
> + push @marcisbns, $marcisbn;
> + $isbn = $value;
> + }
> + if ( $isbn ne $value ) {
> + $isbn = $isbn . " " . $value;
> + }
> + }
> +
> + if ($isbn) {
> + $marcisbn = { marcisbn => $isbn };
> + push @marcisbns, $marcisbn; #load last tag into array
> + }
> + return \@marcisbns;
> +} # end GetMarcISBN
> +
> =head2 GetMarcNotes
>
> $marcnotesarray = GetMarcNotes( $record, $marcflavour );
> diff --git a/catalogue/detail.pl b/catalogue/detail.pl
> index e32170c..6ee79e6 100755
> --- a/catalogue/detail.pl
> +++ b/catalogue/detail.pl
> @@ -87,6 +87,7 @@ unless (defined($record)) {
> }
>
> my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
> +my $marcisbnsarray = GetMarcISBN( $record, $marcflavour );
> my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
> my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
> my $marcseriesarray = GetMarcSeries($record,$marcflavour);
> @@ -212,6 +213,7 @@ $template->param(
> MARCAUTHORS => $marcauthorsarray,
> MARCSERIES => $marcseriesarray,
> MARCURLS => $marcurlsarray,
> + MARCISBNS => $marcisbnsarray,
> subtitle => $subtitle,
> itemdata_ccode => $itemfields{ccode},
> itemdata_enumchron => $itemfields{enumchron},
> 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 d64227a..6d878b3 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
> @@ -148,8 +148,12 @@ function verify_images() {
>
> <div class="yui-u" style="margin-top: 1em;">
> <ul>
> - <!-- TMPL_IF name="normalized_isbn" -->
> - <li><strong>ISBN:</strong> <!-- TMPL_VAR NAME="normalized_isbn" --></li>
> + <!-- TMPL_IF NAME="MARCISBNS" -->
> + <li><strong>ISBN:</strong><ul><!-- TMPL_LOOP NAME="MARCISBNS" --><li><!-- TMPL_VAR NAME="marcisbn" --></li><!-- /TMPL_LOOP --></ul></li>
> + <!-- TMPL_ELSE -->
> + <!-- TMPL_IF name="normalized_isbn" -->
> + <li><strong>ISBN:</strong> <!-- TMPL_VAR NAME="normalized_isbn" --></li>
> + <!-- /TMPL_IF -->
> <!-- /TMPL_IF -->
> <!-- TMPL_IF name="issn" -->
> <li><strong>ISSN:</strong><!-- TMPL_VAR NAME="issn" --></li>
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
> index 25f3a37..2af9584 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
> @@ -132,8 +132,12 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
>
> <!-- TMPL_IF NAME="pages" --><span class="results_summary"><span class="label">Physical details:</span> <!-- TMPL_VAR NAME="pages" --> <!-- TMPL_VAR NAME="illus" --> <!-- TMPL_VAR NAME="size" --></span><!-- /TMPL_IF -->
>
> - <!-- TMPL_IF name="normalized_isbn" -->
> - <span class="results_summary"><span class="label">ISBN: </span><!-- TMPL_VAR NAME="normalized_isbn" --></span>
> + <!-- TMPL_IF NAME="MARCISBNS" -->
> + <span class="results_summary"><span class="label">ISBN:</span><!-- TMPL_LOOP NAME="MARCISBNS" --><!-- TMPL_VAR NAME="marcisbn" --><!-- TMPL_IF NAME="__LAST__" -->.<!-- TMPL_ELSE -->; <!-- /TMPL_IF --><!-- /TMPL_LOOP --></span>
> + <!-- TMPL_ELSE -->
> + <!-- TMPL_IF name="normalized_isbn" -->
> + <span class="results_summary"><span class="label">ISBN: </span><!-- TMPL_VAR NAME="normalized_isbn" --></span>
> + <!-- /TMPL_IF -->
> <!-- /TMPL_IF -->
> <!-- TMPL_IF name="issn" -->
> <span class="results_summary"><span class="label">ISSN:</span><!-- TMPL_VAR NAME="issn" --></span>
> diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
> index 309f01d..9110cca 100755
> --- a/opac/opac-detail.pl
> +++ b/opac/opac-detail.pl
> @@ -197,6 +197,7 @@ for my $itm (@items) {
> my $dbh = C4::Context->dbh;
> my $marcflavour = C4::Context->preference("marcflavour");
> my $marcnotesarray = GetMarcNotes ($record,$marcflavour);
> +my $marcisbnsarray = GetMarcISBN ($record,$marcflavour);
> my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
> my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
> my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
> @@ -209,6 +210,7 @@ my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib
> MARCAUTHORS => $marcauthorsarray,
> MARCSERIES => $marcseriesarray,
> MARCURLS => $marcurlsarray,
> + MARCISBNS => $marcisbnsarray,
> norequests => $norequests,
> RequestOnOpac => C4::Context->preference("RequestOnOpac"),
> itemdata_ccode => $itemfields{ccode},
> --
> 1.7.1
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
More information about the Koha-patches
mailing list