From 946ac9870c4a905342e2b923ecbba3453d9bf2df Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 3 Oct 2011 10:43:35 -0400 Subject: [PATCH] [SIGNED-OFF] Fix for Bug 6957, authors disappearing when emailing lists Content-Type: text/plain; charset="utf-8" Standard author information wasn't even in the template markup, only "additional author." Added standard author and improved output of additional authors (hiding label when empty). Also added subtitle via GetRecordValue (see bug 3550). Also added check for and output of OPACBaseURL in order to make OPAC links in the email clickable. Signed-off-by: Marcel de Rooy --- .../prog/en/modules/virtualshelves/sendshelf.tt | 12 +++++++----- .../opac-tmpl/prog/en/modules/opac-sendshelf.tt | 11 +++++++---- opac/opac-sendshelf.pl | 10 ++++++++-- virtualshelves/sendshelf.pl | 10 ++++++++-- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt index 686d278..52f36c9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt @@ -17,9 +17,11 @@ Reference Manager or ProCite. [% IF ( comment ) %] [% comment %] [% END %] -[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %][% BIBLIO_RESULT.title %][% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %][% IF ( BIBLIO_RESULT.MARCAUTHORS ) %] -Author(s): [% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %][% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %][% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %][% UNLESS ( loop.last ) %]; [% ELSE %] -[% END %][% END %][% END %][% IF ( BIBLIO_RESULT.ISBN ) %] +[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %][% BIBLIO_RESULT.title %][% IF ( BIBLIO_RESULT.subtitle.size ) %] [% FOREACH subtitle IN BIBLIO_RESULT.subtitle %][% subtitle.subfield %][% END %][% END %][% IF ( BIBLIO_RESULT.author ) %] + +by [% BIBLIO_RESULT.author %][% END %] +[% IF ( BIBLIO_RESULT.MARCAUTHORS.size ) %] +Additional author(s): [% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %][% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %] [% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% IF ( BIBLIO_RESULT.ISBN ) %] ISBN: [% BIBLIO_RESULT.ISBN %][% END %] [% IF ( BIBLIO_RESULT.publishercode ) %]Published by: [% BIBLIO_RESULT.publishercode %][% END %][% IF ( BIBLIO_RESULT.publicationyear ) %] in [% END %][% BIBLIO_RESULT.publicationyear %][% IF ( BIBLIO_RESULT.pages ) %], [% END %][% BIBLIO_RESULT.pages %][% IF ( BIBLIO_RESULT.size ) %], [% END %][% BIBLIO_RESULT.size %][% IF ( BIBLIO_RESULT.collection ) %] Collection: [% BIBLIO_RESULT.seriestitle %][% END %][% IF ( BIBLIO_RESULT.subject ) %] @@ -31,9 +33,9 @@ Serial: [% BIBLIO_RESULT.serial %][% END %][% IF ( BIBLIO_RESULT.dewey ) %] Dewey: [% BIBLIO_RESULT.dewey %][% END %][% IF ( BIBLIO_RESULT.classification ) %] Classification: [% BIBLIO_RESULT.classification %][% END %][% IF ( BIBLIO_RESULT.lccn ) %] LCCN: [% BIBLIO_RESULT.lccn %][% END %][% IF ( BIBLIO_RESULT.url ) %] -url : [% BIBLIO_RESULT.url %][% END %] +url : [% BIBLIO_RESULT.url %][% END %][% IF ( OPACBaseurl ) %] In the online catalog: -[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %] + http://[% OPACBaseurl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %][% END %] Items : [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location %] [% IF ( ITEM_RESULT.itemcallnumber ) %]([% ITEM_RESULT.itemcallnumber %])[% END %] [% ITEM_RESULT.barcode %][% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt index 74317df..b329cd4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt @@ -17,8 +17,11 @@ Reference Manager or ProCite. [% IF ( comment ) %] [% comment %] [% END %] -[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %][% BIBLIO_RESULT.title %][% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %][% IF ( BIBLIO_RESULT.MARCAUTHORS ) %] -Author(s): [% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %][% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %][% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %][% UNLESS ( loop.last ) %]; [% ELSE %] +[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %][% BIBLIO_RESULT.title %][% IF ( BIBLIO_RESULT.subtitle.size ) %] [% FOREACH subtitle IN BIBLIO_RESULT.subtitle %][% subtitle.subfield %][% END %][% END %][% IF ( BIBLIO_RESULT.author ) %] + +by [% BIBLIO_RESULT.author %][% END %] +[% IF ( BIBLIO_RESULT.MARCAUTHORS.size ) %] +Additional author(s): [% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %][% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %] [% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %][% UNLESS ( loop.last ) %]; [% ELSE %] [% END %][% END %][% END %][% IF ( BIBLIO_RESULT.ISBN ) %] ISBN: [% BIBLIO_RESULT.ISBN %][% END %] [% IF ( BIBLIO_RESULT.publishercode ) %]Published by: [% BIBLIO_RESULT.publishercode %][% END %][% IF ( BIBLIO_RESULT.publicationyear ) %] in [% END %][% BIBLIO_RESULT.publicationyear %][% IF ( BIBLIO_RESULT.pages ) %], [% END %][% BIBLIO_RESULT.pages %][% IF ( BIBLIO_RESULT.size ) %], [% END %][% BIBLIO_RESULT.size %][% IF ( BIBLIO_RESULT.collection ) %] @@ -31,9 +34,9 @@ Serial: [% BIBLIO_RESULT.serial %][% END %][% IF ( BIBLIO_RESULT.dewey ) %] Dewey: [% BIBLIO_RESULT.dewey %][% END %][% IF ( BIBLIO_RESULT.classification ) %] Classification: [% BIBLIO_RESULT.classification %][% END %][% IF ( BIBLIO_RESULT.lccn ) %] LCCN: [% BIBLIO_RESULT.lccn %][% END %][% IF ( BIBLIO_RESULT.url ) %] -url : [% BIBLIO_RESULT.url %][% END %] +url : [% BIBLIO_RESULT.url %][% END %][% IF ( OPACBaseurl ) %] In the online catalog: -[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %] + http://[% OPACBaseurl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %][% END %] Items : [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location %] [% IF ( ITEM_RESULT.itemcallnumber ) %]([% ITEM_RESULT.itemcallnumber %])[% END %] [% ITEM_RESULT.barcode %][% END %] diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index b571e07..55abd14 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -81,12 +81,13 @@ if ( $email ) { # retrieve biblios from shelf foreach my $biblio (@$items) { my $biblionumber = $biblio->{biblionumber}; - + my $fw = GetFrameworkCode($biblionumber); my $dat = GetBiblioData($biblionumber); my $record = GetMarcBiblio($biblionumber); my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); + my $subtitle = GetRecordValue('subtitle', $record, $fw); my @items = GetItemsInfo( $biblionumber ); @@ -95,13 +96,18 @@ if ( $email ) { $dat->{MARCAUTHORS} = $marcauthorsarray; $dat->{'biblionumber'} = $biblionumber; $dat->{ITEM_RESULTS} = \@items; + $dat->{subtitle} = $subtitle; $iso2709 .= $record->as_usmarc(); push( @results, $dat ); } - my $user = GetMember(borrowernumber => $borrowernumber); + my $user = GetMember(borrowernumber => $borrowernumber); + + if (C4::Context->preference('OPACBaseURL')){ + $template2->param( OPACBaseurl => C4::Context->preference('OPACBaseURL') ); + } $template2->param( BIBLIO_RESULTS => \@results, diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index 16ada89..37ec545 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -77,13 +77,14 @@ if ( $email ) { # retrieve biblios from shelf foreach my $biblio (@$items) { - my $biblionumber = $biblio->{biblionumber}; - + my $biblionumber = $biblio->{biblionumber}; + my $fw = GetFrameworkCode($biblionumber); my $dat = GetBiblioData($biblionumber); my $record = GetMarcBiblio($biblionumber); my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); + my $subtitle = GetRecordValue('subtitle', $record, $fw); my @items = GetItemsInfo( $biblionumber ); @@ -92,12 +93,17 @@ if ( $email ) { $dat->{MARCAUTHORS} = $marcauthorsarray; $dat->{'biblionumber'} = $biblionumber; $dat->{ITEM_RESULTS} = \@items; + $dat->{subtitle} = $subtitle; $iso2709 .= $record->as_usmarc(); push( @results, $dat ); } + if (C4::Context->preference('OPACBaseURL')){ + $template2->param( OPACBaseurl => C4::Context->preference('OPACBaseURL') ); + } + $template2->param( BIBLIO_RESULTS => \@results, email_sender => $email_from, -- 1.6.0.6