Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

How To call Function getLastRespondent() into local ticket.inc.php

I want to name of staff the respondent current ticket by row in home page 

---------------class.ticket.php-----------------------------------------
function getLastRespondent() {

        $sql ='SELECT  resp.staff_id '
             .' FROM '.TICKET_THREAD_TABLE.' resp '
             .' LEFT JOIN '.STAFF_TABLE. ' USING(staff_id) '
             .' WHERE  resp.ticket_id='.db_input($this->getId()).' AND resp.staff_id>0 '
             .'   AND  resp.thread_type IN ("R","N")'
             .' ORDER BY resp.created DESC LIMIT 1';

        if(!($res=db_query($sql)) || !db_num_rows($res))
            return null;

        list($id)=db_fetch_row($res);

        return Staff::lookup($id);

    }
-----------------------ticket.inc.php----------------------------------
[Loop While display Row Ticket on home page]

<td nowrap >
<?php echo $ticket->getLastRespondent(); ?></td>   <<<< not work 

echo sprintf('<td>%s</td>',$ticket->getLastRespondent());  <<<< not work 

--------------------------------------------------------------------------
Example call function it WORK 

---------------ticket-preview.tmpl.php-------------------------

$ticket_state=sprintf('<span>%s</span>',$ticket->getStatus());

$ticket_lastRespondent=sprintf('<span>%s</span>',$ticket->getLastRespondent());

echo sprintf('
        <tr>
            <th width="100">'.__('Ticket State').':</th>
<td>%s</td>
        </tr>
<tr>
<th width="100">'.__('Last Response').':</th>
<td>%s by %s</td>
</tr>
        <tr>
            <th>'.__('Created').':</th>
            <td>%s</td>
        </tr>',$ticket_state,
Format::db_datetime($ticket->getLastRespDate()),
$ticket_lastRespondent,
        Format::db_datetime($ticket->getCreateDate()));

Thank you Every Body Answer 

Comments

  • Last column name "Last Respondent"
    lastrespondent_1.JPG
    861 x 239 - 43K
  • Sorry... but I have no idea what you are asking.
    What page are you referring to as the "home page"?

  • Oh..Sorry .. I meaning Back-end/Staff-side 
    URL referen : osticket/scp/tickets.php 
  • So you want to add a column to the open ticket queue.

    This thread ought to point you in the right direction:
    http://osticket.com/forum/discussion/75457/a-better-ticket-list/p7
  • [Resolve] [Solution for Osticket Offline... It's Work for me]

    "tickets.inc.php"
    Add line 457-465
    // query thread
    $sql ='SELECT resp.staff_id'
    .' FROM '.TICKET_THREAD_TABLE.' resp '
    .' LEFT JOIN '.STAFF_TABLE. ' USING(staff_id) '
    .' WHERE resp.ticket_id = '.$row['ticket_id'].' AND resp.staff_id>0 '
    .' AND resp.thread_type IN ("R","N")'
    .' ORDER BY resp.created DESC LIMIT 1 ';

    Add line 608-615
    <!--Last Responded->
    <?php
    if(!($res=db_query($sql)))
    return null;
    list($id)=db_fetch_row($res);
    ?>
    <td align="center" nowrap><?php echo Staff::lookup($id) ; ?></td>
    lastrespondent_3.JPG
    851 x 197 - 45K
Sign In or Register to comment.