bulk checkin from working on the road:
authorivan <ivan>
Wed, 10 Apr 2002 13:42:49 +0000 (13:42 +0000)
committerivan <ivan>
Wed, 10 Apr 2002 13:42:49 +0000 (13:42 +0000)
- 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

18 files changed:
ANNOUCE.1.4.0
FS/FS/Conf.pm
FS/FS/Record.pm
FS/FS/cust_main.pm
FS/FS/cust_main_invoice.pm
FS/FS/svc_acct.pm
FS/FS/svc_acct_pop.pm
README.1.4.0pre12
bin/populate-msgcat
fs_signup/FS-SignupClient/cgi/signup.cgi
fs_signup/FS-SignupClient/cgi/signup.html
fs_signup/FS-SignupClient/cgi/success.html
fs_signup/fs_signup_server
httemplate/browse/msgcat.cgi
httemplate/docs/signup.html
httemplate/docs/upgrade8.html
httemplate/edit/msgcat.cgi
httemplate/edit/process/msgcat.cgi

index c1da9dd..86f48b6 100644 (file)
@@ -117,5 +117,6 @@ new export! (well, almost)
 
 icradius groups (usergroup table if not radgroupreply & radgroupcheck)
 
 
 icradius groups (usergroup table if not radgroupreply & radgroupcheck)
 
-message catalogs (infrastructure, anyway)
+message catalogs (infrastructure, anyway) & anything which gets sent to a
+customer from the signup server should use message catalog
 
 
index 14dce1a..0c41980 100644 (file)
@@ -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)',
     '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',
   },
 
     '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;
 );
 
 1;
index ff96781..acdebca 100644 (file)
@@ -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 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);
 
 @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 \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/]+)$/
 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);
   '';
 }
   $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 \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/]*)$/
 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);
   '';
 }
   $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*)$/
   } 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);
     $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 \,\.\-\']+)$/
 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);
   '';
 }
   $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*$/
   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*$/
                 $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);
   }
   '';
     $self->setfield($field,$1);
   }
   '';
index 499d149..e1a5173 100644 (file)
@@ -26,6 +26,7 @@ use FS::queue;
 use FS::part_pkg;
 use FS::part_bill_event;
 use FS::cust_bill_event;
 use FS::part_pkg;
 use FS::part_bill_event;
 use FS::cust_bill_event;
+use FS::msgcat qw(gettext);
 
 @ISA = qw( FS::Record );
 
 
 @ISA = qw( FS::Record );
 
@@ -643,12 +644,13 @@ sub check {
     my $payinfo = $self->payinfo;
     $payinfo =~ s/\D//g;
     $payinfo =~ /^(\d{13,16})$/
     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)
     $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' ) {
 
 
   } elsif ( $self->payby eq 'BILL' ) {
 
@@ -690,7 +692,7 @@ sub check {
     $self->payname( $self->first. " ". $self->getfield('last') );
   } else {
     $self->payname =~ /^([\w \,\.\-\']+)$/
     $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);
   }
 
     $self->payname($1);
   }
 
@@ -1153,6 +1155,9 @@ sub collect {
           qsearch('part_bill_event', { 'payby'    => $self->payby,
                                        'disabled' => '',           } )
     ) {
           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
       warn "calling invoice event (". $part_bill_event->eventcode. ")\n"
         if $Debug;
       my $cust_main = $self; #for callback
index ebbadc6..b82e2e7 100644 (file)
@@ -7,6 +7,7 @@ use FS::Record qw( qsearchs );
 use FS::Conf;
 use FS::cust_main;
 use FS::svc_acct;
 use FS::Conf;
 use FS::cust_main;
 use FS::svc_acct;
+use FS::msgcat qw(gettext);
 
 @ISA = qw( FS::Record );
 
 
 @ISA = qw( FS::Record );
 
@@ -111,10 +112,12 @@ sub check {
 
 =item checkdest
 
 
 =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
 
 
 =cut
 
@@ -140,7 +143,7 @@ sub checkdest {
 #    }
     $self->dest("$1\@$2");
   } else {
 #    }
     $self->dest("$1\@$2");
   } else {
-    return "Illegal destination!";
+    return gettext("illegal_email_invoice_address");
   }
 
   ''; #no error
   }
 
   ''; #no error
@@ -167,7 +170,7 @@ sub address {
 
 =head1 VERSION
 
 
 =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
 
 
 =head1 BUGS
 
index 8e25f6a..030ffbe 100644 (file)
@@ -28,6 +28,7 @@ use FS::svc_domain;
 use FS::raddb;
 use FS::queue;
 use FS::radius_usergroup;
 use FS::raddb;
 use FS::queue;
 use FS::radius_usergroup;
+use FS::msgcat qw(gettext);
 
 @ISA = qw( FS::svc_Common );
 
 
 @ISA = qw( FS::svc_Common );
 
@@ -262,7 +263,7 @@ sub insert {
   $error = $self->check;
   return $error if $error;
 
   $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,
                              } );
     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
   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})$/
     $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} = $1;
   }
 
   if ( $username_letterfirst ) {
-    $recref->{username} =~ /^[a-z]/ or return "Illegal username";
+    $recref->{username} =~ /^[a-z]/ or return gettext('illegal_username');
   } elsif ( $username_letter ) {
   } elsif ( $username_letter ) {
-    $recref->{username} =~ /[a-z]/ or return "Illegal username";
+    $recref->{username} =~ /[a-z]/ or return gettext('illegal_username');
   }
   if ( $username_noperiod ) {
   }
   if ( $username_noperiod ) {
-    $recref->{username} =~ /\./ and return "Illegal username";
+    $recref->{username} =~ /\./ and return gettext('illegal_username');
   }
   unless ( $username_ampersand ) {
   }
   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};
   }
 
   $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
@@ -1221,7 +1222,7 @@ sub check {
     $recref->{_password} = '!!';
   } else {
     #return "Illegal password";
     $recref->{_password} = '!!';
   } else {
     #return "Illegal password";
-    return "Illegal password: ". $recref->{_password};
+    return gettext('illegal_password'). ": ". $recref->{_password};
   }
 
   ''; #no error
   }
 
   ''; #no error
index fa4f5c6..3c9ea01 100644 (file)
@@ -121,6 +121,8 @@ sub text {
 
 =cut
 
 
 =cut
 
+#horrible false laziness with signup.cgi (pull special-case for 0 & 1
+# pop code out from signup.cgi??)
 sub popselector {
   my( $popnum, $state ) = @_;
 
 sub popselector {
   my( $popnum, $state ) = @_;
 
@@ -180,14 +182,16 @@ END
 
 =head1 VERSION
 
 
 =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
 
 =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
 
 
 =head1 SEE ALSO
 
index 72353ba..ea1f952 100644 (file)
@@ -40,6 +40,8 @@ Run bin/dbdef-create again
 
 Run bin/populate-msgcat
 
 
 Run bin/populate-msgcat
 
+Set the `locale' configuration option to `en_US'.
+
 the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated.  Use the defaultrecords configuration value instead.
 
 New export code has landed!  If you were using the icradiusmachines,
 the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated.  Use the defaultrecords configuration value instead.
 
 New export code has landed!  If you were using the icradiusmachines,
index 51f04c1..5d6e85a 100755 (executable)
@@ -27,6 +27,8 @@ foreach my $msgcode ( keys %messages ) {
   }
 }
 
   }
 }
 
+print "Message catalog initialized sucessfully\n";
+
 sub messages {
 
   #  'msgcode' => {
 sub messages {
 
   #  'msgcode' => {
@@ -51,6 +53,55 @@ sub messages {
       'en_US' => 'Not a ',
     },
 
       'en_US' => 'Not a ',
     },
 
+    'empty_password' => {
+      'en_US' => 'Empty password',
+    },
+
+    'no_access_number_selected' => {
+      'en_US' => 'No access number selected',
+    },
+
+    'illegal_text' => {
+      'en_US' => 'Illegal (text)',
+      #'en_US' => 'Only letters, numbers, spaces, and the following punctuation symbols are permitted: ! @ # $ % & ( ) - + ; : \' " , . ? / in field',
+    },
+
+    'illegal_or_empty_text' => {
+      'en_US' => 'Illegal or empty (text)',
+      #'en_US' => 'Only letters, numbers, spaces, and the following punctuation symbols are permitted: ! @ # $ % & ( ) - + ; : \' " , . ? / in required field',
+    },
+
+    'illegal_username' => {
+      'en_US' => 'Illegal username',
+    },
+
+    'illegal_password' => {
+      'en_US' => 'Illegal password',
+    },
+
+    'username_in_use' => {
+      'en_US' => 'Username in use',
+    },
+
+    'illegal_email_invoice_address' => {
+      'en_US' => 'Illegal email invoice address',
+    },
+
+    'illegal_name' => {
+      'en_US' => 'Illegal (name)',
+      #'en_US' => 'Only letters, numbers, spaces and the following punctuation symbols are permitted: , . - \' in field',
+    },
+
+    'illegal_phone' => {
+      'en_US' => 'Illegal (phone)',
+      #'en_US' => '',
+    },
+
+    'illegal_zip' => {
+      'en_US' => 'Illegal (zip)',
+      #'en_US' => '',
+    },
+
   );
 }
 
   );
 }
 
index 46621d1..284237d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
 #!/usr/bin/perl -Tw
 #
-# $Id: signup.cgi,v 1.19 2002-04-07 05:56:08 ivan Exp $
+# $Id: signup.cgi,v 1.20 2002-04-10 13:42:48 ivan Exp $
 
 use strict;
 use vars qw( @payby $cgi $locales $packages $pops $init_data $error
 
 use strict;
 use vars qw( @payby $cgi $locales $packages $pops $init_data $error
@@ -15,7 +15,7 @@ use vars qw( @payby $cgi $locales $packages $pops $init_data $error
            );
 use subs qw( print_form print_okay expselect signup_default success_default );
 use CGI;
            );
 use subs qw( print_form print_okay expselect signup_default success_default );
 use CGI;
-use CGI::Carp qw(fatalsToBrowser);
+#use CGI::Carp qw(fatalsToBrowser);
 use Text::Template;
 use Business::CreditCard;
 use HTTP::Headers::UserAgent 2.00;
 use Text::Template;
 use Business::CreditCard;
 use HTTP::Headers::UserAgent 2.00;
@@ -230,13 +230,15 @@ sub print_okay {
     or die "fatal: invalid password got past FS::SignupClient::new_customer";
   my $password = $1;
   ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
     or die "fatal: invalid password got past FS::SignupClient::new_customer";
   my $password = $1;
   ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
-    or die "fatal: invalid email_name got past FS::SignupCLient::new_customer";
+    or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
   my $email_name = $1;
 
   my $pop = pop_info($cgi->param('popnum'))
     or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
   ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
 
   my $email_name = $1;
 
   my $pop = pop_info($cgi->param('popnum'))
     or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
   ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
 
+  my $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
+
   if ( $ieak_template
        && $user_agent->platform eq 'ia32'
        && $user_agent->os =~ /^win/
   if ( $ieak_template
        && $user_agent->platform eq 'ia32'
        && $user_agent->os =~ /^win/
@@ -277,6 +279,12 @@ sub pop_info {
 sub popselector {
   my( $popnum, $state ) = @_;
 
 sub popselector {
   my( $popnum, $state ) = @_;
 
+  return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
+  return $pops->[0]{city}. ', '. $pops->[0]{state}.
+         ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}.
+         '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
+    if scalar(@$pops) == 1;
+
   my %pop = ();
   push @{ $pop{$_->{state}} }, $_ foreach @$pops;
 
   my %pop = ();
   push @{ $pop{$_->{state}} }, $_ foreach @$pops;
 
@@ -359,6 +367,13 @@ sub success_default { #html to use if you don't specify a success file
 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
 Thanks for signing up!
 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
 Thanks for signing up!
+<BR><BR>
+Signup information for <%= $email_name %>:
+<BR><BR>
+Username: <%= $username %><BR>
+Password: <%= $password %><BR>
+Access number: (<%= $ac %>) / $exch - $local<BR>
+Package: <%= $pkg %><BR>
 </BODY></HTML>
 END
 }
 </BODY></HTML>
 END
 }
@@ -515,13 +530,11 @@ Contact Information
 </TR>
 <TR>
   <TD ALIGN="right">Password</TD>
 </TR>
 <TR>
   <TD ALIGN="right">Password</TD>
-  <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>">
-  (blank to generate)</TD>
+  <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
 </TR>
 <TR>
   <TD ALIGN="right">Re-enter Password</TD>
 </TR>
 <TR>
   <TD ALIGN="right">Re-enter Password</TD>
-  <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>">
-  </TD>
+  <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
 </TR>
 <%=
   if ( $init_data->{'security_phrase'} ) {
 </TR>
 <%=
   if ( $init_data->{'security_phrase'} ) {
@@ -536,10 +549,14 @@ ENDOUT
     $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
   }
 %>
     $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
   }
 %>
-<TR>
-  <TD ALIGN="right">Access number</TD>
-  <TD><%= popselector($popnum) %></TD>
-</TR>
+<%=
+  if ( scalar(@$pops) ) {
+    $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
+            popselector($popnum). '</TD></TR>';
+  } else {
+    $OUT .= popselector($popnum);
+  }
+%>
 </TABLE>
 <BR><BR><INPUT TYPE="submit" VALUE="Signup">
 </FORM></BODY></HTML>
 </TABLE>
 <BR><BR><INPUT TYPE="submit" VALUE="Signup">
 </FORM></BODY></HTML>
index 5d2f2d9..6c60141 100755 (executable)
@@ -148,13 +148,11 @@ Contact Information
 </TR>
 <TR>
   <TD ALIGN="right">Password</TD>
 </TR>
 <TR>
   <TD ALIGN="right">Password</TD>
-  <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>">
-  (blank to generate)</TD>
+  <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
 </TR>
 <TR>
   <TD ALIGN="right">Re-enter Password</TD>
 </TR>
 <TR>
   <TD ALIGN="right">Re-enter Password</TD>
-  <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>">
-  </TD>
+  <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
 </TR>
 <%=
   if ( $init_data->{'security_phrase'} ) {
 </TR>
 <%=
   if ( $init_data->{'security_phrase'} ) {
@@ -169,10 +167,14 @@ ENDOUT
     $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
   }
 %>
     $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
   }
 %>
-<TR>
-  <TD ALIGN="right">Access number</TD>
-  <TD><%= popselector($popnum) %></TD>
-</TR>
+<%=
+  if ( scalar(@$pops) ) {
+    $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
+            popselector($popnum). '</TD></TR>';
+  } else {
+    $OUT .= popselector($popnum);
+  }
+%>
 </TABLE>
 <BR><BR><INPUT TYPE="submit" VALUE="Signup">
 </FORM></BODY></HTML>
 </TABLE>
 <BR><BR><INPUT TYPE="submit" VALUE="Signup">
 </FORM></BODY></HTML>
index 6bc2d1f..0119b3b 100644 (file)
@@ -1,4 +1,11 @@
 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
 Thanks for signing up!
 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
 Thanks for signing up!
+<BR><BR>
+Signup information for <%= $email_name %>:
+<BR><BR>
+Username: <%= $username %><BR>
+Password: <%= $password %><BR>
+Access number: (<%= $ac %>) / $exch - $local<BR>
+Package: <%= $pkg %><BR>
 </BODY></HTML>
 </BODY></HTML>
index 871bbdf..ebf424c 100755 (executable)
@@ -47,6 +47,7 @@ while (1) {
   warn "[fs_signup_server] Connecting to $machine...\n" if $Debug;
   sshopen2($machine,$reader,$writer,$fs_signupd);
 
   warn "[fs_signup_server] Connecting to $machine...\n" if $Debug;
   sshopen2($machine,$reader,$writer,$fs_signupd);
 
+  my @pops = qsearch('svc_acct_pop',{} );
   my $init_data = {
 
     #'_protocol' => 'signup',
   my $init_data = {
 
     #'_protocol' => 'signup',
@@ -63,7 +64,7 @@ while (1) {
             qsearch( 'part_pkg', { 'disabled' => '' } )
       ],
 
             qsearch( 'part_pkg', { 'disabled' => '' } )
       ],
 
-    'svc_acct_pop' => [ map { $_->hashref } qsearch ('svc_acct_pop',{} ) ],
+    'svc_acct_pop' => [ map { $_->hashref } @pops ],
 
     'security_phrase' => $conf->exists('security_phrase'),
 
 
     'security_phrase' => $conf->exists('security_phrase'),
 
@@ -96,8 +97,9 @@ while (1) {
     #things that aren't necessary in base class, but are for signup server
       #return "Passwords don't match"
       #  if $hashref->{'_password'} ne $hashref->{'_password2'}
     #things that aren't necessary in base class, but are for signup server
       #return "Passwords don't match"
       #  if $hashref->{'_password'} ne $hashref->{'_password2'}
-    $error ||= "Empty password" unless $signup_data->{'_password'};
-    $error ||= "No POP selected" unless $signup_data->{'popnum'};
+    $error ||= gettext('empty_password') unless $signup_data->{'_password'};
+    $error ||= gettext('no_access_number_selected')
+      unless $signup_data->{'popnum'} || !scalar(@pops);
 
     #shares some stuff with htdocs/edit/process/cust_main.cgi... take any
     # common that are still here and library them.
 
     #shares some stuff with htdocs/edit/process/cust_main.cgi... take any
     # common that are still here and library them.
@@ -150,11 +152,30 @@ while (1) {
     use Tie::RefHash;
     tie my %hash, 'Tie::RefHash';
     %hash = ( $cust_pkg => [ $svc_acct ] );
     use Tie::RefHash;
     tie my %hash, 'Tie::RefHash';
     %hash = ( $cust_pkg => [ $svc_acct ] );
-    $error ||= $cust_main->insert( \%hash, \@invoicing_list );
+    $error ||= $cust_main->insert( \%hash, \@invoicing_list ); #msgcat
 
     warn "[fs_signup_server] Sending results...\n" if $Debug;
     print $writer $error, "\n";
 
 
     warn "[fs_signup_server] Sending results...\n" if $Debug;
     print $writer $error, "\n";
 
+    if ( $conf->config('signup_server-realtime') ) {
+      
+      my $bill_error = $cust_main->bill;
+      warn "[fs_signup_server] error billing new customer: $bill_error"
+        if $bill_error;
+
+      $cust_main->apply_payments;
+      $cust_main->apply_credits;
+
+      $bill_error = $cust_main->collect;
+      warn "[fs_signup_server] error collecting from new customer: $bill_error"
+        if $bill_error;
+
+      if ( $cust_main->balance ) {
+        #should check list for errors...
+        $cust_main->suspend;
+      }
+    }
+
     if ( $error && $conf->config('signup_server-email') ) {
       warn "[fs_signup_server] Sending email...\n" if $Debug;
 
     if ( $error && $conf->config('signup_server-email') ) {
       warn "[fs_signup_server] Sending email...\n" if $Debug;
 
@@ -171,18 +192,20 @@ while (1) {
         "Date: ". time2str("%a, %d %b %Y %X %z", time),
         "Subject: FREESIDE NOTIFICATION: Signup Server",
       ] );
         "Date: ". time2str("%a, %d %b %Y %X %z", time),
         "Subject: FREESIDE NOTIFICATION: Signup Server",
       ] );
-      my $message = new Mail::Internet (
-        'Header' => $header,
-        'Body' => [ 
-          "This is an automatic message from your Freeside installation\n",
-          "informing you a customer has signed up via the signup server:\n",
-          "\n",
-          'custnum: '. $cust_main->custnum. "\n",
-          'Name   : '. $cust_main->last. ", ". $cust_main->first. "\n",
-          'Agent  : '. $cust_main->agent->agent. "\n",
-          "\n",
-        ],
-      );
+      my $body = [
+        "This is an automatic message from your Freeside installation\n",
+        "informing you a customer has signed up via the signup server:\n",
+        "\n",
+        'custnum: '. $cust_main->custnum. "\n",
+        'Name   : '. $cust_main->last. ", ". $cust_main->first. "\n",
+        'Agent  : '. $cust_main->agent->agent. "\n",
+        "\n",
+      ];
+      if ( $cust_main->balance ) {
+        push @$body,
+          "This customer has an outstanding balance and has been suspended.\n";
+      }
+      my $message = new Mail::Internet ( 'Header' => $header, 'Body' => $body );
       $!=0;
       $message->smtpsend( Host => $smtpmachine )
         or $message->smtpsend( Host => $smtpmachine, Debug => 1 )
       $!=0;
       $message->smtpsend( Host => $smtpmachine )
         or $message->smtpsend( Host => $smtpmachine, Debug => 1 )
index 774473b..d4adf9f 100755 (executable)
@@ -1,7 +1,7 @@
 <!-- mason kludge -->
 <%
 
 <!-- mason kludge -->
 <%
 
-print header("Message catalog", menubar(
+print header("View Message catalog", menubar(
   'Main Menu' => $p,
   'Edit message catalog' => $p. "edit/msgcat.cgi",
 )), '<BR>';
   'Main Menu' => $p,
   'Edit message catalog' => $p. "edit/msgcat.cgi",
 )), '<BR>';
index 117cf29..5168f47 100644 (file)
@@ -35,28 +35,22 @@ Then:
 </ul>
 Optional:
 <ul>
 </ul>
 Optional:
 <ul>
-  <li>If you create a <b>/usr/local/freeside/ieak.template</b> file on the external machine, it will be sent to IE users with MIME type <i>application/x-Internet-signup</i>.  This file will be processed with <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> with the following variables available:
-  <ul>
-    <li>$ac - area code of selected POP
-    <li>$exch - exchange of selected POP
-    <li>$loc - local part of selected POP
-    <li>$username
-    <li>$password
-    <li>$email_name - first and last name
-  </ul>
+  <li>If you create a <b>/usr/local/freeside/ieak.template</b> file on the external machine, it will be sent to IE users with MIME type <i>application/x-Internet-signup</i>.  This file will be processed with <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> with the variables listed below available.
   (an example file is included as <b>fs_signup/ieak.template</b>)  See the <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/toc.asp">IEAK documentation</a> for more information.
   (an example file is included as <b>fs_signup/ieak.template</b>)  See the <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/toc.asp">IEAK documentation</a> for more information.
-  <li>If you create a <b>/usr/local/freeside/cck.template</b> file on the external machine, the variables defined will be sent to Netscape users with MIME type <i>application/x-netscape-autoconfigure-dialer-v2</i>.  This file will be processed with <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> with the following variables available:
-  <ul>
-    <li>$ac - area code of selected POP
-    <li>$exch - exchange of selected POP
-    <li>$loc - local part of selected POP
-    <li>$username
-    <li>$password
-    <li>$email_name - first and last name
-  </ul>
+  <li>If you create a <b>/usr/local/freeside/cck.template</b> file on the external machine, the variables defined will be sent to Netscape users with MIME type <i>application/x-netscape-autoconfigure-dialer-v2</i>.  This file will be processed with <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> with the variables listed below available.
   (an example file is included as <b>fs_signup/cck.template</b>).  See the <a href="http://help.netscape.com/products/client/mc/acctproc4.html">Netscape documentation</a> for more information.
   (an example file is included as <b>fs_signup/cck.template</b>).  See the <a href="http://help.netscape.com/products/client/mc/acctproc4.html">Netscape documentation</a> for more information.
-  <li>If you create a <b>/usr/local/freeside/signup.html</b> file on the external machine, it will be used as a template for the form HTML.  This requires the template to be constructed appropriately; probably best to start with the example file included as <b>fs_signup/FS-SignupClient/cgi/signup.html</b>.
   <li>If you create a <b>/usr/local/freeside/success.html</b> file on the external machine, it will be used as the success HTML page.  Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html.  An example file is included as <b>fs_signup/FS-SignupClient/cgi/success.html</b>
   <li>If you create a <b>/usr/local/freeside/success.html</b> file on the external machine, it will be used as the success HTML page.  Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html.  An example file is included as <b>fs_signup/FS-SignupClient/cgi/success.html</b>
+  <li>Variable substitutions available in <b>ieak.template</b>, <b>cck.template</b> and <b>success.html</b>:
+    <ul>
+      <li>$ac - area code of selected POP
+      <li>$exch - exchange of selected POP
+      <li>$loc - local part of selected POP
+      <li>$username
+      <li>$password
+      <li>$email_name - first and last name
+      <li>$pkg - package name
+    </ul>
+  <li>If you create a <b>/usr/local/freeside/signup.html</b> file on the external machine, it will be used as a template for the form HTML.  This requires the template to be constructed appropriately; probably best to start with the example file included as <b>fs_signup/FS-SignupClient/cgi/signup.html</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, and/or the time specified in the <b>seconds</b> column (for use with the <a href="session.html">session monitor</a>), 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>
   <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, and/or the time specified in the <b>seconds</b> column (for use with the <a href="session.html">session monitor</a>), 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>
index a7b5853..d1b13fe 100644 (file)
@@ -325,6 +325,7 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
   <li><b>IMPORTANT</b>: run bin/create-history-tables
   <li><b>IMPORTANT: After running bin/create-history-tables</b>, run bin/dbdef-create again.
   <li>set the <a href="../config/config.cgi#username_policy">user_policy configuration value</a> as appropriate for your site.
   <li><b>IMPORTANT</b>: run bin/create-history-tables
   <li><b>IMPORTANT: After running bin/create-history-tables</b>, run bin/dbdef-create again.
   <li>set the <a href="../config/config.cgi#username_policy">user_policy configuration value</a> as appropriate for your site.
+  <li>set the <a href="../config/config.cgi#locale">locale configuration value</a> to en_US.
   <li>the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated.  Set the <a href="../config/config.cgi#defaultrecords">defaultrecords configuration value</a> instead.
   <li>Create the `/usr/local/etc/freeside/cache.<i>datasrc</i>' directory
       (owned by the freeside user).
   <li>the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated.  Set the <a href="../config/config.cgi#defaultrecords">defaultrecords configuration value</a> instead.
   <li>Create the `/usr/local/etc/freeside/cache.<i>datasrc</i>' directory
       (owned by the freeside user).
index 5d256c0..ee9b1c6 100755 (executable)
@@ -1,11 +1,12 @@
 <!-- mason kludge -->
 <%
 
 <!-- mason kludge -->
 <%
 
-print header("Message catalog", menubar(
+print header("Edit Message catalog", menubar(
 #  'Main Menu' => $p,
 )), '<BR>';
 
 #  'Main Menu' => $p,
 )), '<BR>';
 
-print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !. $cgi->param('error')
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !. $cgi->param('error').
+      '</FONT><BR><BR>'
   if $cgi->param('error');
 
 my $widget = new HTML::Widgets::SelectLayers(
   if $cgi->param('error');
 
 my $widget = new HTML::Widgets::SelectLayers(
@@ -28,7 +29,7 @@ my $widget = new HTML::Widgets::SelectLayers(
         '<TR><TD>'. $msgcat->msgnum. '</TD><TD>'. $msgcat->msgcode. '</TD>'.
         '<TD><INPUT TYPE="text" SIZE=32 '.
         qq! NAME="!. $msgcat->msgnum. '" '.
         '<TR><TD>'. $msgcat->msgnum. '</TD><TD>'. $msgcat->msgcode. '</TD>'.
         '<TD><INPUT TYPE="text" SIZE=32 '.
         qq! NAME="!. $msgcat->msgnum. '" '.
-        qq!VALUE="!. $msgcat->msg. qq!"></TD>!;
+        qq!VALUE="!. ($cgi->param($msgcat->msgnum)||$msgcat->msg). qq!"></TD>!;
       unless ( $layer eq 'en_US' ) {
         my $en_msgcat = qsearchs('msgcat', {
           'locale'  => 'en_US',
       unless ( $layer eq 'en_US' ) {
         my $en_msgcat = qsearchs('msgcat', {
           'locale'  => 'en_US',
index ab30f06..1f94f66 100644 (file)
@@ -3,6 +3,7 @@
 my $error;
 foreach my $param ( grep { /^\d+$/ } $cgi->param ) {
   my $old = qsearchs('msgcat', { msgnum=>$param } );
 my $error;
 foreach my $param ( grep { /^\d+$/ } $cgi->param ) {
   my $old = qsearchs('msgcat', { msgnum=>$param } );
+  next if $old->msg eq $cgi->param($param); #no need to update identical records
   my $new = new FS::msgcat { $old->hash };
   $new->msg($cgi->param($param));
   $error = $new->replace($old);
   my $new = new FS::msgcat { $old->hash };
   $new->msg($cgi->param($param));
   $error = $new->replace($old);