phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.sotts2.inc.php,NONE,1.1 class


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.sotts2.inc.php,NONE,1.1 class.botts.inc.php,1.3,1.4 class.sotts.inc.php,1.3,1.4 class.uitts.inc.php,1.3,1.4
Date: Thu, 06 Feb 2003 09:06:03 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv11229/inc

Modified Files:
        class.botts.inc.php class.sotts.inc.php class.uitts.inc.php 
Added Files:
        class.sotts2.inc.php 
Log Message:
no message

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * 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 sotts2
        {
                function sotts2()
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->bo               = 
CreateObject($this->currentapp.'.botts');
                        $this->historylog       = 
createobject('phpgwapi.historylog',$this->currentapp .'_tts');
                        $this->config           = 
CreateObject('phpgwapi.config');
                }

                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');
                        if($oldcat_id ==0){$oldcat_id ='';}
                        if($oldassigned ==0){$oldassigned ='';}

                        // 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;
                                if($old_status=='X')
                                {
                                        
$this->historylog->add('R',$id,$ticket['status'],$old_status);

                                        $this->db->query("update 
phpgw_fm_tts_tickets set status='O' where id='$id'",__LINE__,__FILE__);
                                }
                                else
                                {
                                        
$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,$this->db->db_addslashes($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;
                }

        }
?>

Index: class.botts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.botts.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.botts.inc.php 6 Feb 2003 12:03:18 -0000       1.3
--- class.botts.inc.php 6 Feb 2003 14:05:57 -0000       1.4
***************
*** 393,405 ****
                }
  
-               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();
--- 393,401 ----
                }
  
  
                function mail_ticket($id,$fields_updated,$receipt=0)
                {
+                       $this->config->read_repository();
+ 
                        $errorcount=count($receipt['error']);
                        $members = array();
***************
*** 488,492 ****
                                $i=1;
  
!                               $history_array = 
$GLOBALS['phpgw']->historylog->return_array(array(),array('C'),'','',$id);
                                while (is_array($history_array) && 
list(,$value) = each($history_array))
                                {
--- 484,488 ----
                                $i=1;
  
!                               $history_array = 
$this->historylog->return_array(array(),array('C'),'','',$id);
                                while (is_array($history_array) && 
list(,$value) = each($history_array))
                                {
***************
*** 558,562 ****
  
                        $mail_method= 
$this->config->config_data['fmwrkorder_mail'];
!       //              echo 'mail_method: '.$mail_method .'<BR>';
  
                        if ($mail_method=='smtp'):
--- 554,558 ----
  
                        $mail_method= 
$this->config->config_data['fmwrkorder_mail'];
!                       echo 'mail_method: '.$mail_method .'<BR>';
  
                        if ($mail_method=='smtp'):
***************
*** 566,574 ****
                        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;
--- 562,570 ----
                        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;
***************
*** 591,595 ****
                        }
  
! //_debug_array($receipt);
                        return $receipt;
                }
--- 587,591 ----
                        }
  
! _debug_array($receipt);
                        return $receipt;
                }

Index: class.sotts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sotts.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.sotts.inc.php 6 Feb 2003 12:03:18 -0000       1.3
--- class.sotts.inc.php 6 Feb 2003 14:05:57 -0000       1.4
***************
*** 16,20 ****
                        $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'];
--- 16,20 ----
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
!                       $this->mail     = 
CreateObject($this->currentapp.'.botts_mail');
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
***************
*** 344,348 ****
                                if 
($this->config->config_data['mailnotification'])
                                {
! //                                    
$receipt=$this->bo->mail_ticket($id,$fields_updated,'');
  
                                }
--- 344,348 ----
                                if 
($this->config->config_data['mailnotification'])
                                {
! //                                    
$receipt=$this->mail->mail_ticket($id,$fields_updated,'');
  
                                }

Index: class.uitts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uitts.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uitts.inc.php 6 Feb 2003 12:03:18 -0000       1.3
--- class.uitts.inc.php 6 Feb 2003 14:05:58 -0000       1.4
***************
*** 39,43 ****
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.botts',True);
!                       $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon',True);
  
                        $this->start                            = 
$this->bo->start;
--- 39,44 ----
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.botts',True);
!                       $this->so2                                      = 
CreateObject($this->currentapp.'.sotts2',True);
!                       $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon',True);
  
                        $this->start                            = 
$this->bo->start;
***************
*** 412,416 ****
                        if($values['save'])
                        {
!                               $receipt = 
$this->bo->update_ticket($values,$id);
                        }
  
--- 413,417 ----
                        if($values['save'])
                        {
!                               $receipt = 
$this->so2->update_ticket($values,$id);
                        }
  





reply via email to

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