Bugzilla - Making more attributes available in bug mail

I spent a while trying to work this out a couple of days ago. If you want to show more attributes of the bug in the Bugzilla 2.18 bug changed email, you can do the following:

Edit Bugzilla/BugMail.pm. Find the NewProcessOnePerson sub. There is a section that sets several values in the $substs hash. The new attributes you want to show need to be added to $substs. The attributes of the bug can be found in $values (named the same as the columns in the bugs table). The following example makes the bug product and component attributes available:

$substs{"summary"} = $values{'short_desc'};
$substs{"reasonsheader"} = join(" ", @reasons);
$substs{"reasonsbody"} = $reasonsbody;
$substs{"space"} = " ";

# Added the following lines to allow product and component to be used in bug mail
$substs{"product"} = $values{'product'};
$substs{"component"} = $values{'component'};

Once this change is made to the code, edit the newchangedmail parameter (bug changed email template) through the edit parameters admin screen. You will now be able to use the new values added to $substs as %name%. For the above example, %product% and %component% can now be added to the template.

3 Responses to “Bugzilla - Making more attributes available in bug mail”

  1. Ivona Says:

    Hi,
    I tried to add op_sys and ref_platform attributes but it didn’t work.
    any suggestions?
    thanks
    Ivona

  2. Phil Ross Says:

    Note that the attribute is rep_platform and not ref_platform.

    It looks like the $substs attributes cannot contain underscores. I’ve added

    $substs{”opsys”} = $values{’op_sys’};
    $substs{”repplatform”} = $values{’rep_platform’};

    to BugMail.pm and

    OS: %opsys%
    Platform: %repplatform%

    to the newchangedmail template and the values appear in the email.

  3. Ivona Says:

    thanks a lot, this helps a great deal

    Ivona

Leave a Reply