fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6563] frontend: set default categories and auto assi


From: Sigurd Nes
Subject: [Fmsystem-commits] [6563] frontend: set default categories and auto assign to user at responsible role
Date: Tue, 09 Nov 2010 22:29:31 +0000

Revision: 6563
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6563
Author:   sigurdne
Date:     2010-11-09 22:29:31 +0000 (Tue, 09 Nov 2010)
Log Message:
-----------
frontend: set default categories and auto assign to user at responsible role

Modified Paths:
--------------
    trunk/frontend/inc/class.uihelpdesk.inc.php
    trunk/frontend/inc/hook_config.inc.php
    trunk/frontend/templates/base/config.tpl

Modified: trunk/frontend/inc/class.uihelpdesk.inc.php
===================================================================
--- trunk/frontend/inc/class.uihelpdesk.inc.php 2010-11-09 20:41:48 UTC (rev 
6562)
+++ trunk/frontend/inc/class.uihelpdesk.inc.php 2010-11-09 22:29:31 UTC (rev 
6563)
@@ -539,23 +539,33 @@
                                        $config = 
CreateObject('phpgwapi.config', 'frontend');
                                        $config->read();
                                        $default_group = 
$config->config_data['tts_default_group'];
+                                       $default_cat = 
$config->config_data['tts_default_cat'] ? 
$config->config_data['tts_default_cat'] : 0;
+                                       
+                                       if(!$default_cat)
+                                       {
+                                               throw new Exception('Default 
category is not set in config');
+                                               
$GLOBALS['phpgw']->common->phpgw_exit();
+                                       }
 
+                                       $location  = array
+                                       (
+                                               'loc1'  => 
$location_details['loc1'],
+                                               'loc2'  => 
$location_details['loc2']
+                                       );
+
                                        $ticket = array(
                                                'origin'    => null,
                                                'origin_id' => null,
-                                               'cat_id'    => 11,
+                                               'cat_id'    => $default_cat,
                                                'group_id'  => ($default_group 
? $default_group : null),
-                                               'assignedto'=> null,
+                                               'assignedto'=> 
execMethod('property.boresponsible.get_responsible', array('location' => 
$location, 'cat_id' => $default_cat)),
                                                'priority'  => 3,
                                                'status'    => 'O', // O = Open
                                                'subject'   => $values['title'],
                                                'details'   => 
$values['locationdesc'].":\n\n".$values['description'],
                                                'apply'     => lang('Apply'),
                                                'contact_id'=> 0,
-                                               'location'  => array(
-                                                       'loc1'  => 
$location_details['loc1'],
-                                                       'loc2'  => 
$location_details['loc2']
-                                               ),
+                                               'location'  => $location,
                                                'street_name'   => 
$location_details['street_name'],
                                                'street_number' => 
$location_details['street_number'],
                                                'location_name' => 
$location_details['loc1_name'],

Modified: trunk/frontend/inc/hook_config.inc.php
===================================================================
--- trunk/frontend/inc/hook_config.inc.php      2010-11-09 20:41:48 UTC (rev 
6562)
+++ trunk/frontend/inc/hook_config.inc.php      2010-11-09 22:29:31 UTC (rev 
6563)
@@ -121,3 +121,19 @@
                return $cat_select;
        }
 
+       /**
+       * Get HTML listbox with categories that are candidates for default 
ticket cat
+       *
+       * @param $config
+       * @return string options for selectbox
+       */
+       function tts_default_cat($config)
+       {
+               $cats   = CreateObject('phpgwapi.categories', -1, 'property', 
'.ticket');
+               $cats->supress_info = true;
+               $selected = isset($config['tts_default_cat']) ? 
$config['tts_default_cat'] : '';
+               $cat_select = '<option value="">' . lang('none selected') . 
'</option>' . "\n";
+               $cat_select     .= $cats->formatted_list(array('selected' => 
$selected));
+               return $cat_select;
+       }
+

Modified: trunk/frontend/templates/base/config.tpl
===================================================================
--- trunk/frontend/templates/base/config.tpl    2010-11-09 20:41:48 UTC (rev 
6562)
+++ trunk/frontend/templates/base/config.tpl    2010-11-09 22:29:31 UTC (rev 
6563)
@@ -29,6 +29,14 @@
                        </td>
                </tr>
                <tr class="row_on">
+                       <td>{lang_ticket_default_category}:</td>
+                       <td>
+                               <select name="newsettings[tts_default_cat]">
+{hook_tts_default_cat}
+                               </select>
+                       </td>
+               </tr>
+               <tr class="row_on">
                        <td>{lang_document_category_for_building_picture}:</td>
                        <td>
                                <select 
name="newsettings[picture_building_cat]">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]