Bug 9978: Replace license header with the correct license (GPLv3+)
[srvgit] / basket / sendbasket.pl
index 36f3c1a..0614aa3 100755 (executable)
@@ -72,7 +72,8 @@ if ( $email_add ) {
         $template2->param( biblionumber => $biblionumber );
 
         my $dat              = GetBiblioData($biblionumber);
-        my $record           = GetMarcBiblio($biblionumber);
+        next unless $dat;
+        my $record           = GetMarcBiblio($biblionumber, 1);
         my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -112,6 +113,7 @@ if ( $email_add ) {
     if ( $template_res =~ /<SUBJECT>(.*)<END_SUBJECT>/s ) {
         $mail{subject} = $1;
         $mail{subject} =~ s|\n?(.*)\n?|$1|;
+        $mail{subject} = Encode::encode("UTF-8", $mail{subject});
     }
     else { $mail{'subject'} = "no subject"; }
 
@@ -119,7 +121,7 @@ if ( $email_add ) {
     if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) {
         $email_header = $1;
         $email_header =~ s|\n?(.*)\n?|$1|;
-        $email_header = encode_qp($email_header);
+        $email_header = encode_qp(Encode::encode("UTF-8", $email_header));
     }
 
     my $email_file = "basket.txt";
@@ -131,7 +133,7 @@ if ( $email_add ) {
     if ( $template_res =~ /<MESSAGE>(.*)<END_MESSAGE>/s ) {
         $body = $1;
         $body =~ s|\n?(.*)\n?|$1|;
-        $body = encode_qp($body);
+        $body = encode_qp(Encode::encode("UTF-8", $body));
     }
 
     my $boundary = "====" . time() . "====";