phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: tts/inc functions.inc.php,1.37,1.37.2.1 hook_hom


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] CVS: tts/inc functions.inc.php,1.37,1.37.2.1 hook_home.inc.php,1.9,1.9.2.1 hook_preferences.inc.php,1.6,1.6.2.1
Date: Fri, 25 Jan 2002 17:00:55 -0500

Update of /cvsroot/phpgroupware/tts/inc
In directory subversions:/tmp/cvs-serv22020/inc

Modified Files:
      Tag: Version-0_9_14-branch
        functions.inc.php hook_home.inc.php hook_preferences.inc.php 
Log Message:
Merged in patchs from wiredtri to fix emailing tickets, and group access


Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/functions.inc.php,v
retrieving revision 1.37
retrieving revision 1.37.2.1
diff -C2 -r1.37 -r1.37.2.1
*** functions.inc.php   30 Dec 2001 09:38:16 -0000      1.37
--- functions.inc.php   25 Jan 2002 22:00:52 -0000      1.37.2.1
***************
*** 31,76 ****
                $GLOBALS['phpgw']->config->read_repository();
  
-               
                if ($GLOBALS['phpgw']->config->config_data['mailnotification']) 
{
                
                        $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
        
!                       $GLOBALS['phpgw']->db->query('select 
t_id,t_category,t_detail,t_priority,t_user,t_assignedto,'
!                               . "t_timestamp_opened, t_timestamp_closed, 
t_subject from phpgw_tts_tickets where t_id='$ticket_id'");
                        $GLOBALS['phpgw']->db->next_record();
      
!                       $group = $GLOBALS['phpgw']->db->f('t_category');
                        
                        // build subject
!                       $subject = '[TTS #'.$ticket_id.' '.$group.'] 
'.(!$GLOBALS['phpgw']->db->f('t_timestamp_closed')?'Updated':'Closed').': 
'.$GLOBALS['phpgw']->db->f('t_subject');
  
                        // build body
                        $body  = '';
!                       $body .= 'TTS #'.$ticket_id."\n\n";
!                       $body .= 'Subject: 
'.$GLOBALS['phpgw']->db->f('t_subject')."\n\n";
!                       $body .= 'Assigned To: 
'.$GLOBALS['phpgw']->db->f('t_assignedto')."\n\n";
!                       $body .= 'Priority: 
'.$GLOBALS['phpgw']->db->f('t_priority')."\n\n";
!                       $body .= 'Group: '.$group."\n\n";
!                       $body .= 'Opened By: 
'.$GLOBALS['phpgw']->db->f('t_user')."\n";
!                       $body .= 'Date Opened: 
'.$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('t_timestamp_opened'))."\n\n";
!                       if($GLOBALS['phpgw']->db->f('t_timestamp_closed'))
                        {
!                               $body .= 'Date Closed: 
'.$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('t_timestamp_closed'))."\n\n";
                        }
-                       $body .= 
stripslashes(strip_tags($GLOBALS['phpgw']->db->f('t_detail')))."\n\n.";
                        
                        if 
($GLOBALS['phpgw']->config->config_data['groupnotification']) 
                        {
                                // select group recipients
!                               $group_id = 
$GLOBALS['phpgw']->accounts->name2id($group);
!                               $members  = 
$GLOBALS['phpgw']->accounts->members($group_id);
                        }
  
                        if 
($GLOBALS['phpgw']->config->config_data['ownernotification'])
                        {
                                // add owner to recipients
!                               $members[] = array('account_id' => 
$GLOBALS['phpgw']->accounts->name2id($GLOBALS['phpgw']->db->f('t_user')), 
'account_name' => $GLOBALS['phpgw']->db->f('t_user'));
                        }
  
                        if 
($GLOBALS['phpgw']->config->config_data['assignednotification'])
                        {
--- 31,109 ----
                $GLOBALS['phpgw']->config->read_repository();
  
                if ($GLOBALS['phpgw']->config->config_data['mailnotification']) 
{
                
                        $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
        
!                       $GLOBALS['phpgw']->db->query("select * from 
phpgw_tts_tickets where ticket_id='$ticket_id'");
                        $GLOBALS['phpgw']->db->next_record();
      
!                       $group_id = $GLOBALS['phpgw']->db->f('ticket_group');
!                       $group_name = 
$GLOBALS['phpgw']->accounts->id2name($group_id);
                        
                        // build subject
!                       $subject = '[TTS #'.$ticket_id.' '.$group_name.'] 
'.(($GLOBALS['phpgw']->db->f('ticket_status')!='X')?'Updated':'Closed').': 
'.$GLOBALS['phpgw']->db->f('ticket_subject');
  
                        // build body
                        $body  = '';
!                       $body .= 'TTS #'.$ticket_id."\n";
!                       $body .= 'Subject: 
'.$GLOBALS['phpgw']->db->f('ticket_subject')."\n";
!                       $body .= 'Assigned To: 
'.$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->db->f('ticket_assignedto'))."\n";
!                       $body .= 'Priority: 
'.$GLOBALS['phpgw']->db->f('ticket_priority')."\n";
!                       $body .= 'Group: '.$group_name."\n";
!                       $body .= 'Opened By: 
'.$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->db->f('ticket_owner'))."\n\n";
!                       $body .= "Latest Note Added:\n";
!                       
/**************************************************************\
!                       * Display latest note                                   
      *
!                       
\**************************************************************/
! 
!                       $GLOBALS['phpgw']->historylog = 
createobject('phpgwapi.historylog','tts');
! 
!                       $history_array = 
$GLOBALS['phpgw']->historylog->return_array(array(),array('C'),'','',$ticket_id);
!                       while (is_array($history_array) && list(,$value) = 
each($history_array))
                        {
!                               
$latest_note=$GLOBALS['phpgw']->common->show_date($value['datetime'])." - 
".$value['owner'];
!                                 $latest_note.=" - 
".stripslashes($value['new_value'])."\n";
! //                            
$GLOBALS['phpgw']->template->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']));
! //                            $body.= 
"$GLOBALS['phpgw']->template->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']));
! //                            
$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))
+                       {
+                               $latest_note="No notes for this ticket.\n";
+                       }
+                       
+                       $body .= $latest_note;
+ 
+                       $body .= "\n\nOriginal Ticket 
Details:\n".$GLOBALS['phpgw']->db->f('ticket_details')."\n\n";
+ 
+ 
+ //                    if($GLOBALS['phpgw']->db->f('t_timestamp_closed'))
+ //                    {
+ //                            $body .= 'Date Closed: 
'.$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('t_timestamp_closed'))."\n\n";
+ //                    }
+                       $body .= 
stripslashes(strip_tags($GLOBALS['phpgw']->db->f('ticket_detail')))."\n\n.";
+                       
+                       
+ $GLOBALS['phpgw']->config->config_data['groupnotification']=True;
+                       // do we need to email all the users in the group 
assigned to this ticket?
                        if 
($GLOBALS['phpgw']->config->config_data['groupnotification']) 
                        {
                                // select group recipients
!                               $members  = 
$GLOBALS['phpgw']->accounts->member($group_id);
                        }
  
+ 
+                       // do we need to email the owner of this ticket?
                        if 
($GLOBALS['phpgw']->config->config_data['ownernotification'])
                        {
                                // add owner to recipients
! //AW -temporary                       $members[] = array('account_id' => 
$GLOBALS['phpgw']->accounts->name2id($GLOBALS['phpgw']->db->f('ticket_owner')), 
'account_name' => $GLOBALS['phpgw']->db->f('ticket_owner'));
                        }
  
+                       // do we need to email the user who is assigned to this 
ticket?
                        if 
($GLOBALS['phpgw']->config->config_data['assignednotification'])
                        {
***************
*** 79,94 ****
                        }
  
                        $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']);
  //                                    $pref = 
CreateObject('phpgwapi.preferences',$members[$i]['account_id']);
  //                                    $prefs = $pref->read_repository();
  //                                    $prefs = 
$phpgw->common->create_emailpreferences($prefs,$members[$i]['account_id']);
                                        $toarray[] = $prefs['email']['address'];
-                                       // echo '<br>'.$toarray[$i];
  //                                    unset($pref);
                                }
--- 112,127 ----
                        }
  
+ 
                        $toarray = Array();
                        $i=0;
                        for ($i=0;$i<count($members);$i++)
                        {
!                               if ($members[$i]['account_name'])
                                {
!                                       $prefs = 
$GLOBALS['phpgw']->preferences->create_email_preferences($members[$i]['account_name']);
  //                                    $pref = 
CreateObject('phpgwapi.preferences',$members[$i]['account_id']);
  //                                    $prefs = $pref->read_repository();
  //                                    $prefs = 
$phpgw->common->create_emailpreferences($prefs,$members[$i]['account_id']);
                                        $toarray[] = $prefs['email']['address'];
  //                                    unset($pref);
                                }

Index: hook_home.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/hook_home.inc.php,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -r1.9 -r1.9.2.1
*** hook_home.inc.php   29 Nov 2001 22:09:56 -0000      1.9
--- hook_home.inc.php   25 Jan 2002 22:00:52 -0000      1.9.2.1
***************
*** 122,126 ****
                $portalbox->draw($p->fp('out','tts_list'));
  
! echo 'TEST -&gt;&gt;' . $p->fp('out','tts_list') . '&lt;&lt;-';
  //            $p->pfp('out','tts_list');
                echo "\n<!-- End TTS New/Updated -->\n";
--- 122,126 ----
                $portalbox->draw($p->fp('out','tts_list'));
  
! //echo 'TEST -&gt;&gt;' . $p->fp('out','tts_list') . '&lt;&lt;-';
  //            $p->pfp('out','tts_list');
                echo "\n<!-- End TTS New/Updated -->\n";

Index: hook_preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/hook_preferences.inc.php,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -r1.6 -r1.6.2.1
*** hook_preferences.inc.php    12 Jan 2002 05:07:20 -0000      1.6
--- hook_preferences.inc.php    25 Jan 2002 22:00:52 -0000      1.6.2.1
***************
*** 15,19 ****
        $values = array(
                'Preferences'           => 
$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=tts'),
!               'Edit Categories'       => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=tts&cats_level=True&global_cats=True')
        );
        display_section('tts','Trouble Ticket System',$values);
--- 15,20 ----
        $values = array(
                'Preferences'           => 
$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=tts'),
!               'Grant Access'          => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
!               'Edit Categories'       => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app='.$appname.'&cats_level=True&global_cats=True')
        );
        display_section('tts','Trouble Ticket System',$values);




reply via email to

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