Bug 7167: Followup: FIX conflicts with Bug 5347
- Fix sql syntax error - Fix Encoding - SendAlerts must return an error if no email is defined - Get error if no email in memberentry http://bugs.koha-community.org/show_bug.cgi?id=7001 Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
parent
38e5e15153
commit
9a4873bc4c
|
|
@ -294,8 +294,8 @@ sub SendAlerts {
|
|||
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;
|
||||
|
|
@ -322,8 +322,8 @@ sub SendAlerts {
|
|||
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( {} );
|
||||
|
|
@ -338,7 +338,7 @@ sub SendAlerts {
|
|||
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;
|
||||
|
|
@ -358,8 +358,8 @@ sub SendAlerts {
|
|||
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;
|
||||
|
|
@ -391,11 +391,12 @@ sub SendAlerts {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,17 @@
|
|||
<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 %]
|
||||
|
|
|
|||
|
|
@ -347,9 +347,19 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
|
|||
# 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue