summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-07-13 19:43:27 +0200
committermkanat%bugzilla.org <>2007-07-13 19:43:27 +0200
commit012d45ae9579b0f1690a2daed8212f38e9c9e26a (patch)
treec42254be11b8b95b4e556e59face03a33d6546e3 /Bugzilla
parent23c63e06693b324f5ea61555fd150ac4a158679a (diff)
downloadbugzilla-012d45ae9579b0f1690a2daed8212f38e9c9e26a.tar.gz
bugzilla-012d45ae9579b0f1690a2daed8212f38e9c9e26a.tar.xz
Bug 385849: Make Bugzilla::Bug do updating for op_sys, rep_platform, and other product-inspecific fields
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm27
-rw-r--r--Bugzilla/Object.pm10
2 files changed, 37 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 321220194..3ace277dd 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -149,8 +149,15 @@ use constant UPDATE_VALIDATORS => {
use constant UPDATE_COLUMNS => qw(
everconfirmed
+ bug_file_loc
+ bug_severity
bug_status
+ op_sys
+ priority
+ rep_platform
resolution
+ short_desc
+ status_whiteboard
);
# This is used by add_comment to know what we validate before putting in
@@ -1145,6 +1152,19 @@ sub fields {
# Mutators
#####################################################################
+# To run check_can_change_field.
+sub _set_global_validator {
+ my ($self, $value, $field) = @_;
+ my $current_value = $self->$field;
+ my $privs;
+ $self->check_can_change_field($field, $current_value, $value, \$privs)
+ || ThrowUserError('illegal_change', { field => $field,
+ oldvalue => $current_value,
+ newvalue => $value,
+ privs => $privs });
+}
+
+
#################
# "Set" Methods #
#################
@@ -1160,13 +1180,20 @@ sub set_dependencies {
$self->{'blocked'} = $blocked;
}
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_resolution { $_[0]->set('resolution', $_[1]); }
+sub set_severity { $_[0]->set('bug_severity', $_[1]); }
sub set_status {
my ($self, $status) = @_;
$self->set('bug_status', $status);
# Check for the everconfirmed transition
$self->_set_everconfirmed(1) if (is_open_state($status) && $status ne 'UNCONFIRMED');
}
+sub set_status_whiteboard { $_[0]->set('status_whiteboard', $_[1]); }
+sub set_summary { $_[0]->set('short_desc', $_[1]); }
+sub set_url { $_[0]->set('bug_file_loc', $_[1]); }
########################
# "Add/Remove" Methods #
diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm
index 7d24c392a..37e4b9349 100644
--- a/Bugzilla/Object.pm
+++ b/Bugzilla/Object.pm
@@ -196,6 +196,10 @@ sub set {
if (exists $validators{$field}) {
my $validator = $validators{$field};
$value = $self->$validator($value, $field);
+
+ if ($self->can('_set_global_validator')) {
+ $self->_set_global_validator($value, $field);
+ }
}
$self->{$field} = $value;
@@ -650,6 +654,12 @@ if it exists. Subclasses should use this function
to implement the various C<set_> mutators for their different
fields.
+If your class defines a method called C<_set_global_validator>,
+C<set> will call it with C<($value, $field)> as arguments, after running
+the validator for this particular field. C<_set_global_validator> does not
+return anything.
+
+
See L</VALIDATORS> for more information.
=item B<Params>