[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] tts/newticket.php, 1.32
From: |
nomail |
Subject: |
[Phpgroupware-cvs] tts/newticket.php, 1.32 |
Date: |
Mon, 11 Oct 2004 11:43:14 +0200 |
Update of /tts
Modified Files:
Branch:
newticket.php
date: 2004/10/11 09:43:14; author: fipsfuchs; state: Exp; lines: +187 -59
Log Message:
replaced with 0.9.16 branche
=====================================================================
Index: tts/newticket.php
diff -u tts/newticket.php:1.31 tts/newticket.php:1.32
--- tts/newticket.php:1.31 Tue Oct 16 23:52:28 2001
+++ tts/newticket.php Mon Oct 11 09:43:14 2004
@@ -1,18 +1,20 @@
<?php
- /**************************************************************************\
- * phpGroupWare - Trouble Ticket System *
- * http://www.phpgroupware.org *
- * -------------------------------------------- *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by the *
- * Free Software Foundation; either version 2 of the License, or (at your *
- * option) any later version. *
- \**************************************************************************/
-
- /* $Id$ */
-
- $submit = $HTTP_POST_VARS['submit'];
- if ($submit || $cancel)
+
/**************************************************************************\
+ * phpGroupWare - Trouble Ticket System
*
+ * http://www.phpgroupware.org
*
+ * --------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by
the *
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+
+ // $Id$
+ // $Source$
+
+ $submit = $_POST['submit'];
+ $cancel = $_POST['cancel'];
+ if($submit || $cancel)
{
$GLOBALS['phpgw_info']['flags'] = array(
'noheader' => True,
@@ -24,68 +26,118 @@
$GLOBALS['phpgw_info']['flags']['enable_send_class'] = True;
$GLOBALS['phpgw_info']['flags']['enable_config_class'] = True;
$GLOBALS['phpgw_info']['flags']['enable_categories_class'] = True;
+ $GLOBALS['phpgw_info']['flags']['enable_vfs_class'] = True;
include('../header.inc.php');
+
+ $GLOBALS['phpgw']->config->read_repository();
- if ($cancel)
+ if($cancel)
{
- $phpgw->redirect($phpgw->link('/tts/index.php'));
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/tts/index.php'));
}
- if ($submit)
- {
- $phpgw->db->query("insert into phpgw_tts_tickets
(ticket_group,ticket_priority,ticket_owner,"
+ if($submit)
+ {
+ //File-Upload
+ if ($HTTP_POST_FILES['attachment']['name'] != '')
+ {
+ $basedir = $GLOBALS['basedir'] . "/tts";
+ //Check if home/groupdirectory exists. If not, we
create it
+ if (!file_exists($basedir))
+ {
+ $GLOBALS['phpgw']->vfs->override_acl = 1;
+ $GLOBALS['phpgw']->vfs->mkdir (array (
+ 'string' => $basedir,
+ 'relatives' => array
(RELATIVE_ALL)));
+ $GLOBALS['phpgw']->vfs->override_acl = 0;
+ }
+
+ $GLOBALS['phpgw']->db->query("SELECT max(ticket_id)
from phpgw_tts_tickets",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ $tid = ($GLOBALS['phpgw']->db->f('max(ticket_id)')) + 1;
+
+ //$tid = $ticket_id =
$phpgw->db->get_last_insert_id('phpgw_tts_tickets','ticket_id');
+ $attdir = $basedir . "/" . $tid;
+
+ $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']->db->query("SELECT max(file_id) from
phpgw_vfs",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ $file_id = $GLOBALS['phpgw']->db->f('max(file_id)');
+ }
+
+ $GLOBALS['phpgw']->db->query("insert into phpgw_tts_tickets
(ticket_group,ticket_priority,ticket_owner,"
.
"ticket_assignedto,ticket_subject,ticket_category,ticket_billable_hours,"
- . "ticket_billable_rate,ticket_status,ticket_details)
values ('0','"
- . $ticket['priority'] . "','"
+ .
"ticket_billable_rate,ticket_status,ticket_deadline,ticket_effort,ticket_type,ticket_platform,ticket_attachment,ticket_details)
values ('"
+ . $_POST['ticket']['group'] . "','"
+ . $_POST['ticket']['priority'] . "','"
. $GLOBALS['phpgw_info']['user']['account_id'] . "','"
- . $ticket['assignedto'] . "','"
- . $ticket['subject'] . "','"
- . $ticket['category'] . "','"
- . $ticket['billable_hours'] . "','"
- . $ticket['billable_rate'] . "','O','"
- . addslashes($ticket['details']) .
"')",__LINE__,__FILE__);
+ . $_POST['ticket']['assignedto'] . "','"
+ . $_POST['ticket']['subject'] . "','"
+ . $_POST['ticket']['category'] . "','"
+ . $_POST['ticket']['billable_hours'] . "','"
+ . $_POST['ticket']['billable_rate'] . "','O','"
+ . $_POST['ticket']['deadline']['year'] . "-" .
$_POST['ticket']['deadline']['month'] . "-" .
$_POST['ticket']['deadline']['day'] . "','"
+ . $_POST['ticket']['effort'] . "','"
+ . ($_POST['ticket']['type'] ? $_POST['ticket']['type']
: 0) . "','"
+ . ($_POST['ticket']['platform'] ?
$_POST['ticket']['platform'] : 0) . "','"
+ . ($file_id ? $file_id : 0). "','"
+ . addslashes($_POST['ticket']['details']) .
"')",__LINE__,__FILE__);
- $ticket_id =
$phpgw->db->get_last_insert_id('phpgw_tts_tickets','ticket_id');
+ $ticket_id =
$GLOBALS['phpgw']->db->get_last_insert_id('phpgw_tts_tickets','ticket_id');
$historylog = createobject('phpgwapi.historylog','tts');
- $historylog->add('O',$ticket_id,'');
+ $historylog->add('O',$ticket_id,' ','');
- if ($GLOBALS['phpgw_info']['server']['tts_mailticket'])
+ if($GLOBALS['phpgw']->config->config_data['mailnotification'])
{
mail_ticket($ticket_id);
}
-
$phpgw->redirect($phpgw->link('/tts/viewticket_details.php','&ticket_id=' .
$ticket_id));
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/tts/viewticket_details.php','&ticket_id='
. $ticket_id));
}
-
$account_selected = array();
$entry_selected = array();
$priority_selected = array();
$priority_comment = array();
- if (! $submit)
+ if(!$submit)
{
$GLOBALS['phpgw']->preferences->read_repository();
- if
($GLOBALS['phpgw_info']['user']['preferences']['tts']['groupdefault'])
+
+ /*
+
if($GLOBALS['phpgw_info']['user']['preferences']['tts']['groupdefault'])
{
-
$entry_selected[$GLOBALS['phpgw_info']['user']['preferences']['tts']['groupdefault']]='
selected';
+
$entry_selected[$GLOBALS['phpgw_info']['user']['preferences']['tts']['groupdefault']]
= ' selected';
}
- if
($GLOBALS['phpgw_info']['user']['preferences']['tts']['assigntodefault'])
+
if($GLOBALS['phpgw_info']['user']['preferences']['tts']['assigntodefault'])
{
-
$account_selected[$GLOBALS['phpgw_info']['user']['preferences']['tts']['assigntodefault']]='
selected';
+
$account_selected[$GLOBALS['phpgw_info']['user']['preferences']['tts']['assigntodefault']]
= ' selected';
}
- if
($GLOBALS['phpgw_info']['user']['preferences']['tts']['prioritydefault'])
+
if($GLOBALS['phpgw_info']['user']['preferences']['tts']['prioritydefault'])
{
-
$priority_selected[$GLOBALS['phpgw_info']['user']['preferences']['tts']['prioritydefault']]='
selected';
+
$priority_selected[$GLOBALS['phpgw_info']['user']['preferences']['tts']['prioritydefault']]
= ' selected';
}
-
+ */
$GLOBALS['phpgw']->template->set_file(array(
'newticket' => 'newticket.tpl'
));
+
$GLOBALS['phpgw']->template->set_block('newticket','options_select');
$GLOBALS['phpgw']->template->set_block('newticket','form');
$GLOBALS['phpgw']->template->set_var('lang_create_new_ticket',lang('Create new
ticket'));
@@ -117,54 +169,130 @@
$GLOBALS['phpgw']->template->set_var('value_subject',$ticket['details']);
$GLOBALS['phpgw']->template->set_var('value_billable_hours',($ticket['billable_hours']?$ticket['billable_hours']:'0.00'));
$GLOBALS['phpgw']->template->set_var('value_billable_hours_rate',($ticket['billable_rate']?$ticket['billable_rate']:'0.00'));
+
$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('lang_deadline',lang('Deadline'));
+
$GLOBALS['phpgw']->template->set_var('lang_effort',lang('Effort'));
+
$GLOBALS['phpgw']->template->set_var('lang_platform',lang('Platform'));
+
$GLOBALS['phpgw']->template->set_var('lang_attachment',lang('Attachment'));
+
unset($s);
$groups = CreateObject('phpgwapi.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))
{
- $s .= '<option value="' . $entry['account_id'] . '" ' .
$entry_selected[$entry['account_lid']]
- . '>' . $entry['account_lid'] . '</option>';
+
if($GLOBALS['phpgw_info']['user']['preferences']['tts']['groupdefault'] ==
$entry['account_id'])
+ {
+ $selected = 'selected';
+ }
+ else
+ {
+ $selected = '';
+ }
+ $s .= '<option value="' . $entry['account_id'] . '" ' .
$selected
+ . '>' . $entry['account_name'] . '</option>';
}
- $GLOBALS['phpgw']->template->set_var('value_group','<select
name="ticket[group]">' . $s . '</select>');
+ $GLOBALS['phpgw']->template->set_var('options_group',$s);
- $s = '<select name="ticket[category]">' .
$GLOBALS['phpgw']->categories->formated_list('select','',$group,True) .
'</select>';
+ $s = '<select name="ticket[category]">' .
$GLOBALS['phpgw']->categories->formated_list('select','',$group,False) .
'</select>';
$GLOBALS['phpgw']->template->set_var('value_category',$s);
unset($s);
+ for($i=1; $i<=31; $i++)
+ {
+ $i < 10 ? $y = '0' . $i : $y = $i;
+ $s .= '<option>' . $y . '</option>';
+ }
+ $GLOBALS['phpgw']->template->set_var('option_day','<select
name="ticket[deadline][day]"><option selected></option>' . $s . '</select>');
+
+ unset($s);
+ for($i=1; $i<=12; $i++)
+ {
+ $i < 10 ? $y = '0' . $i : $y = $i;
+ $s .= '<option>' . $y . '</option>';
+ }
+ $GLOBALS['phpgw']->template->set_var('option_month','<select
name="ticket[deadline][month]"><option selected></option>' . $s . '</select>');
+
+ unset($s);
$accounts = $groups;
$accounts->account_id = $group_id;
- $account_list = $accounts->get_list('accounts');
- while (list($key,$entry) = each($account_list))
+ $account_list = $accounts->get_list('accounts');
+
+ while(list($key,$entry) = each($account_list))
{
- $s .= '<option value="' . $entry['account_id'] . '" ' .
$entry_selected[$entry['account_lid']]
- . '>' . $entry['account_lid'] . '</option>';
+
$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);
+ }
}
-
$GLOBALS['phpgw']->template->set_var('value_assignedto','<select
name="ticket[assignedto]">' . $s . '</select>');
+
+ $select_employee_list = "<select name=\"ticket[assignedto]\"
size=\"1\">\n";
+ while (list($account_id,$account_name) = each($employees_list))
+ {
+ $select_employee_list .= '<option value="' .
$account_id . '"';
+ if
($GLOBALS['phpgw_info']['user']['preferences']['tts']['assigntodefault'] ==
$account_id)
+ {
+ $select_employee_list .= ' selected';
+ }
+ $select_employee_list .=
'>'.$account_name."</option>\n";
+ }
+ $select_employee_list .= '</select>';
+
+
$GLOBALS['phpgw']->template->set_var('value_assignedto',$select_employee_list);
+
+ //auswahlfelder type und platform
+
+ $platform =
CreateObject('tts.subcategories',$GLOBALS['phpgw_info']['user']['account_id'],'tts');
+ unset($s);
+ $s = '<select name="ticket[platform]">' .
$platform->formated_list('select','appandplatform','',False) . '</select>';
+ $GLOBALS['phpgw']->template->set_var('value_platform',$s);
+
+
+ $type =
CreateObject('tts.subcategories',$GLOBALS['phpgw_info']['user']['account_id'],'tts');
+ unset($s);
+ $s = '<select name="ticket[type]">' .
$type->formated_list('select','appandtype','',False) . '</select>';
+ $GLOBALS['phpgw']->template->set_var('value_type',$s);
+
//$GLOBALS['phpgw']->template->set_var('tts_account_lid','0');
//$GLOBALS['phpgw']->template->set_var('tts_account_name',lang('None'));
// Choose the correct priority to display
$prority_selected[$ticket['priority']] = ' selected';
- $priority_comment[1]=' - '.lang('Lowest');
- $priority_comment[5]=' - '.lang('Medium');
- $priority_comment[10]=' - '.lang('Highest');
- for ($i=1; $i<=10; $i++)
+ $priority_comment[1] = ' - '.lang('Lowest');
+ $priority_comment[5] = ' - '.lang('Medium');
+ $priority_comment[10] = ' - '.lang('Highest');
+ for($i=1; $i<=10; $i++)
{
- $priority_select .= '<option value="' . $i . '">' . $i
. $priority_comment[$i] . '</option>';
+
if($GLOBALS['phpgw_info']['user']['preferences']['tts']['prioritydefault'] ==
$i)
+ {
+ $prio_selected = 'selected';
+ }
+ else
+ {
+ $prio_selected = '';
+ }
+ $priority_select .= '<option value="' . $i . '" ' .
$prio_selected . '>' . $i . $priority_comment[$i] . '</option>';
}
$GLOBALS['phpgw']->template->set_var('value_priority','<select
name="ticket[priority]">' . $priority_select . '</select>');
$GLOBALS['phpgw']->template->set_var('tts_select_options','');
$GLOBALS['phpgw']->template->set_var('tts_new_lstcategory','');
$GLOBALS['phpgw']->template->set_var('tts_new_lstassignto','');
-
+
$GLOBALS['phpgw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_footer();
}
else
{
-
}
-?>
\ No newline at end of file
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] tts/newticket.php, 1.32,
nomail <=