RT# 83401 Send country field to B::OP on tokenize
[freeside.git] / FS / FS / cust_main / Billing_Realtime.pm
index 4ff2c06..89d63dd 100644 (file)
@@ -323,13 +323,16 @@ sub _bop_cust_payby_options {
 
     if ( $cust_payby->locationnum ) {
       my $cust_location = $cust_payby->cust_location;
-      $options->{$_} = $cust_location->$_() for qw( address1 address2 city state zip );
+      $options->{$_} = $cust_location->$_()
+        for qw( address1 address2 city state zip country );
     }
   }
 }
 
 # can be called as class method,
 # but can't load default name/phone fields as class method
+# (why was this added?  ah, it might get called from realtime_tokenize in this
+#  fashion "to tokenize old records on upgrade")
 sub _bop_content {
   my ($self, $options) = @_;
   my %content = ();
@@ -361,7 +364,7 @@ sub _bop_content {
 
   $content{name} = $payname if $payname;
 
-  if ( exists($options->{'address1'}) ) {
+  if ( exists($options->{'address1'}) && length($options->{'address1'}) ) {
 
     $content{address} = $options->{'address1'};
     my $address2 = $options->{'address2'};