phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] tts/viewticket_details.php, 1.42.2.6.4.4


From: nomail
Subject: [Phpgroupware-cvs] tts/viewticket_details.php, 1.42.2.6.4.4
Date: Thu, 20 May 2004 16:57:37 -0000

Update of /tts
Modified Files:
        Branch: Version-0_9_16-branch
          viewticket_details.php

date: 2004/04/20 12:52:17;  author: lpiepho;  state: Exp;  lines: +22 -19

Log Message:
Fix in attachments. Multiple attachments are possible now.
=====================================================================
No syntax errors detected in -
=====================================================================
Index: tts/viewticket_details.php
diff -u tts/viewticket_details.php:1.42.2.6.4.3 
tts/viewticket_details.php:1.42.2.6.4.4
--- tts/viewticket_details.php:1.42.2.6.4.3     Fri Apr 16 11:30:05 2004
+++ tts/viewticket_details.php  Tue Apr 20 12:52:17 2004
@@ -93,13 +93,13 @@
                        
                $ticket['effort']         = 
$GLOBALS['phpgw']->db->f('ticket_effort');
                $ticket['platform']       = 
$GLOBALS['phpgw']->categories->id2name($GLOBALS['phpgw']->db->f('ticket_platform'));
-               $ticket['attachment']     = 
$GLOBALS['phpgw']->db->f('ticket_attachment');
                
-               if($ticket['attachment'] != '')
+               $GLOBALS['phpgw']->db->query("SELECT name from phpgw_vfs where 
directory like '/tts/" . $ticket_id . "' AND size > 0",__LINE__,__FILE__);
+               $x = 0;
+               while ($GLOBALS['phpgw']->db->next_record() != "")
                {
-                       $GLOBALS['phpgw']->db->query("SELECT directory, name 
from phpgw_vfs where file_id =" . $ticket['attachment'],__LINE__,__FILE__);
-                       $GLOBALS['phpgw']->db->next_record();
-                       $ticket['attachment'] = 
$GLOBALS['phpgw']->db->f('directory') . '/' .  $GLOBALS['phpgw']->db->f('name');
+                       $ticket['attachment'][$x] =  '/tts/' . $ticket_id . '/' 
. $GLOBALS['phpgw']->db->f('name');
+                       ++$x;
                }
                
                
$GLOBALS['phpgw']->template->set_file('viewticket','viewticket_details.tpl');
@@ -258,7 +258,7 @@
                                case 'D': $type = lang('Deadline changed'); 
break;
                                case 'E': $type = lang('Effort changed'); break;
                                case 'L': $type = lang('Platform changed'); 
break;
-                               case 'M': $type = lang('Attachment changed'); 
break;
+                               case 'M': $type = lang('Attachment added'); 
break;
                                default: break;
                        }
 
@@ -367,11 +367,14 @@
                
$GLOBALS['phpgw']->template->set_var('lang_platform',lang('Platform'));
                
$GLOBALS['phpgw']->template->set_var('value_platform',$ticket['platform']);
 
+               for($i=0; $i <= $x-1; $i++)
+               {
                $file = $GLOBALS['phpgw']->link('/index.php',Array(
                                                                                
                                        'menuaction' => 
'tts.attachedFiles.show_file',
-                                                                               
                                        'file' => $ticket['attachment']
-                                                                               
                                        ));                                     
                       
-               $attLink = "<a href=\"" . $file . "\" target=\"_NEW\">" . 
basename($ticket['attachment']) . " </a><br>";
+                                                                               
                                        'file' => $ticket['attachment'][$i]
+                                                                               
                                        ));                                     
                                                                                
                                                            
+               $attLink .= "<a href=\"" . $file . "\" target=\"_NEW\">" . 
basename($ticket['attachment'][$i]) . " </a><br>";
+               }
                
$GLOBALS['phpgw']->template->set_var('lang_attachment',lang('Attachment'));
                
$GLOBALS['phpgw']->template->set_var('value_attachment',$attLink);
                
@@ -429,7 +432,7 @@
                $ticket['billable_rate']  = $_POST['ticket']['billable_rate'];
                $ticket['assignedto']     = $_POST['ticket']['assignedto'];
                $ticket['category']       = $_POST['ticket']['category'];
-               $ticket['note']        = $_POST['ticket']['note'];
+               $ticket['note']           = $_POST['ticket']['note'];
                $ticket['priority']       = $_POST['ticket']['priority'];
                $ticket['group']          = $_POST['ticket']['group'];
                $ticket['status']         = $_POST['ticket']['status'];
@@ -560,26 +563,26 @@
                if ($HTTP_POST_FILES['attachment']['name'] != '')
                {
                        $fields_updated = True;
-                       $attdir = "home/tts/t" . $ticket_id;
+                       $attdir = "/tts/" . $ticket_id;
+                       $basedir = $GLOBALS['basedir'] . "/tts";
                        
-                       if (!file_exists($GLOBALS['basedir'] . "/" . $attdir))
+                       if (!file_exists($basedir . "/" . $attdir))
                        {
+                               $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("update phpgw_tts_tickets 
set ticket_attachment='" . $file_id . "' where 
ticket_id='$ticket_id'",__LINE__,__FILE__);
-                       
$GLOBALS['phpgw']->historylog->add('M',$ticket_id,$ticket['attachment']['name'],'');
+                       
$GLOBALS['phpgw']->historylog->add('M',$ticket_id,$HTTP_POST_FILES['attachment']['name'],'');
                }
                
 




reply via email to

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