X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=virtualshelves%2Fsendshelf.pl;h=98666719719dd3bc4d899806a2daf383787b7f87;hb=5d6c092921919526ade501facb1220f8a108a08f;hp=16ada89abb3b5b2a77fa8c0ecbe68857437eef44;hpb=6be9d2b27dd47c859eb6ab0cfd873b2059206986;p=koha_fer diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index 16ada89abb..9866671971 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -21,7 +21,7 @@ use strict; use warnings; use CGI; -use Encode qw(encode); +use Encode qw(decode encode); use Carp; use Mail::Sendmail; @@ -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, @@ -110,22 +116,30 @@ if ( $email ) { my $body; # Analysing information and getting mail properties - if ( $template_res =~ /\n(.*)\n/s ) { - $mail{'subject'} = $1; + if ( $template_res =~ /(.*)/s ) { + $mail{subject} = $1; + $mail{subject} =~ s|\n?(.*)\n?|$1|; } else { $mail{'subject'} = "no subject"; } my $email_header = ""; - if ( $template_res =~ /
\n(.*)\n/s ) { + if ( $template_res =~ /
(.*)/s ) { $email_header = $1; + $email_header =~ s|\n?(.*)\n?|$1|; + $email_header = encode_qp($email_header); } - my $email_file = "basket.txt"; - if ( $template_res =~ /\n(.*)\n/s ) { + my $email_file = "list.txt"; + if ( $template_res =~ /(.*)/s ) { $email_file = $1; + $email_file =~ s|\n?(.*)\n?|$1|; } - if ( $template_res =~ /\n(.*)\n/s ) { $body = encode_qp($1); } + if ( $template_res =~ /(.*)/s ) { + $body = $1; + $body =~ s|\n?(.*)\n?|$1|; + $body = encode_qp($body); + } my $boundary = "====" . time() . "====";