summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2000-02-02 20:22:18 +0000
committerivan <ivan>2000-02-02 20:22:18 +0000
commit3bfec7cf75a1a4eb4da1cdf8c64003bd6babcd81 (patch)
treed3bdf9eeedd4c713a3e0858f0dee3f16bbe2f36d
parentb812b5a4a664e0bd271392ae4a609b18e85ca6b6 (diff)
bugfix prepayment in signup server
-rw-r--r--FS/FS/cust_main.pm4
-rw-r--r--FS/FS/prepay_credit.pm9
-rwxr-xr-xbin/generate-prepay32
-rwxr-xr-xfs_signup/fs_signup_server2
-rw-r--r--htdocs/docs/signup.html2
5 files changed, 42 insertions, 7 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 59ec41b81..26883d554 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -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
diff --git a/FS/FS/prepay_credit.pm b/FS/FS/prepay_credit.pm
index 86274aa4c..113cee823 100644
--- a/FS/FS/prepay_credit.pm
+++ b/FS/FS/prepay_credit.pm
@@ -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
index 000000000..6fb615ab1
--- /dev/null
+++ b/bin/generate-prepay
@@ -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";
+}
+
diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server
index f6702386e..1d7ab291b 100755
--- a/fs_signup/fs_signup_server
+++ b/fs_signup/fs_signup_server
@@ -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 );
diff --git a/htdocs/docs/signup.html b/htdocs/docs/signup.html
index c78d1362c..fbd19df62 100644
--- a/htdocs/docs/signup.html
+++ b/htdocs/docs/signup.html
@@ -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>