summaryrefslogtreecommitdiff
path: root/httemplate/elements/mcp_lint.html
blob: 161415eff3d8feabce825c1ce2b5aa38ba73db9d (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
% foreach my $lint (@lint) {
%   my $color = ( $lint =~ /unchecked$/ ? '#FF9900' : '#FF0000' );
    <FONT COLOR="<% $color %>"><% $lint %></FONT><BR>
% }

<%init>

my(%opt) = @_;

my $conf = new FS::Conf;

my @svc = ();
if ( $opt{svc} ) {
  @svc = ref($opt{svc}) ? @{ $opt{svc} } : ( $opt{svc} );
} elsif ( $opt{cust_main} ) {
  my $custnum = $opt{cust_main}->custnum;
  @svc = qsearchs({
           'table'     => 'cust_svc',
           'addl_from' => ' LEFT JOIN cust_pkg  USING ( pkgnum ) '.
                          ' LEFT JOIN cust_main USING ( custnum )',
           'hashref'   => { 'svcpart' => $conf->config('mcp_svcpart') },
           'extra_sql' => " AND custnum = $custnum ",
         });
} else {
  die 'neither svc nor cust_main options passed to mcp_lint';
}


my @lint = ();
push @lint, 'unchecked' unless @svc;
foreach my $svc ( @svc ) {
  my @svc_lint = tron_lint($svc);
  if ( scalar(@svc) > 1 ) {
    push @lint, map $svc->title.": $_", @svc_lint;
  } else {
    push @lint, @svc_lint;
  }
}

</%init>