RT#28842: NG portal - Changes for prepaid needs
[freeside.git] / ng_selfservice / ticket.php
1 <?
2
3 require_once('elements/session.php');
4
5 if ( $_POST['ticket_id'] ) {
6   $ticket_id = $_POST['ticket_id'];
7 } else {
8   $ticket_id = $_SERVER['QUERY_STRING'];
9 }
10
11 if ( ! preg_match( '/^\d+$/', $ticket_id ) ) {
12   header('Location:index.php?error=No+ticket+ID');
13   die();
14 }
15
16 $ticket_info = $freeside->get_ticket( array(
17   'session_id' => $_COOKIE['session_id'],
18   'ticket_id'  => $ticket_id,
19   'subject'    => $_POST['subject'],
20   'reply'      => $_POST['reply'],
21 ) );
22
23 if ( isset($ticket_info['error']) && $ticket_info['error'] ) {
24   $error = $ticket_info['error'];
25   header('Location:index.php?error='. urlencode($error));
26   die();
27 }
28
29 extract($ticket_info);
30
31 ?>
32 <? $title = "View ticket #$ticket_id"; include('elements/header.php'); ?>
33 <? $current_menu = 'tickets.php'; include('elements/menu.php'); ?>
34
35 <TABLE>
36 <? foreach ( $transactions AS $transaction ) {
37      if ( $transaction['content'] == 'This transaction appears to have no content' ) { continue; }
38 ?>
39     <TR>
40       <TD>
41         <B>
42           <? echo $transaction['created'] ?>
43           &nbsp;
44           <? echo $transaction['description'] ?>
45         </B>
46         <PRE><? echo $transaction['content'] ?></PRE><BR>
47       </TD>
48     </TR>
49 <? } ?>
50 </TABLE>
51
52 <BR><BR>
53 <FORM ACTION="ticket.php" METHOD=POST>
54     <input type="hidden" name="ticket_id" value="<? echo $ticket_id ?>">
55
56 <? if ( $edit_ticket_subject ) { ?>
57     Subject:<BR><input type="text" name="subject" value="<? htmlspecialchars($ticket_fields['subject']) ?>" style="width:440px">
58     <BR><BR>
59 <? } ?>
60
61     Add reply to ticket:
62     <BR>
63     <textarea name="reply" cols="60" rows="10" style="width:440px"></textarea>
64     <BR><input type="submit" value="Reply">
65 </form>
66
67 <? include('elements/menu_footer.php'); ?>
68 <? include('elements/footer.php'); ?>