[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] tts/viewticket_details.php, 1.44
From: |
nomail |
Subject: |
[Phpgroupware-cvs] tts/viewticket_details.php, 1.44 |
Date: |
Mon, 11 Oct 2004 11:43:14 +0200 |
Update of /tts
Modified Files:
Branch:
viewticket_details.php
date: 2004/10/11 09:43:14; author: fipsfuchs; state: Exp; lines: +303 -77
Log Message:
replaced with 0.9.16 branche
=====================================================================
Index: tts/viewticket_details.php
diff -u tts/viewticket_details.php:1.43 tts/viewticket_details.php:1.44
--- tts/viewticket_details.php:1.43 Sun Jan 27 14:46:04 2002
+++ tts/viewticket_details.php Mon Oct 11 09:43:14 2004
@@ -9,23 +9,35 @@
* option) any later version.
*
\**************************************************************************/
- /* $Id$ */
+ // $Id$
+ // $Source$
- $GLOBALS['phpgw_info']['flags'] = array(
- 'enable_nextmatchs_class' => True,
- 'enable_categories_class' => True,
- 'currentapp' => 'tts'
- );
- $submit = $HTTP_POST_VARS['submit'];
+ $GLOBALS['phpgw_info']['flags'] = array('enable_nextmatchs_class' =>
true,
+ 'enable_categories_class' =>
true,
+ 'enable_config_class' =>
true,
+ 'currentapp' =>
'tts',
+ 'enable_vfs_class' => true
+ );
+ $submit = $_POST['submit'];
+ $cancel = $_POST['cancel'];
+ $ticket_id = $_REQUEST['ticket_id'];
- if ($submit)
+ if($submit)
{
$GLOBALS['phpgw_info']['flags']['noheader'] = True;
$GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
$GLOBALS['phpgw_info']['flags']['enable_config_class'] = True;
}
include('../header.inc.php');
+
+ $GLOBALS['phpgw']->config->read_repository();
+ if($cancel)
+ {
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/tts/index.php'));
+ }
+
+
$GLOBALS['phpgw']->historylog =
createobject('phpgwapi.historylog','tts');
$GLOBALS['phpgw']->historylog->types = array(
'R' => 'Re-opened',
@@ -36,17 +48,22 @@
'T' => 'Category changed',
'S' => 'Subject changed',
'B' => 'Billing rate',
- 'H' => 'Billing hours'
+ 'H' => 'Billing hours',
+ 'G' => 'Group ownership changed',
+ 'Y' => 'Type',
+ 'D' => 'Deadline',
+ 'E' => 'Effort',
+ 'L' => 'Platform'
);
- if (! $submit)
+ if(!$submit)
{
// Have they viewed this ticket before ?
$GLOBALS['phpgw']->db->query("select count(*) from
phpgw_tts_views where view_id='$ticket_id' "
- . "and view_account_id='" .
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
+ . "and view_account_id='" .
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
- if (! $GLOBALS['phpgw']->db->f(0))
+ if(!$GLOBALS['phpgw']->db->f(0))
{
$GLOBALS['phpgw']->db->query("insert into
phpgw_tts_views values ('$ticket_id','"
. $GLOBALS['phpgw_info']['user']['account_id']
. "','" . time() . "')",__LINE__,__FILE__);
@@ -64,7 +81,26 @@
$ticket['subject'] =
$GLOBALS['phpgw']->db->f('ticket_subject');
$ticket['priority'] =
$GLOBALS['phpgw']->db->f('ticket_priority');
$ticket['owner'] =
$GLOBALS['phpgw']->db->f('ticket_owner');
+ $ticket['group'] =
$GLOBALS['phpgw']->db->f('ticket_group');
+ $ticket['type'] =
$GLOBALS['phpgw']->categories->id2name($GLOBALS['phpgw']->db->f('ticket_type'));
+ if ($GLOBALS['phpgw']->db->f('ticket_deadline') == '0000-00-00')
+ {
+ $ticket['deadline'] = '';
+ }
+ $ticket['deadline'] =
$GLOBALS['phpgw']->db->f('ticket_deadline');
+
+ $ticket['effort'] =
$GLOBALS['phpgw']->db->f('ticket_effort');
+ $ticket['platform'] =
$GLOBALS['phpgw']->categories->id2name($GLOBALS['phpgw']->db->f('ticket_platform'));
+
+ $GLOBALS['phpgw']->db->query("SELECT name from phpgw_vfs where
directory like '/tts/" . $ticket_id . "' AND size > 0",__LINE__,__FILE__);
+ $x = 0;
+ while ($GLOBALS['phpgw']->db->next_record() != "")
+ {
+ $ticket['attachment'][$x] = '/tts/' . $ticket_id . '/'
. $GLOBALS['phpgw']->db->f('name');
+ ++$x;
+ }
+
$GLOBALS['phpgw']->template->set_file('viewticket','viewticket_details.tpl');
$GLOBALS['phpgw']->template->set_block('viewticket','options_select');
$GLOBALS['phpgw']->template->set_block('viewticket','additional_notes_row');
@@ -73,14 +109,14 @@
$GLOBALS['phpgw']->template->set_block('viewticket','row_history_empty');
$GLOBALS['phpgw']->template->set_block('viewticket','form');
- $messages =
$GLOBALS['phpgw']->session->appsession('messages','tts');
- if ($messages)
+ $messages .=
$GLOBALS['phpgw']->session->appsession('messages','tts');
+ if($messages)
{
$GLOBALS['phpgw']->template->set_var('messages',$messages);
$GLOBALS['phpgw']->session->appsession('messages','tts','');
}
- if ($GLOBALS['phpgw']->db->f('ticket_status') == 'C')
+ if($GLOBALS['phpgw']->db->f('ticket_status') == 'C')
{
$GLOBALS['phpgw']->template->set_var('t_status','FIX
ME! time closed ' . __LINE__); //
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('t_timestamp_closed')));
}
@@ -91,11 +127,11 @@
// Choose the correct priority to display
$priority_selected[$ticket['priority']] = ' selected';
- $priority_comment[1]=' - '.lang('Lowest');
- $priority_comment[5]=' - '.lang('Medium');
- $priority_comment[10]=' - '.lang('Highest');
+ $priority_comment[1] = ' - '.lang('Lowest');
+ $priority_comment[5] = ' - '.lang('Medium');
+ $priority_comment[10] = ' - '.lang('Highest');
- for ($i=1; $i<=10; $i++)
+ for($i=1; $i<=10; $i++)
{
$GLOBALS['phpgw']->template->set_var('optionname',
$i.$priority_comment[$i]);
$GLOBALS['phpgw']->template->set_var('optionvalue', $i);
@@ -110,52 +146,70 @@
$GLOBALS['phpgw']->template->set_var('optionvalue','0');
$GLOBALS['phpgw']->template->set_var('optionselected','');
$GLOBALS['phpgw']->template->parse('options_assignedto','options_select',true);
- while (list($key,$entry) = each($account_list))
+
+ while(list($key,$entry) = each($account_list))
{
- $tag = '';
- if ($entry['account_id'] == $ticket['assignedto'])
+
$GLOBALS['phpgw']->accounts->get_account_name($entry['account_id'],$lid,$fname,$lname);
+ if(!$fname && !$lname)
+ continue;
+ $employees_list[$entry['account_id']] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
+
+ if(count($employees_list))
+ {
+ asort($employees_list);
+ reset($employees_list);
+ }
+ }
+
+ while (list($account_id,$account_name) = each($employees_list))
+ {
+ $selected = '';
+ if ($account_id == $ticket['assignedto'])
{
- $tag = 'selected';
+ $selected = 'selected';
}
- $GLOBALS['phpgw']->template->set_var('optionname',
$entry['account_lid']);
- $GLOBALS['phpgw']->template->set_var('optionvalue',
$entry['account_id']);
- $GLOBALS['phpgw']->template->set_var('optionselected',
$tag);
+ $GLOBALS['phpgw']->template->set_var('optionname',
$account_name);
+ $GLOBALS['phpgw']->template->set_var('optionvalue',
$account_id);
+ $GLOBALS['phpgw']->template->set_var('optionselected',
$selected);
$GLOBALS['phpgw']->template->parse('options_assignedto','options_select',True);
}
+
// Figure out when it was opened and last closed
$history_array =
$GLOBALS['phpgw']->historylog->return_array(array(),array('X','O'),'','',$ticket_id);
- while (is_array($history_array) && list(,$value) =
each($history_array))
+
+ while(is_array($history_array) && list(,$value) =
each($history_array))
{
- if ($value['status'] == 'O')
+ if($value['status'] == 'O')
{
- $ticket['opened'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $ticket['opened'] =
$GLOBALS['phpgw']->common->show_date($value['datetime'] - ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
}
- if ($value['status'] == 'X')
+ if($value['status'] == 'X')
{
- $ticket['closed'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $ticket['closed'] =
$GLOBALS['phpgw']->common->show_date($value['datetime'] - ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
}
}
// group
-/*
- $groups = $accounts;
- $group_list = $groups->get_list('groups');
- while (list($key,$entry) = each($group_list))
+
+ $group_list = array();
+ $group_list =
$GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']);
+
+ while(list($key,$entry) = each($group_list))
{
$tag = '';
- if ($entry['account_lid'] == $ticket['groups'])
+ if($entry['account_id'] == $ticket['group'])
{
$tag = 'selected';
}
- $GLOBALS['phpgw']->template->set_var('optionname',
$entry['account_lid']);
+ $GLOBALS['phpgw']->template->set_var('optionname',
$entry['account_name']);
$GLOBALS['phpgw']->template->set_var('optionvalue',
$entry['account_id']);
$GLOBALS['phpgw']->template->set_var('optionselected',
$tag);
$GLOBALS['phpgw']->template->parse('options_group','options_select',true);
}
-*/
-
$GLOBALS['phpgw']->template->set_var('options_category',$GLOBALS['phpgw']->categories->formated_list('select','',$ticket['category'],True));
+
+
$GLOBALS['phpgw']->template->set_var('options_category',$GLOBALS['phpgw']->categories->formated_list('select','',$ticket['category'],False));
$ticket_status[$ticket['status']] = ' selected';
$s = '<option value="O"' . $ticket_status['O'] . '>' .
lang('Open') . '</option>';
@@ -168,19 +222,19 @@
* Display additional notes *
\**************************************************************/
$history_array =
$GLOBALS['phpgw']->historylog->return_array(array(),array('C'),'','',$ticket_id);
- while (is_array($history_array) && list(,$value) =
each($history_array))
+ while(is_array($history_array) && list(,$value) =
each($history_array))
{
$GLOBALS['phpgw']->template->set_var('lang_date',lang('Date'));
$GLOBALS['phpgw']->template->set_var('lang_user',lang('User'));
-
$GLOBALS['phpgw']->template->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']));
+
$GLOBALS['phpgw']->template->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']
- ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])));
$GLOBALS['phpgw']->template->set_var('value_user',$value['owner']);
$GLOBALS['phpgw']->template->set_var('value_note',nl2br(stripslashes($value['new_value'])));
$GLOBALS['phpgw']->template->fp('rows_notes','additional_notes_row',True);
}
- if (! count($history_array))
+ if(!count($history_array))
{
$GLOBALS['phpgw']->template->set_var('lang_no_additional_notes',lang('No
additional notes'));
$GLOBALS['phpgw']->template->fp('rows_notes','additional_notes_row_empty',True);
@@ -193,16 +247,17 @@
$GLOBALS['phpgw']->template->set_var('lang_date',lang('Date'));
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Action'));
$GLOBALS['phpgw']->template->set_var('lang_new_value',lang('New
Value'));
+ $GLOBALS['phpgw']->template->set_var('lang_old_value',lang('Old
Value'));
- $history_array =
$GLOBALS['phpgw']->historylog->return_array(array('C','O'),array(),'','',$ticket_id);
- while (is_array($history_array) && list(,$value) =
each($history_array))
+ $history_array =
$GLOBALS['phpgw']->historylog->return_array(array('C'),array(),'','',$ticket_id);
+ while(is_array($history_array) && list(,$value) =
each($history_array))
{
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
-
$GLOBALS['phpgw']->template->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']));
+
$GLOBALS['phpgw']->template->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']
- ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])));
$GLOBALS['phpgw']->template->set_var('value_user',$value['owner']);
- switch ($value['status'])
+ switch($value['status'])
{
case 'R': $type = lang('Re-opened'); break;
case 'X': $type = lang('Closed'); break;
@@ -213,15 +268,21 @@
case 'S': $type = lang('Subject changed');
break;
case 'H': $type = lang('Billable hours
changed'); break;
case 'B': $type = lang('Billable rate
changed'); break;
+ case 'G': $type = lang('Group ownership
changed'); break;
+ case 'Y': $type = lang('Type changed'); break;
+ case 'D': $type = lang('Deadline changed');
break;
+ case 'E': $type = lang('Effort changed'); break;
+ case 'L': $type = lang('Platform changed');
break;
+ case 'M': $type = lang('Attachment added');
break;
default: break;
}
$GLOBALS['phpgw']->template->set_var('value_action',($type?$type:' '));
unset($type);
- if ($value['status'] == 'A')
+ if($value['status'] == 'A')
{
- if (! $value['new_value'])
+ if(!$value['new_value'])
{
$GLOBALS['phpgw']->template->set_var('value_new_value',lang('None'));
}
@@ -229,24 +290,46 @@
{
$GLOBALS['phpgw']->template->set_var('value_new_value',$GLOBALS['phpgw']->accounts->id2name($value['new_value']));
}
+
+ if(!$value['old_value'])
+ {
+
$GLOBALS['phpgw']->template->set_var('value_old_value',lang('None'));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->template->set_var('value_old_value',$GLOBALS['phpgw']->accounts->id2name($value['old_value']));
+ }
}
- else if ($value['status'] == 'T')
+ elseif($value['status'] == 'T')
{
$GLOBALS['phpgw']->template->set_var('value_new_value',$GLOBALS['phpgw']->categories->id2name($value['new_value']));
+
$GLOBALS['phpgw']->template->set_var('value_old_value',$GLOBALS['phpgw']->categories->id2name($value['old_value']));
+ }
+ elseif($value['status'] == 'G')
+ {
+ $s =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ $s = ($s ? $s : '--');
+
$GLOBALS['phpgw']->template->set_var('value_new_value',$s);
+
+ $s =
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
+ $s = ($s ? $s : '--');
+
$GLOBALS['phpgw']->template->set_var('value_old_value',$s);
}
- else if ($value['status'] != 'O' && $value['new_value'])
+ elseif($value['status'] != 'O' && $value['new_value'])
{
$GLOBALS['phpgw']->template->set_var('value_new_value',$value['new_value']);
+
$GLOBALS['phpgw']->template->set_var('value_old_value',$value['old_value']);
}
else
{
$GLOBALS['phpgw']->template->set_var('value_new_value',' ');
+
$GLOBALS['phpgw']->template->set_var('value_old_value',' ');
}
$GLOBALS['phpgw']->template->fp('rows_history','row_history',True);
}
- if (! count($history_array))
+ if(!count($history_array))
{
$GLOBALS['phpgw']->template->set_var('lang_no_history',lang('No history for
this record'));
$GLOBALS['phpgw']->template->fp('rows_history','row_history_empty',True);
@@ -275,19 +358,55 @@
$GLOBALS['phpgw']->template->set_var('value_priority',$ticket['priority']);
$GLOBALS['phpgw']->template->set_var('lang_group',
lang('Group'));
-
$GLOBALS['phpgw']->template->set_var('value_group',$GLOBALS['phpgw']->accounts->id2name($phpgw->db->f('ticket_group')));
+ $s = $GLOBALS['phpgw']->accounts->id2name($ticket['group']);
+ $s = ($s ? $s : '--');
+ $GLOBALS['phpgw']->template->set_var('value_group',$s);
$GLOBALS['phpgw']->template->set_var('lang_billable_hours',lang('Billable
hours'));
$GLOBALS['phpgw']->template->set_var('value_billable_hours',$ticket['billable_hours']);
$GLOBALS['phpgw']->template->set_var('lang_billable_hours_rate',lang('Billable
rate'));
$GLOBALS['phpgw']->template->set_var('value_billable_hours_rate',$ticket['billable_rate']);
+
+
$GLOBALS['phpgw']->template->set_var('currency',$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']);
+ $GLOBALS['phpgw']->template->set_var('lang_type',lang('Type'));
+
$GLOBALS['phpgw']->template->set_var('value_type',$ticket['type']);
+
+
$GLOBALS['phpgw']->template->set_var('lang_deadline',lang('Deadline'));
+
$GLOBALS['phpgw']->template->set_var('value_deadline',$ticket['deadline']);
+
+
$GLOBALS['phpgw']->template->set_var('lang_effort',lang('Effort'));
+
$GLOBALS['phpgw']->template->set_var('value_effort',$ticket['effort']);
+
+
$GLOBALS['phpgw']->template->set_var('lang_platform',lang('Platform'));
+
$GLOBALS['phpgw']->template->set_var('value_platform',$ticket['platform']);
+
+ for($i=0; $i <= $x-1; $i++)
+ {
+ $file = $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'tts.attachedFiles.show_file',
+
'file' => $ticket['attachment'][$i]
+ ));
+ $attLink .= "<a href=\"" . $file . "\"
target=\"_NEW\">" . basename($ticket['attachment'][$i]) . " </a><br>";
+ }
+
$GLOBALS['phpgw']->template->set_var('lang_attachment',lang('Attachment'));
+
$GLOBALS['phpgw']->template->set_var('value_attachment',$attLink);
+
$GLOBALS['phpgw']->template->set_var('lang_billable_hours_total',lang('Total
billable'));
$GLOBALS['phpgw']->template->set_var('value_billable_hours_total',sprintf('%01.2f',($ticket['billable_hours']
* $ticket['billable_rate'])));
+ $type =
CreateObject('tts.subcategories',$GLOBALS['phpgw_info']['user']['account_id'],'tts');
+ unset($s);
+ $s = '<select name="ticket[type]">' .
$type->formated_list('select','appandtype',$type->getSubCatElementId('type',$ticket['type']),False)
. '</select>';
+ $GLOBALS['phpgw']->template->set_var('option_type',$s);
+
+ $platform =
CreateObject('tts.subcategories',$GLOBALS['phpgw_info']['user']['account_id'],'tts');
+ unset($s);
+ $s = '<select name="ticket[platform]">' .
$platform->formated_list('select','appandplatform',$platform->getSubCatElementId('platform',$ticket['platform']),False)
.'</select>';
+ $GLOBALS['phpgw']->template->set_var('option_platform',$s);
+
$GLOBALS['phpgw']->template->set_var('lang_assignedto',lang('Assigned to'));
- if ($ticket['assignedto'])
+ if($ticket['assignedto'])
{
$assignedto =
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
}
@@ -305,9 +424,10 @@
$GLOBALS['phpgw']->template->set_var('value_subject',
stripslashes($ticket['subject']));
$GLOBALS['phpgw']->template->set_var('lang_additional_notes',lang('Additional
notes'));
- $GLOBALS['phpgw']->template->set_var('lang_ok', lang('OK'));
+ $GLOBALS['phpgw']->template->set_var('lang_ok', lang('Save'));
$GLOBALS['phpgw']->template->set_var('done_url',$GLOBALS['phpgw']->link('/tts/index.php'));
$GLOBALS['phpgw']->template->set_var('lang_done', lang('done'));
+ $GLOBALS['phpgw']->template->set_var('lang_cancel',
lang('cancel'));
$GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
$GLOBALS['phpgw']->template->set_var('value_category',$GLOBALS['phpgw']->categories->id2name($ticket['category']));
@@ -323,13 +443,34 @@
$GLOBALS['phpgw']->db->query("select * from phpgw_tts_tickets
where ticket_id='$ticket_id'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
+ $ticket['billable_hours'] = $_POST['ticket']['billable_hours'];
+ $ticket['billable_rate'] = $_POST['ticket']['billable_rate'];
+ $ticket['assignedto'] = $_POST['ticket']['assignedto'];
+ $ticket['category'] = $_POST['ticket']['category'];
+ $ticket['note'] = $_POST['ticket']['note'];
+ $ticket['priority'] = $_POST['ticket']['priority'];
+ $ticket['group'] = $_POST['ticket']['group'];
+ $ticket['status'] = $_POST['ticket']['status'];
+ $ticket['type'] = $_POST['ticket']['type'];
+ $ticket['deadline'] = $_POST['ticket']['deadline'];
+ $ticket['effort'] = $_POST['ticket']['effort'];
+ $ticket['platform'] = $_POST['ticket']['platform'];
+ $ticket['attachment'] = $_POST['ticket']['attachment'];
+
$oldassigned = $GLOBALS['phpgw']->db->f('ticket_assignedto');
$oldpriority = $GLOBALS['phpgw']->db->f('ticket_priority');
$oldcategory = $GLOBALS['phpgw']->db->f('ticket_category');
$old_status = $GLOBALS['phpgw']->db->f('ticket_status');
$old_billable_hours =
$GLOBALS['phpgw']->db->f('ticket_billable_hours');
$old_billable_rate =
$GLOBALS['phpgw']->db->f('ticket_billable_rate');
-
+ $old_group = $GLOBALS['phpgw']->db->f('ticket_group');
+ $old_type = $GLOBALS['phpgw']->db->f('ticket_type');
+ $old_deadline = $GLOBALS['phpgw']->db->f('ticket_deadline');
+ $old_effort = $GLOBALS['phpgw']->db->f('ticket_effort');
+ $old_platform = $GLOBALS['phpgw']->db->f('ticket_platform');
+ $old_attachment = $GLOBALS['phpgw']->db->f('ticket_attachment');
+ $old_details = $GLOBALS['phpgw']->db->f('ticket_details');
+
$GLOBALS['phpgw']->db->transaction_begin();
/*
@@ -344,79 +485,164 @@
** S - Subject change
** B - Billing rate
** H - Billing hours
+ ** G - Group
+ ** Y - Type
+ ** D - Deadline
+ ** E - Effort
+ ** L - Platform
+ ** M - Attachment
*/
- if ($old_status != $ticket['status'])
+
+
+ if($old_group != $ticket['group'])
{
$fields_updated = True;
-
$GLOBALS['phpgw']->historylog->add($ticket['status'],$ticket_id,'');
-
- $GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_status='"
- . $ticket['status'] . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_group='" . $ticket['group']
+ . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->historylog->add('G',$ticket_id,$ticket['group'],$old_group);
}
- if ($oldassigned != $ticket['assignedto'])
+ if($oldassigned != $ticket['assignedto'])
{
$fields_updated = True;
$GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_assignedto='" . $ticket['assignedto']
. "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
-
$GLOBALS['phpgw']->historylog->add('A',$ticket_id,$ticket['assignedto']);
+
$GLOBALS['phpgw']->historylog->add('A',$ticket_id,$ticket['assignedto'],$oldassigned);
}
- if ($oldpriority != $ticket['priority'])
+ if($oldpriority != $ticket['priority'])
{
$fields_updated = True;
$GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_priority='" . $ticket['priority']
. "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
-
$GLOBALS['phpgw']->historylog->add('P',$ticket_id,$ticket['priority']);
+
$GLOBALS['phpgw']->historylog->add('P',$ticket_id,$ticket['priority'],$oldpriority);
}
- if ($oldcategory != $ticket['category'])
+ if($oldcategory != $ticket['category'])
{
$fields_updated = True;
$GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_category='" . $ticket['category']
. "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
-
$GLOBALS['phpgw']->historylog->add('T',$ticket_id,$ticket['category']);
+
$GLOBALS['phpgw']->historylog->add('T',$ticket_id,$ticket['category'],$oldcategory);
}
- if ($old_billable_hours != $ticket['billable_hours'])
+ if($old_billable_hours != $ticket['billable_hours'] &&
$ticket['billable_hours'])
{
$fields_updated = True;
$GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_billable_hours='" . $ticket['billable_hours']
. "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
-
$GLOBALS['phpgw']->historylog->add('H',$ticket_id,$ticket['billable_hours']);
+
$GLOBALS['phpgw']->historylog->add('H',$ticket_id,$ticket['billable_hours'],$old_billable_hours);
}
- if ($old_billable_rate != $ticket['billable_rate'])
+ if($old_billable_rate != $ticket['billable_rate'] &&
$ticket['billable_rate'])
{
$fields_updated = True;
$GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_billable_rate='" . $ticket['billable_rate']
. "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
-
$GLOBALS['phpgw']->historylog->add('B',$ticket_id,$ticket['billable_rate']);
+
$GLOBALS['phpgw']->historylog->add('B',$ticket_id,$ticket['billable_rate'],$old_billable_rate);
+ }
+
+ if ($old_type != $ticket['type'] && $ticket['type'] != "")
+ {
+ $fields_updated = True;
+ $GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_type='" . $ticket['type']
+ . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->historylog->add('Y',$ticket_id,$ticket['type'],$old_type);
}
- if ($ticket['note'])
+ if ($old_deadline != $ticket['deadline'] && $ticket['deadline']
!= "")
{
$fields_updated = True;
-
$GLOBALS['phpgw']->historylog->add('C',$ticket_id,$ticket['note']);
+ $GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_deadline='" . $ticket['deadline']
+ . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->historylog->add('D',$ticket_id,$ticket['deadline'],$old_deadline);
+ }
- // Do this before we go into mail_ticket()
- $GLOBALS['phpgw']->db->transaction_commit();
+ if ($old_effort != $ticket['effort'] && $ticket['effort'] != "")
+ {
+ $fields_updated = True;
+ $GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_effort='" . $ticket['effort']
+ . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->historylog->add('E',$ticket_id,$ticket['effort'],$old_effort);
+ }
+
+ if ($old_platform != $ticket['platform'] && $ticket['platform']
!= "")
+ {
+ $fields_updated = True;
+ $GLOBALS['phpgw']->db->query("update phpgw_tts_tickets
set ticket_platform='" . $ticket['platform']
+ . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->historylog->add('L',$ticket_id,$ticket['platform'],$old_platform);
+ }
+
+ if ($HTTP_POST_FILES['attachment']['name'] != '')
+ {
+ $fields_updated = true;
+ $attdir = "/tts/" . $ticket_id;
+ $basedir = $GLOBALS['basedir'] . "/tts";
+
+ if (!file_exists($basedir . "/" . $attdir))
+ {
+ $GLOBALS['phpgw']->vfs->override_acl = 1;
+ $GLOBALS['phpgw']->vfs->mkdir (array (
+ 'string' => $attdir,
+ 'relatives' => array
(RELATIVE_ALL)));
+ $GLOBALS['phpgw']->vfs->override_acl = 0;
+ }
+
+ $GLOBALS['phpgw']->vfs->override_acl = 1;
+ $GLOBALS['phpgw']->vfs->cp(array (
+ 'from' =>
$HTTP_POST_FILES['attachment']['tmp_name'],
+ 'to' => $attdir . '/' .
$HTTP_POST_FILES['attachment']['name'],
+ 'relatives' => array
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)));
+ $GLOBALS['phpgw']->vfs->override_acl = 0;
+
+
$GLOBALS['phpgw']->historylog->add('M',$ticket_id,$HTTP_POST_FILES['attachment']['name'],'');
+ }
+
+
+ if($old_status != $_POST['ticket']['status'])
+ {
+ //only allow assigned-to or admin members to close
tickets
+ if(($GLOBALS['phpgw_info']['user']['account_id'] ==
$oldassigned) ||
+
($GLOBALS['phpgw']->applications->data['admin']['enabled'] == 1))
+ {
- if ($GLOBALS['phpgw_info']['server']['tts_mailticket'])
+ $fields_updated = True;
+
$GLOBALS['phpgw']->historylog->add($_POST['ticket']['status'],$ticket_id,$_POST['ticket']['status'],$old_status);
+
+ $GLOBALS['phpgw']->db->query("update
phpgw_tts_tickets set ticket_status='"
+ . $_POST['ticket']['status'] . "' where
ticket_id='$ticket_id'",__LINE__,__FILE__);
+ }
+ else
{
- mail_ticket($ticket_id);
+ $messages .= '<br>You can only close a ticket
if it is assigned to you.';
+
$GLOBALS['phpgw']->session->appsession('messages','tts',lang($messages));
}
}
+
+ if($ticket['note'])
+ {
+ $fields_updated = True;
+
$GLOBALS['phpgw']->historylog->add('C',$ticket_id,$ticket['note'],'');
+
+ // Do this before we go into mail_ticket()
+ $GLOBALS['phpgw']->db->transaction_commit();
+ }
else
{
// Only do our commit once
$GLOBALS['phpgw']->db->transaction_commit();
}
- if ($fields_updated)
+ if($fields_updated)
{
$GLOBALS['phpgw']->session->appsession('messages','tts',lang('Ticket has been
updated'));
+
+
if($GLOBALS['phpgw']->config->config_data['mailnotification'])
+ {
+ mail_ticket($ticket_id);
+ }
}
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/tts/viewticket_details.php','ticket_id='
. $ticket_id));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] tts/viewticket_details.php, 1.44,
nomail <=