[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12018] property: fix conditional ticket update and a
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12018] property: fix conditional ticket update and add calculation import to workorder |
Date: |
Mon, 23 Jun 2014 12:32:11 +0000 |
Revision: 12018
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12018
Author: sigurdne
Date: 2014-06-23 12:32:10 +0000 (Mon, 23 Jun 2014)
Log Message:
-----------
property: fix conditional ticket update and add calculation import to workorder
Modified Paths:
--------------
trunk/property/inc/class.botts.inc.php
trunk/property/inc/class.bowo_hour.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.sotts.inc.php
trunk/property/inc/class.sowo_hour.inc.php
trunk/property/inc/class.uitts.inc.php
trunk/property/inc/class.uiwo_hour.inc.php
trunk/property/js/yahoo/tts.index.simple.js
trunk/property/templates/base/wo_hour.xsl
Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.botts.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -1408,7 +1408,7 @@
$values_attribute =
$this->custom->convert_attribute_save($values_attribute);
}
- $receipt = $this->so->update_ticket($data, $id,
$receipt, $values_attribute);
+ $receipt = $this->so->update_ticket($data, $id,
$receipt, $values_attribute, $this->simple);
$this->fields_updated = $this->so->fields_updated;
$criteria = array
Modified: trunk/property/inc/class.bowo_hour.inc.php
===================================================================
--- trunk/property/inc/class.bowo_hour.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.bowo_hour.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -423,10 +423,9 @@
{
if((int)$entry[4] > 0)
{
- //_debug_array($entry[5]);
- //_debug_array($entry[4]);
$values = array
(
+ 'activity_num'
=> $entry[0],
'descr'
=> $entry[1],
'unit'
=> 8, // FIXME
'cost'
=> $entry[5],
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.soinvoice.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -1414,7 +1414,7 @@
if(isset($this->config->config_data['invoice_acl']) &&
$this->config->config_data['invoice_acl'] == 'dimb')
{
- $sql = "SELECT
DISTINCT fm_ecodimb.* FROM fm_ecodimb {$this->db->join} fm_ecodimb_role_user ON
fm_ecodimb.id = fm_ecodimb_role_user.ecodimb"
+ $sql = "SELECT DISTINCT fm_ecodimb.* FROM
fm_ecodimb {$this->db->join} fm_ecodimb_role_user ON fm_ecodimb.id =
fm_ecodimb_role_user.ecodimb"
. ' WHERE fm_ecodimb_role_user.user_id = ' .
(int) $this->account_id
. ' AND expired_on IS NULL'
. ' ORDER BY descr ASC';
Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.sotts.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -1053,13 +1053,13 @@
}
- function update_ticket(&$ticket,$id = 0, $receipt = array(),
$values_attribute = array())
+ function update_ticket(&$ticket,$id = 0, $receipt = array(),
$values_attribute = array(), $simple = false)
{
$this->fields_updated = array();
$id = (int) $id;
$ticket['id'] = $id;
// DB Content is fresher than http posted value.
- $this->db->query("select * from fm_tts_tickets where
id='$id'",__LINE__,__FILE__);
+ $this->db->query("SELECT * FROM fm_tts_tickets WHERE
id='$id'",__LINE__,__FILE__);
$this->db->next_record();
$location_code =
$this->db->f('location_code');
@@ -1120,24 +1120,43 @@
** M - Mail sent to vendor
*/
- $this->db->query("UPDATE fm_tts_tickets SET
publish_note = NULL WHERE id = {$id}",__LINE__,__FILE__);
- $this->db->query("UPDATE fm_tts_history SET publish =
NULL WHERE history_record_id = {$id}",__LINE__,__FILE__);
- if(isset($ticket['publish_note']))
+ if(!$simple)
{
- foreach ($ticket['publish_note'] as
$publish_info)
+ $this->db->query("UPDATE fm_tts_tickets SET
publish_note = NULL WHERE id = {$id}",__LINE__,__FILE__);
+ $this->db->query("UPDATE fm_tts_history SET
publish = NULL WHERE history_record_id = {$id}",__LINE__,__FILE__);
+ if(isset($ticket['publish_note']))
{
- $note = explode('_', $publish_info);
- if(!$note[1])
+ foreach ($ticket['publish_note'] as
$publish_info)
{
- $this->db->query("UPDATE
fm_tts_tickets SET publish_note = 1 WHERE id = {$note[0]}",__LINE__,__FILE__);
+ $note = explode('_',
$publish_info);
+ if(!$note[1])
+ {
+
$this->db->query("UPDATE fm_tts_tickets SET publish_note = 1 WHERE id =
{$note[0]}",__LINE__,__FILE__);
+ }
+ else
+ {
+
$this->db->query("UPDATE fm_tts_history SET publish = 1 WHERE history_id =
{$note[1]}",__LINE__,__FILE__);
+ }
}
- else
- {
- $this->db->query("UPDATE
fm_tts_history SET publish = 1 WHERE history_id =
{$note[1]}",__LINE__,__FILE__);
- }
}
}
+ if (($old_note != $ticket['note']) && $ticket['note'])
+ {
+ $this->fields_updated[] = 'note';
+
$this->historylog->add('C',$id,$ticket['note'],$old_note);
+ $_history_id =
$this->db->get_last_insert_id('fm_tts_history','history_id');
+ $this->db->query("UPDATE fm_tts_history SET
publish = 1 WHERE history_id = $_history_id",__LINE__,__FILE__);
+ unset($_history_id);
+ }
+
+ if (isset($this->fields_updated) &&
$this->fields_updated && $simple)
+ {
+ $receipt['message'][]= array('msg' =>
lang('Ticket1 has been updated'));
+ $this->db->transaction_commit();
+ return $receipt;
+ }
+
$finnish_date = (isset($ticket['finnish_date']) ?
phpgwapi_datetime::date_to_timestamp($ticket['finnish_date']):'');
if ($oldfinnish_date && isset($ticket['finnish_date'])
&& $ticket['finnish_date'])
@@ -1253,13 +1272,6 @@
$this->historylog->add('T',$id,$ticket['cat_id'],$oldcat_id);
}
- if ($old_budget != $ticket['budget'])
- {
- $this->fields_updated[] = 'budget';
- $this->db->query("UPDATE fm_tts_tickets set
budget='" . (int)$ticket['budget']
- . "' where id='$id'",__LINE__,__FILE__);
-
$this->historylog->add('B',$id,$ticket['budget'],$old_budget);
- }
/*
if ($old_billable_rate != $ticket['billable_rate'])
{
@@ -1290,47 +1302,6 @@
$receipt['message'][]= array('msg' =>
lang('billable hours has been updated'));
}
- if ((int)$old_actual_cost !=
(int)$ticket['actual_cost'])
- {
- $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'));
- }
-
- if ((int)$old_order_cat_id !=
(int)$ticket['order_cat_id'])
- {
- $this->db->query("UPDATE fm_tts_tickets SET
order_cat_id='" . (int)$ticket['order_cat_id']
- . "' WHERE id='$id'",__LINE__,__FILE__);
- $receipt['message'][]= array('msg' =>
lang('order category has been updated'));
- $this->fields_updated[] = 'order_cat_id';
- }
-
- if ((int)$old_order_dim1 != (int)$ticket['order_dim1'])
- {
- $this->db->query("UPDATE fm_tts_tickets SET
order_dim1='" . (int)$ticket['order_dim1']
- . "' WHERE id='$id'",__LINE__,__FILE__);
- $receipt['message'][]= array('msg' =>
lang('order_dim1 has been updated'));
- $this->fields_updated[] = 'order_dim1';
- }
-
- if ($old_building_part != $ticket['building_part'])
- {
- $this->db->query("UPDATE fm_tts_tickets SET
building_part='" . $ticket['building_part']
- . "' WHERE id='$id'",__LINE__,__FILE__);
- $receipt['message'][]= array('msg' =>
lang('building part has been updated'));
- $this->fields_updated[] = 'building_part';
- }
-
- if (($old_note != $ticket['note']) && $ticket['note'])
- {
- $this->fields_updated[] = 'note';
-
$this->historylog->add('C',$id,$ticket['note'],$old_note);
- $_history_id =
$this->db->get_last_insert_id('fm_tts_history','history_id');
- $this->db->query("UPDATE fm_tts_history SET
publish = 1 WHERE history_id = $_history_id",__LINE__,__FILE__);
- unset($_history_id);
- }
-
if(isset($ticket['location']) && $ticket['location'])
{
$ticket['location_code'] = implode('-',
$ticket['location']);
@@ -1455,12 +1426,53 @@
if($order_add || $order_edit)
{
+ if ((int)$old_actual_cost !=
(int)$ticket['actual_cost'])
+ {
+ $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'));
+ }
+
+ if ((int)$old_order_cat_id !=
(int)$ticket['order_cat_id'])
+ {
+ $this->db->query("UPDATE fm_tts_tickets
SET order_cat_id='" . (int)$ticket['order_cat_id']
+ . "' WHERE
id='$id'",__LINE__,__FILE__);
+ $receipt['message'][]= array('msg' =>
lang('order category has been updated'));
+ $this->fields_updated[] =
'order_cat_id';
+ }
+
+ if ((int)$old_order_dim1 !=
(int)$ticket['order_dim1'])
+ {
+ $this->db->query("UPDATE fm_tts_tickets
SET order_dim1='" . (int)$ticket['order_dim1']
+ . "' WHERE
id='$id'",__LINE__,__FILE__);
+ $receipt['message'][]= array('msg' =>
lang('order_dim1 has been updated'));
+ $this->fields_updated[] = 'order_dim1';
+ }
+
+ if ($old_building_part !=
$ticket['building_part'])
+ {
+ $this->db->query("UPDATE fm_tts_tickets
SET building_part='" . $ticket['building_part']
+ . "' WHERE
id='$id'",__LINE__,__FILE__);
+ $receipt['message'][]= array('msg' =>
lang('building part has been updated'));
+ $this->fields_updated[] =
'building_part';
+ }
+
+ if ($old_budget != $ticket['budget'])
+ {
+ $this->fields_updated[] = 'budget';
+ $this->db->query("UPDATE fm_tts_tickets
set budget='" . (int)$ticket['budget']
+ . "' where
id='$id'",__LINE__,__FILE__);
+
$this->historylog->add('B',$id,$ticket['budget'],$old_budget);
+ }
+
$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']);
$value_set['ecodimb'] =
$ticket['ecodimb'];
- $value_set['budget'] =
$ticket['budget'];
+// $value_set['budget'] =
$ticket['budget'];
$value_set['branch_id'] =
$ticket['branch_id'];
+
}
$value_set =
$this->db->validate_update($value_set);
Modified: trunk/property/inc/class.sowo_hour.inc.php
===================================================================
--- trunk/property/inc/class.sowo_hour.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.sowo_hour.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -501,6 +501,7 @@
//_debug
$values= array(
$this->account,
+ $hour['activity_num'],
$hour['descr'],
$hour['unit'],
$hour['cost'],
@@ -522,7 +523,7 @@
$values = $this->db->validate_insert($values);
- $this->db->query("INSERT INTO fm_wo_hours
(owner,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,"
+ $this->db->query("INSERT INTO fm_wo_hours
(owner,activity_num,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,"
. "
grouping_id,grouping_descr,record,building_part,tolerance,remark,entry_date,workorder_id,category,cat_per_cent)
"
. "VALUES ( $values )",__LINE__,__FILE__);
Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.uitts.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -58,7 +58,7 @@
/**
* @var boolean $_simple use simplified interface
*/
- protected $_simple = false;
+ protected $simple = false;
protected $_show_finnish_date = false;
protected $_category_acl = false;
var $part_of_town_id;
Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/inc/class.uiwo_hour.inc.php 2014-06-23 12:32:10 UTC (rev
12018)
@@ -3507,6 +3507,34 @@
if($_FILES)
{
$this->_import_calculation($workorder_id);
+
+ $bofiles =
CreateObject('property.bofiles');
+
+ $file_name = @str_replace('
','_',$_FILES['file']['name']);
+
+ $to_file =
"{$bofiles->fakebase}/workorder/{$workorder_id}/{$file_name}";
+
+ if($bofiles->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ phpgwapi_cache::message_set(lang('This
file already exists !'), 'error');
+ }
+ else
+ {
+
$bofiles->create_document_dir("workorder/{$workorder_id}");
+ $bofiles->vfs->override_acl = 1;
+
+ if(!$bofiles->vfs->cp(array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' => $to_file,
+ 'relatives' => array
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
phpgwapi_cache::message_set(lang('Failed to upload file !'), 'error');
+ }
+ $bofiles->vfs->override_acl = 0;
+ }
}
if( $receipt = phpgwapi_cache::session_get('phpgwapi',
'phpgw_messages'))
Modified: trunk/property/js/yahoo/tts.index.simple.js
===================================================================
--- trunk/property/js/yahoo/tts.index.simple.js 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/js/yahoo/tts.index.simple.js 2014-06-23 12:32:10 UTC (rev
12018)
@@ -30,19 +30,23 @@
{
date_search : 1 //if search has link "Data search"
}
+ var FormatterRight = function(elCell, oRecord, oColumn, oData)
+ {
+ elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+ }
this.particular_setting = function()
{
if(flag_particular_setting=='init')
{
- //status
+ //status
index =
locate_in_array_options(0,"value",path_values.status_id);
- if(index)
- {
- oMenuButton_0.set("label", ("<em>" +
array_options[0][index][1] + "</em>"));
- }
+ if(index)
+ {
+ oMenuButton_0.set("label", ("<em>" +
array_options[0][index][1] + "</em>"));
+ }
// oMenuButton_0.focus();
- YAHOO.util.Dom.get(textImput[0].id).focus();
+ YAHOO.util.Dom.get(textImput[0].id).focus();
}
else if(flag_particular_setting=='update')
{
Modified: trunk/property/templates/base/wo_hour.xsl
===================================================================
--- trunk/property/templates/base/wo_hour.xsl 2014-06-22 14:53:30 UTC (rev
12017)
+++ trunk/property/templates/base/wo_hour.xsl 2014-06-23 12:32:10 UTC (rev
12018)
@@ -2717,16 +2717,6 @@
</xsl:choose>
<tr>
- <td >
- <xsl:variable name="lang_submit">
- <xsl:value-of
select="php:function('lang', 'upload file')"/>
- </xsl:variable>
- <input type="submit" name="submit"
value="{$lang_submit}">
- <xsl:attribute name="title">
- <xsl:value-of
select="$lang_submit"/>
- </xsl:attribute>
- </input>
- </td>
<td>
<input type="file" id="file"
name="file" size="40">
<xsl:attribute name="title">
@@ -2738,6 +2728,16 @@
<input type="button" id =
"get_template" name="get_template" value="{$lang_template}" title =
"{$lang_template}" />
-->
</td>
+ <td >
+ <xsl:variable name="lang_submit">
+ <xsl:value-of
select="php:function('lang', 'upload file')"/>
+ </xsl:variable>
+ <input type="submit" name="submit"
value="{$lang_submit}">
+ <xsl:attribute name="title">
+ <xsl:value-of
select="$lang_submit"/>
+ </xsl:attribute>
+ </input>
+ </td>
</tr>
</table>
</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12018] property: fix conditional ticket update and add calculation import to workorder,
Sigurd Nes <=