default to a session cookie instead of setting an explicit timeout, weird timezone...
[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'    => $conf->exists('tax_district_method')
21                               ? 'wa_state_tax_district()'
22                               : 'submit_continue()',
23             'with_census'   => 1,
24             'with_census_functions' => 1,
25 &>
26 <script>
27   <& /elements/wa_state_tax_district.js &>
28
29   // wa_sate_tax_district() will call submit_continue() upon success,
30   //   or submit_abort() upon error
31   function submit_continue() {
32     document.EditLocationForm.submit();
33   }
34 </script>
35 </TABLE>
36
37 <BR>
38 <SCRIPT TYPE="text/javascript">
39 function go() {
40   confirm('Modify this service location?') &&
41     standardize_locations();
42 }
43
44 function submit_abort() {
45   nd(1);
46 }
47 </SCRIPT>
48 <INPUT TYPE="button" NAME="submitButton" VALUE="Submit" onclick="go()">
49 </FORM>
50 </BODY>
51 </HTML>
52
53 <%init>
54
55 my $conf = new FS::Conf;
56
57 my $curuser = $FS::CurrentUser::CurrentUser;
58
59 # it's the same access right you'd need to do this by editing packages
60 die "access denied"
61   unless $curuser->access_right('Change customer package');
62
63 my $locationnum = scalar($cgi->param('locationnum'));
64 my $cust_location = qsearchs({
65     'select'    => 'cust_location.*',
66     'table'     => 'cust_location',
67     'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
68     'hashref'   => { 'locationnum' => $locationnum },
69     'extra_sql' => ' AND '. $curuser->agentnums_sql,
70   }) or die "unknown locationnum $locationnum";
71
72 die "can't edit disabled locationnum $locationnum" if $cust_location->disabled;
73
74 my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_location->custnum })
75   or die "can't get cust_main record for custnum ". $cust_location->custnum;
76
77 my @cust_pkgs = qsearch('cust_pkg', { 'locationnum' => $locationnum });
78
79 </%init>