aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Report.pm')
-rw-r--r--Bugzilla/Report.pm74
1 files changed, 36 insertions, 38 deletions
diff --git a/Bugzilla/Report.pm b/Bugzilla/Report.pm
index 10af2ea9e..84ea3b38b 100644
--- a/Bugzilla/Report.pm
+++ b/Bugzilla/Report.pm
@@ -26,43 +26,40 @@ use constant AUDIT_UPDATES => 0;
use constant AUDIT_REMOVES => 0;
use constant DB_COLUMNS => qw(
- id
- user_id
- name
- query
+ id
+ user_id
+ name
+ query
);
use constant UPDATE_COLUMNS => qw(
- name
- query
+ name
+ query
);
-use constant VALIDATORS => {
- name => \&_check_name,
- query => \&_check_query,
-};
+use constant VALIDATORS => {name => \&_check_name, query => \&_check_query,};
##############
# Validators #
##############
sub _check_name {
- my ($invocant, $name) = @_;
- $name = clean_text($name);
- $name || ThrowUserError("report_name_missing");
- $name !~ /[<>&]/ || ThrowUserError("illegal_query_name");
- if (length($name) > MAX_LEN_QUERY_NAME) {
- ThrowUserError("query_name_too_long");
- }
- return $name;
+ my ($invocant, $name) = @_;
+ $name = clean_text($name);
+ $name || ThrowUserError("report_name_missing");
+ $name !~ /[<>&]/ || ThrowUserError("illegal_query_name");
+ if (length($name) > MAX_LEN_QUERY_NAME) {
+ ThrowUserError("query_name_too_long");
+ }
+ return $name;
}
sub _check_query {
- my ($invocant, $query) = @_;
- $query || ThrowUserError("buglist_parameters_required");
- my $cgi = new Bugzilla::CGI($query);
- $cgi->clean_search_url;
- return $cgi->query_string;
+ my ($invocant, $query) = @_;
+ $query || ThrowUserError("buglist_parameters_required");
+ my $cgi = new Bugzilla::CGI($query);
+ $cgi->clean_search_url;
+ return $cgi->query_string;
}
#############
@@ -71,7 +68,7 @@ sub _check_query {
sub query { return $_[0]->{'query'}; }
-sub set_name { $_[0]->set('name', $_[1]); }
+sub set_name { $_[0]->set('name', $_[1]); }
sub set_query { $_[0]->set('query', $_[1]); }
###########
@@ -79,25 +76,26 @@ sub set_query { $_[0]->set('query', $_[1]); }
###########
sub create {
- my $class = shift;
- my $param = shift;
+ my $class = shift;
+ my $param = shift;
- Bugzilla->login(LOGIN_REQUIRED);
- $param->{'user_id'} = Bugzilla->user->id;
+ Bugzilla->login(LOGIN_REQUIRED);
+ $param->{'user_id'} = Bugzilla->user->id;
- unshift @_, $param;
- my $self = $class->SUPER::create(@_);
+ unshift @_, $param;
+ my $self = $class->SUPER::create(@_);
}
sub check {
- my $class = shift;
- my $report = $class->SUPER::check(@_);
- my $user = Bugzilla->user;
- if ( grep($_->id eq $report->id, @{$user->reports})) {
- return $report;
- } else {
- ThrowUserError('report_access_denied');
- }
+ my $class = shift;
+ my $report = $class->SUPER::check(@_);
+ my $user = Bugzilla->user;
+ if (grep($_->id eq $report->id, @{$user->reports})) {
+ return $report;
+ }
+ else {
+ ThrowUserError('report_access_denied');
+ }
}
1;