communigate (phase 2): rules. RT#7514
[freeside.git] / httemplate / edit / svc_acct_pop.cgi
1 <% include('/elements/header.html', "$action Access Number", menubar(
2      'View all Access Numbers' => popurl(2). "browse/svc_acct_pop.cgi",
3    ))
4 %>
5
6 <% include('/elements/error.html') %>
7
8 <FORM ACTION="<%$p1%>process/svc_acct_pop.cgi" METHOD=POST>
9
10 <INPUT TYPE="hidden" NAME="popnum" VALUE="<% $hashref->{popnum} %>">
11 Access Number #<% $hashref->{popnum} ? $hashref->{popnum} : "(NEW)" %>
12
13 <PRE>
14 City      <INPUT TYPE="text" NAME="city" SIZE=32 VALUE="<% $hashref->{city} %>">
15 State     <INPUT TYPE="text" NAME="state" SIZE=16 MAXLENGTH=16 VALUE="<% $hashref->{state} %>">
16 Area Code <INPUT TYPE="text" NAME="ac" SIZE=4 MAXLENGTH=3 VALUE="<% $hashref->{ac} %>">
17 Exchange  <INPUT TYPE="text" NAME="exch" SIZE=4 MAXLENGTH=3 VALUE="<% $hashref->{exch} %>">
18 Local     <INPUT TYPE="text" NAME="loc" SIZE=5 MAXLENGTH=4 VALUE="<% $hashref->{loc} %>">
19 </PRE>
20
21 <BR>
22 <INPUT TYPE="submit" VALUE="<% $hashref->{popnum} ? "Apply changes" : "Add Access Number" %>">
23
24 </FORM>
25
26 <% include('/elements/footer.html') %>
27
28 <%init>
29
30 my $curuser = $FS::CurrentUser::CurrentUser;
31
32 die "access denied"
33   unless $curuser->access_right('Dialup configuration')
34       || $curuser->access_right('Dialup global configuration');
35
36 my $svc_acct_pop;
37 if ( $cgi->param('error') ) {
38   $svc_acct_pop = new FS::svc_acct_pop ( {
39     map { $_, scalar($cgi->param($_)) } fields('svc_acct_pop')
40   } );
41 } elsif ( $cgi->keywords ) { #editing
42   my($query)=$cgi->keywords;
43   $query =~ /^(\d+)$/;
44   $svc_acct_pop=qsearchs('svc_acct_pop',{'popnum'=>$1});
45 } else { #adding
46   $svc_acct_pop = new FS::svc_acct_pop {};
47 }
48 my $action = $svc_acct_pop->popnum ? 'Edit' : 'Add';
49 my $hashref = $svc_acct_pop->hashref;
50
51 my $p1 = popurl(1);
52
53 </%init>