summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Object.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-07-27 21:45:13 +0200
committermkanat%bugzilla.org <>2007-07-27 21:45:13 +0200
commit26fb8caed0484e92501ca81d6497f5235a638db8 (patch)
tree36ba64b067c096bb4c1ebbb2f7374fdd8ff6ad40 /Bugzilla/Object.pm
parent45a30629a2e0ebc56340a1119f56df13e475d14a (diff)
downloadbugzilla-26fb8caed0484e92501ca81d6497f5235a638db8.tar.gz
bugzilla-26fb8caed0484e92501ca81d6497f5235a638db8.tar.xz
Bug 388149: Move updating of time-tracking fields into Bugzilla::Bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Object.pm')
-rw-r--r--Bugzilla/Object.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm
index 3da4b9379..4d54b04e1 100644
--- a/Bugzilla/Object.pm
+++ b/Bugzilla/Object.pm
@@ -32,6 +32,7 @@ use constant ID_FIELD => 'id';
use constant LIST_ORDER => NAME_FIELD;
use constant UPDATE_VALIDATORS => {};
+use constant NUMERIC_COLUMNS => ();
###############################
#### Initialization ####
@@ -216,6 +217,7 @@ sub update {
my $old_self = $self->new($self->id);
+ my %numeric = map { $_ => 1 } $self->NUMERIC_COLUMNS;
my (@update_columns, @values, %changes);
foreach my $column ($self->UPDATE_COLUMNS) {
my ($old, $new) = ($old_self->{$column}, $self->{$column});
@@ -225,7 +227,7 @@ sub update {
if (!defined $new || !defined $old) {
next if !defined $new && !defined $old;
}
- elsif ($old eq $new) {
+ elsif ( ($numeric{$column} && $old == $new) || $old eq $new ) {
next;
}
@@ -445,6 +447,14 @@ A list of columns to update when L</update> is called.
If a field can't be changed, it shouldn't be listed here. (For example,
the L</ID_FIELD> usually can't be updated.)
+=item C<NUMERIC_COLUMNS>
+
+When L</update> is called, it compares each column in the object to its
+current value in the database. It only updates columns that have changed.
+
+Any column listed in NUMERIC_COLUMNS is treated as a number, not as a string,
+during these comparisons.
+
=back
=head1 METHODS