From 05cc6289d00b21e12d4d59282384b8729a5c2b57 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 25 Jun 2005 05:33:05 +0000 Subject: Bug 284273: Move productResponsibilities from editusers.cgi to Bugzilla::User.pm - Patch by Marc Schumann r=mkanat a=justdave --- Bugzilla/User.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 87239bc6e..3e68647c6 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -530,6 +530,27 @@ sub derive_groups { $dbh->bz_unlock_tables() unless $already_locked; } +sub product_responsibilities { + my $self = shift; + + return $self->{'product_resp'} if defined $self->{'product_resp'}; + return [] unless $self->id; + + my $h = Bugzilla->dbh->selectall_arrayref( + qq{SELECT products.name AS productname, + components.name AS componentname, + initialowner, + initialqacontact + FROM products, components + WHERE products.id = components.product_id + AND ? IN (initialowner, initialqacontact) + }, + {'Slice' => {}}, $self->id); + $self->{'product_resp'} = $h; + + return $h; +} + sub can_bless { my $self = shift; @@ -1386,6 +1407,32 @@ all MySQL supported, this will go away. =end undocumented +=item C + +Retrieve user's product responsibilities as a list of hashes. +One hash per Bugzilla component the user has a responsibility for. +These are the hash keys: + +=over + +=item productname + +Name of the product. + +=item componentname + +Name of the component. + +=item initialowner + +User ID of default assignee. + +=item initialqacontact + +User ID of default QA contact. + +=back + =item C When called with no arguments: -- cgit v1.2.3-24-g4f1b