From d733bb6bb83f08094bb2c2cf59fccf6dc9491b8a Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 1 May 2012 10:39:17 -0400
Subject: [PATCH] Add PDF export - print

---
 include/class.ticket.php          | 5 +++++
 include/staff/ticket-view.inc.php | 2 +-
 scp/tickets.php                   | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 6a27d981b..2fd5d4f29 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1550,6 +1550,11 @@ class Ticket{
         return $id;
     }
 
+    //Print ticket... export the ticket thread as PDF.
+    function exportPDF() {
+        return false;
+    }
+
     //online based attached files.
     function uploadAttachments($files, $refid, $type) {
 
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index a299b04fc..b8a2e8097 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -40,7 +40,7 @@ if($ticket->isOverdue())
                 <a href="tickets.php?id=<?php echo $ticket->getId(); ?>" title="Reload" class="reload">Reload</a></h2>
         </td>
         <td width="50%" class="right_align">
-            <a href="#" title="Print Ticket" class="print">Print Ticket</a>
+            <a href="tickets.php?id=<?php echo $ticket->getId(); ?>&a=print" title="Print Ticket" class="print">Print Ticket</a>
             <a href="tickets.php?id=<?php echo $ticket->getId(); ?>&a=edit" title="Edit Ticket" class="edit">Edit Ticket</a>
         </td>
     </tr>
diff --git a/scp/tickets.php b/scp/tickets.php
index 567c3f697..e9a13f3ef 100644
--- a/scp/tickets.php
+++ b/scp/tickets.php
@@ -464,6 +464,8 @@ if($ticket) {
     $inc = 'ticket-view.inc.php';
     if($_REQUEST['a']=='edit' && $thisstaff->canEditTickets()) 
         $inc = 'ticket-edit.inc.php';
+    elseif($_REQUEST['a'] == 'print' && !$ticket->exportPDF())
+        $errors['err'] = 'Internal error: Unable to export the ticket to PDF.';
 } else {
     $inc = 'tickets.inc.php';
     if($_REQUEST['a']=='open' && $thisstaff->canCreateTickets())
-- 
GitLab