[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,1.1,1.2 class.s
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,1.1,1.2 class.sotts.inc.php,1.1,1.2 class.uiinvestment.inc.php,1.6,1.7 class.uitts.inc.php,1.1,1.2 |
Date: |
Thu, 06 Feb 2003 04:03:48 -0500 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv5149/inc
Modified Files:
class.botts.inc.php class.sotts.inc.php
class.uiinvestment.inc.php class.uitts.inc.php
Log Message:
no message
Index: class.botts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.botts.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.botts.inc.php 3 Feb 2003 21:50:22 -0000 1.1
--- class.botts.inc.php 6 Feb 2003 09:03:45 -0000 1.2
***************
*** 47,54 ****
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! $this->so =
CreateObject($this->currentapp.'.sotts');
! $this->socommon =
CreateObject($this->currentapp.'.socommon');
! $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
! $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp);
$start = get_var('start',array('POST','GET'));
--- 47,57 ----
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! $this->so =
CreateObject($this->currentapp.'.sotts');
! $this->socommon =
CreateObject($this->currentapp.'.socommon');
! $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
! $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp);
! $this->send =
CreateObject('phpgwapi.send');
! $this->config =
CreateObject('phpgwapi.config');
! $this->cats =
CreateObject('phpgwapi.categories');
$start = get_var('start',array('POST','GET'));
***************
*** 132,135 ****
--- 135,173 ----
}
+ function get_status_list($selected)
+ {
+
+ $filters[0][id]='X';
+ $filters[0][name]=lang('Closed');
+ $filters[1][id]='O';
+ $filters[1][name]=lang('Open');
+
+ while (is_array($filters) && list(,$filter) =
each($filters))
+ {
+ $sel_filter = '';
+ if ($filter['id']==$selected)
+ {
+ $sel_filter = 'selected';
+ }
+
+ $filter_list[] = array
+ (
+ 'id' => $filter['id'],
+ 'name' => $filter['name'],
+ 'selected' => $sel_filter
+ );
+ }
+
+ for ($i=0;$i<count($filter_list);$i++)
+ {
+ if ($filter_list[$i]['selected'] != 'selected')
+ {
+ unset($filter_list[$i]['selected']);
+ }
+ }
+
+ return $filter_list;
+ }
+
function get_priority_list($selected='')
***************
*** 179,183 ****
}
-
function read()
{
--- 217,220 ----
***************
*** 190,194 ****
for ($i=0; $i<count($tickets); $i++)
{
! $tickets[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['owner']);
$tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);
--- 227,231 ----
for ($i=0; $i<count($tickets); $i++)
{
! $tickets[$i]['owner_lid'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['owner_id']);
$tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);
***************
*** 210,248 ****
}
! function read_single($ticket_id)
{
! return $this->so->read_single($ticket_id);
}
! function save($ticket,$action='')
{
! if ($building['access'])
{
! $building['access'] = 'private';
}
! else
{
! $building['access'] = 'public';
}
! if ($action=='edit')
{
! if ($building['building_id'] != 0)
{
! $message = $this->so->edit($ticket);
}
}
else
{
!
$ticket['location_code']=$this->bocommon->location_code($building['property_id'],$building['building_id']);
! $message = $this->so->add($ticket);
}
! return $message;
}
! function delete($ticket_id)
{
! $this->so->delete($ticket_id);
}
}
--- 247,596 ----
}
! function read_single($id)
{
!
! $this->so->update_view($id);
!
! $ticket = $this->so->read_single($id);
!
! $ticket['owner_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['owner_id']);
! $ticket['group_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
!
!
! $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
! $ticket['timestampopened'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$dateformat);
! // Figure out when it was opened and last closed
!
! $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','ASC',$id);
! $ticket['last_opened'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']);
!
! if($ticket['status']=='X')
! {
!
! $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$id);
! $ticket['timestampclosed']=
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$dateformat);
! }
!
!
!
! $status_text = array(
! 'R' => 'Re-opened',
! 'X' => 'Closed',
! 'O' => 'Opened',
! 'A' => 'Re-assigned',
! 'P' => 'Priority changed',
! 'T' => 'Category changed',
! 'S' => 'Subject changed',
! 'B' => 'Billing rate',
! 'H' => 'Billing hours'
! );
!
! $ticket['status_name'] =
lang($status_text[$ticket['status']]);
!
$ticket['assignedto_name']=$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
!
$ticket['owner_lid']=$GLOBALS['phpgw']->accounts->id2name($ticket['owner_id']);
!
$ticket['category_name']=ucfirst($this->cats->id2name($ticket['cat_id']));
!
! return $ticket;
}
! function read_additional_notes($id)
{
! $history_array =
$this->historylog->return_array(array(),array('C'),'','',$id);
! $i=1;
! while (is_array($history_array) && list(,$value) =
each($history_array))
{
! $additional_notes[] = array
! (
! 'value_count' => $i,
! 'value_date' =>
$GLOBALS['phpgw']->common->show_date($value['datetime']),
! 'value_user' => $value['owner'],
! 'value_note' =>
nl2br(stripslashes($value['new_value'])),
! );
! $i++;
}
!
! return $additional_notes;
! }
!
!
! function read_record_history($id)
! {
! $history_array =
$this->historylog->return_array(array('C','O'),array(),'','',$id);
! $i=0;
! while (is_array($history_array) && list(,$value) =
each($history_array))
{
!
! $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
! $record_history[$i]['value_user'] =
$value['owner'];
!
! switch ($value['status'])
! {
! case 'R': $type = lang('Re-opened');
break;
! case 'X': $type = lang('Closed');
break;
! case 'O': $type = lang('Opened');
break;
! case 'A': $type = lang('Re-assigned');
break;
! case 'P': $type = lang('Priority
changed'); break;
! case 'T': $type = lang('Category
changed'); break;
! case 'S': $type = lang('Subject
changed'); break;
! case 'H': $type = lang('Billable hours
changed'); break;
! case 'B': $type = lang('Billable rate
changed'); break;
! default: break;
! }
!
! $record_history[$i]['value_action'] =
$type?$type:'';
! unset($type);
!
! if ($value['status'] == 'A')
! {
! if (! $value['new_value'])
! {
!
$record_history[$i]['value_new_value'] = lang('None');
! }
! else
! {
!
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
! }
! }
! else if ($value['status'] == 'T')
! {
! $record_history[$i]['value_new_value']
= $this->cats->id2name($value['new_value']);
! }
! else if ($value['status'] != 'O' &&
$value['new_value'])
! {
! $record_history[$i]['value_new_value']
= $value['new_value'];
! }
! else
! {
! $record_history[$i]['value_new_value']
= '';
! }
}
! return $record_history;
! }
!
! function add($ticket)
! {
!
!
$ticket['location_code']=$this->bocommon->location_code($ticket['property_id'],$ticket['building_id'],$ticket['entrance_id'],$ticket['apartment_id']);
! $receipt = $this->so->add($ticket);
!
! $this->config->read_repository();
!
! if ($this->config->config_data['mailnotification'])
! {
! $errorcount=count($receipt['error']);
! $receipt =
$this->mail_ticket($receipt['id'],$fields_updated,$receipt);
!
! }
!
! return $receipt;
! }
!
! function update_ticket($values,$id)
! {
! $receipt = $this->so->update_ticket($values,$id);
!
! return $receipt;
! }
!
! function mail_ticket($id,$fields_updated,$receipt=0)
! {
! $errorcount=count($receipt['error']);
! $members = array();
!
! $ticket = $this->so->read_single($id);
!
! $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
! $timestampopened =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$dateformat);
!
! if($ticket['status']=='X')
! {
!
! $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$id);
! $timestampclosed =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$dateformat);
! }
!
!
! $stat = $ticket['status'];
! $status = array(
! 'R' => 'Re-opened',
! 'X' => 'Closed',
! 'O' => 'Opened',
! 'A' => 'Re-assigned',
! 'P' => 'Priority changed',
! 'T' => 'Category changed',
! 'S' => 'Subject changed',
! 'B' => 'Billing rate',
! 'H' => 'Billing hours'
! );
!
!
! $group_name=
$GLOBALS['phpgw']->accounts->id2name($ticket['group']);
!
! // build subject
! $ticket['subject'] = '['.lang('Ticket').' #'.$id.'
'.$group_name.'] '.lang($status[$stat]).': '.$ticket['subject'];
!
!
! $prefs_owner =
$GLOBALS['phpgw']->preferences->create_email_preferences($ticket['owner_id']);
!
! $from_address=$prefs_owner['email']['address'];
!
! //-----------from--------
!
! $user_id=$GLOBALS['phpgw_info']['user']['account_id'];
!
! $user_firstname =
$GLOBALS['phpgw_info']['user']['firstname'];
!
! $user_lastname
=$GLOBALS['phpgw_info']['user']['lastname'];
!
! $user_name= $user_firstname . " " .$user_lastname ;
!
! $prefs_user =
$GLOBALS['phpgw']->preferences->create_email_preferences($user_id);
! $user_address=$prefs_owner['email']['address'];
!
!
! $headers = "Return-Path: <". $coordinator_email
.">\r\n";
! $headers .= "From: " . $user_name . "<" . $user_address
.">\r\n";
! $headers .= "Bcc: " . $user_name . "<" . $user_address
.">\r\n";
! $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
! $headers .= "MIME-Version: 1.0\r\n";
!
! //-----------from--------
! // build body
! $body = '';
! $body .= lang('Ticket').' #'.$id."\n";
! $body .= lang('Date Opened').': '.$timestampopened."\n";
! $body .= lang('Category').': '.
$this->cats->id2name($ticket['cat_id']) ."\n";
! $body .= lang('Subject').': '. $ticket['subject'] ."\n";
! $body .= lang('Property').': '. $ticket['property_id']
."\n";
! $body .= lang('Building').': '. $ticket['building_id']
."\n";
! $body .= lang('Entrance').': '. $ticket['entrance_id']
."\n";
! $body .= lang('Apartment').': '.
$ticket['apartment_id'] ."\n";
! $body .= lang('Street').': '. $ticket['street'] ."\n";
! $body .= lang('Assigned To').':
'.$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto'])."\n";
! $body .= lang('Priority').': '.$priority."\n";
! // $body .= lang('Group').': '. $ticket['group_name']
."\n";
! $body .= lang('Opened By').': '. $ticket['owner_name']
."\n\n";
! $body .= lang('First Note Added').":\n";
! $body .=
stripslashes(strip_tags($ticket['details']))."\n\n";
!
!
/**************************************************************\
! * Display additional notes
*
!
\**************************************************************/
! if($fields_updated)
! {
! $i=1;
!
! $history_array =
$GLOBALS['phpgw']->historylog->return_array(array(),array('C'),'','',$id);
! while (is_array($history_array) &&
list(,$value) = each($history_array))
! {
! $body .= lang('Date') . ':
'.$GLOBALS['phpgw']->common->show_date($value['datetime'])."\n";
! $body .= lang('User') . ':
'.$user_name."\n";
! $body .=lang('Note').': '.
nl2br(stripslashes($value['new_value']))."\n\n";
! $i++;
! }
! $ticket['subject'].= "-" .$i;
! }
!
!
/**************************************************************\
! * Display record history
*
!
\**************************************************************/
!
! if($timestampclosed)
! {
! $body .= lang('Date Closed').':
'.$timestampclosed."\n\n";
! }
!
! if ($this->config->config_data['groupnotification'])
! {
! // select group recipients
! $members =
$GLOBALS['phpgw']->accounts->member($ticket['group']);
! }
!
! if ($this->config->config_data['ownernotification'])
! {
! // add owner to recipients
! $members[] = array('account_id' =>
$ticket['owner_id'], 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['owner_id']));
! }
!
! if ($this->config->config_data['assignednotification'])
! {
! // add assigned to recipients
! $members[] = array('account_id' =>
$ticket['assignedto'], 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']));
! }
!
! $errorcount = 0;
!
! $error = Array();
! $toarray = Array();
! $i=0;
! for ($i=0;$i<count($members);$i++)
{
! if ($members[$i]['account_id'])
{
! $prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences($members[$i]['account_id']);
! if (strlen($prefs['email']['address'])>
(strlen($members[$i]['account_name'])+1))
! {
!
$toarray[$prefs['email']['address']] = $prefs['email']['address'];
! }
! else
! {
!
$receipt['error'][$errorcount++] = array('msg'=> lang('Your message could not
be sent!'));
!
$receipt['error'][$errorcount++] = array('msg'=>lang('This user has not defined
an email address !') . ' : ' . $members[$i]['account_name']);
! }
}
}
+
+ if(count($toarray) > 1)
+ {
+ $to = implode(',',$toarray);
+ }
else
{
+ $to = current($toarray);
+ }
+
+ $mail_method=
$this->config->config_data['fmwrkorder_mail'];
+ // echo 'mail_method: '.$mail_method .'<BR>';
+
+ if ($mail_method=='smtp'):
+ {
+ // $rc = $this->send->msg('email', $to, $subject,
stripslashes($body), '', $cc, $bcc,$user_address,$user_name,'txt');
+ }
+ elseif ($mail_method=='sendmail'):
+ {
+ $rc= mail($to,$subject,stripslashes($body),
$headers);
+ }
+ else:
+ {
+ // $receipt['error'][$errorcount++] =
array('msg'=> lang('Mailing method is not chosen! ("admin" section)'));
+ }
+ endif;
! // $rc=1;
! if (!$rc)
! {
! $receipt['error'][$errorcount++] =
array('msg'=> lang('But Your message could not be sent by mail!'));
! $receipt['error'][$errorcount++] =
array('msg'=> lang('The mail server returned'));
! $receipt['error'][$errorcount++] =
array('msg'=> 'From :' . $user_name . '<' . $user_address .'>');
! $receipt['error'][$errorcount++] =
array('msg'=> 'to: '.$to);
! $receipt['error'][$errorcount++] =
array('msg'=> 'subject: '.$ticket['subject']);
! $receipt['error'][$errorcount++] =
array('msg'=> $body );
! // $receipt['error'][$errorcount++] =
array('msg'=> 'cc: ' . $cc);
! // $receipt['error'][$errorcount++] =
array('msg'=> 'bcc: '.$bcc);
! // $receipt['error'][$errorcount++] =
array('msg'=> 'group: '.$group);
! $receipt['error'][$errorcount++] =
array('msg'=> 'err_code: '.$this->send->err['code']);
! $receipt['error'][$errorcount++] =
array('msg'=> 'err_msg: '. htmlspecialchars($this->send->err['msg']));
! $receipt['error'][$errorcount++] =
array('msg'=> 'err_desc: '. $GLOBALS['phpgw']->err['desc']);
}
!
! //_debug_array($receipt);
! return $receipt;
}
!
! function delete($id)
{
! $this->so->delete($id);
}
}
Index: class.sotts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sotts.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.sotts.inc.php 3 Feb 2003 21:50:22 -0000 1.1
--- class.sotts.inc.php 6 Feb 2003 09:03:45 -0000 1.2
***************
*** 16,21 ****
--- 16,24 ----
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
+ // $this->bo =
CreateObject($this->currentapp.'.botts');
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp);
+ $this->config =
CreateObject('phpgwapi.config');
if
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
***************
*** 57,61 ****
else
{
! $ordermethod = ' order by objekt_id DESC';
}
--- 60,64 ----
else
{
! $ordermethod = ' order by property_id DESC';
}
***************
*** 126,131 ****
$tickets[$i]['grants'] =
$ngrants;
! $this->db2->query("select count(*) from
phpgw_fm_tts_views where view_id='" . $this->db->f('id')
! . "' and view_account_id='" .
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
$this->db2->next_record();
--- 129,134 ----
$tickets[$i]['grants'] =
$ngrants;
! $this->db2->query("select count(*) from
phpgw_fm_tts_views where id='" . $this->db->f('id')
! . "' and account_id='" .
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
$this->db2->next_record();
***************
*** 143,147 ****
function read_single($id)
{
! $sql = "SELECT * FROM boei_bygg where
objekt_id='$property_id' and bygg_id='$building_id'";
$this->db->query($sql,__LINE__,__FILE__);
--- 146,150 ----
function read_single($id)
{
! $sql = "SELECT * FROM phpgw_fm_tts_tickets WHERE
id=$id";
$this->db->query($sql,__LINE__,__FILE__);
***************
*** 149,167 ****
if ($this->db->next_record())
{
! $building['property_id'] =
(int)$this->db->f('objekt_id');
! $building['building_id'] =
(int)$this->db->f('bygg_id');
! $building['owner']
= $this->db->f('owner');
! $building['name']
= stripslashes($this->db->f('byggnavn'));
! $building['generaladdress'] =
stripslashes($this->db->f('generelladresse'));
! $building['access']
= $this->db->f('access');
! $building['date']
= $this->db->f('entry_date');
! $building['cat_id']
= (int)$this->db->f('cat_id');
! $building['omraade_id'] =
$this->db->f('omraade_id');
! $building['part_of_town'] =
$this->db->f('bydel');
! $building['building_type_id'] =
$this->db->f('building_type_id');
! $building['location_code'] =
$this->db->f('location_code');
- return $building;
}
}
--- 152,197 ----
if ($this->db->next_record())
{
! $ticket['assignedto'] =
(int)$this->db->f('assignedto');
! $ticket['owner_id'] =
(int)$this->db->f('owner');
! $ticket['status'] =
$this->db->f('status');
! $ticket['cat_id'] =
(int)$this->db->f('cat_id');
! $ticket['subject'] =
stripslashes($this->db->f('subject'));
! $ticket['priority'] =
$this->db->f('priority');
! $ticket['details'] =
stripslashes($this->db->f('details'));
! $ticket['location_code'] =
$this->db->f('location_code');
! $ticket['property_id'] =
$this->db->f('property_id');
! $ticket['building_id'] =
$this->db->f('building_id');
! $ticket['entrance_id'] =
$this->db->f('entrance_id');
! $ticket['apartment_id'] =
$this->db->f('apartment_id');
! $ticket['street'] =
$this->db->f('street');
!
! $owner_id=(int)$this->db->f('owner');
! $this->db->query("SELECT
account_firstname,account_lastname FROM phpgw_accounts WHERE
account_id='$owner_id' ");
! $this->db->next_record();
!
! $ticket['owner_name'] =
$this->db->f('account_firstname') . " " .$this->db->f('account_lastname') ;
}
+ //_debug_array($ticket);
+
+
+ return $ticket;
+
+
+ }
+
+ function update_view($id='')
+ {
+ // Have they viewed this ticket before ?
+ $this->db->query("select count(*) from
phpgw_fm_tts_views where id='$id' "
+ . "and account_id='" .
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
+ $this->db->next_record();
+
+ if (! $this->db->f(0))
+ {
+ $this->db->query("insert into
phpgw_fm_tts_views (id,account_id,time) values ('$id','"
+ .
$GLOBALS['phpgw_info']['user']['account_id'] . "','" . time() .
"')",__LINE__,__FILE__);
+ }
+
}
***************
*** 169,182 ****
{
! $this->db->query("INSERT INTO boei_bygg (location_code,
objekt_id,bygg_id,owner,access,entry_date,byggnavn,generelladresse,cat_id) "
! . "VALUES ('" . $building['location_code'].
"','" . $building['property_id'] . "','" . $building['building_id'] . "','" .
$this->account . "','" . $building['access'] . "','" . time() . "','" .
$building['name']
! . "','" . $building['generaladdress'] ."','" .
$building['cat_id']. "')",__LINE__,__FILE__);
! $ids['building_id'] = $building['building_id'];
! $ids['property_id'] = $building['property_id'];
! $message = lang('Building has been saved');
! return $message;
}
function edit($ticket)
--- 199,354 ----
{
! $this->db->query("insert into phpgw_fm_tts_tickets
(priority,owner,"
! .
"assignedto,subject,cat_id,status,details,location_code,"
! .
"property_id,property_name,building_id,building_name,entrance_id,floor,apartment_id,street,tenant_id,tenant_name,contact_phone)
values ('"
! . $ticket['priority'] . "','"
! . $GLOBALS['phpgw_info']['user']['account_id']
. "','"
! . $ticket['assignedto'] . "','"
! . $this->db->db_addslashes($ticket['subject'])
. "','"
! . $ticket['cat_id'] . "','O','"
! . $this->db->db_addslashes($ticket['details'])
. "','"
! . $ticket['location_code'] . "','"
! . $ticket['property_id'] . "','"
! . $ticket['property_name'] . "','"
! . $ticket['building_id'] . "','"
! . $ticket['building_name'] . "','"
! . $ticket['entrance_id'] . "','"
! . $ticket['floor'] . "','"
! . $ticket['apartment_id'] . "','"
! . $ticket['street'] . "','"
! . $ticket['tenant_id'] . "','"
! . $ticket['tenant_name'] . "','"
! . $ticket['contact_phone'] .
"')",__LINE__,__FILE__);
!
! $id =
$this->db->get_last_insert_id('phpgw_fm_tts_tickets','id');
!
! $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp);
! $this->historylog->add('O',$id,mktime(),'');
!
! $receipt['message'][0]=array('msg'=>lang('Ticket has
been saved'));
! $receipt['id'] = $id;
! return $receipt;
! }
!
! function update_ticket($ticket,$id='')
! {
! // DB Content is fresher than http posted value.
! $this->db->query("select * from phpgw_fm_tts_tickets
where id='$id'",__LINE__,__FILE__);
! $this->db->next_record();
!
! $oldassigned = $this->db->f('assignedto');
! $oldpriority = $this->db->f('priority');
! $oldcat_id = $this->db->f('cat_id');
! $old_status = $this->db->f('status');
! $old_billable_hours = $this->db->f('billable_hours');
! $old_billable_rate = $this->db->f('billable_rate');
!
! // Figure out and last note
!
! $history_values =
$this->historylog->return_array(array(),array('C'),'history_timestamp','DESC',$id);
! $old_note = $history_values[0]['new_value'];
!
! if(!$old_note)
! {
! $old_note = $this->db->f('details');
! }
!
!
! $this->db->transaction_begin();
! /*
! ** phpgw_fm_tts_append.append_type - Defs
! ** R - Reopen ticket
! ** X - Ticket closed
! ** O - Ticket opened
! ** C - Comment appended
! ** A - Ticket assignment
! ** P - Priority change
! ** T - Category change
! ** S - Subject change
! ** B - Billing rate
! ** H - Billing hours
! */
!
! if ($old_status != $ticket['status'])
! {
! $fields_updated = True;
!
$this->historylog->add($ticket['status'],$id,$ticket['status'],$old_status);
!
! $this->db->query("update phpgw_fm_tts_tickets
set status='"
! . $ticket['status'] . "' where
id='$id'",__LINE__,__FILE__);
! }
!
! if ($oldassigned != $ticket['assignedto'])
! {
! $fields_updated = True;
! $this->db->query("update phpgw_fm_tts_tickets
set assignedto='" . $ticket['assignedto']
! . "' where id='$id'",__LINE__,__FILE__);
!
$this->historylog->add('A',$id,$ticket['assignedto'],$oldassigned);
! }
!
! if ($oldpriority != $ticket['priority'])
! {
! $fields_updated = True;
! $this->db->query("update phpgw_fm_tts_tickets
set priority='" . $ticket['priority']
! . "' where id='$id'",__LINE__,__FILE__);
!
$this->historylog->add('P',$id,$ticket['priority'],$oldpriority);
! }
!
! if ($oldcat_id != $ticket['cat_id'])
! {
! $fields_updated = True;
! $this->db->query("update phpgw_fm_tts_tickets
set cat_id='" . $ticket['cat_id']
! . "' where id='$id'",__LINE__,__FILE__);
!
$this->historylog->add('T',$id,$ticket['cat_id'],$oldcat_id);
! }
!
! if ($old_billable_hours != $ticket['billable_hours'])
! {
! $fields_updated = True;
! $this->db->query("update phpgw_fm_tts_tickets
set billable_hours='" . $ticket['billable_hours']
! . "' where id='$id'",__LINE__,__FILE__);
!
$this->historylog->add('H',$id,$ticket['billable_hours'],$old_billable_hours);
! }
!
! if ($old_billable_rate != $ticket['billable_rate'])
! {
! $fields_updated = True;
! $this->db->query("update phpgw_fm_tts_tickets
set billable_rate='" . $ticket['billable_rate']
! . "' where id='$id'",__LINE__,__FILE__);
!
$this->historylog->add('B',$id,$ticket['billable_rate'],$old_billable_rate);
! }
!
! if (($old_note != $ticket['note']) && $ticket['note'])
! {
! $fields_updated = True;
!
$this->historylog->add('C',$id,$ticket['note'],$old_note);
!
! // Do this before we go into mail_ticket()
! $this->db->transaction_commit();
!
! $this->config->read_repository();
!
! if
($this->config->config_data['mailnotification'])
! {
! //
$receipt=$this->bo->mail_ticket($id,$fields_updated,'');
!
! }
! }
! else
! {
! // Only do our commit once
! $this->db->transaction_commit();
! }
!
! if ($fields_updated)
! {
! $receipt['message'][0]= array('msg' =>
lang('Ticket has been updated'));
! }
!
! return $receipt;
}
+
function edit($ticket)
Index: class.uiinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiinvestment.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uiinvestment.inc.php 3 Feb 2003 21:50:22 -0000 1.6
--- class.uiinvestment.inc.php 6 Feb 2003 09:03:45 -0000 1.7
***************
*** 475,479 ****
}
! if(!$values['property_id'] ||
!$values['equipment_id'])
{
$receipt['error'][$errorcount++]=array('msg'=>lang('Pleace select a location -
or an equipment !'));
--- 475,479 ----
}
! if(!$values['property_id'] &&
!$values['equipment_id'])
{
$receipt['error'][$errorcount++]=array('msg'=>lang('Pleace select a location -
or an equipment !'));
Index: class.uitts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uitts.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.uitts.inc.php 3 Feb 2003 21:50:22 -0000 1.1
--- class.uitts.inc.php 6 Feb 2003 09:03:45 -0000 1.2
***************
*** 193,196 ****
--- 193,199 ----
);
+ $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
+
$GLOBALS['phpgw']->preferences->read_repository();
if
($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'])
***************
*** 201,204 ****
--- 204,209 ----
$data = array
(
+ 'message'
=> $receipt['message'],
+ 'error'
=> $receipt['error'],
'autorefresh'
=> $autorefresh,
'links'
=> $links,
***************
*** 242,250 ****
$sub = get_var('sub',array('POST','GET'));
! $values'[property_id'] =
get_var('property_id',array('POST'));
! $values'[building_id'] =
get_var('building_id',array('POST'));
! $values'[entrance_id'] =
get_var('entrance_id',array('POST'));
! $values'[apartment_id'] =
get_var('apartment_id',array('POST'));
! $values'[equipment_id'] =
get_var('equipment_id',array('POST'));
$location_data=$this->bocommon->initiate_ui_location(array('equipment'
=> False,
--- 247,255 ----
$sub = get_var('sub',array('POST','GET'));
! $values['property_id'] =
get_var('property_id',array('POST'));
! $values['building_id'] =
get_var('building_id',array('POST'));
! $values['entrance_id'] =
get_var('entrance_id',array('POST'));
! $values['apartment_id'] =
get_var('apartment_id',array('POST'));
! $values['equipment_id'] =
get_var('equipment_id',array('POST'));
$location_data=$this->bocommon->initiate_ui_location(array('equipment'
=> False,
***************
*** 255,264 ****
'apartment_id'
=> $values['apartment_id'],
'equipment_id'
=> $values['equipment_id']));
!
!
! _debug_array($values);
if ($values['save'])
{
! // $message = $this->bo->save($values);
}
--- 260,299 ----
'apartment_id'
=> $values['apartment_id'],
'equipment_id'
=> $values['equipment_id']));
! //_debug_array($values);
if ($values['save'])
{
! $errorcount = 0;
!
! if(!$values['subject'])
! {
!
$receipt['error'][$errorcount++]=array('msg'=>lang('Please type a subject for
this ticket !'));
! }
!
! if(!$values['assignedto'])
! {
!
$receipt['error'][$errorcount++]=array('msg'=>lang('Please select a person to
handle the ticket !'));
! }
!
! if(!$values['cat_id'])
! {
!
$receipt['error'][$errorcount++]=array('msg'=>lang('Please select a category
!'));
! }
!
! if(!$values['details'])
! {
!
$receipt['error'][$errorcount++]=array('msg'=>lang('Please give som details
!'));
! }
!
! if(!$values['property_id'] &&
!$values['equipment_id'])
! {
!
$receipt['error'][$errorcount++]=array('msg'=>lang('Pleace select a location -
or an equipment !'));
! }
!
! if(!$receipt['error'])
! {
! $receipt = $this->bo->add($values);
!
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
! header('Location: '.
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index&sub=ticket&order=id&sort=DESC'));
! }
}
***************
*** 269,272 ****
--- 304,312 ----
);
+ if(!$values['assignedto'])
+ {
+ $values['assignedto']=
$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'];
+ }
+
$data = array
(
***************
*** 275,280 ****
'lang_no_user'
=> lang('Select user'),
'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
! 'select_user_name'
=> 'values[user_id]',
! 'user_list'
=> $this->bocommon->get_user_list('select',$values['user_id']),
'lang_priority'
=> lang('Priority'),
--- 315,320 ----
'lang_no_user'
=> lang('Select user'),
'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
! 'select_user_name'
=> 'values[assignedto]',
! 'user_list'
=> $this->bocommon->get_user_list('select',$values['assignedto']),
'lang_priority'
=> lang('Priority'),
***************
*** 301,305 ****
'value_building_id'
=> $building_id,
'value_cat'
=> $building['cat'],
! 'message'
=> $message,
'lang_name_statustext' =>
lang('Enter the name of the building'),
'lang_property_id_statustext' => lang('Enter
Property ID'),
--- 341,346 ----
'value_building_id'
=> $building_id,
'value_cat'
=> $building['cat'],
! 'error'
=> $receipt['error'],
! 'message'
=> $receipt['message'],
'lang_name_statustext' =>
lang('Enter the name of the building'),
'lang_property_id_statustext' => lang('Enter
Property ID'),
***************
*** 363,387 ****
function view()
{
! $property_id = get_var('property_id',array('GET'));
! $building_id = get_var('building_id',array('GET'));
!
$GLOBALS['phpgw']->xslttpl->add_file(array('building',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! $building =
$this->bo->read_single($property_id,$building_id);
$data = array
(
! 'appname' =>
lang('building'),
! 'function_msg' => lang('view
building'),
! 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.index'),
! 'lang_name' => lang('name'),
! 'lang_category' => lang('category'),
! 'lang_access' => lang('access'),
! 'lang_time_created' => lang('time created'),
! 'lang_done' => lang('done'),
! 'value_name' => $building['name'],
! 'value_access' =>
lang(ucfirst($building['access'])),
! 'value_cat' =>
$this->cats->id2name($building['cat']),
! 'value_date' =>
$GLOBALS['phpgw']->common->show_date($building['date'])
);
--- 404,535 ----
function view()
{
! $id = get_var('id',array('GET'));
! $sub = get_var('sub',array('POST','GET'));
! $values = get_var('values',array('POST','GET'));
!
!
$GLOBALS['phpgw']->xslttpl->add_file(array('tts',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
!
! if($values['save'])
! {
! $this->bo->update_ticket($values,$id);
! }
! $ticket = $this->bo->read_single($id);
! $additional_notes =
$this->bo->read_additional_notes($id);
! $record_history = $this->bo->read_record_history($id);
! //_debug_array($values);
! //_debug_array($ticket);
! //_debug_array($additional_notes);
! //_debug_array($record_history);
!
! $request_link
=$GLOBALS['phpgw']->link('/property/add_request.php',"objekt_id=$objekt_id"
! .
"&property_name=$property_name&bygg_id=$bygg_id&building_name=$building_name"
! .
"&seksjons_id=$seksjons_id&etasje=$etasje&leie_id=$leie_id&street=$street"
! .
"&tenant_name=$tenant_name&tenant_id=$tenant_id&contact_phone=$contact_phone");
!
!
! $order_link =
$GLOBALS['phpgw']->link('/property/add_workorder.php',"objekt_id=$objekt_id"
! .
"&property_name=$property_name&bygg_id=$bygg_id&building_name=$building_name"
! .
"&seksjons_id=$seksjons_id&etasje=$etasje&leie_id=$leie_id&street=$street"
! .
"&tenant_name=$tenant_name&tenant_id=$tenant_id&contact_phone=$contact_phone");
!
! $form_link = array
! (
! 'menuaction' =>
$this->currentapp.'.uitts.view',
! 'id' => $id,
! 'sub' => 'tts'
! );
!
!
! $table_header_history[] = array
! (
! 'lang_date' => lang('Date'),
! 'lang_user' => lang('User'),
! 'lang_action' => lang('Action'),
! 'lang_new_value' => lang('New value')
! );
!
! $table_header_additional_notes[] = array
! (
! 'lang_count' => '#',
! 'lang_date' => lang('Date'),
! 'lang_user' => lang('User'),
! 'lang_note' => lang('Note'),
! );
$data = array
(
!
! 'lang_location_code' =>
lang('Location Code'),
! 'lang_property_id'
=> lang('Property id'),
! 'lang_building_id'
=> lang('Building id'),
! 'lang_entrance_id'
=> lang('Entrance id'),
! 'lang_apartment_id'
=> lang('Apartment id'),
! 'lang_street'
=> lang('Street'),
! 'value_location_code' =>
$ticket['location_code'],
! 'value_property_id'
=> $ticket['property_id'],
! 'value_building_id'
=> $ticket['building_id'],
! 'value_entrance_id'
=> $ticket['entrance_id'],
! 'value_apartment_id' =>
$ticket['apartment_id'],
! 'value_street'
=> $ticket['street'],
!
! 'lang_ticket'
=> lang('Ticket'),
! 'table_header_additional_notes' =>
$table_header_additional_notes,
! 'table_header_history' =>
$table_header_history,
! 'lang_status'
=> lang('Status'),
! 'select_status_name' =>
'values[status]',
! 'status_list'
=> $this->bo->get_status_list($ticket['status']),
! 'lang_status_statustext' =>
lang('Set the status of the ticket'),
!
! 'lang_no_user'
=> lang('Select user'),
! 'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
! 'select_user_name'
=> 'values[assignedto]',
! 'user_list'
=> $this->bocommon->get_user_list('select',$ticket['assignedto']),
!
! 'lang_priority'
=> lang('Priority'),
! 'value_priority'
=> $ticket['priority'],
! 'lang_priority_statustext' =>
lang('Select the priority the selection belongs to.'),
! 'select_priority_name' =>
'values[priority]',
! 'priority_list'
=> $this->bo->get_priority_list($ticket['priority']),
!
! 'lang_no_cat'
=> lang('no category'),
! 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
! 'select_name'
=> 'values[cat_id]',
! 'cat_list'
=> $this->cats->formatted_xslt_list(array('format' =>
'select','selected' => $ticket['cat_id'],'globals' => True)),
! 'lang_category'
=> lang('category'),
! 'value_category_name' =>
$ticket['category_name'],
!
! 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
! 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index&sub='
. $sub),
! 'value_subject'
=> '[ #'. $id . ' ] - ' .$ticket['subject'],
!
! 'lang_details'
=> lang('Details'),
! 'value_details'
=> $ticket['details'],
! 'lang_details_statustext' =>
lang('Add new comments'),
!
! 'lang_additional_notes' =>
lang('Additional notes'),
!
! 'lang_opendate'
=> lang('Open Date'),
! 'value_opendate'
=> $ticket['timestampopened'],
!
! 'lang_assignedfrom'
=> lang('Assigned from'),
! 'value_assignedfrom' =>
$ticket['owner_name'],
! 'lang_assignedto'
=> lang('Assigned to'),
! 'value_assignedto'
=> $ticket['assignedto_name'],
!
! 'lang_no_additional_notes' =>
lang('No additional notes'),
! 'lang_no_history'
=> lang('No history for this record'),
! 'additional_notes'
=> $additional_notes,
! 'record_history'
=> $record_history,
! 'request_link'
=> $request_link,
! 'order_link'
=> $order_link,
! 'lang_generate_request' =>
lang('Generate Request'),
! 'lang_generate_workorder' =>
lang('Generate order'),
! 'appname'
=> lang($this->currentapp),
! 'function_msg'
=> lang('view ticket detail'),
! 'lang_save'
=> lang('save'),
! 'lang_name'
=> lang('name'),
! 'lang_done'
=> lang('done'),
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,1.1,1.2 class.sotts.inc.php,1.1,1.2 class.uiinvestment.inc.php,1.6,1.7 class.uitts.inc.php,1.1,1.2,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/templates/default tts.xsl,1.1,1.2
- Next by Date:
[Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,1.2,1.3 class.sotts.inc.php,1.2,1.3 class.uitts.inc.php,1.2,1.3
- Previous by thread:
[Phpgroupware-cvs] CVS: property/templates/default tts.xsl,1.1,1.2
- Next by thread:
[Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,1.2,1.3 class.sotts.inc.php,1.2,1.3 class.uitts.inc.php,1.2,1.3
- Index(es):