RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / browse / realestate_unit.html
1 <% include( 'elements/browse.html',
2   title       => emt('Real Estate Inventory'),
3   name        => 'real estate inventory',
4
5   menubar => [
6     'Edit locations'     => "${p}browse/realestate_location.html",
7     'Add a new location' => "${p}edit/realestate_location.html",
8     'Add a new unit'     => "${p}edit/realestate_unit.html",
9   ],
10
11   query => {
12     table => 'realestate_unit',
13     select => join(', ',qw(
14       realestate_unit.*
15       realestate_location.location_title
16       cust_main.first
17       cust_main.last
18       cust_main.company
19     )),
20     addl_from => "
21       LEFT JOIN realestate_location
22         ON realestate_location.realestatelocnum
23            = realestate_unit.realestatelocnum
24       LEFT JOIN svc_realestate
25         ON realestate_unit.realestatenum = svc_realestate.realestatenum
26       LEFT JOIN cust_svc
27         ON svc_realestate.svcnum = cust_svc.svcnum
28       LEFT JOIN cust_pkg
29         ON cust_svc.pkgnum = cust_pkg.pkgnum
30       LEFT JOIN cust_main
31         ON cust_pkg.custnum = cust_main.custnum
32     ",
33     order_by => "ORDER BY location_title, unit_title"
34   },
35
36   count_query => 'SELECT COUNT(*) FROM realestate_unit',
37
38   header => [ 'Location', 'Unit', 'Customer' ],
39   fields => [
40     'location_title',
41     'unit_title',
42     sub {
43       return '' unless $_[0]->custnum;
44       return encode_entities( $_[0]->company ) if $_[0]->company;
45       return encode_entities( $_[0]->first.' '.$_[0]->last );
46     },
47   ],
48   links => [
49     ["${p}edit/realestate_location.html?", 'realestatelocnum' ],
50     ["${p}edit/realestate_unit.html?",     'realestatenum' ],
51     ["${p}view/cust_main.cgi?",            'custnum' ]
52   ],
53
54   agent_virt  => 1,
55   agent_pos   => 0,
56   disableable => 1,
57 )
58 %>
59 <%init>
60
61
62 my $curuser = $FS::CurrentUser::CurrentUser;
63 die("access denied")
64   unless $curuser->access_right('Edit inventory')
65       || $curuser->access_right('Edit global inventory')
66       || $curuser->access_right('Configuration');
67
68
69
70 </%init>