diff options
Diffstat (limited to 'httemplate/browse')
22 files changed, 1491 insertions, 1319 deletions
diff --git a/httemplate/browse/access_group.html b/httemplate/browse/access_group.html index 9ebb2b882..d1c3aea4c 100644 --- a/httemplate/browse/access_group.html +++ b/httemplate/browse/access_group.html @@ -1,53 +1,54 @@ -<% - -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' ]; - -%><%= include( 'elements/browse.html', +% +% +%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' ]; +% +% +<% include( 'elements/browse.html', 'title' => 'Internal Access Groups', 'menubar' => [ # 'Main menu' => $p, 'Internal users' => $p.'browse/access_user.html', diff --git a/httemplate/browse/access_user.html b/httemplate/browse/access_user.html index 5b787977d..05384289a 100644 --- a/httemplate/browse/access_user.html +++ b/httemplate/browse/access_user.html @@ -1,83 +1,84 @@ -<% - -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/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; - - [ map { - my $access_usergroup = $_; - my $access_group = $access_usergroup->access_group; - [ - { - 'data' => $access_group->groupname, - 'align' => 'left', - 'link' => - $p. 'edit/access_group.html?'. $access_usergroup->groupnum, - }, - ]; - } - grep { $_->access_group # and ! $_->access_group->disabled - } - $access_user->access_usergroup, - - ]; - -}; - -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', +% +% +%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/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; +% +% [ map { +% my $access_usergroup = $_; +% my $access_group = $access_usergroup->access_group; +% [ +% { +% 'data' => $access_group->groupname, +% 'align' => 'left', +% 'link' => +% $p. 'edit/access_group.html?'. $access_usergroup->groupnum, +% }, +% ]; +% } +% grep { $_->access_group # and ! $_->access_group->disabled +% } +% $access_user->access_usergroup, +% +% ]; +% +%}; +% +%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', diff --git a/httemplate/browse/addr_block.cgi b/httemplate/browse/addr_block.cgi index d453adf8e..87f46c0e7 100644 --- a/httemplate/browse/addr_block.cgi +++ b/httemplate/browse/addr_block.cgi @@ -1,66 +1,73 @@ -<%= include("/elements/header.html",'Address Blocks', menubar('Main Menu' => $p)) %> -<% +<% include("/elements/header.html",'Address Blocks', menubar('Main Menu' => $p)) %> +% +% +%use NetAddr::IP; +% +%my @addr_block = qsearch('addr_block', {}); +%my @router = qsearch('router', {}); +%my $block; +%my $p2 = popurl(2); +%my $path = $p2 . "edit/process/addr_block"; +% +% +% if ($cgi->param('error')) { -use NetAddr::IP; - -my @addr_block = qsearch('addr_block', {}); -my @router = qsearch('router', {}); -my $block; -my $p2 = popurl(2); -my $path = $p2 . "edit/process/addr_block"; - -%> - -<% if ($cgi->param('error')) { %> - <FONT SIZE="+1" COLOR="#ff0000">Error: <%=$cgi->param('error')%></FONT> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%$cgi->param('error')%></FONT> <BR><BR> -<% } %> +% } -<%=table()%> -<% foreach $block (sort {$a->NetAddr cmp $b->NetAddr} @addr_block) { %> +<%table()%> +% foreach $block (sort {$a->NetAddr cmp $b->NetAddr} @addr_block) { + <TR> - <TD><%=$block->NetAddr%></TD> - <% if (my $router = $block->router) { %> - <% if (scalar($block->svc_broadband) == 0) { %> + <TD><%$block->NetAddr%></TD> +% if (my $router = $block->router) { +% if (scalar($block->svc_broadband) == 0) { + <TD> - <%=$router->routername%> + <%$router->routername%> </TD> <TD> - <FORM ACTION="<%=$path%>/deallocate.cgi" METHOD="POST"> - <INPUT TYPE="hidden" NAME="blocknum" VALUE="<%=$block->blocknum%>"> + <FORM ACTION="<%$path%>/deallocate.cgi" METHOD="POST"> + <INPUT TYPE="hidden" NAME="blocknum" VALUE="<%$block->blocknum%>"> <INPUT TYPE="submit" NAME="submit" VALUE="Deallocate"> </FORM> </TD> - <% } else { %> +% } else { + <TD COLSPAN="2"> - <%=$router->routername%> + <%$router->routername%> </TD> - <% } %> - <% } else { %> +% } +% } else { + <TD> - <FORM ACTION="<%=$path%>/allocate.cgi" METHOD="POST"> - <INPUT TYPE="hidden" NAME="blocknum" VALUE="<%=$block->blocknum%>"> + <FORM ACTION="<%$path%>/allocate.cgi" METHOD="POST"> + <INPUT TYPE="hidden" NAME="blocknum" VALUE="<%$block->blocknum%>"> <SELECT NAME="routernum" SIZE="1"> - <% foreach (@router) { %> - <OPTION VALUE="<%=$_->routernum %>"><%=$_->routername%></OPTION> - <% } %> +% foreach (@router) { + + <OPTION VALUE="<%$_->routernum %>"><%$_->routername%></OPTION> +% } + </SELECT> <INPUT TYPE="submit" NAME="submit" VALUE="Allocate"> </FORM> </TD> <TD> - <FORM ACTION="<%=$path%>/split.cgi" METHOD="POST"> - <INPUT TYPE="hidden" NAME="blocknum" VALUE="<%=$block->blocknum%>"> + <FORM ACTION="<%$path%>/split.cgi" METHOD="POST"> + <INPUT TYPE="hidden" NAME="blocknum" VALUE="<%$block->blocknum%>"> <INPUT TYPE="submit" NAME="submit" VALUE="Split"> </FORM> </TD> </TR> -<% } - } %> +% } +% } + <TR><TD COLSPAN="3"><BR></TD></TR> <TR> - <FORM ACTION="<%=$path%>/add.cgi" METHOD="POST"> + <FORM ACTION="<%$path%>/add.cgi" METHOD="POST"> <TD>Gateway/Netmask</TD> <TD> <INPUT TYPE="text" NAME="ip_gateway" SIZE="15">/<INPUT TYPE="text" NAME="ip_netmask" SIZE="2"> diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index f5157d9b7..001e6ba50 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,283 +1,371 @@ -<% - - my %search; - if ( $cgi->param('showdisabled') - || !dbdef->table('agent')->column('disabled') ) { - %search = (); - } else { - %search = ( 'disabled' => '' ); - } - - my $conf = new FS::Conf; - -%> -<%= include("/elements/header.html",'Agent Listing', menubar( +% +% +% my %search; +% if ( $cgi->param('showdisabled') +% || !dbdef->table('agent')->column('disabled') ) { +% %search = (); +% } else { +% %search = ( 'disabled' => '' ); +% } +% +% my $conf = new FS::Conf; +% +% + +<% include("/elements/header.html",'Agent Listing', menubar( 'Main Menu' => $p, 'Agent Types' => $p. 'browse/agent_type.cgi', # 'Add new agent' => '../edit/agent.cgi' )) %> Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type).<BR><BR> -<A HREF="<%= $p %>edit/agent.cgi"><I>Add a new agent</I></A><BR><BR> +<A HREF="<% $p %>edit/agent.cgi"><I>Add a new agent</I></A><BR><BR> +% if ( dbdef->table('agent')->column('disabled') ) { -<% if ( dbdef->table('agent')->column('disabled') ) { %> - <%= $cgi->param('showdisabled') + <% $cgi->param('showdisabled') ? do { $cgi->param('showdisabled', 0); '( <a href="'. $cgi->self_url. '">hide disabled agents</a> )'; } : do { $cgi->param('showdisabled', 1); '( <a href="'. $cgi->self_url. '">show disabled agents</a> )'; } %> -<% } %> +% } -<%= include('/elements/table-grid.html') %> -<% my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor = ''; -%> +<% include('/elements/table-grid.html') %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; +% + <TR> - <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<%= ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</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') ) { %> +% if ( $conf->config('ticket_system') ) { + <TH CLASS="grid" BGCOLOR="#cccccc">Ticketing</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> -# <TH>Agent</TH> +% +%# <TH><FONT SIZE=-1>Agent #</FONT></TH> +%# <TH>Agent</TH> +% +%foreach my $agent ( sort { +% #$a->getfield('agentnum') <=> $b->getfield('agentnum') +% $a->getfield('agent') cmp $b->getfield('agent') +%} qsearch('agent', \%search ) ) { +% +% my $cust_main_link = $p. 'search/cust_main.cgi?agentnum_on=1&'. +% 'agentnum='. $agent->agentnum; +% +% my $cust_pkg_link = $p. 'search/cust_pkg.cgi?agentnum='. $agent->agentnum; +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% +% + -foreach my $agent ( sort { - #$a->getfield('agentnum') <=> $b->getfield('agentnum') - $a->getfield('agent') cmp $b->getfield('agent') -} qsearch('agent', \%search ) ) { + <TR> + <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') ) { - my $cust_main_link = $p. 'search/cust_main.cgi?agentnum_on=1&'. - 'agentnum='. $agent->agentnum; + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $agent->disabled ? 'DISABLED' : '' %></TD> +% } - my $cust_pkg_link = $p. 'search/cust_pkg.cgi?agentnum='. $agent->agentnum; - - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } -%> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"> + <% $agent->agent %></A></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<%$p%>edit/agent_type.cgi?<% $agent->typenum %>"><% $agent->agent_type->atype %></A></TD> - <TR> - <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 CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $agent->disabled ? 'DISABLED' : '' %></TD> -<% } %> - - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%=$p%>edit/agent.cgi?<%= $agent->agentnum %>"> - <%= $agent->agent %></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 %>"> + <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0> <TR> <TH ALIGN="right" WIDTH="40%"> <FONT COLOR="#7e0079"> - <%= my $num_prospect = $agent->num_prospect_cust_main %> + <% my $num_prospect = $agent->num_prospect_cust_main %> </FONT> </TH> <TD> - <% if ( $num_prospect ) { %> - <A HREF="<%= $cust_main_link %>&prospect=1"><% } %>prospects<% if ($num_prospect ) { %></A><% } %> +% 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 %> + <% my $num_inactive = $agent->num_inactive_cust_main %> </FONT> </TH> <TD> - <% if ( $num_inactive ) { %> - <A HREF="<%= $cust_main_link %>&inactive=1"><% } %>inactive<% if ( $num_inactive ) { %></A><% } %> +% 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 %> + <% my $num_active = $agent->num_active_cust_main %> </FONT> </TH> <TD> - <% if ( $num_active ) { %> - <A HREF="<%= $cust_main_link %>&active=1"><% } %>active<% if ( $num_active ) { %></A><% } %> +% 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 %> + <% my $num_susp = $agent->num_susp_cust_main %> </FONT> </TH> <TD> - <% if ( $num_susp ) { %> - <A HREF="<%= $cust_main_link %>&suspended=1"><% } %>suspended<% if ( $num_susp ) { %></A><% } %> +% 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 %> + <% my $num_cancel = $agent->num_cancel_cust_main %> </FONT> </TH> <TD> - <% if ( $num_cancel ) { %> - <A HREF="<%= $cust_main_link %>&showcancelledcustomers=1&cancelled=1"><% } %>cancelled<% if ( $num_cancel ) { %></A><% } %> +% if ( $num_cancel ) { + + <A HREF="<% $cust_main_link %>&showcancelledcustomers=1&cancelled=1"> +% } +cancelled +% if ( $num_cancel ) { +</A> +% } + </TD> </TR> </TABLE> </TD> - <TD CLASS="inv" BGCOLOR="<%= $bgcolor %>" VALIGN="bottom"> + <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 %> + <% my $num_inactive_pkg = $agent->num_inactive_cust_pkg %> </FONT> </TH> <TD> - <% if ( $num_inactive_pkg ) { %> - <A HREF="<%= $cust_pkg_link %>&magic=inactive"><% } %>inactive<% if ( $num_inactive_pkg ) { %></A><% } %> +% 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 %> + <% my $num_active_pkg = $agent->num_active_cust_pkg %> </FONT> </TH> <TD> - <% if ( $num_active_pkg ) { %> - <A HREF="<%= $cust_pkg_link %>&magic=active"><% } %>active<% if ( $num_active_pkg ) { %></A><% } %> +% 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 %> + <% my $num_susp_pkg = $agent->num_susp_cust_pkg %> </FONT> </TH> <TD> - <% if ( $num_susp_pkg ) { %> - <A HREF="<%= $cust_pkg_link %>&magic=suspended"><% } %>suspended<% if ( $num_susp_pkg ) { %></A><% } %> +% 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 %> + <% my $num_cancel_pkg = $agent->num_cancel_cust_pkg %> </FONT> </TH> <TD> - <% if ( $num_cancel_pkg ) { %> - <A HREF="<%= $cust_pkg_link %>&magic=cancelled"><% } %>cancelled<% if ( $num_cancel_pkg ) { %></A><% } %> +% if ( $num_cancel_pkg ) { + + <A HREF="<% $cust_pkg_link %>&magic=cancelled"> +% } +cancelled +% if ( $num_cancel_pkg ) { +</A> +% } + </TD> </TR> </TABLE> </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> - <!--<BR><A HREF="<%= $p %>search/money_time.cgi?agentnum=<%= $agent->agentnum %>">Sales/Credits/Receipts</A>--> + <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> + <!--<BR><A HREF="<% $p %>search/money_time.cgi?agentnum=<% $agent->agentnum %>">Sales/Credits/Receipts</A>--> </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 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 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><% } %> - <BR><A HREF="<%=$p%>edit/prepay_credit.cgi?agentnum=<%= $agent->agentnum %>">Generate cards</A> + <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> +% } + + <BR><A HREF="<%$p%>edit/prepay_credit.cgi?agentnum=<% $agent->agentnum %>">Generate cards</A> </TD> +% if ( $conf->config('ticket_system') ) { - <% if ( $conf->config('ticket_system') ) { %> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"> - <% if ( $agent->ticketing_queueid ) { %> - Queue: <%= $agent->ticketing_queueid %>: <%= $agent->ticketing_queue %><BR> - <% } %> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> +% if ( $agent->ticketing_queueid ) { + + Queue: <% $agent->ticketing_queueid %>: <% $agent->ticketing_queue %><BR> +% } + </TD> +% } - <% } %> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> <TABLE CELLSPACING=0 CELLPADDING=0> - <% foreach my $override ( - # sort { } want taxclass-full stuff first? and default cards (empty cardtype) - qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } ) - ) { - %> +% foreach my $override ( +% # sort { } want taxclass-full stuff first? and default cards (empty cardtype) +% qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } ) +% ) { +% + <TR> <TD> - <%= $override->cardtype || 'Default' %> to <%= $override->payment_gateway->gateway_module %> (<%= $override->payment_gateway->gateway_username %>) - <%= $override->taxclass + <% $override->cardtype || 'Default' %> to <% $override->payment_gateway->gateway_module %> (<% $override->payment_gateway->gateway_username %>) + <% $override->taxclass ? ' for '. $override->taxclass. ' only' : '' %> - <FONT SIZE=-1><A HREF="<%=$p%>misc/delete-agent_payment_gateway.cgi?<%= 'XXXoverridenum' %>">(delete)</A></FONT> + <FONT SIZE=-1><A HREF="<%$p%>misc/delete-agent_payment_gateway.cgi?<% 'XXXoverridenum' %>">(delete)</A></FONT> </TD> </TR> - <% } %> +% } + <TR> - <TD><FONT SIZE=-1><A HREF="<%=$p%>edit/agent_payment_gateway.html?agentnum=<%= $agent->agentnum %>">(add override)</A></FONT></TD> + <TD><FONT SIZE=-1><A HREF="<%$p%>edit/agent_payment_gateway.html?agentnum=<% $agent->agentnum %>">(add override)</A></FONT></TD> </TR> </TABLE> </TD> <!-- - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $agent->freq %></TD> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $agent->prog %></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $agent->freq %></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $agent->prog %></TD> --> </TR> +% } -<% } %> </TABLE> </BODY> diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index ceffce3d4..318d0b6ea 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,37 +1,38 @@ -<% - -my $html_init = - 'Agent types define groups of packages that you can then assign to'. - ' particular agents.<BR><BR>'. - qq!<A HREF="${p}edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>!; - -my $count_query = 'SELECT COUNT(*) FROM agent_type'; - -#false laziness w/access_user.html -my $packages_sub = sub { - my $agent_type = shift; - - [ map { - my $type_pkgs = $_; - #my $part_pkg = $type_pkgs->part_pkg; - [ - { - #'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, - }, - ]; - } - - $agent_type->type_pkgs_enabled - ]; - -}; - -my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ]; - -%><%= include( 'elements/browse.html', +% +% +%my $html_init = +% 'Agent types define groups of packages that you can then assign to'. +% ' particular agents.<BR><BR>'. +% qq!<A HREF="${p}edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>!; +% +%my $count_query = 'SELECT COUNT(*) FROM agent_type'; +% +%#false laziness w/access_user.html +%my $packages_sub = sub { +% my $agent_type = shift; +% +% [ map { +% my $type_pkgs = $_; +% #my $part_pkg = $type_pkgs->part_pkg; +% [ +% { +% #'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, +% }, +% ]; +% } +% +% $agent_type->type_pkgs_enabled +% ]; +% +%}; +% +%my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ]; +% +% +<% include( 'elements/browse.html', 'title' => 'Agent Types', 'menubar' => [ #'Main menu' => $p, 'Agents' =>"${p}browse/agent.cgi", diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 9e3feb8f3..69a7eb9a0 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -1,22 +1,22 @@ -<%= include('/elements/header.html', "Tax Rate Listing", menubar( +<% include('/elements/header.html', "Tax Rate Listing", menubar( 'Edit tax rates' => $p. "edit/cust_main_county.cgi", )) %> Click on <u>expand country</u> to specify a country's tax rates by state. <BR>Click on <u>expand state</u> to specify a state's tax rates by county. +% +%my $conf = new FS::Conf; +%my $enable_taxclasses = $conf->exists('enable_taxclasses'); +% +%if ( $enable_taxclasses ) { -<% -my $conf = new FS::Conf; -my $enable_taxclasses = $conf->exists('enable_taxclasses'); - -if ( $enable_taxclasses ) { %> <BR>Click on <u>expand taxclasses</u> to specify tax classes +% } -<% } %> <BR><BR> -<%= table() %> +<% table() %> <TR> <TH><FONT SIZE=-1>Country</FONT></TH> @@ -27,123 +27,140 @@ if ( $enable_taxclasses ) { %> <TH><FONT SIZE=-1>Tax</FONT></TH> <TH><FONT SIZE=-1>Exemption</TH> </TR> +% +%my @regions = sort { $a->country cmp $b->country +% or $a->state cmp $b->state +% or $a->county cmp $b->county +% or $a->taxclass cmp $b->taxclass +% } qsearch('cust_main_county',{}); +% +%my $sup=0; +%#foreach $cust_main_county ( @regions ) { +%for ( my $i=0; $i<@regions; $i++ ) { +% my $cust_main_county = $regions[$i]; +% my $hashref = $cust_main_county->hashref; +% +% -<% -my @regions = sort { $a->country cmp $b->country - or $a->state cmp $b->state - or $a->county cmp $b->county - or $a->taxclass cmp $b->taxclass - } qsearch('cust_main_county',{}); - -my $sup=0; -#foreach $cust_main_county ( @regions ) { -for ( my $i=0; $i<@regions; $i++ ) { - my $cust_main_county = $regions[$i]; - my $hashref = $cust_main_county->hashref; - - %> <TR> - <TD BGCOLOR="#ffffff"><%= $hashref->{country} %></TD> - - <% - - my $j; - if ( $sup ) { - $sup--; - } else { - - #lookahead - for ( $j=1; $i+$j<@regions; $j++ ) { - last if $hashref->{country} ne $regions[$i+$j]->country - || $hashref->{state} ne $regions[$i+$j]->state - || $hashref->{tax} != $regions[$i+$j]->tax - || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount - || $hashref->{setuptax} ne $regions[$i+$j]->setuptax - || $hashref->{recurtax} ne $regions[$i+$j]->recurtax; - } - - my $newsup=0; - if ( $j>1 && $i+$j+1 < @regions - && ( $hashref->{state} ne $regions[$i+$j+1]->state - || $hashref->{country} ne $regions[$i+$j+1]->country - ) - && ( ! $i - || $hashref->{state} ne $regions[$i-1]->state - || $hashref->{country} ne $regions[$i-1]->country - ) - ) { - $sup = $j-1; - } else { - $j = 1; - } - - %> - - <TD ROWSPAN=<%= $j %><%= + <TD BGCOLOR="#ffffff"><% $hashref->{country} %></TD> +% +% +% my $j; +% if ( $sup ) { +% $sup--; +% } else { +% +% #lookahead +% for ( $j=1; $i+$j<@regions; $j++ ) { +% last if $hashref->{country} ne $regions[$i+$j]->country +% || $hashref->{state} ne $regions[$i+$j]->state +% || $hashref->{tax} != $regions[$i+$j]->tax +% || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount +% || $hashref->{setuptax} ne $regions[$i+$j]->setuptax +% || $hashref->{recurtax} ne $regions[$i+$j]->recurtax; +% } +% +% my $newsup=0; +% if ( $j>1 && $i+$j+1 < @regions +% && ( $hashref->{state} ne $regions[$i+$j+1]->state +% || $hashref->{country} ne $regions[$i+$j+1]->country +% ) +% && ( ! $i +% || $hashref->{state} ne $regions[$i-1]->state +% || $hashref->{country} ne $regions[$i-1]->country +% ) +% ) { +% $sup = $j-1; +% } else { +% $j = 1; +% } +% +% + + + <TD ROWSPAN=<% $j %><% $hashref->{state} ? ' BGCOLOR="#ffffff">'. $hashref->{state} : qq! BGCOLOR="#cccccc">(ALL) <FONT SIZE=-1>!. qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}. qq!">expand country</A></FONT>! %> - <% if ( $j>1 ) { %> - <FONT SIZE=-1><A HREF="<%= $p %>edit/process/cust_main_county-collapse.cgi?<%= $hashref->{taxnum} %>">collapse state</A></FONT> - <% } %> +% if ( $j>1 ) { + + <FONT SIZE=-1><A HREF="<% $p %>edit/process/cust_main_county-collapse.cgi?<% $hashref->{taxnum} %>">collapse state</A></FONT> +% } + </TD> - <% } %> - -<% # $sup=$newsup; %> - - <TD<% if ( $hashref->{county} ) { - %> BGCOLOR="#ffffff"><%= $hashref->{county} %> - <% } else { - %> BGCOLOR="#cccccc">(ALL) - <% if ( $hashref->{state} ) { %> - <FONT SIZE=-1><A HREF="<%= $p %>edit/cust_main_county-expand.cgi?<%= $hashref->{taxnum} %>">expand state</A></FONT> - <% } %> - <% } %> +% } +% # $sup=$newsup; + + + <TD +% if ( $hashref->{county} ) { +% + BGCOLOR="#ffffff"><% $hashref->{county} %> +% } else { +% + BGCOLOR="#cccccc">(ALL) +% if ( $hashref->{state} ) { + + <FONT SIZE=-1><A HREF="<% $p %>edit/cust_main_county-expand.cgi?<% $hashref->{taxnum} %>">expand state</A></FONT> +% } +% } + </TD> - <TD<% if ( $hashref->{taxclass} ) { - %> BGCOLOR="#ffffff"><%= $hashref->{taxclass} %> - <% } else { - %> BGCOLOR="#cccccc">(ALL) - <% if ( $enable_taxclasses ) { %> - <FONT SIZE=-1><A HREF="<%= $p %>edit/cust_main_county-expand.cgi?taxclass<%= $hashref->{taxnum} %>">expand taxclasses</A></FONT> - <% } %> - <% } %> + <TD +% if ( $hashref->{taxclass} ) { +% + BGCOLOR="#ffffff"><% $hashref->{taxclass} %> +% } else { +% + BGCOLOR="#cccccc">(ALL) +% if ( $enable_taxclasses ) { + + <FONT SIZE=-1><A HREF="<% $p %>edit/cust_main_county-expand.cgi?taxclass<% $hashref->{taxnum} %>">expand taxclasses</A></FONT> +% } +% } + </TD> - <TD<% if ( $hashref->{taxname} ) { - %> BGCOLOR="#ffffff"><%= $hashref->{taxname} %> - <% } else { - %> BGCOLOR="#cccccc">Tax - <% } %> + <TD +% if ( $hashref->{taxname} ) { +% + BGCOLOR="#ffffff"><% $hashref->{taxname} %> +% } else { +% + BGCOLOR="#cccccc">Tax +% } + </TD> - <TD BGCOLOR="#ffffff"><%= $hashref->{tax} %>%</TD> + <TD BGCOLOR="#ffffff"><% $hashref->{tax} %>%</TD> <TD BGCOLOR="#ffffff"> +% if ( $hashref->{exempt_amount} > 0 ) { - <% if ( $hashref->{exempt_amount} > 0 ) { %> - $<%= sprintf("%.2f", $hashref->{exempt_amount} ) %> per month<BR> - <% } %> + $<% sprintf("%.2f", $hashref->{exempt_amount} ) %> per month<BR> +% } +% if ( $hashref->{setuptax} =~ /^Y$/i ) { - <% if ( $hashref->{setuptax} =~ /^Y$/i ) { %> Setup fee<BR> - <% } %> - - <% if ( $hashref->{recurtax} =~ /^Y$/i ) { %> +% } +% if ( $hashref->{recurtax} =~ /^Y$/i ) { + Recurring fee<BR> - <% } %> +% } + </TD> </TR> +% } -<% } %> </TABLE> -<%= include('/elements/footer.html') %> +<% include('/elements/footer.html') %> diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi index 98ea2f5a2..e40e95870 100755 --- a/httemplate/browse/cust_pay_batch.cgi +++ b/httemplate/browse/cust_pay_batch.cgi @@ -1,27 +1,27 @@ <!-- mason kludge --> -<%= include("/elements/header.html","Credit card batch details", menubar( 'Main Menu' => $p,)) %> +<% include("/elements/header.html","Credit card batch details", menubar( 'Main Menu' => $p,)) %> +% +% +%die "No batch specified (bad URL)!" unless $cgi->keywords; +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $batchnum = $1; +%my $pay_batch = qsearchs('pay_batch',{'batchnum'=>$batchnum}); +%die "Batch not found!" unless $pay_batch; +% +% -<% -die "No batch specified (bad URL)!" unless $cgi->keywords; -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $batchnum = $1; -my $pay_batch = qsearchs('pay_batch',{'batchnum'=>$batchnum}); -die "Batch not found!" unless $pay_batch; - -%> - -<FORM ACTION="<%=$p%>misc/download-batch.cgi" METHOD="POST"> +<FORM ACTION="<%$p%>misc/download-batch.cgi" METHOD="POST"> Download batch in format <SELECT NAME="format"> <OPTION VALUE="">Default batch mode</OPTION> <OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV file for TD Canada Trust Merchant PC Batch</OPTION> <OPTION VALUE="PAP">80 byte file for TD Canada Trust PAP Batch</OPTION> <OPTION VALUE="BoM">Bank of Montreal ECA batch</OPTION> -</SELECT><INPUT TYPE="hidden" NAME="batchnum" VALUE="<%= $batchnum %>"><INPUT TYPE="submit" VALUE="Download"></FORM> +</SELECT><INPUT TYPE="hidden" NAME="batchnum" VALUE="<% $batchnum %>"><INPUT TYPE="submit" VALUE="Download"></FORM> <BR><BR> -<FORM ACTION="<%=$p%>misc/upload-batch.cgi" METHOD="POST" ENCTYPE="multipart/form-data"> +<FORM ACTION="<%$p%>misc/upload-batch.cgi" METHOD="POST" ENCTYPE="multipart/form-data"> Upload results<BR> Filename <INPUT TYPE="file" NAME="batch_results"><BR> Format <SELECT NAME="format"> @@ -32,26 +32,26 @@ Format <SELECT NAME="format"> </SELECT><BR> <INPUT TYPE="submit" VALUE="Upload"></FORM> <BR> +% +% my $statement = "SELECT SUM(amount) from cust_pay_batch WHERE batchnum=". +% $batchnum; +% my $sth = dbh->prepare($statement) or die dbh->errstr. "doing $statement"; +% $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; +% my $total = $sth->fetchrow_arrayref->[0]; +% +% my $c_statement = "SELECT COUNT(*) from cust_pay_batch WHERE batchnum=". +% $batchnum; +% my $c_sth = dbh->prepare($c_statement) +% or die dbh->errstr. "doing $c_statement"; +% $c_sth->execute or die "Error executing \"$c_statement\": ". $c_sth->errstr; +% my $cards = $c_sth->fetchrow_arrayref->[0]; +% -<% - my $statement = "SELECT SUM(amount) from cust_pay_batch WHERE batchnum=". - $batchnum; - my $sth = dbh->prepare($statement) or die dbh->errstr. "doing $statement"; - $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; - my $total = $sth->fetchrow_arrayref->[0]; - - my $c_statement = "SELECT COUNT(*) from cust_pay_batch WHERE batchnum=". - $batchnum; - my $c_sth = dbh->prepare($c_statement) - or die dbh->errstr. "doing $c_statement"; - $c_sth->execute or die "Error executing \"$c_statement\": ". $c_sth->errstr; - my $cards = $c_sth->fetchrow_arrayref->[0]; -%> -<%= $cards %> credit card payments batched<BR> -$<%= sprintf("%.2f", $total) %> total in batch<BR> +<% $cards %> credit card payments batched<BR> +$<% sprintf("%.2f", $total) %> total in batch<BR> <BR> -<%= &table() %> +<% &table() %> <TR> <TH>#</TH> <TH><font size=-1>inv#</font></TH> @@ -62,35 +62,35 @@ $<%= sprintf("%.2f", $total) %> total in batch<BR> <TH>Amount</TH> <TH>Status</TH> </TR> +% +%foreach my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } +% qsearch('cust_pay_batch', {'batchnum'=>$batchnum} ) +%) { +% my $cardnum = $cust_pay_batch->payinfo; +% #$cardnum =~ s/.{4}$/xxxx/; +% $cardnum = 'x'x(length($cardnum)-4). substr($cardnum,(length($cardnum)-4)); +% +% $cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; +% my( $mon, $year ) = ( $2, $1 ); +% $mon = "0$mon" if $mon < 10; +% my $exp = "$mon/$year"; +% +% -<% -foreach my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } - qsearch('cust_pay_batch', {'batchnum'=>$batchnum} ) -) { - my $cardnum = $cust_pay_batch->payinfo; - #$cardnum =~ s/.{4}$/xxxx/; - $cardnum = 'x'x(length($cardnum)-4). substr($cardnum,(length($cardnum)-4)); - - $cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; - my( $mon, $year ) = ( $2, $1 ); - $mon = "0$mon" if $mon < 10; - my $exp = "$mon/$year"; - -%> <TR> - <TD><%= $cust_pay_batch->paybatchnum %></TD> - <TD><A HREF="../view/cust_bill.cgi?<%= $cust_pay_batch->invnum %>"><%= $cust_pay_batch->invnum %></TD> - <TD><A HREF="../view/cust_main.cgi?<%= $cust_pay_batch->custnum %>"><%= $cust_pay_batch->custnum %></TD> - <TD><%= $cust_pay_batch->get('last'). ', '. $cust_pay_batch->first %></TD> - <TD><%= $cust_pay_batch->payname %></TD> - <TD><%= $cardnum %></TD> - <TD><%= $exp %></TD> - <TD align="right">$<%= $cust_pay_batch->amount %></TD> - <TD><%= $cust_pay_batch->status %></TD> + <TD><% $cust_pay_batch->paybatchnum %></TD> + <TD><A HREF="../view/cust_bill.cgi?<% $cust_pay_batch->invnum %>"><% $cust_pay_batch->invnum %></TD> + <TD><A HREF="../view/cust_main.cgi?<% $cust_pay_batch->custnum %>"><% $cust_pay_batch->custnum %></TD> + <TD><% $cust_pay_batch->get('last'). ', '. $cust_pay_batch->first %></TD> + <TD><% $cust_pay_batch->payname %></TD> + <TD><% $cardnum %></TD> + <TD><% $exp %></TD> + <TD align="right">$<% $cust_pay_batch->amount %></TD> + <TD><% $cust_pay_batch->status %></TD> </TR> +% } -<% } %> </TABLE> </BODY> diff --git a/httemplate/browse/elements/browse.html b/httemplate/browse/elements/browse.html index 6d146d356..2cc5a9660 100644 --- a/httemplate/browse/elements/browse.html +++ b/httemplate/browse/elements/browse.html @@ -1,4 +1,4 @@ -<%= include( '/search/elements/search.html', +<% include( '/search/elements/search.html', @_, 'disable_download' => 1, 'disable_nonefound' => 1, diff --git a/httemplate/browse/inventory_class.html b/httemplate/browse/inventory_class.html index 4a15bf7d4..6d9424e14 100644 --- a/httemplate/browse/inventory_class.html +++ b/httemplate/browse/inventory_class.html @@ -1,27 +1,28 @@ -<% - -tie my %labels, 'Tie::IxHash', - 'num_avail' => 'Available', # <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>', - 'num_used' => 'In use', #'Used', #'Allocated', - 'num_total' => 'Total', -; - -my %link = ( - 'num_avail' => ';avail=1', - 'num_used' => ';used=1', - 'num_total' => '', -); - -my %inv_action_link = ( - 'num_avail' => [ 'upload batch', - $p.'misc/inventory_item-import.html?classnum=', - 'classnum' - ], -); - -my $link = [ "${p}edit/inventory_class.html?", 'classnum' ]; - -%><%= include( 'elements/browse.html', +% +% +%tie my %labels, 'Tie::IxHash', +% 'num_avail' => 'Available', # <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>', +% 'num_used' => 'In use', #'Used', #'Allocated', +% 'num_total' => 'Total', +%; +% +%my %link = ( +% 'num_avail' => ';avail=1', +% 'num_used' => ';used=1', +% 'num_total' => '', +%); +% +%my %inv_action_link = ( +% 'num_avail' => [ 'upload batch', +% $p.'misc/inventory_item-import.html?classnum=', +% 'classnum' +% ], +%); +% +%my $link = [ "${p}edit/inventory_class.html?", 'classnum' ]; +% +% +<% include( 'elements/browse.html', 'title' => 'Inventory Classes', 'name' => 'inventory classes', 'menubar' => [ 'Add a new inventory class' => diff --git a/httemplate/browse/msgcat.cgi b/httemplate/browse/msgcat.cgi index 318ebfdff..35ea06957 100755 --- a/httemplate/browse/msgcat.cgi +++ b/httemplate/browse/msgcat.cgi @@ -1,40 +1,42 @@ -<%= include('/elements/header.html', "View Message catalog", menubar( +<% include('/elements/header.html', "View Message catalog", menubar( 'Edit message catalog' => $p. "edit/msgcat.cgi", -)) %><% +)) %> +% +% +%my $widget = new HTML::Widgets::SelectLayers( +% 'selected_layer' => 'en_US', +% 'options' => { 'en_US'=>'en_US' }, +% 'layer_callback' => sub { +% my $layer = shift; +% my $html = "<BR>Messages for locale $layer<BR>". table(). +% "<TR><TH COLSPAN=2>Code</TH>". +% "<TH>Message</TH>"; +% $html .= "<TH>en_US Message</TH>" unless $layer eq 'en_US'; +% $html .= '</TR>'; +% +% #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode } +% # qsearch('msgcat', { 'locale' => $layer } ) ) { +% foreach my $msgcat ( qsearch('msgcat', { 'locale' => $layer } ) ) { +% $html .= '<TR><TD>'. $msgcat->msgnum. '</TD>'. +% '<TD>'. $msgcat->msgcode. '</TD>'. +% '<TD>'. $msgcat->msg. '</TD>'; +% unless ( $layer eq 'en_US' ) { +% my $en_msgcat = qsearchs('msgcat', { +% 'locale' => 'en_US', +% 'msgcode' => $msgcat->msgcode, +% } ); +% $html .= '<TD>'. $en_msgcat->msg. '</TD>'; +% } +% $html .= '</TR>'; +% } +% +% $html .= '</TABLE>'; +% $html; +% }, +% +%); +% -my $widget = new HTML::Widgets::SelectLayers( - 'selected_layer' => 'en_US', - 'options' => { 'en_US'=>'en_US' }, - 'layer_callback' => sub { - my $layer = shift; - my $html = "<BR>Messages for locale $layer<BR>". table(). - "<TR><TH COLSPAN=2>Code</TH>". - "<TH>Message</TH>"; - $html .= "<TH>en_US Message</TH>" unless $layer eq 'en_US'; - $html .= '</TR>'; - #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode } - # qsearch('msgcat', { 'locale' => $layer } ) ) { - foreach my $msgcat ( qsearch('msgcat', { 'locale' => $layer } ) ) { - $html .= '<TR><TD>'. $msgcat->msgnum. '</TD>'. - '<TD>'. $msgcat->msgcode. '</TD>'. - '<TD>'. $msgcat->msg. '</TD>'; - unless ( $layer eq 'en_US' ) { - my $en_msgcat = qsearchs('msgcat', { - 'locale' => 'en_US', - 'msgcode' => $msgcat->msgcode, - } ); - $html .= '<TD>'. $en_msgcat->msg. '</TD>'; - } - $html .= '</TR>'; - } - - $html .= '</TABLE>'; - $html; - }, - -); -%> - -<%= $widget->html %> -<%= include('/elements/footer.html') %> +<% $widget->html %> +<% include('/elements/footer.html') %> diff --git a/httemplate/browse/nas.cgi b/httemplate/browse/nas.cgi index 9ccbfe632..022c65ea7 100755 --- a/httemplate/browse/nas.cgi +++ b/httemplate/browse/nas.cgi @@ -1,80 +1,81 @@ <!-- mason kludge --> -<% +% +% +%print header('NAS ports', menubar( +% 'Main Menu' => $p, +%)); +% +%my $now = time; +% +%foreach my $nas ( sort { $a->nasnum <=> $b->nasnum } qsearch( 'nas', {} ) ) { +% print $nas->nasnum. ": ". $nas->nas. " ". +% $nas->nasfqdn. " (". $nas->nasip. ") ". +% "as of ". time2str("%c",$nas->last). +% " (". &pretty_interval($now - $nas->last). " ago)<br>". +% &table(). "<TR><TH>Nas<BR>Port #</TH><TH>Global<BR>Port #</BR></TH>". +% "<TH>IP address</TH><TH>User</TH><TH>Since</TH><TH>Duration</TH><TR>", +% ; +% foreach my $port ( sort { +% $a->nasport <=> $b->nasport || $a->portnum <=> $b->portnum +% } qsearch( 'port', { 'nasnum' => $nas->nasnum } ) ) { +% my $session = $port->session; +% my($user, $since, $pretty_since, $duration); +% if ( ! $session ) { +% $user = "(empty)"; +% $since = 0; +% $pretty_since = "(never)"; +% $duration = ''; +% } elsif ( $session->logout ) { +% $user = "(empty)"; +% $since = $session->logout; +% } else { +% my $svc_acct = $session->svc_acct; +% $user = "<A HREF=\"$p/view/svc_acct.cgi?". $svc_acct->svcnum. "\">". +% $svc_acct->username. "</A>"; +% $since = $session->login; +% } +% $pretty_since = time2str("%c", $since) if $since; +% $duration = pretty_interval( $now - $since ). " ago" +% unless defined($duration); +% print "<TR><TD>". $port->nasport. "</TD><TD>". $port->portnum. "</TD><TD>". +% $port->ip. "</TD><TD>$user</TD><TD>$pretty_since". +% "</TD><TD>$duration</TD></TR>" +% ; +% } +% print "</TABLE><BR>"; +%} +% +%#Time::Duration?? +%sub pretty_interval { +% my $interval = shift; +% my %howlong = ( +% '604800' => 'week', +% '86400' => 'day', +% '3600' => 'hour', +% '60' => 'minute', +% '1' => 'second', +% ); +% +% my $pretty = ""; +% foreach my $key ( sort { $b <=> $a } keys %howlong ) { +% my $value = int( $interval / $key ); +% if ( $value ) { +% if ( $value == 1 ) { +% $pretty .= +% ( $howlong{$key} eq 'hour' ? 'an ' : 'a ' ). $howlong{$key}. " " +% } else { +% $pretty .= $value. ' '. $howlong{$key}. 's '; +% } +% } +% $interval -= $value * $key; +% } +% $pretty =~ /^\s*(\S.*\S)\s*$/; +% $1; +%} +% +%#print &table(), <<END; +%#<TR> +%# <TH>#</TH> +%# <TH>NAS</ +% -print header('NAS ports', menubar( - 'Main Menu' => $p, -)); - -my $now = time; - -foreach my $nas ( sort { $a->nasnum <=> $b->nasnum } qsearch( 'nas', {} ) ) { - print $nas->nasnum. ": ". $nas->nas. " ". - $nas->nasfqdn. " (". $nas->nasip. ") ". - "as of ". time2str("%c",$nas->last). - " (". &pretty_interval($now - $nas->last). " ago)<br>". - &table(). "<TR><TH>Nas<BR>Port #</TH><TH>Global<BR>Port #</BR></TH>". - "<TH>IP address</TH><TH>User</TH><TH>Since</TH><TH>Duration</TH><TR>", - ; - foreach my $port ( sort { - $a->nasport <=> $b->nasport || $a->portnum <=> $b->portnum - } qsearch( 'port', { 'nasnum' => $nas->nasnum } ) ) { - my $session = $port->session; - my($user, $since, $pretty_since, $duration); - if ( ! $session ) { - $user = "(empty)"; - $since = 0; - $pretty_since = "(never)"; - $duration = ''; - } elsif ( $session->logout ) { - $user = "(empty)"; - $since = $session->logout; - } else { - my $svc_acct = $session->svc_acct; - $user = "<A HREF=\"$p/view/svc_acct.cgi?". $svc_acct->svcnum. "\">". - $svc_acct->username. "</A>"; - $since = $session->login; - } - $pretty_since = time2str("%c", $since) if $since; - $duration = pretty_interval( $now - $since ). " ago" - unless defined($duration); - print "<TR><TD>". $port->nasport. "</TD><TD>". $port->portnum. "</TD><TD>". - $port->ip. "</TD><TD>$user</TD><TD>$pretty_since". - "</TD><TD>$duration</TD></TR>" - ; - } - print "</TABLE><BR>"; -} - -#Time::Duration?? -sub pretty_interval { - my $interval = shift; - my %howlong = ( - '604800' => 'week', - '86400' => 'day', - '3600' => 'hour', - '60' => 'minute', - '1' => 'second', - ); - - my $pretty = ""; - foreach my $key ( sort { $b <=> $a } keys %howlong ) { - my $value = int( $interval / $key ); - if ( $value ) { - if ( $value == 1 ) { - $pretty .= - ( $howlong{$key} eq 'hour' ? 'an ' : 'a ' ). $howlong{$key}. " " - } else { - $pretty .= $value. ' '. $howlong{$key}. 's '; - } - } - $interval -= $value * $key; - } - $pretty =~ /^\s*(\S.*\S)\s*$/; - $1; -} - -#print &table(), <<END; -#<TR> -# <TH>#</TH> -# <TH>NAS</ -%> diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi index 91e31d832..2486c6669 100755 --- a/httemplate/browse/part_bill_event.cgi +++ b/httemplate/browse/part_bill_event.cgi @@ -1,118 +1,116 @@ -<% -my %search; -if ( $cgi->param('showdisabled') ) { - %search = (); -} else { - %search = ( 'disabled' => '' ); -} +% +%my %search; +%if ( $cgi->param('showdisabled') ) { +% %search = (); +%} else { +% %search = ( 'disabled' => '' ); +%} +% +%my @part_bill_event = qsearch('part_bill_event', \%search ); +%my $total = scalar(@part_bill_event); +% -my @part_bill_event = qsearch('part_bill_event', \%search ); -my $total = scalar(@part_bill_event); -%> -<%= include("/elements/header.html",'Invoice Event Listing', menubar( 'Main Menu' => $p) ) %> +<% include("/elements/header.html",'Invoice Event Listing', menubar( 'Main Menu' => $p) ) %> Invoice events are actions taken on open invoices.<BR><BR> -<A HREF="<%= $p %>edit/part_bill_event.cgi"><I>Add a new invoice event</I></A> +<A HREF="<% $p %>edit/part_bill_event.cgi"><I>Add a new invoice event</I></A> <BR><BR> -<%= $total %> events -<%= $cgi->param('showdisabled') +<% $total %> events +<% $cgi->param('showdisabled') ? do { $cgi->param('showdisabled', 0); '( <a href="'. $cgi->self_url. '">hide disabled events</a> )'; } : do { $cgi->param('showdisabled', 1); '( <a href="'. $cgi->self_url. '">show disabled events</a> )'; } %> <BR><BR> +% tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname; +% tie my %freq, 'Tie::IxHash', '1d' => 'daily', '1m' => 'monthly'; +% foreach my $payby ( keys %payby ) { +% my $oldfreq = ''; +% +% my @payby_part_bill_event = +% grep { $payby eq $_->payby } +% sort { ( $a->freq || '1d') cmp ( $b->freq || '1d' ) # for now +% || $a->seconds <=> $b->seconds +% || $a->weight <=> $b->weight +% || $a->eventpart <=> $b->eventpart +% } +% @part_bill_event; +% +% +% if ( @payby_part_bill_event ) { -<% tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname; - tie my %freq, 'Tie::IxHash', '1d' => 'daily', '1m' => 'monthly'; - foreach my $payby ( keys %payby ) { - my $oldfreq = ''; - - my @payby_part_bill_event = - grep { $payby eq $_->payby } - sort { ( $a->freq || '1d') cmp ( $b->freq || '1d' ) # for now - || $a->seconds <=> $b->seconds - || $a->weight <=> $b->weight - || $a->eventpart <=> $b->eventpart - } - @part_bill_event; - -%> - <% if ( @payby_part_bill_event ) { %> + <% include('/elements/table-grid.html') %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor; +% +% +% foreach my $part_bill_event ( @payby_part_bill_event ) { +% my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart; +% my $delay = duration_exact($part_bill_event->seconds); +% ( my $plandata = $part_bill_event->plandata ) =~ s/\n/<BR>/go; +% my $freq = $part_bill_event->freq || '1d'; +% +% if ( $oldfreq ne $freq ) { - <%= include('/elements/table-grid.html') %> - - <% my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor; - %> - - <% - foreach my $part_bill_event ( @payby_part_bill_event ) { - my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart; - my $delay = duration_exact($part_bill_event->seconds); - ( my $plandata = $part_bill_event->plandata ) =~ s/\n/<BR>/go; - my $freq = $part_bill_event->freq || '1d'; - %> - - <% if ( $oldfreq ne $freq ) { %> <TR> - <TH CLASS="grid" BGCOLOR="#999999" COLSPAN=<%= $cgi->param('showdisabled') ? 7 : 8 %>><%= ucfirst($freq{$freq}) %> event tests for <FONT SIZE="+1"><I><%= $payby{$payby} %> customers</I></FONT></TH> + <TH CLASS="grid" BGCOLOR="#999999" COLSPAN=<% $cgi->param('showdisabled') ? 7 : 8 %>><% ucfirst($freq{$freq}) %> event tests for <FONT SIZE="+1"><I><% $payby{$payby} %> customers</I></FONT></TH> </TR> <TR> - <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Event</TH> + <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% $cgi->param('showdisabled') ? 2 : 3 %>>Event</TH> <TH CLASS="grid" BGCOLOR="#cccccc">After</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Action</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Options</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Code</TH> </TR> - - <% - $oldfreq = $freq; - $bgcolor = ''; - %> - - <% } %> - - <% - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } - %> +% +% $oldfreq = $freq; +% $bgcolor = ''; +% +% } +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% + <TR> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%= $url %>"> - <%= $part_bill_event->eventpart %></A></TD> - <% unless ( $cgi->param('showdisabled') ) { %> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"> - <%= $part_bill_event->disabled ? 'DISABLED' : '' %></TD> - <% } %> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%= $url %>"> - <%= $part_bill_event->event %></A></TD> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"> - <%= $delay %></TD> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"> - <%= $part_bill_event->plan %></TD> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"> - <%= $plandata %></TD> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><FONT SIZE="-1"> - <%= $part_bill_event->eventcode %></FONT></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $url %>"> + <% $part_bill_event->eventpart %></A></TD> +% unless ( $cgi->param('showdisabled') ) { + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% $part_bill_event->disabled ? 'DISABLED' : '' %></TD> +% } + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $url %>"> + <% $part_bill_event->event %></A></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% $delay %></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% $part_bill_event->plan %></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% $plandata %></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><FONT SIZE="-1"> + <% $part_bill_event->eventcode %></FONT></TD> </TR> - <% } %> +% } + </TABLE> <BR><BR> +% } +% } - <% } %> - -<% } %> </BODY> </HTML> diff --git a/httemplate/browse/part_export.cgi b/httemplate/browse/part_export.cgi index 25a49cd20..0f6731739 100755 --- a/httemplate/browse/part_export.cgi +++ b/httemplate/browse/part_export.cgi @@ -1,7 +1,7 @@ <!-- mason kludge --> -<%= include("/elements/header.html","Export Listing", menubar( 'Main Menu' => "$p#sysadmin" )) %> +<% include("/elements/header.html","Export Listing", menubar( 'Main Menu' => "$p#sysadmin" )) %> Provisioning services to external machines, databases and APIs.<BR><BR> -<A HREF="<%= $p %>edit/part_export.cgi"><I>Add a new export</I></A><BR><BR> +<A HREF="<% $p %>edit/part_export.cgi"><I>Add a new export</I></A><BR><BR> <SCRIPT> function part_export_areyousure(href) { if (confirm("Are you sure you want to delete this export?") == true) @@ -9,30 +9,32 @@ function part_export_areyousure(href) { } </SCRIPT> -<%= table() %> +<% table() %> <TR> <TH COLSPAN=2>Export</TH> <TH>Options</TH> </TR> +% foreach my $part_export ( sort { +% $a->getfield('exportnum') <=> $b->getfield('exportnum') +% } qsearch('part_export',{}) ) { +% -<% foreach my $part_export ( sort { - $a->getfield('exportnum') <=> $b->getfield('exportnum') - } qsearch('part_export',{}) ) { -%> <TR> - <TD><A HREF="<%= $p %>edit/part_export.cgi?<%= $part_export->exportnum %>"><%= $part_export->exportnum %></A></TD> - <TD><%= $part_export->exporttype %> to <%= $part_export->machine %> (<A HREF="<%= $p %>edit/part_export.cgi?<%= $part_export->exportnum %>">edit</A> | <A HREF="javascript:part_export_areyousure('<%= $p %>misc/delete-part_export.cgi?<%= $part_export->exportnum %>')">delete</A>)</TD> + <TD><A HREF="<% $p %>edit/part_export.cgi?<% $part_export->exportnum %>"><% $part_export->exportnum %></A></TD> + <TD><% $part_export->exporttype %> to <% $part_export->machine %> (<A HREF="<% $p %>edit/part_export.cgi?<% $part_export->exportnum %>">edit</A> | <A HREF="javascript:part_export_areyousure('<% $p %>misc/delete-part_export.cgi?<% $part_export->exportnum %>')">delete</A>)</TD> <TD> - <%= itable() %> - <% my %opt = $part_export->options; - foreach my $opt ( keys %opt ) { %> - <TR><TD><%= $opt %></TD><TD><%= encode_entities($opt{$opt}) %></TD></TR> - <% } %> + <% itable() %> +% my %opt = $part_export->options; +% foreach my $opt ( keys %opt ) { + + <TR><TD><% $opt %></TD><TD><% encode_entities($opt{$opt}) %></TD></TR> +% } + </TABLE> </TD> </TR> +% } -<% } %> </TABLE> </BODY> diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index a5e212d17..f2364b152 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,227 +1,228 @@ -<% - -#false laziness w/access_user.html -my %search = (); -my $search = ''; -unless ( $cgi->param('showdisabled') ) { - %search = ( 'disabled' => '' ); - $search = "( disabled = '' OR disabled IS NULL )"; -} - -my $select = '*'; -my $orderby = 'pkgpart'; -if ( $cgi->param('active') ) { - - $orderby = 'num_active DESC'; -} - $select = " - - *, - - ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart - AND ( cancel IS NULL OR cancel = 0 ) - AND ( susp IS NULL OR susp = 0 ) - ) AS num_active, - - ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart - AND ( cancel IS NULL OR cancel = 0 ) - AND susp IS NOT NULL AND susp != 0 - ) AS num_suspended, - - ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart - AND cancel IS NOT NULL AND cancel != 0 - ) AS num_cancelled - - "; - -#} - -my $conf = new FS::Conf; -my $taxclasses = $conf->exists('enable_taxclasses'); - -my $html_init; -#unless ( $cgi->param('active') ) { - $html_init = qq! - One or more service definitions are grouped together into a package - definition and given pricing information. Customers purchase packages - rather than purchase services directly.<BR><BR> - <A HREF="${p}edit/part_pkg.cgi"><I>Add a new package definition</I></A> - <BR><BR> - !; -#} - -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' ]; - -my @header = ( '#', 'Package', 'Comment' ); -my @fields = ( 'pkgpart', 'pkg', 'comment' ); -my $align = 'rll'; -my @links = ( $link, $link, '' ); -my @style = ( '', '', '' ); - -#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>' - : '<FONT COLOR="#00CC00">Active</FONT>' - }; - push @links, ''; - $align .= 'c'; - push @style, 'b'; -} - -unless ( 0 ) { #already showing only one class or something? - push @header, 'Class'; - push @fields, sub { shift->classname || '(none)'; }; - $align .= 'l'; -} - -#if ( $cgi->param('active') ) { - push @header, 'Customer<BR>packages'; - my %col = ( - 'active' => '00CC00', - 'suspended' => 'FF9900', - 'cancelled' => 'FF0000', - ); - my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart='; - push @fields, sub { my $part_pkg = shift; - [ - map { - [ - { - 'data' => '<B><FONT COLOR="#'. $col{$_}. '">'. - $part_pkg->get("num_$_"). - '</FONT></B>', - 'align' => 'right', - }, - { - 'data' => $_, - 'align' => 'left', - 'link' => ( $part_pkg->get("num_$_") - ? $cust_pkg_link. - $part_pkg->pkgpart. - ";magic=$_" - : '' - ), - }, - ], - } (qw( active suspended cancelled )) - ]; }; - $align .= 'r'; -#} - -push @header, 'Frequency'; -push @fields, sub { shift->freq_pretty; }; -$align .= 'l'; - -if ( $taxclasses ) { - push @header, 'Taxclass'; - push @fields, sub { shift->taxclass() || ' '; }; - $align .= 'l'; -} - -push @header, 'Plan', - 'Data', - 'Services'; - #'Service', 'Quan', 'Primary'; - -push @fields, sub { shift->plan || '(legacy)' }, - - sub { - my $part_pkg = shift; - if ( $part_pkg->plan ) { - - [ map { - /^(\w+)=(.*)$/; #or something; - [ - { 'data' => $1, - 'align' => 'right', - }, - { 'data' => $2, - 'align' => 'left', - }, - ]; - } - split(/\n/, $part_pkg->plandata) - ]; - - } else { - - [ map { [ - { 'data' => uc($_), - 'align' => 'right', - }, - { - 'data' => $part_pkg->$_(), - 'align' => 'left', - }, - ]; - } - (qw(setup recur)) - ]; - - } - - }, - - sub { - my $part_pkg = shift; - - [ map { - my $pkg_svc = $_; - my $part_svc = $pkg_svc->part_svc; - my $svc = $part_svc->svc; - if ( $pkg_svc->primary_svc =~ /^Y/i ) { - $svc = "<B>$svc (PRIMARY)</B>"; - } - $svc =~ s/ +/ /g; - - [ - { - 'data' => '<B>'. $pkg_svc->quantity. '</B>', - 'align' => 'right' - }, - { - 'data' => $svc, - 'align' => 'left', - 'link' => $p. 'edit/part_svc.cgi?'. - $part_svc->svcpart, - }, - ]; - } - sort { $b->primary_svc =~ /^Y/i - <=> $a->primary_svc =~ /^Y/i - } - $part_pkg->pkg_svc - - ]; - - }; - -$align .= 'lrl'; #rr'; - -# -------- - -my $count_query = 'SELECT COUNT(*) FROM part_pkg'; -$count_query .= " WHERE $search" - if $search; - -%><%= include( 'elements/browse.html', +% +% +%#false laziness w/access_user.html +%my %search = (); +%my $search = ''; +%unless ( $cgi->param('showdisabled') ) { +% %search = ( 'disabled' => '' ); +% $search = "( disabled = '' OR disabled IS NULL )"; +%} +% +%my $select = '*'; +%my $orderby = 'pkgpart'; +%if ( $cgi->param('active') ) { +% +% $orderby = 'num_active DESC'; +%} +% $select = " +% +% *, +% +% ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart +% AND ( cancel IS NULL OR cancel = 0 ) +% AND ( susp IS NULL OR susp = 0 ) +% ) AS num_active, +% +% ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart +% AND ( cancel IS NULL OR cancel = 0 ) +% AND susp IS NOT NULL AND susp != 0 +% ) AS num_suspended, +% +% ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart +% AND cancel IS NOT NULL AND cancel != 0 +% ) AS num_cancelled +% +% "; +% +%#} +% +%my $conf = new FS::Conf; +%my $taxclasses = $conf->exists('enable_taxclasses'); +% +%my $html_init; +%#unless ( $cgi->param('active') ) { +% $html_init = qq! +% One or more service definitions are grouped together into a package +% definition and given pricing information. Customers purchase packages +% rather than purchase services directly.<BR><BR> +% <A HREF="${p}edit/part_pkg.cgi"><I>Add a new package definition</I></A> +% <BR><BR> +% !; +%#} +% +%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' ]; +% +%my @header = ( '#', 'Package', 'Comment' ); +%my @fields = ( 'pkgpart', 'pkg', 'comment' ); +%my $align = 'rll'; +%my @links = ( $link, $link, '' ); +%my @style = ( '', '', '' ); +% +%#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>' +% : '<FONT COLOR="#00CC00">Active</FONT>' +% }; +% push @links, ''; +% $align .= 'c'; +% push @style, 'b'; +%} +% +%unless ( 0 ) { #already showing only one class or something? +% push @header, 'Class'; +% push @fields, sub { shift->classname || '(none)'; }; +% $align .= 'l'; +%} +% +%#if ( $cgi->param('active') ) { +% push @header, 'Customer<BR>packages'; +% my %col = ( +% 'active' => '00CC00', +% 'suspended' => 'FF9900', +% 'cancelled' => 'FF0000', +% ); +% my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart='; +% push @fields, sub { my $part_pkg = shift; +% [ +% map { +% [ +% { +% 'data' => '<B><FONT COLOR="#'. $col{$_}. '">'. +% $part_pkg->get("num_$_"). +% '</FONT></B>', +% 'align' => 'right', +% }, +% { +% 'data' => $_, +% 'align' => 'left', +% 'link' => ( $part_pkg->get("num_$_") +% ? $cust_pkg_link. +% $part_pkg->pkgpart. +% ";magic=$_" +% : '' +% ), +% }, +% ], +% } (qw( active suspended cancelled )) +% ]; }; +% $align .= 'r'; +%#} +% +%push @header, 'Frequency'; +%push @fields, sub { shift->freq_pretty; }; +%$align .= 'l'; +% +%if ( $taxclasses ) { +% push @header, 'Taxclass'; +% push @fields, sub { shift->taxclass() || ' '; }; +% $align .= 'l'; +%} +% +%push @header, 'Plan', +% 'Data', +% 'Services'; +% #'Service', 'Quan', 'Primary'; +% +%push @fields, sub { shift->plan || '(legacy)' }, +% +% sub { +% my $part_pkg = shift; +% if ( $part_pkg->plan ) { +% +% [ map { +% /^(\w+)=(.*)$/; #or something; +% [ +% { 'data' => $1, +% 'align' => 'right', +% }, +% { 'data' => $2, +% 'align' => 'left', +% }, +% ]; +% } +% split(/\n/, $part_pkg->plandata) +% ]; +% +% } else { +% +% [ map { [ +% { 'data' => uc($_), +% 'align' => 'right', +% }, +% { +% 'data' => $part_pkg->$_(), +% 'align' => 'left', +% }, +% ]; +% } +% (qw(setup recur)) +% ]; +% +% } +% +% }, +% +% sub { +% my $part_pkg = shift; +% +% [ map { +% my $pkg_svc = $_; +% my $part_svc = $pkg_svc->part_svc; +% my $svc = $part_svc->svc; +% if ( $pkg_svc->primary_svc =~ /^Y/i ) { +% $svc = "<B>$svc (PRIMARY)</B>"; +% } +% $svc =~ s/ +/ /g; +% +% [ +% { +% 'data' => '<B>'. $pkg_svc->quantity. '</B>', +% 'align' => 'right' +% }, +% { +% 'data' => $svc, +% 'align' => 'left', +% 'link' => $p. 'edit/part_svc.cgi?'. +% $part_svc->svcpart, +% }, +% ]; +% } +% sort { $b->primary_svc =~ /^Y/i +% <=> $a->primary_svc =~ /^Y/i +% } +% $part_pkg->pkg_svc +% +% ]; +% +% }; +% +%$align .= 'lrl'; #rr'; +% +%# -------- +% +%my $count_query = 'SELECT COUNT(*) FROM part_pkg'; +%$count_query .= " WHERE $search" +% if $search; +% +% +<% include( 'elements/browse.html', 'title' => 'Package Definitions', 'menubar' => [ 'Main Menu' => $p ], 'html_init' => $html_init, diff --git a/httemplate/browse/part_referral.html b/httemplate/browse/part_referral.html index c50a406ed..0e61a908e 100755 --- a/httemplate/browse/part_referral.html +++ b/httemplate/browse/part_referral.html @@ -1,129 +1,140 @@ -<%= include("/elements/header.html","Advertising source Listing" ) %> +<% 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.html"><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> +% +% my $today = timelocal(0, 0, 0, (localtime(time))[3..5] ); +% my %after; +% tie %after, 'Tie::IxHash', +% 'Today' => 0, +% 'Yesterday' => 86400, # 60sec * 60min * 24hrs +% 'Past week' => 518400, # 60sec * 60min * 24hrs * 6days +% 'Past 30 days' => 2505600, # 60sec * 60min * 24hrs * 29days +% 'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 59days +% 'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 89days +% 'Past 6 months' => 15724800, # 60sec * 60min * 24hrs * 182days +% 'Past year' => 31486000, # 60sec * 60min * 24hrs * 364days +% 'Total' => $today, +% ; +% my %before = ( +% 'Today' => 86400, # 60sec * 60min * 24hrs +% 'Yesterday' => 0, +% 'Past week' => 86400, # 60sec * 60min * 24hrs +% 'Past 30 days' => 86400, # 60sec * 60min * 24hrs +% 'Past 60 days' => 86400, # 60sec * 60min * 24hrs +% 'Past 90 days' => 86400, # 60sec * 60min * 24hrs +% 'Past 6 months' => 86400, # 60sec * 60min * 24hrs +% 'Past year' => 86400, # 60sec * 60min * 24hrs +% '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 = ''; +% -<% - my $today = timelocal(0, 0, 0, (localtime(time))[3..5] ); - my %after; - tie %after, 'Tie::IxHash', - 'Today' => 0, - 'Yesterday' => 86400, # 60sec * 60min * 24hrs - 'Past week' => 518400, # 60sec * 60min * 24hrs * 6days - 'Past 30 days' => 2505600, # 60sec * 60min * 24hrs * 29days - 'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 59days - 'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 89days - 'Past 6 months' => 15724800, # 60sec * 60min * 24hrs * 182days - 'Past year' => 31486000, # 60sec * 60min * 24hrs * 364days - 'Total' => $today, - ; - my %before = ( - 'Today' => 86400, # 60sec * 60min * 24hrs - 'Yesterday' => 0, - 'Past week' => 86400, # 60sec * 60min * 24hrs - 'Past 30 days' => 86400, # 60sec * 60min * 24hrs - 'Past 60 days' => 86400, # 60sec * 60min * 24hrs - 'Past 90 days' => 86400, # 60sec * 60min * 24hrs - 'Past 6 months' => 86400, # 60sec * 60min * 24hrs - 'Past year' => 86400, # 60sec * 60min * 24hrs - '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 = ''; -%> <TR> <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2 ROWSPAN=2>Advertising source</TH> - <% if ( $show_agentnums ) { %> +% if ( $show_agentnums ) { + <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Agent</TH> - <% } %> - <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<%= scalar(keys %after) %>>Customers</TH> +% } + + <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% scalar(keys %after) %>>Customers</TH> </TR> -<% for my $period ( keys %after ) { %> - <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><%= $period %></FONT></TH> -<% } %> +% for my $period ( keys %after ) { + + <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><% $period %></FONT></TH> +% } + </TR> +% +%foreach my $part_referral ( FS::part_referral->all_part_referral(1) ) { +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% +% $a = 0; +% +% -<% -foreach my $part_referral ( FS::part_referral->all_part_referral(1) ) { + <TR> - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> +% if ( $part_referral->agentnum || $curuser->access_right('Edit global advertising sources') ) { +% $a++; +% - $a = 0; + <A HREF="<% $p %>edit/part_referral.html?<% $part_referral->refnum %>"> +% } -%> - <TR> + <% $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}, +% $today+$before{$period}, +% ) or die $sth->errstr; +% my $number = $sth->fetchrow_arrayref->[0]; +% + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="right"><% $number %></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}, - $today+$before{$period}, - ) or die $sth->errstr; - my $number = $sth->fetchrow_arrayref->[0]; - %> - <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right"><%= $number %></TD> - <% } %> </TR> -<% } %> +% } +% +% $statement =~ s/AND refnum = \?//; +% $sth = dbh->prepare($statement) +% or die dbh->errstr; +% -<% - $statement =~ s/AND refnum = \?//; - $sth = dbh->prepare($statement) - or die dbh->errstr; -%> <TR> <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 BGCOLOR="#dddddd" ALIGN="right"><B><%= $number %><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 BGCOLOR="#dddddd" ALIGN="right"><B><% $number %><B></TD> +% } + </TR> </TABLE> </BODY> diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 805bd88b9..0113263fb 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,42 +1,43 @@ -<% - -#code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm -my %flag = ( - '' => '', - '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; -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 = map { $_->svcpart => $_->num_cust_svc } @part_svc; - -if ( $cgi->param('orderby') eq 'active' ) { - @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=> - $num_active_cust_svc{$a->svcpart} } @part_svc; -} elsif ( $cgi->param('orderby') eq 'svc' ) { - @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) ) %> +% +% +%#code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm +%my %flag = ( +% '' => '', +% '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; +%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 = map { $_->svcpart => $_->num_cust_svc } @part_svc; +% +%if ( $cgi->param('orderby') eq 'active' ) { +% @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=> +% $num_active_cust_svc{$a->svcpart} } @part_svc; +%} elsif ( $cgi->param('orderby') eq 'svc' ) { +% @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) ) %> <SCRIPT> function part_export_areyousure(href) { @@ -47,113 +48,130 @@ function part_export_areyousure(href) { 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> -<% } %> +<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') +<% $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> )'; } %> -<% $cgi->param('showdisabled', ( 1 ^ $cgi->param('showdisabled') ) ); %> -<%= table() %> +% $cgi->param('showdisabled', ( 1 ^ $cgi->param('showdisabled') ) ); + +<% table() %> <TR> - <TH><A HREF="<%= do { $cgi->param('orderby', 'svcpart'); $cgi->self_url } %>">#</A></TH> - <% if ( $cgi->param('showdisabled') ) { %> + <TH><A HREF="<% do { $cgi->param('orderby', 'svcpart'); $cgi->self_url } %>">#</A></TH> +% if ( $cgi->param('showdisabled') ) { + <TH>Status</TH> - <% } %> - <TH><A HREF="<%= do { $cgi->param('orderby', 'svc'); $cgi->self_url; } %>">Service</A></TH> +% } + + <TH><A HREF="<% do { $cgi->param('orderby', 'svc'); $cgi->self_url; } %>">Service</A></TH> <TH>Table</TH> - <TH><A HREF="<%= do { $cgi->param('orderby', 'active'); $cgi->self_url; } %>"><FONT SIZE=-1>Customer<BR>Services</FONT></A></TH> + <TH><A HREF="<% do { $cgi->param('orderby', 'active'); $cgi->self_url; } %>"><FONT SIZE=-1>Customer<BR>Services</FONT></A></TH> <TH>Export</TH> <TH>Field</TH> <TH COLSPAN=2>Modifier</TH> </TR> +% foreach my $part_svc ( @part_svc ) { +% my $svcdb = $part_svc->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?". $part_svc->svcpart; +% -<% foreach my $part_svc ( @part_svc ) { - my $svcdb = $part_svc->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?". $part_svc->svcpart; -%> <TR> - <TD ROWSPAN=<%= $rowspan %>><A HREF="<%= $url %>"> - <%= $part_svc->svcpart %></A></TD> -<% if ( $cgi->param('showdisabled') ) { %> - <TD ROWSPAN=<%= $rowspan %>> - <%= $part_svc->disabled + <TD ROWSPAN=<% $rowspan %>><A HREF="<% $url %>"> + <% $part_svc->svcpart %></A></TD> +% if ( $cgi->param('showdisabled') ) { + + <TD ROWSPAN=<% $rowspan %>> + <% $part_svc->disabled ? '<FONT COLOR="#FF0000"><B>Disabled</B></FONT>' : '<FONT COLOR="#00CC00"><B>Enabled</B></FONT>' %> </TD> -<% } %> - <TD ROWSPAN=<%= $rowspan %>><A HREF="<%= $url %>"> - <%= $part_svc->svc %></A></TD> - <TD ROWSPAN=<%= $rowspan %>> - <%= $svcdb %></TD> - <TD ROWSPAN=<%= $rowspan %>> - <FONT COLOR="#00CC00"><B><%= $num_active_cust_svc{$part_svc->svcpart} %></B></FONT> <A HREF="<%=$p%>search/<%= $svcdb %>.cgi?svcpart=<%= $part_svc->svcpart %>">active</A> - <% if ( $num_active_cust_svc{$part_svc->svcpart} ) { %> - <BR><FONT SIZE="-1">[ <A HREF="<%=$p%>edit/bulk-cust_svc.html?svcpart=<%= $part_svc->svcpart %>">change</A> ]</FONT> - <% } %> +% } + + <TD ROWSPAN=<% $rowspan %>><A HREF="<% $url %>"> + <% $part_svc->svc %></A></TD> + <TD ROWSPAN=<% $rowspan %>> + <% $svcdb %></TD> + <TD ROWSPAN=<% $rowspan %>> + <FONT COLOR="#00CC00"><B><% $num_active_cust_svc{$part_svc->svcpart} %></B></FONT> <A HREF="<%$p%>search/<% $svcdb %>.cgi?svcpart=<% $part_svc->svcpart %>">active</A> +% if ( $num_active_cust_svc{$part_svc->svcpart} ) { + + <BR><FONT SIZE="-1">[ <A HREF="<%$p%>edit/bulk-cust_svc.html?svcpart=<% $part_svc->svcpart %>">change</A> ]</FONT> +% } + </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 } ) - ) { -%> + <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> -<% } %> + <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; +% -<% my($n1)=''; - foreach my $field ( @fields ) { - my $flag = $part_svc->part_svc_column($field)->columnflag; -%> - <%= $n1 %> - <TD><%= $field %></TD> - <TD><%= $flag{$flag} %></TD> + <% $n1 %> + <TD><% $field %></TD> + <TD><% $flag{$flag} %></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} +% 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> +% } else { + <% $value %> +% } + + </TD> +% $n1="</TR><TR>"; +% } +% -<% $n1="</TR><TR>"; - } -%> </TR> -<% } %> +% } + </TABLE> </BODY> </HTML> diff --git a/httemplate/browse/part_virtual_field.cgi b/httemplate/browse/part_virtual_field.cgi index 555798818..7dcb58a53 100644 --- a/httemplate/browse/part_virtual_field.cgi +++ b/httemplate/browse/part_virtual_field.cgi @@ -1,39 +1,43 @@ -<%= include("/elements/header.html",'Virtual field definitions', menubar('Main Menu' => $p)) %> -<% +<% include("/elements/header.html",'Virtual field definitions', menubar('Main Menu' => $p)) %> +% +% +%my %pvfs; +%my $block; +%my $p2 = popurl(2); +%my $dbtable; +% +%foreach (qsearch('part_virtual_field', {})) { +% push @{ $pvfs{$_->dbtable} }, $_; +%} +% +% if ($cgi->param('error')) { -my %pvfs; -my $block; -my $p2 = popurl(2); -my $dbtable; - -foreach (qsearch('part_virtual_field', {})) { - push @{ $pvfs{$_->dbtable} }, $_; -} -%> - -<% if ($cgi->param('error')) { %> - <FONT SIZE="+1" COLOR="#ff0000">Error: <%=$cgi->param('error')%></FONT> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%$cgi->param('error')%></FONT> <BR><BR> -<% } %> +% } + -<A HREF="<%=$p2%>edit/part_virtual_field.cgi"><I>Add a new field</I></A><BR><BR> +<A HREF="<%$p2%>edit/part_virtual_field.cgi"><I>Add a new field</I></A><BR><BR> +% foreach $dbtable (sort { $a cmp $b } keys (%pvfs)) { -<% foreach $dbtable (sort { $a cmp $b } keys (%pvfs)) { %> -<H3><%=$dbtable%></H3> +<H3><%$dbtable%></H3> -<%=table()%> +<%table()%> <TH><TD>Field name</TD><TD>Description</TD></TH> -<% foreach my $pvf (sort {$a->name cmp $b->name} @{ $pvfs{$dbtable} }) { %> +% foreach my $pvf (sort {$a->name cmp $b->name} @{ $pvfs{$dbtable} }) { + <TR> <TD></TD> <TD> - <A HREF="<%=$p2%>edit/part_virtual_field.cgi?<%=$pvf->vfieldpart%>"> - <%=$pvf->name%></A></TD> - <TD><%=$pvf->label%></TD> + <A HREF="<%$p2%>edit/part_virtual_field.cgi?<%$pvf->vfieldpart%>"> + <%$pvf->name%></A></TD> + <TD><%$pvf->label%></TD> </TR> -<% } %> +% } + </TABLE> -<% } %> +% } + </BODY> </HTML> diff --git a/httemplate/browse/payment_gateway.html b/httemplate/browse/payment_gateway.html index 791906b78..6c14a1006 100644 --- a/httemplate/browse/payment_gateway.html +++ b/httemplate/browse/payment_gateway.html @@ -1,71 +1,76 @@ -<% +% +% +% my %search; +% if ( $cgi->param('showdisabled') ) { +% %search = (); +% } else { +% %search = ( 'disabled' => '' ); +% } +% +% - my %search; - if ( $cgi->param('showdisabled') ) { - %search = (); - } else { - %search = ( 'disabled' => '' ); - } - -%> -<%= include("/elements/header.html",'Payment gateways', menubar( +<% include("/elements/header.html",'Payment gateways', menubar( 'Main Menu' => $p, 'Agents' => $p. 'browse/agent.cgi', )) %> -<A HREF="<%= $p %>edit/payment_gateway.html"><I>Add a new payment gateway</I></A><BR><BR> +<A HREF="<% $p %>edit/payment_gateway.html"><I>Add a new payment gateway</I></A><BR><BR> -<%= $cgi->param('showdisabled') +<% $cgi->param('showdisabled') ? do { $cgi->param('showdisabled', 0); '( <a href="'. $cgi->self_url. '">hide disabled gateways</a> )'; } : do { $cgi->param('showdisabled', 1); '( <a href="'. $cgi->self_url. '">show disabled gateways</a> )'; } %> -<%= table() %> +<% table() %> <TR> - <TH COLSPAN=<%= $cgi->param('showdisabled') ? 1 : 2 %>>#</TH> + <TH COLSPAN=<% $cgi->param('showdisabled') ? 1 : 2 %>>#</TH> <TH>Gateway</TH> <TH>Username</TH> <TH>Password</TH> <TH>Action</TH> <TH>Options</TH> </TR> +% foreach my $payment_gateway ( qsearch( 'payment_gateway', \%search ) ) { -<% foreach my $payment_gateway ( qsearch( 'payment_gateway', \%search ) ) { %> <TR> - <TD><%= $payment_gateway->gatewaynum %></TD> - <% if ( !$cgi->param('showdisabled') ) { %> - <TD><%= $payment_gateway->disabled ? 'DISABLED' : '' %></TD> - <% } %> - <TD><%= $payment_gateway->gateway_module %> + <TD><% $payment_gateway->gatewaynum %></TD> +% if ( !$cgi->param('showdisabled') ) { + + <TD><% $payment_gateway->disabled ? 'DISABLED' : '' %></TD> +% } + + <TD><% $payment_gateway->gateway_module %> <FONT SIZE="-1"> - <A HREF="<%=$p%>edit/payment_gateway.html?<%= $payment_gateway->gatewaynum %>">(edit)</A> - <%= !$payment_gateway->disabled + <A HREF="<%$p%>edit/payment_gateway.html?<% $payment_gateway->gatewaynum %>">(edit)</A> + <% !$payment_gateway->disabled ? '<A HREF="'. $p. 'misc/disable-payment_gateway.cgi?'. $payment_gateway->gatewaynum.'">(disable)</A>' : '' %> </FONT> </TD> - <TD><%= $payment_gateway->gateway_username %></TD> + <TD><% $payment_gateway->gateway_username %></TD> <TD> - </TD> - <TD><%= $payment_gateway->gateway_action %></TD> + <TD><% $payment_gateway->gateway_action %></TD> <TD> <TABLE CELLSPACING=0 CELLPADDING=0> - <% my %options = $payment_gateway->options; - foreach my $option ( keys %options ) { - %> +% my %options = $payment_gateway->options; +% foreach my $option ( keys %options ) { +% + <TR> - <TH><%= $option %>:</TH> - <TD><%= $options{$option} %></TD> + <TH><% $option %>:</TH> + <TD><% $options{$option} %></TD> </TR> - <% } %> +% } + </TABLE> </TD> </TR> +% } -<% } %> </TABLE> </BODY> diff --git a/httemplate/browse/pkg_class.html b/httemplate/browse/pkg_class.html index d4f8f02a9..3ec5e559b 100644 --- a/httemplate/browse/pkg_class.html +++ b/httemplate/browse/pkg_class.html @@ -1,15 +1,16 @@ -<% - -my $html_init = - 'Package classes define groups of packages, for reporting and '. - 'convenience purposes.<BR><BR>'. - qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!; - -my $count_query = 'SELECT COUNT(*) FROM pkg_class'; - -my $link = [ $p.'edit/pkg_class.html?', 'classnum' ]; - -%><%= include( 'elements/browse.html', +% +% +%my $html_init = +% 'Package classes define groups of packages, for reporting and '. +% 'convenience purposes.<BR><BR>'. +% qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!; +% +%my $count_query = 'SELECT COUNT(*) FROM pkg_class'; +% +%my $link = [ $p.'edit/pkg_class.html?', 'classnum' ]; +% +% +<% include( 'elements/browse.html', 'title' => 'Package classes', 'menubar' => [ 'Main menu' => $p, ], 'html_init' => $html_init, diff --git a/httemplate/browse/rate.cgi b/httemplate/browse/rate.cgi index c4ae2f081..9bdbe2d0c 100644 --- a/httemplate/browse/rate.cgi +++ b/httemplate/browse/rate.cgi @@ -1,22 +1,23 @@ -<% - -my $html_init = - 'Rate plans, regions and prefixes for VoIP and call billing.<BR><BR>'. - qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!. - qq! | <A HREF="${p}edit/rate_region.cgi"><I>Add a region</I></A>!. - '<BR><BR> - <SCRIPT> - function rate_areyousure(href) { - if (confirm("Are you sure you want to delete this rate plan?") == true) - window.location.href = href; - } - </SCRIPT>'; - -my $count_query = 'SELECT COUNT(*) FROM rate'; - -my $link = [ $p.'edit/rate.cgi?', 'ratenum' ]; - -%><%= include( 'elements/browse.html', +% +% +%my $html_init = +% 'Rate plans, regions and prefixes for VoIP and call billing.<BR><BR>'. +% qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!. +% qq! | <A HREF="${p}edit/rate_region.cgi"><I>Add a region</I></A>!. +% '<BR><BR> +% <SCRIPT> +% function rate_areyousure(href) { +% if (confirm("Are you sure you want to delete this rate plan?") == true) +% window.location.href = href; +% } +% </SCRIPT>'; +% +%my $count_query = 'SELECT COUNT(*) FROM rate'; +% +%my $link = [ $p.'edit/rate.cgi?', 'ratenum' ]; +% +% +<% include( 'elements/browse.html', 'title' => 'Rate plans', 'menubar' => [ 'Main menu' => $p, ], 'html_init' => $html_init, diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 410037d41..7309388c6 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -1,56 +1,60 @@ -<%= include("/elements/header.html",'Routers', menubar('Main Menu' => $p)) %> -<% +<% include("/elements/header.html",'Routers', menubar('Main Menu' => $p)) %> +% +% +%my @router = qsearch('router', {}); +%my $p2 = popurl(2); +% +% +% if ($cgi->param('error')) { -my @router = qsearch('router', {}); -my $p2 = popurl(2); + <FONT SIZE="+1" COLOR="#ff0000">Error: <%$cgi->param('error')%></FONT> + <BR><BR> +% } +% +%my $hidecustomerrouters = 0; +%my $hideurl = ''; +%if ($cgi->param('hidecustomerrouters') eq '1') { +% $hidecustomerrouters = 1; +% $cgi->param('hidecustomerrouters', 0); +% $hideurl = '<A HREF="' . $cgi->self_url() . '">Show customer routers</A>'; +%} else { +% $hidecustomerrouters = 0; +% $cgi->param('hidecustomerrouters', 1); +% $hideurl = '<A HREF="' . $cgi->self_url() . '">Hide customer routers</A>'; +%} +% -%> -<% if ($cgi->param('error')) { %> - <FONT SIZE="+1" COLOR="#ff0000">Error: <%=$cgi->param('error')%></FONT> - <BR><BR> -<% } %> - -<% -my $hidecustomerrouters = 0; -my $hideurl = ''; -if ($cgi->param('hidecustomerrouters') eq '1') { - $hidecustomerrouters = 1; - $cgi->param('hidecustomerrouters', 0); - $hideurl = '<A HREF="' . $cgi->self_url() . '">Show customer routers</A>'; -} else { - $hidecustomerrouters = 0; - $cgi->param('hidecustomerrouters', 1); - $hideurl = '<A HREF="' . $cgi->self_url() . '">Hide customer routers</A>'; -} -%> - -<A HREF="<%=$p2%>edit/router.cgi">Add a new router</A> | <%=$hideurl%> - -<%=table()%> +<A HREF="<%$p2%>edit/router.cgi">Add a new router</A> | <%$hideurl%> + +<%table()%> <TR> <TD><B>Router name</B></TD> <TD><B>Address block(s)</B></TD> </TR> -<% foreach my $router (sort {$a->routernum <=> $b->routernum} @router) { - next if $hidecustomerrouters && $router->svcnum; - my @addr_block = $router->addr_block; - if (scalar(@addr_block) == 0) { - push @addr_block, ' '; - } -%> +% foreach my $router (sort {$a->routernum <=> $b->routernum} @router) { +% next if $hidecustomerrouters && $router->svcnum; +% my @addr_block = $router->addr_block; +% if (scalar(@addr_block) == 0) { +% push @addr_block, ' '; +% } +% + <TR> - <TD ROWSPAN="<%=scalar(@addr_block)+1%>"> - <A HREF="<%=$p2%>edit/router.cgi?<%=$router->routernum%>"><%=$router->routername%></A> + <TD ROWSPAN="<%scalar(@addr_block)+1%>"> + <A HREF="<%$p2%>edit/router.cgi?<%$router->routernum%>"><%$router->routername%></A> </TD> </TR> - <% foreach my $block ( @addr_block ) { %> +% foreach my $block ( @addr_block ) { + <TR> - <TD><%=UNIVERSAL::isa($block, 'FS::addr_block') ? $block->NetAddr : ' '%></TD> + <TD><%UNIVERSAL::isa($block, 'FS::addr_block') ? $block->NetAddr : ' '%></TD> </TR> - <% } %> +% } + </TR> -<% } %> +% } + </TABLE> </BODY> </HTML> diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index 73de6accc..949bfa790 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,13 +1,14 @@ <!-- mason kludge --> -<% - my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct - WHERE popnum = ? ") - or die dbh->errstr; -%> -<%= include("/elements/header.html",'Access Number Listing', menubar( 'Main Menu' => $p )) %> +% +% my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct +% WHERE popnum = ? ") +% or die dbh->errstr; +% + +<% include("/elements/header.html",'Access Number Listing', menubar( 'Main Menu' => $p )) %> Points of Presence<BR><BR> -<A HREF="<%= $p %>edit/svc_acct_pop.cgi"><I>Add new Access Number</I></A><BR><BR> -<%= table() %> +<A HREF="<% $p %>edit/svc_acct_pop.cgi"><I>Add new Access Number</I></A><BR><BR> +<% table() %> <TR> <TH></TH> <TH>City</TH> @@ -17,43 +18,50 @@ Points of Presence<BR><BR> <TH>Local</TH> <TH>Accounts</TH> </TR> +% +%foreach my $svc_acct_pop ( sort { +% #$a->getfield('popnum') <=> $b->getfield('popnum') +% $a->state cmp $b->state || $a->city cmp $b->city +% || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc +%} qsearch('svc_acct_pop',{}) ) { +% +% my $svc_acct_pop_link = $p . 'edit/svc_acct_pop.cgi?'. $svc_acct_pop->popnum; +% +% $accounts_sth->execute($svc_acct_pop->popnum) or die $accounts_sth->errstr; +% my $num_accounts = $accounts_sth->fetchrow_arrayref->[0]; +% +% my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='. $svc_acct_pop->popnum; +% +% -<% -foreach my $svc_acct_pop ( sort { - #$a->getfield('popnum') <=> $b->getfield('popnum') - $a->state cmp $b->state || $a->city cmp $b->city - || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc -} qsearch('svc_acct_pop',{}) ) { - - my $svc_acct_pop_link = $p . 'edit/svc_acct_pop.cgi?'. $svc_acct_pop->popnum; - - $accounts_sth->execute($svc_acct_pop->popnum) or die $accounts_sth->errstr; - my $num_accounts = $accounts_sth->fetchrow_arrayref->[0]; - - my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='. $svc_acct_pop->popnum; - -%> <TR> - <TD><A HREF="<%= $svc_acct_pop_link %>"> - <%= $svc_acct_pop->popnum %></A></TD> - <TD><A HREF="<%= $svc_acct_pop_link %>"> - <%= $svc_acct_pop->city %></A></TD> - <TD><A HREF="<%= $svc_acct_pop_link %>"> - <%= $svc_acct_pop->state %></A></TD> - <TD><A HREF="<%= $svc_acct_pop_link %>"> - <%= $svc_acct_pop->ac %></A></TD> - <TD><A HREF="<%= $svc_acct_pop_link %>"> - <%= $svc_acct_pop->exch %></A></TD> - <TD><A HREF="<%= $svc_acct_pop_link %>"> - <%= $svc_acct_pop->loc %></A></TD> + <TD><A HREF="<% $svc_acct_pop_link %>"> + <% $svc_acct_pop->popnum %></A></TD> + <TD><A HREF="<% $svc_acct_pop_link %>"> + <% $svc_acct_pop->city %></A></TD> + <TD><A HREF="<% $svc_acct_pop_link %>"> + <% $svc_acct_pop->state %></A></TD> + <TD><A HREF="<% $svc_acct_pop_link %>"> + <% $svc_acct_pop->ac %></A></TD> + <TD><A HREF="<% $svc_acct_pop_link %>"> + <% $svc_acct_pop->exch %></A></TD> + <TD><A HREF="<% $svc_acct_pop_link %>"> + <% $svc_acct_pop->loc %></A></TD> <TD> - <FONT COLOR="#00CC00"><B><%= $num_accounts %></B></FONT> - <% if ( $num_accounts ) { %><A HREF="<%= $svc_acct_link %>"><% } %> + <FONT COLOR="#00CC00"><B><% $num_accounts %></B></FONT> +% if ( $num_accounts ) { +<A HREF="<% $svc_acct_link %>"> +% } + active - <% if ( $num_accounts ) { %></A><% } %> +% if ( $num_accounts ) { +</A> +% } + </TD> </TR> -<% } %> +% } + <TR> </TR> |