I created a little mod that adds in a pending (or waiting for customer response) status. You can place the ticket into "open/pending" status which moves it out of the default open (non-pending queue) queue, and places it in pending. The ticket automatically moves out of pending if a customer responds to the ticket or if staff moves it out of pending. Please see the attached screen shot. NOTE: I haven't had a chance to test the instructions below on a fresh install yet, so please back up your files before you attempt this.

Here are the edits you must make:

0. DB Changes

DB Changes:

mysql> use osticket; # or whatever your db name is...

mysql> alter table ost_ticket add column is_pending tinyint(1) default 0;

1. include/staff/viewticket.inc.php

After:

<table align="center" class="ticketinfo" cellspacing="1" cellpadding="3" width="100%" border=0>

<tr>

<th>Status:</th>

<td><?=$ticket->getStatus()?>

Add:

<?php if($ticket->isPending()) { echo "/pending"; } ?>

Note: this is placed before the

***********************************************************

After:

<?if($ticket->isAssigned()){ ?>

<option value="release" <?=$info=='release'?'selected':''?> >Release (unassign)</option>

<?}?>

Add:

<?if(!$ticket->isPending()){ ?>

<option value="set_pending">Place Into Pending</option>

<?} else {?>

<option value="set_non_pending">Remove From Pending</option>

<?}?>

2. include/class.ticket.php

After:

var $overdue;

Add:

var $is_pending;

*************************************************************

After:

$this->closed =$row;

Add:

$this->is_pending =$row;

*************************************************************

After:

function setLastMsgId($msgid) {

return $this->lastMsgId=$msgid;

}

Add:

function setPending($pending_val){

if($pending_val) {

$sql = 'UPDATE ' . TICKET_TABLE . ' SET is_pending=1 WHERE '.

'ticket_id='.db_input($this->getId());

} else {

$sql = 'UPDATE ' . TICKET_TABLE . ' SET is_pending=0 WHERE '.

'ticket_id='.db_input($this->getId());

}

db_query($sql);

}

*************************************************************

After:

function getSubject() {

return $this->subject;

}

Add:

function isPending() {

if($this->is_pending == 1)

return true;

else

return false;

}

3. includes/staff/tickets.inc.php

After:

$staffId=0; //Nothing for now...TODO: Allow admin and manager to limit tickets to single staff level.

//Get status we are actually going to use on the query...making sure it is clean!

$status=null;

Add:

$showpending = false;

$showpendingonly = false;

*************************************************************

Replace the switch block:

switch(strtolower($_REQUEST)){ //Status is overloaded

...

}

With:

switch(strtolower($_REQUEST)){ //Status is overloaded

case 'open':

$status='open';

break;

case 'closed':

$status='closed';

$showpending = true;

break;

case 'overdue':

$status='open';

$showoverdue=true;

$showpending=true;

$results_type='Overdue Tickets';

break;

case 'assigned':

//$status='Open'; //

$showpending = true;

$staffId=$thisuser->getId();

break;

case 'answered':

$status='open';

$showanswered=true;

$showpending = true;

$results_type='Answered Tickets';

break;

case 'pending':

$status='open';

$showpendingonly=true;

break;

default:

if(!$search)

$status='open';

}

*************************************************************

After:

}elseif(!$search && !$cfg->showAnsweredTickets() && !strcasecmp($status,'open')) {

$qwhere.=' AND isanswered=0 ';

}

Add:

//Pending

if(!$showpending && !$showpendingonly) {

$qwhere .= ' AND is_pending=0 ';

}

if($showpendingonly) {

$qwhere .= ' AND is_pending=1 ';

}

4. scp/tickets.php

Replace the SQL string after:

//Navigation

$submenu=array();

/*quick stats...*/

With this:

$sql='SELECT (count(open.ticket_id) - sum(open.is_pending)) as open, sum(open.is_pending) as pending, count(answered.ticket_id) as answered '.

',count(overdue.ticket_id) as overdue, count(assigned.ticket_id) as assigned '.

' FROM '.TICKET_TABLE.' ticket '.

'LEFT JOIN '.TICKET_TABLE.' open ON open.ticket_id=ticket.ticket_id AND open.status=\'open\' AND open.isanswered=0 '.

'LEFT JOIN '.TICKET_TABLE.' answered ON answered.ticket_id=ticket.ticket_id AND answered.status=\'open\' AND answered.isanswered=1 '.

'LEFT JOIN '.TICKET_TABLE.' overdue ON overdue.ticket_id=ticket.ticket_id AND overdue.status=\'open\' AND overdue.isoverdue=1 '.

'LEFT JOIN '.TICKET_TABLE.' assigned ON assigned.ticket_id=ticket.ticket_id AND assigned.staff_id='.db_input($thisuser->getId());

*************************************************************

After:

function postMessage($msg,$source='',$msgid=NULL,$headers='',$newticket=false){

global $cfg;

if(!$this->getId())

return 0;

Add:

$this->setPending(false);

*************************************************************

Replace the line after:

if($cfg->showAnsweredTickets()) {

$nav->addSubMenu(array('desc'=>'Open ('.($stats+$stats).')'

,'title'=>'Open Tickets', 'href'=>'tickets.php', 'iconclass'=>'Ticket'));

}else{

if($stats)

With this:

$nav->addSubMenu(array('desc'=>'Open/Non-Pending('.$stats.')','title'=>'Open Tickets', 'href'=>'tickets.php', 'iconclass'=>'Ticket'));

*************************************************************

After:

$nav->addSubMenu(array('desc'=>'Answered ('.$stats.')',

'title'=>'Answered Tickets', 'href'=>'tickets.php?status=answered', 'iconclass'=>'answeredTickets'));

}

}

Add:

if($stats) { $nav->addSubMenu(array('desc'=>'Pending('.$stats.')','title'=>'Open Tickets', 'href'=>'tickets.php?status=pending', 'iconclass'=>'Ticket'));

}

*************************************************************

After:

case 'process':

$isdeptmanager=($ticket->getDeptId()==$thisuser->getDeptId())?true;

switch(strtolower($_POST)):

Add:

case 'set_pending':

if(!$thisuser->canManageTickets()){

$errors='Perm. Denied. You are not allowed to change the ticket\'s status';

}

if(!$errors)

$ticket->setPending(true);

break;

case 'set_non_pending':

if(!$thisuser->canManageTickets()){

$errors='Perm. Denied. You are not allowed to change the ticket\'s status';

}

if(!$errors)

$ticket->setPending(false);

break;

imaaage.jpg

4 months later

Hi

this mod is nice but I think that some lines are missing.

it's not specify where we need to modify this line.

I think that I find, it's in : include \class.ticket.php

Then, I did everything, the new tab "pending" is missing. When i put one ticket in pending and I click on "Ticket" tab, it disappear over the answered tab, and the number

beside of my answered ticket stay the same. But when I click on Answered, all answered ticket appear + pending ticket too.

After:

Code:

function postMessage($msg,$source='',$msgid=NULL,$headers='',$newticket=false){

global $cfg;

if(!$this->getId())

return 0;

a year later

Hi, i have this mod working of a sort.

I have 90 tickets open. I pended 1 ticket. it now shows 91 open and 70 pending but there is only 1 in the pending queue and should show 89 in the open queue....

went for this mod instead:

http://www.osticket.com/forums/showthread.php?t=6162&highlight=pending(http://www.osticket.com/forums/showthread.php?t=6162&highlight=pending)

works perfectly.

Write a Reply...