Index: trunk/ippToPsps/perl/ippToPsps_run.pl
===================================================================
--- trunk/ippToPsps/perl/ippToPsps_run.pl	(revision 28849)
+++ trunk/ippToPsps/perl/ippToPsps_run.pl	(revision 28850)
@@ -103,4 +103,12 @@
 $fullDvoPath = $dvoPath . "/" . $dvoDb;
 
+# determine PSPS batch 'type'
+my $pspsBatchType;
+if ($batchType eq 'init') {$pspsBatchType = "IN";}
+elsif ($batchType eq 'det') {$pspsBatchType = "P2";}
+elsif ($batchType eq 'stack') {$pspsBatchType = "ST";}
+elsif ($batchType eq 'diff') {$pspsBatchType = "OB";}
+else {$pspsBatchType = "UNKNOWN";}
+
 my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps);
 my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps);
@@ -181,5 +189,5 @@
         if (!$surveyType) {next;}
 
-        $batchId = $ippToPspsDb->getNewBatchId($expId, $surveyType, $batchType);
+        $batchId = $ippToPspsDb->createNewBatch($expId, $distGroup, $pspsBatchType, $dvoDb, (defined $datastoreProduct) ? $datastoreProduct : "NONE");
 
         # TODO quit here if no sensible batch ID
@@ -208,5 +216,5 @@
             }
 
-            $ippToPspsDb->updateDb($batchId, $expId, 1, $published, $totalDetections);
+            $ippToPspsDb->updateBatch($batchId, $expId, 1, $published, $totalDetections, $minObjId, $maxObjId);
         }
 
@@ -361,12 +369,4 @@
     my $timeStamp = sprintf "%4d-%02d-%02d %02d:%02d:%02d", $year+1900,$mon+1,$mday,$hour,$min,$sec;
 
-    # determine batch 'type'
-    my $type;
-    if ($batchType eq 'init') {$type = "IN";}
-    elsif ($batchType eq 'det') {$type = "P2";}
-    elsif ($batchType eq 'stack') {$type = "ST";}
-    elsif ($batchType eq 'diff') {$type = "OB";}
-    else {$type = "UNKNOWN";}
-
     # create XML file
     my $writer = new XML::Writer(OUTPUT => $output, DATA_MODE => 1, DATA_INDENT=>2);
@@ -403,5 +403,5 @@
                 $writer->startTag('manifest',
                         "name" => "$batch",
-                        "type" => $type,
+                        "type" => $pspsBatchType,
                         "survey" => $pspsSurvey,
                         "timestamp" => "$timeStamp",
@@ -413,5 +413,5 @@
                 $writer->startTag('manifest',
                         "name" => "$batch",
-                        "type" => $type,
+                        "type" => $pspsBatchType,
                         "timestamp" => "$timeStamp");
             }
