diff --git a/include/class.ticket.php b/include/class.ticket.php index bdb2655fb381b3b799c71a04eb7f2d8a923da038..477135e0e997fd95057bb35d6f6ac302579c663b 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1787,15 +1787,15 @@ class Ticket { $fields['email'] = array('type'=>'email', 'required'=>1, 'error'=>'Valid email required'); $fields['subject'] = array('type'=>'string', 'required'=>1, 'error'=>'Subject required'); $fields['topicId'] = array('type'=>'int', 'required'=>1, 'error'=>'Help topic required'); - $fields['slaId'] = array('type'=>'int', 'required'=>1, 'error'=>'SLA required'); $fields['priorityId'] = array('type'=>'int', 'required'=>1, 'error'=>'Priority required'); + $fields['slaId'] = array('type'=>'int', 'required'=>0, 'error'=>'Select SLA'); $fields['phone'] = array('type'=>'phone', 'required'=>0, 'error'=>'Valid phone # required'); $fields['duedate'] = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date - must be MM/DD/YY'); $fields['note'] = array('type'=>'text', 'required'=>1, 'error'=>'Reason for the update required'); if(!Validator::process($fields, $vars, $errors) && !$errors['err']) - $errors['err'] ='Missing or invalid data - check the errors and try again'; + $errors['err'] = 'Missing or invalid data - check the errors and try again'; if($vars['duedate']) { if($this->isClosed()) @@ -2087,10 +2087,17 @@ class Ticket { $priorityId=$priorityId?$priorityId:$topic->getPriorityId(); if($autorespond) $autorespond=$topic->autoRespond(); $source=$vars['source']?$vars['source']:'Web'; + + //Auto assignment. if (!isset($vars['staffId']) && $topic->getStaffId()) $vars['staffId'] = $topic->getStaffId(); elseif (!isset($vars['teamId']) && $topic->getTeamId()) $vars['teamId'] = $topic->getTeamId(); + + //set default sla. + if(!isset($vars['slaId']) && $topic->getSLAId()) + $vars['slaId'] = $topic->getSLAId(); + }elseif($vars['emailId'] && !$vars['deptId'] && ($email=Email::lookup($vars['emailId']))) { //Emailed Tickets $deptId=$email->getDeptId(); $priorityId=$priorityId?$priorityId:$email->getPriorityId(); @@ -2280,7 +2287,7 @@ class Ticket { function checkOverdue() { $sql='SELECT ticket_id FROM '.TICKET_TABLE.' T1 ' - .' JOIN '.SLA_TABLE.' T2 ON (T1.sla_id=T2.id) ' + .' INNER JOIN '.SLA_TABLE.' T2 ON (T1.sla_id=T2.id AND T2.isactive=1) ' .' WHERE status=\'open\' AND isoverdue=0 ' .' AND ((reopened is NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),T1.created))>=T2.grace_period*3600) ' .' OR (reopened is NOT NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),reopened))>=T2.grace_period*3600) ' diff --git a/include/staff/ticket-edit.inc.php b/include/staff/ticket-edit.inc.php index 39093db710d6ca41cf681232ed4fa082b1278532..5f5a0a4d2e2e86816e64039bfb6ede821f5379b5 100644 --- a/include/staff/ticket-edit.inc.php +++ b/include/staff/ticket-edit.inc.php @@ -24,7 +24,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$ticket->getUpdateInfo()); Full Name: </td> <td> - <input type="text" size="45" name="name" value="<?php echo $info['name']; ?>"> + <input type="text" size="50" name="name" value="<?php echo $info['name']; ?>"> <span class="error">* <?php echo $errors['name']; ?></span> </td> </tr> @@ -33,7 +33,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$ticket->getUpdateInfo()); Email Address: </td> <td> - <input type="text" size="45" name="email" value="<?php echo $info['email']; ?>"> + <input type="text" size="50" name="email" value="<?php echo $info['email']; ?>"> <span class="error">* <?php echo $errors['email']; ?></span> </td> </tr> @@ -42,9 +42,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$ticket->getUpdateInfo()); Phone Number: </td> <td> - <input type="text" size="18" name="phone" value="<?php echo $info['phone']; ?>"> + <input type="text" size="20" name="phone" value="<?php echo $info['phone']; ?>"> <span class="error"> <?php echo $errors['phone']; ?></span> - Ext <input type="text" size="5" name="phone_ext" value="<?php echo $info['phone_ext']; ?>"> + Ext <input type="text" size="6" name="phone_ext" value="<?php echo $info['phone_ext']; ?>"> <span class="error"> <?php echo $errors['phone_ext']; ?></span> </td> </tr> @@ -109,11 +109,20 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$ticket->getUpdateInfo()); </tr> <tr> <td width="160" class="required"> - SLA: + Subject: + </td> + <td> + <input type="text" name="subject" size="60" value="<?php echo $info['subject']; ?>"> + <font class="error">* <?php $errors['subject']; ?></font> + </td> + </tr> + <tr> + <td width="160"> + SLA Plan: </td> <td> <select name="slaId"> - <option value="" selected >— Select SLA —</option> + <option value="0" selected="selected" >— None —</option> <?php if($slas=SLA::getSLAs()) { foreach($slas as $id =>$name) { @@ -123,16 +132,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$ticket->getUpdateInfo()); } ?> </select> - <font class="error">* <?php echo $errors['slaId']; ?></font> - </td> - </tr> - <tr> - <td width="160" class="required"> - Subject: - </td> - <td> - <input type="text" name="subject" size="60" value="<?php echo $info['subject']; ?>"> - <font class="error">* <?php $errors['subject']; ?></font> + <font class="error"> <?php echo $errors['slaId']; ?></font> </td> </tr> <tr> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 1ef3a7ba52ee0925ee4166984629d6661ce861a6..f36c1e0bcd97dcf1fd067fd71e585675283788f5 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -24,7 +24,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </td> <td> - <input type="text" size="45" name="email" id="email" class="typeahead" value="<?php echo $info['email']; ?>" + <input type="text" size="50" name="email" id="email" class="typeahead" value="<?php echo $info['email']; ?>" autocomplete="off" autocorrect="off" autocapitalize="off"> <span class="error">* <?php echo $errors['email']; ?></span> <?php @@ -40,7 +40,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); Full Name: </td> <td> - <input type="text" size="45" name="name" id="name" value="<?php echo $info['name']; ?>"> + <input type="text" size="50" name="name" id="name" value="<?php echo $info['name']; ?>"> <span class="error">* <?php echo $errors['name']; ?></span> </td> </tr> @@ -49,15 +49,15 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); Phone Number: </td> <td> - <input type="text" size="18" name="phone" id="phone" value="<?php echo $info['phone']; ?>"> + <input type="text" size="20" name="phone" id="phone" value="<?php echo $info['phone']; ?>"> <span class="error"> <?php echo $errors['phone']; ?></span> - Ext <input type="text" size="5" name="phone_ext" id="phone_ext" value="<?php echo $info['phone_ext']; ?>"> + Ext <input type="text" size="6" name="phone_ext" id="phone_ext" value="<?php echo $info['phone_ext']; ?>"> <span class="error"> <?php echo $errors['phone_ext']; ?></span> </td> </tr> <tr> <th colspan="2"> - <em><strong>Ticket Information</strong>:</em> + <em><strong>Ticket Information & Options</strong>:</em> </th> </tr> <tr> @@ -114,92 +114,45 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </td> </tr> <tr> - <td width="160" class="required"> - Subject: + <td width="160"> + Priority: </td> <td> - <input type="text" name="subject" size="55" value="<?php echo $info['subject']; ?>"> - <font class="error">* <?php echo $errors['subject']; ?></font> + <select name="priorityId"> + <option value="0" selected >— System Default —</option> + <?php + if($priorities=Priority::getPriorities()) { + foreach($priorities as $id =>$name) { + echo sprintf('<option value="%d" %s>%s</option>', + $id, ($info['priorityId']==$id)?'selected="selected"':'',$name); + } + } + ?> + </select> + <font class="error"> <?php echo $errors['priorityId']; ?></font> </td> - </tr> - <tr> - <th colspan="2"> - <em><strong>Issue summary</strong>: Detailed summary of the reason(s) of opening the ticket. <font class="error">* <?php echo $errors['issue']; ?></font></em> - </th> - </tr> - <tr> - <td colspan=2> - <textarea name="issue" cols="21" rows="8" style="width:80%;"><?php echo $info['issue']; ?></textarea> - <br><em>The user will be able to see the summary and any associated responses.</em> + </tr> + <tr> + <td width="160"> + SLA Plan: </td> - </tr> - <tr> - <th colspan="2"> - <em><strong>Response</strong>: Optional response to the above issue.</em> - </th> - </tr> - <tr> - <td colspan=2> - <?php - if(($cannedResponses=Canned::getCannedResponses())) { - ?> - <div> - Canned Response: - <select id="cannedResp" name="cannedResp"> - <option value="0" selected="selected">— Select a canned response —</option> - <?php - foreach($cannedResponses as $id =>$title) { - echo sprintf('<option value="%d">%s</option>',$id,$title); - } - ?> - </select> - - <label><input type='checkbox' value='1' name="append" id="append" checked="checked">Append</label> - </div> - <?php - } ?> - <textarea name="response" id="response" cols="21" rows="8" style="width:80%;"><?php echo $info['response']; ?></textarea> - <?php - if($cfg->allowAttachments()) { ?> - <br><em><b>Attachments:</b> Response required when files are attached.</em> - <div class="canned_attachments"> + <td> + <select name="slaId"> + <option value="0" selected="selected" >— System Default —</option> <?php - if($info['cannedattachments']) { - foreach($info['cannedattachments'] as $k=>$id) { - if(!($file=AttachmentFile::lookup($id))) continue; - $hash=$file->getHash().md5($file->getId().session_id().$file->getHash()); - echo sprintf('<label><input type="checkbox" name="cannedattachments[]" id="f%d" value="%d" checked="checked"> - <a href="file.php?h=%s">%s</a> </label> ', - $file->getId(), $file->getId() , $hash, $file->getName()); + if($slas=SLA::getSLAs()) { + foreach($slas as $id =>$name) { + echo sprintf('<option value="%d" %s>%s</option>', + $id, ($info['slaId']==$id)?'selected="selected"':'',$name); } } ?> - </div> - <div class="uploads"></div> - <div class="file_input"> - <input type="file" class="multifile" name="attachments[]" size="30" value="" /> - </div> - <?php - } ?> + </select> + <font class="error"> <?php echo $errors['slaId']; ?></font> </td> - </tr> + </tr> - <tr> - <th colspan="2"> - <em><strong>Internal Note</strong>: Optional internal note (recommended on assignment) <font class="error"> <?php echo $errors['note']; ?></font></em> - </th> - </tr> - <tr> - <td colspan=2> - <textarea name="note" cols="21" rows="6" style="width:80%;"><?php echo $info['note']; ?></textarea> - </td> - </tr> - <tr> - <th colspan="2"> - <em><strong>Ticket Options</strong>: Due date, when set, overwrites SLA grace period.</em> - </th> - </tr> - <tr> + <tr> <td width="160"> Due Date: </td> @@ -210,32 +163,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); $min=$hr=null; if($info['time']) list($hr, $min)=explode(':', $info['time']); - + echo Misc::timeDropdown($hr, $min, 'time'); ?> <font class="error"> <?php echo $errors['duedate']; ?> <?php echo $errors['time']; ?></font> <em>Time is based on your time zone (GMT <?php echo $thisstaff->getTZoffset(); ?>)</em> </td> </tr> - <tr> - <td width="160"> - Priority: - </td> - <td> - <select name="priorityId"> - <option value="0" selected >— System Default —</option> - <?php - if($priorities=Priority::getPriorities()) { - foreach($priorities as $id =>$name) { - echo sprintf('<option value="%d" %s>%s</option>', - $id, ($info['priorityId']==$id)?'selected="selected"':'',$name); - } - } - ?> - </select> - <font class="error"> <?php echo $errors['priorityId']; ?></font> - </td> - </tr> + <?php if($thisstaff->canAssignTickets()) { ?> <tr> @@ -253,7 +188,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); } echo '</OPTGROUP>'; } - + if(($teams=Team::getActiveTeams())) { echo '<OPTGROUP label="Teams ('.count($teams).')">'; foreach($teams as $id => $name) { @@ -269,37 +204,114 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </tr> <?php } ?> - - <?php - if($thisstaff->canCloseTickets()) { ?> <tr> - <td width="160"> - Ticket Status: - </td> - <td> - <input type="checkbox" name="ticket_state" value="closed" <?php echo $info['ticket_state']?'checked="checked"':''; ?>> - <b>Close On Response</b> <em>(Only applicable if response is entered)</em> + <th colspan="2"> + <em><strong>Issue</strong>: The user will be able to see the issue summary below and any associated responses.</em> + </th> + </tr> + <tr> + <td colspan=2> + <div> + <em><strong>Subject</strong>: Issue summary </em> <font class="error">* <?php echo $errors['subject']; ?></font><br> + <input type="text" name="subject" size="60" value="<?php echo $info['subject']; ?>"> + </div> + <div><em><strong>Issue</strong>: Details on the reason(s) for opening the ticket.</em> <font class="error">* <?php echo $errors['issue']; ?></font></div> + <textarea name="issue" cols="21" rows="8" style="width:80%;"><?php echo $info['issue']; ?></textarea> </td> </tr> - <?php - } ?> <tr> - <td>Signature:</td> - <td> - <?php - $info['signature']=$info['signature']?$info['signature']:$thisstaff->getDefaultSignatureType(); + <th colspan="2"> + <em><strong>Response</strong>: Optional response to the above issue.</em> + </th> + </tr> + <tr> + <td colspan=2> + <?php + if(($cannedResponses=Canned::getCannedResponses())) { ?> - <label><input type="radio" name="signature" value="none" checked="checked"> None</label> - <?php - if($thisstaff->getSignature()) { ?> - <label><input type="radio" name="signature" value="mine" - <?php echo ($info['signature']=='mine')?'checked="checked"':''; ?>> My signature</label> + <div> + Canned Response: + <select id="cannedResp" name="cannedResp"> + <option value="0" selected="selected">— Select a canned response —</option> + <?php + foreach($cannedResponses as $id =>$title) { + echo sprintf('<option value="%d">%s</option>',$id,$title); + } + ?> + </select> + + <label><input type='checkbox' value='1' name="append" id="append" checked="checked">Append</label> + </div> + <?php + } ?> + <textarea name="response" id="response" cols="21" rows="8" style="width:80%;"><?php echo $info['response']; ?></textarea> + <table border="0" cellspacing="0" cellpadding="2" width="100%"> <?php - } ?> - <label><input type="radio" name="signature" value="dept" - <?php echo ($info['signature']=='dept')?'checked="checked"':''; ?>> - Dept. Signature (if set)</label> - <span style="padding-left:25px;"> + if($cfg->allowAttachments()) { ?> + <tr><td width="100" valign="top">Attachments:</td> + <td> + <div class="canned_attachments"> + <?php + if($info['cannedattachments']) { + foreach($info['cannedattachments'] as $k=>$id) { + if(!($file=AttachmentFile::lookup($id))) continue; + $hash=$file->getHash().md5($file->getId().session_id().$file->getHash()); + echo sprintf('<label><input type="checkbox" name="cannedattachments[]" + id="f%d" value="%d" checked="checked" + <a href="file.php?h=%s">%s</a> </label> ', + $file->getId(), $file->getId() , $hash, $file->getName()); + } + } + ?> + </div> + <div class="uploads"></div> + <div class="file_input"> + <input type="file" class="multifile" name="attachments[]" size="30" value="" /> + </div> + </td> + </tr> + <?php + } ?> + + <?php + if($thisstaff->canCloseTickets()) { ?> + <tr> + <td width="100">Ticket Status:</td> + <td> + <input type="checkbox" name="ticket_state" value="closed" <?php echo $info['ticket_state']?'checked="checked"':''; ?>> + <b>Close On Response</b> <em>(Only applicable if response is entered)</em> + </td> + </tr> + <?php + } ?> + <tr> + <td width="100">Signature:</td> + <td> + <?php + $info['signature']=$info['signature']?$info['signature']:$thisstaff->getDefaultSignatureType(); + ?> + <label><input type="radio" name="signature" value="none" checked="checked"> None</label> + <?php + if($thisstaff->getSignature()) { ?> + <label><input type="radio" name="signature" value="mine" + <?php echo ($info['signature']=='mine')?'checked="checked"':''; ?>> My signature</label> + <?php + } ?> + <label><input type="radio" name="signature" value="dept" + <?php echo ($info['signature']=='dept')?'checked="checked"':''; ?>> Dept. Signature (if set)</label> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <th colspan="2"> + <em><strong>Internal Note</strong>: Optional internal note (recommended on assignment) <font class="error"> <?php echo $errors['note']; ?></font></em> + </th> + </tr> + <tr> + <td colspan=2> + <textarea name="note" cols="21" rows="6" style="width:80%;"><?php echo $info['note']; ?></textarea> </td> </tr> </tbody>