RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / misc / location.cgi
1 <% encode_json(\%hash) %>\
2 <%init>
3
4 my $locationnum = $cgi->param('arg');
5
6 my $curuser = $FS::CurrentUser::CurrentUser;
7
8 my $cust_location = qsearchs({
9   'select'    => 'cust_location.*',
10   'table'     => 'cust_location',
11   'hashref'   => { 'locationnum' => $locationnum },
12   'addl_from' => ' LEFT JOIN cust_main     USING ( custnum     ) ',
13                  ' LEFT JOIN prospect_main USING ( prospectnum ) ',
14   'extra_sql' => ' AND ( '.
15                        ' ( custnum IS NOT NULL AND '.
16                            $curuser->agentnums_sql( table=>'cust_main' ).
17                        ' ) '.
18                        ' OR '.
19                        ' ( prospectnum IS NOT NULL AND '.
20                            $curuser->agentnums_sql( table=>'prospect_main' ).
21                        ' ) '.
22                      ' )',
23 });
24
25 my %hash = ();
26 %hash = map { $_ => $cust_location->$_() }
27             ( FS::cust_main->location_fields,
28               qw( location_kind location_type location_number )
29             )
30   if $cust_location;
31
32 </%init>