summaryrefslogtreecommitdiffstats
path: root/extensions/Example
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-12-18 21:32:31 +0100
committerDave Lawrence <dlawrence@mozilla.com>2012-12-18 21:32:31 +0100
commit2f310307750a7d70da1bb4f3077c7a7fa616e2eb (patch)
treeb86dc8fc80c2d1798d9db1977b33480c14c40109 /extensions/Example
parentc74561474c4cff83539420bde57306c1b9a384a7 (diff)
downloadbugzilla-2f310307750a7d70da1bb4f3077c7a7fa616e2eb.tar.gz
bugzilla-2f310307750a7d70da1bb4f3077c7a7fa616e2eb.tar.xz
Bug 813628 - New extension hook for Bugzilla::Bug::update called bug_start_of_update
Diffstat (limited to 'extensions/Example')
-rw-r--r--extensions/Example/Extension.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm
index d7b892cfa..3208d701a 100644
--- a/extensions/Example/Extension.pm
+++ b/extensions/Example/Extension.pm
@@ -168,6 +168,42 @@ sub bug_end_of_create_validators {
# $bug_params->{cc} = [];
}
+sub bug_start_of_update {
+ my ($self, $args) = @_;
+
+ # This code doesn't actually *do* anything, it's just here to show you
+ # how to use this hook.
+ my ($bug, $old_bug, $timestamp, $changes) =
+ @$args{qw(bug old_bug timestamp changes)};
+
+ foreach my $field (keys %$changes) {
+ my $used_to_be = $changes->{$field}->[0];
+ my $now_it_is = $changes->{$field}->[1];
+ }
+
+ my $old_summary = $old_bug->short_desc;
+
+ my $status_message;
+ if (my $status_change = $changes->{'bug_status'}) {
+ my $old_status = new Bugzilla::Status({ name => $status_change->[0] });
+ my $new_status = new Bugzilla::Status({ name => $status_change->[1] });
+ if ($new_status->is_open && !$old_status->is_open) {
+ $status_message = "Bug re-opened!";
+ }
+ if (!$new_status->is_open && $old_status->is_open) {
+ $status_message = "Bug closed!";
+ }
+ }
+
+ my $bug_id = $bug->id;
+ my $num_changes = scalar keys %$changes;
+ my $result = "There were $num_changes changes to fields on bug $bug_id"
+ . " at $timestamp.";
+ # Uncomment this line to see $result in your webserver's error log whenever
+ # you update a bug.
+ # warn $result;
+}
+
sub bug_end_of_update {
my ($self, $args) = @_;