Closed Bug 813628 Opened 12 years ago Closed 12 years ago

New extension hook for Bugzilla::Bug::update called bug_start_of_update

Categories

(Bugzilla :: Extensions, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: dkl, Assigned: dkl)

Details

Attachments

(1 file)

bug_start_of_update This happens near the beginning of "update" in Bugzilla::Bug, after "update" in Bugzilla::Object is called, but before all other special changes are made to the database. Once use case is this allows for adding your own entries to the "changes" hash which gets added to the bugs_activity table later keeping you from having to do it yourself. Also this is also helpful if your extension needs to add CC members, flags, keywords, groups, etc. This generally occurs inside a database transaction. Patch attached dkl
Attachment #683635 - Flags: review?(LpSolit)
Comment on attachment 683635 [details] [diff] [review] Patch to add new bug_start_of_update hook (v1) >=== modified file 'extensions/Example/Extension.pm' >+ 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!"; >+ } >+ } You should do something with $status_message, e.g. display it somewhere. Else setting this variable is pretty useless. r=LpSolit with this comment fixed.
Attachment #683635 - Flags: review?(LpSolit) → review+
Severity: normal → enhancement
Flags: approval4.4+
Flags: approval+
Keywords: relnote
OS: Linux → All
Hardware: x86_64 → All
Target Milestone: --- → Bugzilla 4.4
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk modified extensions/Example/Extension.pm modified Bugzilla/Bug.pm modified Bugzilla/Hook.pm Committed revision 8518. Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/4.4 modified extensions/Example/Extension.pm modified Bugzilla/Bug.pm modified Bugzilla/Hook.pm Committed revision 8484.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Added to relnotes for 4.4rc2.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: