bugfix prepayment in signup server
authorivan <ivan>
Wed, 2 Feb 2000 20:22:18 +0000 (20:22 +0000)
committerivan <ivan>
Wed, 2 Feb 2000 20:22:18 +0000 (20:22 +0000)
FS/FS/cust_main.pm
FS/FS/prepay_credit.pm
bin/generate-prepay [new file with mode: 0755]
fs_signup/fs_signup_server
htdocs/docs/signup.html

index 59ec41b..26883d5 100644 (file)
@@ -399,7 +399,7 @@ sub check {
 
   }
 
-  if ( $self->paydate eq '' ) {
+  if ( $self->paydate eq '' || $self->paydate eq '-' ) {
     return "Expriation date required"
       unless $self->payby eq 'BILL' || $self->payby eq 'PREPAY';
     $self->paydate('');
@@ -993,7 +993,7 @@ sub check_invoicing_list {
 
 =head1 VERSION
 
-$Id: cust_main.pm,v 1.3 2000-01-31 05:22:23 ivan Exp $
+$Id: cust_main.pm,v 1.4 2000-02-02 20:22:18 ivan Exp $
 
 =head1 BUGS
 
index 86274aa..113cee8 100644 (file)
@@ -96,7 +96,7 @@ sub check {
   $identifier =~ s/\W//g; #anything else would just confuse things
   $self->identifier($identifier);
 
-  $self->ut_number('prepaynum')
+  $self->ut_numbern('prepaynum')
   || $self->ut_alpha('identifier')
   || $self->ut_money('amount')
   ;
@@ -107,7 +107,7 @@ sub check {
 
 =head1 VERSION
 
-$Id: prepay_credit.pm,v 1.1 2000-01-31 05:22:23 ivan Exp $
+$Id: prepay_credit.pm,v 1.2 2000-02-02 20:22:18 ivan Exp $
 
 =head1 BUGS
 
@@ -118,7 +118,10 @@ L<FS::Record>, schema.html from the base documentation.
 =head1 HISTORY
 
 $Log: prepay_credit.pm,v $
-Revision 1.1  2000-01-31 05:22:23  ivan
+Revision 1.2  2000-02-02 20:22:18  ivan
+bugfix prepayment in signup server
+
+Revision 1.1  2000/01/31 05:22:23  ivan
 prepaid "internet cards"
 
 
diff --git a/bin/generate-prepay b/bin/generate-prepay
new file mode 100755 (executable)
index 0000000..6fb615a
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+
+use strict;
+use FS::UID qw(adminsuidsetup);
+use FS::prepay_credit;
+
+require 5.004; #srand(time|$$);
+
+my $user = shift or die &usage;
+&adminsuidsetup( $user );
+
+my $amount = shift or die &usage;
+
+my $num_digits = shift or die &usage;
+
+my $num_entries = shift or die &usage;
+
+for ( 1 .. $num_entries ) {
+  my $identifier = join( '', map int(rand(10)), ( 1 .. $num_digits ) );
+  my $prepay_credit = new FS::prepay_credit {
+    'identifier' => $identifier,
+    'amount'     => $amount,
+  };
+  my $error = $prepay_credit->insert;
+  die $error if $error;
+  print "$identifier\n";
+}
+
+sub usage {
+  die "Usage:\n\n  generate-prepay user amount num_digits num_entries";
+}
+
index f670238..1d7ab29 100755 (executable)
@@ -15,7 +15,7 @@ use vars qw( $opt $Debug );
 
 $Debug = 0;
 
-my @payby = qw(CARD);
+my @payby = qw(CARD PREPAY);
 
 my $user = shift or die &usage;
 &adminsuidsetup( $user ); 
index c78d136..fbd19df 100644 (file)
@@ -42,6 +42,6 @@ Optional:
     <li>$email_name - first and last name
   </ul>
   (an example file is included as <b>fs_signup/ieak.template</b>)
-  <li>If there are any entries in the <i>prepay_credit</i> table, a user can enter a string matching the <b>identifier</i> column to receive the credit specified in the <b>amount</b> column, after which that <b>identifier</b> is no longer valid.  This can be used to implement pre-paid "calling card" type signups.
+  <li>If there are any entries in the <i>prepay_credit</i> table, a user can enter a string matching the <b>identifier</i> column to receive the credit specified in the <b>amount</b> column, after which that <b>identifier</b> is no longer valid.  This can be used to implement pre-paid "calling card" type signups.  The <i>bin/generate-prepay</i> script can be used to populate the <i>prepay_credit</i> table.
 </ul>
 </body>