bc9cd4f31952b059d4dbd207ab97a9782724412a
[freeside.git] / httemplate / edit / process / cust_location-censustract.html
1 % if ($error) {
2 %   $cgi->param('error', $error);
3 %   $cgi->redirect(popurl(3). 'edit/cust_location-censustract.html?'. $cgi->query_string );
4 % } else {
5
6     <% header("Census tract changed") %>
7       <SCRIPT TYPE="text/javascript">
8         window.top.location.reload();
9       </SCRIPT>
10     </BODY>
11     </HTML>
12
13 % }
14 <%init>
15
16 my $curuser = $FS::CurrentUser::CurrentUser;
17
18 die "access denied"
19   unless $curuser->access_right('Change customer package');
20
21 my $locationnum = $cgi->param('locationnum');
22 my $cust_location = qsearchs({
23   'select'    => 'cust_location.*',
24   'table'     => 'cust_location',
25   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
26   'hashref'   => { 'locationnum' => $locationnum },
27   'extra_sql' => ' AND '. $curuser->agentnums_sql,
28 });
29 die "unknown locationnum $locationnum" unless $cust_location;
30
31 $cust_location->set('censustract', $cgi->param('censustract'));
32 my $error = $cust_location->replace;
33
34 </%init>