blob: ef0de13cccd3c1d8bfd61d4100409eaff25dbf5a (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
<!-- mason kludge -->
<%
my %search;
if ( $cgi->param('showdisabled') ) {
%search = ();
} else {
%search = ( 'disabled' => '' );
}
my @part_svc =
sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') }
qsearch('part_svc', \%search );
my $total = scalar(@part_svc);
my %num_active_cust_svc = ();
if ( $cgi->param('active') ) {
my $active_sth = dbh->prepare(
'SELECT COUNT(*) FROM cust_svc WHERE svcpart = ?'
) or die dbh->errstr;
foreach my $part_svc ( @part_svc ) {
$active_sth->execute($part_svc->svcpart) or die $active_sth->errstr;
$num_active_cust_svc{$part_svc->svcpart} =
$active_sth->fetchrow_arrayref->[0];
}
@part_svc = sort { $num_active_cust_svc{$b->svcpart} <=>
$num_active_cust_svc{$a->svcpart} } @part_svc;
}
%>
<%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %>
<SCRIPT>
function part_export_areyousure(href) {
if (confirm("Are you sure you want to delete this export?") == true)
window.location.href = href;
}
</SCRIPT>
Service definitions are the templates for items you offer to your customers.<BR><BR>
<FORM METHOD="POST" ACTION="<%= $p %>edit/part_svc.cgi">
<A HREF="<%= $p %>edit/part_svc.cgi"><I>Add a new service definition</I></A><% if ( @part_svc ) { %> or <SELECT NAME="clone"><OPTION></OPTION>
<% foreach my $part_svc ( @part_svc ) { %>
<OPTION VALUE="<%= $part_svc->svcpart %>"><%= $part_svc->svc %></OPTION>
<% } %>
</SELECT><INPUT TYPE="submit" VALUE="Clone existing service">
<% } %>
</FORM><BR>
<%= $total %> service definitions
<%= $cgi->param('showdisabled')
? do { $cgi->param('showdisabled', 0);
'( <a href="'. $cgi->self_url. '">hide disabled services</a> )'; }
: do { $cgi->param('showdisabled', 1);
'( <a href="'. $cgi->self_url. '">show disabled services</a> )'; }
%>
<%= table() %>
<TR>
<TH COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Service</TH>
<TH>Table</TH>
<% if ( $cgi->param('active') ) { %>
<TH><FONT SIZE=-1>Customer<BR>Services</FONT></TH>
<% } %>
<TH>Export</TH>
<TH>Field</TH>
<TH COLSPAN=2>Modifier</TH>
</TR>
<% foreach my $part_svc ( @part_svc ) {
my $hashref = $part_svc->hashref;
my $svcdb = $hashref->{svcdb};
my $svc_x = "FS::$svcdb"->new( { svcpart => $part_svc->svcpart } );
my @dfields = $svc_x->fields;
push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
my @fields =
grep { $svc_x->pvf($_)
or $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag }
@dfields ;
my $rowspan = scalar(@fields) || 1;
my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}";
%>
<TR>
<TD ROWSPAN=<%= $rowspan %>><A HREF="<%= $url %>">
<%= $hashref->{svcpart} %></A></TD>
<% unless ( $cgi->param('showdisabled') ) { %>
<TD ROWSPAN=<%= $rowspan %>>
<%= $hashref->{disabled} ? 'DISABLED' : '' %></TD>
<% } %>
<TD ROWSPAN=<%= $rowspan %>><A HREF="<%= $url %>">
<%= $hashref->{svc} %></A></TD>
<TD ROWSPAN=<%= $rowspan %>>
<%= $hashref->{svcdb} %></TD>
<% if ( $cgi->param('active') ) { %>
<TD ROWSPAN=<%= $rowspan %>>
<FONT COLOR="#00CC00"><B><%= $num_active_cust_svc{$hashref->{svcpart}} %></B></FONT> <A HREF="<%=$p%>search/<%= $hashref->{svcdb} %>.cgi?svcpart=<%= $hashref->{svcpart} %>">active</A>
</TD>
<% } %>
<TD ROWSPAN=<%= $rowspan %>><%= itable() %>
<%
# my @part_export =
map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export_svc', { svcpart => $part_svc->svcpart } ) ;
foreach my $part_export (
map { qsearchs('part_export', { exportnum => $_->exportnum } ) }
qsearch('export_svc', { svcpart => $part_svc->svcpart } )
) {
%>
<TR>
<TD><A HREF="<%= $p %>edit/part_export.cgi?<%= $part_export->exportnum %>"><%= $part_export->exportnum %>: <%= $part_export->exporttype %> to <%= $part_export->machine %></A></TD></TR>
<% } %>
</TABLE></TD>
<% my($n1)='';
foreach my $field ( @fields ) {
my $flag = $part_svc->part_svc_column($field)->columnflag;
%>
<%= $n1 %><TD><%= $field %></TD><TD>
<% if ( $flag eq "D" ) { print "Default"; }
elsif ( $flag eq "F" ) { print "Fixed"; }
elsif ( not $flag ) { }
else { print "(Unknown!)"; }
%>
</TD><TD><%= $part_svc->part_svc_column($field)->columnvalue%></TD>
<% $n1="</TR><TR>";
}
%>
</TR>
<% } %>
</TABLE>
</BODY>
</HTML>
|