doc: spelling
[freeside.git] / FS / FS / cust_main.pm
index 08c7a51..2c01e18 100644 (file)
@@ -2528,7 +2528,7 @@ plans support this feature (they tend to charge 0).
 
 =item invoice_terms
 
-Options terms to be printed on this invocice.  Otherwise, customer-specific
+Options terms to be printed on this invoice.  Otherwise, customer-specific
 terms or the default terms are used.
 
 =back
@@ -4774,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 ) {
@@ -6112,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 ) {
@@ -8428,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
@@ -8808,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,
+          ),
       } );
     }