Index: branches/pap/ippTools/share/chiptool_pendingimfile.sql
===================================================================
--- branches/pap/ippTools/share/chiptool_pendingimfile.sql	(revision 27708)
+++ branches/pap/ippTools/share/chiptool_pendingimfile.sql	(revision 28003)
@@ -10,5 +10,7 @@
     rawExp.camera,
     rawExp.telescope,
-    rawExp.filelevel
+    rawExp.filelevel,
+    IFNULL(Label.priority, 10000) AS priority,
+    chipProcessedImfile.path_base
 FROM chipRun
 JOIN rawExp
@@ -25,4 +27,5 @@
 LEFT JOIN chipMask
     ON chipRun.label = chipMask.label
+LEFT JOIN Label ON chipRun.label = Label.label
 WHERE
     ((chipRun.state = 'new'
@@ -33,9 +36,5 @@
     OR
     (chipRun.state = 'update'
-    AND chipProcessedImfile.data_state = 'update'))
--- // Restriction to prevent the processing of bad chips. Not needed now.
---     AND
---     (rawImfile.class_id != 'XY15' AND
---     rawImfile.class_id != 'XY32' AND
---     rawImfile.class_id != 'XY45')
-
+    AND chipProcessedImfile.data_state = 'update'
+    AND chipProcessedImfile.fault = 0))
+    AND (Label.active OR Label.active IS NULL)
