summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2002-04-10 13:42:49 +0000
committerivan <ivan>2002-04-10 13:42:49 +0000
commit0b65ce59c7d2ee712389c27954382274ddf718a5 (patch)
treeed8d8fb079faf656fe93e5f68d98e095500c03ef /FS
parentfd597aef277c522889a849d78dc7dcae67d00d95 (diff)
bulk checkin from working on the road:
- use msgcat for more error messages - should be all things that would come3 back from the signup server normally now - signup server: don't display access number <SELECT> if there's none or one - signup_server-realtime config option to run billing for signup server signups immediately - signup server: pkg available to success templates, better documentation on success templates - httemplate/edit/msgcat.cgi fields are properly sticky on errors - httemplate/edit/process/msgcat.cgi - don't update identical fields
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm11
-rw-r--r--FS/FS/Record.pm14
-rw-r--r--FS/FS/cust_main.pm13
-rw-r--r--FS/FS/cust_main_invoice.pm15
-rw-r--r--FS/FS/svc_acct.pm17
-rw-r--r--FS/FS/svc_acct_pop.pm8
6 files changed, 51 insertions, 27 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 14dce1a..0c41980 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -272,7 +272,7 @@ httemplate/docs/config.html
'key' => 'business-onlinepayment-description',
'section' => 'billing',
'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>. Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages to which the invoiced being charged applies)',
- 'type' => 'textarea',
+ 'type' => 'text',
},
{
@@ -888,6 +888,15 @@ httemplate/docs/config.html
'type' => 'checkbox',
},
+ {
+ 'key' => 'signup_server-realtime',
+ 'section' => '',
+ 'description' => 'Run billing for signup server signups immediately, and suspend accounts which subsequently have a balance.',
+ 'type' => 'checkbox',
+ },
+
+
+
);
1;
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index ff96781..acdebca 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -12,6 +12,7 @@ use DBI qw(:sql_types);
use DBIx::DBSchema 0.19;
use FS::UID qw(dbh checkruid getotaker datasrc driver_name);
use FS::SearchCache;
+use FS::msgcat qw(gettext);
@ISA = qw(Exporter);
@EXPORT_OK = qw(dbh fields hfields qsearch qsearchs dbdef jsearch);
@@ -825,7 +826,8 @@ false.
sub ut_text {
my($self,$field)=@_;
$self->getfield($field) =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/]+)$/
- or return "Illegal or empty (text) $field: ". $self->getfield($field);
+ or return gettext('illegal_or_empty_text'). " $field: ".
+ $self->getfield($field);
$self->setfield($field,$1);
'';
}
@@ -841,7 +843,7 @@ May be null. If there is an error, returns the error, otherwise returns false.
sub ut_textn {
my($self,$field)=@_;
$self->getfield($field) =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/]*)$/
- or return "Illegal (text) $field: ". $self->getfield($field);
+ or return gettext('illegal_text'). " $field: ". $self->getfield($field);
$self->setfield($field,$1);
'';
}
@@ -896,7 +898,7 @@ sub ut_phonen {
} elsif ( $country eq 'US' || $country eq 'CA' ) {
$phonen =~ s/\D//g;
$phonen =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/
- or return "Illegal (phone) $field: ". $self->getfield($field);
+ or return gettext('illegal_phone'). " $field: ". $self->getfield($field);
$phonen = "$1-$2-$3";
$phonen .= " x$4" if $4;
$self->setfield($field,$phonen);
@@ -965,7 +967,7 @@ May not be null.
sub ut_name {
my( $self, $field ) = @_;
$self->getfield($field) =~ /^([\w \,\.\-\']+)$/
- or return "Illegal (name) $field: ". $self->getfield($field);
+ or return gettext('illegal_name'). " $field: ". $self->getfield($field);
$self->setfield($field,$1);
'';
}
@@ -980,12 +982,12 @@ sub ut_zip {
my( $self, $field, $country ) = @_;
if ( $country eq 'US' ) {
$self->getfield($field) =~ /\s*(\d{5}(\-\d{4})?)\s*$/
- or return "Illegal (zip) $field for country $country: ".
+ or return gettext('illegal_zip'). " $field for country $country: ".
$self->getfield($field);
$self->setfield($field,$1);
} else {
$self->getfield($field) =~ /^\s*(\w[\w\-\s]{2,8}\w)\s*$/
- or return "Illegal (zip) $field: ". $self->getfield($field);
+ or return gettext('illegal_zip'). " $field: ". $self->getfield($field);
$self->setfield($field,$1);
}
'';
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 499d149..e1a5173 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -26,6 +26,7 @@ use FS::queue;
use FS::part_pkg;
use FS::part_bill_event;
use FS::cust_bill_event;
+use FS::msgcat qw(gettext);
@ISA = qw( FS::Record );
@@ -643,12 +644,13 @@ sub check {
my $payinfo = $self->payinfo;
$payinfo =~ s/\D//g;
$payinfo =~ /^(\d{13,16})$/
- or return "Illegal credit card number: ". $self->payinfo;
+ or return gettext('invalid_catd'); # . ": ". $self->payinfo;
$payinfo = $1;
$self->payinfo($payinfo);
validate($payinfo)
- or return "Illegal credit card number: ". $self->payinfo;
- return "Unknown card type" if cardtype($self->payinfo) eq "Unknown";
+ or return gettext('invalid_catd'); # . ": ". $self->payinfo;
+ return gettext('unknown_card_type')
+ if cardtype($self->payinfo) eq "Unknown";
} elsif ( $self->payby eq 'BILL' ) {
@@ -690,7 +692,7 @@ sub check {
$self->payname( $self->first. " ". $self->getfield('last') );
} else {
$self->payname =~ /^([\w \,\.\-\']+)$/
- or return "Illegal billing name: ". $self->payname;
+ or return gettext('illegal_name'). " payname: ". $self->payname;
$self->payname($1);
}
@@ -1153,6 +1155,9 @@ sub collect {
qsearch('part_bill_event', { 'payby' => $self->payby,
'disabled' => '', } )
) {
+
+ last unless $cust_bill->owed > 0; #don't run subsequent events if owed=0
+
warn "calling invoice event (". $part_bill_event->eventcode. ")\n"
if $Debug;
my $cust_main = $self; #for callback
diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm
index ebbadc6..b82e2e7 100644
--- a/FS/FS/cust_main_invoice.pm
+++ b/FS/FS/cust_main_invoice.pm
@@ -7,6 +7,7 @@ use FS::Record qw( qsearchs );
use FS::Conf;
use FS::cust_main;
use FS::svc_acct;
+use FS::msgcat qw(gettext);
@ISA = qw( FS::Record );
@@ -111,10 +112,12 @@ sub check {
=item checkdest
-Checks the dest field only. If it finds that the account ends in the
-same domain configured as the B<domain> configuration file, it will change the
-invoice destination from an email address to a service number (see
-L<FS::svc_acct>).
+Checks the dest field only.
+
+#If it finds that the account ends in the
+#same domain configured as the B<domain> configuration file, it will change the
+#invoice destination from an email address to a service number (see
+#L<FS::svc_acct>).
=cut
@@ -140,7 +143,7 @@ sub checkdest {
# }
$self->dest("$1\@$2");
} else {
- return "Illegal destination!";
+ return gettext("illegal_email_invoice_address");
}
''; #no error
@@ -167,7 +170,7 @@ sub address {
=head1 VERSION
-$Id: cust_main_invoice.pm,v 1.10 2002-02-10 17:02:37 ivan Exp $
+$Id: cust_main_invoice.pm,v 1.11 2002-04-10 13:42:48 ivan Exp $
=head1 BUGS
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 8e25f6a..030ffbe 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -28,6 +28,7 @@ use FS::svc_domain;
use FS::raddb;
use FS::queue;
use FS::radius_usergroup;
+use FS::msgcat qw(gettext);
@ISA = qw( FS::svc_Common );
@@ -262,7 +263,7 @@ sub insert {
$error = $self->check;
return $error if $error;
- return "Username ". $self->username. " in use"
+ return gettext('username_in_use'). ": ". $self->username
if qsearchs( 'svc_acct', { 'username' => $self->username,
'domsvc' => $self->domsvc,
} );
@@ -1088,24 +1089,24 @@ sub check {
my $ulen = $usernamemax || $self->dbdef_table->column('username')->length;
if ( $username_uppercase ) {
$recref->{username} =~ /^([a-z0-9_\-\.\&]{$usernamemin,$ulen})$/i
- or return "Illegal username: ". $recref->{username};
+ or return gettext('illegal_username'). ": ". $recref->{username};
$recref->{username} = $1;
} else {
$recref->{username} =~ /^([a-z0-9_\-\.\&]{$usernamemin,$ulen})$/
- or return "Illegal username: ". $recref->{username};
+ or return gettext('illegal_username'). ": ". $recref->{username};
$recref->{username} = $1;
}
if ( $username_letterfirst ) {
- $recref->{username} =~ /^[a-z]/ or return "Illegal username";
+ $recref->{username} =~ /^[a-z]/ or return gettext('illegal_username');
} elsif ( $username_letter ) {
- $recref->{username} =~ /[a-z]/ or return "Illegal username";
+ $recref->{username} =~ /[a-z]/ or return gettext('illegal_username');
}
if ( $username_noperiod ) {
- $recref->{username} =~ /\./ and return "Illegal username";
+ $recref->{username} =~ /\./ and return gettext('illegal_username');
}
unless ( $username_ampersand ) {
- $recref->{username} =~ /\&/ and return "Illegal username";
+ $recref->{username} =~ /\&/ and return gettext('illegal_username');
}
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
@@ -1221,7 +1222,7 @@ sub check {
$recref->{_password} = '!!';
} else {
#return "Illegal password";
- return "Illegal password: ". $recref->{_password};
+ return gettext('illegal_password'). ": ". $recref->{_password};
}
''; #no error
diff --git a/FS/FS/svc_acct_pop.pm b/FS/FS/svc_acct_pop.pm
index fa4f5c6..3c9ea01 100644
--- a/FS/FS/svc_acct_pop.pm
+++ b/FS/FS/svc_acct_pop.pm
@@ -121,6 +121,8 @@ sub text {
=cut
+#horrible false laziness with signup.cgi (pull special-case for 0 & 1
+# pop code out from signup.cgi??)
sub popselector {
my( $popnum, $state ) = @_;
@@ -180,14 +182,16 @@ END
=head1 VERSION
-$Id: svc_acct_pop.pm,v 1.6 2001-12-18 06:29:30 ivan Exp $
+$Id: svc_acct_pop.pm,v 1.7 2002-04-10 13:42:48 ivan Exp $
=head1 BUGS
It should be renamed to part_pop.
popselector? putting web ui components in here? they should probably live
-somewhere else...
+somewhere else...
+
+popselector: pull special-case for 0 & 1 pop code out from signup.cgi
=head1 SEE ALSO