X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling_Realtime.pm;h=1ac12ce6b324976a43c148f333563a522d063518;hp=b29408b0e174b04a7313bf4c407dbbc650b84e78;hb=1ac968c34d6656307d23080a2b55de1a8caa6bf4;hpb=94b60bb13c044e436800239be3e3c5a029bdff8e diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index b29408b0e..1ac12ce6b 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -330,6 +330,8 @@ sub _bop_cust_payby_options { # 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,14 +363,23 @@ sub _bop_content { $content{name} = $payname if $payname; - $content{address} = $options->{'address1'}; - my $address2 = $options->{'address2'}; - $content{address} .= ", ". $address2 if length($address2); + if ( exists($options->{'address1'}) && length($options->{'address1'}) ) { - $content{city} = $options->{'city'}; - $content{state} = $options->{'state'}; - $content{zip} = $options->{'zip'}; - $content{country} = $options->{'country'}; + $content{address} = $options->{'address1'}; + my $address2 = $options->{'address2'}; + $content{address} .= ", ". $address2 if length($address2); + + $content{$_} = $options->{$_} foreach qw( city state zip country ); + + } elsif ( ref($self) ) { + + $content{address} = $self->address1; + my $address2 = $self->address2; + $content{address} .= ", ". $address2 if length($address2); + + $content{$_} = $self->$_() foreach qw( city state zip country ); + + } # can't set phone if called as class method $content{phone} = $self->daytime || $self->night