From c62b0d1928f8b45a3f624b9b8c01948a9626c8cb Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 14 Jul 2007 19:54:59 +0000 Subject: Bug 388045: Move updating of cc_accessible and reporter_accessible into Bugzilla::Bug (from process_bug) Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla/Bug.pm | 6 ++++++ Bugzilla/Object.pm | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index cf1051a74..ad9146504 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -151,12 +151,15 @@ sub VALIDATORS { use constant UPDATE_VALIDATORS => { bug_status => \&_check_bug_status, + cclist_accessible => \&Bugzilla::Object::check_boolean, + reporter_accessible => \&Bugzilla::Object::check_boolean, resolution => \&_check_resolution, }; sub UPDATE_COLUMNS { my @columns = qw( alias + cclist_accessible everconfirmed bug_file_loc bug_severity @@ -164,6 +167,7 @@ sub UPDATE_COLUMNS { op_sys priority rep_platform + reporter_accessible resolution short_desc status_whiteboard @@ -1207,6 +1211,7 @@ sub _set_global_validator { ################# sub set_alias { $_[0]->set('alias', $_[1]); } +sub set_cclist_accessible { $_[0]->set('cclist_accessible', $_[1]); } sub set_custom_field { my ($self, $field, $value) = @_; ThrowCodeError('field_not_custom', { field => $field }) if !$field->custom; @@ -1226,6 +1231,7 @@ sub _set_everconfirmed { $_[0]->set('everconfirmed', $_[1]); } sub set_op_sys { $_[0]->set('op_sys', $_[1]); } sub set_platform { $_[0]->set('rep_platform', $_[1]); } sub set_priority { $_[0]->set('priority', $_[1]); } +sub set_reporter_accessible { $_[0]->set('reporter_accessible', $_[1]); } sub set_resolution { $_[0]->set('resolution', $_[1]); } sub set_severity { $_[0]->set('bug_severity', $_[1]); } sub set_status { diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index 37e4b9349..3da4b9379 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -333,6 +333,12 @@ sub get_all { return @$objects; } +############################### +#### Validators ###### +############################### + +sub check_boolean { return $_[1] ? 1 : 0 } + 1; __END__ @@ -679,6 +685,20 @@ be the same as the name of the field in L, if it exists there. =back +=head2 Simple Validators + +You can use these in your subclass L or L. +Note that you have to reference them like C<\&Bugzilla::Object::check_boolean>, +you can't just write C<\&check_boolean>. + +=over + +=item C + +Returns C<1> if the passed-in value is true, C<0> otherwise. + +=back + =head1 CLASS FUNCTIONS =over -- cgit v1.2.3-24-g4f1b