remove customer deletion
[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 &>
22 </TABLE>
23
24 <BR>
25 <SCRIPT TYPE="text/javascript">
26 function go() {
27 % if ( FS::Conf->new->config('address_standardize_method') ) {
28   standardize_locations();
29 % } else {
30   confirm('Modify this service location?') &&
31     document.EditLocationForm.submit();
32 % }
33 }
34 </SCRIPT>
35 <INPUT TYPE="button" NAME="submitButton" VALUE="Submit" onclick="go()">
36 </FORM>
37 </BODY>
38 </HTML>
39
40 <%init>
41
42 my $conf = new FS::Conf;
43
44 my $curuser = $FS::CurrentUser::CurrentUser;
45
46 # it's the same access right you'd need to do this by editing packages
47 die "access denied"
48   unless $curuser->access_right('Change customer package');
49
50 my $locationnum = scalar($cgi->param('locationnum'));
51 my $cust_location = qsearchs({
52     'select'    => 'cust_location.*',
53     'table'     => 'cust_location',
54     'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
55     'hashref'   => { 'locationnum' => $locationnum },
56     'extra_sql' => ' AND '. $curuser->agentnums_sql,
57   }) or die "unknown locationnum $locationnum";
58
59 die "can't edit disabled locationnum $locationnum" if $cust_location->disabled;
60
61 my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_location->custnum })
62   or die "can't get cust_main record for custnum ". $cust_location->custnum;
63
64 my @cust_pkgs = qsearch('cust_pkg', { 'locationnum' => $locationnum });
65
66 </%init>