Restricting Product List in bug template

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Restricting Product List in bug template

Hildebrand, Jeff
When I look at a bug (using show_bug.cgi?id=###) it gives me a form that uses the edit.html.tmpl template.

In the template it creates a list of products containing all the products.  The code looks like this:

    [%#############%]
    [%#  PRODUCT  #%]
   [%#############%]
    <tr>
       [% INCLUDE bug/field.html.tmpl
            bug = bug, field = bug_fields.product,
            override_legal_values = bug.choices.product
            desc_url = 'describecomponents.cgi', value = bug.product
            editable = bug.check_can_change_field('product', 0, 1) %]
    </tr>

I would like to change it so it just lists the products that are in the current classification and not all products.  Has anyone done this already or have any pointers on how?

Thanks.

Jeffery Hildebrand | Analog Design EDA Engineer
Medical Products - CMPG
Office: +1 858-675-3469 | Cell: +1 (952) 210-8926
www.microsemi.com<http://www.microsemi.com/>
[image001]

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Restricting Product List in bug template

vcsekhar
Am also looking for the same. Appreciate if you could share, whenever you
get to have the solution.

Thanks

VC


On Mon, Jan 20, 2014 at 8:26 PM, Hildebrand, Jeff <
[hidden email]> wrote:

> When I look at a bug (using show_bug.cgi?id=###) it gives me a form that
> uses the edit.html.tmpl template.
>
> In the template it creates a list of products containing all the products.
>  The code looks like this:
>
>     [%#############%]
>     [%#  PRODUCT  #%]
>    [%#############%]
>     <tr>
>        [% INCLUDE bug/field.html.tmpl
>             bug = bug, field = bug_fields.product,
>             override_legal_values = bug.choices.product
>             desc_url = 'describecomponents.cgi', value = bug.product
>             editable = bug.check_can_change_field('product', 0, 1) %]
>     </tr>
>
> I would like to change it so it just lists the products that are in the
> current classification and not all products.  Has anyone done this already
> or have any pointers on how?
>
> Thanks.
>
> Jeffery Hildebrand | Analog Design EDA Engineer
> Medical Products - CMPG
> Office: +1 858-675-3469 | Cell: +1 (952) 210-8926
> www.microsemi.com<http://www.microsemi.com/>
> [image001]
>
> _______________________________________________
> support-bugzilla mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/support-bugzilla
> PLEASE put [hidden email] in the To: field when you
> reply.
>
_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Restricting Product List in bug template

Gervase Markham
In reply to this post by Hildebrand, Jeff
On 21/01/14 01:26, Hildebrand, Jeff wrote:
> I would like to change it so it just lists the products that are in
> the current classification and not all products.  Has anyone done
> this already or have any pointers on how?

Update the subroutine choices() in Bugzilla/Bug.pm to return the set of
products you want. At the moment, it returns
$user->get_enterable_products ; depending on what you want, you could
update that sub, or you could change choices() itself to return a
different list.

I'm not sure what the side effects of this would be, so do some testing :-)

Gerv
_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

RE: Restricting Product List in bug template

Hildebrand, Jeff
In reply to this post by vcsekhar
Ok, I tried what was suggested and changed the file Bugzilla/Bug.pm, the sub named choices.

It's not very elegant because I tried to keep it one block of code so it won't cause problems with future patches.  Everything else I tried to leave untouched.

Insert this at line 3716 of the file Bugzilla/Bug.pm of version 4.4.1.

#
#  added code to reduce the products to just what is in the classification
#

#   reset the @products array to nothing
    @products = ( );
#   Put the list of user enterable products into the @tempProducts array
    my @tempProducts = @{ $user->get_enterable_products };
#   Grab the specific classification ID off our current product
    my $specificClassification_id = $self->product_obj->classification_id;
#   Step through the @tempProducts to find any that have the same classification ID
    foreach my $tProduct (@tempProducts) {
        if ( $tProduct->classification_id == $specificClassification_id ) {
           unshift( @products, $tProduct );
        }
    }
#   @products has all products that are both user enterable and match classification ID
    # redo the current product just like above
    if (!grep($_->name eq $self->product_obj->name, @products)) {
        unshift(@products, $self->product_obj);
    }
#
#   end added code ... jrah
#


Jeffery Hildebrand | Analog Design EDA Engineer
Medical Products - CMPG
Office: +1 858-675-3469 | Cell: +1 (952) 210-8926
www.microsemi.com<http://www.microsemi.com/>
[image001]

From: vcsekhar parepalli [mailto:[hidden email]]
Sent: Monday, January 20, 2014 7:12 PM
To: Hildebrand, Jeff
Cc: '[hidden email]' ([hidden email])
Subject: Re: Restricting Product List in bug template

Am also looking for the same. Appreciate if you could share, whenever you get to have the solution.

Thanks

VC

On Mon, Jan 20, 2014 at 8:26 PM, Hildebrand, Jeff <[hidden email]<mailto:[hidden email]>> wrote:
When I look at a bug (using show_bug.cgi?id=###) it gives me a form that uses the edit.html.tmpl template.

In the template it creates a list of products containing all the products.  The code looks like this:

    [%#############%]
    [%#  PRODUCT  #%]
   [%#############%]
    <tr>
       [% INCLUDE bug/field.html.tmpl
            bug = bug, field = bug_fields.product,
            override_legal_values = bug.choices.product
            desc_url = 'describecomponents.cgi', value = bug.product
            editable = bug.check_can_change_field('product', 0, 1) %]
    </tr>

I would like to change it so it just lists the products that are in the current classification and not all products.  Has anyone done this already or have any pointers on how?

Thanks.

Jeffery Hildebrand | Analog Design EDA Engineer
Medical Products - CMPG
Office: +1 858-675-3469<tel:%2B1%20858-675-3469> | Cell: +1 (952) 210-8926<tel:%2B1%20%28952%29%20210-8926>
www.microsemi.com<http://www.microsemi.com><http://www.microsemi.com/>
[image001]

_______________________________________________
support-bugzilla mailing list
[hidden email]<mailto:[hidden email]>
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email]<mailto:[hidden email]> in the To: field when you reply.

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Restricting Product List in bug template

Thorsten Schöning
Guten Tag Hildebrand, Jeff,
am Mittwoch, 22. Januar 2014 um 00:34 schrieben Sie:

> It's not very elegant because I tried to keep it one block of code
> so it won't cause problems with future patches.

This may be a good time to have a look at bzr and using Bugzilla from
there, because this way you can create your own branch with your
customizations to the code versioned and bzr will assist you on future
upgrades, which are only merges form the main codeline.

https://wiki.mozilla.org/Bugzilla:Bzr

Mit freundlichen Grüßen,

Thorsten Schöning

--
Thorsten Schöning       E-Mail:[hidden email]
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.