Feature Request: Display Date & Time Next to Subject in "Previous Tickets" Section

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
arsagor
Posts: 11
Joined: Mon Mar 10, 2025 8:32 am

Feature Request: Display Date & Time Next to Subject in "Previous Tickets" Section

Post by arsagor »

Version of script: 3.5.2
Hosting company: Local Host

In the "Previous Tickets" section, currently only the subject is displayed. If the date and time of each ticket could also be shown next to the subject, it would make tracking and reviewing tickets much easier.

Image
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Re: Feature Request: Display Date & Time Next to Subject in "Previous Tickets" Section

Post by Klemen »

You could add this easily by editing /admin/admin_ticket.php

Find

Code: Select all

$res = hesk_dbQuery("SELECT `trackid`, `status`, `subject` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` `tickets`
and change it to

Code: Select all

$res = hesk_dbQuery("SELECT `dt`,`trackid`, `status`, `subject` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` `tickets`
Then add

Code: Select all

<?php echo hesk_date($past_ticket['dt'], true); ?>
a few lines below where tickets are printed.

Example final code:

Code: Select all

            // Get recent tickets, ordered by last change
            $res = hesk_dbQuery("SELECT `dt`,`trackid`, `status`, `subject` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` `tickets`
                WHERE ".hesk_myCategories()."
                    AND ".hesk_myOwnership()."
                    AND `id` <> ".$ticket['id']."
                    AND EXISTS (
                        SELECT 1
                        FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."ticket_to_customer`
                        WHERE `ticket_id` = `tickets`.`id`
                        AND `customer_id` = ".intval($first_customer['id'])."
                    ) 
                ORDER BY `lastchange` DESC
                LIMIT " . ($show_previous_tickets+1));
            $past_num = hesk_dbNumRows($res);
            ?>
            <section class="params--block details accordion <?php if ($past_num > 0) echo 'visible'; ?>">
                <h4 class="accordion-title">
                    <span><?php echo $hesklang['previous_tickets']; ?></span>
                    <svg class="icon icon-chevron-down">
                        <use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-chevron-down"></use>
                    </svg>
                </h4>
                <div class="accordion-body" <?php if ($past_num > 0) echo 'style="display:block"'; ?>>
                    <?php
                    $i = 0;
                    while ($past_ticket = hesk_dbFetchAssoc($res)) {
                        $i++;
                        if ($i > $show_previous_tickets) {
                            hesk_dbFreeResult($res);
                            break;
                        }
                        ?>
                        <div>
                            <?php if (isset($hesk_settings['statuses'][$past_ticket['status']]['class'])): ?>
                                <span class="dot bg-<?php echo $hesk_settings['statuses'][$past_ticket['status']]['class']; ?>" title="<?php echo $hesk_settings['statuses'][$past_ticket['status']]['name']; ?>"></span>
                            <?php else: ?>
                                <span class="dot" style="background-color:<?php echo $hesk_settings['statuses'][$past_ticket['status']]['color']; ?>" title="<?php echo $hesk_settings['statuses'][$past_ticket['status']]['name']; ?>"></span>
                            <?php endif; ?>
                            <?php echo hesk_date($past_ticket['dt'], true); ?><br>
                            <a href="admin_ticket.php?track=<?php echo $past_ticket['trackid']; ?>&amp;Refresh=<?php echo rand(10000,99999); ?>"><?php echo $past_ticket['subject']; ?></a>
                        </div>
                        <?php
                    }

                    if ($past_num > 0 && $i > $show_previous_tickets) {
                        echo '<br><a href="find_tickets.php?q='.urlencode($first_customer['email']).'&amp;what=email&amp;s_my=1&amp;s_ot=1&amp;s_un=1">'.$hesklang['all_previous'].'</a>';
                    } elseif ($past_num == 0) {
                        echo sprintf($hesklang['no_previous'], hesk_htmlspecialchars($first_customer['email']));
                    }
                    ?>
                </div>
            </section>
            <?php
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
arsagor
Posts: 11
Joined: Mon Mar 10, 2025 8:32 am

Re: Feature Request: Display Date & Time Next to Subject in "Previous Tickets" Section

Post by arsagor »

Hi Klemen,
Thank you very much for your reply. I made a small edit so that the subject appears first, followed by the date and time, like "Subject | Date Time." The code is working fine.
I hope this feature will be included in a future update.

Image
Post Reply