diff options
author | mark <mark> | 2011-04-01 02:52:24 +0000 |
---|---|---|
committer | mark <mark> | 2011-04-01 02:52:24 +0000 |
commit | b65b8096089410001dfbcd35f9a56f9405b9f5f1 (patch) | |
tree | df16b0422007bd876bc969bdff857d8a510b0aca /httemplate/browse | |
parent | 19b0c403fbf697a1de92f12abc8a2104daca07bc (diff) |
svc_hardware and svc_dish, #11454
Diffstat (limited to 'httemplate/browse')
-rw-r--r-- | httemplate/browse/hardware_class.html | 44 | ||||
-rw-r--r-- | httemplate/browse/hardware_status.html | 24 | ||||
-rwxr-xr-x | httemplate/browse/part_svc.cgi | 19 |
3 files changed, 78 insertions, 9 deletions
diff --git a/httemplate/browse/hardware_class.html b/httemplate/browse/hardware_class.html new file mode 100644 index 000000000..aef0fa39e --- /dev/null +++ b/httemplate/browse/hardware_class.html @@ -0,0 +1,44 @@ +<% include( 'elements/browse.html', + 'title' => 'Hardware Classes and Types', + 'name' => 'hardware classes', + 'menubar' => $menubar, + 'query' => { 'table' => 'hardware_class' }, + 'count_query' => 'SELECT COUNT(*) FROM hardware_class', + 'header' => [ '#', 'Hardware class', '', 'Device types' ], + 'fields' => [ 'classnum', + 'classname', + '', + $types_sub, + ], + 'links' => [ $class_link, + $class_link, + '', + '', + ], + ) +%> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Configuration'); + +my $menubar = + [ 'Hardware statuses' => $p.'browse/hardware_status.html', + 'Add a hardware class' => $p.'edit/hardware_class.html', + 'Add a device type', => $p.'edit/hardware_type.html', ]; + +my $types_sub = sub { + my $hardware_class = shift; + my @rows = map { + my $type_link = $p.'edit/hardware_type.html?'.$_->typenum; + [ { 'data' => $_->model, 'link' => $type_link }, ] + } $hardware_class->hardware_type; + + \@rows; +}; + +my $class_link = [ "${p}edit/hardware_class.html?", 'classnum' ]; + +</%init> diff --git a/httemplate/browse/hardware_status.html b/httemplate/browse/hardware_status.html new file mode 100644 index 000000000..9695ed399 --- /dev/null +++ b/httemplate/browse/hardware_status.html @@ -0,0 +1,24 @@ +<% include( 'elements/browse.html', + 'title' => 'Hardware Statuses', + 'name' => 'hardware statuses', + 'menubar' => $menubar, + 'query' => { 'table' => 'hardware_status', }, + 'count_query' => 'SELECT COUNT(*) FROM hardware_status', + 'header' => [ '#', 'Status' ], + 'fields' => [ 'statusnum', 'label' ], + 'links' => [ $link, $link ], + ) +%> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Configuration'); + +my $menubar = [ 'Hardware classes' => $p.'browse/hardware_class.html', + 'Add a status' => $p.'edit/hardware_status.html' ]; + +my $link = [ "${p}edit/hardware_status.html?", 'statusnum' ]; + +</%init> diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 82b1150cc..4549e44dd 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -169,14 +169,14 @@ function part_export_areyousure(href) { <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> % my $value = &$formatter($part_svc->part_svc_column($field)->columnvalue); -% if ( $flag =~ /^[MA]$/ ) { -% $inventory_class{$value} -% ||= qsearchs('inventory_class', { 'classnum' => $value } ); -% - - <% $inventory_class{$value} - ? $inventory_class{$value}->classname - : "WARNING: inventory_class.classnum $value not found" %> +% if ( $flag =~ /^[MAH]$/ ) { +% my $select_table = ($flag eq 'H') ? 'hardware_class' : 'inventory_class'; +% $select_class{$value} ||= +% qsearchs($select_table, { 'classnum' => $value } ); +% + <% $select_class{$value} + ? $select_class{$value}->classname + : "WARNING: $select_table.classnum $value not found" %> % } else { <% $value %> @@ -208,6 +208,7 @@ my %flag = ( 'M' => 'Manual selected from inventory', #'A' => 'Automatically fill in from inventory', 'A' => 'Automatically filled in from inventory', + 'H' => 'Selected from hardware class', 'X' => 'Excluded', ); @@ -232,6 +233,6 @@ if ( $cgi->param('orderby') eq 'active' ) { @part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc; } -my %inventory_class = (); +my %select_class = (); </%init> |