summaryrefslogtreecommitdiff
path: root/httemplate/browse
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/browse')
-rw-r--r--httemplate/browse/access_group.html45
-rw-r--r--httemplate/browse/access_user.html89
-rwxr-xr-xhttemplate/browse/agent.cgi114
-rwxr-xr-xhttemplate/browse/agent_type.cgi13
-rwxr-xr-xhttemplate/browse/cust_pay_batch.cgi2
-rw-r--r--httemplate/browse/inventory_class.html2
-rwxr-xr-xhttemplate/browse/part_pkg.cgi8
-rwxr-xr-xhttemplate/browse/part_referral.html (renamed from httemplate/browse/part_referral.cgi)75
-rwxr-xr-xhttemplate/browse/part_svc.cgi28
9 files changed, 286 insertions, 90 deletions
diff --git a/httemplate/browse/access_group.html b/httemplate/browse/access_group.html
index 6ba89ea81..9ebb2b882 100644
--- a/httemplate/browse/access_group.html
+++ b/httemplate/browse/access_group.html
@@ -4,6 +4,45 @@ my $html_init =
"Internal access groups control access to the back-office interface.<BR><BR>".
qq!<A HREF="${p}edit/access_group.html"><I>Add an internal access group</I></A><BR><BR>!;
+#false laziness w/access_user.html & agent_type.cgi
+my $agents_sub = sub {
+ my $access_group = shift;
+
+ [ map {
+ my $access_groupagent = $_;
+ my $agent = $access_groupagent->agent;
+ [
+ {
+ 'data' => $agent->agent,
+ 'align' => 'left',
+ 'link' => $p. 'edit/agent.cgi?'. $agent->agentnum,
+ },
+ ];
+ }
+ grep { $_->agent } #?
+ $access_group->access_groupagent,
+
+ ];
+
+};
+
+my $rights_sub = sub {
+ my $access_group = shift;
+
+ [ map { my $access_right = $_;
+ [
+ {
+ 'data' => $access_right->rightname,
+ 'align' => 'left',
+ },
+ ];
+ }
+ $access_group->access_rights,
+
+ ];
+
+};
+
my $count_query = 'SELECT COUNT(*) FROM access_group';
my $link = [ $p.'edit/access_group.html?', 'groupnum' ];
@@ -22,12 +61,18 @@ my $link = [ $p.'edit/access_group.html?', 'groupnum' ];
'count_query' => $count_query,
'header' => [ '#',
'Group name',
+ 'Agents',
+ 'Rights',
],
'fields' => [ 'groupnum',
'groupname',
+ $agents_sub,
+ $rights_sub,
],
'links' => [ $link,
$link,
+ '',
+ '',
],
)
%>
diff --git a/httemplate/browse/access_user.html b/httemplate/browse/access_user.html
index 38d5430b1..5b787977d 100644
--- a/httemplate/browse/access_user.html
+++ b/httemplate/browse/access_user.html
@@ -4,7 +4,15 @@ my $html_init =
"Internal users have access to the back-office interface. Typically, this is your employees and contractors, but in a VISP setup, you can also add accounts for your reseller's employees. It is <B>highly recommended</B> to add a <B>separate account for each person</B> rather than using role accounts.<BR><BR>".
qq!<A HREF="${p}edit/access_user.html"><I>Add an internal user</I></A><BR><BR>!;
-#false laziness w/agent_type.cgi
+#false laziness w/part_pkg.cgi
+my %search = ();
+my $search = '';
+unless ( $cgi->param('showdisabled') ) {
+ %search = ( 'disabled' => '' );
+ $search = "( disabled = '' OR disabled IS NULL )";
+}
+
+#false laziness w/access_group.html & agent_type.cgi
my $groups_sub = sub {
my $access_user = shift;
@@ -28,36 +36,63 @@ my $groups_sub = sub {
};
+my $posttotal;
+if ( $cgi->param('showdisabled') ) {
+ $cgi->param('showdisabled', 0);
+ $posttotal = '( <a href="'. $cgi->self_url. '">hide disabled users</a> )';
+ $cgi->param('showdisabled', 1);
+} else {
+ $cgi->param('showdisabled', 1);
+ $posttotal = '( <a href="'. $cgi->self_url. '">show disabled users</a> )';
+ $cgi->param('showdisabled', 0);
+}
+
my $count_query = 'SELECT COUNT(*) FROM access_user';
+$count_query .= " WHERE $search"
+ if $search;
my $link = [ $p.'edit/access_user.html?', 'usernum' ];
+my @header = ( '#', 'Username' );
+my @fields = ( 'usernum', 'username' );
+my $align = 'rl';
+my @links = ( $link, $link );
+my @style = ( '', '' );
+
+#false laziness w/part_pkg.cgi
+#unless ( $cgi->param('showdisabled') ) { #its been reversed already
+if ( $cgi->param('showdisabled') ) { #its been reversed already
+ push @header, 'Status';
+ push @fields, sub { shift->disabled
+ ? '<FONT COLOR="#FF0000">DISABLED</FONT>'
+ : '<FONT COLOR="#00CC00">Active</FONT>'
+ };
+ push @links, '';
+ $align .= 'c';
+ push @style, 'b';
+}
+
+push @header, 'Full name', 'Groups';
+push @fields, 'name', $groups_sub;
+push @links, $link, '';
+$align .= 'll';
+
%><%= include( 'elements/browse.html',
- 'title' => 'Internal Users',
- 'menubar' => [ #'Main menu' => $p,
- 'Internal access groups' => $p.'browse/access_group.html',
- ],
- 'html_init' => $html_init,
- 'name' => 'internal users',
- 'query' => { 'table' => 'access_user',
- 'hashref' => {},
- 'extra_sql' => 'ORDER BY last, first',
- },
- 'count_query' => $count_query,
- 'header' => [ '#',
- 'Username',
- 'Full name',
- 'Groups'
- ],
- 'fields' => [ 'usernum',
- 'username',
- 'name', # sub { shift->name },
- $groups_sub,
- ],
- 'links' => [ $link,
- $link,
- $link,
- ''
- ],
+ 'title' => 'Internal Users',
+ 'menubar' => [ #'Main menu' => $p,
+ 'Internal access groups' => $p.'browse/access_group.html',
+ ],
+ 'html_init' => $html_init,
+ 'html_posttotal' => $posttotal,
+ 'name' => 'internal users',
+ 'query' => { 'table' => 'access_user',
+ 'hashref' => \%search,
+ 'extra_sql' => 'ORDER BY last, first',
+ },
+ 'count_query' => $count_query,
+ 'header' => \@header,
+ 'fields' => \@fields,
+ 'links' => \@links,
+ 'style' => \@style,
)
%>
diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi
index 17cc8bd40..f5157d9b7 100755
--- a/httemplate/browse/agent.cgi
+++ b/httemplate/browse/agent.cgi
@@ -29,21 +29,27 @@ full offerings (via their type).<BR><BR>
%>
<% } %>
-<%= table() %>
+<%= include('/elements/table-grid.html') %>
+
+<% my $bgcolor1 = '#eeeeee';
+ my $bgcolor2 = '#ffffff';
+ my $bgcolor = '';
+%>
+
<TR>
- <TH COLSPAN=<%= ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH>
- <TH>Type</TH>
- <TH>Customers</TH>
- <TH><FONT SIZE=-1>Customer<BR>packages</FONT></TH>
- <TH>Reports</TH>
- <TH>Registration codes</TH>
- <TH>Prepaid cards</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<%= ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Customers</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Customer<BR>packages</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Reports</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Registration codes</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Prepaid cards</TH>
<% if ( $conf->config('ticket_system') ) { %>
- <TH>Ticketing</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Ticketing</TH>
<% } %>
- <TH><FONT SIZE=-1>Payment Gateway Overrides</FONT></TH>
- <TH><FONT SIZE=-1>Freq.</FONT></TH>
- <TH><FONT SIZE=-1>Prog.</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Payment Gateway Overrides</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Freq.</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Prog.</FONT></TH>
</TR>
<%
# <TH><FONT SIZE=-1>Agent #</FONT></TH>
@@ -58,107 +64,157 @@ foreach my $agent ( sort {
'agentnum='. $agent->agentnum;
my $cust_pkg_link = $p. 'search/cust_pkg.cgi?agentnum='. $agent->agentnum;
+
+ if ( $bgcolor eq $bgcolor1 ) {
+ $bgcolor = $bgcolor2;
+ } else {
+ $bgcolor = $bgcolor1;
+ }
%>
<TR>
- <TD><A HREF="<%=$p%>edit/agent.cgi?<%= $agent->agentnum %>">
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%=$p%>edit/agent.cgi?<%= $agent->agentnum %>">
<%= $agent->agentnum %></A></TD>
<% if ( dbdef->table('agent')->column('disabled')
&& !$cgi->param('showdisabled') ) { %>
- <TD><%= $agent->disabled ? 'DISABLED' : '' %></TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $agent->disabled ? 'DISABLED' : '' %></TD>
<% } %>
- <TD><A HREF="<%=$p%>edit/agent.cgi?<%= $agent->agentnum %>">
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%=$p%>edit/agent.cgi?<%= $agent->agentnum %>">
<%= $agent->agent %></A></TD>
- <TD><A HREF="<%=$p%>edit/agent_type.cgi?<%= $agent->typenum %>"><%= $agent->agent_type->atype %></A></TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%=$p%>edit/agent_type.cgi?<%= $agent->typenum %>"><%= $agent->agent_type->atype %></A></TD>
+
+ <TD CLASS="inv" BGCOLOR="<%= $bgcolor %>">
+ <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
- <TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TH ALIGN="right" WIDTH="40%">
- <%= my $num_prospect = $agent->num_prospect_cust_main %>&nbsp;
+ <FONT COLOR="#7e0079">
+ <%= my $num_prospect = $agent->num_prospect_cust_main %>&nbsp;
+ </FONT>
</TH>
+
<TD>
<% if ( $num_prospect ) { %>
<A HREF="<%= $cust_main_link %>&prospect=1"><% } %>prospects<% if ($num_prospect ) { %></A><% } %>
<TD>
</TR>
+
+ <TR>
+ <TH ALIGN="right" WIDTH="40%">
+ <FONT COLOR="#0000CC">
+ <%= my $num_inactive = $agent->num_inactive_cust_main %>&nbsp;
+ </FONT>
+ </TH>
+
+ <TD>
+ <% if ( $num_inactive ) { %>
+ <A HREF="<%= $cust_main_link %>&inactive=1"><% } %>inactive<% if ( $num_inactive ) { %></A><% } %>
+ </TD>
+ </TR>
+
<TR>
<TH ALIGN="right" WIDTH="40%">
<FONT COLOR="#00CC00">
<%= my $num_active = $agent->num_active_cust_main %>&nbsp;
</FONT>
</TH>
+
<TD>
<% if ( $num_active ) { %>
<A HREF="<%= $cust_main_link %>&active=1"><% } %>active<% if ( $num_active ) { %></A><% } %>
</TD>
</TR>
+
<TR>
<TH ALIGN="right" WIDTH="40%">
<FONT COLOR="#FF9900">
<%= my $num_susp = $agent->num_susp_cust_main %>&nbsp;
</FONT>
</TH>
+
<TD>
<% if ( $num_susp ) { %>
<A HREF="<%= $cust_main_link %>&suspended=1"><% } %>suspended<% if ( $num_susp ) { %></A><% } %>
</TD>
</TR>
+
<TR>
<TH ALIGN="right" WIDTH="40%">
<FONT COLOR="#FF0000">
<%= my $num_cancel = $agent->num_cancel_cust_main %>&nbsp;
</FONT>
</TH>
+
<TD>
<% if ( $num_cancel ) { %>
<A HREF="<%= $cust_main_link %>&showcancelledcustomers=1&cancelled=1"><% } %>cancelled<% if ( $num_cancel ) { %></A><% } %>
</TD>
</TR>
+
</TABLE>
</TD>
- <TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
+ <TD CLASS="inv" BGCOLOR="<%= $bgcolor %>" VALIGN="bottom">
+ <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
+
+ <TR>
+ <TH ALIGN="right" WIDTH="40%">
+ <FONT COLOR="#0000CC">
+ <%= my $num_inactive_pkg = $agent->num_inactive_cust_pkg %>&nbsp;
+ </FONT>
+ </TH>
+
+ <TD>
+ <% if ( $num_inactive_pkg ) { %>
+ <A HREF="<%= $cust_pkg_link %>&magic=inactive"><% } %>inactive<% if ( $num_inactive_pkg ) { %></A><% } %>
+ </TD>
+ </TR>
+
<TR>
<TH ALIGN="right" WIDTH="40%">
<FONT COLOR="#00CC00">
<%= my $num_active_pkg = $agent->num_active_cust_pkg %>&nbsp;
</FONT>
</TH>
+
<TD>
<% if ( $num_active_pkg ) { %>
<A HREF="<%= $cust_pkg_link %>&magic=active"><% } %>active<% if ( $num_active_pkg ) { %></A><% } %>
</TD>
</TR>
+
<TR>
<TH ALIGN="right" WIDTH="40%">
<FONT COLOR="#FF9900">
<%= my $num_susp_pkg = $agent->num_susp_cust_pkg %>&nbsp;
</FONT>
+
</TH>
<TD>
<% if ( $num_susp_pkg ) { %>
<A HREF="<%= $cust_pkg_link %>&magic=suspended"><% } %>suspended<% if ( $num_susp_pkg ) { %></A><% } %>
</TD>
</TR>
+
<TR>
<TH ALIGN="right" WIDTH="40%">
<FONT COLOR="#FF0000">
<%= my $num_cancel_pkg = $agent->num_cancel_cust_pkg %>&nbsp;
</FONT>
</TH>
+
<TD>
<% if ( $num_cancel_pkg ) { %>
<A HREF="<%= $cust_pkg_link %>&magic=cancelled"><% } %>cancelled<% if ( $num_cancel_pkg ) { %></A><% } %>
</TD>
</TR>
+
</TABLE>
</TD>
- <TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<A HREF="<%= $p %>search/report_cust_pay.html?agentnum=<%= $agent->agentnum %>">Payments</A>
<BR><A HREF="<%= $p %>search/report_cust_credit.html?agentnum=<%= $agent->agentnum %>">Credits</A>
<BR><A HREF="<%= $p %>search/report_receivables.cgi?agentnum=<%= $agent->agentnum %>">A/R Aging</A>
@@ -166,14 +222,14 @@ foreach my $agent ( sort {
</TD>
- <TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<%= my $num_reg_code = $agent->num_reg_code %>
<% if ( $num_reg_code ) { %>
<A HREF="<%=$p%>search/reg_code.html?agentnum=<%= $agent->agentnum %>"><% } %>Unused<% if ( $num_reg_code ) { %></A><% } %>
<BR><A HREF="<%=$p%>edit/reg_code.cgi?agentnum=<%= $agent->agentnum %>">Generate codes</A>
</TD>
- <TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<%= my $num_prepay_credit = $agent->num_prepay_credit %>
<% if ( $num_prepay_credit ) { %>
<A HREF="<%=$p%>search/prepay_credit.html?agentnum=<%= $agent->agentnum %>"><% } %>Unused<% if ( $num_prepay_credit ) { %></A><% } %>
@@ -182,7 +238,7 @@ foreach my $agent ( sort {
<% if ( $conf->config('ticket_system') ) { %>
- <TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<% if ( $agent->ticketing_queueid ) { %>
Queue: <%= $agent->ticketing_queueid %>: <%= $agent->ticketing_queue %><BR>
<% } %>
@@ -190,7 +246,7 @@ foreach my $agent ( sort {
<% } %>
- <TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<TABLE CELLSPACING=0 CELLPADDING=0>
<% foreach my $override (
# sort { } want taxclass-full stuff first? and default cards (empty cardtype)
@@ -214,8 +270,10 @@ foreach my $agent ( sort {
</TABLE>
</TD>
- <TD><%= $agent->freq %></TD>
- <TD><%= $agent->prog %></TD>
+<!--
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $agent->freq %></TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $agent->prog %></TD>
+-->
</TR>
diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi
index a5ffb1048..ceffce3d4 100755
--- a/httemplate/browse/agent_type.cgi
+++ b/httemplate/browse/agent_type.cgi
@@ -13,21 +13,18 @@ my $packages_sub = sub {
[ map {
my $type_pkgs = $_;
- my $part_pkg = $type_pkgs->part_pkg;
+ #my $part_pkg = $type_pkgs->part_pkg;
[
{
- 'data' => $part_pkg->pkg. ' - '. $part_pkg->comment,
+ #'data' => $part_pkg->pkg. ' - '. $part_pkg->comment,
+ 'data' => $type_pkgs->pkg. ' - '. $type_pkgs->comment,
'align' => 'left',
'link' => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart,
},
];
}
- #sort {
- # }
- grep {
- $_->part_pkg and ! $_->part_pkg->disabled
- }
- $agent_type->type_pkgs #XXX the method should order itself by something
+
+ $agent_type->type_pkgs_enabled
];
};
diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi
index 6ee983ab4..c7f0afe76 100755
--- a/httemplate/browse/cust_pay_batch.cgi
+++ b/httemplate/browse/cust_pay_batch.cgi
@@ -15,7 +15,7 @@ Filename <INPUT TYPE="file" NAME="batch_results"><BR>
Format <SELECT NAME="format">
<OPTION VALUE="">Default batch mode</OPTION>
<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV results from TD Canada Trust Merchant PC Batch</OPTION>
-<OPTION VALUE="BoM">Bank of Montreal ECA results</OPTION>
+<OPTION VALUE="BoM">Bank of Montreal ECA batch</OPTION>
</SELECT><BR>
<INPUT TYPE="submit" VALUE="Upload"></FORM>
<BR>
diff --git a/httemplate/browse/inventory_class.html b/httemplate/browse/inventory_class.html
index 6da3c9e3c..4a15bf7d4 100644
--- a/httemplate/browse/inventory_class.html
+++ b/httemplate/browse/inventory_class.html
@@ -8,7 +8,7 @@ tie my %labels, 'Tie::IxHash',
my %link = (
'num_avail' => ';avail=1',
- 'num_used' => ';avail=1',
+ 'num_used' => ';used=1',
'num_total' => '',
);
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index 41d86358c..a5e212d17 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -1,5 +1,6 @@
<%
+#false laziness w/access_user.html
my %search = ();
my $search = '';
unless ( $cgi->param('showdisabled') ) {
@@ -53,11 +54,14 @@ my $posttotal;
if ( $cgi->param('showdisabled') ) {
$cgi->param('showdisabled', 0);
$posttotal = '( <a href="'. $cgi->self_url. '">hide disabled packages</a> )';
+ $cgi->param('showdisabled', 1);
} else {
$cgi->param('showdisabled', 1);
$posttotal = '( <a href="'. $cgi->self_url. '">show disabled packages</a> )';
+ $cgi->param('showdisabled', 0);
}
+
# ------
my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ];
@@ -68,7 +72,9 @@ my $align = 'rll';
my @links = ( $link, $link, '' );
my @style = ( '', '', '' );
-unless ( $cgi->param('showdisabled') ) { #its been reversed already
+#false laziness w/access_user.html
+#unless ( $cgi->param('showdisabled') ) { #its been reversed already
+if ( $cgi->param('showdisabled') ) { #its been reversed already
push @header, 'Status';
push @fields, sub { shift->disabled
? '<FONT COLOR="#FF0000">DISABLED</FONT>'
diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.html
index 238ddace7..c50a406ed 100755
--- a/httemplate/browse/part_referral.cgi
+++ b/httemplate/browse/part_referral.html
@@ -1,11 +1,9 @@
-<!-- mason kludge -->
-<%= include("/elements/header.html","Advertising source Listing", menubar(
- 'Main Menu' => $p,
-# 'Add new referral' => "../edit/part_referral.cgi",
-)) %>
+<%= include("/elements/header.html","Advertising source Listing" ) %>
+
Where a customer heard about your service. Tracked for informational purposes.
<BR><BR>
-<A HREF="<%= $p %>edit/part_referral.cgi"><I>Add a new advertising source</I></A>
+
+<A HREF="<%= $p %>edit/part_referral.html"><I>Add a new advertising source</I></A>
<BR><BR>
<%
@@ -34,36 +32,71 @@ Where a customer heard about your service. Tracked for informational purposes.
'Total' => 86400, # 60sec * 60min * 24hrs
);
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
my $statement = "SELECT COUNT(*) FROM h_cust_main
WHERE history_action = 'insert'
AND refnum = ?
AND history_date >= ?
AND history_date < ?
- ";
+ AND ". $curuser->agentnums_sql;
my $sth = dbh->prepare($statement)
or die dbh->errstr;
+
+ my $show_agentnums = scalar($curuser->agentnums);
+
+%>
+
+<%= include('/elements/table-grid.html') %>
+
+<% my $bgcolor1 = '#eeeeee';
+ my $bgcolor2 = '#ffffff';
+ my $bgcolor = '';
%>
-<%= table() %>
<TR>
- <TH COLSPAN=2 ROWSPAN=2>Advertising source</TH>
- <TH COLSPAN=<%= scalar(keys %after) %>>Customers</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2 ROWSPAN=2>Advertising source</TH>
+ <% if ( $show_agentnums ) { %>
+ <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Agent</TH>
+ <% } %>
+ <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<%= scalar(keys %after) %>>Customers</TH>
</TR>
<% for my $period ( keys %after ) { %>
- <TH><FONT SIZE=-1><%= $period %></FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><%= $period %></FONT></TH>
<% } %>
</TR>
<%
-foreach my $part_referral ( sort {
- $a->getfield('refnum') <=> $b->getfield('refnum')
-} qsearch('part_referral',{}) ) {
+foreach my $part_referral ( FS::part_referral->all_part_referral(1) ) {
+
+ if ( $bgcolor eq $bgcolor1 ) {
+ $bgcolor = $bgcolor2;
+ } else {
+ $bgcolor = $bgcolor1;
+ }
+
+ $a = 0;
+
%>
<TR>
- <TD><A HREF="<%= $p %>edit/part_referral.cgi?<%= $part_referral->refnum %>">
- <%= $part_referral->refnum %></A></TD>
- <TD><A HREF="<%= $p %>edit/part_referral.cgi?<%= $part_referral->refnum %>">
- <%= $part_referral->referral %></A></TD>
+
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <% if ( $part_referral->agentnum || $curuser->access_right('Edit global advertising sources') ) {
+ $a++;
+ %>
+ <A HREF="<%= $p %>edit/part_referral.html?<%= $part_referral->refnum %>">
+ <% } %>
+ <%= $part_referral->refnum %><%= $a ? '</A>' : '' %></TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <% if ( $a ) { %>
+ <A HREF="<%= $p %>edit/part_referral.html?<%= $part_referral->refnum %>">
+ <% } %>
+ <%= $part_referral->referral %><%= $a ? '</A>' : '' %></TD>
+
+ <% if ( $show_agentnums ) { %>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $part_referral->agentnum ? $part_referral->agent->agent : '(global)' %></TD>
+ <% } %>
+
<% for my $period ( keys %after ) {
$sth->execute( $part_referral->refnum,
$today-$after{$period},
@@ -71,7 +104,7 @@ foreach my $part_referral ( sort {
) or die $sth->errstr;
my $number = $sth->fetchrow_arrayref->[0];
%>
- <TD ALIGN="right"><%= $number %></TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right"><%= $number %></TD>
<% } %>
</TR>
<% } %>
@@ -82,14 +115,14 @@ foreach my $part_referral ( sort {
or die dbh->errstr;
%>
<TR>
- <TH COLSPAN=2>Total</TH>
+ <TD BGCOLOR="#dddddd" ALIGN="center" COLSPAN=3><B>Total</B></TD>
<% for my $period ( keys %after ) {
$sth->execute( $today-$after{$period},
$today+$before{$period},
) or die $sth->errstr;
my $number = $sth->fetchrow_arrayref->[0];
%>
- <TD ALIGN="right"><%= $number %></TD>
+ <TD BGCOLOR="#dddddd" ALIGN="right"><B><%= $number %><B></TD>
<% } %>
</TR>
</TABLE>
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index eef2676c0..805bd88b9 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -1,9 +1,15 @@
<%
+#code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm
my %flag = (
- 'D' => 'Default',
- 'F' => 'Fixed',
'' => '',
+ 'D' => 'Default',
+ 'F' => 'Fixed (unchangeable)',
+ #'M' => 'Manual selection from inventory',
+ 'M' => 'Manual selected from inventory',
+ #'A' => 'Automatically fill in from inventory',
+ 'A' => 'Automatically filled in from inventory',
+ 'X' => 'Excluded',
);
my %search;
@@ -27,6 +33,8 @@ if ( $cgi->param('orderby') eq 'active' ) {
@part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc;
}
+my %inventory_class = ();
+
%>
<%= include("/elements/header.html",'Service Definition Listing', menubar( 'Main Menu' => $p) ) %>
@@ -125,7 +133,21 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export
<%= $n1 %>
<TD><%= $field %></TD>
<TD><%= $flag{$flag} %></TD>
- <TD><%= $part_svc->part_svc_column($field)->columnvalue%></TD>
+
+ <TD>
+ <% my $value = $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" %>
+ <% } else { %>
+ <%= $value %>
+ <% } %>
+ </TD>
+
<% $n1="</TR><TR>";
}