2 'query' => { 'table' => $table },
3 'count_query' => "SELECT COUNT(*) FROM $table",
4 'header' => [ '#', $opt{name_header} ],
5 'fields' => [ $table_key, $opt{name_col} ],
7 'link_onclicks' => [ '', $sub_edit_popup ],
9 'disabled_statuspos' => 2,
10 'html_init' => $html_init,
14 A simple wrapper around search/elements/search.html for browsing/editing
15 tables that only have a primary key, a 'disabled' field, and one other column
16 which is the object's name or description. Usage:
18 <& browse-simple.html,
21 'title' => 'My Things',
22 'name_singular' => 'thing',
23 'name_col' => 'thingname',
24 'name_header' => 'Thing name'
25 'acl' => 'Configure things',
32 my $table = delete $opt{table};
33 my $name_singular = $opt{name_singular};
36 unless $FS::CurrentUser::CurrentUser->access_right($opt{acl});
38 my $table_key = dbdef->table($table)->primary_key;
39 my $sub_edit_popup = sub {
40 my $pkey = $_[0]->get($table_key);
41 include('/elements/popup_link_onclick.html',
42 'action' => $p."edit/$table.html?$pkey",
43 'actionlabel' => "Edit $name_singular",
49 my $html_init = include('/elements/popup_link.html',
50 'action' => $p."edit/$table.html?",
51 'actionlabel' => "Add $name_singular",
54 'label' => "Add a new $name_singular",