links to show alternate invoices also
[freeside.git] / bin / sqlradius.reimport
index 89eb801..2218a3f 100755 (executable)
@@ -107,7 +107,8 @@ while ( defined ( $row = $sth->fetchrow_arrayref ) ) {
     }
   }
 
-  my( $password, $finger, $group ) = ( '', '', '' );
+  #my( $password, $finger, $group ) = ( '', '', '' );
+  my( $password, $group ) = ( '', '', '' );
 
   my $rc_sth = $dbh->prepare(
     'SELECT Attribute, Value, Name, GroupName'.
@@ -118,9 +119,9 @@ while ( defined ( $row = $sth->fetchrow_arrayref ) ) {
 
   foreach my $rc_row ( @{$rc_sth->fetchall_arrayref} ) {
     my($attribute, $value, $name, $groupname) = @$rc_row;
-    if ( $attribute =~ /^(Crypt-)?Password$/ ) {
+    if ( $attribute =~ /^((Crypt|User)-)?Password$/ ) {
       $password = $value;
-      $finger = $name;
+      #$finger = $name;
       $group = $groupname;
     } else {
       #handle other params!
@@ -131,7 +132,8 @@ while ( defined ( $row = $sth->fetchrow_arrayref ) ) {
                  qsearch('svc_acct', { 'username' => $username,
                                        'domsvc'   => $svc_domain->svcnum, } );
 
-  print "$r_username / $realm: $password / $finger: ";
+  #print "$r_username / $realm: $password / $finger: ";
+  print "$r_username / $realm: $password: ";
   if ( scalar(@svc_acct) == 0 ) {
     print "not found\n";
     next;
@@ -139,11 +141,13 @@ while ( defined ( $row = $sth->fetchrow_arrayref ) ) {
     print "multiple matches found?!?!\n";
     next;
   } else {
-    print "correcting password and name\n";
+    #print "correcting password and name\n";
+    print "correcting password\n";
   }
 
   my $svc_acct = $svc_acct[0];
-  my $new = new FS::svc_acct { $svc_acct->hash, '_password' => $password, 'finger' => $finger };
+  #my $new = new FS::svc_acct { $svc_acct->hash, '_password' => $password, 'finger' => $finger };
+  my $new = new FS::svc_acct { $svc_acct->hash, '_password' => $password };
   my $error = $new->replace($svc_acct);
   #my $error = $new->check;
   die "$r_username / $realm: $error" if $error;
@@ -151,6 +155,6 @@ while ( defined ( $row = $sth->fetchrow_arrayref ) ) {
 }
 
 sub usage {
-  die "Usage:\n\n  sqlradius.import user\n";
+  die "Usage:\n\n  sqlradius.reimport user\n";
 }