for want of a paren
[freeside.git] / fs_selfservice / FS-SelfService / cgi / selfservice.cgi
index 4ab1309..ed6d623 100644 (file)
@@ -1,7 +1,8 @@
+#!/usr/bin/perl -T
 #!/usr/bin/perl -Tw
 
 use strict;
-use vars qw($cgi $session_id $form_max $template_dir);
+use vars qw($DEBUG $cgi $session_id $form_max $template_dir);
 use subs qw(do_template);
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
@@ -18,6 +19,8 @@ use FS::SelfService qw( login customer_info invoice
 
 $template_dir = '.';
 
+$DEBUG = 1;
+
 $form_max = 255;
 
 $cgi = new CGI;
@@ -67,6 +70,9 @@ $cgi->param('action') =~
   or die "unknown action ". $cgi->param('action');
 my $action = $1;
 
+warn "calling $action sub\n"
+  if $DEBUG;
+$FS::SelfService::DEBUG = $DEBUG;
 my $result = eval "&$action();";
 die $@ if $@;
 
@@ -78,7 +84,8 @@ if ( $result->{error} eq "Can't resume session" ) { #ick
 #warn $result->{'open_invoices'};
 #warn scalar(@{$result->{'open_invoices'}});
 
-warn "processing template $action\n";
+warn "processing template $action\n"
+  if $DEBUG;
 do_template($action, {
   'session_id' => $session_id,
   'action'     => $action, #so the menu knows what tab we're on...
@@ -121,9 +128,12 @@ sub payment_results {
   validate($payinfo)
     #or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
     or die "invalid card"; #!!!
-  cardtype($payinfo) eq $cgi->param('card_type')
-    #or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type');
-    or die "not a ". $cgi->param('card_type');
+
+  if ( $cgi->param('card_type') ) {
+    cardtype($payinfo) eq $cgi->param('card_type')
+      #or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type');
+      or die "not a ". $cgi->param('card_type');
+  }
 
   $cgi->param('month') =~ /^(\d{2})$/ or die "illegal month";
   my $month = $1;