Author: rjollos
Date: Mon Jun 24 21:15:22 2013
New Revision: 1496220

URL: http://svn.apache.org/r1496220
Log:
Refs #569:
 * Added `product` to default `quick_create_fields`.
 * Ensure that the `product` select is properly populated, even when 
`[multiproduct] default_product_prefix` is invalid.

Modified:
    bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1496220&r1=1496219&r2=1496220&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Mon Jun 24 21:15:22 2013
@@ -443,7 +443,7 @@ class QuickCreateTicketDialog(Component)
     implements(IRequestFilter, IRequestHandler)
 
     qct_fields = ListOption('ticket', 'quick_create_fields', 
-                            'version,type',
+                            'product, version, type',
         doc="""Multiple selection fields displayed in create ticket menu""")
 
     # IRequestFilter(Interface):
@@ -478,7 +478,15 @@ class QuickCreateTicketDialog(Component)
                 if self.env.product:
                     product_field['value'] = self.env.product.prefix
                 else:
-                    product_field['value'] = product_field['options'][0]
+                    # Global scope, now check default_product_prefix is valid
+                    default_prefix = self.config.get('multiproduct',
+                                                     'default_product_prefix')
+                    try:
+                        ProductEnvironment.lookup_env(self.env, default_prefix)
+                    except LookupError:
+                        product_field['value'] = product_field['options'][0]
+                    else:
+                        product_field['value'] = default_prefix
 
             data['qct'] = {
                 'fields': [all_fields[k] for k in self.qct_fields
@@ -540,8 +548,6 @@ class QuickCreateTicketDialog(Component)
             t[k] = v
         t['status'] = 'new'
         t['resolution'] = ''
-        if self.env.product:
-            t['product'] = self.env.product.prefix
         t.insert()
 
         if notify:


Reply via email to