Commit 0b6e8545 authored by mkanat%kerio.com's avatar mkanat%kerio.com

Bug 282632: Eliminate AUTOLOAD section from BugMail.pm

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=wicked, a=justdave
parent 0338ce8b
...@@ -36,10 +36,15 @@ use base qw(Exporter); ...@@ -36,10 +36,15 @@ use base qw(Exporter);
PerformSubsts PerformSubsts
); );
use Bugzilla;
use Bugzilla::DB qw(:deprecated);
use Bugzilla::User;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Util; use Bugzilla::Util;
use Date::Parse;
use Date::Format;
use Mail::Mailer; use Mail::Mailer;
use Mail::Header; use Mail::Header;
...@@ -63,20 +68,6 @@ if ($2) { ...@@ -63,20 +68,6 @@ if ($2) {
$sitespec = "-$2$sitespec"; # Put the port number back in, before the '@' $sitespec = "-$2$sitespec"; # Put the port number back in, before the '@'
} }
# I got sick of adding &:: to everything.
# However, 'Yuck!'
# I can't require, cause that pulls it in only once, so it won't then be
# in the global package, and these aren't modules, so I can't use globals.pl
# Remove this evilness once our stuff uses real packages.
sub AUTOLOAD {
no strict 'refs';
use vars qw($AUTOLOAD);
my $subName = $AUTOLOAD;
$subName =~ s/.*::/::/; # remove package name
*$AUTOLOAD = \&$subName;
goto &$AUTOLOAD;
}
# This is run when we load the package # This is run when we load the package
if (open(NOMAIL, '<', "$datadir/nomail")) { if (open(NOMAIL, '<', "$datadir/nomail")) {
while (<NOMAIL>) { while (<NOMAIL>) {
...@@ -121,7 +112,7 @@ sub Send($;$) { ...@@ -121,7 +112,7 @@ sub Send($;$) {
# This only works in a sub. Probably something to do with the # This only works in a sub. Probably something to do with the
# require abuse we do. # require abuse we do.
GetVersionTable(); &::GetVersionTable();
return ProcessOneBug($id, $forced); return ProcessOneBug($id, $forced);
} }
...@@ -152,8 +143,8 @@ sub ProcessOneBug($$) { ...@@ -152,8 +143,8 @@ sub ProcessOneBug($$) {
foreach my $i (@::log_columns) { foreach my $i (@::log_columns) {
$values{$i} = shift(@row); $values{$i} = shift(@row);
} }
$values{product} = get_product_name($values{product_id}); $values{product} = &::get_product_name($values{product_id});
$values{component} = get_component_name($values{component_id}); $values{component} = &::get_component_name($values{component_id});
my ($start, $end) = (@row); my ($start, $end) = (@row);
...@@ -170,24 +161,24 @@ sub ProcessOneBug($$) { ...@@ -170,24 +161,24 @@ sub ProcessOneBug($$) {
# At this point, we don't care if there are duplicates in these arrays. # At this point, we don't care if there are duplicates in these arrays.
my $changer = $forced->{'changer'}; my $changer = $forced->{'changer'};
if ($forced->{'owner'}) { if ($forced->{'owner'}) {
push (@assignees, DBNameToIdAndCheck($forced->{'owner'})); push (@assignees, &::DBNameToIdAndCheck($forced->{'owner'}));
} }
if ($forced->{'qacontact'}) { if ($forced->{'qacontact'}) {
push (@qa_contacts, DBNameToIdAndCheck($forced->{'qacontact'})); push (@qa_contacts, &::DBNameToIdAndCheck($forced->{'qacontact'}));
} }
if ($forced->{'cc'}) { if ($forced->{'cc'}) {
foreach my $cc (@{$forced->{'cc'}}) { foreach my $cc (@{$forced->{'cc'}}) {
push(@ccs, DBNameToIdAndCheck($cc)); push(@ccs, &::DBNameToIdAndCheck($cc));
} }
} }
# Convert to names, for later display # Convert to names, for later display
$values{'assigned_to'} = DBID_to_name($values{'assigned_to'}); $values{'assigned_to'} = &::DBID_to_name($values{'assigned_to'});
$values{'reporter'} = DBID_to_name($values{'reporter'}); $values{'reporter'} = &::DBID_to_name($values{'reporter'});
if ($values{'qa_contact'}) { if ($values{'qa_contact'}) {
$values{'qa_contact'} = DBID_to_name($values{'qa_contact'}); $values{'qa_contact'} = &::DBID_to_name($values{'qa_contact'});
} }
$values{'estimated_time'} = format_time_decimal($values{'estimated_time'}); $values{'estimated_time'} = format_time_decimal($values{'estimated_time'});
...@@ -299,7 +290,7 @@ sub ProcessOneBug($$) { ...@@ -299,7 +290,7 @@ sub ProcessOneBug($$) {
$interestingchange = 0; $interestingchange = 0;
} }
$thisdiff .= FormatTriple($fielddescription{$what}, $old, $new); $thisdiff .= FormatTriple($fielddescription{$what}, $old, $new);
if ($what eq 'bug_status' && IsOpenedState($old) ne IsOpenedState($new)) { if ($what eq 'bug_status' && &::IsOpenedState($old) ne &::IsOpenedState($new)) {
$interestingchange = 1; $interestingchange = 1;
} }
...@@ -319,7 +310,7 @@ sub ProcessOneBug($$) { ...@@ -319,7 +310,7 @@ sub ProcessOneBug($$) {
} }
my ($newcomments, $anyprivate) = GetLongDescriptionAsText($id, $start, $end); my ($newcomments, $anyprivate) = &::GetLongDescriptionAsText($id, $start, $end);
########################################################################### ###########################################################################
# Start of email filtering code # Start of email filtering code
...@@ -364,14 +355,15 @@ sub ProcessOneBug($$) { ...@@ -364,14 +355,15 @@ sub ProcessOneBug($$) {
# remove your vote. # remove your vote.
if ($what eq "CC") { if ($what eq "CC") {
foreach my $cc_user (split(/[\s,]+/, $old)) { foreach my $cc_user (split(/[\s,]+/, $old)) {
push(@{$recipients{DBNameToIdAndCheck($cc_user)}}, REL_CC); push(@{$recipients{&::DBNameToIdAndCheck($cc_user)}},
REL_CC);
} }
} }
elsif ($what eq "QAContact") { elsif ($what eq "QAContact") {
push(@{$recipients{DBNameToIdAndCheck($old)}}, REL_QA); push(@{$recipients{&::DBNameToIdAndCheck($old)}}, REL_QA);
} }
elsif ($what eq "AssignedTo") { elsif ($what eq "AssignedTo") {
push(@{$recipients{DBNameToIdAndCheck($old)}}, REL_ASSIGNEE); push(@{$recipients{&::DBNameToIdAndCheck($old)}}, REL_ASSIGNEE);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment