fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16824] property: history log entries on bulk update


From: sigurdne
Subject: [Fmsystem-commits] [16824] property: history log entries on bulk update budget
Date: Sun, 4 Jun 2017 13:48:34 -0400 (EDT)

Revision: 16824
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16824
Author:   sigurdne
Date:     2017-06-04 13:48:34 -0400 (Sun, 04 Jun 2017)
Log Message:
-----------
property: history log entries on bulk update budget

Modified Paths:
--------------
    trunk/property/inc/class.boproject.inc.php
    trunk/property/inc/class.boworkorder.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiworkorder.inc.php

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2017-06-02 02:03:11 UTC (rev 
16823)
+++ trunk/property/inc/class.boproject.inc.php  2017-06-04 17:48:34 UTC (rev 
16824)
@@ -868,6 +868,7 @@
                                        $record_history[$i]['value_new_value'] 
= '';
                                }
 
+                               $record_history[$i]['#'] = $i +1;
                                $i++;
                        }
 

Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php        2017-06-02 02:03:11 UTC 
(rev 16823)
+++ trunk/property/inc/class.boworkorder.inc.php        2017-06-04 17:48:34 UTC 
(rev 16824)
@@ -760,7 +760,7 @@
                                {
                                        $record_history[$i]['value_new_value'] 
= '';
                                }
-
+                               $record_history[$i]['#'] = $i +1;
                                $i++;
                        }
 

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2017-06-02 02:03:11 UTC (rev 
16823)
+++ trunk/property/inc/class.soproject.inc.php  2017-06-04 17:48:34 UTC (rev 
16824)
@@ -38,6 +38,7 @@
                var $total_records = 0;
                private $global_lock = false;
                private $vendor_list = array();
+               protected $historylog;
 
                function __construct()
                {
@@ -57,6 +58,8 @@
                        $this->grants = $this->acl->get_grants2('property', 
'.project');
                        $this->config = CreateObject('phpgwapi.config', 
'property');
                        $this->config->read();
+                       $this->historylog = CreateObject('property.historylog', 
'project');
+
                }
 
                function select_status_list()
@@ -2694,6 +2697,9 @@
 
                private function transfer_budget( $id, $budget, $year )
                {
+
+                       $historylog = & $this->historylog;
+
                        $this->db->transaction_begin();
 
                        $id = (int)$id;
@@ -2762,6 +2768,8 @@
                                }
 
                                $this->update_budget($id, $year, 
$periodization_id, $new_budget, true, 'update', true);
+                               $historylog->add('B', $id, $new_budget);
+                               $historylog->add('RM', $id, 'Budsjett oppdatert 
via masseoppdatering');
                        }
                        else if ($project_type_id == 1 || $project_type_id == 
4)//operation or maintenance
                        {
@@ -2769,6 +2777,10 @@
                                {
                                        $this->db->query("UPDATE 
fm_project_budget SET active = 0 WHERE project_id = {$id}", __LINE__, 
__FILE__); // previous
                                        $this->update_budget($id, $year, 
$periodization_id, (int)$budget['budget_amount'], true, 'update', true);
+
+                                       $historylog->add('B', $id, 
(int)$budget['budget_amount']);
+                                       $historylog->add('RM', $id, 'Budsjett 
oppdatert via masseoppdatering');
+
                                }
                        }
 

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2017-06-02 02:03:11 UTC 
(rev 16823)
+++ trunk/property/inc/class.soworkorder.inc.php        2017-06-04 17:48:34 UTC 
(rev 16824)
@@ -37,8 +37,8 @@
 
                var $total_records = 0;
                protected $global_lock = false;
-
-               function __construct()
+               protected $historylog;
+                                       function __construct()
                {
                        $this->account = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon = CreateObject('property.bocommon');
@@ -51,6 +51,7 @@
                        $this->acl = & $GLOBALS['phpgw']->acl;
                        $this->acl->set_account_id($this->account);
                        $this->grants = $this->acl->get_grants2('property', 
'.project');
+                       $this->historylog = CreateObject('property.historylog', 
'workorder');
                }
 
                function next_id()
@@ -1203,7 +1204,7 @@
                function add( $workorder )
                {
                        $receipt = array();
-                       $historylog = CreateObject('property.historylog', 
'workorder');
+                       $historylog = & $this->historylog;
                        $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
                        $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
                        $workorder['billable_hours'] = (float)str_replace(',', 
'.', $workorder['billable_hours']);
@@ -1404,7 +1405,7 @@
                {
                        $config = CreateObject('phpgwapi.config','property');
                        $config->read_repository();
-                       $historylog = CreateObject('property.historylog', 
'workorder');
+                       $historylog = & $this->historylog;
                        $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
                        $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
                        $workorder['billable_hours'] = (float)str_replace(',', 
'.', $workorder['billable_hours']);
@@ -1859,7 +1860,7 @@
                        if ($orders && is_array($orders))
                        {
                                $lang_closed = lang('closed');
-                               $historylog_workorder = 
CreateObject('property.historylog', 'workorder');
+                               $historylog_workorder = & $this->historylog;
 
                                foreach ($orders as $id)
                                {
@@ -1907,7 +1908,7 @@
 
                        $lang_reopen = lang('Re-opened');
 
-                       $historylog_workorder = 
CreateObject('property.historylog', 'workorder');
+                       $historylog_workorder = & $this->historylog;
 
                        foreach ($orders as $id)
                        {
@@ -2700,6 +2701,8 @@
                 * */
                public function transfer_budget( $id, $budget, $year )
                {
+                       $historylog = & $this->historylog;
+
                        if ($this->db->get_transaction())
                        {
                                $this->global_lock = true;
@@ -2731,6 +2734,7 @@
 
                        phpgwapi_cache::system_clear('property', 
"budget_order_{$id}");
 
+                       $updated_budget = false;
                        if ($continuous)
                        {
                                $this->db->query("UPDATE fm_workorder_budget 
SET active = 0 WHERE order_id = {$id} AND year = {$latest_year}", __LINE__, 
__FILE__);
@@ -2737,6 +2741,8 @@
                                if ($budget['budget_amount'])
                                {
                                        $this->_update_order_budget($id, $year, 
$periodization_id, (int)$budget['budget_amount'], 
(int)$budget['budget_amount'], (int)$budget['budget_amount'], $action = 
'update', true);
+                                       $historylog->add('B', $id, 
(int)$budget['budget_amount']);
+                                       $updated_budget = true;
                                }
                        }
                        else if ($project_type_id == 1)//operation
@@ -2756,6 +2762,8 @@
                                $transferred = $this->_update_order_budget($id, 
$latest_year, $periodization_id, $paid_last_year, $paid_last_year, 
$paid_last_year, $action = 'update', $activate = 0);
 
                                $this->_update_order_budget($id, $year, 
$periodization_id, (int)$budget['budget_amount'], 
(int)$budget['budget_amount'], (int)$budget['budget_amount'], $action = 
'update', true);
+                               $historylog->add('B', $id, 
(int)$budget['budget_amount']);
+                               $updated_budget = true;
 
                                $this->db->query("UPDATE fm_workorder_budget 
SET active = 0 WHERE order_id = {$id} AND year = {$latest_year}", __LINE__, 
__FILE__);
 
@@ -2819,8 +2827,15 @@
                                }
 
                                $this->_update_order_budget($id, $year, 
$periodization_id, $new_budget, $new_budget, $new_budget, $action = 'update', 
true);
+                               $historylog->add('B', $id, (int)$new_budget);
+                               $updated_budget = true;
                        }
 //die();
+                       if($updated_budget)
+                       {
+                               $historylog->add('RM', $id, 'Budsjett oppdatert 
via masseoppdatering');
+                       }
+
                        if (!$this->global_lock)
                        {
                                $this->db->transaction_commit();
@@ -3021,7 +3036,7 @@
                        $order_id = $data['order_id'];
                        $status = $data['status'];
 
-                       $historylog = CreateObject('property.historylog', 
'workorder');
+                       $historylog = & $this->historylog;
 
                        $this->db->query("SELECT status FROM fm_workorder WHERE 
id = {$order_id}", __LINE__, __FILE__);
                        $this->db->next_record();

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2017-06-02 02:03:11 UTC (rev 
16823)
+++ trunk/property/inc/class.uiproject.inc.php  2017-06-04 17:48:34 UTC (rev 
16824)
@@ -1883,11 +1883,12 @@
 
                        $history_def = array
                                (
-                               array('key' => 'value_date', 'label' => 
lang('Date'), 'sortable' => true),
-                               array('key' => 'value_user', 'label' => 
lang('User'), 'Action' => true),
-                               array('key' => 'value_action', 'label' => 
lang('action'), 'sortable' => true),
-                               array('key' => 'value_old_value', 'label' => 
lang('old value'), 'sortable' => true),
-                               array('key' => 'value_new_value', 'label' => 
lang('new value'), 'sortable' => true)
+                               array('key' => '#',     'label' => '#', 
'sortable' =>true),
+                               array('key' => 'value_date', 'label' => 
lang('Date'), 'sortable' => false),
+                               array('key' => 'value_user', 'label' => 
lang('User'), 'sortable' => false),
+                               array('key' => 'value_action', 'label' => 
lang('action'), 'sortable' => false),
+                               array('key' => 'value_old_value', 'label' => 
lang('old value'), 'sortable' => false),
+                               array('key' => 'value_new_value', 'label' => 
lang('new value'), 'sortable' => false)
                        );
 
                        $datatable_def[] = array

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2017-06-02 02:03:11 UTC 
(rev 16823)
+++ trunk/property/inc/class.uiworkorder.inc.php        2017-06-04 17:48:34 UTC 
(rev 16824)
@@ -1718,14 +1718,19 @@
                        $history_def = array
                                (
                                array(
+                                       'key' => '#',
+                                       'label' => '#',
+                                       'sortable' =>true,
+                                       'resizeable' => true),
+                               array(
                                        'key' => 'value_date',
                                        'label' => lang('Date'),
-                                       'sortable' => true,
+                                       'sortable' =>false,
                                        'resizeable' => true),
                                array(
                                        'key' => 'value_user',
                                        'label' => lang('User'),
-                                       'Action' => true,
+                                       'sortable' =>false,
                                        'resizeable' => true),
                                array(
                                        'key' => 'value_action',
@@ -1735,12 +1740,12 @@
                                array(
                                        'key' => 'value_old_value',
                                        'label' => lang('old value'),
-                                       'sortable' => true,
+                                       'sortable' => false,
                                        'resizeable' => true),
                                array(
                                        'key' => 'value_new_value',
                                        'label' => lang('New Value'),
-                                       'sortable' => true,
+                                       'sortable' => false,
                                        'resizeable' => true)
                        );
 




reply via email to

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