Index: trunk/ippTasks/publish.pro
===================================================================
--- trunk/ippTasks/publish.pro	(revision 30375)
+++ trunk/ippTasks/publish.pro	(revision 30376)
@@ -79,4 +79,5 @@
     end
     add_poll_args run
+    add_poll_labels run
     command $run
   end
@@ -131,4 +132,5 @@
     book getword publishRun $pageName dbname -var DBNAME
     book getword publishRun $pageName output_format -var OUTPUT_FORMAT
+    book getword publishRun $pageName need_magic -var NEED_MAGIC
 
     stdout $LOGDIR/publish.run.log
@@ -139,4 +141,9 @@
 
     $run = publish_file.pl --pub_id $PUB_ID --camera $CAMERA --workdir $WORKDIR --product $PRODUCT --stage $STAGE --stage_id $STAGE_ID --output_format $OUTPUT_FORMAT --redirect-output
+
+    if ("$NEED_MAGIC" == "T") 
+        $run = $run --need-magic
+    end
+
     add_standard_args run
 
Index: trunk/ippTasks/survey.pro
===================================================================
--- trunk/ippTasks/survey.pro	(revision 30375)
+++ trunk/ippTasks/survey.pro	(revision 30376)
@@ -367,10 +367,12 @@
 # user functions to manipulate publish labels
 macro survey.add.publish
-  if ($0 != 3)
-    echo "USAGE: survey.add.publish (label) (client_id)"
+  if ($0 != 5)
+    echo "USAGE: survey.add.publish (tag) (label) (client_id) (comment)"
     break
   end
   book newpage SURVEY_PUBLISH $1
-  book setword SURVEY_PUBLISH $1 CLIENT_ID $2
+  book setword SURVEY_PUBLISH $1 LABEL $2
+  book setword SURVEY_PUBLISH $1 CLIENT_ID $3
+  book setword SURVEY_PUBLISH $1 COMMENT $4
   book setword SURVEY_PUBLISH $1 STATE PENDING
 end
@@ -1089,13 +1091,15 @@
     endif
 
-    book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW
-    if ("$label" == "NULL")
-      # All labels have been done --- reset
-      # echo "Resetting labels"
+    # survey.publish allows multiple entries per label.
+    # The key is called tag and must be unique
+    book getpage SURVEY_PUBLISH 0 -var tag -key STATE NEW
+    if ("$tag" == "NULL")
+      # All tags have been done --- reset
+      # echo "Resetting tags"
       for i 0 $N
-        book getpage SURVEY_PUBLISH $i -var label
-	book setword SURVEY_PUBLISH $label STATE NEW
+        book getpage SURVEY_PUBLISH $i -var tag
+	book setword SURVEY_PUBLISH $tag STATE NEW
       end
-      book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW
+      book getpage SURVEY_PUBLISH 0 -var tag -key STATE NEW
 
       # Select different database
@@ -1104,8 +1108,14 @@
     end
 
-    book setword SURVEY_PUBLISH $label STATE DONE
-    book getword SURVEY_PUBLISH $label CLIENT_ID -var client_id
+    book setword SURVEY_PUBLISH $tag STATE DONE
+    book getword SURVEY_PUBLISH $tag LABEL -var label
+    book getword SURVEY_PUBLISH $tag CLIENT_ID -var client_id
+    book getword SURVEY_PUBLISH $tag COMMENT -var comment
   
     $run = pubtool -definerun -label $label -client_id $client_id
+
+    if ("$comment" != "NULL") 
+        $run = $run -comment $comment
+    end
 
     if ($DB:n == 0)
@@ -1116,6 +1126,8 @@
     end
     
-    #echo $run
+    echo $run
+
     command $run
+    
   end
 
