my %mail = (
To => $email,
From => $email,
- Subject => "" . $letter->{title},
- Message => "" . $letter->{content},
+ Subject => Encode::encode( "utf8", "" . $letter->{title} ),
+ Message => Encode::encode( "utf8", "" . $letter->{content} ),
'Content-Type' => 'text/plain; charset="utf8"',
);
sendmail(%mail) or carp $Mail::Sendmail::error;
LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
WHERE serial.serialid IN (
- }
- . join( ",", @$externalid ) . ")";
+ };
+ $strsth .= join( ",", @$externalid ) . ")";
my $sthorders = $dbh->prepare($strsth);
$sthorders->execute;
my $dataorders = $sthorders->fetchall_arrayref( {} );
push @email, $databookseller->{contemail} if $databookseller->{contemail};
unless (@email) {
warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
- return;
+ return { error => "no_email" };
}
my $userenv = C4::Context->userenv;
my %mail = (
To => join( ','. @email),
From => $userenv->{emailaddress},
- Subject => "" . $letter->{title},
- Message => "" . $letter->{content},
+ Subject => Encode::encode( "utf8", "" . $letter->{title} ),
+ Message => Encode::encode( "utf8", "" . $letter->{content} ),
'Content-Type' => 'text/plain; charset="utf8"',
);
sendmail(%mail) or carp $Mail::Sendmail::error;
want_librarian => 1,
) or return;
+ return { error => "no_email" } unless $externalid->{'emailaddr'};
my %mail = (
To => $externalid->{'emailaddr'},
From => $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
- Subject => $letter->{'title'},
- Message => $letter->{'content'},
+ Subject => Encode::encode( "utf8", $letter->{'title'} ),
+ Message => Encode::encode( "utf8", $letter->{'content'} ),
'Content-Type' => 'text/plain; charset="utf8"',
);
sendmail(%mail) or carp $Mail::Sendmail::error;
<div id="yui-main">
<div class="yui-b">
+ [% IF error_alert %]
+ [% IF ( error_alert == "no_email" ) %]
+ <div class="error">This member has no email</div>
+ [% ELSE %]
+ <div class="error">[% error_alert %]</div>
+ [% END %]
+ [% END %]
+ [% IF info_alert %]
+ <div class="dialog message">Email has been sent.</div>
+ [% END %]
+
[% IF ( no_add ) %]<div class="dialog alert"><h3>Cannot add patron</h3>
[% IF ( no_branches ) %]<p>There are <strong>no libraries defined</strong>. [% IF ( CAN_user_parameters ) %]Please <a href="/cgi-bin/koha/admin/branches.pl">add a library</a>.[% ELSE %]An administrator must define at least one library.[% END %]</p>[% END %]
[% IF ( no_categories ) %]<p>There are <strong>no patron categories defined</strong>. [% IF ( CAN_user_parameters ) %]Please <a href="/cgi-bin/koha/admin/categorie.pl">add a patron category</a>.[% ELSE %]An administrator must define at least one patron category.</p>[% END %][% END %]</div>[% END %]
# if we manage to find a valid email address, send notice
if ($emailaddr) {
$newdata{emailaddr} = $emailaddr;
- SendAlerts ( 'members', \%newdata, "ACCTDETAILS" );
+ my $err;
+ eval {
+ $err = SendAlerts ( 'members', \%newdata, "ACCTDETAILS" );
+ };
+ if ( $@ ) {
+ $template->param(error_alert => $@);
+ } elsif ( defined $err->{error} and $err->{error} eq "no_email" ) {
+ $template->{VARS}->{'error_alert'} = "no_email";
+ } else {
+ $template->{VARS}->{'info_alert'} = 1;
+ }
}
- }
+ }
if ($data{'organisations'}){
# need to add the members organisations