[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11559] Historylog
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11559] Historylog |
Date: |
Sun, 22 Dec 2013 21:25:13 +0000 |
Revision: 11559
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11559
Author: sigurdne
Date: 2013-12-22 21:25:11 +0000 (Sun, 22 Dec 2013)
Log Message:
-----------
Historylog
Modified Paths:
--------------
trunk/property/inc/class.boworkorder.inc.php
trunk/property/inc/class.historylog.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/setup/phpgw_no.lang
Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php 2013-12-21 21:01:26 UTC
(rev 11558)
+++ trunk/property/inc/class.boworkorder.inc.php 2013-12-22 21:25:11 UTC
(rev 11559)
@@ -713,7 +713,7 @@
$record_history[$i]['value_old_value'] = $category[0]['name'];
}
}
- else if ($value['status'] == 'S' ||
$value['status'] == 'SO')
+ else if ($value['status'] == 'S' ||
$value['status'] == 'SO' || $value['status'] == 'R' || $value['status'] == 'X')
{
$record_history[$i]['value_new_value']
= $status_text[$value['new_value']];
$record_history[$i]['value_old_value']
= $status_text[$value['old_value']];
Modified: trunk/property/inc/class.historylog.inc.php
===================================================================
--- trunk/property/inc/class.historylog.inc.php 2013-12-21 21:01:26 UTC (rev
11558)
+++ trunk/property/inc/class.historylog.inc.php 2013-12-22 21:25:11 UTC (rev
11559)
@@ -131,11 +131,6 @@
function add($status,$record_id,$new_value,$old_value
='',$attrib_id='', $date=0,$detail_id='')
{
- $attrib_id_field = $this->attrib_id_field;
- $attrib_id_value = (isset($attrib_id) && $attrib_id ?
",$attrib_id" : '');
- $detail_id_field = $this->detail_id_field;
- $detail_id_value = (isset($detail_id) && $detail_id ?
",$detail_id" : '');
-
if($date)
{
$timestamp =
date($this->db->date_format(),$date);
@@ -145,13 +140,30 @@
$timestamp = date($this->db->datetime_format());
}
- $this->db->query("INSERT INTO {$this->table}
(history_record_id,"
- .
"history_appname,history_owner,history_status,history_new_value,
history_old_value, history_timestamp $attrib_id_field $detail_id_field) "
- . "values ('{$record_id}','{$this->appname}','"
- . $this->account . "','$status','"
- . $this->db->db_addslashes($new_value) . "','"
- . $this->db->db_addslashes($old_value) . "','"
. $timestamp
- . "' $attrib_id_value
$detail_id_value)",__LINE__,__FILE__);
+ $value_set = array
+ (
+ 'history_record_id' => $record_id,
+ 'history_appname' =>
$this->appname,
+ 'history_owner' =>
$this->account,
+ 'history_status' => $status,
+ 'history_new_value' =>
$this->db->db_addslashes($new_value),
+ 'history_old_value' =>
$this->db->db_addslashes($old_value),
+ 'history_timestamp' => $timestamp
+ );
+
+ if($this->attrib_id_field && $attrib_id)
+ {
+ $value_set[$this->attrib_id_field] =
$attrib_id;
+ }
+ if($this->detail_id_field && $detail_id)
+ {
+ $value_set[$this->detail_id_field] =
$detail_id;
+ }
+
+ $cols = implode(',', array_keys($value_set));
+ $values =
$this->db->validate_insert(array_values($value_set));
+ $sql = "INSERT INTO {$this->table} ({$cols}) VALUES
({$values})";
+ $this->db->query($sql,__LINE__,__FILE__);
}
// array $filter_out
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2013-12-21 21:01:26 UTC (rev
11558)
+++ trunk/property/inc/class.soinvoice.inc.php 2013-12-22 21:25:11 UTC (rev
11559)
@@ -784,6 +784,7 @@
function update_invoice_sub($values)
{
+ $update_status = array();
$receipt = array();
$GLOBALS['phpgw']->db->transaction_begin();
@@ -897,11 +898,20 @@
}
- if (isset($update_status) AND is_array($update_status))
+ if ($update_status)
{
- $closed =
isset($this->config->config_data['workorder_closed_status']) &&
$this->config->config_data['workorder_closed_status'] ?
$this->config->config_data['workorder_closed_status'] : 'closed';
- $reopen =
isset($this->config->config_data['workorder_reopen_status']) &&
$this->config->config_data['workorder_reopen_status'] ?
$this->config->config_data['workorder_reopen_status'] : 're_opened';
+ $closed =
isset($this->config->config_data['workorder_closed_status']) &&
$this->config->config_data['workorder_closed_status'] ?
$this->config->config_data['workorder_closed_status'] : '';
+ $reopen =
isset($this->config->config_data['workorder_reopen_status']) &&
$this->config->config_data['workorder_reopen_status'] ?
$this->config->config_data['workorder_reopen_status'] : '';
+ if(!$closed)
+ {
+ throw new
Exception('property_soinvoice::update_invoice_sub() - "workorder_closed_status"
not configured');
+ }
+ if(!$reopen)
+ {
+ throw new
Exception('property_soinvoice::update_invoice_sub() - "workorder_reopen_status"
not configured');
+ }
+
$status_code=array('X' => $closed,'R' =>
$reopen);
$historylog_workorder =
CreateObject('property.historylog','workorder');
@@ -2341,7 +2351,7 @@
*/
if( isset($data['order_id']) && $data['order_id'])
{
- if(isset($data['close_order']) &&
$data['close_order'])
+ if(isset($data['close_order']) &&
$data['close_order'] && !$data['close_order_orig'])
{
execMethod('property.soworkorder.close_orders',array($data['order_id']));
}
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2013-12-21 21:01:26 UTC
(rev 11558)
+++ trunk/property/inc/class.soworkorder.inc.php 2013-12-22 21:25:11 UTC
(rev 11559)
@@ -1648,8 +1648,13 @@
{
$config =
CreateObject('phpgwapi.config','property');
$config->read();
- $closed =
isset($config->config_data['workorder_closed_status']) &&
$config->config_data['workorder_closed_status'] ?
$config->config_data['workorder_closed_status'] : 'closed';
+ $closed =
isset($config->config_data['workorder_closed_status']) &&
$config->config_data['workorder_closed_status'] ?
$config->config_data['workorder_closed_status'] : '';
+ if(!$closed)
+ {
+ throw new
Exception('property_soworkorder::close_orders() - "workorder_closed_status" not
configured');
+ }
+
if ( $this->db->get_transaction() )
{
$this->global_lock = true;
@@ -1662,6 +1667,7 @@
if ($orders && is_array($orders))
{
+ $lang_closed = lang('closed');
$historylog_workorder =
CreateObject('property.historylog','workorder');
foreach ($orders as $id)
@@ -1671,14 +1677,10 @@
switch ( $this->db->f('type') )
{
case 'workorder':
-
$historylog_workorder->add($entry,$id,$closed);
+
$historylog_workorder->add('X',$id,$closed);
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder SET status='{$closed}' WHERE
id = '{$id}'");
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder SET paid_percent=100 WHERE
id= '{$id}'");
- $receipt['message'][] =
array('msg'=>lang('Workorder %1 is %2',$id, $closed));
-
$this->db->query("SELECT project_id FROM fm_workorder WHERE
id='{$id}'",__LINE__,__FILE__);
-
$this->db->next_record();
- $project_id =
$this->db->f('project_id');
- //
$this->update_planned_cost($project_id);
+ $receipt['message'][] =
array('msg'=>lang('Workorder %1 is %2',$id, $lang_closed));
break;
}
}
@@ -1705,22 +1707,27 @@
$config =
CreateObject('phpgwapi.config','property');
$config->read();
- $reopen =
isset($config->config_data['workorder_reopen_status']) &&
$config->config_data['workorder_reopen_status'] ?
$config->config_data['workorder_reopen_status'] : 're_opened';
- $status_code=array('X' => $closed,'R' => $reopen);
+ $reopen =
isset($config->config_data['workorder_reopen_status']) &&
$config->config_data['workorder_reopen_status'] ?
$config->config_data['workorder_reopen_status'] : '';
+ if(!$reopen)
+ {
+ throw new
Exception('property_soworkorder::close_orders() - "workorder_reopen_status" not
configured');
+ }
+
+ $lang_reopen = lang('Re-opened');
+
$historylog_workorder =
CreateObject('property.historylog','workorder');
foreach ($orders as $id)
{
- $id = (int) $id;
- $this->db->query("SELECT type FROM fm_orders
WHERE id={$id}",__LINE__,__FILE__);
+ $this->db->query("SELECT type FROM fm_orders
WHERE id='{$id}'",__LINE__,__FILE__);
$this->db->next_record();
switch ( $this->db->f('type') )
{
case 'workorder':
$historylog_workorder->add('R',
$id, $reopen);
-
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status='{$reopen}' WHERE
id = {$id}");
- $receipt['message'][] =
array('msg'=>lang('Workorder %1 is %2',$id, $status_code[$entry]));
+
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status='{$reopen}' WHERE
id = '{$id}'");
+ $receipt['message'][] =
array('msg'=>lang('Workorder %1 is %2',$id, $lang_reopen));
}
}
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2013-12-21 21:01:26 UTC (rev 11558)
+++ trunk/property/setup/phpgw_no.lang 2013-12-22 21:25:11 UTC (rev 11559)
@@ -1376,7 +1376,7 @@
rental agreement categories property no Leieavtale kategorier
rental agreement item attributes property no Attributter for
utleie - detaljer
rental type property no Utleietype
-re-opened property no gjenåpnet
+re-opened property no Gjenåpnet
repeat property no serie
repeat type property no type serie
repeat day property no gjenta dag
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11559] Historylog,
Sigurd Nes <=