summaryrefslogtreecommitdiff
path: root/httemplate/search/report_svc_hardware.html
blob: b0bfc08c7f6d8d196bf6af9cc3de212a0137add6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<% include('/elements/header.html', $title ) %>

<FORM ACTION="svc_hardware.cgi" METHOD="GET">

  <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
    <TR>
      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
    </TR>

    <& /elements/tr-td-label.html, label => 'Device type' &>
%#    <% include('/elements/selectlayers.html',
%#                  'field'           => 'classnum',
%#                  'label'           => '',
%#                  'options'         => \@classnums,
%#                  'labels'          => \%class_labels,
%#                  'layer_callback'  => \&layer_callback,
%#                  'html_between'    => '</TD><TD>',
%#              ) %>
    <TD>
      <& /elements/select-hardware_type.html,
          'empty_label' => '(all)'
       &>
    </TD></TR>

    <% include('/elements/tr-input-text.html',
                  'field' => 'serial',
                  'label' => 'Serial number',
              ) %>
    <% include('/elements/tr-input-text.html',
                  'field' => 'hw_addr',
                  'label' => 'Hardware address',
              ) %>
    <% include('/elements/tr-input-text.html',
                  'field' => 'ip_addr',
                  'label' => 'IP address',
              ) %>
    <% include('/elements/tr-input-text.html',
                  'field' => 'smartcard',
                  'label' => 'Smartcard #',
              ) %>
    <% include('/elements/tr-select-table.html',
                  'field'     => 'statusnum',
                  'label'     => 'Service status',
                  'table'     => 'hardware_status',
                  'name_col'  => 'label',
                  'empty_label' => 'any',
                  'hashref'   => {},
                  'extra_sql' => ' WHERE hardware_status.disabled IS NULL
OR (SELECT COUNT(*) FROM svc_hardware 
  WHERE svc_hardware.statusnum = hardware_status.statusnum) > 0',
              ) %>
 
  </TABLE>

<BR>
<INPUT TYPE="submit" VALUE="Search">

</FORM>

<% include('/elements/footer.html') %>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Services: Hardware: Advanced search');

my $title = 'Hardware Service Report';

my @classes = qsearch('hardware_class', {});
my @classnums = ('', map { $_->classnum } @classes);
my %class_labels = ('' => 'Select hardware class',
                     map { $_->classnum => $_->classname } @classes);

sub layer_callback {
  my $classnum = shift or return '';
  include('/elements/select-hardware_type.html',
              'field'       => 'classnum'.$classnum.'typenum',
              'classnum'    => $classnum,
              'prefix'      => $classnum,
              'empty_label' => 'any',
          );
}
  
</%init>