1 <% include('/elements/header-popup.html', "Enter $title") %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<% $p1 %>process/cust_main_county-expand.cgi" METHOD=POST>
7 <INPUT TYPE="hidden" NAME="taxnum" VALUE="<% $taxnum %>">
8 <INPUT TYPE="hidden" NAME="taxclass" VALUE="<% $taxclass |h %>">
10 <TEXTAREA NAME="expansion" COLS="50" ROWS="16"><% $expansion |h %></TEXTAREA>
13 <INPUT TYPE="submit" VALUE="Add <% $title %>">
22 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
24 my($taxnum, $expansion, $taxclass);
25 my($query) = $cgi->keywords;
26 if ( $cgi->param('error') ) {
27 $taxnum = $cgi->param('taxnum');
28 $expansion = $cgi->param('expansion');
29 $taxclass = $cgi->param('taxclass');
31 $query =~ /^(taxclass)?(\d+)$/
32 or die "Illegal taxnum (query $query)";
33 $taxclass = $1 ? 'taxclass' : '';
38 my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum})
39 or die "cust_main_county.taxnum $taxnum not found";
43 die "Can't expand entry!" if $cust_main_county->taxclass;
45 $title = 'Tax Classes';
47 # prepopuplate with other tax classes... which should really have a primary
48 # key of their own... also this could be more efficient in the error case...
49 my $sth = dbh->prepare("SELECT DISTINCT taxclass FROM cust_main_county")
51 $sth->execute or die $sth->errstr;
52 my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
53 $expansion ||= join("\n", grep $_, keys %taxclasses );
56 die "Can't expand entry!" if $cust_main_county->county;
58 if ( $cust_main_county->state ) {
61 $title = 'States/Provinces';