C
colomailbe

  • 18 days ago
  • Joined Jul 19, 2022
  • 0 best answers
  • it wasn't possible to still link on _thread after deletion... however, I figured out how to cleanup _thread_event:

    Remove deletion event:
    SELECT COUNT(*) FROM ost_thread_event WHERE username='user1' AND data IS NULL AND event_id=14;

    Remove closed event:
    SELECT COUNT(*) FROM ost_thread_event WHERE username='user2' AND data='{"status":[3,"Closed"]}' AND event_id=2 AND thread_id=0;

    Remove created event:
    SELECT COUNT(*) FROM ost_thread_event WHERE username='SYSTEM' AND data IS NULL AND event_id=1 AND thread_id=0;

    Note. Of course SELECT COUNT(*) has to be replaced by DELETE, it was just to make sure to get the same number of rows everywhere.

    And now:
    SELECT COUNT(*) FROM ost_thread_event WHERE thread_id=0;
    equal 0

    Guess we are saved ;-)

    Thanks Kevin !

    Colo

  • KevinTheJedi

    Hi Kevin,

    Thanks for quick answer, but I still have a question then.

    As it seems that everything is logged apart. I can easily delete the rows for the DELETE action, but what about the CLOSE action and SYSTEM action when it created them from mail ? I suppose that I'll have to delete them as well (otherwise I'll still have 1k cases created today). Is there any way to find those rows based on either rows with delete action or subject, or mail body ?

    Thanks !

    Colo

    • Hi everyone,

      There's already plenty of threads concerning this topic, but I still need some help, as we are running in production and it's not completely obvious (at least for me ;-)

      One of our IT guy wrote an agent that mailed hundreds of cases to osTicket. We deleted them but it's still in the Dashboard, as we are using it for KPI, it would be nice to be able to completely remove them.

      I've checked table thread and thread_event (as suggested in other posts). In table thread_event I can easily find the deleted entries by timestamp and username. But I can't in table thread, id and object_id doesn't seems to match with anything I have in the other table.

      So how can I safely remove those deleted tickets from the dashboard ?

      Thanks !!

      PHP: 8.2.4
      Arch Linux: Last update somewhere in September
      osTicket: 1.17.3

      Colo

      • I was happy to see a reply with some code that could have solved my issue, but this is actually what I have in my class.report.php.
        However comment, line 99, may suggest a future update: "# TODO: Handle user => db timezone offset"

        The lines that you point are used to sort and group by day, not for display.

        My best guess, reading quickly the code would be:
        line 119, $row_time = strtotime($row[1]);
        line 130, $times[] = $time = $row_time;
        reformat the date to store in array, but as it's stored as timestamp, I doubt that it'll work when it'll be used to effectively plot the graph.

        If we find where this array is used to plot the graph:
        line 139, return array("times" => $times, "plots" => $plots, "events" => $events);
        maybe then we could hardcode a different way to display the date.

        Best,
        CMB

      • Hi everyone,

        How can I set the display date in the dashboard to European standard (dd/MM/yyyy) ?
        (currently it's the US version M/d/yy)

        Settings > System are set to:
        Default locale: English (Belgium)
        Time Zone: Europe/Brussels
        Date and Time format: Advanced (with required settings)

        My system locale are:
        LANG=en_US.UTF-8
        LC_NUMERIC=fr_BE.utf8
        LC_TIME=en_GB.utf8
        LC_MONETARY=fr_BE.utf8
        LC_PAPER=fr_BE.utf8
        LC_MEASUREMENT=fr_BE.utf8

        I've probably missed something in the configuration (but if not, would it be possible to set dashboard to use either configured locale in osTicket or system locale ?).

        Thanks!!

        CMB

        [EDIT] Forgot to mention that I'm running latest version 1.17.3