fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11096] property: specify candidates for ticket assig


From: Sigurd Nes
Subject: [Fmsystem-commits] [11096] property: specify candidates for ticket assignment (groups), alter 'billable hours'
Date: Thu, 09 May 2013 12:44:39 +0000

Revision: 11096
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11096
Author:   sigurdne
Date:     2013-05-09 12:44:33 +0000 (Thu, 09 May 2013)
Log Message:
-----------
property: specify candidates for ticket assignment (groups), alter 'billable 
hours'

Modified Paths:
--------------
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/hook_config.inc.php
    trunk/property/templates/base/config.tpl
    trunk/property/templates/base/tts.xsl

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2013-05-08 12:25:57 UTC (rev 
11095)
+++ trunk/property/inc/class.botts.inc.php      2013-05-09 12:44:33 UTC (rev 
11096)
@@ -316,8 +316,50 @@
                        return $columns;
                }
 
+               function get_group_list($selected = 0)
+               {
+                       $query='';
+                       $group_list     = 
$this->bocommon->get_group_list('select', $selected, $start=-1, $sort='ASC', 
$order='account_firstname', $query, $offset=-1);
+                       $_candidates = array();
+                       
if(isset($this->config->config_data['fmtts_assign_group_candidates']) && 
is_array($this->config->config_data['fmtts_assign_group_candidates']))
+                       {
+                               
foreach($this->config->config_data['fmtts_assign_group_candidates'] as 
$group_candidate)
+                               {
+                                       if( $group_candidate )
+                                       {
+                                               $_candidates[] = 
$group_candidate;
+                                       }
+                               }
+                       }
 
+                       if( $_candidates )
+                       {
+                               if($selected)
+                               {
+                                       if( !in_array( $selected, $_candidates) 
)
+                                       {
+                                               $_candidates[] = $selected;
+                                       }
+                               }
 
+                               $values = array();
+                               foreach ($group_list as $group)
+                               {
+                                       if( in_array( $group['id'], 
$_candidates) )
+                                       {
+                                               $values[] = $group;
+                                       }
+                               }
+
+                               return $values;
+                       }
+                       else
+                       {
+                               return $group_list;
+
+                       }
+               }
+
                function filter($data=0)
                {
                        if(is_array($data))

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2013-05-08 12:25:57 UTC (rev 
11095)
+++ trunk/property/inc/class.sotts.inc.php      2013-05-09 12:44:33 UTC (rev 
11096)
@@ -1009,7 +1009,7 @@
                        $old_status                     = 
$this->db->f('status');
                        $ticket['old_status']   = $old_status; // used for 
custom functions
                        $old_budget                     = 
$this->db->f('budget');
-                       $old_billable_hours             = 
$this->db->f('billable_hours');
+                       $old_billable_hours             = 
(float)$this->db->f('billable_hours');
                //      $old_billable_rate      = $this->db->f('billable_rate');
                        $old_subject                    = 
$this->db->f('subject');
                        $old_contact_id                 = 
$this->db->f('contact_id');
@@ -1215,9 +1215,10 @@
                        if($ticket['billable_hours'])
                        {
                                $ticket['billable_hours'] = 
(float)str_replace(',','.', $ticket['billable_hours']);
-                       }
-                       if ((float)$old_billable_hours != 
$ticket['billable_hours'])
-                       {
+                               $ticket['billable_hours'] += 
(float)$old_billable_hours;
+//                     }
+//                     if ((float)$old_billable_hours != 
$ticket['billable_hours'])
+//                     {
                                $this->db->query("UPDATE fm_tts_tickets SET 
billable_hours='{$ticket['billable_hours']}'"
                                        . " WHERE 
id='{$id}'",__LINE__,__FILE__);
                                
$this->historylog->add('H',$id,$ticket['billable_hours'],$old_billable_hours);

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2013-05-08 12:25:57 UTC (rev 
11095)
+++ trunk/property/inc/class.uitts.inc.php      2013-05-09 12:44:33 UTC (rev 
11096)
@@ -1999,9 +1999,10 @@
                                        'lang_user_statustext'                  
=> lang('Select the user the selection belongs to. To do not use a user select 
NO USER'),
                                        'select_user_name'                      
        => 'values[assignedto]',
                                        'user_list'                             
                => 
$this->bocommon->get_user_list_right2('select',4,$values['assignedto'],$this->acl_location),
+                                       'disable_userassign_on_add'             
=> 
isset($this->bo->config->config_data['tts_disable_userassign_on_add'])?$this->bo->config->config_data['tts_disable_userassign_on_add']:'',
 
                                        'lang_no_group'                         
        => lang('No group'),
-                                       'group_list'                            
        => 
$this->bocommon->get_group_list('select',$values['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+                                       'group_list'                            
        => $this->bo->get_group_list(),
                                        'select_group_name'                     
        => 'values[group_id]',
 
                                        'lang_priority_statustext'              
=> lang('Select the priority the selection belongs to.'),
@@ -3163,7 +3164,9 @@
                                        'user_list'                             
                => 
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl_location),
 
                                        'lang_no_group'                         
        => lang('No group'),
-                                       'group_list'                            
        => 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+//                                     'group_list'                            
        => 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+                                       'group_list'                            
        => $this->bo->get_group_list($ticket['group_id']),
+
                                        'select_group_name'                     
        => 'values[group_id]',
                                        'value_group_id'                        
        => $ticket['group_id'],
 

Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php      2013-05-08 12:25:57 UTC (rev 
11095)
+++ trunk/property/inc/hook_config.inc.php      2013-05-09 12:44:33 UTC (rev 
11096)
@@ -33,6 +33,32 @@
        * @param $config
        * @return string HTML checkboxes to be placed in a table
        */
+       function fmtts_assign_group_candidates($config)
+       {
+               $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+               $groups_assigned = 
isset($config['fmtts_assign_group_candidates']) ? 
$config['fmtts_assign_group_candidates'] : array();
+               $out = '';
+               foreach ( $groups as $group => $label)
+               {
+                       $checked = '';
+                       if ( in_array($group, $groups_assigned))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .=  <<<HTML
+                       <tr><td><input type="checkbox" 
name="newsettings[fmtts_assign_group_candidates][]" value="{$group}" 
{$checked}><label>{$label}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }
+
+       /**
+       * Get HTML checkbox with groups that are candidates for simplified tts 
interface
+       *
+       * @param $config
+       * @return string HTML checkboxes to be placed in a table
+       */
        function fmttssimple_group($config)
        {
                $groups = $GLOBALS['phpgw']->accounts->get_list('groups');

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2013-05-08 12:25:57 UTC (rev 
11095)
+++ trunk/property/templates/base/config.tpl    2013-05-09 12:44:33 UTC (rev 
11096)
@@ -238,7 +238,26 @@
                                {lang_default}: {lang_Open}</td>
                        <td><input name="newsettings[tts_lang_open]" 
value="{value_tts_lang_open}"></td>
                </tr>
+               <tr class="row_off">
+                       <td valign = 
'top'>{lang_TTS_assign_group_candidates}:</td>
+                       <td>
+                               <!--to be able to blank the setting - need an 
empty value-->
+                               <input type = 'hidden' 
name="newsettings[fmtts_assign_group_candidates][]" value="">
+                               <table>
+                                       {hook_fmtts_assign_group_candidates}
+                               </table>
+                       </td>
+               </tr>
                <tr class="row_on">
+                       <td >{lang_TTS_disable_assign_to_user_on_add}:</td>
+                       <td>
+                               <select 
name="newsettings[tts_disable_userassign_on_add]">
+                                       <option value="" 
{selected_tts_disable_userassign_on_add_}>NO</option>
+                                       <option value="1" 
{selected_tts_disable_userassign_on_add_1}>YES</option>
+                               </select>
+                       </td>
+               </tr>
+               <tr class="row_off">
                        <td valign = 'top'>{lang_TTS_simplified_group}:</td>
                        <td>
                                <!--to be able to blank the setting - need an 
empty value-->
@@ -266,7 +285,7 @@
                                </select>
                        </td>
                </tr>
-               <tr class="row_off">
+               <tr class="row_on">
                        <td>{lang_Owner_Notification_TTS}.</td>
                        <td>
                                <select name="newsettings[ownernotification]">
@@ -275,7 +294,7 @@
                                </select>
                        </td>
                </tr>
-               <tr class="row_on">
+               <tr class="row_off">
                        <td>{lang_Assigned_Notification_TTS}.</td>
                        <td>
                                <select 
name="newsettings[assignednotification]">
@@ -284,7 +303,7 @@
                                </select>
                        </td>
                </tr>
-               <tr class="row_off">
+               <tr class="row_on">
                        <td>{lang_Group_Notification_TTS}.</td>
                        <td>
                                <select name="newsettings[groupnotification]">

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2013-05-08 12:25:57 UTC (rev 
11095)
+++ trunk/property/templates/base/tts.xsl       2013-05-09 12:44:33 UTC (rev 
11096)
@@ -89,16 +89,20 @@
                                                                                
<xsl:call-template name="group_select"/>
                                                                        </td>
                                                                </tr>
-                                                               <tr>
-                                                                       <td 
valign="top">
-                                                                               
<label>
-                                                                               
        <xsl:value-of select="php:function('lang', 'Assign to')"/>
-                                                                               
</label>
-                                                                       </td>
-                                                                       <td>
-                                                                               
<xsl:call-template name="user_id_select"/>
-                                                                       </td>
-                                                               </tr>
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="disable_userassign_on_add !='1'">
+                                                                               
<tr>
+                                                                               
        <td valign="top">
+                                                                               
                <label>
+                                                                               
                        <xsl:value-of select="php:function('lang', 'Assign 
to')"/>
+                                                                               
                </label>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <xsl:call-template name="user_id_select"/>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       
</xsl:when>
+                                                               </xsl:choose>
                                                                
<xsl:call-template name="contact_form"/>
                                                                <tr>
                                                                        <td>
@@ -650,11 +654,16 @@
                                                                                
                        </label>
                                                                                
                </td>
                                                                                
                <td>
-                                                                               
                        <input type="text" id="values_billable_hour" 
name="values[billable_hours]" size="10" value="{value_billable_hours}">
+                                                                               
                        <input type="text" id="values_billable_hour" 
name="values[billable_hours]" size="10" value="">
                                                                                
                                <xsl:attribute name="title">
                                                                                
                                        <xsl:value-of 
select="php:function('lang', 'enter the billable hour for the task')"/>
                                                                                
                                </xsl:attribute>
                                                                                
                        </input>
+                                                                               
                        <input type="text" id="values_billable_hour_orig" 
name="values[billable_hours_orig]" size="10" value="{value_billable_hours}" 
readonly="readonly">
+                                                                               
                                <xsl:attribute name="title">
+                                                                               
                                        <xsl:value-of 
select="php:function('lang', 'enter the billable hour for the task')"/>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </input>
                                                                                
                </td>
                                                                                
        </tr>
                                                                                
</xsl:when>




reply via email to

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