X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=47ee23fb21b8aec67a8f9b6f303bfd4c9941b9a4;hb=e670183bbb184527df5da958acb7a4b5d41ee6ec;hp=5d6826f485e6b14c003ccb15ce0e4391e149469d;hpb=1c2b820bd8d41fb9620e81faf617adffe85dbd33;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 5d6826f48..47ee23fb2 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -3963,7 +3963,8 @@ I, I and I are also available. Any of these options, if set, will override the value from the customer record. I is a free-text field passed to the gateway. It defaults to -"Internet services". +the value defined by the business-onlinepayment-description configuration +option, or "Internet services" if that is unset. If an I is specified, this payment (if successful) is applied to the specified invoice. If you don't specify an I you might want to @@ -4003,7 +4004,17 @@ sub realtime_bop { warn " $_ => $options{$_}\n" foreach keys %options; } - $options{'description'} ||= 'Internet services'; + unless ( $options{'description'} ) { + if ( $conf->exists('business-onlinepayment-description') ) { + my $dtempl = $conf->config('business-onlinepayment-description'); + + my $agent = $self->agent->agent; + #$pkgs... not here + $options{'description'} = eval qq("$dtempl"); + } else { + $options{'description'} = 'Internet services'; + } + } return $self->fake_bop($method, $amount, %options) if $options{'fake'}; @@ -4763,6 +4774,9 @@ sub realtime_refund_bop { ) { warn " attempting void\n" if $DEBUG > 1; my $void = new Business::OnlinePayment( $processor, @bop_options ); + $content{'card_number'} = $cust_pay->payinfo + if $cust_pay->payby eq 'CARD' + && $void->can('info') && $void->info('CC_void_requires_card'); $void->content( 'action' => 'void', %content ); $void->submit(); if ( $void->is_success ) { @@ -4959,7 +4973,8 @@ I, I and I are also available. Any of these options, if set, will override the value from the customer record. I is a free-text field passed to the gateway. It defaults to -"Internet services". +the value defined by the business-onlinepayment-description configuration +option, or "Internet services" if that is unset. If an I is specified, this payment (if successful) is applied to the specified invoice. If you don't specify an I you might want to @@ -5013,7 +5028,8 @@ I, I and I are also available. Any of these options, if set, will override the value from the customer record. I is a free-text field passed to the gateway. It defaults to -"Internet services". +the value defined by the business-onlinepayment-description configuration +option, or "Internet services" if that is unset. If an I is specified, this payment (if successful) is applied to the specified invoice. If you don't specify an I you might want to @@ -5064,7 +5080,18 @@ sub _bop_options { sub _bop_defaults { my ($self, $options) = @_; - $options->{description} ||= 'Internet services'; + unless ( $options->{'description'} ) { + if ( $conf->exists('business-onlinepayment-description') ) { + my $dtempl = $conf->config('business-onlinepayment-description'); + + my $agent = $self->agent->agent; + #$pkgs... not here + $options->{'description'} = eval qq("$dtempl"); + } else { + $options->{'description'} = 'Internet services'; + } + } + $options->{payinfo} = $self->payinfo unless exists( $options->{payinfo} ); $options->{invnum} ||= ''; $options->{payname} = $self->payname unless exists( $options->{payname} ); @@ -6088,6 +6115,9 @@ sub _new_realtime_refund_bop { ) { warn " attempting void\n" if $DEBUG > 1; my $void = new Business::OnlinePayment( $processor, @bop_options ); + $content{'card_number'} = $cust_pay->payinfo + if $cust_pay->payby eq 'CARD' + && $void->can('info') && $void->info('CC_void_requires_card'); $void->content( 'action' => 'void', %content ); $void->submit(); if ( $void->is_success ) { @@ -8381,6 +8411,22 @@ sub search_sql { ; } + ### + # invoice terms + ### + + if ( $params->{'invoice_terms'} =~ /^([\w ]+)$/ ) { + my $terms = $1; + if ( $1 eq 'NULL' ) { + push @where, + "( cust_main.invoice_terms IS NULL OR cust_main.invoice_terms = '' )"; + } else { + push @where, + "cust_main.invoice_terms IS NOT NULL", + "cust_main.invoice_terms = '$1'"; + } + } + ## # amounts ## @@ -8388,8 +8434,10 @@ sub search_sql { #my $balance_sql = $class->balance_sql(); my $balance_sql = FS::cust_main->balance_sql(); + my @current_balance = @{ $params->{'current_balance'} }; + push @where, map { s/current_balance/$balance_sql/; $_ } - @{ $params->{'current_balance'} }; + @current_balance; ## # custbatch @@ -8768,17 +8816,21 @@ sub smart_search { # "Company (Last, First)" #this is probably something a browser remembered, - #so just do an exact (but case-insensitive) search + #so just do an exact search (but case-insensitive, so USPS standardization + #doesn't throw a wrench in the works) foreach my $prefix ( '', 'ship_' ) { push @cust_main, qsearch( { 'table' => 'cust_main', - 'hashref' => { $prefix.'first' => $first, - $prefix.'last' => $last, - $prefix.'company' => $company, - %options, - }, - 'extra_sql' => " AND $agentnums_sql", + 'hashref' => { %options }, + 'extra_sql' => + ( keys(%options) ? ' AND ' : ' WHERE ' ). + join(' AND ', + " LOWER(${prefix}first) = ". dbh->quote(lc($first)), + " LOWER(${prefix}last) = ". dbh->quote(lc($last)), + " LOWER(${prefix}company) = ". dbh->quote(lc($company)), + $agentnums_sql, + ), } ); }