-% 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" %>