fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11280] property: add history on tenant claim


From: Sigurd Nes
Subject: [Fmsystem-commits] [11280] property: add history on tenant claim
Date: Fri, 06 Sep 2013 13:20:38 +0000

Revision: 11280
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11280
Author:   sigurdne
Date:     2013-09-06 13:20:36 +0000 (Fri, 06 Sep 2013)
Log Message:
-----------
property: add history on tenant claim

Modified Paths:
--------------
    trunk/property/inc/class.historylog.inc.php
    trunk/property/inc/class.sotenant_claim.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.historylog.inc.php
===================================================================
--- trunk/property/inc/class.historylog.inc.php 2013-09-06 09:29:20 UTC (rev 
11279)
+++ trunk/property/inc/class.historylog.inc.php 2013-09-06 13:20:36 UTC (rev 
11280)
@@ -99,6 +99,10 @@
                                        $this->attrib_id_field = 
',history_attrib_id';
                                        $this->detail_id_field = 
',history_detail_id';
                                break;
+                               case 'tenant_claim':
+                                       $this->table='fm_tenant_claim_history';
+                                       break;
+                               
                        }
 
                        $this->appname = $appname;

Modified: trunk/property/inc/class.sotenant_claim.inc.php
===================================================================
--- trunk/property/inc/class.sotenant_claim.inc.php     2013-09-06 09:29:20 UTC 
(rev 11279)
+++ trunk/property/inc/class.sotenant_claim.inc.php     2013-09-06 13:20:36 UTC 
(rev 11280)
@@ -277,8 +277,17 @@
 
                function edit($claim)
                {
+                       $historylog     = 
CreateObject('property.historylog','tenant_claim');
+
                        $this->db->transaction_begin();
 
+                       $this->db->query("select status from fm_tenant_claim 
where id=" . (int)$claim['claim_id'],__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $old_status                     = 
$this->db->f('status');
+
+
+
                        $claim['name'] = 
$this->db->db_addslashes($claim['name']);
                        $claim['amount'] =  
str_replace(",",".",$claim['amount']);
 
@@ -294,10 +303,15 @@
 
                        $value_set      = 
$this->db->validate_update($value_set);
 
-                       $this->db->query("UPDATE fm_tenant_claim set $value_set 
 WHERE id=" . (int)$claim['claim_id'],__LINE__,__FILE__);
+                       $claim_id = (int)$claim['claim_id'];
+                       $this->db->query("UPDATE fm_tenant_claim set 
{$value_set} WHERE id={$claim_id}",__LINE__,__FILE__);
 
-                       $claim_id = $claim['claim_id'];
+                       if($old_status != $claim['status'])
+                       {
 
+                               $historylog->add('S', $claim_id, 
$claim['status'], $old_status);
+                       }
+
                        $this->interlink->delete_from_target('property', 
'.tenant_claim', $claim_id, $this->db);
 
                        $this->db->query("UPDATE fm_workorder set claim_issued 
= NULL WHERE project_id = {$claim['project_id']}" ,__LINE__,__FILE__);

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2013-09-06 09:29:20 UTC (rev 11279)
+++ trunk/property/setup/setup.inc.php  2013-09-06 13:20:36 UTC (rev 11280)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.669';
+       $setup_info['property']['version']              = '0.9.17.670';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -192,6 +192,7 @@
                'fm_cron_log',
                'fm_tenant_claim',
                'fm_tenant_claim_category',
+               'fm_tenant_claim_history',
                'fm_budget_basis',
                'fm_budget',
                'fm_budget_period',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2013-09-06 09:29:20 UTC (rev 
11279)
+++ trunk/property/setup/tables_current.inc.php 2013-09-06 13:20:36 UTC (rev 
11280)
@@ -1801,6 +1801,22 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_tenant_claim_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_owner' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2013-09-06 09:29:20 UTC (rev 
11279)
+++ trunk/property/setup/tables_update.inc.php  2013-09-06 13:20:36 UTC (rev 
11280)
@@ -7546,7 +7546,6 @@
        }
 
 
-
        /**
        * Update property version from 0.9.17.668 to 0.9.17.669
        * Add check for missing budgets
@@ -7589,3 +7588,42 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+
+       /**
+       * Update property version from 0.9.17.669 to 0.9.17.670
+       * Add history for tenant claim
+       */
+       $test[] = '0.9.17.669';
+       function property_upgrade0_9_17_669()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_tenant_claim_history', array(
+                               'fd' => array(
+                                       'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                                       'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                                       'history_new_value' => array('type' => 
'text','nullable' => False),
+                                       'history_old_value' => array('type' => 
'text','nullable' => true),
+                                       'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                               ),
+                               'pk' => array('history_id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.670';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+




reply via email to

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