Pager does not work properly on user ticket view page

Created on 15 February 2012, almost 13 years ago
Updated 29 March 2023, almost 2 years ago

On page
support/user/(id)
works support_page_user function.
When creating a count_query the code

$sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {support_ticket} t ON n.nid = t.nid LEFT JOIN {comments} c ON n.nid = c.nid WHERE (c.status = ". COMMENT_PUBLISHED ." OR c.status IS NULL) AND n.status = 1 AND n.type = 'support_ticket' AND t.assigned = $user->uid $state";

does not check if $assigned=false, And result of this query returns zero even if we have rows to show.
I have changed the code above on this:

    if (!$assigned) {
      $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {support_ticket} t ON n.nid = t.nid LEFT JOIN {comments} c ON n.nid = c.nid WHERE (c.status = ". COMMENT_PUBLISHED ." OR c.status IS NULL) AND n.status = 1 AND n.type = 'support_ticket' AND (t.assigned = $user->uid OR n.uid = $user->uid) $state";
    } else {
    	$sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {support_ticket} t ON n.nid = t.nid LEFT JOIN {comments} c ON n.nid = c.nid WHERE (c.status = ". COMMENT_PUBLISHED ." OR c.status IS NULL) AND n.status = 1 AND n.type = 'support_ticket' AND t.assigned = $user->uid $state";
    }

and it began work correct.

πŸ› Bug report
Status

Closed: outdated

Version

1.8

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine natbampo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024