mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUG FIX: SQL queries fixed for MSSQL
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@72983 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
71c64c1968
commit
2961a00b46
@ -55,7 +55,7 @@ class CommentAdmin extends LeftAndMain {
|
||||
$section = $this->Section();
|
||||
|
||||
if($section == 'approved') {
|
||||
$filter = 'NOT "IsSpam" AND NOT "NeedsModeration"';
|
||||
$filter = "\"IsSpam\"=0 AND \"NeedsModeration\"=0";
|
||||
$title = "<h2>". _t('CommentAdmin.APPROVEDCOMMENTS', 'Approved Comments')."</h2>";
|
||||
} else if($section == 'unmoderated') {
|
||||
$filter = '"NeedsModeration"';
|
||||
@ -272,21 +272,21 @@ JS;
|
||||
* Return the number of moderated comments
|
||||
*/
|
||||
function NumModerated() {
|
||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE NOT \"IsSpam\" AND NOT \"NeedsModeration\"")->value();
|
||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"=0 AND \"NeedsModeration\"=0")->value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of unmoderated comments
|
||||
*/
|
||||
function NumUnmoderated() {
|
||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE NOT \"IsSpam\" AND \"NeedsModeration\"")->value();
|
||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"=0 AND \"NeedsModeration\"=0")->value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of comments marked as spam
|
||||
*/
|
||||
function NumSpam() {
|
||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"")->value();
|
||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"=1")->value();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ class PageCommentInterface extends RequestHandler {
|
||||
$limit['start'] = isset($_GET['commentStart']) ? (int)$_GET['commentStart'] : 0;
|
||||
$limit['limit'] = PageComment::$comments_per_page;
|
||||
|
||||
$spamfilter = isset($_GET['showspam']) ? '' : 'AND NOT "IsSpam"';
|
||||
$unmoderatedfilter = Permission::check('ADMIN') ? '' : 'AND NOT "NeedsModeration"';
|
||||
$spamfilter = isset($_GET['showspam']) ? '' : "AND \"IsSpam\"=0";
|
||||
$unmoderatedfilter = Permission::check('ADMIN') ? '' : "AND \"NeedsModeration\"=0";
|
||||
$comments = DataObject::get("PageComment", "\"ParentID\" = '" . Convert::raw2sql($this->page->ID) . "' $spamfilter $unmoderatedfilter", '"Created" DESC', "", $limit);
|
||||
|
||||
if(is_null($comments)) {
|
||||
|
Loading…
Reference in New Issue
Block a user