Bug 55299

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@464 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2009-10-14 15:22:05 +00:00
parent 4ad1fa4ddc
commit 4fcd8a89ac
2 changed files with 36 additions and 4 deletions

View File

@ -36,6 +36,7 @@ use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Constants;
use Bugzilla::Util;
use Bugzilla::Hook;
use Bugzilla::Bug;
use Bugzilla::Classification;
use Bugzilla::Product;
@ -690,11 +691,12 @@ sub sendMail
Bugzilla::CustisLocalBugzillas::HackIntoUrlbase($user->email);
my $msg;
my $tmpl = '';
my $template = Bugzilla->template_inner($user->settings->{lang}->{value});
my $tmpl = '-'.$values{product};
$tmpl = '' unless $template->template_exists("email/newchangedmail$tmpl.txt.tmpl");
$template->process("email/newchangedmail$tmpl.txt.tmpl", $vars, \$msg)
|| ThrowTemplateError($template->error());
Bugzilla::Hook::process('bugmail-pre_template', { tmpl => \$tmpl, vars => $vars });
$tmpl = "email/newchangedmail.txt.tmpl" unless $template->template_exists($tmpl);
$template->process($tmpl, $vars, \$msg) || ThrowTemplateError($template->error());
Bugzilla->template_inner("");
MessageToMTA($msg);

View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
use strict;
use Bugzilla::Constants;
use Bugzilla::Util;
use POSIX qw(strftime);
if (0)
{
my $vars = Bugzilla->hook_args->{vars};
${Bugzilla->hook_args->{tmpl}} = 'email/newchangedmail-'.$vars->{product}.'.txt.tmpl';
my $datadir = bz_locations()->{datadir};
my $fd;
if (-w "$datadir/maillog" && open $fd, ">>$datadir/maillog")
{
my $s = [ strftime("%Y-%m-%d %H:%M:%S: ", localtime) . ($vars->{isnew} ? "" : "Re: ") . "Bug #$vars->{id} mail to $vars->{to}" ];
if ($vars->{new_comments} && @{$vars->{new_comments}})
{
push @$s, scalar(@{$vars->{new_comments}}) . ' comments (#' . (join ',', map { $_->{count} } @{$vars->{new_comments}}) . ')';
}
if ($vars->{diffarray} && @{$vars->{diffarray}})
{
push @$s, scalar(grep { $_->{type} eq 'change' } @{$vars->{diffarray}}) . ' diffs';
}
$s = join "; ", @$s;
print $fd $s, "\n";
close $fd;
}
}