check cust_main.edit_subject, RT#13199
[freeside.git] / httemplate / edit / cust_main_county-expand.cgi
1 <% include('/elements/header-popup.html', "Enter $title") %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM ACTION="<% $p1 %>process/cust_main_county-expand.cgi" METHOD=POST>
6
7 <INPUT TYPE="hidden" NAME="taxnum" VALUE="<% $taxnum %>">
8
9 <TEXTAREA NAME="expansion" COLS="50" ROWS="16"><% $expansion |h %></TEXTAREA>
10
11 <BR>
12 <INPUT TYPE="submit" VALUE="Add <% $title %>">
13
14 </FORM>
15 </BODY>
16 </HTML>
17
18 <%init>
19
20 die "access denied"
21   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
22
23 my($taxnum, $expansion);
24 my($query) = $cgi->keywords;
25 if ( $cgi->param('error') ) {
26   $taxnum = $cgi->param('taxnum');
27   $expansion = $cgi->param('expansion');
28 } else {
29   $query =~ /^(\d+)$/
30     or die "Illegal taxnum (query $query)";
31   $taxnum = $1;
32   $expansion = '';
33 }
34
35 my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum})
36   or die "cust_main_county.taxnum $taxnum not found";
37
38 my $title;
39
40 die "Can't expand entry!" if $cust_main_county->city;
41
42 if ( $cust_main_county->county ) {
43   $title = 'Cities';
44 } elsif ( $cust_main_county->state ) {
45   $title = 'Counties';
46 } else {
47   $title = 'States/Provinces';
48 }
49
50 my $p1 = popurl(1);
51
52 </%init>