diff options
author | jake%acutex.net <> | 2001-07-21 00:18:25 +0200 |
---|---|---|
committer | jake%acutex.net <> | 2001-07-21 00:18:25 +0200 |
commit | 32c74ca90011bfa5cfc781ca0879529abb3c5d30 (patch) | |
tree | a37625309a4e03167eea6977451b70246fe7fa46 /globals.pl | |
parent | 708fafdbfa042bea7e5bb006ca1bdcde69248431 (diff) | |
download | bugzilla-32c74ca90011bfa5cfc781ca0879529abb3c5d30.tar.gz bugzilla-32c74ca90011bfa5cfc781ca0879529abb3c5d30.tar.xz |
Fix for bugs 55161 and 12819. The activity log now stores only what's changed in multi-value fields.
r= justdave@syndicomm.com
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/globals.pl b/globals.pl index 302d9b8b7..51fe1ddee 100644 --- a/globals.pl +++ b/globals.pl @@ -1224,6 +1224,37 @@ sub Param ($) { die "Can't find param named $value"; } +# Take two comma or space separated strings and return what +# values were removed from or added to the new one. +sub DiffStrings { + my ($oldstr, $newstr) = @_; + + my (@remove, @add) = (); + my @old = split(/[ ,]/, $oldstr); + my @new = split(/[ ,]/, $newstr); + + # Find values that were removed + foreach my $value(@old) { + next if $value =~ /^\s*$/; + if (! grep /^$value$/, @new) { + push (@remove, $value); + } + } + + # Find values that were added + foreach my $value(@new) { + next if $value =~ /^\s*$/; + if (! grep /^$value$/, @old) { + push (@add, $value); + } + } + + my $removed = join (", ", @remove); + my $added = join (", ", @add); + + return ($removed, $added); +} + sub PerformSubsts { my ($str, $substs) = (@_); $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg; |