Page 1 of 1

Printing notifications inside tickets

Posted: Tue Nov 08, 2016 7:38 am
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.

Re: Printing notifications inside tickets

Posted: Tue Nov 08, 2016 6:45 pm
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.

Re: Printing notifications inside tickets

Posted: Wed Nov 09, 2016 8:09 am
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.

Re: Printing notifications inside tickets

Posted: Wed Nov 09, 2016 11:54 am
by Klemen
Ah, the $res in the above code needs to be changed to $res2 (twice, fixed now in the post above).

Re: Printing notifications inside tickets

Posted: Wed Nov 09, 2016 12:11 pm
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?

Re: Printing notifications inside tickets

Posted: Fri Nov 11, 2016 10:02 am
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.

Re: Printing notifications inside tickets

Posted: Sat Nov 12, 2016 8:55 am
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