no need to be y1.9k complient
[freeside.git] / FS / FS / cust_main.pm
index c3a3e3f..23cae96 100644 (file)
@@ -17,7 +17,7 @@ use Mail::Internet;
 use Mail::Header;
 use Business::CreditCard;
 use FS::UID qw( getotaker dbh );
-use FS::Record qw( qsearchs qsearch );
+use FS::Record qw( qsearchs qsearch dbdef );
 use FS::cust_pkg;
 use FS::cust_bill;
 use FS::cust_bill_pkg;
@@ -500,6 +500,7 @@ sub check {
     || $self->ut_text('city')
     || $self->ut_textn('county')
     || $self->ut_textn('state')
+    || $self->ut_country('country')
     || $self->ut_anything('comments')
   ;
   #barf.  need message catalogs.  i18n.  etc.
@@ -523,8 +524,6 @@ sub check {
     $self->ss("$1-$2-$3");
   }
 
-  $self->country =~ /^(\w\w)$/ or return "Illegal country: ". $self->country;
-  $self->country($1);
   unless ( qsearchs('cust_main_county', {
     'country' => $self->country,
     'state'   => '',
@@ -565,13 +564,11 @@ sub check {
         || $self->ut_text('ship_city')
         || $self->ut_textn('ship_county')
         || $self->ut_textn('ship_state')
+        || $self->ut_country('ship_country')
       ;
       return $error if $error;
 
       #false laziness with above
-      $self->ship_country =~ /^(\w\w)$/
-        or return "Illegal ship_country: ". $self->ship_country;
-      $self->ship_country($1);
       unless ( qsearchs('cust_main_county', {
         'country' => $self->ship_country,
         'state'   => '',
@@ -648,8 +645,6 @@ sub check {
       or return "Illegal expiration date: ". $self->paydate;
     if ( length($2) == 4 ) {
       $self->paydate("$2-$1-01");
-    } elsif ( $2 > 97 ) { #should pry change to check for "this year"
-      $self->paydate("19$2-$1-01");
     } else {
       $self->paydate("20$2-$1-01");
     }
@@ -1349,9 +1344,28 @@ sub check_invoicing_list {
 
 =back
 
+=head1 SUBROUTINES
+
+=over 4
+
+=item rebuild_fuzzyfile
+
+=cut
+
+sub rebuild_fuzzyfiles {
+  my @all_last = map $_->getfield('last'), qsearch('cust_main', {});
+  push @all_last,
+                 grep $_, map $_->getfield('ship_last'), qsearch('cust_main',{})
+      if defined dbdef->table('cust_main')->column('ship_last');
+#  open(
+
+}
+
+=back
+
 =head1 VERSION
 
-$Id: cust_main.pm,v 1.18 2001-08-17 10:55:04 ivan Exp $
+$Id: cust_main.pm,v 1.20 2001-08-23 06:17:03 ivan Exp $
 
 =head1 BUGS