1 package FS::SelfService;
4 use vars qw($VERSION @ISA @EXPORT_OK $dir $socket %autoload $tag);
10 use Storable 2.09 qw(nstore_fd fd_retrieve);
14 @ISA = qw( Exporter );
16 $dir = "/usr/local/freeside";
17 $socket = "$dir/selfservice_socket";
18 $socket .= '.'.$tag if defined $tag && length($tag);
20 #maybe should ask ClientAPI for this list
22 'passwd' => 'passwd/passwd',
23 'chfn' => 'passwd/passwd',
24 'chsh' => 'passwd/passwd',
25 'login' => 'MyAccount/login',
26 'logout' => 'MyAccount/logout',
27 'customer_info' => 'MyAccount/customer_info',
28 'edit_info' => 'MyAccount/edit_info', #add to ss cgi!
29 'invoice' => 'MyAccount/invoice',
30 'list_invoices' => 'MyAccount/list_invoices', #?
31 'cancel' => 'MyAccount/cancel', #add to ss cgi!
32 'payment_info' => 'MyAccount/payment_info',
33 'process_payment' => 'MyAccount/process_payment',
34 'process_prepay' => 'MyAccount/process_prepay',
35 'list_pkgs' => 'MyAccount/list_pkgs', #add to ss cgi!
36 'order_pkg' => 'MyAccount/order_pkg', #add to ss cgi!
37 'cancel_pkg' => 'MyAccount/cancel_pkg', #add to ss cgi!
38 'charge' => 'MyAccount/charge', #?
39 'part_svc_info' => 'MyAccount/part_svc_info',
40 'provision_acct' => 'MyAccount/provision_acct',
41 'provision_external' => 'MyAccount/provision_external',
42 'unprovision_svc' => 'MyAccount/unprovision_svc',
43 'signup_info' => 'Signup/signup_info',
44 'new_customer' => 'Signup/new_customer',
45 'agent_login' => 'Agent/agent_login',
46 'agent_logout' => 'Agent/agent_logout',
47 'agent_info' => 'Agent/agent_info',
48 'agent_list_customers' => 'Agent/agent_list_customers',
50 @EXPORT_OK = ( keys(%autoload), qw( regionselector expselect popselector ) );
52 $ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin';
53 $ENV{'SHELL'} = '/bin/sh';
54 $ENV{'IFS'} = " \t\n";
57 $ENV{'BASH_ENV'} = '';
59 my $freeside_uid = scalar(getpwnam('freeside'));
60 die "not running as the freeside user\n" if $> != $freeside_uid;
62 -e $dir or die "FATAL: $dir doesn't exist!";
63 -d $dir or die "FATAL: $dir isn't a directory!";
64 -r $dir or die "FATAL: Can't read $dir as freeside user!";
65 -x $dir or die "FATAL: $dir not searchable (executable) as freeside user!";
67 foreach my $autoload ( keys %autoload ) {
78 $param->{_packet} = \''. $autoload{$autoload}. '\';
80 simple_packet($param);
90 socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!";
91 connect(SOCK, sockaddr_un($socket)) or die "connect to $socket: $!";
92 nstore_fd($packet, \*SOCK) or die "can't send packet: $!";
95 #shoudl trap: Magic number checking on storable file failed at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/fd_retrieve.al) line 337, at /usr/local/share/perl/5.6.1/FS/SelfService.pm line 71
97 #block until there is a message on socket
98 # my $w = new IO::Select;
100 # my @wait = $w->can_read;
101 my $return = fd_retrieve(\*SOCK) or die "error reading result: $!";
102 die $return->{'_error'} if defined $return->{_error} && $return->{_error};
109 FS::SelfService - Freeside self-service API
113 # password and shell account changes
114 use FS::SelfService qw(passwd chfn chsh);
116 # "my account" functionality
117 use FS::SelfService qw( login customer_info invoice cancel payment_info process_payment );
119 my $rv = login( { 'username' => $username,
121 'password' => $password,
125 if ( $rv->{'error'} ) {
126 #handle login error...
129 my $session_id = $rv->{'session_id'};
132 my $customer_info = customer_info( { 'session_id' => $session_id } );
134 #payment_info and process_payment are available in 1.5+ only
135 my $payment_info = payment_info( { 'session_id' => $session_id } );
137 #!!! process_payment example
139 #!!! list_pkgs example
141 #!!! order_pkg example
143 #!!! cancel_pkg example
145 # signup functionality
146 use FS::SelfService qw( signup_info new_customer );
148 my $signup_info = signup_info;
150 $rv = new_customer( {
153 'company' => $company,
154 'address1' => $address1,
155 'address2' => $address2,
159 'country' => $country,
160 'daytime' => $daytime,
164 'payinfo' => $payinfo,
166 'paydate' => $paydate,
167 'payname' => $payname,
168 'invoicing_list' => $invoicing_list,
169 'referral_custnum' => $referral_custnum,
170 'pkgpart' => $pkgpart,
171 'username' => $username,
172 '_password' => $password,
174 'agentnum' => $agentnum,
178 my $error = $rv->{'error'};
179 if ( $error eq '_decline' ) {
189 Use this API to implement your own client "self-service" module.
191 If you just want to customize the look of the existing "self-service" module,
194 =head1 PASSWORD, GECOS, SHELL CHANGING FUNCTIONS
206 =head1 "MY ACCOUNT" FUNCTIONS
212 Creates a user session. Takes a hash reference as parameter with the
225 Returns a hash reference with the following keys:
231 Empty on success, or an error message on errors.
235 Session identifier for successful logins
239 =item customer_info HASHREF
241 Returns general customer information.
243 Takes a hash reference as parameter with a single key: B<session_id>
245 Returns a hash reference with the following keys:
259 Array reference of hash references of open inoices. Each hash reference has
260 the following keys: invnum, date, owed
264 An HTML fragment containing shipping and billing addresses.
266 =item The following fields are also returned: first last company address1 address2 city county state zip country daytime night fax ship_first ship_last ship_company ship_address1 ship_address2 ship_city ship_state ship_zip ship_country ship_daytime ship_night ship_fax payby payinfo payname month year invoicing_list postal_invoicing
270 =item edit_info HASHREF
272 Takes a hash reference as parameter with any of the following keys:
274 first last company address1 address2 city county state zip country daytime night fax ship_first ship_last ship_company ship_address1 ship_address2 ship_city ship_state ship_zip ship_country ship_daytime ship_night ship_fax payby payinfo paycvv payname month year invoicing_list postal_invoicing
276 If a field exists, the customer record is updated with the new value of that
277 field. If a field does not exist, that field is not changed on the customer
280 Returns a hash reference with a single key, B<error>, empty on success, or an
281 error message on errors
283 =item invoice HASHREF
285 Returns an invoice. Takes a hash reference as parameter with two keys:
286 session_id and invnum
288 Returns a hash reference with the following keys:
294 Empty on success, or an error message on errors
306 =item list_invoices HASHREF
308 Returns a list of all customer invoices. Takes a hash references with a single
311 Returns a hash reference with the following keys:
317 Empty on success, or an error message on errors
321 Reference to array of hash references with the following keys:
331 Invoice date, in UNIX epoch time
339 Cancels this customer.
341 Takes a hash reference as parameter with a single key: B<session_id>
343 Returns a hash reference with a single key, B<error>, which is empty on
344 success or an error message on errors.
346 =item payment_info HASHREF
348 Returns information that may be useful in displaying a payment page.
350 Takes a hash reference as parameter with a single key: B<session_id>.
352 Returns a hash reference with the following keys:
358 Empty on success, or an error message on errors
366 Exact name on credit card (CARD/DCRD)
380 Customer's current default payment type.
384 For CARD/DCRD payment types, the card type (Visa card, MasterCard, Discover card, American Express card, etc.)
388 For CARD/DCRD payment types, the card number
392 For CARD/DCRD payment types, expiration month
396 For CARD/DCRD payment types, expiration year
398 =item cust_main_county
400 County/state/country data - array reference of hash references, each of which has the fields of a cust_main_county record (see L<FS::cust_main_county>). Note these are not FS::cust_main_county objects, but hash references of columns and values.
404 Array reference of all states in the current default country.
408 Hash reference of card types; keys are card types, values are the exact strings
409 passed to the process_payment function
413 Unique transaction identifier (prevents multiple charges), passed to the
414 process_payment function
418 =item process_payment HASHREF
420 Processes a payment and possible change of address or payment type. Takes a
421 hash reference as parameter with the following keys:
429 If true, address and card information entered will be saved for subsequent
434 If true, future credit card payments will be done automatically (sets payby to
435 CARD). If false, future credit card payments will be done on-demand (sets
436 payby to DCRD). This option only has meaning if B<save> is set true.
456 Card expiration month
464 Unique transaction identifier, returned from the payment_info function.
465 Prevents multiple charges.
469 Returns a hash reference with a single key, B<error>, empty on success, or an
470 error message on errors
474 Returns package information for this customer.
476 Takes a hash reference as parameter with a single key: B<session_id>
478 Returns a hash reference containing customer package information. The hash reference contains the following keys:
483 =item cust_pkg HASHREF
485 Array reference of hash references, each of which has the fields of a cust_pkg
486 record (see L<FS::cust_pkg>) as well as the fields below. Note these are not
487 the internal FS:: objects, but hash references of columns and values.
489 =item all fields of part_pkg (XXXpare this down to a secure subset)
491 =item part_svc - An array of hash references, each of which has the following keys:
495 =item all fields of part_svc (XXXpare this down to a secure subset)
503 Empty on success, or an error message on errors.
509 Orders a package for this customer.
511 Takes a hash reference as parameter with the following keys:
521 optional svcpart, required only if the package definition does not contain
522 one svc_acct service definition with quantity 1 (it may contain others with
535 Returns a hash reference with a single key, B<error>, empty on success, or an
536 error message on errors. The special error '_decline' is returned for
537 declined transactions.
541 Cancels a package for this customer.
543 Takes a hash reference as parameter with the following keys:
553 Returns a hash reference with a single key, B<error>, empty on success, or an
554 error message on errors.
558 =head1 SIGNUP FUNCTIONS
562 =item signup_info HASHREF
564 Takes a hash reference as parameter with the following keys:
568 =item session_id - Optional agent/reseller interface session
572 Returns a hash reference containing information that may be useful in
573 displaying a signup page. The hash reference contains the following keys:
577 =item cust_main_county
579 County/state/country data - array reference of hash references, each of which has the fields of a cust_main_county record (see L<FS::cust_main_county>). Note these are not FS::cust_main_county objects, but hash references of columns and values.
583 Available packages - array reference of hash references, each of which has the fields of a part_pkg record (see L<FS::part_pkg>). Each hash reference also has an additional 'payby' field containing an array reference of acceptable payment types specific to this package (see below and L<FS::part_pkg/payby>). Note these are not FS::part_pkg objects, but hash references of columns and values. Requires the 'signup_server-default_agentnum' configuration value to be set, or
584 an agentnum specified explicitly via reseller interface session_id in the
589 Array reference of hash references, each of which has the fields of an agent record (see L<FS::agent>). Note these are not FS::agent objects, but hash references of columns and values.
591 =item agentnum2part_pkg
593 Hash reference; keys are agentnums, values are array references of available packages for that agent, in the same format as the part_pkg arrayref above.
597 Access numbers - array reference of hash references, each of which has the fields of an svc_acct_pop record (see L<FS::svc_acct_pop>). Note these are not FS::svc_acct_pop objects, but hash references of columns and values.
599 =item security_phrase
601 True if the "security_phrase" feature is enabled
605 Array reference of acceptable payment types for signup
609 =item CARD (credit card - automatic)
611 =item DCRD (credit card - on-demand - version 1.5+ only)
613 =item CHEK (electronic check - automatic)
615 =item DCHK (electronic check - on-demand - version 1.5+ only)
617 =item LECB (Phone bill billing)
619 =item BILL (billing, not recommended for signups)
621 =item COMP (free, definately not recommended for signups)
623 =item PREPAY (special billing type: applies a credit (see FS::prepay_credit) and sets billing type to BILL)
629 True if CVV features are available (1.5+ or 1.4.2 with CVV schema patch)
633 Hash reference of message catalog values, to support error message customization. Currently available keys are: passwords_dont_match, invalid_card, unknown_card_type, and not_a (as in "Not a Discover card"). Values are configured in the web interface under "View/Edit message catalog".
645 =item new_customer HASHREF
647 Creates a new customer. Takes a hash reference as parameter with the
652 =item first - first name (required)
654 =item last - last name (required)
656 =item ss (not typically collected; mostly used for ACH transactions)
660 =item address1 (required)
664 =item city (required)
668 =item state (required)
672 =item daytime - phone
678 =item payby - CARD, DCRD, CHEK, DCHK, LECB, BILL, COMP or PREPAY (see L</signup_info> (required)
680 =item payinfo - Card number for CARD/DCRD, account_number@aba_number for CHEK/DCHK, prepaid "pin" for PREPAY, purchase order number for BILL
682 =item paycvv - Credit card CVV2 number (1.5+ or 1.4.2 with CVV schema patch)
684 =item paydate - Expiration date for CARD/DCRD
686 =item payname - Exact name on credit card for CARD/DCRD, bank name for CHEK/DCHK
688 =item invoicing_list - comma-separated list of email addresses for email invoices. The special value 'POST' is used to designate postal invoicing (it may be specified alone or in addition to email addresses),
690 =item referral_custnum - referring customer number
692 =item pkgpart - pkgpart of initial package
698 =item sec_phrase - security phrase
700 =item popnum - access number (index, not the literal number)
702 =item agentnum - agent number
706 Returns a hash reference with the following keys:
710 =item error Empty on success, or an error message on errors. The special error '_decline' is returned for declined transactions; other error messages should be suitable for display to the user (and are customizable in under Sysadmin | View/Edit message catalog)
714 =item regionselector HASHREF | LIST
716 Takes as input a hashref or list of key/value pairs with the following keys:
720 =item selected_county
724 =item selected_country
726 =item prefix - Specify a unique prefix string if you intend to use the HTML output multiple time son one page.
728 =item onchange - Specify a javascript subroutine to call on changes
732 =item default_country
734 =item locales - An arrayref of hash references specifying regions. Normally you can just pass the value of the I<cust_main_county> field returned by B<signup_info>.
738 Returns a list consisting of three HTML fragments for county selection,
739 state selection and country selection, respectively.
743 #false laziness w/FS::cust_main_county (this is currently the "newest" version)
751 $param->{'selected_country'} ||= $param->{'default_country'};
752 $param->{'selected_state'} ||= $param->{'default_state'};
754 my $prefix = exists($param->{'prefix'}) ? $param->{'prefix'} : '';
758 my %cust_main_county;
760 # unless ( @cust_main_county ) { #cache
761 #@cust_main_county = qsearch('cust_main_county', {} );
762 #foreach my $c ( @cust_main_county ) {
763 foreach my $c ( @{ $param->{'locales'} } ) {
764 #$countyflag=1 if $c->county;
765 $countyflag=1 if $c->{county};
766 #push @{$cust_main_county{$c->country}{$c->state}}, $c->county;
767 #$cust_main_county{$c->country}{$c->state}{$c->county} = 1;
768 $cust_main_county{$c->{country}}{$c->{state}}{$c->{county}} = 1;
771 $countyflag=1 if $param->{selected_county};
773 my $script_html = <<END;
775 function opt(what,value,text) {
776 var optionName = new Option(text, value, false, false);
777 var length = what.length;
778 what.options[length] = optionName;
780 function ${prefix}country_changed(what) {
781 country = what.options[what.selectedIndex].text;
782 for ( var i = what.form.${prefix}state.length; i >= 0; i-- )
783 what.form.${prefix}state.options[i] = null;
785 #what.form.${prefix}state.options[0] = new Option('', '', false, true);
787 foreach my $country ( sort keys %cust_main_county ) {
788 $script_html .= "\nif ( country == \"$country\" ) {\n";
789 foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
790 my $text = $state || '(n/a)';
791 $script_html .= qq!opt(what.form.${prefix}state, "$state", "$text");\n!;
793 $script_html .= "}\n";
796 $script_html .= <<END;
798 function ${prefix}state_changed(what) {
802 $script_html .= <<END;
803 state = what.options[what.selectedIndex].text;
804 country = what.form.${prefix}country.options[what.form.${prefix}country.selectedIndex].text;
805 for ( var i = what.form.${prefix}county.length; i >= 0; i-- )
806 what.form.${prefix}county.options[i] = null;
809 foreach my $country ( sort keys %cust_main_county ) {
810 $script_html .= "\nif ( country == \"$country\" ) {\n";
811 foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
812 $script_html .= "\nif ( state == \"$state\" ) {\n";
813 #foreach my $county ( sort @{$cust_main_county{$country}{$state}} ) {
814 foreach my $county ( sort keys %{$cust_main_county{$country}{$state}} ) {
815 my $text = $county || '(n/a)';
817 qq!opt(what.form.${prefix}county, "$county", "$text");\n!;
819 $script_html .= "}\n";
821 $script_html .= "}\n";
825 $script_html .= <<END;
830 my $county_html = $script_html;
832 $county_html .= qq!<SELECT NAME="${prefix}county" onChange="$param->{'onchange'}">!;
833 $county_html .= '</SELECT>';
836 qq!<INPUT TYPE="hidden" NAME="${prefix}county" VALUE="$param->{'selected_county'}">!;
839 my $state_html = qq!<SELECT NAME="${prefix}state" !.
840 qq!onChange="${prefix}state_changed(this); $param->{'onchange'}">!;
841 foreach my $state ( sort keys %{ $cust_main_county{$param->{'selected_country'}} } ) {
842 my $text = $state || '(n/a)';
843 my $selected = $state eq $param->{'selected_state'} ? 'SELECTED' : '';
844 $state_html .= "\n<OPTION $selected VALUE=$state>$text</OPTION>"
846 $state_html .= '</SELECT>';
848 $state_html .= '</SELECT>';
850 my $country_html = qq!<SELECT NAME="${prefix}country" !.
851 qq!onChange="${prefix}country_changed(this); $param->{'onchange'}">!;
852 my $countrydefault = $param->{default_country} || 'US';
853 foreach my $country (
854 sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) or $a cmp $b }
855 keys %cust_main_county
857 my $selected = $country eq $param->{'selected_country'} ? ' SELECTED' : '';
858 $country_html .= "\n<OPTION$selected>$country</OPTION>"
860 $country_html .= '</SELECT>';
862 ($county_html, $state_html, $country_html);
866 #=item expselect HASHREF | LIST
868 #Takes as input a hashref or list of key/value pairs with the following keys:
872 #=item prefix - Specify a unique prefix string if you intend to use the HTML output multiple time son one page.
874 #=item date - current date, in yyyy-mm-dd or m-d-yyyy format
878 =item expselect PREFIX [ DATE ]
880 Takes as input a unique prefix string and the current expiration date, in
881 yyyy-mm-dd or m-d-yyyy format
883 Returns an HTML fragments for expiration date selection.
893 #my $prefix = $param->{'prefix'};
894 #my $prefix = exists($param->{'prefix'}) ? $param->{'prefix'} : '';
895 #my $date = exists($param->{'date'}) ? $param->{'date'} : '';
897 my $date = scalar(@_) ? shift : '';
899 my( $m, $y ) = ( 0, 0 );
900 if ( $date =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format
901 ( $m, $y ) = ( $2, $1 );
902 } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
903 ( $m, $y ) = ( $1, $3 );
905 my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
907 $return .= "<OPTION";
908 $return .= " SELECTED" if $_ == $m;
911 $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
913 my $thisYear = $t[5] + 1900;
914 for ( ($thisYear > $y && $y > 0 ? $y : $thisYear) .. 2037 ) {
915 $return .= "<OPTION";
916 $return .= " SELECTED" if $_ == $y;
919 $return .= "</SELECT>";
924 =item popselector HASHREF | LIST
926 Takes as input a hashref or list of key/value pairs with the following keys:
932 =item pops - An arrayref of hash references specifying access numbers. Normally you can just pass the value of the I<svc_acct_pop> field returned by B<signup_info>.
936 Returns an HTML fragment for access number selection.
940 #horrible false laziness with FS/FS/svc_acct_pop.pm::popselector
948 my $popnum = $param->{'popnum'};
949 my $pops = $param->{'pops'};
951 return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
952 return $pops->[0]{city}. ', '. $pops->[0]{state}.
953 ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}. '-'. $pops->[0]{loc}.
954 '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
955 if scalar(@$pops) == 1;
960 push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
961 $popnum2pop{$_->{popnum}} = $_;
966 function opt(what,href,text) {
967 var optionName = new Option(text, href, false, false)
968 var length = what.length;
969 what.options[length] = optionName;
973 my $init_popstate = $param->{'init_popstate'};
974 if ( $init_popstate ) {
975 $text .= '<INPUT TYPE="hidden" NAME="init_popstate" VALUE="'.
976 $init_popstate. '">';
979 function acstate_changed(what) {
980 state = what.options[what.selectedIndex].text;
981 what.form.popac.options.length = 0
982 what.form.popac.options[0] = new Option("Area code", "-1", false, true);
986 my @states = $init_popstate ? ( $init_popstate ) : keys %pop;
987 foreach my $state ( sort { $a cmp $b } @states ) {
988 $text .= "\nif ( state == \"$state\" ) {\n" unless $init_popstate;
990 foreach my $ac ( sort { $a cmp $b } keys %{ $pop{$state} }) {
991 $text .= "opt(what.form.popac, \"$ac\", \"$ac\");\n";
992 if ($ac eq $param->{'popac'}) {
993 $text .= "what.form.popac.options[what.form.popac.length-1].selected = true;\n";
996 $text .= "}\n" unless $init_popstate;
998 $text .= "popac_changed(what.form.popac)}\n";
1001 function popac_changed(what) {
1002 ac = what.options[what.selectedIndex].text;
1003 what.form.popnum.options.length = 0;
1004 what.form.popnum.options[0] = new Option("City", "-1", false, true);
1008 foreach my $state ( @states ) {
1009 foreach my $popac ( keys %{ $pop{$state} } ) {
1010 $text .= "\nif ( ac == \"$popac\" ) {\n";
1012 foreach my $pop ( @{$pop{$state}->{$popac}}) {
1013 my $o_popnum = $pop->{popnum};
1014 my $poptext = $pop->{city}. ', '. $pop->{state}.
1015 ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc};
1017 $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n";
1018 if ($popnum == $o_popnum) {
1019 $text .= "what.form.popnum.options[what.form.popnum.length-1].selected = true;\n";
1027 $text .= "}\n</SCRIPT>\n";
1030 qq!<TABLE CELLPADDING="0"><TR><TD><SELECT NAME="acstate"! .
1031 qq!SIZE=1 onChange="acstate_changed(this)"><OPTION VALUE=-1>State!;
1032 $text .= "<OPTION" . ($_ eq $param->{'acstate'} ? " SELECTED" : "") .
1033 ">$_" foreach sort { $a cmp $b } @states;
1034 $text .= '</SELECT>'; #callback? return 3 html pieces? #'</TD>';
1037 qq!<SELECT NAME="popac" SIZE=1 onChange="popac_changed(this)">!.
1038 qq!<OPTION>Area code</SELECT></TR><TR VALIGN="top">!;
1040 $text .= qq!<TR><TD><SELECT NAME="popnum" SIZE=1 STYLE="width: 20em"><OPTION>City!;
1043 #comment this block to disable initial list polulation
1044 my @initial_select = ();
1045 if ( scalar( @$pops ) > 100 ) {
1046 push @initial_select, $popnum2pop{$popnum} if $popnum2pop{$popnum};
1048 @initial_select = @$pops;
1050 foreach my $pop ( sort { $a->{state} cmp $b->{state} } @initial_select ) {
1051 $text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'.
1052 ( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">".
1053 $pop->{city}. ', '. $pop->{state}.
1054 ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc};
1057 $text .= qq!</SELECT></TD></TR></TABLE>!;
1065 =head1 RESELLER FUNCTIONS
1067 Note: Resellers can also use the B<signup_info> and B<new_customer> functions
1068 with their active session, and the B<customer_info> and B<order_pkg> functions
1069 with their active session and an additonal I<custnum> parameter.
1077 =item agent_list_customers
1085 L<freeside-selfservice-clientd>, L<freeside-selfservice-server>