import customer from Excel file too
[freeside.git] / FS / FS / Record.pm
index 4039fac..2540dd3 100644 (file)
@@ -808,7 +808,8 @@ sub insert {
   my $table = $self->table;
   
   # Encrypt before the database
-  if ( defined(eval '@FS::'. $table . '::encrypted_fields')
+  if (    defined(eval '@FS::'. $table . '::encrypted_fields')
+       && scalar( eval '@FS::'. $table . '::encrypted_fields')
        && $conf->exists('encryption')
   ) {
     foreach my $field (eval '@FS::'. $table . '::encrypted_fields') {
@@ -1305,7 +1306,7 @@ sub _h_statement {
 
   # If we're encrypting then don't ever store the payinfo or CVV2 in the history....
   # You can see if it changed by the paymask...
-  if ($conf->exists('encryption') ) {
+  if ($conf && $conf->exists('encryption') ) {
     @fields = grep  $_ ne 'payinfo' && $_ ne 'cvv2', @fields;
   }
   my @values = map { _quote( $self->getfield($_), $self->table, $_) } @fields;
@@ -1613,6 +1614,8 @@ sub ut_phonen {
     $self->setfield($field,'');
   } elsif ( $country eq 'US' || $country eq 'CA' ) {
     $phonen =~ s/\D//g;
+    $phonen = $conf->config('cust_main-default_areacode').$phonen
+      if length($phonen)==7 && $conf->config('cust_main-default_areacode');
     $phonen =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/
       or return gettext('illegal_phone'). " $field: ". $self->getfield($field);
     $phonen = "$1-$2-$3";