[freeside-devel] self-service namespace clobbering

Simon P. Ditner simon-freeside at uc.org
Tue Jul 25 09:58:52 PDT 2006


Hi,

I found that there was some namespace pollution happening in the
signup.html template originating from FS::ClientAPI::Signup

Here's a patch -- I didn't touch the signup-*.html files, I don't quite
understand what they're for, but they likely need to be updated as well.

Cheers,
spd

| It ain't what you don't know that gets you into trouble. It's what
| you know for sure that just ain't so.   -- Mark Twain

Index: fs_selfservice/FS-SelfService/cgi/signup.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/signup.cgi,v
retrieving revision 1.2
diff -u -r1.2 signup.cgi
--- fs_selfservice/FS-SelfService/cgi/signup.cgi        12 Mar 2005 14:35:12 -0000      1.2
+++ fs_selfservice/FS-SelfService/cgi/signup.cgi        25 Jul 2006 16:55:44 -0000
@@ -4,7 +4,7 @@
 # $Id: signup.cgi,v 1.2 2005/03/12 14:35:12 ivan Exp $

 use strict;
-use vars qw( @payby $cgi $init_data
+use vars qw( $cgi $init_data
              $self_url $error $agentnum

              $ieak_file $ieak_template
@@ -23,12 +23,14 @@
 use HTTP::BrowserDetect;
 use FS::SelfService qw( signup_info new_customer );

-#acceptable payment methods
+#acceptable payment methods --
+# DEPRICATED! This is now controlled from within the freeside interface, under:
+#   Configuration->Settings->Unclassified->signup_server-payby
 #
 #@payby = qw( CARD BILL COMP );
 #@payby = qw( CARD BILL );
 #@payby = qw( CARD );
- at payby = qw( CARD PREPAY );
+#@payby = qw( CARD PREPAY );

 $ieak_file = '/usr/local/freeside/ieak.template';
 $signup_html = -e 'signup.html'
Index: fs_selfservice/FS-SelfService/cgi/signup.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/signup.html,v
retrieving revision 1.3
diff -u -r1.3 signup.html
--- fs_selfservice/FS-SelfService/cgi/signup.html       12 Mar 2005 14:31:50 -0000      1.3
+++ fs_selfservice/FS-SelfService/cgi/signup.html       25 Jul 2006 16:55:44 -0000
@@ -21,10 +21,10 @@
 <INPUT TYPE="hidden" NAME="ss" VALUE="">
 Where did you hear about our service? <SELECT NAME="refnum">
 <%=
-  $OUT .= '<OPTION VALUE="">' unless $refnum;
+  $OUT .= '<OPTION VALUE="">' unless ( $refnum || $default_refnum );
   foreach my $part_referral ( @part_referral ) {
     $OUT .= '<OPTION VALUE="'. $part_referral->{'refnum'}. '"';
-    $OUT .= ' SELECTED' if $part_referral->{'refnum'} eq $refnum;
+    $OUT .= ' SELECTED' if $part_referral->{'refnum'} eq ( $refnum || $default_refnum );
     $OUT .= '>'. $part_referral->{'referral'};
   }
 %>
@@ -101,7 +101,7 @@
 </TD></TR>
 <TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ ne 'POST' } split(', ', $invoicing_list ) ) %>">
 </TD></TR>
-<%= scalar(@payby) > 1 ? '<TR><TD>Billing type</TD></TR>' : '' %>
+<%= scalar(@payby_accepted) > 1 ? '<TR><TD>Billing type</TD></TR>' : '' %>
 </TABLE>
 <TABLE BGCOLOR="#c0c0c0" BORDER=1 WIDTH="100%">
 <TR>
@@ -156,8 +156,8 @@
       }
     }

-    for (@payby) {
-      if ( scalar(@payby) == 1) {
+    for (@payby_accepted) {
+      if ( scalar(@payby_accepted) == 1) {
         $OUT .= '<TD VALIGN=TOP>'.
                 qq!<INPUT TYPE="hidden" NAME="payby" VALUE="$_">!.
                 "$paybychecked{$_}</TD>";
Index: FS/FS/ClientAPI/Signup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Signup.pm,v
retrieving revision 1.22
diff -u -r1.22 Signup.pm
--- FS/FS/ClientAPI/Signup.pm   24 Aug 2005 13:22:27 -0000      1.22
+++ FS/FS/ClientAPI/Signup.pm   25 Jul 2006 16:55:44 -0000
@@ -67,7 +67,7 @@

     'security_phrase' => $conf->exists('security_phrase'),

-    'payby' => [ $conf->config('signup_server-payby') ],
+    'payby_accepted' => [ $conf->config('signup_server-payby') ],

     'cvv_enabled' => defined dbdef->table('cust_main')->column('paycvv'),

@@ -81,7 +81,7 @@

     'countrydefault' => $conf->config('countrydefault') || 'US',

-    'refnum' => $conf->config('signup_server-default_refnum'),
+    'default_refnum' => $conf->config('signup_server-default_refnum'),

   };



More information about the freeside-devel mailing list