From a5a258c91c5dc78897d16627b8092385ceb4c4d2 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Nov 2004 18:20:21 +0000 Subject: [PATCH] promo codes and separate signup addresses for hdn --- FS/FS/ClientAPI/Signup.pm | 53 +++- FS/FS/Record.pm | 2 +- FS/FS/cust_pkg.pm | 62 ++--- FS/FS/part_pkg.pm | 3 + FS/bin/freeside-setup | 5 +- README.1.5.0pre7 | 5 + fs_signup/FS-SignupClient/SignupClient.pm | 3 +- fs_signup/FS-SignupClient/cgi/promocode.html | 14 + .../FS-SignupClient/cgi/signup-billaddress.html | 307 +++++++++++++++++++++ fs_signup/FS-SignupClient/cgi/signup.cgi | 186 ++++++++++--- fs_signup/FS-SignupClient/cgi/signup.html | 9 +- httemplate/docs/schema.html | 7 +- httemplate/docs/upgrade10.html | 4 + httemplate/edit/cust_main.cgi | 22 +- httemplate/edit/part_pkg.cgi | 11 +- 15 files changed, 580 insertions(+), 113 deletions(-) create mode 100644 fs_signup/FS-SignupClient/cgi/promocode.html create mode 100755 fs_signup/FS-SignupClient/cgi/signup-billaddress.html diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index bdcd2fbf1..dc627e9bd 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -75,6 +75,8 @@ sub signup_info { 'cvv_enabled' => defined dbdef->table('cust_main')->column('paycvv'), + '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 ) }, @@ -102,11 +104,28 @@ sub signup_info { } } - if ( $agentnum ) { + $signup_info->{'part_pkg'} = []; + if ( $packet->{'promo_code'} ) { + $signup_info->{'part_pkg'} = + [ map { { 'payby' => [ $_->payby ], %{$_->hashref} } } + grep { $_->svcpart('svc_acct') } + qsearch( 'part_pkg', { 'promo_code' => { + op=>'ILIKE', + value=>$packet->{'promo_code'} + }, + 'disabled' => '', } ) + ]; + + $signup_info->{'error'} = 'Unknown promotional code' + unless @{ $signup_info->{'part_pkg'} }; + } + + if ( $agentnum && ! @{ $signup_info->{'part_pkg'} } ) { $signup_info->{'part_pkg'} = $signup_info->{'agentnum2part_pkg'}{$agentnum}; - } else { - delete $signup_info->{'part_pkg'}; } + # else { + # delete $signup_info->{'part_pkg'}; + #} if ( $session ) { my $agent_signup_info = { %$signup_info }; @@ -158,10 +177,17 @@ sub new_customer { || $conf->config('signup_server-default_refnum'), map { $_ => $packet->{$_} } qw( - last first ss company address1 address2 city county state zip country - daytime night fax payby payinfo paycvv paydate payname referral_custnum - comments - ), + + last first ss company address1 address2 + city county state zip country + daytime night fax + + ship_last ship_first ship_ss ship_company ship_address1 ship_address2 + ship_city ship_county ship_state ship_zip ship_country + ship_daytime ship_night ship_fax + + payby payinfo paycvv paydate payname referral_custnum comments + ) } ); @@ -185,10 +211,11 @@ sub new_customer { my $cust_pkg = new FS::cust_pkg ( { #later#'custnum' => $custnum, - 'pkgpart' => $packet->{'pkgpart'}, + 'pkgpart' => $packet->{'pkgpart'}, + 'promo_code' => $packet->{'promo_code'}, } ); - my $error = $cust_pkg->check; - return { 'error' => $error } if $error; + #my $error = $cust_pkg->check; + #return { 'error' => $error } if $error; my $svc_acct = new FS::svc_acct ( { 'svcpart' => $svcpart, @@ -214,15 +241,15 @@ sub new_customer { my $y = $svc_acct->setdefault; # arguably should be in new method return { 'error' => $y } if $y && !ref($y); - $error = $svc_acct->check; - return { 'error' => $error } if $error; + #$error = $svc_acct->check; + #return { 'error' => $error } if $error; #setup a job dependancy to delay provisioning my $placeholder = new FS::queue ( { 'job' => 'FS::ClientAPI::Signup::__placeholder', 'status' => 'locked', } ); - $error = $placeholder->insert; + my $error = $placeholder->insert; return { 'error' => $error } if $error; use Tie::RefHash; diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index f0026d5d2..5a6bb579e 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -1424,7 +1424,7 @@ on the column first. sub ut_foreign_key { my( $self, $field, $table, $foreign ) = @_; qsearchs($table, { $foreign => $self->getfield($field) }) - or return "Can't find $field ". $self->getfield($field). + or return "Can't find ". $self->table. ".$field ". $self->getfield($field). " in $table.$foreign"; ''; } diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 3bce653b5..1f1ae4090 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -145,32 +145,9 @@ sub table { 'cust_pkg'; } Adds this billing item to the database ("Orders" the item). If there is an error, returns the error, otherwise returns false. -=cut - -sub insert { - my $self = shift; - - # custnum might not have have been defined in sub check (for one-shot new - # customers), so check it here instead - # (is this still necessary with transactions?) - - my $error = $self->ut_number('custnum'); - return $error if $error; - - my $cust_main = $self->cust_main; - return "Unknown custnum: ". $self->custnum unless $cust_main; - - unless ( $disable_agentcheck ) { - my $agent = qsearchs( 'agent', { 'agentnum' => $cust_main->agentnum } ); - my $pkgpart_href = $agent->pkgpart_hashref; - return "agent ". $agent->agentnum. - " can't purchase pkgpart ". $self->pkgpart - unless $pkgpart_href->{ $self->pkgpart }; - } - - $self->SUPER::insert; - -} +If the additional field I is defined instead of I, it +will be used to look up the package definition and agent restrictions will be +ignored. =item delete @@ -233,8 +210,8 @@ sub check { my $error = $self->ut_numbern('pkgnum') - || $self->ut_numbern('custnum') - || $self->ut_number('pkgpart') + || $self->ut_foreign_key('custnum', 'cust_main', 'custnum') + || $self->ut_numbern('pkgpart') || $self->ut_numbern('setup') || $self->ut_numbern('bill') || $self->ut_numbern('susp') @@ -242,12 +219,31 @@ sub check { ; return $error if $error; - if ( $self->custnum ) { - return "Unknown customer ". $self->custnum unless $self->cust_main; - } + if ( $self->promo_code ) { + + my $promo_part_pkg = + qsearchs('part_pkg', { + 'pkgpart' => $self->pkgpart, + 'promo_code' => { op=>'ILIKE', value=>$self->promo_code }, + } ); + return 'Unknown promotional code' unless $promo_part_pkg; + $self->pkgpart($promo_part_pkg->pkgpart); + + } else { + + unless ( $disable_agentcheck ) { + my $agent = + qsearchs( 'agent', { 'agentnum' => $self->cust_main->agentnum } ); + my $pkgpart_href = $agent->pkgpart_hashref; + return "agent ". $agent->agentnum. + " can't purchase pkgpart ". $self->pkgpart + unless $pkgpart_href->{ $self->pkgpart }; + } - return "Unknown pkgpart: ". $self->pkgpart - unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); + $error = $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart' ); + return $error if $error; + + } $self->otaker(getotaker) unless $self->otaker; $self->otaker =~ /^([\w\.\-]{0,16})$/ or return "Illegal otaker"; diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index d7cc3cb34..2f3cb8b8b 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -54,6 +54,8 @@ inherits from FS::Record. The following fields are currently supported: =item comment - Text name of this package definition (non-customer-viewable) +=item promo_code - Promotional code + =item setup - Setup fee expression (deprecated) =item freq - Frequency of recurring fee @@ -288,6 +290,7 @@ sub check { my $error = $self->ut_numbern('pkgpart') || $self->ut_text('pkg') || $self->ut_text('comment') + || $self->ut_textn('promo_code') || $self->ut_alphan('plan') || $self->ut_enum('setuptax', [ '', 'Y' ] ) || $self->ut_enum('recurtax', [ '', 'Y' ] ) diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 288b08663..49953b8f7 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -680,6 +680,7 @@ sub tables_hash_hack { 'pkgpart', 'serial', '', '', 'pkg', 'varchar', '', $char_d, 'comment', 'varchar', '', $char_d, + 'promo_code', 'varchar', 'NULL', $char_d, 'setup', @perl_type, 'freq', 'varchar', '', $char_d, #billing frequency 'recur', @perl_type, @@ -691,8 +692,8 @@ sub tables_hash_hack { 'taxclass', 'varchar', 'NULL', $char_d, ], 'primary_key' => 'pkgpart', - 'unique' => [], - 'index' => [ [ 'disabled' ], ], + 'unique' => [ [ 'promo_code' ] ], + 'index' => [ [ 'disabled' ] ], }, # 'part_title' => { diff --git a/README.1.5.0pre7 b/README.1.5.0pre7 index 074f3a5bf..cd7e5a266 100644 --- a/README.1.5.0pre7 +++ b/README.1.5.0pre7 @@ -31,6 +31,11 @@ CREATE TABLE rate_prefix ( CREATE INDEX rate_prefix1 ON rate_prefix ( countrycode ); CREATE INDEX rate_prefix2 ON rate_prefix ( regionnum ); +ALTER TABLE part_pkg ADD promo_code varchar(80) NULL; +ALTER TABLE h_part_pkg ADD promo_code varchar(80) NULL; +CREATE INDEX part_pkg2 ON part_pkg ( promo_code ); +CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code ); + dbdef-create username create-history-tables username rate rate_detail rate_region rate_prefix dbdef-create username diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm index 284fdddfe..d6730301c 100644 --- a/fs_signup/FS-SignupClient/SignupClient.pm +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -196,7 +196,8 @@ sub popselector { =head1 BUGS This is just a wrapper around FS::SelfService functions for backwards -compatibility and will probably be deprecated soon. +compatibility. It is only necessary if you're using a signup.cgi from before +1.5.0pre7. =head1 SEE ALSO diff --git a/fs_signup/FS-SignupClient/cgi/promocode.html b/fs_signup/FS-SignupClient/cgi/promocode.html new file mode 100644 index 000000000..f8ee7f6eb --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/promocode.html @@ -0,0 +1,14 @@ +ISP Signup +ISP Signup - promotional code

+ +
+Enter promotional code + + +
+ + diff --git a/fs_signup/FS-SignupClient/cgi/signup-billaddress.html b/fs_signup/FS-SignupClient/cgi/signup-billaddress.html new file mode 100755 index 000000000..3cf9d2505 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/signup-billaddress.html @@ -0,0 +1,307 @@ +ISP Signup form + + +ISP Signup form

+<%= $error %> +
+ + + +Where did you hear about our service?

+Billing Address (where credit card statement is sent) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Exact name on card
(last, first)
, +
Company
*Address
 
*City*State/Country + <%= + ($county_html, $state_html, $country_html) = + regionselector( $county, $state, $country, '', 'changed(this)' ); + + "$county_html $state_html"; + %> + *Zip
*Country<%= $country_html %>
Day Phone
Night Phone
Fax
+ + + +

+Service Address +(>same as billing address)
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Contact name
(last, first)
, +
Company
*Address
 
*City*State/Country + <%= + ($ship_county_html, $ship_state_html, $ship_country_html) = + regionselector( $ship_county, + $ship_state, + $ship_country, + 'ship_', + 'changed(this)', + ); + + "$ship_county_html $ship_state_html"; + %> + *Zip
*Country<%= $ship_country_html %>
Day Phone
Night Phone
Fax
+ +* required fields
+ +
Billing information + + +<%= scalar(@payby) > 1 ? '' : '' %> +
+ + <%= + $OUT .= ' + + Postal mail invoice +
Email invoice +
Billing type
+ + + + <%= + + my $cardselect = ''; + + my %payby = ( + 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD"), #. qq!
*Name on card
!, + 'DCRD' => qq!Credit card
*$cardselect
*Exp !. expselect("DCRD"), #. qq!
*Name on card
!, + 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'DCHK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), + 'PREPAY' => qq!Prepaid card
*!, + ); + + if ( $init_data->{'cvv_enabled'} ) { + foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 + $payby{$payby} .= qq!
CVV2 (help!; + } + } + + my( $account, $aba ) = split('@', $payinfo); + my %paybychecked = ( + 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD", $paydate), #. qq!
*Name on card
!, + 'DCRD' => qq!Credit card
*$cardselect
*Exp !. expselect("DCRD", $paydate), #. qq!
*Name on card
!, + 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'DCHK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", $paydate). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), + 'PREPAY' => qq!Prepaid card
*!, + ); + + if ( $init_data->{'cvv_enabled'} ) { + foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 + $paybychecked{$payby} .= qq!
CVV2 (help!; + } + } + + for (@payby) { + if ( scalar(@payby) == 1) { + $OUT .= '"; + } else { + $OUT .= qq!!; + } else { + $OUT .= qq!> $payby{$_}!; + } + + } + } + %> + +
'. + qq!!. + "$paybychecked{$_} $paybychecked{$_}
* required fields for each billing type +

First package + + + + + + + + + + + + + + + + + +<%= + if ( $init_data->{'security_phrase'} ) { + $OUT .= < + + + +ENDOUT + } else { + $OUT .= ''; + } +%> +<%= + if ( scalar(@$pops) ) { + $OUT .= ''; + } else { + $OUT .= popselector($popnum); + } +%> +
Username
Password
Re-enter Password
Security Phrase +
Access number'. + popselector($popnum). '
+

+
diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 4f9efff98..a1b9ed427 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,14 +1,22 @@ #!/usr/bin/perl -T #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.52 2004-10-01 01:38:02 ivan Exp $ +# $Id: signup.cgi,v 1.53 2004-11-22 18:20:21 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops %pop %popnum2pop $init_data $error - $last $first $ss $company $address1 $address2 $city $state $county - $country $zip $daytime $night $fax $invoicing_list $payby $payinfo + + $last $first $ss $company $address1 + $address2 $city $state $county + $country $zip $daytime $night $fax + + $ship_last $ship_first $ship_ss $ship_company $ship_address1 + $ship_address2 $ship_city $ship_state $ship_county + $ship_country $ship_zip $ship_daytime $ship_night $ship_fax + + $invoicing_list $payby $payinfo $paycvv $paydate $payname $referral_custnum $init_popstate $pkgpart $username $password $password2 $sec_phrase $popnum $agentnum $refnum @@ -21,14 +29,14 @@ use vars qw( @payby $cgi $locales $packages $self_url ); use subs qw( print_form print_okay print_decline - success_default decline_default ); + success_default decline_default + ); use CGI; #use CGI::Carp qw(fatalsToBrowser); use Text::Template; use Business::CreditCard; use HTTP::BrowserDetect; -use FS::SignupClient 0.03 qw( signup_info new_customer - regionselector expselect popselector); +use FS::SelfService qw( signup_info new_customer expselect ); #acceptable payment methods # @@ -124,8 +132,13 @@ if ( -e $decline_html ) { or die $Text::Template::ERROR; } +$cgi = new CGI; -( $locales, $packages, $pops, $init_data ) = signup_info(); +$init_data = signup_info( 'promo_code' => $cgi->param('promo_code') ); +$error = $init_data->{'error'}; +$locales = $init_data->{'cust_main_county'}; +$packages = $init_data->{'part_pkg'}; +$pops = $init_data->{'svc_acct_pop'}; @payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}}; $packages = $init_data->{agentnum2part_pkg}{$agentnum} if $agentnum; %pop = (); @@ -135,8 +148,6 @@ foreach (@$pops) { $popnum2pop{$_->{popnum}} = $_; } -$cgi = new CGI; - if ( defined $cgi->param('magic') ) { if ( $cgi->param('magic') eq 'process' ) { @@ -193,6 +204,22 @@ if ( defined $cgi->param('magic') ) { $daytime = $cgi->param('daytime'); $night = $cgi->param('night'); $fax = $cgi->param('fax'); + + $ship_last = $cgi->param('ship_last'); + $ship_first = $cgi->param('ship_first'); + $ship_ss = $cgi->param('ship_ss'); + $ship_company = $cgi->param('ship_company'); + $ship_address1 = $cgi->param('ship_address1'); + $ship_address2 = $cgi->param('ship_address2'); + $ship_city = $cgi->param('ship_city'); + #$ship_county, + #$ship_state, + $ship_zip = $cgi->param('ship_zip'); + #$ship_country, + $ship_daytime = $cgi->param('ship_daytime'); + $ship_night = $cgi->param('ship_night'); + $ship_fax = $cgi->param('ship_fax'); + #$payby, #$payinfo, #$paydate, @@ -228,37 +255,56 @@ if ( defined $cgi->param('magic') ) { or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type'); } - $error ||= new_customer ( { - 'last' => $last, - 'first' => $first, - 'ss' => $ss, - 'company' => $company, - 'address1' => $address1, - 'address2' => $address2, - 'city' => $city, - 'county' => $county, - 'state' => $state, - 'zip' => $zip, - 'country' => $country, - 'daytime' => $daytime, - 'night' => $night, - 'fax' => $fax, - 'payby' => $payby, - 'payinfo' => $payinfo, - 'paycvv' => $paycvv, - 'paydate' => $paydate, - 'payname' => $payname, - 'invoicing_list' => $invoicing_list, - 'referral_custnum' => $referral_custnum, - 'pkgpart' => $pkgpart, - 'username' => $username, - 'sec_phrase' => $sec_phrase, - '_password' => $password, - 'popnum' => $popnum, - 'agentnum' => $agentnum, - 'refnum' => $refnum, - map { $_ => $cgi->param($_) } grep { /^snarf_/ } $cgi->param - } ); + unless ( $error ) { + + my $r = new_customer ( { + 'last' => $last, + 'first' => $first, + 'ss' => $ss, + 'company' => $company, + 'address1' => $address1, + 'address2' => $address2, + 'city' => $city, + 'county' => $county, + 'state' => $state, + 'zip' => $zip, + 'country' => $country, + 'daytime' => $daytime, + 'night' => $night, + 'fax' => $fax, + 'ship_last' => $ship_last, + 'ship_first' => $ship_first, + 'ship_company' => $ship_company, + 'ship_address1' => $ship_address1, + 'ship_address2' => $ship_address2, + 'ship_city' => $ship_city, + 'ship_county' => $ship_county, + 'ship_state' => $ship_state, + 'ship_zip' => $ship_zip, + 'ship_country' => $ship_country, + 'ship_daytime' => $ship_daytime, + 'ship_night' => $ship_night, + 'ship_fax' => $ship_fax, + 'payby' => $payby, + 'payinfo' => $payinfo, + 'paycvv' => $paycvv, + 'paydate' => $paydate, + 'payname' => $payname, + 'invoicing_list' => $invoicing_list, + 'referral_custnum' => $referral_custnum, + 'promo_code' => $cgi->param('promo_code'), + 'pkgpart' => $pkgpart, + 'username' => $username, + 'sec_phrase' => $sec_phrase, + '_password' => $password, + 'popnum' => $popnum, + 'agentnum' => $agentnum, + 'refnum' => $refnum, + map { $_ => $cgi->param($_) } grep { /^snarf_/ } $cgi->param + } ); + $error ||= $r->{'error'}; + + } } @@ -277,7 +323,7 @@ if ( defined $cgi->param('magic') ) { die "unrecognized magic: ". $cgi->param('magic'); } } else { - $error = ''; + #$error = ''; $last = ''; $first = ''; $ss = ''; @@ -292,6 +338,19 @@ if ( defined $cgi->param('magic') ) { $daytime = ''; $night = ''; $fax = ''; + $ship_last = ''; + $ship_first = ''; + $ship_company = ''; + $ship_address1 = ''; + $ship_address2 = ''; + $ship_city = ''; + $ship_state = $init_data->{statedefault}; + $ship_county = ''; + $ship_country = $init_data->{countrydefault}; + $ship_zip = ''; + $ship_daytime = ''; + $ship_night = ''; + $ship_fax = ''; $invoicing_list = ''; $payby = ''; $payinfo = ''; @@ -331,17 +390,17 @@ sub print_okay { my $user_agent = new HTTP::BrowserDetect $ENV{HTTP_USER_AGENT}; $cgi->param('username') =~ /^(.+)$/ - or die "fatal: invalid username got past FS::SignupClient::new_customer"; + or die "fatal: invalid username got past FS::SelfService::new_customer"; my $username = $1; $cgi->param('_password') =~ /^(.+)$/ - or die "fatal: invalid password got past FS::SignupClient::new_customer"; + or die "fatal: invalid password got past FS::SelfService::new_customer"; my $password = $1; ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/ - or die "fatal: invalid email_name got past FS::SignupClient::new_customer"; + or die "fatal: invalid email_name got past FS::SelfService::new_customer"; $email_name = $1; #global for template my $pop = $popnum2pop{$cgi->param('popnum')}; - #or die "fatal: invalid popnum got past FS::SignupClient::new_customer"; + #or die "fatal: invalid popnum got past FS::SelfService::new_customer"; if ( $pop ) { ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} ); } else { @@ -387,3 +446,40 @@ support. END } +# subs for the templates... + +=item regionselector SELECTED_COUNTY, SELECTED_STATE, SELECTED_COUNTRY, PREFIX, ONCHANGE + +=cut + +sub regionselector { + my ( $selected_county, $selected_state, $selected_country, + $prefix, $onchange ) = @_; + signup_info() unless $init_data; + FS::SelfService::regionselector({ + selected_county => $selected_county, + selected_state => $selected_state, + selected_country => $selected_country, + prefix => $prefix, + onchange => $onchange, + default_country => $init_data->{countrydefault}, + locales => $init_data->{cust_main_county}, + }); + #default_state => $init_data->{statedefault}, +} + +=item popselector + +=cut + +sub popselector { + my( $popnum ) = @_; + signup_info() unless $init_data; + FS::SelfService::popselector({ + popnum => $popnum, + pops => $init_data->{svc_acct_pop}, + }); + #popac => + #acstate => +} + diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html index a6cbf2146..c0e4f73eb 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.html +++ b/fs_signup/FS-SignupClient/cgi/signup.html @@ -167,14 +167,17 @@ Contact Information * required fields for each billing type

First package - +
- END @@ -181,10 +181,10 @@ if ( $conf->exists('show_ss') ) { print < - - - - + + +!; +print qq!!; my($daytime,$night,$fax)=( $cust_main->daytime, $cust_main->night, $cust_main->fax, + '', + 'changed(this)', ); my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; @@ -216,9 +218,9 @@ my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; print < - - - + + + END print "
+ , +
Company
${r}Address
 
${r}City${r}State +
Company
${r}Address
 
${r}City${r}State END #false laziness with ship state @@ -203,12 +203,14 @@ my($county_html, $state_html, $country_html) = print "$county_html $state_html"; -print qq!${r}Zip
${r}Zip
${r}Country$country_html
$daytime_label
$night_label
Fax
$daytime_label
$night_label
Fax
${r}required fields
"; diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index dc2992459..b3c389c9d 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -93,7 +93,12 @@ Package information - + + Promotional code + + + + Disable new orders @@ -257,7 +262,9 @@ my $widget = new HTML::Widgets::SelectLayers( 'options' => \%options, 'form_name' => 'dummy', 'form_action' => 'process/part_pkg.cgi', - 'form_text' => [ qw(pkg comment clone pkgnum pkgpart), @fixups ], + 'form_text' => [ qw(pkg comment promo_code clone pkgnum pkgpart), + @fixups + ], 'form_checkbox' => [ qw(setuptax recurtax disabled) ], 'form_radio' => \@form_radio, 'form_select' => \@form_select, -- 2.11.0