ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / virtualshelves / sendshelf.pl
index cb46ce2..3c077ef 100755 (executable)
@@ -17,8 +17,7 @@
 # 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;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use Encode qw( encode );
@@ -77,11 +76,12 @@ if ($email) {
     my @results;
 
     while ( my $content = $contents->next ) {
-        my $biblionumber     = $content->biblionumber->biblionumber;
+        my $biblionumber     = $content->biblionumber;
         my $fw               = GetFrameworkCode($biblionumber);
         my $dat              = GetBiblioData($biblionumber);
-        my $record           = GetMarcBiblio($biblionumber, 1);
-        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
+        my $record           = GetMarcBiblio({
+            biblionumber => $biblionumber,
+            embed_items  => 1 });
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
         my $subtitle         = GetRecordValue( 'subtitle', $record, $fw );
@@ -89,7 +89,6 @@ if ($email) {
         my @items = GetItemsInfo($biblionumber);
 
         $dat->{ISBN}           = GetMarcISBN($record, $marcflavour);
-        $dat->{MARCNOTES}      = $marcnotesarray;
         $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
         $dat->{MARCAUTHORS}    = $marcauthorsarray;
         $dat->{'biblionumber'} = $biblionumber;
@@ -114,10 +113,11 @@ if ($email) {
 
     # Analysing information and getting mail properties
     if ( $template_res =~ /<SUBJECT>(.*)<END_SUBJECT>/s ) {
-        $mail{'subject'} = Encode::encode("UTF-8", $1);
+        $mail{subject} = $1;
         $mail{subject} =~ s|\n?(.*)\n?|$1|;
     }
     else { $mail{'subject'} = "no subject"; }
+    $mail{subject} = encode( 'MIME-Header', $mail{subject} );
 
     my $email_header = "";
     if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) {