[freeside-commits] freeside/fs_selfservice/FS-SelfService SelfService.pm, 1.26.2.3, 1.26.2.4

Jeff Finucane,420,, jeff at wavetail.420.am
Tue Dec 11 21:58:18 PST 2007


Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService
In directory wavetail:/tmp/cvs-serv26846/fs_selfservice/FS-SelfService

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	SelfService.pm 
Log Message:
self-service can select domain on provision (#2801)

Index: SelfService.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/SelfService.pm,v
retrieving revision 1.26.2.3
retrieving revision 1.26.2.4
diff -u -d -r1.26.2.3 -r1.26.2.4
--- SelfService.pm	5 Nov 2007 05:42:08 -0000	1.26.2.3
+++ SelfService.pm	12 Dec 2007 05:58:16 -0000	1.26.2.4
@@ -50,13 +50,14 @@
   'unprovision_svc'           => 'MyAccount/unprovision_svc',
   'myaccount_passwd'          => 'MyAccount/myaccount_passwd',
   'signup_info'               => 'Signup/signup_info',
+  'domain_select_hash'        => 'Signup/domain_select_hash',  # expose?
   'new_customer'              => 'Signup/new_customer',
   'agent_login'               => 'Agent/agent_login',
   'agent_logout'              => 'Agent/agent_logout',
   'agent_info'                => 'Agent/agent_info',
   'agent_list_customers'      => 'Agent/agent_list_customers',
 );
- at EXPORT_OK = ( keys(%autoload), qw( regionselector expselect popselector ) );
+ at EXPORT_OK = ( keys(%autoload), qw( regionselector expselect popselector domainselector) );
 
 $ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin';
 $ENV{'SHELL'} = '/bin/sh';
@@ -1242,6 +1243,66 @@
 
 }
 
+=item domainselector HASHREF | LIST
+
+Takes as input a hashref or list of key/value pairs with the following keys:
+
+=over 4
+
+=item pkgnum
+
+Package number
+
+=item domsvc
+
+Service number of the selected item.
+
+=back
+
+Returns an HTML fragment for domain selection.
+
+=cut
+
+sub domainselector {
+  my $param;
+  if ( ref($_[0]) ) {
+    $param = shift;
+  } else {
+    $param = { @_ };
+  }
+  my $domsvc= $param->{'domsvc'};
+  my $rv = 
+      domain_select_hash(map {$_ => $param->{$_}} qw(pkgnum svcpart pkgpart) );
+  my $domains = $rv->{'domains'};
+  $domsvc = $rv->{'domsvc'} unless $domsvc;
+
+  return '<INPUT TYPE="hidden" NAME="domsvc" VALUE="">'
+    unless scalar(keys %$domains);
+    
+  if (scalar(keys %$domains) == 1) {
+    my $key;
+    foreach(keys %$domains) {
+      $key = $_;
+    }
+    return '<TR><TD ALIGN="right">Domain</TD><TD>'. $domains->{$key}.
+           '<INPUT TYPE="hidden" NAME="domsvc" VALUE="'. $key. '"></TD></TR>'
+  }
+
+  my $text .= qq!<TR><TD ALIGN="right">Domain</TD><TD><SELECT NAME="domsvc" SIZE=1 STYLE="width: 20em"><OPTION>(Choose Domain)!;
+
+
+  foreach my $domain ( sort { $domains->{$a} cmp $domains->{$b} } keys %$domains ) {
+    $text .= qq!<OPTION VALUE="!. $domain. '"'.
+             ( ( $domsvc && $domain == $domsvc ) ? ' SELECTED' : '' ). ">".
+             $domains->{$domain};
+  }
+
+  $text .= qq!</SELECT></TD></TR>!;
+
+  $text;
+
+}
+
 =back
 
 =head1 RESELLER FUNCTIONS



More information about the freeside-commits mailing list