Added debug-only option to edi_pusher.pl
authorBill Erickson <berick@esilibrary.com>
Fri, 27 Jul 2012 15:11:25 +0000 (11:11 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 1 Aug 2012 19:15:24 +0000 (15:15 -0400)
Option causes the final EDI to be printed to STDOUT, but does not
populate any data in the DB nor does it FTP the file to the vendor.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/support-scripts/edi_pusher.pl

index 80e4e19..e94abb8 100755 (executable)
@@ -33,7 +33,10 @@ INIT {
 my %defaults = (
     'quiet' => 0,
     'test'  => 0,   # TODO
-    'max-batch-size=i' => -1
+    'max-batch-size=i' => -1,
+
+    # if true, print final EDI to STDOUT, send nothign to the vendor, write nothing to the DB
+    'debug-only' => 0
 );
 
 my $cs = OpenILS::Utils::Cronscript->new(\%defaults);
@@ -173,6 +176,12 @@ foreach my $def (@$defs) {
             # than to add a cascade of failing inscrutable copies of the same message(s) to our DB.  
         }
 
+        if ($opts->{'debug-only'}) {
+            print OpenILS::Application::Acq::EDI->attempt_translation($message, 1)->edi . "\n";
+            print "\ndebug-only => skipping FTP\n";
+            next;
+        }
+
         print "Writing new message + translation to DB for $logstr2\n";
 
         $e->xact_begin;