Bug 8436: QA Follow-up: Activate branch filter, if IndependentBranches is off
[koha.git] / opac / opac-sendshelf.pl
index 61cc979..8512c65 100755 (executable)
@@ -4,18 +4,18 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use strict;
 use warnings;
@@ -43,7 +43,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
         query           => $query,
         type            => "opac",
         authnotrequired => 0,
-        flagsrequired   => { borrow => 1 },
     }
 );
 
@@ -70,7 +69,6 @@ if ( $email ) {
             query           => $query,
             type            => "opac",
             authnotrequired => 1,
-            flagsrequired   => { borrow => 1 },
         }
     );
 
@@ -85,7 +83,7 @@ if ( $email ) {
         my $biblionumber = $biblio->{biblionumber};
         my $fw               = GetFrameworkCode($biblionumber);
         my $dat              = GetBiblioData($biblionumber);
-        my $record           = GetMarcBiblio($biblionumber);
+        my $record           = GetMarcBiblio($biblionumber, 1);
         my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -111,7 +109,6 @@ if ( $email ) {
 
     $template2->param(
         BIBLIO_RESULTS => \@results,
-        email_sender   => $mail{'from'},
         comment        => $comment,
         shelfname      => $shelf[1],
         firstname      => $user->{firstname},
@@ -128,12 +125,13 @@ if ( $email ) {
         $mail{subject} =~ s|\n?(.*)\n?|$1|;
     }
     else { $mail{'subject'} = "no subject"; }
+    $mail{subject} = Encode::encode("UTF-8", $mail{subject});
 
     my $email_header = "";
     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 = "list.txt";
@@ -145,7 +143,7 @@ if ( $email ) {
     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() . "====";