fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6782] property: tweak tickets


From: Sigurd Nes
Subject: [Fmsystem-commits] [6782] property: tweak tickets
Date: Sat, 15 Jan 2011 23:52:05 +0000

Revision: 6782
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6782
Author:   sigurdne
Date:     2011-01-15 23:52:04 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
property: tweak tickets

Modified Paths:
--------------
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/tts.xsl

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2011-01-14 17:05:34 UTC (rev 
6781)
+++ trunk/property/inc/class.botts.inc.php      2011-01-15 23:52:04 UTC (rev 
6782)
@@ -92,7 +92,9 @@
                        $location_code                  = 
phpgw::get_var('location_code');
 
 
-                       $this->start                    = $start                
                                        ? $start                        : 0;
+//                     $this->start                    = $start                
                                        ? $start                        : 0;
+
+                       $this->start                    = 
isset($_REQUEST['start'])             ? $start                        : 
$this->start;
                        $this->query                    = 
isset($_REQUEST['query'])             ? $query                        : 
$this->query;
                        $this->sort                             = 
isset($_REQUEST['sort'])                      ? $sort                         : 
$this->sort;
                        $this->order                    = 
isset($_REQUEST['order'])             ? $order                        : 
$this->order;
@@ -981,9 +983,9 @@
                        return $receipt;
                }
 
-               public function update_ticket($data, $id)
+               public function update_ticket($data, $id,$receipt = array())
                {
-                       $receipt        = $this->so->update_ticket($data, $id);
+                       $receipt = $this->so->update_ticket($data, $id, 
$receipt);
                        $this->fields_updated = $this->so->fields_updated;      
        
                        return $receipt;
                }

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2011-01-14 17:05:34 UTC (rev 
6781)
+++ trunk/property/inc/class.sogeneric.inc.php  2011-01-15 23:52:04 UTC (rev 
6782)
@@ -1427,6 +1427,12 @@
                                                                'name' => 
'closed',
                                                                'descr' => 
lang('closed'),
                                                                'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'actual_cost',
+                                                               'descr' => 
lang('mandatory actual cost'),
+                                                               'type' => 
'checkbox'
                                                        )
                                                ),
                                                'edit_msg'                      
=> lang('edit'),

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2011-01-14 17:05:34 UTC (rev 
6781)
+++ trunk/property/inc/class.sotts.inc.php      2011-01-15 23:52:04 UTC (rev 
6782)
@@ -740,10 +740,9 @@
 
                }
 
-               function update_ticket($ticket,$id = 0)
+               function update_ticket($ticket,$id = 0, $receipt = array())
                {
                        $id = (int) $id;
-                       $receipt = array();
                        // DB Content is fresher than http posted value.
                        $this->db->query("select * from fm_tts_tickets where 
id='$id'",__LINE__,__FILE__);
                        $this->db->next_record();
@@ -956,7 +955,7 @@
                                $this->db->query("UPDATE fm_tts_tickets SET 
actual_cost='" . (float)$ticket['actual_cost']
                                        . "' WHERE id='$id'",__LINE__,__FILE__);
                                
$this->historylog->add('AC',$id,(float)$ticket['actual_cost'] , 
$old_actual_cost);
-                               $receipt['message'][]= array('msg' => 
lang('actual_cost has been updated'));
+                               $receipt['message'][]= array('msg' => 
lang('actual cost has been updated'));
                        }
 
                        if ((int)$old_order_cat_id != 
(int)$ticket['order_cat_id'])

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2011-01-14 17:05:34 UTC (rev 
6781)
+++ trunk/property/inc/class.uitts.inc.php      2011-01-15 23:52:04 UTC (rev 
6782)
@@ -293,9 +293,23 @@
                                return lang('sorry - insufficient rights');
                        }
 
-
                        $new_status = phpgw::get_var('new_status', 'string', 
'GET');
                        $id             = phpgw::get_var('id', 'int');
+
+                       $ticket = $this->bo->read_single($id);
+
+                       if($ticket['order_id'] &&  abs($ticket['actual_cost']) 
== 0)
+                       {
+                               $sogeneric              = 
CreateObject('property.sogeneric');
+                               
$sogeneric->get_location_info('ticket_status',false);
+                               $status_data    = 
$sogeneric->read_single(array('id' => (int)ltrim($new_status,'C')),array());
+
+                               if($status_data['actual_cost'])
+                               {
+                                       return "id ".$id." ".lang('actual 
cost') . ': ' . lang('Missing value');
+                               }
+                       }
+
                        $receipt        = 
$this->bo->update_status(array('status'=>$new_status),$id);
                        if 
(isset($this->bo->config->config_data['mailnotification']) && 
$this->bo->config->config_data['mailnotification'])
                        {
@@ -1753,9 +1767,9 @@
 
                                        'lang_priority_statustext'              
=> lang('Select the priority the selection belongs to.'),
                                        'select_priority_name'                  
=> 'values[priority]',
-                                       'priority_list'                         
        => 
$this->bo->get_priority_list((isset($values['priority'])?$values['priority']:'')),
+                                       'priority_list'                         
        => array('options' => 
$this->bo->get_priority_list((isset($values['priority'])?$values['priority']:''))),
 
-                                       'status_list'                           
        => $this->bo->get_status_list('O'),
+                                       'status_list'                           
        => array('options' => $this->bo->get_status_list('O')),
 
                                        'form_action'                           
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
 
@@ -2007,11 +2021,25 @@
 
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
                        
$GLOBALS['phpgw']->session->appsession('receipt','property','');
+                       if(!$receipt)
+                       {
+                               $receipt = array();
+                       }
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files'));
 
                        $historylog     = 
CreateObject('property.historylog','tts');
 
+                       $order_read                     = 
$this->acl->check('.ticket.order', PHPGW_ACL_READ, 'property');
+                       $order_add                              = 
$this->acl->check('.ticket.order', PHPGW_ACL_ADD, 'property');
+                       $order_edit                     = 
$this->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
+
+                       $access_order = false;
+                       if($order_add || $order_edit)
+                       {
+                               $access_order = true;
+                       }
+
                        if(isset($values['save']))
                        {
                                if(!$this->acl_edit)
@@ -2038,11 +2066,30 @@
                                        
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
                                }
 
+                               $sogeneric              = 
CreateObject('property.sogeneric');
+                               
$sogeneric->get_location_info('ticket_status',false);
+                               $status_data    = 
$sogeneric->read_single(array('id' => 
(int)ltrim($values['status'],'C')),array());
+
+                               if($access_order && $status_data['actual_cost'])
+                               {
+                                       if(!$values['actual_cost'] || 
!abs($values['actual_cost']) > 0)
+                                       {
+//_Debug_Array(abs($values['actual_cost']));
+//_debug_Array($values['actual_cost']);die();
+
+                                               
$receipt['error'][]=array('msg'=>lang('actual cost') . ': ' . lang('Missing 
value'));
+                                       }
+                                       else 
if(!is_numeric($values['actual_cost']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter a 
numeric value'));                                 
+                                       }
+                               }
+                               
                                if(isset($values['takeover']) && 
$values['takeover'])
                                {
                                        $values['assignedto'] = $this->account;
                                }
-                               $receipt = 
$this->bo->update_ticket($values,$id);
+                               $receipt = 
$this->bo->update_ticket($values,$id, $receipt);
 
                                if ( (isset($values['send_mail']) && 
$values['send_mail']) 
                                        || 
(isset($this->bo->config->config_data['mailnotification'])
@@ -2260,16 +2307,7 @@
                        }
 
                        // -------- start order section
-                       $order_read                     = 
$this->acl->check('.ticket.order', PHPGW_ACL_READ, 'property');
-                       $order_add                              = 
$this->acl->check('.ticket.order', PHPGW_ACL_ADD, 'property');
-                       $order_edit                     = 
$this->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
 
-                       $access_order = false;
-                       if($order_add || $order_edit)
-                       {
-                               $access_order = true;
-                       }
-
                        if($access_order)
                        {
                                
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
@@ -2752,9 +2790,8 @@
 
                                        'location_data'                         
        => $location_data,
 
-                                       'status_name'                           
        => 'values[status]',
                                        'value_status'                          
        => $ticket['status'],
-                                       'status_list'                           
        => $this->bo->get_status_list($ticket['status']),
+                                       'status_list'                           
        => array('options' => $this->bo->get_status_list($ticket['status'])),
 
                                        'lang_no_user'                          
        => lang('Select user'),
                                        'lang_user_statustext'                  
=> lang('Select the user the selection belongs to. To do not use a user select 
NO USER'),
@@ -2772,7 +2809,7 @@
                                        'value_priority'                        
        => $ticket['priority'],
                                        'lang_priority_statustext'              
=> lang('Select the priority the selection belongs to.'),
                                        'select_priority_name'                  
=> 'values[priority]',
-                                       'priority_list'                         
        => $this->bo->get_priority_list($ticket['priority']),
+                                       'priority_list'                         
        => array('options' => 
$this->bo->get_priority_list($ticket['priority'])),
 
                                        'lang_no_cat'                           
        => lang('no category'),
                                        'value_cat_id'                          
        => $this->cat_id,
@@ -2816,9 +2853,9 @@
                                        'textareacols'                          
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
                                        'textarearows'                          
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
                                        'order_cat_list'                        
        => $order_catetory,
-                                       'building_part_list'                    
=> array('status_list' => $this->bocommon->select_category_list(array('type'=> 
'building_part','selected' =>$ticket['building_part'], 'order' => 'id', 
'id_in_name' => 'num' ))),
-                                       'order_dim1_list'                       
        => array('status_list' => 
$this->bocommon->select_category_list(array('type'=> 'order_dim1','selected' 
=>$ticket['order_dim1'], 'order' => 'id', 'id_in_name' => 'num' ))),
-                                       'branch_list'                           
        => array('status_list' => 
execMethod('property.boproject.select_branch_list', $values['branch_id'])),
+                                       'building_part_list'                    
=> array('options' => $this->bocommon->select_category_list(array('type'=> 
'building_part','selected' =>$ticket['building_part'], 'order' => 'id', 
'id_in_name' => 'num' ))),
+                                       'order_dim1_list'                       
        => array('options' => 
$this->bocommon->select_category_list(array('type'=> 'order_dim1','selected' 
=>$ticket['order_dim1'], 'order' => 'id', 'id_in_name' => 'num' ))),
+                                       'branch_list'                           
        => array('options' => 
execMethod('property.boproject.select_branch_list', $values['branch_id'])),
                                );
 
                        //---datatable settings--------------------
@@ -3018,9 +3055,7 @@
                                        'lang_ticket'                           
        => lang('Ticket'),
                                        'table_header_additional_notes' => 
$table_header_additional_notes,
                                        'table_header_history'                  
=> $table_header_history,
-                                       'lang_status'                           
        => lang('Status'),
-                                       'status_name'                           
        => 'values[status]',
-                                       'status_list'                           
        => $this->bo->get_status_list($ticket['status']),
+                                       'status_list'                           
        => array('options' => $this->bo->get_status_list($ticket['status'])),
                                        'lang_status_statustext'                
=> lang('Set the status of the ticket'),
 
                                        'lang_no_user'                          
        => lang('Select user'),

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-01-14 17:05:34 UTC (rev 6781)
+++ trunk/property/setup/phpgw_no.lang  2011-01-15 23:52:04 UTC (rev 6782)
@@ -29,6 +29,7 @@
 actual cost    property        no      Faktisk kostnad
 actual_cost    property        no      Faktisk kostnad
 actual cost changed    property        no      Faktisk kostnad er endret
+actual cost has been updated   property        no      Faktisk kostnad er 
oppdatert
 actual cost - paid so far      property        no      Faktisk betalt - pr dd
 add a apartment        property        no      Legg til leilighet
 add a attrib   property        no      Legg til en attibutt
@@ -1011,6 +1012,7 @@
 minute property        no      Minutt
 minutes before the event       property        no      Minutter til hendelse
 Missing log message    property        no      Angi grunn for endring
+Missing value  property        no      Mangler verdi
 missing value for %1   property        no      Mangler verdi for %1
 month  property        no      Måned
 Monthly (by day)       property        no      Månedlig (dag)

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2011-01-14 17:05:34 UTC (rev 
6781)
+++ trunk/property/templates/base/tts.xsl       2011-01-15 23:52:04 UTC (rev 
6782)
@@ -483,7 +483,7 @@
                                                                                
<xsl:variable name="lang_priority_statustext"><xsl:value-of 
select="lang_priority_statustext"/></xsl:variable>
                                                                                
<xsl:variable name="select_priority_name"><xsl:value-of 
select="select_priority_name"/></xsl:variable>
                                                                                
<select name="{$select_priority_name}" 
onMouseover="window.status='{$lang_priority_statustext}'; return true;" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:apply-templates select="priority_list"/>
+                                                                               
        <xsl:apply-templates select="priority_list/options"/>
                                                                                
</select>                       
                                                                        </td>
                                                                </tr>
@@ -496,7 +496,7 @@
                                                                                
        <xsl:attribute name="title">
                                                                                
                <xsl:value-of select="php:function('lang', 'Set the status of 
the ticket')" />
                                                                                
        </xsl:attribute>
-                                                                               
        <xsl:apply-templates select="status_list"/>
+                                                                               
        <xsl:apply-templates select="status_list/options"/>
                                                                                
</select>                       
                                                                        </td>
                                                                </tr>
@@ -742,18 +742,6 @@
 
        </xsl:template>
 
-       <xsl:template match="priority_list">
-               <xsl:variable name="id"><xsl:value-of 
select="id"/></xsl:variable>
-               <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
-
 <!-- view -->
        <xsl:template match="view" xmlns:php="http://php.net/xsl";>
                <script type="text/javascript">
@@ -988,7 +976,7 @@
                                                        <xsl:variable 
name="lang_priority_statustext"><xsl:value-of select="php:function('lang', 
'Select the priority the selection belongs to')" /></xsl:variable>
                                                        <xsl:variable 
name="select_priority_name"><xsl:value-of 
select="select_priority_name"/></xsl:variable>
                                                        <select 
name="{$select_priority_name}" class="forms" title = 
"{$lang_priority_statustext}" 
onMouseover="window.status='{$lang_priority_statustext}'; return true;" 
onMouseout="window.status='';return true;">
-                                                               
<xsl:apply-templates select="priority_list"/>
+                                                               
<xsl:apply-templates select="priority_list/options"/>
                                                        </select>               
        
                                                </td>
                                        </tr>
@@ -999,12 +987,11 @@
                                                                        
<xsl:value-of select="php:function('lang', 'status')" />
                                                                </td>
                                                                <td>
-                                                                       
<xsl:variable name="status_name"><xsl:value-of 
select="status_name"/></xsl:variable>
-                                                                       <select 
name="{$status_name}" class="forms">
+                                                                       <select 
name="values[status]" class="forms">
                                                                                
<xsl:attribute name="title">
                                                                                
        <xsl:value-of select="php:function('lang', 'Set the status of the 
ticket')" />
                                                                                
</xsl:attribute>
-                                                                               
<xsl:apply-templates select="status_list"/>
+                                                                               
<xsl:apply-templates select="status_list/options"/>
                                                                        
</select>                       
                                                                </td>
                                                        </tr>
@@ -1213,7 +1200,7 @@
                                                                                
<option value="0">
                                                                                
        <xsl:value-of select="php:function('lang', 'select building part')" />
                                                                                
</option>
-                                                                               
<xsl:apply-templates select="building_part_list/status_list"/>
+                                                                               
<xsl:apply-templates select="building_part_list/options"/>
                                                                        
</select>
                                                                </td>
                                                        </tr>
@@ -1229,7 +1216,7 @@
                                                                                
<option value="0">
                                                                                
        <xsl:value-of select="php:function('lang', 'select branch')" />
                                                                                
</option>
-                                                                               
<xsl:apply-templates select="branch_list/status_list"/>
+                                                                               
<xsl:apply-templates select="branch_list/options"/>
                                                                        
</select>
                                                                </td>
                                                        </tr>
@@ -1245,7 +1232,7 @@
                                                                                
<option value="0">
                                                                                
        <xsl:value-of select="php:function('lang', 'order_dim1')" />
                                                                                
</option>
-                                                                               
<xsl:apply-templates select="order_dim1_list/status_list"/>
+                                                                               
<xsl:apply-templates select="order_dim1_list/options"/>
                                                                        
</select>
                                                                </td>
                                                        </tr>
@@ -1352,12 +1339,11 @@
                                                                <xsl:value-of 
select="php:function('lang', 'status')" />
                                                        </td>
                                                        <td>
-                                                               <xsl:variable 
name="status_name"><xsl:value-of select="status_name"/></xsl:variable>
-                                                               <select 
name="{$status_name}" class="forms">
+                                                               <select 
name="values[status]" class="forms">
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="php:function('lang', 'Set the status of the ticket')" />
                                                                        
</xsl:attribute>
-                                                                       
<xsl:apply-templates select="status_list"/>
+                                                                       
<xsl:apply-templates select="status_list/options"/>
                                                                </select>       
                
                                                        </td>
                                                </tr>
@@ -1689,9 +1675,8 @@
                                </td>
                                <td>
                                <xsl:variable 
name="lang_status_statustext"><xsl:value-of 
select="lang_status_statustext"/></xsl:variable>
-                               <xsl:variable name="status_name"><xsl:value-of 
select="status_name"/></xsl:variable>
-                                       <select name="{$status_name}" 
class="forms" onMouseover="window.status='{$lang_status_statustext}'; return 
true;" onMouseout="window.status='';return true;">
-                                                       <xsl:apply-templates 
select="status_list"/>
+                                       <select name="values[status]" 
class="forms" onMouseover="window.status='{$lang_status_statustext}'; return 
true;" onMouseout="window.status='';return true;">
+                                                       <xsl:apply-templates 
select="status_list/options"/>
                                        </select>                       
                                </td>
                        </tr>
@@ -1882,7 +1867,7 @@
        </xsl:template>
 
 
-       <xsl:template match="priority_list">
+       <xsl:template match="options">
                <option value="{id}">
                        <xsl:if test="selected != 0">
                                <xsl:attribute name="selected" value="selected" 
/>
@@ -1891,15 +1876,6 @@
                </option>
        </xsl:template>
 
-       <xsl:template match="status_list">
-               <option value="{id}">
-                       <xsl:if test="selected != 0">
-                               <xsl:attribute name="selected" value="selected" 
/>
-                       </xsl:if>
-                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
-               </option>
-       </xsl:template>
-
        <xsl:template match="vendor_email" xmlns:php="http://php.net/xsl";>
                <tr>
                        <td>




reply via email to

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