add ignore_noapply flag to make sure payments are forced in anyway on import
authorivan <ivan>
Thu, 9 Jun 2005 00:18:35 +0000 (00:18 +0000)
committerivan <ivan>
Thu, 9 Jun 2005 00:18:35 +0000 (00:18 +0000)
FS/FS/cust_pay.pm

index 201ada9..ccf991d 100644 (file)
@@ -1,7 +1,7 @@
 package FS::cust_pay;
 
 use strict;
-use vars qw( @ISA $conf $unsuspendauto );
+use vars qw( @ISA $conf $unsuspendauto $ignore_noapply );
 use Date::Format;
 use Business::CreditCard;
 use Text::Template;
@@ -15,6 +15,8 @@ use FS::cust_pay_void;
 
 @ISA = qw( FS::Record );
 
+$ignore_noapply = 0;
+
 #ask FS::UID to run this stuff for us later
 FS::UID->install_callback( sub { 
   $conf = new FS::Conf;
@@ -134,8 +136,13 @@ sub insert {
     };
     $error = $cust_bill_pay->insert;
     if ( $error ) {
-      $dbh->rollback if $oldAutoCommit;
-      return "error inserting $cust_bill_pay: $error";
+      if ( $ignore_noapply ) {
+        warn "warning: error inserting $cust_bill_pay: $error ".
+             "(ignore_noapply flag set; inserting cust_pay record anyway)\n";
+      } else {
+        $dbh->rollback if $oldAutoCommit;
+        return "error inserting $cust_bill_pay: $error";
+      }
     }
   }