Fix pending report check
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 17 Apr 2014 14:13:57 +0000 (16:13 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 17 Apr 2014 14:14:31 +0000 (16:14 +0200)
see 71b3fabad7123da741f3ce4152017dc2232b539a

wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php

index e213adb0d07074da2343a51c0bad945fee4ef977..2779e507b9103972d2e5cdd6d16f053d9af58dbf 100644 (file)
@@ -58,18 +58,19 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager {
        public function hasPendingReport($objectType, $objectID) {
                $objectTypeID = $this->getObjectTypeID($objectType);
                
-               $sql = "SELECT  status
+               $sql = "SELECT  COUNT(*)
                        FROM    wcf".WCF_N."_moderation_queue
                        WHERE   objectTypeID = ?
-                               AND objectID = ?";
+                               AND objectID = ?
+                               AND status <> ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array(
                        $objectTypeID,
-                       $objectID
+                       $objectID,
+                       ModerationQueue::STATUS_DONE
                ));
-               $status = $statement->fetchColumn();
                
-               return $status !== false && $status != ModerationQueue::STATUS_DONE;
+               return $statement->fetchColumn() > 0;
        }
        
        /**