diff options
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/msg_template/email.html | 2 | ||||
-rw-r--r-- | httemplate/edit/part_export.cgi | 3 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main_county-add.cgi | 71 |
3 files changed, 55 insertions, 21 deletions
diff --git a/httemplate/edit/msg_template/email.html b/httemplate/edit/msg_template/email.html index 53f538b11..a400bc804 100644 --- a/httemplate/edit/msg_template/email.html +++ b/httemplate/edit/msg_template/email.html @@ -297,6 +297,7 @@ my %substitutions = ( 'cust_pay' => [ '$paynum' => 'Payment#', '$paid' => 'Amount', + '$processing_fee' => 'Processing fee', '$payby' => 'Payment method', '$date' => 'Payment date', '$payinfo' => 'Card/account# (masked)', @@ -372,6 +373,7 @@ Substitutions: ' Enclose substitutions and other Perl expressions in braces: <BR>{ $name } = ExampleCo (Smith, John) <BR>{ time2str("%D", time) } = '.time2str("%D", time).' +<BR>{ "processing fee of $processing_fee" if $processing_fee; } = Will display text if there is a processing fee </P>'; $sidebar .= include('/elements/template_image-dialog.html', 'callback' => 'insertHtml' diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index f8a46c7fd..30e4218e2 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -296,7 +296,7 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= '<TR><TD ALIGN="left" COLSPAN=2>' . include('/elements/progress-init.html', $part_export->exporttype, - [ $script.'_exportnum', $script.'_script' ], + [ $script.'_exportnum' ], rooturl().'view/svc_export/run_script.cgi', { 'error_url' => rooturl().$exports->{$layer}{scripts}{$script}->{error_url}."exportnum=".$part_export->{Hash}->{exportnum}, @@ -307,7 +307,6 @@ my $widget = new HTML::Widgets::SelectLayers( $script, ) . '<INPUT TYPE="hidden" NAME="'.$script.'_exportnum" VALUE="'.$part_export->{Hash}->{exportnum}.'"> - <INPUT TYPE="hidden" NAME="'.$script.'_script" VALUE="'.$script.'"> <A HREF="#" onClick="'.$script.'process();">'.$exports->{$layer}{scripts}{$script}->{html_label}.'</A></TD></TR>'; } diff --git a/httemplate/edit/process/cust_main_county-add.cgi b/httemplate/edit/process/cust_main_county-add.cgi index fcc138f49..fcd6be48f 100755 --- a/httemplate/edit/process/cust_main_county-add.cgi +++ b/httemplate/edit/process/cust_main_county-add.cgi @@ -27,26 +27,59 @@ my @expansion = split /[\n\r]{1,2}/, $cgi->param('expansion'); $1; } @expansion; -foreach ( @expansion ) { - my(%hash)=$cust_main_county->hash; - my($new)=new FS::cust_main_county \%hash; - $new->setfield('taxnum',''); - $new->setfield('taxclass', ''); - if ( $cgi->param('what') eq 'state' ) { #?? - $new->setfield('state',$_); - $new->setfield('county', ''); - $new->setfield('city', ''); - } elsif ( $cgi->param('what') eq 'county' ) { - $new->setfield('county',$_); - $new->setfield('city', ''); - } elsif ( $cgi->param('what') eq 'city' ) { - #uppercase cities in the US to try and agree with USPS validation - $new->setfield('city', $new->country eq 'US' ? uc($_) : $_ ); - } else { #??? - die 'unknown what '. $cgi->param('what'); +my $what = $cgi->param('what'); +foreach my $new_tax_area ( @expansion ) { + + # Clone specific tax columns from original tax row + # + # UI Note: Preserving original behavior, of cloning + # tax amounts into new tax record, against better + # judgement. If the new city/county/state has a + # different tax value than the one being populated + # (rather likely?) now the user must remember to + # revisit each newly created tax row, and correct + # the possibly incorrect tax values that were populated. + # Values would be easier to identify and correct if + # they were initially populated with 0% tax rates + # District Note: The 'district' column is NOT cloned + # to the new tax row. Manually entered taxes + # are not be divided into road maintenance districts + # like Washington state sales taxes + my $new = FS::cust_main_county->new({ + map { $_ => $cust_main_county->getfield($_) } + qw/ + charge_prediscount + exempt_amount + exempt_amount_currency + recurtax + setuptax + tax + taxname + / + }); + + # Clone additional location columns, based on the $what value + my %clone_cols_for = ( + state => [qw/country /], + county => [qw/country state/], + city => [qw/country state county/], + ); + + die "unknown what: $what" + unless grep { $_ eq $what } keys %clone_cols_for; + + $new->setfield( $_ => $cust_main_county->getfield($_) ) + for @{ $clone_cols_for{ $cgi->param('what') } }; + + # In the US, store cities upper case for USPS validation + $new_tax_area = uc($new_tax_area) + if $what eq 'city' + && $new->country eq 'US'; + + $new->setfield( $what, $new_tax_area ); + if ( my $error = $new->insert ) { + die $error; } - my $error = $new->insert; - die $error if $error; } </%init> |