my $field_obj = blessed $field ? $field : Bugzilla::Field->check($field);
my $field_name = $field_obj->name;
- if ($class->CLASS_MAP->{$field_name}) {
- return $class->CLASS_MAP->{$field_name};
+ if (my $package = $class->CLASS_MAP->{$field_name}) {
+ # Callers expect the module to be already loaded.
+ eval "require $package";
+ return $package;
}
# For generic classes, we use a lowercase class name, so as
use strict;
-use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::WebService::Constants;
use Bugzilla::Hook;
include_languages);
use Bugzilla::Keyword;
use Bugzilla::Util;
-use Bugzilla::User;
use Bugzilla::Error;
use Bugzilla::Search;
-use Bugzilla::Status;
use Bugzilla::Token;
use Cwd qw(abs_path);
my $dbh = Bugzilla->dbh;
if (defined $bug) {
- $bug = blessed($bug) ? $bug : new Bugzilla::Bug($bug);
+ if (!blessed($bug)) {
+ require Bugzilla::Bug;
+ $bug = new Bugzilla::Bug($bug);
+ }
return $link_text if $bug->{error};
}