Closed Bug 521373 Opened 16 years ago Closed 16 years ago

Create an object-before_create hook

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

(Whiteboard: [es-ita])

Attachments

(1 file, 2 obsolete files)

In general, it's pretty silly to have a before_create hook for each individual subclass of Bugzilla::Object, because before_create in the subclass would happen at the same time as before_create in Bugzilla::Object. People can just use $class->isa() to determine what class they're updating, using one central hook.
Whiteboard: [es-ita]
Attached patch v1 (obsolete) — Splinter Review
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #405407 - Flags: review?(dkl)
Blocks: 521413
Attached patch v2 (obsolete) — Splinter Review
Had forgotten to include "use Bugzilla::Hook" in the first patch.
Attachment #405407 - Attachment is obsolete: true
Attachment #405461 - Flags: review?(dkl)
Attachment #405407 - Flags: review?(dkl)
Attached patch v3Splinter Review
I moved it to check_required_create_fields because that way it will affect Bugzilla::Bug and anything else that uses the three internal subroutines instead of calling SUPER::create.
Attachment #405461 - Attachment is obsolete: true
Attachment #407913 - Flags: review?(dkl)
Attachment #405461 - Flags: review?(dkl)
Comment on attachment 407913 [details] [diff] [review] v3 I can see where this would be very useful. I wrote a test extension and this worked pretty much as expected. r=dkl
Attachment #407913 - Flags: review?(dkl) → review+
Flags: approval?
Flags: approval? → approval+
Checking in Bugzilla/Hook.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Hook.pm,v <-- Hook.pm new revision: 1.34; previous revision: 1.33 done Checking in Bugzilla/Object.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Object.pm,v <-- Object.pm new revision: 1.38; previous revision: 1.37 done RCS file: /cvsroot/mozilla/webtools/bugzilla/extensions/example/code/object-before_create.pl,v done Checking in extensions/example/code/object-before_create.pl; /cvsroot/mozilla/webtools/bugzilla/extensions/example/code/object-before_create.pl,v <-- object-before_create.pl initial revision: 1.1 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: