enable census tract lookup and manual entry in package order/change and location...
[freeside.git] / httemplate / edit / cust_location.cgi
1 <% include('/elements/header-popup.html', "Edit Location") %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="EditLocationForm" 
6 ACTION="<% $p %>edit/process/cust_location.cgi" METHOD=POST>
7 <INPUT TYPE="hidden" NAME="locationnum" VALUE="<% $locationnum %>">
8
9 <% ntable('#cccccc') %>
10 <& /elements/location.html,
11   'object'              => $cust_location,
12   'no_asterisks'        => 1,
13   # these are service locations, so they need all this stuff
14   'enable_coords'       => 1,
15   'enable_district'     => 1,
16   'enable_censustract'  => 1,
17 &>
18 <& /elements/standardize_locations.html,
19             'form'          => 'EditLocationForm',
20             'callback'      => 'document.EditLocationForm.submit();',
21             'with_census'   => 1,
22             'with_census_functions' => 1,
23 &>
24 </TABLE>
25
26 <BR>
27 <SCRIPT TYPE="text/javascript">
28 function go() {
29 % if ( FS::Conf->new->config('address_standardize_method') ) {
30   standardize_locations();
31 % } else {
32   confirm('Modify this service location?') &&
33     document.EditLocationForm.submit();
34 % }
35 }
36
37 function submit_abort() {
38   nd(1);
39 }
40 </SCRIPT>
41 <INPUT TYPE="button" NAME="submitButton" VALUE="Submit" onclick="go()">
42 </FORM>
43 </BODY>
44 </HTML>
45
46 <%init>
47
48 my $conf = new FS::Conf;
49
50 my $curuser = $FS::CurrentUser::CurrentUser;
51
52 # it's the same access right you'd need to do this by editing packages
53 die "access denied"
54   unless $curuser->access_right('Change customer package');
55
56 my $locationnum = scalar($cgi->param('locationnum'));
57 my $cust_location = qsearchs({
58     'select'    => 'cust_location.*',
59     'table'     => 'cust_location',
60     'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
61     'hashref'   => { 'locationnum' => $locationnum },
62     'extra_sql' => ' AND '. $curuser->agentnums_sql,
63   }) or die "unknown locationnum $locationnum";
64
65 die "can't edit disabled locationnum $locationnum" if $cust_location->disabled;
66
67 my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_location->custnum })
68   or die "can't get cust_main record for custnum ". $cust_location->custnum;
69
70 my @cust_pkgs = qsearch('cust_pkg', { 'locationnum' => $locationnum });
71
72 </%init>