better debugging
authorivan <ivan>
Wed, 27 Feb 2002 21:57:24 +0000 (21:57 +0000)
committerivan <ivan>
Wed, 27 Feb 2002 21:57:24 +0000 (21:57 +0000)
FS/FS/cust_main.pm
FS/bin/freeside-daily

index b6d3075..7445e35 100644 (file)
@@ -1102,7 +1102,7 @@ sub collect {
   my $dbh = dbh;
 
   my $balance = $self->balance;
-  warn "collect: balance $balance" if $Debug;
+  warn "collect customer". $self->custnum. ": balance $balance" if $Debug;
   unless ( $balance > 0 ) { #redundant?????
     $dbh->rollback if $oldAutoCommit; #hmm
     return '';
@@ -1140,10 +1140,16 @@ sub collect {
           qsearch('part_bill_event', { 'payby'    => $self->payby,
                                        'disabled' => '',           } )
     ) {
-      #run callback
+      warn "calling invoice event (". $part_bill_event->eventcode. ")\n"
+        if $Debug;
       my $cust_main = $self; #for callback
       my $error = eval $part_bill_event->eventcode;
 
+      if ( $@ ) {
+        warn "fatal error running invoice event (". part_bill_event->eventcode.
+             "): $@";
+      }
+
       if ( $error ) {
 
         warn "Error running invoice event (". $part_bill_event->eventcode.
index 8d839cb..e6f02df 100755 (executable)
@@ -9,12 +9,14 @@ use FS::Record qw(qsearch qsearchs);
 use FS::cust_main;
 
 &untaint_argv; #what it sounds like  (eww)
-use vars qw($opt_d);
-getopts("d:");
+use vars qw($opt_d $opt_v);
+getopts("d:v");
 my $user = shift or die &usage;
 
 adminsuidsetup $user;
 
+$FS::cust_main::Debug = 1 if $opt_v;
+
 my @cust_main = @ARGV
   ? map { qsearchs('cust_main', { custnum => $_ } ) } @ARGV
   : qsearch('cust_main', {} )