Kayako logo
Modifications & Addon Releases Modification guides and addons are posted here to share with the community. Do not post requests in here!

Notices

Reply
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  (#1) Old
jenglish Offline
Member
 
jenglish's Avatar
 
Posts: 39
Join Date: Jan 2007
Location: Tyler, TX
View Attachments on PDA Interface - 30-10-2008, 07:11 PM

Here is an addition to the PDA Interface to make it a little more useful on mobile devices when staff members are "in the field."

This modification adds the same "Attachments" section to a ticket post as is seen on the staff view ticket page.

INSTALLATION INSTRUCTIONS:

All modifications for this install are to the /modules/tickets/pda_manage.php file.

STEP 1: add the code below directly beneath the line "echo $contents;"
PHP Code:
<?
        $contents 
= &$val["contents"];
        echo 
$contents;
        
        
//ADD ACCESS TO ATTACHMENTS FROM PDA SITE
        
if (count($val["attachments"]))
        {
            
?><BR /><BR /><fieldset class="swiftfieldsetnopad"><legend><?=$_SWIFT["language"]["attachments"]?></legend><div class="navsub"><?
            
foreach ($val["attachments"] as $atkey=>$atval)
            {
                
$extension getFileExtension($atval["filename"]);
                
$mimedata $mimelist[$extension];
                if (!empty(
$mimedata[1]))
                {
                    
$icon $mimedata[1];
                } else {
                    
$icon "mimeico_blank.gif";
                }
            
                echo 
'<table width="100%"><tr>';
                echo 
'<td><a href="index.php?_m=tickets&_a=ticketactions&ticketid='intval($_ticket["ticketid"]) .'&action=attachment&attachmentid='intval($atval["attachmentid"]) .'" target="_blank"><img src="'$_SWIFT["themepath"] . $icon .'" border="0" align="absmiddle" />&nbsp;'$atval["filename"] .'</a> ('formattedSize($atval["filesize"]) .')'.'</td>';
                echo 
'<td align="right"><a href="index.php?_m=tickets&_a=ticketactions&ticketid='intval($_ticket["ticketid"]) .'&action=delattachment&attachmentid='intval($atval["attachmentid"]) .'"><img src="'$_SWIFT["themepath"] . "icon_delete.gif" .'" border="0" align="middle"/></a></td>';
                echo 
'</tr></table>';
            }
            
?></div></fieldset><?
        
}
        
//END ADD ACCESS TO ATTACHMENTS FROM PDA SITE
STEP 2: Locate the "TICKET ACTIONS" section at the end of the file. We are going to add some code at the end. Replace the text at the end of the file with the following code, starting at the comment marker.

PHP Code:
        // Couple of things, 1) If we have the ticket id then great, just redirect to it 2) If we have no ticket id, we need to redirect to ticket listing 3) Blah Blah Blah
        
if (!empty($_ticketid))
        {
            
header("location: index.php?_m=tickets&_a=viewticket&ticketid=".intval($_ticketid));
        } else {
            
header("location: index.php?_m=tickets&_a=manage&departmentid=".intval($_ticketobj->ticket["departmentid"])."&ticketstatusid=".intval($_ticketobj->ticket["ticketstatusid"]));
        }
        exit;
    }
    
//BEGIN ADD ACCESS TO TICKET ATTACHMENTS ON PDA SITE
    
else if ($_GET["action"] == "attachment") {
    
$_ticketobj =& new TicketMain($_GET["ticketid"], true);

    if (!
$_ticketobj->ticket)
    {
        echo 
$_SWIFT["language"]["errorticketaccess"];
        exit;
    }

    if (!empty(
$_GET["attachmentid"]))
    {
        require_once (
"./modules/tickets/functions_attachments.php");
        
$_attach = new TicketAttachments();
        
$_attach->dispatchAttachment($_GET["attachmentid"], $_ticketobj->ticket["ticketid"]);
        exit;
    }
}
else if (
$_GET["action"] == "delattachment") {

    
$_ticketobj =& new TicketMain($_REQUEST["ticketid"], true);

    if (!
$_ticketobj->ticket)
    {
        echo 
$_SWIFT["language"]["errorticketaccess"];
        exit;
    }

    if (
$_SWIFT["staff"]["tdeletepost"] != "0")
    {
        if (!empty(
$_GET["attachmentid"]))
        {
            
// Are we using the filesytem or the database for storage?
            
$dbCore->query("SELECT `data` FROM `"TABLE_PREFIX ."settings` WHERE `vkey` = 'tickets_attachtype';");
            
$dbCore->nextRecord();
            
$AttachmentType $dbCore->Record["data"];

            if (
$AttachmentType == 2)  // This means we are using the filesystem
            
{
                
// Get filename
                
$dbCore->query("SELECT `storefilename` FROM `"TABLE_PREFIX ."attachments` WHERE `attachmentid` = '".intval($_GET["attachmentid"])."';");
                
$dbCore->nextRecord();
                
$StoreFilename $dbCore->Record["storefilename"];
                
                
// Delete the file
                
unlink("./files/".$StoreFilename);
            }

            
// Clean up the database
            
$dbCore->query("DELETE FROM `"TABLE_PREFIX ."attachments` WHERE `attachmentid` = '"intval($_GET["attachmentid"]) ."';");  // Delete attachment entry
            
$dbCore->query("DELETE * FROM `"TABLE_PREFIX ."attachmentchunks` WHERE `attachmentid` = '"intval($_GET["attachmentid"]) ."';");  // Delete attachment contents (if using database for storage; otherwise this does nothing)

            // Clear hasattachments ticket indicator if there are no more attachments
            
$count $dbCore->queryFetch("SELECT COUNT(*) AS count FROM `"TABLE_PREFIX ."attachments` WHERE `ticketid`= '"intval($_ticketobj->ticket["ticketid"]) ."';");

            if(empty(
$count["count"])) 
            {
                
$dbCore->query("UPDATE `"TABLE_PREFIX ."tickets` SET `hasattachments` = '0' WHERE `ticketid` = '"intval($_ticketobj->ticket["ticketid"]) ."';");  // Delete attachment entry
            
}
        }
        
header("location: index.php?_m=tickets&_a=viewticket&ticketid="intval($_ticketobj->ticket["ticketid"]) ."&atdelconfirm=1");
    }else {
        
header("location: index.php?_m=tickets&_a=viewticket&ticketid="intval($_ticketobj->ticket["ticketid"]));
    }

    exit;
}  
}

?> 
STEP 3: PROFIT! $$$
Attached Images
File Type: png screenshot.png (13.5 KB, 10 views)
   
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDA web interface on WM5 SmartPhone SkyNet SupportSuite, eSupport and LiveResponse 2 02-11-2007 12:53 PM



Powered by vBulletin® Version 3.7.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Help desk software by Kayako.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48