phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/class.sotts2.php, 1.1.1.3


From: nomail
Subject: [Phpgroupware-cvs] property/class.sotts2.php, 1.1.1.3
Date: Fri, 21 May 2004 16:05:22 -0000

Update of /property
Modified Files:
        Branch: 
          class.sotts2.php

date: 2004/04/23 21:26:33;  author: sigurdne;  state: Exp;  lines: +206 -206

Log Message:
no message
=====================================================================
Index: property/class.sotts2.php
diff -u property/class.sotts2.php:1.1.1.2 property/class.sotts2.php:1.1.1.3
--- property/class.sotts2.php:1.1.1.2   Fri Apr 23 20:26:09 2004
+++ property/class.sotts2.php   Fri Apr 23 21:26:33 2004
@@ -1,206 +1,206 @@
-<?php
-       
/**************************************************************************\
-       * phpGroupWare - property                                               
   *
-       * http://www.phpgroupware.org                                           
   *
-       *                                                                       
   *
-       * Facilities Management                                                 
   *
-       * Written by Sigurd Nes [sigurdne at online.no]                         
   *
-       * 
------------------------------------------------------------------------ *
-       * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
-       * This program is part of the GNU project, see http://www.gnu.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.                                            
   *
-       
\**************************************************************************/
-
-       class property_sotts2
-       {
-               function property_sotts2()
-               {
-                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->db               = $GLOBALS['phpgw']->db;
-                       $this->db2              = $this->db;
-                       $this->bo               = 
CreateObject($this->currentapp.'_botts');
-                       $this->historylog       = 
CreateObject($this->currentapp.'_historylog','tts');
-                       $this->config           = 
CreateObject('phpgwapi_config');
-                       $this->bocommon         = 
CreateObject($this->currentapp.'_bocommon');
-
-                       $this->join                     = $this->bocommon->join;
-               }
-
-               function update_ticket($ticket,$id='')
-               {
-                       // DB Content is fresher than http posted value.
-                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT * 
from fm_tts_tickets where id='$id'");
-
-
-
-                       $location_code  = $dbresult->fields['location_code'];
-                       $oldfinnish_date        = 
$dbresult->fields['finnish_date'];
-                       $oldassigned            = 
$dbresult->fields['assignedto'];
-                       $oldgroup_id            = $dbresult->fields['group_id'];
-                       $oldpriority            = $dbresult->fields['priority'];
-                       $oldcat_id                      = 
$dbresult->fields['cat_id'];
-                       $old_status             = $dbresult->fields['status'];
-                       $old_billable_hours     = 
$dbresult->fields['billable_hours'];
-                       $old_billable_rate      = 
$dbresult->fields['billable_rate'];
-                       if($oldcat_id ==0){$oldcat_id ='';}
-                       if($oldassigned ==0){$oldassigned ='';}
-                       if($oldgroup_id ==0){$oldgroup_id ='';}
-
-                       // 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 = $dbresult->fields['details'];
-                       }
-
-
-                       $GLOBALS['phpgw']->db->begintrans();
-
-                       /*
-                       ** phpgw_fm_tts_append.append_type - Defs
-                       ** R - Reopen ticket
-                       ** X - Ticket closed
-                       ** O - Ticket opened
-                       ** C - Comment appended
-                       ** A - Ticket assignment
-                       ** G - Ticket group assignment
-                       ** P - Priority change
-                       ** T - Category change
-                       ** S - Subject change
-                       ** B - Billing rate
-                       ** H - Billing hours
-                       ** F - finnish date
-                       */
-
-                       $finnish_date   = 
$this->bocommon->date_to_timestamp($ticket['finnish_date']);
-
-                       if ($oldfinnish_date && $ticket['finnish_date']):
-                       {
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set finnish_date2='" . $finnish_date
-                                       . "' where id='$id'");
-                       }
-                       elseif(!$oldfinnish_date && $ticket['finnish_date'] ):
-                       {
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set finnish_date='" . $finnish_date
-                                       . "' where id='$id'");
-                       }
-                       endif;
-
-                       if($ticket['finnish_date'])
-                       {
-                               if ($oldfinnish_date != $finnish_date)
-                               {
-                                       $fields_updated = True;
-                                       
$this->historylog->add('F',$id,$finnish_date,$oldfinnish_date);
-                               }
-                       }
-
-                       if ($old_status != $ticket['status'])
-                       {
-                               $fields_updated = True;
-                               if($old_status=='X')
-                               {
-                                       
$this->historylog->add('R',$id,$ticket['status'],$old_status);
-
-                                       $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set status='O' where id='$id'");
-                               }
-                               else
-                               {
-                                       
$this->historylog->add($ticket['status'],$id,$ticket['status'],$old_status);
-
-                                       $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set status='"
-                                       . $ticket['status'] . "' where 
id='$id'");
-                               }
-                       }
-
-                       if ($oldassigned != $ticket['assignedto'])
-                       {
-                               $fields_updated = True;
-
-                               $value_set=array('assignedto'   => 
$ticket['assignedto']);
-                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
-
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set $value_set where id='$id'");
-                               
$this->historylog->add('A',$id,$ticket['assignedto'],$oldassigned);
-                       }
-
-                       if ($oldgroup_id != $ticket['group_id'])
-                       {
-                               $fields_updated = True;
-
-                               $value_set=array('group_id'     => 
$ticket['group_id']);
-                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
-
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set $value_set where id='$id'");
-                               
$this->historylog->add('G',$id,$ticket['group_id'],$oldgroup_id);
-                       }
-
-                       if ($oldpriority != $ticket['priority'])
-                       {
-                               $fields_updated = True;
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set priority='" . $ticket['priority']
-                                       . "' where id='$id'");
-                               
$this->historylog->add('P',$id,$ticket['priority'],$oldpriority);
-                       }
-
-                       if ($oldcat_id != $ticket['cat_id'])
-                       {
-                               $fields_updated = True;
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set cat_id='" . $ticket['cat_id']
-                                       . "' where id='$id'");
-                               
$this->historylog->add('T',$id,$ticket['cat_id'],$oldcat_id);
-                       }
-
-                       if ($old_billable_hours != $ticket['billable_hours'])
-                       {
-                               $fields_updated = True;
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set billable_hours='" . $ticket['billable_hours']
-                                       . "' where id='$id'");
-                               
$this->historylog->add('H',$id,$ticket['billable_hours'],$old_billable_hours);
-                       }
-
-                       if ($old_billable_rate != $ticket['billable_rate'])
-                       {
-                               $fields_updated = True;
-                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set billable_rate='" . $ticket['billable_rate']
-                                       . "' where id='$id'");
-                               
$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,$this->db->db_addslashes($ticket['note']),$old_note);
-                               $GLOBALS['phpgw']->db->committrans();
-                       }
-                       else
-                       {
-                               // Only do our commit once
-                               $GLOBALS['phpgw']->db->committrans();
-                       }
-
-                       if ($fields_updated)
-                       {
-                               $this->config->read_repository();
-
-                               if 
($this->config->config_data['mailnotification'])
-                               {
-                                       
$receipt=$this->bo->mail_ticket($id,$fields_updated,'',$location_code);
-
-                               }
-
-                               $receipt['message'][]= array('msg' => 
lang('Ticket has been updated'));
-                       }
-
-                       return $receipt;
-               }
-
-       }
-?>
+<?php
+       
/**************************************************************************\
+       * phpGroupWare - property                                               
   *
+       * http://www.phpgroupware.org                                           
   *
+       *                                                                       
   *
+       * Facilities Management                                                 
   *
+       * Written by Sigurd Nes [sigurdne at online.no]                         
   *
+       * 
------------------------------------------------------------------------ *
+       * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
+       * This program is part of the GNU project, see http://www.gnu.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.                                            
   *
+       
\**************************************************************************/
+
+       class property_sotts2
+       {
+               function property_sotts2()
+               {
+                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->db               = $GLOBALS['phpgw']->db;
+                       $this->db2              = $this->db;
+                       $this->bo               = 
CreateObject($this->currentapp.'_botts');
+                       $this->historylog       = 
CreateObject($this->currentapp.'_historylog','tts');
+                       $this->config           = 
CreateObject('phpgwapi_config');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'_bocommon');
+
+                       $this->join                     = $this->bocommon->join;
+               }
+
+               function update_ticket($ticket,$id='')
+               {
+                       // DB Content is fresher than http posted value.
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT * 
from fm_tts_tickets where id='$id'");
+
+
+
+                       $location_code  = $dbresult->fields['location_code'];
+                       $oldfinnish_date        = 
$dbresult->fields['finnish_date'];
+                       $oldassigned            = 
$dbresult->fields['assignedto'];
+                       $oldgroup_id            = $dbresult->fields['group_id'];
+                       $oldpriority            = $dbresult->fields['priority'];
+                       $oldcat_id                      = 
$dbresult->fields['cat_id'];
+                       $old_status             = $dbresult->fields['status'];
+                       $old_billable_hours     = 
$dbresult->fields['billable_hours'];
+                       $old_billable_rate      = 
$dbresult->fields['billable_rate'];
+                       if($oldcat_id ==0){$oldcat_id ='';}
+                       if($oldassigned ==0){$oldassigned ='';}
+                       if($oldgroup_id ==0){$oldgroup_id ='';}
+
+                       // 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 = $dbresult->fields['details'];
+                       }
+
+
+                       $GLOBALS['phpgw']->db->begintrans();
+
+                       /*
+                       ** phpgw_fm_tts_append.append_type - Defs
+                       ** R - Reopen ticket
+                       ** X - Ticket closed
+                       ** O - Ticket opened
+                       ** C - Comment appended
+                       ** A - Ticket assignment
+                       ** G - Ticket group assignment
+                       ** P - Priority change
+                       ** T - Category change
+                       ** S - Subject change
+                       ** B - Billing rate
+                       ** H - Billing hours
+                       ** F - finnish date
+                       */
+
+                       $finnish_date   = 
$this->bocommon->date_to_timestamp($ticket['finnish_date']);
+
+                       if ($oldfinnish_date && $ticket['finnish_date']):
+                       {
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set finnish_date2='" . $finnish_date
+                                       . "' where id='$id'");
+                       }
+                       elseif(!$oldfinnish_date && $ticket['finnish_date'] ):
+                       {
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set finnish_date='" . $finnish_date
+                                       . "' where id='$id'");
+                       }
+                       endif;
+
+                       if($ticket['finnish_date'])
+                       {
+                               if ($oldfinnish_date != $finnish_date)
+                               {
+                                       $fields_updated = True;
+                                       
$this->historylog->add('F',$id,$finnish_date,$oldfinnish_date);
+                               }
+                       }
+
+                       if ($old_status != $ticket['status'])
+                       {
+                               $fields_updated = True;
+                               if($old_status=='X')
+                               {
+                                       
$this->historylog->add('R',$id,$ticket['status'],$old_status);
+
+                                       $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set status='O' where id='$id'");
+                               }
+                               else
+                               {
+                                       
$this->historylog->add($ticket['status'],$id,$ticket['status'],$old_status);
+
+                                       $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set status='"
+                                       . $ticket['status'] . "' where 
id='$id'");
+                               }
+                       }
+
+                       if ($oldassigned != $ticket['assignedto'])
+                       {
+                               $fields_updated = True;
+
+                               $value_set=array('assignedto'   => 
$ticket['assignedto']);
+                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
+
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set $value_set where id='$id'");
+                               
$this->historylog->add('A',$id,$ticket['assignedto'],$oldassigned);
+                       }
+
+                       if ($oldgroup_id != $ticket['group_id'])
+                       {
+                               $fields_updated = True;
+
+                               $value_set=array('group_id'     => 
$ticket['group_id']);
+                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
+
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set $value_set where id='$id'");
+                               
$this->historylog->add('G',$id,$ticket['group_id'],$oldgroup_id);
+                       }
+
+                       if ($oldpriority != $ticket['priority'])
+                       {
+                               $fields_updated = True;
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set priority='" . $ticket['priority']
+                                       . "' where id='$id'");
+                               
$this->historylog->add('P',$id,$ticket['priority'],$oldpriority);
+                       }
+
+                       if ($oldcat_id != $ticket['cat_id'])
+                       {
+                               $fields_updated = True;
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set cat_id='" . $ticket['cat_id']
+                                       . "' where id='$id'");
+                               
$this->historylog->add('T',$id,$ticket['cat_id'],$oldcat_id);
+                       }
+
+                       if ($old_billable_hours != $ticket['billable_hours'])
+                       {
+                               $fields_updated = True;
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set billable_hours='" . $ticket['billable_hours']
+                                       . "' where id='$id'");
+                               
$this->historylog->add('H',$id,$ticket['billable_hours'],$old_billable_hours);
+                       }
+
+                       if ($old_billable_rate != $ticket['billable_rate'])
+                       {
+                               $fields_updated = True;
+                               $GLOBALS['phpgw']->db->Execute("UPDATE 
fm_tts_tickets set billable_rate='" . $ticket['billable_rate']
+                                       . "' where id='$id'");
+                               
$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,$this->db->db_addslashes($ticket['note']),$old_note);
+                               $GLOBALS['phpgw']->db->committrans();
+                       }
+                       else
+                       {
+                               // Only do our commit once
+                               $GLOBALS['phpgw']->db->committrans();
+                       }
+
+                       if ($fields_updated)
+                       {
+                               $this->config->read_repository();
+
+                               if 
($this->config->config_data['mailnotification'])
+                               {
+                                       
$receipt=$this->bo->mail_ticket($id,$fields_updated,'',$location_code);
+
+                               }
+
+                               $receipt['message'][]= array('msg' => 
lang('Ticket has been updated'));
+                       }
+
+                       return $receipt;
+               }
+
+       }
+?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]