diff options
Diffstat (limited to 'httemplate/edit/cust_main')
-rw-r--r-- | httemplate/edit/cust_main/billing.html | 631 | ||||
-rw-r--r-- | httemplate/edit/cust_main/contact.html | 141 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-country.html | 59 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-county.html | 82 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-state.html | 25 |
5 files changed, 473 insertions, 465 deletions
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 790f41f00..78a2002a4 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,70 +1,71 @@ -<% - -my( $cust_main, %options ) = @_; -my @invoicing_list = @{ $options{'invoicing_list'} }; -my $conf = new FS::Conf; -my $payby_default = $conf->config('payby-default'); - -my @payby = grep /\w/, $conf->config('payby'); -#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) -@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) - unless @payby; - -if ( $payby_default eq 'HIDE' ) { - - $cust_main->payby('BILL') unless $cust_main->payby; - -%> - - <INPUT TYPE="hidden" NAME="select" VALUE="<%= $cust_main->payby %>"> +% +% +%my( $cust_main, %options ) = @_; +%my @invoicing_list = @{ $options{'invoicing_list'} }; +%my $conf = new FS::Conf; +%my $payby_default = $conf->config('payby-default'); +% +%my @payby = grep /\w/, $conf->config('payby'); +%#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +%@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) +% unless @payby; +% +%if ( $payby_default eq 'HIDE' ) { +% +% $cust_main->payby('BILL') unless $cust_main->payby; +% +% + + + <INPUT TYPE="hidden" NAME="select" VALUE="<% $cust_main->payby %>"> </FORM> - <FORM NAME="<%= $cust_main->payby %>" STYLE="margin-top: 0; margin-bottom: 0"> <% # XXX key %> - - <% foreach my $field (qw( payinfo payname paycvv paystart_month paystart_year payissue payip )) { %> + <FORM NAME="<% $cust_main->payby %>" STYLE="margin-top: 0; margin-bottom: 0"> +% # XXX key +% foreach my $field (qw( payinfo payname paycvv paystart_month paystart_year payissue payip )) { - <INPUT TYPE="hidden" NAME="<%= $field %>" VALUE="<%= $cust_main->getfield($field) %>"> - <% } %> + <INPUT TYPE="hidden" NAME="<% $field %>" VALUE="<% $cust_main->getfield($field) %>"> +% } +% +% #false laziness w/elements/select-month_year.html & view/cust_main/billing.html +% my( $mon, $year ); +% my $date = $cust_main->paydate || '12-2037'; +% if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format +% ( $mon, $year ) = ( $2, $1 ); +% } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { +% ( $mon, $year ) = ( $1, $3 ); +% } else { +% die "unrecognized expiration date format: $date"; +% } +% - <% - #false laziness w/elements/select-month_year.html & view/cust_main/billing.html - my( $mon, $year ); - my $date = $cust_main->paydate || '12-2037'; - if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format - ( $mon, $year ) = ( $2, $1 ); - } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { - ( $mon, $year ) = ( $1, $3 ); - } else { - die "unrecognized expiration date format: $date"; - } - %> - <INPUT TYPE="hidden" NAME="exp_month" VALUE="<%= $mon %>"> - <INPUT TYPE="hidden" NAME="exp_year" VALUE="<%= $year %>"> + <INPUT TYPE="hidden" NAME="exp_month" VALUE="<% $mon %>"> + <INPUT TYPE="hidden" NAME="exp_year" VALUE="<% $year %>"> </FORM> <FORM NAME="billing_bottomform" STYLE="margin-top: 0; margin-bottom: 0"> - <INPUT TYPE="hidden" NAME="tax" VALUE="<%= $cust_main->tax %>"> + <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax %>"> - <INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<%= join(', ', @invoicing_list) %>"> + <INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<% join(', ', @invoicing_list) %>"> </FORM> +% } else { +% +% my $r = qq!<font color="#ff0000">*</font> !; +% +% -<% } else { - - my $r = qq!<font color="#ff0000">*</font> !; - -%> <BR>Billing information - <%= &ntable("#cccccc") %> + <% &ntable("#cccccc") %> <TR> - <TD ALIGN="right" WIDTH="200"><%=$r%>Billing type</TD> + <TD ALIGN="right" WIDTH="200"><%$r%>Billing type</TD> <SCRIPT> @@ -133,274 +134,274 @@ if ( $payby_default eq 'HIDE' ) { +'<div>[iframe not supported]</div></iframe>'); } </SCRIPT> - - <% - - my($payby, $payinfo, $payname)=( - $cust_main->payby, - $cust_main->payinfo, - $cust_main->payname, - ); - my( $account, $aba ) = split('@', $payinfo); - - my $disabled = 'DISABLED style="background-color: #dddddd"'; - my $text_disabled = 'style="color: #999999"'; - if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) { - $disabled = 'style="background-color: #ffffff"'; - $text_disabled = 'style="color: #000000";' - } - - my %payby = ( - - 'CARD' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Card number </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $payinfo : '' ). qq!" MAXLENGTH=19 onChange="card_changed(this)" onKeyUp="card_changed(this)"></TD></TR>!. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!. - '<TD WIDTH="408">'. - - include('/elements/select-month_year.html', - 'prefix' => 'exp', - 'selected_date' => - ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), - ). - - '</TD></TR>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">CVV2 !. - - qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!. - qq!</TD>!. - '<TD WIDTH="408"><INPUT TYPE="text" NAME="paycvv" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paycvv : '' ). '" SIZE=4 MAXLENGTH=4>'. - - - qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>Start date </SPAN></TD>!. - '<TD WIDTH="408">'. - - include('/elements/select-month_year.html', - 'prefix' => 'paystart', - 'disabled' => $disabled, - 'empty_option' => 1, - 'start_year' => 2000, - 'end_year' => (localtime())[5] + 1900, - 'selected_date' => ( - ( $payby =~ /^(CARD|DCRD)$/ - && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) - ? $cust_main->paystart_month. '-'. - $cust_main->paystart_year - : '' - ) - ). - - qq!<SPAN ID="payissue_label" $text_disabled> or Issue number </SPAN>!. - '<INPUT TYPE="text" NAME="payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Exact name on card </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!. - - qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCRD' ? '' : 'CHECKED' ). '> Charge future payments to this card automatically</TD></TR>'. - - '</TABLE>', - - 'CHEK' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Account number </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD></TR>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}ABA/Routing number </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !. - qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!. - qq!</TD></TR>!. - - qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!. - qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Bank name </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!. - - qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCHK' ? '' : 'CHECKED' ). '> Charge future payments to this electronic check automatically</TD></TR>'. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - 'LECB' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Phone number </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!. - - qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!. - qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!. - qq!<INPUT TYPE="hidden" NAME="payname" VALUE="">!. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - 'BILL' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">P.O. </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!. - - qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!. - qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!. - - qq!<TR><TD ALIGN="right" WIDTH="200">Attention </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - 'COMP' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Approved by </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE=""></TD></TR>!. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!. - '<TD WIDTH="408">'. - - include('/elements/select-month_year.html', - 'prefix' => 'exp', - 'selected_date' => - ( $payby eq 'COMP' ? $cust_main->paydate : '' ), - ). - - '</TD></TR>'. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - 'CASH' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - 'WEST' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - 'MCRD' => - - '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. - - qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. - qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'MCRD' ? $cust_main->paid : '' ). qq!"></TD></TR>!. - - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - '<TR><TD> </TD></TR>'. - - '</TABLE>', - - ); - - #this should use FS::payby - my %allopt = ( - 'CARD' => 'Credit card', - 'CHEK' => 'Electronic check', - 'LECB' => 'Phone bill billing', - 'BILL' => 'Billing', - 'CASH' => 'Cash', # initial payment, then billing', - 'WEST' => 'Western Union', # initial payment, then billing', - 'MCRD' => 'Manual credit card', # initial payment, then billing', - 'COMP' => 'Complimentary', - ); - if ( $cust_main->custnum ) { #don't offer CASH/WEST/MCRD initial payment types - # when editing customer - delete $allopt{$_} for qw(CASH WEST MCRD); - } - - tie my %options, 'Tie::IxHash', - map { $_ => $allopt{$_} } - grep { exists $allopt{$_} } - @payby; - - my %payby2option = ( - ( map { $_ => $_ } keys %options ), - 'DCRD' => 'CARD', - 'DCHK' => 'CHEK', - ); - - my $widget = new HTML::Widgets::SelectLayers( - 'options' => \%options, - #'form_name' => 'dummy', - #'form_action' => 'nothingyet', - #chops bottom of page in IE# 'under_position' => 'absolute', - 'html_between' => '</TD></TR></TABLE>', - 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] }, - 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, - ); - - %> - - <TD WIDTH="408"><%= $widget->html %> +% +% +% my($payby, $payinfo, $payname)=( +% $cust_main->payby, +% $cust_main->payinfo, +% $cust_main->payname, +% ); +% my( $account, $aba ) = split('@', $payinfo); +% +% my $disabled = 'DISABLED style="background-color: #dddddd"'; +% my $text_disabled = 'style="color: #999999"'; +% if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) { +% $disabled = 'style="background-color: #ffffff"'; +% $text_disabled = 'style="color: #000000";' +% } +% +% my %payby = ( +% +% 'CARD' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Card number </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $payinfo : '' ). qq!" MAXLENGTH=19 onChange="card_changed(this)" onKeyUp="card_changed(this)"></TD></TR>!. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!. +% '<TD WIDTH="408">'. +% +% include('/elements/select-month_year.html', +% 'prefix' => 'exp', +% 'selected_date' => +% ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), +% ). +% +% '</TD></TR>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">CVV2 !. +% +% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!. +% qq!</TD>!. +% '<TD WIDTH="408"><INPUT TYPE="text" NAME="paycvv" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paycvv : '' ). '" SIZE=4 MAXLENGTH=4>'. +% +% +% qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>Start date </SPAN></TD>!. +% '<TD WIDTH="408">'. +% +% include('/elements/select-month_year.html', +% 'prefix' => 'paystart', +% 'disabled' => $disabled, +% 'empty_option' => 1, +% 'start_year' => 2000, +% 'end_year' => (localtime())[5] + 1900, +% 'selected_date' => ( +% ( $payby =~ /^(CARD|DCRD)$/ +% && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) +% ? $cust_main->paystart_month. '-'. +% $cust_main->paystart_year +% : '' +% ) +% ). +% +% qq!<SPAN ID="payissue_label" $text_disabled> or Issue number </SPAN>!. +% '<INPUT TYPE="text" NAME="payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Exact name on card </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!. +% +% qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCRD' ? '' : 'CHECKED' ). '> Charge future payments to this card automatically</TD></TR>'. +% +% '</TABLE>', +% +% 'CHEK' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Account number </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD></TR>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}ABA/Routing number </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !. +% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!. +% qq!</TD></TR>!. +% +% qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!. +% qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Bank name </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!. +% +% qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCHK' ? '' : 'CHECKED' ). '> Charge future payments to this electronic check automatically</TD></TR>'. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% 'LECB' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Phone number </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!. +% +% qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!. +% qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!. +% qq!<INPUT TYPE="hidden" NAME="payname" VALUE="">!. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% 'BILL' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">P.O. </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!. +% +% qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!. +% qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">Attention </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% 'COMP' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Approved by </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE=""></TD></TR>!. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!. +% '<TD WIDTH="408">'. +% +% include('/elements/select-month_year.html', +% 'prefix' => 'exp', +% 'selected_date' => +% ( $payby eq 'COMP' ? $cust_main->paydate : '' ), +% ). +% +% '</TD></TR>'. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% 'CASH' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% 'WEST' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% 'MCRD' => +% +% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. +% +% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'MCRD' ? $cust_main->paid : '' ). qq!"></TD></TR>!. +% +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% '<TR><TD> </TD></TR>'. +% +% '</TABLE>', +% +% ); +% +% #this should use FS::payby +% my %allopt = ( +% 'CARD' => 'Credit card', +% 'CHEK' => 'Electronic check', +% 'LECB' => 'Phone bill billing', +% 'BILL' => 'Billing', +% 'CASH' => 'Cash', # initial payment, then billing', +% 'WEST' => 'Western Union', # initial payment, then billing', +% 'MCRD' => 'Manual credit card', # initial payment, then billing', +% 'COMP' => 'Complimentary', +% ); +% if ( $cust_main->custnum ) { #don't offer CASH/WEST/MCRD initial payment types +% # when editing customer +% delete $allopt{$_} for qw(CASH WEST MCRD); +% } +% +% tie my %options, 'Tie::IxHash', +% map { $_ => $allopt{$_} } +% grep { exists $allopt{$_} } +% @payby; +% +% my %payby2option = ( +% ( map { $_ => $_ } keys %options ), +% 'DCRD' => 'CARD', +% 'DCHK' => 'CHEK', +% ); +% +% my $widget = new HTML::Widgets::SelectLayers( +% 'options' => \%options, +% #'form_name' => 'dummy', +% #'form_action' => 'nothingyet', +% #chops bottom of page in IE# 'under_position' => 'absolute', +% 'html_between' => '</TD></TR></TABLE>', +% 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] }, +% 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, +% ); +% +% + + + <TD WIDTH="408"><% $widget->html %> <FORM NAME="billing_bottomform" STYLE="margin-top: 0; margin-bottom: 0"> - <%= &ntable("#cccccc") %> + <% &ntable("#cccccc") %> <TR><TD> </TD></TR> <TR> - <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <%= $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt</TD> + <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt</TD> </TR> <TR> - <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%= + <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <% ( ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') @@ -417,7 +418,7 @@ if ( $payby_default eq 'HIDE' ) { </TR> <TR> - <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <%= + <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'CHECKED' @@ -430,22 +431,24 @@ if ( $payby_default eq 'HIDE' ) { <TR> <TD ALIGN="right" WIDTH="200">Email invoice </TD> - <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD> + <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD> </TR> +% if ( $conf->exists('voip-cust_cdr_spools') ) { - <% if ( $conf->exists('voip-cust_cdr_spools') ) { %> <TR> - <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <%= $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRs</TD> + <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <% $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRs</TD> </TR> - <% } else { %> - <INPUT TYPE="hidden" NAME="spool_cdr" VALUE="<%= $cust_main->spool_cdr %>"> - <% } %> +% } else { + + <INPUT TYPE="hidden" NAME="spool_cdr" VALUE="<% $cust_main->spool_cdr %>"> +% } + </TABLE> </FORM> - <%= $r %> required fields + <% $r %> required fields +% } -<% } %> diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index 6e4f08957..a001634a2 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -1,125 +1,128 @@ -<% - -my( $cust_main, $pre, $onchange, $disabled ) = @_; -my $conf = new FS::Conf; - -#false laziness with ship state -my $countrydefault = $conf->config('countrydefault') || 'US'; -$cust_main->set($pre.'country', $countrydefault ) - unless $cust_main->get($pre.'country'); - -my $statedefault = $conf->config('statedefault') - || ($countrydefault eq 'US' ? 'CA' : ''); -$cust_main->set($pre.'state', $statedefault ) - unless $cust_main->get($pre.'state') - || $cust_main->get($pre.'country') ne $countrydefault; - -#my($county_html, $state_html, $country_html) = -# FS::cust_main_county::regionselector( $cust_main->get($pre.'county'), -# $cust_main->get($pre.'state'), -# $cust_main->get($pre.'country'), -# $pre, -# $onchange, -# $disabled, -# ); - -my %select_hash = ( - 'county' => $cust_main->get($pre.'county'), - 'state' => $cust_main->get($pre.'state'), - 'country' => $cust_main->get($pre.'country'), - 'prefix' => $pre, - 'onchange' => $onchange, - 'disabled' => $disabled, -); - -my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; -my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; - -my $r = qq!<font color="#ff0000">*</font> !; - -%> - -<%= &ntable("#cccccc") %> +% +% +%my( $cust_main, $pre, $onchange, $disabled ) = @_; +%my $conf = new FS::Conf; +% +%#false laziness with ship state +%my $countrydefault = $conf->config('countrydefault') || 'US'; +%$cust_main->set($pre.'country', $countrydefault ) +% unless $cust_main->get($pre.'country'); +% +%my $statedefault = $conf->config('statedefault') +% || ($countrydefault eq 'US' ? 'CA' : ''); +%$cust_main->set($pre.'state', $statedefault ) +% unless $cust_main->get($pre.'state') +% || $cust_main->get($pre.'country') ne $countrydefault; +% +%#my($county_html, $state_html, $country_html) = +%# FS::cust_main_county::regionselector( $cust_main->get($pre.'county'), +%# $cust_main->get($pre.'state'), +%# $cust_main->get($pre.'country'), +%# $pre, +%# $onchange, +%# $disabled, +%# ); +% +%my %select_hash = ( +% 'county' => $cust_main->get($pre.'county'), +% 'state' => $cust_main->get($pre.'state'), +% 'country' => $cust_main->get($pre.'country'), +% 'prefix' => $pre, +% 'onchange' => $onchange, +% 'disabled' => $disabled, +%); +% +%my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; +%my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; +% +%my $r = qq!<font color="#ff0000">*</font> !; +% +% + + +<% &ntable("#cccccc") %> <TR> - <TH ALIGN="right"><%=$r%>Contact name<BR>(last, first)</TH> + <TH ALIGN="right"><%$r%>Contact name<BR>(last, first)</TH> <TD COLSPAN=3> - <INPUT TYPE="text" NAME="<%=$pre%>last" VALUE="<%= $cust_main->get($pre.'last') %>" onChange="<%= $onchange %>" <%=$disabled%>> , - <INPUT TYPE="text" NAME="<%=$pre%>first" VALUE="<%= $cust_main->get($pre.'first') %>" onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') %>" onChange="<% $onchange %>" <%$disabled%>> , + <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') %>" onChange="<% $onchange %>" <%$disabled%>> </TD> +% if ( $conf->exists('show_ss') && !$pre ) { -<% if ( $conf->exists('show_ss') && !$pre ) { %> <TD ALIGN="right">SS#</TD> - <TD><INPUT TYPE="text" NAME="ss" VALUE="<%= $cust_main->ss %>" SIZE=11></TD> -<% } elsif ( !$pre ) { %> - <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<%= $cust_main->ss %>"></TD> -<% } %> + <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $cust_main->ss %>" SIZE=11></TD> +% } elsif ( !$pre ) { + + <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $cust_main->ss %>"></TD> +% } + </TR> <TR> <TD ALIGN="right">Company</TD> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%=$pre%>company" VALUE="<%= $cust_main->get($pre.'company') %>" SIZE=70 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> <TR> - <TH ALIGN="right"><%=$r%>Address</TH> + <TH ALIGN="right"><%$r%>Address</TH> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%=$pre%>address1" VALUE="<%= $cust_main->get($pre.'address1') %>" SIZE=70 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>address1" VALUE="<% $cust_main->get($pre.'address1') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> <TR> <TD ALIGN="right"> </TD> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%=$pre%>address2" VALUE="<%= $cust_main->get($pre.'address2') %>" SIZE=70 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>address2" VALUE="<% $cust_main->get($pre.'address2') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> <TR> - <TH ALIGN="right"><%=$r%>City</TH> + <TH ALIGN="right"><%$r%>City</TH> <TD> - <INPUT TYPE="text" NAME="<%=$pre%>city" VALUE="<%= $cust_main->get($pre.'city') %>" onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>city" VALUE="<% $cust_main->get($pre.'city') %>" onChange="<% $onchange %>" <%$disabled%>> </TD> - <TH ALIGN="right"><%=$r%>State</TH> + <TH ALIGN="right"><%$r%>State</TH> <TD> - <%= include('select-county.html', %select_hash ) %> - <%= include('select-state.html', %select_hash ) %> + <% include('select-county.html', %select_hash ) %> + <% include('select-state.html', %select_hash ) %> </TD> - <TH><%=$r%>Zip</TH> + <TH><%$r%>Zip</TH> <TD> - <INPUT TYPE="text" NAME="<%=$pre%>zip" VALUE="<%= $cust_main->get($pre.'zip') %>" SIZE=10 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>zip" VALUE="<% $cust_main->get($pre.'zip') %>" SIZE=10 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> <TR> - <TH ALIGN="right"><%=$r%>Country</TH> - <TD COLSPAN=5><%= include('select-country.html', %select_hash ) %></TD> + <TH ALIGN="right"><%$r%>Country</TH> + <TD COLSPAN=5><% include('select-country.html', %select_hash ) %></TD> </TR> <TR> - <TD ALIGN="right"><%= $daytime_label %></TD> + <TD ALIGN="right"><% $daytime_label %></TD> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%=$pre%>daytime" VALUE="<%= $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> <TR> - <TD ALIGN="right"><%= $night_label %></TD> + <TD ALIGN="right"><% $night_label %></TD> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%=$pre%>night" VALUE="<%= $cust_main->get($pre.'night') %>" SIZE=18 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> <TR> <TD ALIGN="right">Fax</TD> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%=$pre%>fax" VALUE="<%= $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<%= $onchange %>" <%=$disabled%>> + <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>> </TD> </TR> </TABLE> -<%=$r%>required fields<BR> +<%$r%>required fields<BR> diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html index 3941f2f93..5467f26e9 100644 --- a/httemplate/edit/cust_main/select-country.html +++ b/httemplate/edit/cust_main/select-country.html @@ -1,16 +1,17 @@ -<% - - my %opt = @_; - foreach my $opt (qw( county state country prefix onchange disabled )) { - $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); - } - - my $conf = new FS::Conf; - my $countrydefault = $conf->config('countrydefault') || 'US'; - -%> - -<%= include('/elements/xmlhttp.html', +% +% +% my %opt = @_; +% foreach my $opt (qw( county state country prefix onchange disabled )) { +% $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); +% } +% +% my $conf = new FS::Conf; +% my $countrydefault = $conf->config('countrydefault') || 'US'; +% +% + + +<% include('/elements/xmlhttp.html', 'url' => $p.'misc/states.cgi', 'subs' => [ $opt{'prefix'}. 'get_states' ], ) @@ -24,15 +25,15 @@ what.options[length] = optionName; } - function <%= $opt{'prefix'} %>country_changed(what, callback) { + function <% $opt{'prefix'} %>country_changed(what, callback) { country = what.options[what.selectedIndex].value; - function <%= $opt{'prefix'} %>update_states(states) { + function <% $opt{'prefix'} %>update_states(states) { // blank the current state list - for ( var i = what.form.<%= $opt{'prefix'} %>state.length; i >= 0; i-- ) - what.form.<%= $opt{'prefix'} %>state.options[i] = null; + for ( var i = what.form.<% $opt{'prefix'} %>state.length; i >= 0; i-- ) + what.form.<% $opt{'prefix'} %>state.options[i] = null; // add the new states var statesArray = eval('(' + states + ')' ); @@ -40,7 +41,7 @@ var stateLabel = statesArray[s+1]; if ( stateLabel == "" ) stateLabel = '(n/a)'; - opt(what.form.<%= $opt{'prefix'} %>state, statesArray[s], stateLabel); + opt(what.form.<% $opt{'prefix'} %>state, statesArray[s], stateLabel); } //run the callback @@ -49,25 +50,25 @@ } // go get the new states - <%= $opt{'prefix'} %>get_states( country, <%= $opt{'prefix'} %>update_states ); + <% $opt{'prefix'} %>get_states( country, <% $opt{'prefix'} %>update_states ); } </SCRIPT> -<SELECT NAME="<%= $opt{'prefix'} %>country" onChange="<%= $opt{'prefix'} %>country_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>> +<SELECT NAME="<% $opt{'prefix'} %>country" onChange="<% $opt{'prefix'} %>country_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>> +% foreach my $country ( +% sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) +% or code2country($a) cmp code2country($b) } +% map { $_->country } +% qsearch( 'cust_main_county',{}, 'DISTINCT ON ( country ) *', ) +% ) { +% -<% foreach my $country ( - sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) - or code2country($a) cmp code2country($b) } - map { $_->country } - qsearch( 'cust_main_county',{}, 'DISTINCT ON ( country ) *', ) - ) { -%> - <OPTION VALUE="<%= $country %>"<%= $country eq $opt{'country'} ? ' SELECTED' : '' %>><%= code2country($country). " ($country)" %> + <OPTION VALUE="<% $country %>"<% $country eq $opt{'country'} ? ' SELECTED' : '' %>><% code2country($country). " ($country)" %> +% } -<% } %> </SELECT> diff --git a/httemplate/edit/cust_main/select-county.html b/httemplate/edit/cust_main/select-county.html index 3de380b31..70939fca5 100644 --- a/httemplate/edit/cust_main/select-county.html +++ b/httemplate/edit/cust_main/select-county.html @@ -1,21 +1,21 @@ -<% - - my %opt = @_; - foreach my $opt (qw( county state country prefix onchange disabled )) { - $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); - } - - my $sql = "SELECT COUNT(*) FROM cust_main_county". - " WHERE county IS NOT NULL AND county != ''"; - my $sth = dbh->prepare($sql) or die dbh->errstr; - $sth->execute or die $sth->errstr; - my $countyflag = $sth->fetchrow_arrayref->[0]; - -%> - -<% if ( $countyflag ) { %> - - <%= include('/elements/xmlhttp.html', +% +% +% my %opt = @_; +% foreach my $opt (qw( county state country prefix onchange disabled )) { +% $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); +% } +% +% my $sql = "SELECT COUNT(*) FROM cust_main_county". +% " WHERE county IS NOT NULL AND county != ''"; +% my $sth = dbh->prepare($sql) or die dbh->errstr; +% $sth->execute or die $sth->errstr; +% my $countyflag = $sth->fetchrow_arrayref->[0]; +% +% +% if ( $countyflag ) { + + + <% include('/elements/xmlhttp.html', 'url' => $p.'misc/counties.cgi', 'subs' => [ $opt{'prefix'}. 'get_counties' ], ) @@ -29,16 +29,16 @@ what.options[length] = optionName; } - function <%= $opt{'prefix'} %>state_changed(what, callback) { + function <% $opt{'prefix'} %>state_changed(what, callback) { state = what.options[what.selectedIndex].text; - country = what.form.<%= $opt{'prefix'} %>country.options[what.form.<%= $opt{'prefix'} %>country.selectedIndex].text; + country = what.form.<% $opt{'prefix'} %>country.options[what.form.<% $opt{'prefix'} %>country.selectedIndex].text; - function <%= $opt{'prefix'} %>update_counties(counties) { + function <% $opt{'prefix'} %>update_counties(counties) { // blank the current county list - for ( var i = what.form.<%= $opt{'prefix'} %>county.length; i >= 0; i-- ) - what.form.<%= $opt{'prefix'} %>county.options[i] = null; + for ( var i = what.form.<% $opt{'prefix'} %>county.length; i >= 0; i-- ) + what.form.<% $opt{'prefix'} %>county.options[i] = null; // add the new counties var countiesArray = eval('(' + counties + ')' ); @@ -46,7 +46,7 @@ var countyLabel = countiesArray[s]; if ( countyLabel == "" ) countyLabel = '(n/a)'; - opt(what.form.<%= $opt{'prefix'} %>county, countiesArray[s], countyLabel); + opt(what.form.<% $opt{'prefix'} %>county, countiesArray[s], countyLabel); } //run the callback @@ -55,37 +55,37 @@ } // go get the new counties - <%= $opt{'prefix'} %>get_counties( state, country, <%= $opt{'prefix'} %>update_counties ); + <% $opt{'prefix'} %>get_counties( state, country, <% $opt{'prefix'} %>update_counties ); } </SCRIPT> - <SELECT NAME="<%= $opt{'prefix'} %>county" onChange="<%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>> + <SELECT NAME="<% $opt{'prefix'} %>county" onChange="<% $opt{'onchange'} %>" <% $opt{'disabled'} %>> +% foreach my $county ( +% sort +% map { $_->county } +% qsearch('cust_main_county', { 'state' => $opt{'state'}, +% 'country' => $opt{'country'}, +% } +% ) +% ) { +% - <% foreach my $county ( - sort - map { $_->county } - qsearch('cust_main_county', { 'state' => $opt{'state'}, - 'country' => $opt{'country'}, - } - ) - ) { - %> - <OPTION VALUE="<%= $county %>"<%= $county eq $opt{'county'} ? ' SELECTED' : '' %>><%= $county %> + <OPTION VALUE="<% $county %>"<% $county eq $opt{'county'} ? ' SELECTED' : '' %>><% $county %> +% } - <% } %> </SELECT> +% } else { -<% } else { %> <SCRIPT TYPE="text/javascript"> - function <%= $opt{'prefix'} %>state_changed(what) { + function <% $opt{'prefix'} %>state_changed(what) { } </SCRIPT> - <INPUT TYPE="hidden" NAME="<%= $opt{'prefix'} %>county" VALUE="<%= $opt{'county'} %>"> + <INPUT TYPE="hidden" NAME="<% $opt{'prefix'} %>county" VALUE="<% $opt{'county'} %>"> +% } -<% } %> diff --git a/httemplate/edit/cust_main/select-state.html b/httemplate/edit/cust_main/select-state.html index 64da36ba7..a7e56e78f 100644 --- a/httemplate/edit/cust_main/select-state.html +++ b/httemplate/edit/cust_main/select-state.html @@ -1,20 +1,21 @@ -<% +% +% +% my %opt = @_; +% foreach my $opt (qw( county state country prefix onchange disabled )) { +% $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); +% } +% +% - my %opt = @_; - foreach my $opt (qw( county state country prefix onchange disabled )) { - $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); - } -%> +<SELECT NAME="<% $opt{'prefix'} %>state" onChange="<% $opt{'prefix'} %>state_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>> +% tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); +% foreach my $state ( keys %states ) { -<SELECT NAME="<%= $opt{'prefix'} %>state" onChange="<%= $opt{'prefix'} %>state_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>> -<% tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); %> -<% foreach my $state ( keys %states ) { %> + <OPTION VALUE="<% $state %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %> +% } - <OPTION VALUE="<%= $state %>"<%= $state eq $opt{'state'} ? ' SELECTED' : '' %>><%= $states{$state} || '(n/a)' %> - -<% } %> </SELECT> |