ACCORD5 / TrellisDesk

A robust and user-friendly help desk solution for businesses and organizations.
http://www.accord5.com/trellis
Other
122 stars 61 forks source link

Database error when "marking all tickets as read" #54

Open darbin opened 12 years ago

darbin commented 12 years ago

I have a usergroup with admin access to different departments. In few of them this usergroup have only viewer access, in others also a editor access (I don't think this matter, just giving information just in case). When user from this group clicking on "Mark all tickets as read" (/admin.php?section=manage&page=tickets&act=dotrackall) he getting error:

TD Fatal Error: MySQL - Unable to process query: SELECT t.id, tt.date AS track_date FROM td_tickets t LEFT JOIN td_tickets_track tt ON ( tt.tid = t.id ) WHERE t.did IN ( '2', '3', '4', '5', '6', '7', '1' ) OR a.uid = '10' The following error was returned: 1054: Unknown column 'a.uid' in 'where clause' in /includes/classes/class_mysql.php on line 79

Under admin I able to mark all tickets as read without database error.

DanielRuf commented 12 years ago

should be t.uid or tt.uid ? please change the a to t or tt and check that in includes/functions/func_tickets.php on line 1733

darbin commented 12 years ago

Thank you. Changing array( 'a' => 'uid' ) to array( 't' => 'uid' ) in line 1733 helps.

But there are another issue - I just figure out that system writing "All tickets have been successfully marked as read." but not marking tickets as read (tested under user and admin), still showing balloon with toolitp "unread".

Also I think we should add in "Filter by Status" (admin.php?section=manage&page=ticket) one more checkbox "Unread" to filter unread tickets.

DanielRuf commented 12 years ago

Will take a look this weekend and try to solve this issue with the status that is not set in the database.

Also I will maybe add the "Filter by status".

Are these 2 functions executed without any issues ore do they fail?:

    $this->trellis->db->construct( array(
                'update'    => 'tickets_track',
                'set'        => array( 'date' => time() ),
                'where'        => array( 'uid', '=', $this->trellis->user['id'] ),
            ) );

        $this->trellis->db->execute();

        foreach ( $tickets as &$t )
        {
            if ( ! isset( $t['track_date'] ) )
            {
                $this->trellis->db->construct( array(
                    'insert'    => 'tickets_track',
                    'set'        => array( 'tid' => $t['id'], 'uid' => $this->trellis->user['id'], 'date' => time() ),
                ) );

                $this->trellis->db->execute();