less cut and paste
[freeside.git] / FS / FS / ClientAPI / Signup.pm
index ede7ba9..b1cc3f0 100644 (file)
@@ -24,7 +24,6 @@ sub signup_info {
 
   use vars qw($signup_info); #cache for performance;
   $signup_info ||= {
-
     'cust_main_county' =>
       [ map { $_->hashref } qsearch('cust_main_county', {}) ],
 
@@ -65,6 +64,8 @@ sub signup_info {
 
     'svc_acct_pop' => [ map { $_->hashref } qsearch('svc_acct_pop',{} ) ],
 
+    'emailinvoiceonly' => $conf->exists('emailinvoiceonly'),
+
     'security_phrase' => $conf->exists('security_phrase'),
 
     'payby' => [ $conf->config('signup_server-payby') ],
@@ -74,7 +75,7 @@ sub signup_info {
     'ship_enabled' => defined dbdef->table('cust_main')->column('ship_last'),
 
     'msgcat' => { map { $_=>gettext($_) } qw(
-      passwords_dont_match invalid_card unknown_card_type not_a empty_password
+      passwords_dont_match invalid_card unknown_card_type not_a empty_password illegal_or_empty_text
     ) },
 
     'statedefault' => $conf->config('statedefault') || 'CA',
@@ -85,6 +86,21 @@ sub signup_info {
 
   };
 
+  my @addl = qw( signup_server-classnum2 signup_server-classnum3 );
+
+  if ( grep { $conf->exists($_) } @addl ) {
+  
+    $signup_info->{optional_packages} = [];
+
+    foreach my $addl ( @addl ) {
+      my $classnum = $conf->config($addl) or next;
+      my @pkgs = map { $_->hashref }
+                     qsearch( 'part_pkg', { classnum => $classnum } );
+      push @{$signup_info->{optional_packages}}, \@pkgs;
+    }
+
+  }
+
   my $agentnum = $conf->config('signup_server-default_agentnum');
 
   my $session = '';
@@ -197,7 +213,12 @@ sub new_customer {
       ship_city ship_county ship_state ship_zip ship_country
       ship_daytime ship_night ship_fax
 
-      payby payinfo paycvv paydate payname referral_custnum comments
+      payby
+      payinfo paycvv paydate payname
+      paystart_month paystart_year payissue
+      payip
+
+      referral_custnum comments
     )
 
   } );
@@ -297,7 +318,7 @@ sub new_customer {
     $cust_main->apply_payments;
     $cust_main->apply_credits;
 
-    $bill_error = $cust_main->collect;
+    $bill_error = $cust_main->collect('realtime' => 1);
     #warn "[fs_signup_server] error collecting from new customer: $bill_error"
     #  if $bill_error;