$querystr .= " id=%d OR merged_to=%d"; array_push($argv, $result['merged_to']); array_push($argv, $result['merged_to']); } if ($rows) { $querystr .= " OR"; } $querystr .= " merged_to=%d"; array_push($argv, $id); $querystr .= ") ORDER BY status DESC,priority DESC,id"; if (!isset($_GET['full'])) { $querystr .= " LIMIT 10"; } array_unshift($argv, $querystr); $matches = 0; $query2 = squery_args($argv); while ($result2 = sql_fetch_array($query2)) { if (!$matches) { ?> <tr class="Karnaf_Head2"><td colspan="2">Possible Related Tickets</td></tr> <tr><td colspan="2"> <table border="1" bordercolor="Black" width="100%" cellpadding="0" cellspacing="0"> <tr class="Karnaf_P_Head"> <td>ID</td> <td><?php echo USER_FIELD; ?> </td> <td>E-Mail</td> <td>Assigned to</td> </tr>
/* Note: Yes, the line is repeated by design.. the second is for the close time */ } else { if (!empty($_POST['time_start'])) { $time_start = datetounixtime($_POST['time_start']); $qstr .= " AND t.open_time>=%d"; array_push($argv, $time_start); } if (!empty($_POST['time_end'])) { $time_end = datetounixtime($_POST['time_end']); $qstr .= " AND t.close_time!=0 AND close_time<=%d"; array_push($argv, $time_end); } } $qstr .= " ORDER BY t.priority DESC,t.open_time LIMIT " . $next . "," . ($next + $limit + 1); array_unshift($argv, $qstr); $query = squery_args($argv); $cnt = 0; while ($result = sql_fetch_array($query)) { if (!IsGroupMember($result['rep_g']) && !IsKarnafAdminSession()) { continue; } /* Skip tickets for other teams */ $cnt++; if ($cnt > $limit) { echo "<tr><td colspan=\"9\" align=\"center\">*** There are more results... ***</td></tr>"; break; } $query2 = squery("SELECT count(*) AS count FROM karnaf_actions WHERE tid=%d", $result['id']); if ($result2 = sql_fetch_array($query2)) { $action_cnt = (int) $result2['count']; } else {