X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-sendbasket.pl;h=76400a50927e5aae0d273cc5e409fc4ab281fd89;hb=206e1b53b68fa910d8c1b0d0d7620f0287a940b7;hp=87e71b6fbed11232a76b5e310468d4cd40014a56;hpb=fc1342f73df868410e0ab670981f25ba2e1acd74;p=koha_fer diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 87e71b6fbe..76400a5092 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -16,15 +16,20 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; -require Exporter; +use warnings; + use CGI; +use Encode qw(encode); + use Mail::Sendmail; use MIME::QuotedPrint; use MIME::Base64; use C4::Biblio; +use C4::Items; use C4::Auth; -use C4::Interface::CGI::Output; +use C4::Output; use C4::Biblio; +use C4::Members; my $query = new CGI; @@ -33,7 +38,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( template_name => "opac-sendbasketform.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => 0, flagsrequired => { borrow => 1 }, } ); @@ -77,9 +82,16 @@ if ( $email_add ) { my @items = &GetItemsInfo( $biblionumber, 'opac' ); + my $hasauthors = 0; + if($dat->{'author'} || @$marcauthorsarray) { + $hasauthors = 1; + } + + $dat->{MARCNOTES} = $marcnotesarray; $dat->{MARCSUBJCTS} = $marcsubjctsarray; $dat->{MARCAUTHORS} = $marcauthorsarray; + $dat->{HASAUTHORS} = $hasauthors; $dat->{'biblionumber'} = $biblionumber; $dat->{ITEM_RESULTS} = \@items; @@ -89,10 +101,15 @@ if ( $email_add ) { } my $resultsarray = \@results; + + my $user = GetMember(borrowernumber => $borrowernumber); + $template2->param( BIBLIO_RESULTS => $resultsarray, email_sender => $email_sender, - comment => $comment + comment => $comment, + firstname => $user->{firstname}, + surname => $user->{surname}, ); # Getting template result @@ -115,7 +132,7 @@ if ( $email_add ) { $email_file = $1; } - if ( $template_res =~ /\n(.*)\n/s ) { $body = $1; } + if ( $template_res =~ /\n(.*)\n/s ) { $body = encode_qp($1); } my $boundary = "====" . time() . "===="; @@ -128,13 +145,14 @@ if ( $email_add ) { # # Writing mail # $mail{body} = $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; - my $isofile = encode_base64($iso2709); + my $isofile = encode_base64(encode("UTF-8", $iso2709)); $boundary = '--' . $boundary; $mail{body} = <