Index: trunk/ippTools/share/disttool_pending_chip.sql
===================================================================
--- trunk/ippTools/share/disttool_pending_chip.sql	(revision 26567)
+++ trunk/ippTools/share/disttool_pending_chip.sql	(revision 30387)
@@ -15,5 +15,6 @@
     chipProcessedImfile.quality,
     distRun.no_magic,
-    chipProcessedImfile.magicked
+    chipProcessedImfile.magicked,
+    IFNULL(Label.priority, 10000) AS priority
 FROM distRun
 JOIN distTarget USING(target_id, stage, clean)
@@ -24,4 +25,6 @@
     ON distRun.dist_id = distComponent.dist_id 
     AND chipProcessedImfile.class_id = distComponent.component
+LEFT JOIN Label
+    ON distRun.label = Label.label
 WHERE
     distRun.state = 'new'
@@ -30,2 +33,3 @@
     AND ((chipRun.magicked > 0) OR distRun.no_magic)
     AND (chipRun.state = 'full' OR (distRun.clean AND chipRun.state = 'cleaned'))
+    AND (Label.active OR Label.active IS NULL)
