rt# 74031 Implement forms for editing real estate inventory
[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 cust_main
25         ON realestate_unit.custnum = cust_main.custnum
26     ",
27   },
28
29   count_query => 'SELECT COUNT(*) FROM realestate_unit',
30
31   header => [ 'Location', 'Unit', 'Customer' ],
32   fields => [
33     'location_title',
34     'unit_title',
35     sub {
36       return '' unless $_[0]->custnum;
37       return $_[0]->company if $_[0]->company;
38       return $_[0]->first.' '.$_[0]->last;
39     },
40   ],
41   links => [
42     ["${p}edit/realestate_location?",  'realestatelocnum' ],
43     ["${p}edit/realestate_unit.html?", 'realestatenum' ],
44     ["${p}view/cust_main.cgi?",        'custnum' ]
45   ],
46
47   agent_virt  => 1,
48   agent_pos   => 0,
49   disableable => 1,
50 )
51 %>
52 <%init>
53
54
55 my $curuser = $FS::CurrentUser::CurrentUser;
56 die("access denied")
57   unless $curuser->access_right('Edit inventory')
58       || $curuser->access_right('Edit global inventory')
59       || $curuser->access_right('Configuration');
60
61
62
63 </%init>