eliminate harmless uninitialized value noise
[freeside.git] / FS / FS / cust_main.pm
index de83625..a4f88b4 100644 (file)
@@ -2475,33 +2475,33 @@ sub bill_and_collect {
   $error = $self->cancel_expired_pkgs( $options{actual_time} );
   if ( $error ) {
     $error = "Error expiring custnum ". $self->custnum. ": $error";
-    if    ( $options{'fatal'} eq 'return' ) { return $error; }
-    elsif ( $options{'fatal'}             ) { die    $error; }
-    else                                    { warn   $error; }
+    if    ( $options{fatal} && $options{fatal} eq 'return' ) { return $error; }
+    elsif ( $options{fatal}                                ) { die    $error; }
+    else                                                     { warn   $error; }
   }
 
   $error = $self->suspend_adjourned_pkgs( $options{actual_time} );
   if ( $error ) {
     $error = "Error adjourning custnum ". $self->custnum. ": $error";
-    if    ( $options{'fatal'} eq 'return' ) { return $error; }
-    elsif ( $options{'fatal'}             ) { die    $error; }
-    else                                    { warn   $error; }
+    if    ( $options{fatal} && $options{fatal} eq 'return' ) { return $error; }
+    elsif ( $options{fatal}                                ) { die    $error; }
+    else                                                     { warn   $error; }
   }
 
   $error = $self->bill( %options );
   if ( $error ) {
     $error = "Error billing custnum ". $self->custnum. ": $error";
-    if    ( $options{'fatal'} eq 'return' ) { return $error; }
-    elsif ( $options{'fatal'}             ) { die    $error; }
-    else                                    { warn   $error; }
+    if    ( $options{fatal} && $options{fatal} eq 'return' ) { return $error; }
+    elsif ( $options{fatal}                                ) { die    $error; }
+    else                                                     { warn   $error; }
   }
 
   $error = $self->apply_payments_and_credits;
   if ( $error ) {
     $error = "Error applying custnum ". $self->custnum. ": $error";
-    if    ( $options{'fatal'} eq 'return' ) { return $error; }
-    elsif ( $options{'fatal'}             ) { die    $error; }
-    else                                    { warn   $error; }
+    if    ( $options{fatal} && $options{fatal} eq 'return' ) { return $error; }
+    elsif ( $options{fatal}                                ) { die    $error; }
+    else                                                     { warn   $error; }
   }
 
   unless ( $conf->exists('cancelled_cust-noevents')
@@ -2510,9 +2510,9 @@ sub bill_and_collect {
     $error = $self->collect( %options );
     if ( $error ) {
       $error = "Error collecting custnum ". $self->custnum. ": $error";
-      if    ( $options{'fatal'} eq 'return' ) { return $error; }
-      elsif ( $options{'fatal'}             ) { die    $error; }
-      else                                    { warn   $error; }
+      if    ($options{fatal} && $options{fatal} eq 'return') { return $error; }
+      elsif ($options{fatal}                               ) { die    $error; }
+      else                                                   { warn   $error; }
     }
   }
 
@@ -4107,6 +4107,8 @@ sub realtime_bop {
     warn "  $_ => $options{$_}\n" foreach keys %options;
   }
 
+  return "Amount must be greater than 0" unless $amount > 0;
+
   unless ( $options{'description'} ) {
     if ( $conf->exists('business-onlinepayment-description') ) {
       my $dtempl = $conf->config('business-onlinepayment-description');
@@ -5043,10 +5045,12 @@ sub _new_bop_required {
   my $botpp = 'Business::OnlineThirdPartyPayment';
 
   return 1
-    if ( $conf->config('business-onlinepayment-namespace') eq $botpp ||
-         scalar( grep { $_->gateway_namespace eq $botpp } 
-                 qsearch( 'payment_gateway', { 'disabled' => '' } )
-               )
+    if (   (     $conf->exists('business-onlinepayment-namespace')
+             &&  $conf->config('business-onlinepayment-namespace') eq $botpp
+           )
+         or scalar( grep { $_->gateway_namespace eq $botpp } 
+                    qsearch( 'payment_gateway', { 'disabled' => '' } )
+                  )
        )
   ;
 
@@ -7986,9 +7990,11 @@ sub geocode {
                ? 'ship_'
                : '';
 
-  my ($zip,$plus4) = split /-/, $self->get("${prefix}zip")
+  my($zip,$plus4) = split /-/, $self->get("${prefix}zip")
     if $self->country eq 'US';
 
+  $zip ||= '';
+  $plus4 ||= '';
   #CCH specific location stuff
   my $extra_sql = "AND plus4lo <= '$plus4' AND plus4hi >= '$plus4'";
 
@@ -8401,8 +8407,8 @@ sub _money_table_where {
 
 (Class method)
 
-Returns a qsearch hash expression to search for parameters specified in HREF.
-Valid parameters are
+Returns a qsearch hash expression to search for parameters specified in
+HASHREF.  Valid parameters are
 
 =over 4