X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=virtualshelves%2Fsendshelf.pl;h=98666719719dd3bc4d899806a2daf383787b7f87;hb=5d6c092921919526ade501facb1220f8a108a08f;hp=d902398e618d23eff1a298d2d77e412558420b8f;hpb=9573f444fcd6f56b2c9248d6bc8d52525a62d518;p=koha_fer diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index d902398e61..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,27 +77,33 @@ 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, 'opac' ); + my @items = GetItemsInfo( $biblionumber ); $dat->{MARCNOTES} = $marcnotesarray; $dat->{MARCSUBJCTS} = $marcsubjctsarray; $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() . "====";