no more &swapuid
[freeside.git] / FS / bin / freeside-bill
index 8f2c32f..3462fa1 100755 (executable)
@@ -4,7 +4,7 @@ use strict;
 use Fcntl qw(:flock);
 use Date::Parse;
 use Getopt::Std;
-use FS::UID qw(adminsuidsetup swapuid);
+use FS::UID qw(adminsuidsetup);
 use FS::Record qw(qsearch qsearchs);
 use FS::cust_main;
 
@@ -28,6 +28,9 @@ my($time)= $main::opt_d ? str2time($main::opt_d) : $^T;
 my($cust_main,%saw);
 foreach $cust_main (
   map {
+    unless ( exists $saw{ $_->custnum } && defined $saw{ $_->custnum} ) {
+      $saw{ $_->custnum } = 0; # to avoid 'use of uninitialized value' errors
+    }
     if (
       ( $main::opt_a || ( ( $_->getfield('bill') || 0 ) <= $time ) )
       && $bill_only{ $_->custnum }
@@ -45,7 +48,6 @@ foreach $cust_main (
   # and bill them
 
   print "Billing customer #" . $cust_main->getfield('custnum') . "\n";
-  next;
 
   my($error);
 
@@ -70,13 +72,15 @@ foreach $cust_main (
 
 sub untaint_argv {
   foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
-    $ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
+    #$ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
+    # Date::Parse
+    $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
     $ARGV[$_]=$1;
   }
 }
 
 sub usage {
-  die "Usage:\n\n  bill [ -c [ i ] ] [ -d 'date' ] [ -b ] user\n";
+  die "Usage:\n\n  freeside-bill [ -c [ i ] ] [ -d 'date' ] [ -b ] user\n";
 }
 
 =head1 NAME
@@ -100,7 +104,7 @@ the bill and collect methods of a cust_main object.  See L<FS::cust_main>.
   -i: real-time billing (as opposed to batch billing).  only relevant
       for credit cards.
 
-  -d: Pretent it's 'date'.  Date is in any format Date::Parse is happy with,
+  -d: Pretend it's 'date'.  Date is in any format Date::Parse is happy with,
       but be careful.
 
 user: From the mapsecrets file - see config.html from the base documentation
@@ -110,7 +114,7 @@ customers.  Otherwise, bills all customers.
 
 =head1 VERSION
 
-$Id: freeside-bill,v 1.1 1999-08-11 20:41:27 ivan Exp $
+$Id: freeside-bill,v 1.7 2001-08-21 09:34:13 ivan Exp $
 
 =head1 BUGS