Index: trunk/ippMonitor/def/autocode.php
===================================================================
--- trunk/ippMonitor/def/autocode.php	(revision 34012)
+++ trunk/ippMonitor/def/autocode.php	(revision 34014)
@@ -29,4 +29,10 @@
 
 // Note: the restriction is now moved AFTER the count query
+// unless the RESTRICT_COUNT keyword is used
+if ($restricted == 0) {
+  if ("$RESTRICT_COUNT" != "none") {
+    $WHERE = "$WHERE $RESTRICT_COUNT";
+  }
+}
 
 // Add GROUP BY statements if any
@@ -55,5 +61,5 @@
 // Restrict the query if it is necessary
 if ($restricted == 0) {
-  if ("$UNRESTRICTED" != "none") {
+  if ( ("$UNRESTRICTED" != "none") && ("$RESTRICT_COUNT" == "none") ) {
     $WHERE = "$WHERE $UNRESTRICTED";
   }
