Printing notifications inside tickets

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
stevenf
Posts: 24
Joined: Wed Jun 15, 2016 9:37 am

Printing notifications inside tickets

Post by stevenf »

Script URL:
Version of script: 2.6.7.
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

Hello,

can you help me with one printing question? Is it possible to enable via backend to includes notes when printing tickets. Now print only includes ticket converstation but no notes.

I guess if it's not possible via backend I will need to change print.php, but can you point me what I should add and where?

Also, is it possible to sort ticket that new responses whould be always on top?

Thank you and best regards.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Printing notifications inside tickets

Post by Klemen »

There's no built-in function for this, but try this:

1. open "print.php" in a powerful text editor, such as Notepad++

2. find this code

Code: Select all

// Close ticket head table
echo '</table>';
3. Just below that code add

Code: Select all

// Print notes for staff
if ( ! empty($_SESSION['id']) )
{
    $res2 = hesk_dbQuery("SELECT t1.*, t2.`name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."notes` AS t1 LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."users` AS t2 ON t1.`who` = t2.`id` WHERE `ticket`='".intval($ticket['id'])."' ORDER BY t1.`id` " . ($hesk_settings['new_top'] ? 'DESC' : 'ASC') );
    while ($note = hesk_dbFetchAssoc($res2))
    {
        echo '<p>' . $hesklang['noteby'] . ' ' . ($note['name'] ? $note['name'] : $hesklang['e_udel']) . ' - ' . hesk_date($note['dt'], true) . '<br />';
        echo $note['message'] . '</p>';
    }
}
This should print notes if you are logged in as staff.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
stevenf
Posts: 24
Joined: Wed Jun 15, 2016 9:37 am

Re: Printing notifications inside tickets

Post by stevenf »

Hello again,

thank you for answer, but the problem now is, when I put that code, I can see only notifications and now there are missing ticket replys. It would be great to have both inside print.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Printing notifications inside tickets

Post by Klemen »

Ah, the $res in the above code needs to be changed to $res2 (twice, fixed now in the post above).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
stevenf
Posts: 24
Joined: Wed Jun 15, 2016 9:37 am

Re: Printing notifications inside tickets

Post by stevenf »

This should be it.

And also can you tell me how to modify --- End of ticket --- text because I would like to make spacing between notes and inittial ticket message?

Also, is it possible to sort ticket that new responses whould be always on top?
stevenf
Posts: 24
Joined: Wed Jun 15, 2016 9:37 am

Re: Printing notifications inside tickets

Post by stevenf »

I asked friend who knows PHP and he helped so if anybody would need this in future here it is how to change:

To make new replys in tickets to be on top with text field in hesk_settings.inc.php under // --> Help desk settings change $hesk_settings['new_top'] and $hesk_settings['reply_top'] from 0 to 1

Thanks to Klemen and his big help to include ticket's notes in printing options, code is above but if somebody need to change ticket order inside print viewu, open print.php and under /* Get replies */ for $res change ORDER BY from ASC to DESC.

And to add more options like --- End of ticket --- inside language folder in text.php under // ADMIN PANEL just add new strings that will be visible messages when printing tickets.

Once more, thx Klemen, your code helped so much.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Printing notifications inside tickets

Post by Klemen »

I'm glad you got it working and thanks for sharing the steps needed.

Just a note: no need to edit hesk_settings.inc.php manually (actually, I strongly advise against it), the newest replies on top is changeable from the admin panel:

Admin panel > Settings > Help desk tab > Reply order: [?] Newest reply at top
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply