ALTER TABLE `bug` ADD `hidden` INT(2) UNSIGNED NOT NULL AFTER `assignedto`;
-ALTER TABLE `comment` ADD `hidden` INT(2) UNSIGNED NOT NULL;
\ No newline at end of file
+ALTER TABLE `comment` ADD `hidden` INT(2) UNSIGNED NOT NULL;
+
+ALTER TABLE `bug` ADD `hiddenlastposttime` INT(10) UNSIGNED NOT NULL, ADD `hiddenlastpostby` INT(10) UNSIGNED NOT NULL;
\ No newline at end of file
chdir('./../');
require_once('./global.php');
-$comments = $db->query("SELECT * FROM comment ORDER BY bugid, dateline ASC");
+$comments = $db->query("SELECT * FROM " . TABLE_PREFIX . "comment ORDER BY bugid, dateline ASC");
while ($comment = $db->fetch_array($comments))
{
if (!isset($replace["$comment[bugid]"]))
{
- $replace["$comment[bugid]"] = array('initialreport' => $comment['commentid'], 'dateline' => $comment['dateline'], 'lastposttime' => $comment['dateline'], 'lastpostby' => $comment['userid']);
+ $replace["$comment[bugid]"] = array(
+ 'initialreport' => $comment['commentid'],
+ 'dateline' => $comment['dateline'],
+ 'lastposttime' => $comment['dateline'],
+ 'lastpostby' => $comment['userid']
+ );
}
+ if (!$comment['hidden'] AND !isset($replace["$comment[bugid]"]['hiddenlastposttime']))
+ {
+ $replace["$comment[bugid]"]['hiddenlastposttime'] = $comment['dateline'];
+ $replace["$comment[bugid]"]['hiddenlastpostby'] = $comment['userid'];
+ }
+
$replace["$comment[bugid]"]['lastposttime'] = $comment['dateline'];
}
foreach ($replace AS $bugid => $newfields)
{
- $db->query("UPDATE bug SET initialreport = $newfields[initialreport], dateline = $newfields[dateline], lastposttime = $newfields[lastposttime], lastpostby = $newfields[lastpostby] WHERE bugid = $bugid");
+ $db->query("
+ UPDATE " . TABLE_PREFIX . "bug
+ SET initialreport = $newfields[initialreport],
+ dateline = $newfields[dateline],
+ lastposttime = $newfields[lastposttime],
+ lastpostby = $newfields[lastpostby],
+ hiddenlastposttime = $newfields[hiddenlastposttime],
+ hiddenlastpostby = $newfields[hiddenlastpostby]
+ WHERE bugid = $bugid"
+ );
echo "<p>Updated $bugid</p>";
}
$log->log();
$log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in['hidden'])));
+ $lastgood = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC");
+ print_r($lastgood);
+ $db->query("
+ UPDATE " . TABLE_PREFIX . "bug
+ SET hiddenlastposttime = $lastgood[dateline],
+ hiddenlastpostby = $lastgood[userid]
+ WHERE bugid = $bug[bugid]"
+ );
+
$message->redirect('comment saved', "showreport.php?bugid=$bug[bugid]");
}
// #*# pagination needs to be done here
$bugs_fetch = $db->query("
- SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost
+ SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost, user3.displayname AS hiddenlastpost
FROM " . TABLE_PREFIX . "bug AS bug
LEFT JOIN user AS user1
ON (bug.userid = user1.userid)
LEFT JOIN user AS user2
- ON (bug.lastpostby = user2.userid)" . ((!can_perform('canviewhidden')) ? "
+ ON (bug.lastpostby = user2.userid)
+ LEFT JOIN user AS user3
+ ON (bug.hiddenlastpostby = user3.userid)" . ((!can_perform('canviewhidden')) ? "
WHERE !hidden" : "") . "
- ORDER BY bug.lastposttime DESC"
+ ORDER BY bug." . ((can_perform('canviewhidden')) ? "lastposttime" : "hiddenlastposttime") . " DESC"
);
while ($bug = $db->fetch_array($bugs_fetch))
$bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version'];
$bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status'];
$bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'];
+
+ $bug['hiddendisplay'] = ((!can_perform('canviewhidden') AND $bug['hiddenlastposttime']) ? true : false);
+
+ $bug['lastposttime'] = (($bug['hiddendisplay']) ? $bug['hiddenlastposttime'] : $bug['lastposttime']);
+ $bug['lastpost'] = (($bug['hiddendisplay']) ? $bug['hiddenlastpost'] : $bug['lastpost']);
+
$bug['lastpostinfo'] = datelike('standard', $bug['lastposttime']) . ' by ' . $bug['lastpost'];
+
eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";');
}
$commentid = $db->insert_id();
- $db->query("UPDATE " . TABLE_PREFIX . "bug SET lastposttime = $time, lastpostby = " . $bugsys->userinfo['userid'] . " WHERE bugid = " . intval($bugsys->in['bugid']));
+ $db->query("
+ UPDATE " . TABLE_PREFIX . "bug
+ SET lastposttime = $time,
+ lastpostby = " . $bugsys->userinfo['userid'] . ",
+ hiddenlastposttime = $time,
+ hiddenlastpostby = " . $bugsys->userinfo['userid'] . "
+ WHERE bugid = " . intval($bugsys->in['bugid'])
+ );
// setup logging
require_once('./includes/class_history.php');
$initialreport = $db->insert_id();
- $db->query("UPDATE " . TABLE_PREFIX . "bug SET dateline = $time, initialreport = $initialreport, lastposttime = $time, lastpostby = " . $bugsys->userinfo['userid'] . " WHERE bugid = $bugid");
+ $db->query("
+ UPDATE " . TABLE_PREFIX . "bug
+ SET dateline = $time,
+ initialreport = $initialreport,
+ lastposttime = $time,
+ lastpostby = " . $bugsys->userinfo['userid'] . ",
+ hiddenlastposttime = $time,
+ hiddenlastpostby = " . $bugsys->userinfo['userid'] . "
+ WHERE bugid = $bugid"
+ );
$message->redirect('bug is done!', "showreport.php?bugid=$bugid");
}