From 3bfec7cf75a1a4eb4da1cdf8c64003bd6babcd81 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Feb 2000 20:22:18 +0000 Subject: [PATCH] bugfix prepayment in signup server --- FS/FS/cust_main.pm | 4 ++-- FS/FS/prepay_credit.pm | 9 ++++++--- bin/generate-prepay | 32 ++++++++++++++++++++++++++++++++ fs_signup/fs_signup_server | 2 +- htdocs/docs/signup.html | 2 +- 5 files changed, 42 insertions(+), 7 deletions(-) create mode 100755 bin/generate-prepay 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, 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:
  • $email_name - first and last name (an example file is included as fs_signup/ieak.template) -
  • If there are any entries in the prepay_credit table, a user can enter a string matching the identifier column to receive the credit specified in the amount column, after which that identifier is no longer valid. This can be used to implement pre-paid "calling card" type signups. +
  • If there are any entries in the prepay_credit table, a user can enter a string matching the identifier column to receive the credit specified in the amount column, after which that identifier is no longer valid. This can be used to implement pre-paid "calling card" type signups. The bin/generate-prepay script can be used to populate the prepay_credit table. -- 2.11.0