X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=168c43dc83ab6fa9c950e4d6a2d006643d314a20;hb=6a24254d490f3d023728044daba0765f20f6971e;hp=ceefeaf69bb8a316028b45d392414075db25d29d;hpb=6626dc2a13c809092aa539c5a72bc72a0c56afdc;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index ceefeaf69..168c43dc8 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -8,6 +8,7 @@ use vars qw( $realtime_bop_decline_quiet ); #ugh use Safe; use Carp; use Exporter; +use Scalar::Util qw( blessed ); use Time::Local qw(timelocal_nocheck); use Data::Dumper; use Tie::IxHash; @@ -1052,7 +1053,7 @@ sub delete { } -=item replace OLD_RECORD [ INVOICING_LIST_ARYREF ] +=item replace [ OLD_RECORD ] [ INVOICING_LIST_ARYREF ] Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. @@ -1068,23 +1069,16 @@ check_invoicing_list first. Here's an example: sub replace { my $self = shift; - my $old = shift; + + my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') ) + ? shift + : $self->replace_old; + my @param = @_; + warn "$me replace called\n" if $DEBUG; - local $SIG{HUP} = 'IGNORE'; - local $SIG{INT} = 'IGNORE'; - local $SIG{QUIT} = 'IGNORE'; - local $SIG{TERM} = 'IGNORE'; - local $SIG{TSTP} = 'IGNORE'; - local $SIG{PIPE} = 'IGNORE'; - - # We absolutely have to have an old vs. new record to make this work. - if (!defined($old)) { - $old = qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); - } - my $curuser = $FS::CurrentUser::CurrentUser; if ( $self->payby eq 'COMP' && $self->payby ne $old->payby @@ -1099,6 +1093,13 @@ sub replace { && $self->payby =~ /^(CARD|DCRD)$/ && ( $old->payinfo eq $self->payinfo || $old->paymask eq $self->paymask ); + local $SIG{HUP} = 'IGNORE'; + local $SIG{INT} = 'IGNORE'; + local $SIG{QUIT} = 'IGNORE'; + local $SIG{TERM} = 'IGNORE'; + local $SIG{TSTP} = 'IGNORE'; + local $SIG{PIPE} = 'IGNORE'; + my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; @@ -4827,15 +4828,15 @@ sub country_full { code2country($self->country); } -=item geocode DATA_PROVIDER +=item geocode DATA_VENDOR -Returns a value for the customer location as encoded by DATA_PROVIDER. -Currently this only makes sense for "CCH" as DATA_PROVIDER. +Returns a value for the customer location as encoded by DATA_VENDOR. +Currently this only makes sense for "CCH" as DATA_VENDOR. =cut sub geocode { - my ($self, $data_provider) = (shift, shift); #always cch for now + my ($self, $data_vendor) = (shift, shift); #always cch for now my $prefix = ( $conf->exists('tax-ship_address') && length($self->ship_last) ) ? 'ship_' @@ -4851,7 +4852,7 @@ sub geocode { my $cust_tax_location = qsearchs( { 'table' => 'cust_tax_location', - 'hashref' => { 'zip' => $zip, 'data_provider' => $data_provider }, + 'hashref' => { 'zip' => $zip, 'data_vendor' => $data_vendor }, 'extra_sql' => $extra_sql, } );