From 26fb8caed0484e92501ca81d6497f5235a638db8 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 27 Jul 2007 19:45:13 +0000 Subject: Bug 388149: Move updating of time-tracking fields into Bugzilla::Bug Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla/Object.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Object.pm') 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 is called. If a field can't be changed, it shouldn't be listed here. (For example, the L usually can't be updated.) +=item C + +When L 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 -- cgit v1.2.3-24-g4f1b