forked from FullService/OsTicket
-
Notifications
You must be signed in to change notification settings - Fork 20
/
viewticket.inc.php
633 lines (605 loc) · 22 KB
/
viewticket.inc.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
<?php
//Note that ticket is initiated in tickets.php.
if(!defined('OSTSCPINC') || !@$thisuser->isStaff() || !is_object($ticket) ) die('Invalid path');
if(!$ticket->getId() or (!$thisuser->canAccessDept($ticket->getDeptId()) and $thisuser->getId()!=$ticket->getStaffId())) die($trl->translate("TEXT_ACCESS_DENIED"));
$info=($_POST && $errors)?Format::input($_POST):array(); //Re-use the post info on error...savekeyboards.org
//Auto-lock the ticket if locking is enabled..if locked already simply renew it.
if($cfg->getLockTime() && !$ticket->acquireLock())
$warn.='Unable to obtain a lock on the ticket';
//We are ready baby...lets roll. Akon rocks!
$dept = $ticket->getDept(); //Dept
$staff = $ticket->getStaff(); //Assiged staff.
$lock = $ticket->getLock(); //Ticket lock obj
$id=$ticket->getId(); //Ticket ID.
if($staff)
$warn.=' <span class="Icon assignedTicket">Ticket is assigned to '.$staff->getName().'</span>';
if(!$errors['err'] && ($lock && $lock->getStaffId()!=$thisuser->getId()))
$errors['err']='This ticket is currently locked by another staff member!';
if(!$errors['err'] && ($emailBanned=BanList::isbanned($ticket->getEmail())))
$errors['err']='Email is in banlist! Must be removed before any reply/response';
if($ticket->isOverdue())
$warn.=' <span class="Icon overdueTicket">Marked overdue!</span>';
?>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="msg" width=50%>Ticket #<?=$ticket->getExtId()?> <a
href="tickets.php?id=<?=$id?>" title="Reload"><span
class="Icon refresh"> </span> </a></td>
<td class="msg" width=50%><? if($thisuser->canEditTickets() || ($thisuser->isManager() && $dept->getId()==$thisuser->getDeptId())) { ?>
<a href="tickets.php?id=<?=$id?>&a=edit" title="Edit Ticket"
class="Icon editTicket">Edit Ticket</a> <?}?>
</td>
</tr>
<tr>
<td width=50%>
<table align="center" class="ticketinfo" cellspacing="1"
cellpadding="3" width="100%" border=0>
<tr>
<th>Status:</th>
<td><?=$ticket->getStatus()?></td>
</tr>
<tr>
<th>Priority:</th>
<td><?=$ticket->getPriority()?></td>
</tr>
<tr>
<th>Department:</th>
<td><?=Format::htmlchars($ticket->getDeptName())?></td>
</tr>
<tr>
<th>Create Date:</th>
<td><?=Format::db_datetime($ticket->getCreateDate())?></td>
</tr>
</table>
</td>
<td width=50% valign="top">
<table align="center" class="ticketinfo" cellspacing="1"
cellpadding="3" width="100%" border=0>
<tr>
<th>Name:</th>
<td><?=Format::htmlchars($ticket->getName())?></td>
</tr>
<tr>
<th>Email:</th>
<td><?php
echo $ticket->getEmail();
if(($related=$ticket->getRelatedTicketsCount())) {
echo sprintf(' <a href="tickets.php?a=search&query=%s" title="Related Tickets">(<b>%d</b>)</a>',
urlencode($ticket->getEmail()),$related);
}
?>
</td>
</tr>
<tr>
<th>Phone:</th>
<td><?=Format::phone($ticket->getPhoneNumber())?></td>
</tr>
<tr>
<th>Source:</th>
<td><?=$ticket->getSource()?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2 class="msg">Subject: <?=Format::htmlchars($ticket->getSubject())?>
</td>
</tr>
<tr>
<td valign="top" width=50%>
<table align="center" class="ticketinfo" cellspacing="1"
cellpadding="3" width="100%" border=0>
<tr>
<th>Assigned Staff:</th>
<td><?=$staff?Format::htmlchars($staff->getName()):'- unassigned -'?>
</td>
</tr>
<tr>
<th nowrap>Last Response:</th>
<td><?=Format::db_datetime($ticket->getLastResponseDate())?></td>
</tr>
<?php
if($ticket->isOpen()){ ?>
<tr>
<th>Due Date:</th>
<td><?=Format::db_datetime($ticket->getDueDate())?></td>
</tr>
<?php
}else { ?>
<tr>
<th>Close Date:</th>
<td><?=Format::db_datetime($ticket->getCloseDate())?></td>
</tr>
<?php
}
?>
</table>
</td>
<td width=50% valign="top">
<table align="center" class="ticketinfo" cellspacing="1"
cellpadding="3" width="100%" border=0>
<tr>
<th>Help Topic:</th>
<td><?
$ht=$ticket->getHelpTopic();
echo Format::htmlchars($ht?$ht:'N/A');
?>
</td>
</tr>
<tr>
<th>IP Address:</th>
<td><?=$ticket->getIP()?></td>
</tr>
<tr>
<th nowrap>Last Message:</th>
<td><?=Format::db_datetime($ticket->getLastMessageDate())?></td>
</tr>
</table>
</td>
</tr>
</table>
<div>
<?if($errors['err'] && $_POST['a']=='process') {?>
<p align="center" id="errormessage">
<?=$errors['err']?>
</p>
<?}elseif($msg && $_POST['a']=='process' || $_POST['a']=='update' ) {?>
<p align="center" id="infomessage">
<?=$msg?>
</p>
<?}elseif($warn) {?>
<p id="warnmessage">
<?=$warn?>
</p>
<?}?>
</div>
<?
//Ticket adminstrative options...admin,managers and staff with manage perm allowed.
if($thisuser->canManageTickets() || $thisuser->isManager()){ ?>
<table cellpadding="0" cellspacing="2" border="0" width="100%"
class="ticketoptions">
<tr>
<td>
<form name=action action='tickets.php?id=<?=$id?>' method=post
class="inline">
<input type='hidden' name='ticket_id' value="<?=$id?>" /> <input
type='hidden' name='a' value="process" /> <span for="do"> <b>Action:</b>
</span> <select id="do" name="do"
onChange="this.form.ticket_priority.disabled=strcmp(this.options[this.selectedIndex].value,'change_priority','reopen','overdue')?false:true;">
<option value=""><?php te('LABEL_STAFF_VIEWTICKET_SELECT_ACTION')?></option>
<option value="change_priority"
<?=$info['do']=='change_priority'?'selected':''?>><?php te('LABEL_STAFF_VIEWTICKET_CHANGE_PRIORITY')?></option>
<?if(!$ticket->isoverdue()){ ?>
<option value="overdue" <?=$info['do']=='overdue'?'selected':''?>><?php te('LABEL_STAFF_VIEWTICKET_MARK_OVERDUE')?>
</option>
<?}?>
<?if($ticket->isAssigned()){ ?>
<option value="release" <?=$info['do']=='release'?'selected':''?>><?php te('LABEL_STAFF_VIEWTICKET_RELEASE_UNASSIGN')?>
</option>
<?}?>
<?if($thisuser->canCloseTickets()){
//if you can close a ticket...reopening it is given.
if($ticket->isOpen()){?>
<option value="close" <?=$info['do']=='close'?'selected':''?>><?php te('LABEL_STAFF_VIEWTICKET_CLOSE_TICKET')?>
</option>
<?}else{?>
<option value="reopen" <?=$info['do']=='reopen'?'selected':''?>><?php te('LABEL_STAFF_VIEWTICKET_REOPEN_TICKET')?>
</option>
<?}
}?>
<?php
if($thisuser->canManageBanList()) {
if(!$emailBanned) {?>
<option value="banemail">
Ban Email
<?=$ticket->isOpen()?'& Close':''?>
</option>
<?}else{?>
<option value="unbanemail">Un-Ban Email</option>
<?}
}?>
<?if($thisuser->canDeleteTickets()){ //oooh...fear the deleters! ?>
<option value="delete">Delete Ticket</option>
<?}?>
</select> <span for="ticket_priority">Priority:</span> <select
id="ticket_priority" name="ticket_priority"
<?=!$info['do']?'disabled':''?>>
<option value="0" selected="selected">-Unchanged-</option>
<?
$priorityId=$ticket->getPriorityId();
$resp=db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE);
while($row=db_fetch_array($resp)){ ?>
<option value="<?=$row['priority_id']?>"
<?=$priorityId==$row['priority_id']?'disabled':''?>>
<?=$row['priority_desc']?>
</option>
<?}?>
</select> <input class="button" type="submit"
value="GO">
</form>
</tr>
</td>
</table>
<?}?>
<br>
<?
//Internal Notes
$sql ='SELECT note_id,title,note,source,created FROM '.TICKET_NOTE_TABLE.' WHERE ticket_id='.db_input($id).' ORDER BY created DESC';
if(($resp=db_query($sql)) && ($notes=db_num_rows($resp))){
$display=($notes>5)?'none':'block'; //Collapse internal notes if more than 5.
?>
<div align="left">
<a class="Icon note" href="#"
onClick="toggleLayer('ticketnotes'); return false;">Internal Notes (<?=$notes?>)</a><br>
<br>
<div id='ticketnotes' style="display:<?=$display?>;text-align:center;">
<?
while($row=db_fetch_array($resp)) {?>
<table align="center" class="note" cellspacing="0" cellpadding="1"
width="100%" border=0>
<tr>
<th><?=Format::db_daydatetime($row['created'])?> - posted
by <?=$row['source']?></th>
</tr>
<? if($row['title']) {?>
<tr class="header">
<td><?=Format::display($row['title'])?></td>
</tr>
<?} ?>
<tr>
<td><?=Format::display($row['note'])?></td>
</tr>
</table>
<?} ?>
</div>
</div>
<?} ?>
<div align="left">
<a class="Icon thread" href="#"
onClick="toggleLayer('ticketthread'); return false;">Ticket Thread</a>
<div id="ticketthread">
<?
//get messages
$sql='SELECT msg.msg_id,msg.created,msg.message,count(attach_id) as attachments FROM '.TICKET_MESSAGE_TABLE.' msg '.
' LEFT JOIN '.TICKET_ATTACHMENT_TABLE." attach ON msg.ticket_id=attach.ticket_id AND msg.msg_id=attach.ref_id AND ref_type='M' ".
' WHERE msg.ticket_id='.db_input($id).
' GROUP BY msg.msg_id ORDER BY created';
$msgres =db_query($sql);
while ($msg_row = db_fetch_array($msgres)) {
?>
<table align="center" class="message" cellspacing="0" cellpadding="1"
width="100%" border=0>
<tr>
<th><?=Format::db_daydatetime($msg_row['created'])?></th>
</tr>
<?if($msg_row['attachments']>0){ ?>
<tr class="header">
<td><?=$ticket->getAttachmentStr($msg_row['msg_id'],'M')?></td>
</tr>
<?}?>
<tr>
<td><?=Format::display($msg_row['message'])?> </td>
</tr>
</table>
<?
//get answers for messages
$sql='SELECT resp.*,count(attach_id) as attachments FROM '.TICKET_RESPONSE_TABLE.' resp '.
' LEFT JOIN '.TICKET_ATTACHMENT_TABLE." attach ON resp.ticket_id=attach.ticket_id AND resp.response_id=attach.ref_id AND ref_type='R' ".
' WHERE msg_id='.db_input($msg_row['msg_id']).' AND resp.ticket_id='.db_input($id).
' GROUP BY resp.response_id ORDER BY created';
$resp =db_query($sql);
while ($resp_row = db_fetch_array($resp)) {
$respID=$resp_row['response_id'];
?>
<table align="center" class="response" cellspacing="0" cellpadding="1"
width="100%" border=0>
<tr>
<th><?=Format::db_daydatetime($resp_row['created'])?> - <?=$resp_row['staff_name']?>
</th>
</tr>
<?if($resp_row['attachments']>0){ ?>
<tr class="header">
<td><?=$ticket->getAttachmentStr($respID,'R')?></td>
</tr>
<?}?>
<tr>
<td><?=Format::display($resp_row['response'])?></td>
</tr>
</table>
<?}
$msgid =$msg_row['msg_id'];
}?>
</div>
</div>
<table align="center" cellspacing="0" cellpadding="3" width="90%"
border=0>
<?if($_POST['a']!='process') {?>
<tr>
<td align="center"><?if($errors['err']) {?>
<p align="center" id="errormessage">
<?=$errors['err']?>
</p> <?}elseif($msg) {?>
<p align="center" id="infomessage">
<?=$msg?>
</p> <?}?>
</td>
</tr>
<?}?>
<tr>
<td align="center">
<div class="tabber">
<div id="reply" class="tabbertab" align="left">
<h2>
<?= $trl->translate('TEXT_POST_REPLY')?>
</h2>
<p>
<form action="tickets.php?id=<?=$id?>#reply" name="reply"
id="replyform" method="post" enctype="multipart/form-data">
<input type="hidden" name="ticket_id" value="<?=$id?>"> <input
type="hidden" name="msg_id" value="<?=$msgid?>"> <input
type="hidden" name="a" value="reply">
<div>
<font class="error"> <?=$errors['response']?> </font>
</div>
<div>
<?
$sql='SELECT premade_id,title FROM '.KB_PREMADE_TABLE.' WHERE isenabled=1 '.
' AND (dept_id=0 OR dept_id='.db_input($ticket->getDeptId()).')';
$canned=db_query($sql);
if($canned && db_num_rows($canned)) {
?>
<?php $trl->_('LABEL_CANNED_RESPONSE')?>
: <select id="canned" name="canned"
onChange="getCannedResponse(this.options[this.selectedIndex].value,this.form,'response');this.selectedIndex='0';">
<option value="0" selected="selected">
<?php $trl->_('TEXT_SELECT_PREMADE_REPLY')?>
</option>
<?while(list($cannedId,$title)=db_fetch_row($canned)) { ?>
<option value="<?=$cannedId?>">
<?=Format::htmlchars($title)?>
</option>
<?}?>
</select> <label><input type='checkbox'
value='1' name=append checked="true" /> <?php $trl->_('LABEL_APPEND')?>
</label>
<?}?>
<textarea name="response" id="response" cols="90" rows="9"
wrap="soft" style="width: 90%">
<?=$info['response']?>
</textarea>
</div>
<?php if($cfg->canUploadFiles()){ //TODO: may be allow anyways and simply email out attachment?? ?>
<div style="margin-top: 3px;">
<label for="attachment">Attach File:</label> <input type="file"
name="attachment" id="attachment" size=30px
value="<?=$info['attachment']?>" /> <font class="error"> <?=$errors['attachment']?>
</font>
</div>
<?php }?>
<?
$appendStaffSig=$thisuser->appendMySignature();
$appendDeptSig=$dept->canAppendSignature();
$info['signature']=!$info['signature']?'none':$info['signature']; //change 'none' to 'mine' to default to staff signature.
if($appendStaffSig || $appendDeptSig) { ?>
<div style="margin-top: 10px;">
<label for="signature" nowrap><?php $trl->_('LABEL_APPEND_SIGNATURE')?>:</label>
<label><input type="radio" name="signature" value="none" checked>
<?php $trl->_('LABEL_NONE')?> </label>
<?if($appendStaffSig) {?>
<label> <input type="radio" name="signature" value="mine"
<?=$info['signature']=='mine'?'checked':''?>> <?php $trl->_('LABEL_MY_SIGNATURE')?>
</label>
<?}?>
<?if($appendDeptSig) {?>
<label><input type="radio" name="signature" value="dept"
<?=$info['signature']=='dept'?'checked':''?>> <?php $trl->_('LABEL_DEPT_SIGNATURE')?>
</label>
<?}?>
</div>
<?}?>
<div style="margin-top: 3px;">
<b><?php $trl->_('TEXT_TICKET_STATUS')?>:</b>
<?
$checked=isset($info['ticket_status'])?'checked':''; //Staff must explicitly check the box to change status..
if($ticket->isOpen()){?>
<label><input type="checkbox" name="ticket_status"
id="l_ticket_status" value="Close" <?=$checked?>> <?php $trl->_('LABEL_CLOSE_TICKET');?>
</label>
<?}else{ ?>
<label><input type="checkbox" name="ticket_status"
id="l_ticket_status" value="Reopen" <?=$checked?>> <?php $trl->_('LABEL_REOPEN_TICKET')?>
</label>
<?}?>
</div>
<p>
<div
style="margin-left: 50px; margin-top: 30px; margin-bottom: 10px; border: 0px;">
<input class="button" type='submit'
value='<?= $trl->translate('LABEL_POST_REPLY')?>' /> <input
class="button" type='reset'
value='<?= $trl->translate('LABEL_RESET')?>' /> <input
class="button" type='button'
value='<?= $trl->translate('LABEL_CANCEL')?>'
onClick="history.go(-1)" />
</div>
</p>
</form>
</p>
</div>
<div id="notes" class="tabbertab" align="left">
<h2>
<?php $trl->_('LABEL_POST_INTERNAL_NOTE')?>
</h2>
<p>
<form action="tickets.php?id=<?=$id?>#notes" name="notes"
class="inline" method="post" enctype="multipart/form-data">
<input type="hidden" name="ticket_id" value="<?=$id?>"> <input
type="hidden" name="a" value="postnote">
<div>
<label for="title"><?php $trl->_('LABEL_NOTE_TITLE')?>:</label> <input
type="text" name="title" id="title" value="<?=$info['title']?>"
size=30px /> </select><font class="error">* <?=$errors['title']?>
</font>
</div>
<div style="margin-top: 3px;">
<label for="note" valign="top"><?php $trl->_('LABEL_ENTER_NOTE_CONTENT')?>
<font class="error">* <?=$errors['note']?> </font> </label><br />
<textarea name="note" id="note" cols="80" rows="7" wrap="soft"
style="width: 90%">
<?=$info['note']?>
</textarea>
</div>
<?
//When the ticket is assigned Allow assignee, admin or ANY dept manager to close it
if(!$ticket->isAssigned() || $thisuser->isadmin() || $thisuser->isManager() || $thisuser->getId()==$ticket->getStaffId()) {
?>
<div style="margin-top: 3px;">
<b><?php $trl->_('LABEL_TICKET_STATUS')?>:</b>
<?
$checked=($info && isset($info['ticket_status']))?'checked':''; //not selected by default.
if($ticket->isOpen()){?>
<label><input type="checkbox" name="ticket_status"
id="ticket_status" value="Close" <?=$checked?>> <?php $trl->_('LABEL_CLOSE_TICKET')?>
</label>
<?}else{ ?>
<label><input type="checkbox" name="ticket_status"
id="ticket_status" value="Reopen" <?=$checked?>> <?php $trl->_('LABEL_REOPEN_TICKET')?>
</label>
<?}?>
</div>
<?}?>
<p>
<div align="left"
style="margin-left: 50px; margin-top: 10px; margin-bottom: 10px; border: 0px;">
<input class="button" type='submit'
value='<?= $trl->translate('LABEL_SUBMIT')?>' /> <input
class="button" type='reset'
value='<?= $trl->translate('LABEL_RESET')?>' /> <input
class="button" type='button'
value='<?= $trl->translate('LABEL_CANCEL')?>'
onClick="history.go(-1)" />
</div>
</p>
</form>
</p>
</div>
<?
if($thisuser->canTransferTickets()) {
?>
<div id="transfer" class="tabbertab" align="left">
<h2>
<?php $trl->_('TEXT_DEPT_TRANSFER')?>
</h2>
<p>
<form action="tickets.php?id=<?=$id?>#transfer" name="notes"
method="post" enctype="multipart/form-data">
<input type="hidden" name="ticket_id" value="<?=$id?>"> <input
type="hidden" name="a" value="transfer">
<div>
<span for="dept_id"><?php $trl->_('LABEL_DEPARTMENT')?>:</span> <select
id="dept_id" name="dept_id">
<option value="" selected="selected">
<?php $trl->_('TEXT_SELECT_TARGET_DEPT')?>
</option>
<?
$depts= db_query('SELECT dept_id,dept_name FROM '.DEPT_TABLE.' WHERE dept_id!='.db_input($ticket->getDeptId()));
while (list($deptId,$deptName) = db_fetch_row($depts)){
$selected = ($info['dept_id']==$deptId)?'selected':''; ?>
<option value="<?=$deptId?>" <?=$selected?>>
<?=$deptName?>
Department
</option>
<?
}?>
</select><font class='error'> *<?=$errors['dept_id']?> </font>
</div>
<div>
<span><?php $trl->_('TEXT_COMMENTS_REASONS_TRANSFER')?> <font
class='error'> *<?=$errors['message']?> </font> </span>
<textarea name="message" id="message" cols="80" rows="7"
wrap="soft" style="width: 90%;">
<?=$info['message']?>
</textarea>
</div>
<p>
<div
style="margin-left: 50px; margin-top: 5px; margin-bottom: 10px; border: 0px;"
align="left">
<input class="button" type='submit'
value='<?= $trl->translate('LABEL_TRANSFER')?>' /> <input
class="button" type='reset'
value='<?= $trl->translate('LABEL_RESET')?>' /> <input
class="button" type='button'
value='<?= $trl->translate('LABEL_CANCEL')?>'
onClick="history.go(-1)" />
</div>
</p>
</form>
</p>
</div>
<?}?>
<?
//When the ticket is assigned Allow assignee, admin or ANY dept manager to reassign the ticket.
if(!$ticket->isAssigned() || $thisuser->isadmin() || $thisuser->isManager() || $thisuser->getId()==$ticket->getStaffId()) {
?>
<div id="assign" class="tabbertab" align="left">
<h2>
<?=$staff?$trl->_t('LABEL_RE_ASSIGN_TICKET'):$trl->_t('LABEL_ASSIGN_TO_STAFF')?>
</h2>
<p>
<form action="tickets.php?id=<?=$id?>#assign" name="notes"
method="post" enctype="multipart/form-data">
<input type="hidden" name="ticket_id" value="<?=$id?>"> <input
type="hidden" name="a" value="assign">
<div>
<span for="staffId"><?php $trl->_('LABEL_STAFF_MEMBER')?>:</span>
<select id="staffId" name="staffId">
<option value="0" selected="selected">
<?php $trl->_('TEXT_SELECT_STAFF_MEMBER')?>
</option>
<?
//TODO: make sure the user's group is also active....DO a join.
$sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name FROM '.STAFF_TABLE.
' WHERE isactive=1 AND onvacation=0 ';
if($ticket->isAssigned())
$sql.=' AND staff_id!='.db_input($ticket->getStaffId());
$depts= db_query($sql.' ORDER BY lastname,firstname ');
while (list($staffId,$staffName) = db_fetch_row($depts)){
$selected = ($info['staffId']==$staffId)?'selected':''; ?>
<option value="<?=$staffId?>" <?=$selected?>>
<?=$staffName?>
</option>
<?
}?>
</select><font class='error'> *<?=$errors['staffId']?> </font>
</div>
<div>
<span>Comments/message for assignee. (<i>Saved as internal
note</i>) <font class='error'> *<?=$errors['assign_message']?>
</font> </span>
<textarea name="assign_message" id="assign_message" cols="80"
rows="7" wrap="soft" style="width: 90%;">
<?=$info['assign_message']?>
</textarea>
</div>
<p>
<div
style="margin-left: 50px; margin-top: 5px; margin-bottom: 10px; border: 0px;"
align="left">
<input class="button" type='submit'
value='<?= $trl->translate('LABEL_ASSIGN')?>' /> <input
class="button" type='reset'
value='<?= $trl->translate('LABEL_RESET')?>' /> <input
class="button" type='button'
value='<?= $trl->translate('LABEL_CANCEL')?>'
onClick="history.go(-1)" />
</div>
</p>
</form>
</p>
</div>
<?}?>
</div>
</td>
</tr>
</table>