fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9084] property: modified timestamp on tickets


From: Sigurd Nes
Subject: [Fmsystem-commits] [9084] property: modified timestamp on tickets
Date: Thu, 29 Mar 2012 17:10:11 +0000

Revision: 9084
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9084
Author:   sigurdne
Date:     2012-03-29 17:10:11 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
property: modified timestamp on tickets

Modified Paths:
--------------
    trunk/property/inc/class.sotts.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2012-03-29 12:58:33 UTC (rev 
9083)
+++ trunk/property/inc/class.sotts.inc.php      2012-03-29 17:10:11 UTC (rev 
9084)
@@ -436,7 +436,7 @@
 
                        $return_fields = 
"fm_tts_tickets.id,fm_tts_tickets.assignedto,fm_tts_tickets.status,fm_tts_tickets.user_id,"
                        . 
"fm_tts_tickets.subject,fm_tts_tickets.address,fm_tts_tickets.location_code,fm_tts_tickets.priority,fm_tts_tickets.cat_id,fm_tts_tickets.group_id,"
-                       . 
"fm_tts_tickets.entry_date,fm_tts_tickets.finnish_date,fm_tts_tickets.finnish_date2,fm_tts_tickets.order_id,fm_tts_tickets.vendor_id,fm_tts_tickets.actual_cost,"
+                       . 
"fm_tts_tickets.entry_date,fm_tts_tickets.modified_date,fm_tts_tickets.finnish_date,fm_tts_tickets.finnish_date2,fm_tts_tickets.order_id,fm_tts_tickets.vendor_id,fm_tts_tickets.actual_cost,"
                        . 
"fm_tts_tickets.budget,fm_tts_tickets.billable_hours,fm_district.descr as 
district,fm_tts_views.id as view,fm_location1.loc1_name {$result_order_field}";
 
                        //fm_tts_tickets.* ,fm_location1.loc1_name, 
fm_tts_views.id as view {$result_order_field},fm_district.descr as district
@@ -525,6 +525,7 @@
                                                        'cat_id'                
        => $this->db->f('cat_id'),
                                                        'group_id'              
        => $this->db->f('group_id'),
                                                        'entry_date'            
=> $this->db->f('entry_date'),
+                                                       'modified_date'         
=> $this->db->f('modified_date'),
                                                        'finnish_date'          
=> $this->db->f('finnish_date'),
                                                        'finnish_date2'         
=> $this->db->f('finnish_date2'),
                                                        'order_id'              
        => $this->db->f('order_id'),
@@ -609,6 +610,8 @@
                                $ticket['billable_hours']       = 
$this->db->f('billable_hours');
                                $ticket['branch_id']            = 
$this->db->f('branch_id');
                                $ticket['entry_date']           = 
$this->db->f('entry_date');
+                               $ticket['modified_date']        = 
$this->db->f('modified_date');
+
                                $user_id=(int)$this->db->f('user_id');
 
                                $ticket['user_name']    = 
$GLOBALS['phpgw']->accounts->get($user_id)->__toString();
@@ -731,6 +734,7 @@
                        $value_set['location_code']     = 
$ticket['location_code'];
                        $value_set['address']           = $address;
                        $value_set['entry_date']        = time();
+                       $value_set['modified_date']     = time();
                        $value_set['finnish_date']      = 
$ticket['finnish_date'];
                        $value_set['contact_id']        = $ticket['contact_id'];
                        $value_set['publish_note']      = 1;
@@ -872,13 +876,14 @@
                                }
                        }
 
-                       $this->db->transaction_commit();
-
                        if ($this->fields_updated)
                        {
+                               $this->db->query('UPDATE fm_tts_tickets SET 
modified_date= ' . time() . " WHERE id={$id}",__LINE__,__FILE__);
                                $receipt['message'][]= array('msg' => 
lang('Ticket %1 has been updated',$id));
                        }
 
+                       $this->db->transaction_commit();
+
                        return $receipt;
 
                }
@@ -901,15 +906,18 @@
                                
$this->historylog->add('P',$id,$ticket['priority'],$oldpriority);
                        }
 
-                       $this->db->transaction_commit();
-
                        if ($this->fields_updated)
                        {
+                               $this->db->query('UPDATE fm_tts_tickets SET 
modified_date= ' . time() . " WHERE id={$id}",__LINE__,__FILE__);
                                $receipt['message'][]= array('msg' => 
lang('Ticket %1 has been updated',$id));
                        }
+
+                       $this->db->transaction_commit();
+
                        return $receipt;
                }
 
+
                function update_ticket(&$ticket,$id = 0, $receipt = array(), 
$values_attribute = array())
                {
                        $this->fields_updated = array();
@@ -1301,6 +1309,7 @@
                                }
                        }
 
+                       $value_set['modified_date']     = time();
                        $value_set['vendor_id']         = $ticket['vendor_id'];
                        $value_set['b_account_id']      = 
$ticket['b_account_id'];
                        $value_set['order_descr']       = 
$this->db->db_addslashes($ticket['order_descr']);
@@ -1313,35 +1322,9 @@
 
                        $this->db->transaction_commit();
 
-                       if (isset($this->fields_updated))
+                       if (isset($this->fields_updated) && 
$this->fields_updated)
                        {
                                $receipt['message'][]= array('msg' => 
lang('Ticket has been updated'));
-
-/*
-                               $criteria = array
-                                       (
-                                               'appname'       => 'property',
-                                               'location'      => 
$this->acl_location,
-                                               'allrows'       => true
-                                       );
-
-                               $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
-
-                               foreach ( $custom_functions as $entry )
-                               {
-                                       // prevent path traversal
-                                       if ( preg_match('/\.\./', 
$entry['file_name']) )
-                                       {
-                                               continue;
-                                       }
-
-                                       $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
-                                       if ( $entry['active'] && is_file($file) 
)
-                                       {
-                                               require_once $file;
-                                       }
-                               }
-*/
                        }
                        return $receipt;
                }

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-03-29 12:58:33 UTC (rev 9083)
+++ trunk/property/setup/setup.inc.php  2012-03-29 17:10:11 UTC (rev 9084)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.637';
+       $setup_info['property']['version']              = '0.9.17.638';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-03-29 12:58:33 UTC (rev 
9083)
+++ trunk/property/setup/tables_current.inc.php 2012-03-29 17:10:11 UTC (rev 
9084)
@@ -929,7 +929,7 @@
                                'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
                                'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
                                'floor' => array('type' => 
'varchar','precision' => '6','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => True),
                                'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
                                'contact_email' => array('type' => 
'varchar','precision' => '64','nullable' => True),
                                'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
@@ -948,7 +948,8 @@
                                'building_part'=> array('type' => 
'varchar','precision' => 4,'nullable' => True),
                                'order_dim1'=> array('type' => 
'int','precision' => 4,'nullable' => True),
                                'publish_note'=> array('type' => 
'int','precision' => 2,'nullable' => True),
-                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'modified_date' => array('type' => 
'int','precision' => '4','nullable' => True),
                        ),
                        'pk' => array('id'),
                        'ix' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-03-29 12:58:33 UTC (rev 
9083)
+++ trunk/property/setup/tables_update.inc.php  2012-03-29 17:10:11 UTC (rev 
9084)
@@ -6022,11 +6022,9 @@
                }
        }
 
-
-
        /**
-       * Update property version from 0.9.17.635 to 0.9.17.636
-       * Add percent value to tax-code
+       * Update property version from 0.9.17.636 to 0.9.17.637
+       * Add approve tag and mail recipients to workorders
        * 
        */
        $test[] = '0.9.17.636';
@@ -6044,26 +6042,54 @@
                }
        }
 
-
-
        /**
-       * Update property version from 0.9.17.607 to 0.9.17.608
-       * Add more room for address at tickets
+       * Update property version from 0.9.17.637 to 0.9.17.638
+       * Modified timestamp til tickets
        * 
        */
-
-/*
-       $test[] = '0.9.17.607';
-       function property_upgrade0_9_17_608()
+       $test[] = '0.9.17.637';
+       function property_upgrade0_9_17_637()
        {
+               date_default_timezone_set('UTC');
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','modified_date',array('type'
 => 'int','precision' => 4, 'nullable' => True));
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_tts_tickets','address',array('type'
 => 'varchar','precision' => '255','nullable' => True));
+               
+               $sql = 'SELECT id, entry_date FROM fm_tts_tickets';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               $tickets = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $tickets[] = array
+                       (
+                               'id'                    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'entry_date'    => 
$GLOBALS['phpgw_setup']->oProc->f('entry_date')
+                       );
+               }
+
+               foreach ($tickets as $ticket)
+               {
+                       $sql = "SELECT history_timestamp FROM fm_tts_history 
WHERE history_record_id = {$ticket['id']} ORDER BY history_timestamp DESC";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+                       if($GLOBALS['phpgw_setup']->oProc->next_record())
+                       {
+                               $modified_date = 
(int)strtotime($GLOBALS['phpgw_setup']->oProc->f('history_timestamp'));
+                       }
+                       else
+                       {
+                               $modified_date = (int)$ticket['entry_date'];
+                       }
+                       $sql = "UPDATE fm_tts_tickets SET modified_date = 
{$modified_date} WHERE id = {$ticket['id']}";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               }
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
-                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.608';
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.638';
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
-*/
-




reply via email to

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