summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/REAL_cust_pkg.cgi163
-rwxr-xr-xhttemplate/edit/agent.cgi80
-rw-r--r--httemplate/edit/agent_payment_gateway.html64
-rwxr-xr-xhttemplate/edit/agent_type.cgi78
-rw-r--r--httemplate/edit/bulk-cust_svc.html97
-rwxr-xr-xhttemplate/edit/cust_main.cgi381
-rw-r--r--httemplate/edit/cust_main/billing.html443
-rw-r--r--httemplate/edit/cust_main/contact.html36
-rw-r--r--httemplate/edit/cust_main/select-country.html72
-rw-r--r--httemplate/edit/cust_main/select-county.html91
-rw-r--r--httemplate/edit/cust_main/select-state.html27
-rwxr-xr-xhttemplate/edit/cust_pay.cgi98
-rwxr-xr-xhttemplate/edit/cust_pkg.cgi61
-rwxr-xr-xhttemplate/edit/part_bill_event.cgi102
-rwxr-xr-xhttemplate/edit/part_pkg.cgi190
-rwxr-xr-xhttemplate/edit/part_svc.cgi90
-rw-r--r--httemplate/edit/payment_gateway.html109
-rw-r--r--httemplate/edit/prepay_credit.cgi56
-rw-r--r--httemplate/edit/process/agent_payment_gateway.html25
-rw-r--r--httemplate/edit/process/bulk-cust_svc.cgi3
-rwxr-xr-xhttemplate/edit/process/cust_credit_bill.cgi5
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi40
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi13
-rwxr-xr-xhttemplate/edit/process/part_svc.cgi3
-rw-r--r--httemplate/edit/process/payment_gateway.html33
-rw-r--r--httemplate/edit/process/prepay_credit.cgi51
-rw-r--r--httemplate/edit/process/quick-charge.cgi27
-rwxr-xr-xhttemplate/edit/process/rate.cgi38
-rw-r--r--httemplate/edit/process/reg_code.cgi44
-rw-r--r--httemplate/edit/process/svc_broadband.cgi9
-rw-r--r--httemplate/edit/rate.cgi57
-rw-r--r--httemplate/edit/reg_code.cgi36
-rwxr-xr-xhttemplate/edit/svc_acct.cgi453
-rw-r--r--httemplate/edit/svc_www.cgi1
34 files changed, 842 insertions, 2234 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi
index 78dd0fa..9cbab2a 100755
--- a/httemplate/edit/REAL_cust_pkg.cgi
+++ b/httemplate/edit/REAL_cust_pkg.cgi
@@ -1,4 +1,6 @@
+<!-- mason kludge -->
<%
+# <!-- $Id: REAL_cust_pkg.cgi,v 1.8 2004-12-22 14:06:45 ivan Exp $ -->
my $error ='';
my $pkgnum = '';
@@ -27,24 +29,20 @@ if ( $error ) {
#$cust_pkg->$_(str2time($cgi->param($_)) foreach qw(setup bill);
$cust_pkg->setup(str2time($cgi->param('setup')));
$cust_pkg->bill(str2time($cgi->param('bill')));
- $cust_pkg->last_bill(str2time($cgi->param('last_bill')));
}
#my $custnum = $cust_pkg->getfield('custnum');
-%>
-
-<%= header('Customer package - Edit dates') %>
-<%
-#, menubar(
+print header('Package Edit'); #, menubar(
# "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum",
# 'Main Menu' => popurl(2)
#));
+
%>
-<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
-<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
+ <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
+ <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
+ <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
+ <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
<%
@@ -58,106 +56,67 @@ my($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment'));
my($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill'));
my $otaker = $cust_pkg->getfield('otaker');
-%>
-
-<FORM NAME="formname" ACTION="process/REAL_cust_pkg.cgi" METHOD="POST">
-<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>">
-
-<% if ( $error ) { %>
- <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT>
-<% } %>
+print '<FORM NAME="formname" ACTION="process/REAL_cust_pkg.cgi" METHOD="POST">', qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!;
-<%
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT>!
+ if $error;
#my $format = "%c %z (%Z)";
my $format = "%m/%d/%Y %T %z (%Z)";
-#false laziness w/view/cust_main/packages.html
-#my( $billed_or_prepaid,
-my( $last_bill_or_renewed, $next_bill_or_prepaid_until );
-unless ( $part_pkg->is_prepaid ) {
- #$billed_or_prepaid = 'billed';
- $last_bill_or_renewed = 'Last bill';
- $next_bill_or_prepaid_until = 'Next bill';
-} else {
- #$billed_or_prepaid = 'prepaid';
- $last_bill_or_renewed = 'Renewed';
- $next_bill_or_prepaid_until = 'Prepaid until';
-}
+print ntable("#cccccc",2),
+ '<TR><TD ALIGN="right">Package number</TD><TD BGCOLOR="#ffffff">',
+ $pkgnum, '</TD></TR>',
+ '<TR><TD ALIGN="right">Package</TD><TD BGCOLOR="#ffffff">',
+ $pkg, '</TD></TR>',
+ '<TR><TD ALIGN="right">Comment</TD><TD BGCOLOR="#ffffff">',
+ $comment, '</TD></TR>',
+ '<TR><TD ALIGN="right">Order taker</TD><TD BGCOLOR="#ffffff">',
+ $otaker, '</TD></TR>',
+ '<TR><TD ALIGN="right">Setup date</TD><TD>'.
+ '<INPUT TYPE="text" NAME="setup" SIZE=32 ID="setup_text" VALUE="',
+ ( $setup ? time2str($format, $setup) : "" ), '">'.
+ ' <IMG SRC="../images/calendar.png" ID="setup_button" STYLE="cursor: pointer" TITLE="Select date">'.
+ '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Last bill date</TD><TD>',
+ '<INPUT TYPE="text" NAME="last_bill" SIZE=32 ID="last_bill_text" VALUE="',
+ ( $cust_pkg->last_bill
+ ? time2str($format, $cust_pkg->last_bill)
+ : "" ),
+ '">'.
+ ' <IMG SRC="../images/calendar.png" ID="last_bill_button" STYLE="cursor: pointer" TITLE="Select date">'.
+ '</TD></TR>'
+ if $cust_pkg->dbdef_table->column('last_bill');
+
+print '<TR><TD ALIGN="right">Next bill date</TD><TD>',
+ '<INPUT TYPE="text" NAME="bill" SIZE=32 ID="bill_text" VALUE="',
+ ( $bill ? time2str($format, $bill) : "" ), '">'.
+ ' <IMG SRC="../images/calendar.png" ID="bill_button" STYLE="cursor: pointer" TITLE="Select date">'.
+ '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Suspension date</TD><TD BGCOLOR="#ffffff">',
+ time2str($format, $susp), '</TD></TR>'
+ if $susp;
+
+#print '<TR><TD ALIGN="right">Expiration date</TD><TD BGCOLOR="#ffffff">',
+# time2str("%D",$expire), '</TD></TR>'
+# if $expire;
+print '<TR><TD ALIGN="right">Expiration date'.
+ '</TD><TD>',
+ '<INPUT TYPE="text" NAME="expire" SIZE=32 ID="expire_text" VALUE="',
+ ( $expire ? time2str($format, $expire) : "" ), '">'.
+ ' <IMG SRC="../images/calendar.png" ID="expire_button" STYLE="cursor: pointer" TITLE="Select date">'.
+ '<BR><FONT SIZE=-1>(will <b>cancel</b> this package'.
+ ' when the date is reached)</FONT>'.
+ '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Cancellation date</TD><TD BGCOLOR="#ffffff">',
+ time2str($format, $cancel), '</TD></TR>'
+ if $cancel;
%>
-
-<%= ntable("#cccccc",2) %>
-
- <TR>
- <TD ALIGN="right">Package number</TD>
- <TD BGCOLOR="#ffffff"><%= $pkgnum %></TD>
- </TR>
-
- <TR>
- <TD ALIGN="right">Package</TD>
- <TD BGCOLOR="#ffffff"><%= $pkg %></TD>
- </TR>
-
- <TR>
- <TD ALIGN="right">Comment</TD>
- <TD BGCOLOR="#ffffff"><%= $comment %></TD>
- </TR>
-
- <TR>
- <TD ALIGN="right">Order taker</TD>
- <TD BGCOLOR="#ffffff"><%= $otaker %></TD>
- </TR>
-
- <TR>
- <TD ALIGN="right">Setup date</TD>
- <TD>
- <INPUT TYPE="text" NAME="setup" SIZE=32 ID="setup_text" VALUE="<%= ( $setup ? time2str($format, $setup) : "" ) %>">
- <IMG SRC="../images/calendar.png" ID="setup_button" STYLE="cursor: pointer" TITLE="Select date">
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN="right"><%= $last_bill_or_renewed %> date</TD>
- <TD>
- <INPUT TYPE="text" NAME="last_bill" SIZE=32 ID="last_bill_text" VALUE="<%= ( $cust_pkg->last_bill ? time2str($format, $cust_pkg->last_bill) : "" ) %>">
- <IMG SRC="../images/calendar.png" ID="last_bill_button" STYLE="cursor: pointer" TITLE="Select date">
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN="right"><%= $next_bill_or_prepaid_until %> date</TD>
- <TD>
- <INPUT TYPE="text" NAME="bill" SIZE=32 ID="bill_text" VALUE="<%= ( $bill ? time2str($format, $bill) : "" ) %>">
- <IMG SRC="../images/calendar.png" ID="bill_button" STYLE="cursor: pointer" TITLE="Select date">
- </TD>
- </TR>
-
- <% if ( $susp ) { %>
- <TR>
- <TD ALIGN="right">Suspension date</TD>
- <TD BGCOLOR="#ffffff"><%= time2str($format, $susp) %></TD>
- </TR>
- <% } %>
-
- <TR>
- <TD ALIGN="right">Expiration date</TD>
- <TD>
- <INPUT TYPE="text" NAME="expire" SIZE=32 ID="expire_text" VALUE="<%= ( $expire ? time2str($format, $expire) : "" ) %>">
- <IMG SRC="../images/calendar.png" ID="expire_button" STYLE="cursor: pointer" TITLE="Select date">
- <BR><FONT SIZE=-1>(will <b>cancel</b> this package when the date is reached)</FONT>
- </TD>
- </TR>
-
- <% if ( $cancel ) { %>
- <TR>
- <TD ALIGN="right">Cancellation date</TD>
- <TD BGCOLOR="#ffffff"><%= time2str($format, $cancel) %></TD>
- </TR>
- <% } %>
-
</TABLE>
-
<SCRIPT TYPE="text/javascript">
<%
my @cal = qw( setup bill expire );
diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi
index cb64ad8..8a1cb2a 100755
--- a/httemplate/edit/agent.cgi
+++ b/httemplate/edit/agent.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
my $agent;
@@ -15,8 +16,6 @@ if ( $cgi->param('error') ) {
my $action = $agent->agentnum ? 'Edit' : 'Add';
my $hashref = $agent->hashref;
-my $conf = new FS::Conf;
-
%>
<%= header("$action Agent", menubar(
@@ -33,74 +32,45 @@ my $conf = new FS::Conf;
Agent #<%= $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)" %>
<%= &ntable("#cccccc", 2, '') %>
-
<TR>
<TH ALIGN="right">Agent</TH>
<TD><INPUT TYPE="text" NAME="agent" SIZE=32 VALUE="<%= $hashref->{agent} %>"></TD>
</TR>
+<TR>
+ <TH ALIGN="right">Agent type</TH>
+ <TD><SELECT NAME="typenum" SIZE=1>
- <TR>
- <TH ALIGN="right">Agent type</TH>
- <TD><SELECT NAME="typenum" SIZE=1>
-
- <% foreach my $agent_type (qsearch('agent_type',{})) { %>
- <OPTION VALUE="<%= $agent_type->typenum %>"<%= ( $hashref->{typenum} && ( $hashref->{typenum} == $agent_type->typenum ) ) ? ' SELECTED' : '' %>>
- <%= $agent_type->getfield('typenum') %>: <%= $agent_type->getfield('atype') %>
- <% } %>
-
- </SELECT></TD>
- </TR>
-
+<% foreach my $agent_type (qsearch('agent_type',{})) { %>
+ <OPTION VALUE="<%= $agent_type->typenum %>"<%= ( $hashref->{typenum} && ( $hashref->{typenum} == $agent_type->typenum ) ) ? ' SELECTED' : '' %>>
+ <%= $agent_type->getfield('typenum') %>: <%= $agent_type->getfield('atype') %>
+<% } %>
+
+</SELECT></TD>
+</TR>
+<% if ( dbdef->table('agent')->column('disabled') ) { %>
<TR>
<TD ALIGN="right">Disable</TD>
<TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<%= $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>></TD>
</TR>
-
- <TR>
- <TD ALIGN="right"><!--Frequency--></TD>
- <TD><INPUT TYPE="hidden" NAME="freq" VALUE="<%= $hashref->{freq} %>"></TD>
- </TR>
-
- <TR>
- <TD ALIGN="right"><!--Program--></TD>
- <TD><INPUT TYPE="hidden" NAME="prog" VALUE="<%= $hashref->{prog} %>"></TD>
- </TR>
-
- <% if ( $conf->config('ticket_system') ) {
- my $default_queueid = $conf->config('ticket_system-default_queueid');
- my $default_queue = FS::TicketSystem->queue($default_queueid);
- $default_queue = "(default) $default_queueid: $default_queue"
- if $default_queueid;
- my %queues = FS::TicketSystem->queues();
- my @queueids = sort { $a <=> $b } keys %queues;
- %>
- <TR>
- <TD ALIGN="right">Ticketing queue</TD>
- <TD>
- <SELECT NAME="ticketing_queueid">
- <OPTION VALUE=""><%= $default_queue %>
- <% foreach my $queueid ( @queueids ) { %>
- <OPTION VALUE="<%= $queueid %>" <%= $agent->ticketing_queueid == $queueid ? ' SELECTED' : '' %>><%= $queueid %>: <%= $queues{$queueid} %>
- <% } %>
- </SELECT>
- </TD>
- </TR>
- <% } %>
-
+<% } %>
+<TR>
+ <TD ALIGN="right"><!--Frequency--></TD>
+ <TD><INPUT TYPE="hidden" NAME="freq" VALUE="<%= $hashref->{freq} %>"></TD>
+</TR>
+<TR>
+ <TD ALIGN="right"><!--Program--></TD>
+ <TD><INPUT TYPE="hidden" NAME="prog" VALUE="<%= $hashref->{prog} %>"></TD>
+</TR>
+<% if ( dbdef->table('agent')->column('username') ) { %>
<TR>
<TD ALIGN="right">Agent interface username</TD>
- <TD>
- <INPUT TYPE="text" NAME="username" VALUE="<%= $hashref->{username} %>">
- </TD>
+ <TD><INPUT TYPE="text" NAME="username" VALUE="<%= $hashref->{username} %>"></TD>
</TR>
-
<TR>
<TD ALIGN="right">Agent interface password</TD>
- <TD>
- <INPUT TYPE="text" NAME="_password" VALUE="<%= $hashref->{_password} %>">
- </TD>
+ <TD><INPUT TYPE="text" NAME="_password" VALUE="<%= $hashref->{_password} %>"></TD>
</TR>
-
+<% } %>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="<%= $hashref->{agentnum} ? "Apply changes" : "Add agent" %>">
diff --git a/httemplate/edit/agent_payment_gateway.html b/httemplate/edit/agent_payment_gateway.html
deleted file mode 100644
index 61d29e0..0000000
--- a/httemplate/edit/agent_payment_gateway.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<%
-
-$cgi->param('agentnum') =~ /(\d+)$/ or die "illegal agentnum";
-my $agent = qsearchs('agent', { 'agentnum' => $1 } );
-die "agentnum $1 not found" unless $agent;
-
-#my @agent_payment_gateway;
-if ( $cgi->param('error') ) {
-}
-
-my $action = 'Add';
-
-%>
-
-<%= header("$action payment gateway override for ". $agent->agent, menubar(
- 'Main Menu' => $p,
- #'View all payment gateways' => $p. 'browse/payment_gateway.html',
- 'View all agents' => $p. 'browse/agent.html',
-)) %>
-
-<% if ( $cgi->param('error') ) { %>
-<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
-<% } %>
-
-<FORM ACTION="<%=popurl(1)%>process/agent_payment_gateway.html" METHOD=POST>
-<INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agent->agentnum %>">
-
-Use gateway <SELECT NAME="gatewaynum">
-<% foreach my $payment_gateway (
- qsearch('payment_gateway', { 'disabled' => '' } )
- ) {
-%>
- <OPTION VALUE="<%= $payment_gateway->gatewaynum %>"><%= $payment_gateway->gateway_module %> (<%= $payment_gateway->gateway_username %>)
-<% } %>
-</SELECT>
-<BR><BR>
-
-for <SELECT NAME="cardtype" MULTIPLE>
-<% foreach my $cardtype (
- "",
- "VISA card",
- "MasterCard",
- "Discover card",
- "American Express card",
- "Diner's Club/Carte Blanche",
- "enRoute",
- "JCB",
- "BankCard",
- "Switch",
- "Solo",
- 'ACH',
-) { %>
- <OPTION VALUE="<%= $cardtype %>"><%= $cardtype || '(Default fallback)' %>
-<% } %>
-</SELECT>
-<BR><BR>
-
-(optional) when invoice contains only items of taxclass <INPUT TYPE="text" NAME="taxclass">
-<BR><BR>
-
-<INPUT TYPE="submit" VALUE="Add gateway override">
-</FORM>
-</BODY>
-</HTML>
diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi
index 5addbbd..637c710 100755
--- a/httemplate/edit/agent_type.cgi
+++ b/httemplate/edit/agent_type.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
my($agent_type);
@@ -13,63 +14,50 @@ if ( $cgi->param('error') ) {
$agent_type = new FS::agent_type {};
}
my $action = $agent_type->typenum ? 'Edit' : 'Add';
+my $hashref = $agent_type->hashref;
-%>
-
-<%= header("$action Agent Type", menubar(
+print header("$action Agent Type", menubar(
'Main Menu' => "$p",
'View all agent types' => "${p}browse/agent_type.cgi",
-))
-%>
+));
-<% if ( $cgi->param('error') ) { %>
- <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
-<% } %>
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+ "</FONT>"
+ if $cgi->param('error');
-<FORM ACTION="<%= popurl(1) %>process/agent_type.cgi" METHOD=POST>
-<INPUT TYPE="hidden" NAME="typenum" VALUE="<%= $agent_type->typenum %>">
-Agent Type #<%= $agent_type->typenum || "(NEW)" %>
-<BR><BR>
+print '<FORM ACTION="', popurl(1), 'process/agent_type.cgi" METHOD=POST>',
+ qq!<INPUT TYPE="hidden" NAME="typenum" VALUE="$hashref->{typenum}">!,
+ "Agent Type #", $hashref->{typenum} ? $hashref->{typenum} : "(NEW)";
-Agent Type
-<INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<%= $agent_type->atype %>">
-<BR><BR>
-
-Select which packages agents of this type may sell to customers<BR>
-
-<% foreach my $part_pkg (
- qsearch({ 'table' => 'part_pkg',
- 'hashref' => { 'disabled' => '' },
- 'select' => 'part_pkg.*',
- 'addl_from' => 'LEFT JOIN type_pkgs USING ( pkgpart )',
- 'extra_sql' => ( $agent_type->typenum
- ? 'OR typenum = '. $agent_type->typenum
- : ''
- ),
- })
- ) {
-%>
+print <<END;
+<BR><BR>Agent Type <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="$hashref->{atype}">
+<BR><BR>Select which packages agents of this type may sell to customers<BR>
+END
- <BR>
- <INPUT TYPE="checkbox" NAME="pkgpart<%= $part_pkg->pkgpart %>" <%=
+foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) {
+ print qq!<BR><INPUT TYPE="checkbox" NAME="pkgpart!,
+ $part_pkg->getfield('pkgpart'), qq!" !,
+ # ( 'CHECKED 'x scalar(
qsearchs('type_pkgs',{
- 'typenum' => $agent_type->typenum,
- 'pkgpart' => $part_pkg->pkgpart,
+ 'typenum' => $agent_type->getfield('typenum'),
+ 'pkgpart' => $part_pkg->getfield('pkgpart'),
})
? 'CHECKED '
- : ''
- %> VALUE="ON">
-
- <A HREF="<%= $p %>edit/part_pkg.cgi?<%= $part_pkg->pkgpart %>"><%= $part_pkg->pkgpart %>:
- <%= $part_pkg->pkg %> - <%= $part_pkg->comment %></A>
- <%= $part_pkg->disabled =~ /^Y/i ? ' (DISABLED)' : '' %>
-
-<% } %>
-
-<BR><BR>
+ : '',
+ qq!VALUE="ON"> !,
+ qq!<A HREF="${p}edit/part_pkg.cgi?!, $part_pkg->pkgpart,
+ '">', $part_pkg->pkgpart. ": ". $part_pkg->getfield('pkg'), '</A>',
+ ;
+}
-<INPUT TYPE="submit" VALUE="<%= $agent_type->typenum ? "Apply changes" : "Add agent type" %>">
+print qq!<BR><BR><INPUT TYPE="submit" VALUE="!,
+ $hashref->{typenum} ? "Apply changes" : "Add agent type",
+ qq!">!;
+print <<END;
</FORM>
</BODY>
</HTML>
+END
+
+%>
diff --git a/httemplate/edit/bulk-cust_svc.html b/httemplate/edit/bulk-cust_svc.html
deleted file mode 100644
index 332b5b6..0000000
--- a/httemplate/edit/bulk-cust_svc.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<%= header( 'Bulk customer service change',
- menubar(
- 'Main Menu' => $p,
- ),
- )
-%>
-
-<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
-
-<%= include('/elements/progress-init.html',
- 'OneTrueForm',
- [qw( old_svcpart new_svcpart pkgpart )],
- 'process/bulk-cust_svc.cgi',
- $p.'browse/part_svc.cgi',
- )
-%>
-
-<FORM NAME="OneTrueForm">
-
-<%
- $cgi->param('svcpart') =~ /^(\d+)$/
- or die "illegal svcpart: ". $cgi->param('svcpart');
-
- my $old_svcpart = $1;
- my $src_part_svc = qsearchs('part_svc', { 'svcpart' => $old_svcpart } )
- or die "unknown svcpart: $old_svcpart";
-%>
-
-<INPUT NAME="old_svcpart" TYPE="hidden" VALUE="<%= $old_svcpart %>">
-Change <!-- customer
-<B><%= $src_part_svc->svcpart %>: <%= $src_part_svc->svc %></B> services
-<BR>
--->
-
-<SELECT NAME="pkgpart">
-
-<% my $num_cust_svc = $src_part_svc->num_cust_svc; %>
-<% if ( $num_cust_svc > 1 ) { %>
- <OPTION VALUE="">all <%= $num_cust_svc %> <%= $src_part_svc->svc %> services
-<% } else { %>
- <OPTION VALUE="">the <%= $num_cust_svc %> <%= $src_part_svc->svc %> service
-<% } %>
-
-<%
- my $num_unlinked = $src_part_svc->num_cust_svc(0);
- if ( $num_unlinked ) {
-%>
- <OPTION VALUE="0">the <%= $num_unlinked %> unlinked <%= $src_part_svc->svc %> services
-
-<% } %>
-
-<% foreach my $schwartz (
- grep { $_->[1] }
- map { [ $_, $src_part_svc->num_cust_svc($_->pkgpart) ] }
- qsearch('part_pkg', {} )
- ) {
- my( $part_pkg, $num_cust_svc ) = @$schwartz;
-%>
- <OPTION VALUE="<%= $part_pkg->pkgpart %>">the <%= $num_cust_svc %>
- <%= $src_part_svc->svc %> service<%= $num_cust_svc > 1 ? 's in' : ' in a' %>
- <%= $part_pkg->pkg %> package<%= $num_cust_svc > 1 ? 's' : '' %>
-<% } %>
-</SELECT>
-<BR>
-
-to new service definition
-<SELECT NAME="new_svcpart">
-<% foreach my $dest_part_svc (
- grep { $_->svcpart != $old_svcpart
- && $_->svcdb eq $src_part_svc->svcdb
- }
- qsearch('part_svc', { 'disabled' => '' } )
- ) {
-%>
- <OPTION VALUE="<%= $dest_part_svc->svcpart %>"><%= $dest_part_svc->svcpart %>: <%= $dest_part_svc->svc %>
-
-<% } %>
-</SELECT>
-<BR>
-
-<BR>
-
-<SCRIPT TYPE="text/javascript">
-var confirm_change = '<P ALIGN="center"><B>Bulk customer service change - Are you sure?</B><BR><P ALIGN="CENTER" <INPUT TYPE="button" VALUE="Yes, make changes" onClick="process();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Cancel" onClick="cClick()">';
-</SCRIPT>
-
-<INPUT TYPE="button" VALUE="Bulk change customer services" onClick="overlib(confirm_change, CAPTION, 'Confirm bulk customer service change', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' );">
-
-</FORM>
-
-</BODY>
-</HTML>
-
-
-
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 144d540..a18114c 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
#for misplaced logic below
@@ -17,7 +18,6 @@ my $conf = new FS::Conf;
my $error = '';
my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart);
my(@invoicing_list);
-my $same = '';
if ( $cgi->param('error') ) {
$error = $cgi->param('error');
$cust_main = new FS::cust_main ( {
@@ -34,8 +34,6 @@ if ( $cgi->param('error') ) {
$password = $cgi->param('_password');
$popnum = $cgi->param('popnum');
@invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') );
- $same = $cgi->param('same');
- $cust_main->setfield('paid' => $cgi->param('paid')) if $cgi->param('paid');
} elsif ( $cgi->keywords ) { #editing
my( $query ) = $cgi->keywords;
$query =~ /^(\d+)$/;
@@ -76,9 +74,9 @@ my $action = $custnum ? 'Edit' : 'Add';
<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT>
<% } %>
-<FORM NAME="topform" STYLE="margin-bottom: 0">
+<FORM ACTION="<%= popurl(1) %>process/cust_main.cgi" METHOD=POST NAME="form1" onSubmit="document.form1.submit.disabled=true">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>">
-Customer # <%= $custnum ? "<B>$custnum</B>" : " (NEW)" %>
+ustomer # <%= $custnum ? "<B>$custnum</B>" : " (NEW)" %>
<!-- agent -->
@@ -105,64 +103,58 @@ my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first
</SELECT>
<% } %>
-<!-- referral (advertising source) -->
-
-<%
-my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
-if ( $custnum && ! $conf->exists('editreferrals') ) {
-%>
-
- <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-
<%
- } else {
- my(@referrals) = qsearch('part_referral',{});
- if ( scalar(@referrals) == 0 ) {
- eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources.";
- } elsif ( scalar(@referrals) == 1 ) {
- $refnum ||= $referrals[0]->refnum;
-%>
+# (referral and referring customer still need to be "template"ized)
- <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-
-<% } else { %>
+#referral
- <BR><BR><%=$r%>Advertising source
- <SELECT NAME="refnum" SIZE="1">
- <%= $refnum ? '' : '<OPTION VALUE="">' %>
- <% foreach my $referral (sort { $a->refnum <=> $b->refnum } @referrals) { %>
- <OPTION VALUE="<%= $referral->refnum %>" <%= $referral->refnum == $refnum ? 'SELECTED' : '' %>><%= $referral->refnum %>: <%= $referral->referral %>
- <% } %>
- </SELECT>
-<% } %>
-
-<% } %>
+my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
+if ( $custnum && ! $conf->exists('editreferrals') ) {
+ print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
+} else {
+ my(@referrals) = qsearch('part_referral',{});
+ if ( scalar(@referrals) == 0 ) {
+ eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources.";
+ } elsif ( scalar(@referrals) == 1 ) {
+ $refnum ||= $referrals[0]->refnum;
+ print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
+ } else {
+ print qq!<BR><BR>${r}Advertising source <SELECT NAME="refnum" SIZE="1">!;
+ print "<OPTION> " unless $refnum;
+ my($referral);
+ foreach $referral (sort {
+ $a->refnum <=> $b->refnum;
+ } @referrals) {
+ print "<OPTION" . " SELECTED"x($referral->refnum==$refnum),
+ ">", $referral->refnum, ": ", $referral->referral;
+ }
+ print "</SELECT>";
+ }
+}
-<!-- referring customer -->
+#referring customer
-<%
+#print qq!<BR><BR>Referring Customer: !;
my $referring_cust_main = '';
if ( $cust_main->referral_custnum
and $referring_cust_main =
qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
) {
-%>
-
- <BR><BR>Referring Customer:
- <A HREF="<%= popurl(1) %>/cust_main.cgi?<%= $cust_main->referral_custnum %>"><%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %></A>
- <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<%= $cust_main->referral_custnum %>">
-
-<% } elsif ( ! $conf->exists('disable_customer_referrals') ) { %>
-
- <BR><BR>Referring customer number:
- <INPUT TYPE="text" NAME="referral_custnum" VALUE="">
-
-<% } else { %>
-
- <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
+ print '<BR><BR>Referring Customer: <A HREF="'. popurl(1). '/cust_main.cgi?'.
+ $cust_main->referral_custnum. '">'.
+ $cust_main->referral_custnum. ': '.
+ ( $referring_cust_main->company
+ || $referring_cust_main->last. ', '. $referring_cust_main->first ).
+ '</A><INPUT TYPE="hidden" NAME="referral_custnum" VALUE="'.
+ $cust_main->referral_custnum. '">';
+} elsif ( ! $conf->exists('disable_customer_referrals') ) {
+ print '<BR><BR>Referring customer number: <INPUT TYPE="text" NAME="referral_custnum" VALUE="">';
+} else {
+ print '<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">';
+}
-<% } %>
+%>
<!-- contact info -->
@@ -180,17 +172,11 @@ function bill_changed(what) {
<% for (qw( last first company address1 address2 city zip daytime night fax )) { %>
what.form.ship_<%=$_%>.value = what.form.<%=$_%>.value;
<% } %>
-
what.form.ship_country.selectedIndex = what.form.country.selectedIndex;
- function fix_ship_state() {
- what.form.ship_state.selectedIndex = what.form.state.selectedIndex;
- }
- ship_country_changed(what.form.ship_country, fix_ship_state );
-
- function fix_ship_county() {
- what.form.ship_county.selectedIndex = what.form.county.selectedIndex;
- }
- ship_state_changed(what.form.ship_state, fix_ship_county );
+ ship_country_changed(what.form.ship_country);
+ what.form.ship_state.selectedIndex = what.form.state.selectedIndex;
+ ship_state_changed(what.form.ship_state);
+ what.form.ship_county.selectedIndex = what.form.county.selectedIndex;
}
}
function samechanged(what) {
@@ -213,7 +199,7 @@ function samechanged(what) {
my $checked = '';
my $disabled = '';
my $disabledselect = '';
- unless ( $cust_main->ship_last && $same ne 'Y' ) {
+ unless ( $cust_main->ship_last && $cgi->param('same') ne 'Y' ) {
$checked = 'CHECKED';
$disabled = 'DISABLED style="background-color: #dddddd"';
foreach (
@@ -232,138 +218,181 @@ Service address
<% } %>
-<!-- billing info -->
+<%
+# billing info
+
+sub expselect {
+ my $prefix = shift;
+ my( $m, $y ) = (0, 0);
+ if ( scalar(@_) ) {
+ my $date = shift || '01-2000';
+ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
+ ( $m, $y ) = ( $2, $1 );
+ } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
+ ( $m, $y ) = ( $1, $3 );
+ } else {
+ die "unrecognized expiration date format: $date";
+ }
+ }
-<%= include( 'cust_main/billing.html', $cust_main,
- 'invoicing_list' => \@invoicing_list,
- )
-%>
+ my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
+ for ( 1 .. 12 ) {
+ $return .= "<OPTION";
+ $return .= " SELECTED" if $_ == $m;
+ $return .= ">$_";
+ }
+ $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
+ my @t = localtime;
+ my $thisYear = $t[5] + 1900;
+ for ( ($thisYear > $y && $y > 0 ? $y : $thisYear) .. 2037 ) {
+ $return .= "<OPTION";
+ $return .= " SELECTED" if $_ == $y;
+ $return .= ">$_";
+ }
+ $return .= "</SELECT>";
-<SCRIPT>
-function bottomfixup(what) {
+ $return;
+}
- var topvars = new Array(
- 'custnum', 'agentnum', 'refnum', 'referral_custnum',
+my $payby_default = $conf->config('payby-default');
- 'last', 'first', 'ss', 'company',
- 'address1', 'address2', 'city',
- 'county', 'state', 'zip', 'country',
- 'daytime', 'night', 'fax',
+if ( $payby_default eq 'HIDE' ) {
- 'same',
+ $cust_main->payby('BILL') unless $cust_main->payby;
- 'ship_last', 'ship_first', 'ship_company',
- 'ship_address1', 'ship_address2', 'ship_city',
- 'ship_county', 'ship_state', 'ship_zip', 'ship_country',
- 'ship_daytime','ship_night', 'ship_fax',
+ foreach my $field (qw( tax payby )) {
+ print qq!<INPUT TYPE="hidden" NAME="$field" VALUE="!.
+ $cust_main->getfield($field). '">';
+ }
- 'select' // XXX key
- );
+ print qq!<INPUT TYPE="hidden" NAME="invoicing_list" VALUE="!.
+ join(', ', $cust_main->invoicing_list). '">';
- var layervars = new Array(
- 'payauto',
- 'payinfo', 'payinfo1', 'payinfo2',
- 'payname', 'exp_month', 'exp_year', 'paycvv',
- 'paystart_month', 'paystart_year', 'payissue',
- 'payip',
- 'paid'
- );
+ foreach my $payby (qw( CARD DCRD CHEK DCHK LECB BILL COMP )) {
+ foreach my $field (qw( payinfo payname )) {
+ print qq!<INPUT TYPE="hidden" NAME="${payby}_$field" VALUE="!.
+ $cust_main->getfield($field). '">';
+ }
- var billing_bottomvars = new Array(
- 'tax',
- 'invoicing_list', 'invoicing_list_POST', 'invoicing_list_FAX'
- );
+ #false laziness w/expselect
+ my( $m, $y );
+ my $date = $cust_main->paydate || '12-2037';
+ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
+ ( $m, $y ) = ( $2, $1 );
+ } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
+ ( $m, $y ) = ( $1, $3 );
+ } else {
+ die "unrecognized expiration date format: $date";
+ }
- for ( f=0; f < topvars.length; f++ ) {
- var field = topvars[f];
- copyelement( document.topform.elements[field],
- document.bottomform.elements[field]
- );
- }
+ print qq!<INPUT TYPE="hidden" NAME="${payby}_month" VALUE="$m">!.
+ qq!<INPUT TYPE="hidden" NAME="${payby}_year" VALUE="$y">!;
- var layerform = document.topform.select.options[document.topform.select.selectedIndex].value;
- for ( f=0; f < layervars.length; f++ ) {
- var field = layervars[f];
- copyelement( document.forms[layerform].elements[field],
- document.bottomform.elements[field]
- );
}
- for ( f=0; f < billing_bottomvars.length; f++ ) {
- var field = billing_bottomvars[f];
- copyelement( document.billing_bottomform.elements[field],
- document.bottomform.elements[field]
- );
+} else {
+
+ print "<BR>Billing information", &itable("#cccccc"),
+ qq!<TR><TD><INPUT TYPE="checkbox" NAME="tax" VALUE="Y"!;
+ print qq! CHECKED! if $cust_main->tax eq "Y";
+ print qq!>Tax Exempt</TD></TR><TR><TD>!.
+ qq!<INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"!;
+
+ #my @invoicing_list = $cust_main->invoicing_list;
+ print qq! CHECKED!
+ if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') )
+ || grep { $_ eq 'POST' } @invoicing_list;
+ print qq!>Postal mail invoice</TD></TR>!;
+ my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list );
+ print qq!<TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="$invoicing_list"></TD></TR>!;
+
+ print "<TR><TD>Billing type</TD></TR>",
+ "</TABLE>", '<SCRIPT>
+ var mywindow = -1;
+ function myopen(filename,windowname,properties) {
+ myclose();
+ mywindow = window.open(filename,windowname,properties);
+ }
+ function myclose() {
+ if ( mywindow != -1 )
+ mywindow.close();
+ mywindow = -1;
+ }
+ var achwindow = -1;
+ function achopen(filename,windowname,properties) {
+ achclose();
+ achwindow = window.open(filename,windowname,properties);
+ }
+ function achclose() {
+ if ( achwindow != -1 )
+ achwindow.close();
+ achwindow = -1;
+ }
+ </SCRIPT>',
+ &table("#cccccc"), "<TR>";
+
+ my($payinfo, $payname)=(
+ $cust_main->payinfo,
+ $cust_main->payname,
+ );
+
+ my %payby = (
+ 'CARD' => qq!Credit card (automatic)<BR>${r}<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR>${r}Exp !. expselect("CARD"). qq!<BR>${r}Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="">!,
+ 'DCRD' => qq!Credit card (on-demand)<BR>${r}<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="" MAXLENGTH=19><BR>${r}Exp !. expselect("DCRD"). qq!<BR>${r}Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="">!,
+ 'CHEK' => qq!Electronic check (automatic)<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE=""><BR>${r}ABA/Routing number <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="" SIZE=10 MAXLENGTH=9> (<A HREF="javascript:achopen('../docs/ach.html','ach','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=384,height=256')">help</A>)<INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="">!,
+ 'DCHK' => qq!Electronic check (on-demand)<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE=""><BR>${r}ABA/Routing number <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="" SIZE=10 MAXLENGTH=9> (<A HREF="javascript:achopen('../docs/ach.html','ach','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=384,height=256')">help</A>)<INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="">!,
+ 'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" BANE="LECB_payinfo" VALUE="" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
+ 'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE=""><BR><INPUT TYPE="hidden" NAME="BILL_month" VALUE="12"><INPUT TYPE="hidden" NAME="BILL_year" VALUE="2037">Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="">!,
+ 'COMP' => qq!Complimentary<BR>${r}Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR>${r}Exp !. expselect("COMP"),
+);
+
+ if ( $cust_main->dbdef_table->column('paycvv') ) {
+ foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 bs
+ $payby{$payby} .= qq!<BR>CVV2&nbsp;(<A HREF="javascript:myopen('../docs/cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>)&nbsp;<INPUT TYPE="text" NAME=${payby}_paycvv VALUE="" SIZE=4 MAXLENGTH=4>!;
+ }
}
-}
+ my( $account, $aba ) = split('@', $payinfo);
-function copyelement(from, to) {
- if ( from == undefined ) {
- to.value = '';
- } else if ( from.type == 'select-one' ) {
- to.value = from.options[from.selectedIndex].value;
- //alert(from + " (" + from.type + "): " + to.name + " => (" + from.selectedIndex + ") " + to.value);
- } else if ( from.type == 'checkbox' ) {
- if ( from.checked ) {
- to.value = from.value;
- } else {
- to.value = '';
+ my %paybychecked = (
+ 'CARD' => qq!Credit card (automatic)<BR>${r}<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR>${r}Exp !. expselect("CARD", $cust_main->paydate). qq!<BR>${r}Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname">!,
+ 'DCRD' => qq!Credit card (on-demand)<BR>${r}<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR>${r}Exp !. expselect("DCRD", $cust_main->paydate). qq!<BR>${r}Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="$payname">!,
+ 'CHEK' => qq!Electronic check (automatic)<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="$account"><BR>${r}ABA/Routing number <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9> (<A HREF="javascript:achopen('../docs/ach.html','ach','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=384,height=256')">help</A>)<INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="$payname">!,
+ 'DCHK' => qq!Electronic check (on-demand)<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="$account"><BR>${r}ABA/Routing number <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9> (<A HREF="javascript:achopen('../docs/ach.html','ach','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=384,height=256')">help</A>)<INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="$payname">!,
+ 'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" BANE="LECB_payinfo" VALUE="$payinfo" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
+ 'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR><INPUT TYPE="hidden" NAME="BILL_month" VALUE="12"><INPUT TYPE="hidden" NAME="BILL_year" VALUE="2037">Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!,
+ 'COMP' => qq!Complimentary<BR>${r}Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR>${r}Exp !. expselect("COMP", $cust_main->paydate),
+);
+
+ if ( $cust_main->dbdef_table->column('paycvv') ) {
+ my $paycvv = $cust_main->paycvv;
+
+ foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 bs
+ $paybychecked{$payby} .= qq!<BR>CVV2&nbsp;(<A HREF="javascript:myopen('../docs/cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>)&nbsp;<INPUT TYPE="text" NAME=${payby}_paycvv VALUE="$paycvv" SIZE=4 MAXLENGTH=4>!;
}
- } else {
- if ( from.value == undefined ) {
- to.value = '';
+ }
+
+
+ $cust_main->payby($payby_default) unless $cust_main->payby;
+ for (qw(CARD DCRD CHEK DCHK LECB BILL COMP)) {
+ print qq!<TD VALIGN=TOP><INPUT TYPE="radio" NAME="payby" VALUE="$_"!;
+ if ($cust_main->payby eq "$_") {
+ print qq! CHECKED> $paybychecked{$_}</TD>!;
} else {
- to.value = from.value;
+ print qq!> $payby{$_}</TD>!;
}
}
- //alert(from + " (" + from.type + "): " + to.name + " => " + to.value);
-}
-</SCRIPT>
+ print "</TR></TABLE>$r required fields for each billing type";
-<FORM ACTION="<%= popurl(1) %>process/cust_main.cgi" METHOD=POST NAME="bottomform" onSubmit="document.bottomform.submit.disabled=true; bottomfixup(this.form);" STYLE="margin-top: 0; margin-bottom: 0">
-
-<% foreach my $hidden (
- 'custnum', 'agentnum', 'refnum', 'referral_custnum',
- 'last', 'first', 'ss', 'company',
- 'address1', 'address2', 'city',
- 'county', 'state', 'zip', 'country',
- 'daytime', 'night', 'fax',
-
- 'same',
-
- 'ship_last', 'ship_first', 'ship_company',
- 'ship_address1', 'ship_address2', 'ship_city',
- 'ship_county', 'ship_state', 'ship_zip', 'ship_country',
- 'ship_daytime','ship_night', 'ship_fax',
-
- 'select', #XXX key
-
- 'payauto',
- 'payinfo', 'payinfo1', 'payinfo2',
- 'payname', 'exp_month', 'exp_year', 'paycvv',
- 'paystart_month', 'paystart_year', 'payissue',
- 'payip',
- 'paid',
-
- 'tax',
- 'invoicing_list', 'invoicing_list_POST', 'invoicing_list_FAX'
- ) {
-%>
- <INPUT TYPE="hidden" NAME="<%= $hidden %>" VALUE="">
-<% } %>
-
-<BR>Comments
-<%= &ntable("#cccccc") %>
- <TR>
- <TD>
- <TEXTAREA COLS=80 ROWS=5 WRAP="HARD" NAME="comments"><%= $cust_main->comments %></TEXTAREA>
- </TD>
- </TR>
-</TABLE>
+}
-<%
+if ( defined $cust_main->dbdef_table->column('comments') ) {
+ print "<BR><BR>Comments", &itable("#cccccc"),
+ qq!<TR><TD><TEXTAREA COLS=80 ROWS=5 WRAP="HARD" NAME="comments">!,
+ $cust_main->comments, "</TEXTAREA>",
+ "</TD></TR></TABLE>";
+}
unless ( $custnum ) {
# pry the wrong place for this logic. also pretty expensive
@@ -393,7 +422,7 @@ unless ( $custnum ) {
# print "<BR><BR>First package", &itable("#cccccc", "0 ALIGN=LEFT"),
#apiabuse & undesirable wrapping
- print "<BR>First package", &ntable("#cccccc"),
+ print "<BR><BR>First package", &itable("#cccccc"),
qq!<TR><TD COLSPAN=2><SELECT NAME="pkgpart_svcpart">!;
print qq!<OPTION VALUE="">(none)!;
@@ -421,7 +450,7 @@ unless ( $custnum ) {
(blank to generate)</TD></TR>
END
- print '<TR><TD ALIGN="right">Access number</TD><TD>'
+ print '<TR><TD ALIGN="right">Access number</TD><TD WIDTH="100%">'
.
&FS::svc_acct_pop::popselector($popnum).
'</TD></TR></TABLE>'
@@ -431,9 +460,9 @@ END
my $otaker = $cust_main->otaker;
print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!,
- qq!<BR><INPUT TYPE="submit" NAME="submit" VALUE="!,
- $custnum ? "Apply Changes" : "Add Customer", qq!"><BR>!,
- "</FORM></DIV></BODY></HTML>",
+ qq!<BR><INPUT NAME="submit" TYPE="submit" VALUE="!,
+ $custnum ? "Apply Changes" : "Add Customer", qq!">!,
+ "</FORM></BODY></HTML>",
;
%>
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
deleted file mode 100644
index 96f777b..0000000
--- a/httemplate/edit/cust_main/billing.html
+++ /dev/null
@@ -1,443 +0,0 @@
-<%
-
-my( $cust_main, %options ) = @_;
-my @invoicing_list = @{ $options{'invoicing_list'} };
-my $conf = new FS::Conf;
-my $payby_default = $conf->config('payby-default');
-
-my @payby = grep /\w/, $conf->config('payby');
-#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
-@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
- unless @payby;
-
-if ( $payby_default eq 'HIDE' ) {
-
- $cust_main->payby('BILL') unless $cust_main->payby;
-
-%>
-
- <INPUT TYPE="hidden" NAME="select" VALUE="<%= $cust_main->payby %>">
-
- </FORM>
-
- <FORM NAME="<%= $cust_main->payby %>" STYLE="margin-top: 0; margin-bottom: 0"> <% # XXX key %>
-
- <% foreach my $field (qw( payinfo payname paycvv paystart_month paystart_year payissue payip )) { %>
-
- <INPUT TYPE="hidden" NAME="<%= $field %>" VALUE="<%= $cust_main->getfield($field) %>">
-
- <% } %>
-
- <%
- #false laziness w/elements/select-month_year.html & view/cust_main/billing.html
- my( $mon, $year );
- my $date = $cust_main->paydate || '12-2037';
- if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
- ( $mon, $year ) = ( $2, $1 );
- } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
- ( $mon, $year ) = ( $1, $3 );
- } else {
- die "unrecognized expiration date format: $date";
- }
- %>
-
- <INPUT TYPE="hidden" NAME="exp_month" VALUE="<%= $mon %>">
- <INPUT TYPE="hidden" NAME="exp_year" VALUE="<%= $year %>">
-
- </FORM>
-
- <FORM NAME="billing_bottomform" STYLE="margin-top: 0; margin-bottom: 0">
-
- <INPUT TYPE="hidden" NAME="tax" VALUE="<%= $cust_main->tax %>">
-
- <INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<%= join(', ', @invoicing_list) %>">
-
- </FORM>
-
-<% } else {
-
- my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
-
-%>
-
- <BR>Billing information
- <%= &ntable("#cccccc") %>
-
- <TR>
- <TD ALIGN="right" WIDTH="200"><%=$r%>Billing type</TD>
-
- <SCRIPT>
-
- var mywindow = -1;
- function myopen(filename,windowname,properties) {
- myclose();
- mywindow = window.open(filename,windowname,properties);
- }
- function myclose() {
- if ( mywindow != -1 )
- mywindow.close();
- mywindow = -1;
- }
-
- var achwindow = -1;
- function achopen(filename,windowname,properties) {
- achclose();
- achwindow = window.open(filename,windowname,properties);
- }
- function achclose() {
- if ( achwindow != -1 )
- achwindow.close();
- achwindow = -1;
- }
-
- function card_changed(what) {
- if (
- what.form.payinfo.value.substring(0, 4) == '4093'
- || what.form.payinfo.value.substring(0, 4) == '4911'
- || what.form.payinfo.value.substring(0, 4) == '4936'
- || what.form.payinfo.value.substring(0, 6) == '564132'
- || what.form.payinfo.value.substring(0, 2) == '63'
- || what.form.payinfo.value.substring(0, 2) == '67'
- )
- {
- what.form.paystart_month.disabled = false;
- what.form.paystart_year.disabled = false;
- what.form.payissue.disabled = false;
- what.form.paystart_month.style.backgroundColor = '#ffffff';
- what.form.paystart_year.style.backgroundColor = '#ffffff';
- what.form.payissue.style.backgroundColor = '#ffffff';
- document.getElementById('paystart_label').style.color = '#000000';
- document.getElementById('payissue_label').style.color = '#000000';
- } else {
- what.form.paystart_month.disabled = true;
- what.form.paystart_year.disabled = true;
- what.form.payissue.disabled = true;
- what.form.paystart_month.style.backgroundColor = '#dddddd';
- what.form.paystart_year.style.backgroundColor = '#dddddd';
- what.form.payissue.style.backgroundColor = '#dddddd';
- document.getElementById('paystart_label').style.color = '#999999';
- document.getElementById('payissue_label').style.color = '#999999';
- }
- return true;
- }
-
- </SCRIPT>
-
- <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
- <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
- <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
- <SCRIPT TYPE="text/javascript">
- function OLiframeContent(src, width, height, name) {
- return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
- +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
- +'<div>[iframe not supported]</div></iframe>');
- }
- </SCRIPT>
-
- <%
-
- my($payby, $payinfo, $payname)=(
- $cust_main->payby,
- $cust_main->payinfo,
- $cust_main->payname,
- );
- my( $account, $aba ) = split('@', $payinfo);
-
- my $disabled = 'DISABLED style="background-color: #dddddd"';
- my $text_disabled = 'style="color: #999999"';
- if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) {
- $disabled = 'style="background-color: #ffffff"';
- $text_disabled = 'style="color: #000000";'
- }
-
- my %payby = (
-
- 'CARD' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Card number </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $payinfo : '' ). qq!" MAXLENGTH=19 onChange="card_changed(this)" onKeyUp="card_changed(this)"></TD></TR>!.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!.
- '<TD WIDTH="408">'.
-
- include('/elements/select-month_year.html',
- 'prefix' => 'exp',
- 'selected_date' =>
- ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ),
- ).
-
- '</TD></TR>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">CVV2&nbsp;!.
-
- qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!.
- qq!</TD>!.
- '<TD WIDTH="408"><INPUT TYPE="text" NAME="paycvv" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paycvv : '' ). '" SIZE=4 MAXLENGTH=4>'.
-
-
- qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>Start date </SPAN></TD>!.
- '<TD WIDTH="408">'.
-
- include('/elements/select-month_year.html',
- 'prefix' => 'paystart',
- 'disabled' => $disabled,
- 'empty_option' => 1,
- 'start_year' => 2000,
- 'end_year' => (localtime())[5] + 1900,
- 'selected_date' => (
- ( $payby =~ /^(CARD|DCRD)$/
- && cardtype($payinfo) =~ /^(Switch|Solo)$/ )
- ? $cust_main->paystart_month. '-'.
- $cust_main->paystart_year
- : ''
- )
- ).
-
- qq!<SPAN ID="payissue_label" $text_disabled> or Issue number </SPAN>!.
- '<INPUT TYPE="text" NAME="payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Exact name on card </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
-
- qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCRD' ? '' : 'CHECKED' ). '> Charge future payments to this card automatically</TD></TR>'.
-
- '</TABLE>',
-
- 'CHEK' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Account number </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD></TR>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}ABA/Routing number </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !.
- qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!.
- qq!</TD></TR>!.
-
- qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!.
- qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Bank name </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
-
- qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCHK' ? '' : 'CHECKED' ). '> Charge future payments to this electronic check automatically</TD></TR>'.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- 'LECB' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Phone number </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!.
-
- qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!.
- qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!.
- qq!<INPUT TYPE="hidden" NAME="payname" VALUE="">!.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- 'BILL' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">P.O. </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!.
-
- qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!.
- qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">Attention </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- 'COMP' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Approved by </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE=""></TD></TR>!.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!.
- '<TD WIDTH="408">'.
-
- include('/elements/select-month_year.html',
- 'prefix' => 'exp',
- 'selected_date' =>
- ( $payby eq 'COMP' ? $cust_main->paydate : '' ),
- ).
-
- '</TD></TR>'.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- 'CASH' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- 'WEST' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- 'MCRD' =>
-
- '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-
- qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!.
- qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'MCRD' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
-
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
- '<TR><TD>&nbsp;</TD></TR>'.
-
- '</TABLE>',
-
- );
-
-
- my %allopt = (
- 'CARD' => 'Credit card',
- 'CHEK' => 'Electronic check',
- 'LECB' => 'Phone bill billing',
- 'BILL' => 'Billing',
- 'CASH' => 'Cash', # initial payment, then billing',
- 'WEST' => 'Western Union', # initial payment, then billing',
- 'MCRD' => 'Manual credit card', # initial payment, then billing',
- 'COMP' => 'Complimentary',
- );
- if ( $cust_main->custnum ) { #don't offer CASH/WEST/MCRD initial payment types
- # when editing customer
- delete $allopt{$_} for qw(CASH WEST MCRD);
- }
-
- tie my %options, 'Tie::IxHash',
- map { $_ => $allopt{$_} }
- grep { exists $allopt{$_} }
- @payby;
-
- my %payby2option = (
- ( map { $_ => $_ } keys %options ),
- 'DCRD' => 'CARD',
- 'DCHK' => 'CHEK',
- );
-
- my $widget = new HTML::Widgets::SelectLayers(
- 'options' => \%options,
- #'form_name' => 'dummy',
- #'form_action' => 'nothingyet',
- #chops bottom of page in IE# 'under_position' => 'absolute',
- 'html_between' => '</TD></TR></TABLE>',
- 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] },
- 'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
- );
-
- %>
-
- <TD WIDTH="408"><%= $widget->html %>
-
- <FORM NAME="billing_bottomform" STYLE="margin-top: 0; margin-bottom: 0">
-
- <%= &ntable("#cccccc") %>
-
- <TR><TD>&nbsp;</TD></TR>
-
- <TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <%= $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt</TD>
- </TR>
-
- <TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%=
-
- ( ( ! @invoicing_list
- && ! $conf->exists('disablepostalinvoicedefault')
- && ! $cust_main->custnum
- )
- || grep { $_ eq 'POST' } @invoicing_list )
-
- ? 'CHECKED'
- : ''
-
- %>> Postal mail invoice
-
- </TD>
- </TR>
-
- <TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <%=
-
- ( grep { $_ eq 'FAX' } @invoicing_list )
- ? 'CHECKED'
- : ''
-
- %>> Fax invoice
-
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN="right" WIDTH="200">Email invoice </TD>
- <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD>
- </TR>
-
- </TABLE>
-
- </FORM>
-
- <%= $r %> required fields
-
-<% } %>
-
diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html
index e0cd06f..7b88ccb 100644
--- a/httemplate/edit/cust_main/contact.html
+++ b/httemplate/edit/cust_main/contact.html
@@ -14,23 +14,14 @@ $cust_main->set($pre.'state', $statedefault )
unless $cust_main->get($pre.'state')
|| $cust_main->get($pre.'country') ne $countrydefault;
-#my($county_html, $state_html, $country_html) =
-# FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
-# $cust_main->get($pre.'state'),
-# $cust_main->get($pre.'country'),
-# $pre,
-# $onchange,
-# $disabled,
-# );
-
-my %select_hash = (
- 'county' => $cust_main->get($pre.'county'),
- 'state' => $cust_main->get($pre.'state'),
- 'country' => $cust_main->get($pre.'country'),
- 'prefix' => $pre,
- 'onchange' => $onchange,
- 'disabled' => $disabled,
-);
+my($county_html, $state_html, $country_html) =
+ FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
+ $cust_main->get($pre.'state'),
+ $cust_main->get($pre.'country'),
+ $pre,
+ $onchange,
+ $disabled,
+ );
my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone';
my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone';
@@ -39,7 +30,7 @@ my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
%>
-<%= &ntable("#cccccc") %>
+<%= &itable("#cccccc") %>
<TR>
<TH ALIGN="right"><%=$r%>Contact&nbsp;name<BR>(last,&nbsp;first)</TH>
@@ -51,7 +42,7 @@ my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
<% if ( $conf->exists('show_ss') && !$pre ) { %>
<TD ALIGN="right">SS#</TD>
<TD><INPUT TYPE="text" NAME="ss" VALUE="<%= $cust_main->ss %>" SIZE=11></TD>
-<% } elsif ( !$pre ) { %>
+<% } else { %>
<TD><INPUT TYPE="hidden" NAME="ss" VALUE="<%= $cust_main->ss %>"></TD>
<% } %>
@@ -84,10 +75,7 @@ my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
<INPUT TYPE="text" NAME="<%=$pre%>city" VALUE="<%= $cust_main->get($pre.'city') %>" onChange="<%= $onchange %>" <%=$disabled%>>
</TD>
<TH ALIGN="right"><%=$r%>State</TH>
- <TD>
- <%= include('select-county.html', %select_hash ) %>
- <%= include('select-state.html', %select_hash ) %>
- </TD>
+ <TD><%= $county_html. $state_html %></TD>
<TH><%=$r%>Zip</TH>
<TD>
<INPUT TYPE="text" NAME="<%=$pre%>zip" VALUE="<%= $cust_main->get($pre.'zip') %>" SIZE=10 onChange="<%= $onchange %>" <%=$disabled%>>
@@ -96,7 +84,7 @@ my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
<TR>
<TH ALIGN="right"><%=$r%>Country</TH>
- <TD><%= include('select-country.html', %select_hash ) %></TD>
+ <TD><%= $country_html %></TD>
</TR>
<TR>
diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html
deleted file mode 100644
index 014effd..0000000
--- a/httemplate/edit/cust_main/select-country.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<%
-
- my %opt = @_;
- foreach my $opt (qw( county state country prefix onchange disabled )) {
- $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
- }
-
- my $conf = new FS::Conf;
- my $countrydefault = $conf->config('countrydefault') || 'US';
-
-%>
-
-<%= include('/elements/xmlhttp.html',
- 'url' => $p.'misc/states.cgi',
- 'subs' => [ $opt{'prefix'}. 'get_states' ],
- )
-%>
-
-<SCRIPT TYPE="text/javascript">
-
- function opt(what,value,text) {
- var optionName = new Option(text, value, false, false);
- var length = what.length;
- what.options[length] = optionName;
- }
-
- function <%= $opt{'prefix'} %>country_changed(what, callback) {
-
- country = what.options[what.selectedIndex].text;
-
- function <%= $opt{'prefix'} %>update_states(states) {
-
- // blank the current state list
- for ( var i = what.form.<%= $opt{'prefix'} %>state.length; i >= 0; i-- )
- what.form.<%= $opt{'prefix'} %>state.options[i] = null;
-
- // add the new states
- var statesArray = eval('(' + states + ')' );
- for ( var s = 0; s < statesArray.length; s++ ) {
- var stateLabel = statesArray[s];
- if ( stateLabel == "" )
- stateLabel = '(n/a)';
- opt(what.form.<%= $opt{'prefix'} %>state, statesArray[s], stateLabel);
- }
-
- //run the callback
- if ( callback != null )
- callback();
- }
-
- // go get the new states
- <%= $opt{'prefix'} %>get_states( country, <%= $opt{'prefix'} %>update_states );
-
- }
-
-</SCRIPT>
-
-<SELECT NAME="<%= $opt{'prefix'} %>country" onChange="<%= $opt{'prefix'} %>country_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>>
-
-<% foreach my $country (
- sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) or $a cmp $b }
- map { $_->country }
- qsearch( 'cust_main_county',{}, 'DISTINCT ON ( country ) *', )
- ) {
-%>
-
- <OPTION VALUE="<%= $country %>"<%= $country eq $opt{'country'} ? ' SELECTED' : '' %>><%= $country %>
-
-<% } %>
-
-</SELECT>
-
diff --git a/httemplate/edit/cust_main/select-county.html b/httemplate/edit/cust_main/select-county.html
deleted file mode 100644
index 3de380b..0000000
--- a/httemplate/edit/cust_main/select-county.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<%
-
- my %opt = @_;
- foreach my $opt (qw( county state country prefix onchange disabled )) {
- $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
- }
-
- my $sql = "SELECT COUNT(*) FROM cust_main_county".
- " WHERE county IS NOT NULL AND county != ''";
- my $sth = dbh->prepare($sql) or die dbh->errstr;
- $sth->execute or die $sth->errstr;
- my $countyflag = $sth->fetchrow_arrayref->[0];
-
-%>
-
-<% if ( $countyflag ) { %>
-
- <%= include('/elements/xmlhttp.html',
- 'url' => $p.'misc/counties.cgi',
- 'subs' => [ $opt{'prefix'}. 'get_counties' ],
- )
-%>
-
- <SCRIPT TYPE="text/javascript">
-
- function opt(what,value,text) {
- var optionName = new Option(text, value, false, false);
- var length = what.length;
- what.options[length] = optionName;
- }
-
- function <%= $opt{'prefix'} %>state_changed(what, callback) {
-
- state = what.options[what.selectedIndex].text;
- country = what.form.<%= $opt{'prefix'} %>country.options[what.form.<%= $opt{'prefix'} %>country.selectedIndex].text;
-
- function <%= $opt{'prefix'} %>update_counties(counties) {
-
- // blank the current county list
- for ( var i = what.form.<%= $opt{'prefix'} %>county.length; i >= 0; i-- )
- what.form.<%= $opt{'prefix'} %>county.options[i] = null;
-
- // add the new counties
- var countiesArray = eval('(' + counties + ')' );
- for ( var s = 0; s < countiesArray.length; s++ ) {
- var countyLabel = countiesArray[s];
- if ( countyLabel == "" )
- countyLabel = '(n/a)';
- opt(what.form.<%= $opt{'prefix'} %>county, countiesArray[s], countyLabel);
- }
-
- //run the callback
- if ( callback != null )
- callback();
- }
-
- // go get the new counties
- <%= $opt{'prefix'} %>get_counties( state, country, <%= $opt{'prefix'} %>update_counties );
-
- }
-
- </SCRIPT>
-
- <SELECT NAME="<%= $opt{'prefix'} %>county" onChange="<%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>>
-
- <% foreach my $county (
- sort
- map { $_->county }
- qsearch('cust_main_county', { 'state' => $opt{'state'},
- 'country' => $opt{'country'},
- }
- )
- ) {
- %>
-
- <OPTION VALUE="<%= $county %>"<%= $county eq $opt{'county'} ? ' SELECTED' : '' %>><%= $county %>
-
- <% } %>
-
- </SELECT>
-
-<% } else { %>
-
- <SCRIPT TYPE="text/javascript">
- function <%= $opt{'prefix'} %>state_changed(what) {
- }
- </SCRIPT>
-
- <INPUT TYPE="hidden" NAME="<%= $opt{'prefix'} %>county" VALUE="<%= $opt{'county'} %>">
-
-<% } %>
diff --git a/httemplate/edit/cust_main/select-state.html b/httemplate/edit/cust_main/select-state.html
deleted file mode 100644
index 98e685a..0000000
--- a/httemplate/edit/cust_main/select-state.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<%
-
- my %opt = @_;
- foreach my $opt (qw( county state country prefix onchange disabled )) {
- $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
- }
-
-%>
-
-<SELECT NAME="<%= $opt{'prefix'} %>state" onChange="<%= $opt{'prefix'} %>state_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>>
-
-<% foreach my $state (
- sort
- map { $_->state }
- qsearch( 'cust_main_county',
- { 'country' => $opt{'country'} },
- 'DISTINCT ON ( state ) *',
- )
- ) {
-%>
-
- <OPTION VALUE="<%= $state %>"<%= $state eq $opt{'state'} ? ' SELECTED' : '' %>><%= $state || '(n/a)' %>
-
-<% } %>
-
-</SELECT>
-
diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
index 0370ab7..755050b 100755
--- a/httemplate/edit/cust_pay.cgi
+++ b/httemplate/edit/cust_pay.cgi
@@ -1,14 +1,8 @@
+<!-- mason kludge -->
<%
my $conf = new FS::Conf;
-my %payby = (
- 'BILL' => 'Check',
- 'CASH' => 'Cash',
- 'WEST' => 'Western Union',
- 'MCRD' => 'Manual credit card',
-);
-
my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date);
if ( $cgi->param('error') ) {
$link = $cgi->param('link');
@@ -18,34 +12,33 @@ if ( $cgi->param('error') ) {
$payinfo = $cgi->param('payinfo');
$quickpay = $cgi->param('quickpay');
$_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time;
-} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
- $link = 'custnum';
- $linknum = $1;
- $paid = '';
- $payby = $cgi->param('payby') || 'BILL';
- $payinfo = '';
- $quickpay = $cgi->param('quickpay');
- $_date = time;
-} elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) {
+} elsif ($cgi->keywords) {
+ my($query) = $cgi->keywords;
+ $query =~ /^(\d+)$/;
$link = 'invnum';
$linknum = $1;
$paid = '';
- $payby = $cgi->param('payby') || 'BILL';
+ $payby = 'BILL';
$payinfo = "";
$quickpay = '';
$_date = time;
+} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+ $link = 'custnum';
+ $linknum = $1;
+ $paid = '';
+ $payby = 'BILL';
+ $payinfo = '';
+ $quickpay = $cgi->param('quickpay');
+ $_date = time;
} else {
die "illegal query ". $cgi->keywords;
}
my $paybatch = "webui-$_date-$$-". rand() * 2**32;
-my $title = 'Post '. $payby{$payby}. ' payment';
-$title .= " against Invoice #$linknum" if $link eq 'invnum';
-
%>
-<%= header($title, '') %>
+<%= header("Post payment", '') %>
<% if ( $cgi->param('error') ) { %>
<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
@@ -65,12 +58,49 @@ $title .= " against Invoice #$linknum" if $link eq 'invnum';
<INPUT TYPE="hidden" NAME="quickpay" VALUE="<%= $quickpay %>">
<%
-my $money_char = $conf->config('money_char') || '$';
my $custnum;
if ( $link eq 'invnum' ) {
+
my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } )
or die "unknown invnum $linknum";
+ print "Invoice #<B>$linknum</B>". ntable("#cccccc",2).
+ '<TR><TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff">'.
+ time2str("%D", $cust_bill->_date). '</TD></TR>'.
+ '<TR><TD ALIGN="right" VALIGN="top">Items</TD><TD BGCOLOR="#ffffff">';
+ foreach ( $cust_bill->cust_bill_pkg ) { #false laziness with FS::cust_bill
+ if ( $_->pkgnum ) {
+
+ my($cust_pkg)=qsearchs('cust_pkg', { 'pkgnum', $_->pkgnum } );
+ my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->pkgpart});
+ my($pkg)=$part_pkg->pkg;
+
+ if ( $_->setup != 0 ) {
+ print "$pkg Setup<BR>"; # $money_char. sprintf("%10.2f",$_->setup);
+ print join('<BR>',
+ map { " ". $_->[0]. ": ". $_->[1] } $cust_pkg->labels
+ ). '<BR>';
+ }
+
+ if ( $_->recur != 0 ) {
+ print
+ "$pkg (" . time2str("%x",$_->sdate) . " - " .
+ time2str("%x",$_->edate) . ")<BR>";
+ #$money_char. sprintf("%10.2f",$_->recur)
+ print join('<BR>',
+ map { '--->'. $_->[0]. ": ". $_->[1] } $cust_pkg->labels
+ ). '<BR>';
+ }
+
+ } else { #pkgnum Tax
+ print "Tax<BR>" # $money_char. sprintf("%10.2f",$_->setup)
+ if $_->setup != 0;
+ }
+
+ }
+ print '</TD></TR></TABLE><BR><BR>';
+
$custnum = $cust_bill->custnum;
+
} elsif ( $link eq 'custnum' ) {
$custnum = $linknum;
}
@@ -100,28 +130,16 @@ Payment
</SCRIPT>
<TR>
<TD ALIGN="right">Amount</TD>
- <TD BGCOLOR="#ffffff" ALIGN="right"><%= $money_char %></TD>
- <TD><INPUT TYPE="text" NAME="paid" VALUE="<%= $paid %>" SIZE=8 MAXLENGTH=8> by <B><%= $payby{$payby} %></B></TD>
+ <TD BGCOLOR="#ffffff" ALIGN="right">$</TD>
+ <TD><INPUT TYPE="text" NAME="paid" VALUE="<%= $paid %>" SIZE=8 MAXLENGTH=8></TD>
+</TR>
+<TR>
+ <TD ALIGN="right">Check #</TD>
+ <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<%= $payinfo %>" SIZE=10></TD>
</TR>
-
-<% if ( $payby eq 'BILL' ) { %>
-
- <TR>
- <TD ALIGN="right">Check #</TD>
- <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<%= $payinfo %>" SIZE=10></TD>
- </TR>
-
-<% } %>
-
<TR>
-<% if ( $link eq 'custnum' ) { %>
<TD ALIGN="right">Auto-apply<BR>to invoices</TD>
<TD COLSPAN=2><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED>yes<OPTION>no</SELECT></TD>
-<% } elsif ( $link eq 'invnum' ) { %>
- <TD ALIGN="right">Apply to</TD>
- <TD COLSPAN=2 BGCOLOR="#ffffff">Invoice #<B><%= $linknum %></B> only</TD>
- <INPUT TYPE="hidden" NAME="apply" VALUE="no">
-<% } %>
</TR>
</TABLE>
diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi
index ce1c866..485d601 100755
--- a/httemplate/edit/cust_pkg.cgi
+++ b/httemplate/edit/cust_pkg.cgi
@@ -45,24 +45,23 @@ my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } );
if (@cust_pkg) {
print <<END;
Current packages - select to remove (services are moved to a new package below)
-<TABLE>
- <TR STYLE="background-color: #cccccc;">
- <TH COLSPAN="2">Pkg #</TH>
- <TH>Package description</TH>
- </TR>
<BR><BR>
END
- foreach (sort { $all_pkg{$a->getfield('pkgpart')} cmp $all_pkg{$b->getfield('pkgpart')} } @cust_pkg) {
+ my $count = 0 ;
+ print qq!<TABLE>! ;
+ foreach (@cust_pkg) {
+ print '<TR>' if $count == 0;
my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') );
- my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : '';
- print <<END;
- <TR>
- <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="$pkgnum"${checked}></TD>
- <TD ALIGN="right">$pkgnum:</TD>\n
- <TD>$all_pkg{$pkgpart} - $all_comment{$pkgpart}</TD>
- </TR>
-END
+ print qq!<TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="$pkgnum"!;
+ print " CHECKED" if $remove_pkg{$pkgnum};
+ print qq!>$pkgnum: $all_pkg{$pkgpart} - $all_comment{$pkgpart}</TD>\n!;
+ $count ++ ;
+ if ($count == 2)
+ {
+ $count = 0 ;
+ print qq!</TR>\n! ;
+ }
}
print qq!</TABLE><BR><BR>!;
}
@@ -74,37 +73,25 @@ END
my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
-my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) }
- qsearch('type_pkgs',{'typenum'=> $agent->typenum });
-
my $count = 0;
my $pkgparts = 0;
-print <<END;
-<TABLE>
- <TR STYLE="background-color: #cccccc;">
- <TH>Qty.</TH>
- <TH COLSPAN="2">Package Description</TH>
- </TR>
-END
-#foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
-foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} }
- keys(%agent_pkgs) ) {
+print qq!<TABLE>!;
+foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
$pkgparts++;
+ my($pkgpart)=$type_pkgs->pkgpart;
next unless exists $pkg{$pkgpart}; #skip disabled ones
- #print qq!<TR>! if ( $count == 0 );
+ print qq!<TR>! if ( $count == 0 );
my $value = $cgi->param("pkg$pkgpart") || 0;
print <<END;
- <TR>
- <TD><INPUT TYPE="text" NAME="pkg$pkgpart" VALUE="$value" SIZE="2" MAXLENGTH="2"></TD>
- <TD ALIGN="right">$pkgpart:</TD>
- <TD>$pkg{$pkgpart} - $comment{$pkgpart}</TD>
- </TR>
+ <TD>
+ <INPUT TYPE="text" NAME="pkg$pkgpart" VALUE="$value" SIZE="2" MAXLENGTH="2">
+ $pkgpart: $pkg{$pkgpart} - $comment{$pkgpart}</TD>\n
END
$count ++ ;
- #if ( $count == 2 ) {
- # print qq!</TR>\n! ;
- # $count = 0;
- #}
+ if ( $count == 2 ) {
+ print qq!</TR>\n! ;
+ $count = 0;
+ }
}
print qq!</TABLE>!;
diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi
index 32ca47a..99bc260 100755
--- a/httemplate/edit/part_bill_event.cgi
+++ b/httemplate/edit/part_bill_event.cgi
@@ -83,20 +83,16 @@ sub select_pkgpart {
sub select_agentnum {
my $plandata = shift;
- #my $agentnum = $plandata->{'agentnum'};
- my %agentnums = map { $_=>1 } split(/,\s*/, $plandata->{'agentnum'});
- '<SELECT NAME="agentnum" MULTIPLE>'.
+ my $agentnum = $plandata->{'agentnum'};
+ '<SELECT NAME="agentnum">'.
join("\n", map {
'<OPTION VALUE="'. $_->agentnum. '"'.
- ( $agentnums{$_->agentnum} ? ' SELECTED' : '' ).
+ ( $_->agentnum == $agentnum ? ' SELECTED' : '' ).
'>'. $_->agent
} qsearch('agent', { 'disabled' => '' } ) ).
'</SELECT>';
}
-my $conf = new FS::Conf;
-my $money_char = $conf->config('money_char') || '$';
-
#this is pretty kludgy right here.
tie my %events, 'Tie::IxHash',
@@ -113,12 +109,6 @@ tie my %events, 'Tie::IxHash',
'code' => '$cust_main->suspend();',
'weight' => 10,
},
- 'suspend' => {
- 'name' => 'Suspend if balance (this invoice and previous) over',
- 'code' => '$cust_bill->cust_suspend_if_balance_over( %%%balanceover%%% );',
- 'html' => " $money_char ". '<INPUT TYPE="text" SIZE="7" NAME="balanceover" VALUE="%%%balanceover%%%">',
- 'weight' => 10,
- },
'suspend-if-pkgpart' => {
'name' => 'Suspend packages',
'code' => '$cust_main->suspend_if_pkgpart(%%%if_pkgpart%%%);',
@@ -197,11 +187,11 @@ tie my %events, 'Tie::IxHash',
'send_agent' => {
'name' => 'Send invoice (email/print) ',
- 'code' => '$cust_bill->send(\'%%%agent_templatename%%%\', [ %%%agentnum%%% ], \'%%%agent_invoice_from%%%\');',
+ 'code' => '$cust_bill->send(\'%%%agent_templatename%%%\', %%%agentnum%%%, \'%%%agent_invoice_from%%%\');',
'html' => sub {
'<TABLE BORDER=0>
<TR>
- <TD ALIGN="right">only for agent(s) </TD>
+ <TD ALIGN="right">only for agent </TD>
<TD>'. &select_agentnum(@_). '</TD>
</TR>
<TR>
@@ -223,26 +213,13 @@ tie my %events, 'Tie::IxHash',
'send_csv_ftp' => {
'name' => 'Upload CSV invoice data to an FTP server',
- 'code' => '$cust_bill->send_csv( protocol => \'ftp\',
- server => \'%%%ftpserver%%%\',
- username => \'%%%ftpusername%%%\',
- password => \'%%%ftppassword%%%\',
- dir => \'%%%ftpdir%%%\',
- \'format\' => \'%%%ftpformat%%%\',
- );',
+ 'code' => '$cust_bill->send_csv( protocol => \'ftp\',
+ server => \'%%%ftpserver%%%\',
+ username => \'%%%ftpusername%%%\',
+ password => \'%%%ftppassword%%%\',
+ dir => \'%%%ftpdir%%%\' );',
'html' =>
- '<TABLE BORDER=0>'.
- '<TR><TD ALIGN="right">Format ("default" or "billco"): </TD>'.
- '<TD>'.
- '<!--'.
- '<SELECT NAME="ftpformat">'.
- '<OPTION VALUE="default">Default'.
- '<OPTION VALUE="billco">Billco'.
- '</SELECT>'.
- '-->'.
- '<INPUT TYPE="text" NAME="ftpformat" VALUE="%%%ftpformat%%%">'.
- '</TD></TR>'.
- '<TR><TD ALIGN="right">FTP server: </TD>'.
+ '<TABLE BORDER=0><TR><TD ALIGN="right">FTP server: </TD>'.
'<TD><INPUT TYPE="text" NAME="ftpserver" VALUE="%%%ftpserver%%%">'.
'</TD></TR>'.
'<TR><TD ALIGN="right">FTP username: </TD><TD>'.
@@ -258,63 +235,6 @@ tie my %events, 'Tie::IxHash',
'weight' => 50,
},
- 'spool_csv' => {
- 'name' => 'Spool CSV invoice data',
- 'code' => '$cust_bill->spool_csv(
- \'format\' => \'%%%spoolformat%%%\',
- \'dest\' => \'%%%spooldest%%%\',
- \'agent_spools\' => \'%%%spoolagent_spools%%%\',
- );',
- 'html' => sub {
- my $plandata = shift;
-
- my $html =
- '<TABLE BORDER=0>'.
- '<TR><TD ALIGN="right">Format: </TD>'.
- '<TD>'.
- '<SELECT NAME="spoolformat">';
-
- foreach my $option (qw( default billco )) {
- $html .= qq(<OPTION VALUE="$option");
- $html .= ' SELECTED' if $option eq $plandata->{'spoolformat'};
- $html .= ">\u$option";
- }
-
- $html .=
- '</SELECT>'.
- '</TD></TR>'.
- '<TR><TD ALIGN="right">For destination: </TD>'.
- '<TD>'.
- '<SELECT NAME="spooldest">';
-
- tie my %dest, 'Tie::IxHash',
- '' => '(all)',
- 'POST' => 'Postal Mail',
- 'EMAIL' => 'Email',
- 'FAX' => 'Fax',
- ;
-
- foreach my $dest (keys %dest) {
- $html .= qq(<OPTION VALUE="$dest");
- $html .= ' SELECTED' if $dest eq $plandata->{'spooldest'};
- $html .= '>'. $dest{$dest};
- }
-
- $html .=
- '</SELECT>'.
- '</TD></TR>'.
- '<TR><TD ALIGN="right">Individual per-agent spools? </TD>'.
- '<TD><INPUT TYPE="checkbox" NAME="spoolagent_spools" VALUE="1" '.
- ( $plandata->{'spoolagent_spools'} ? 'CHECKED' : '' ).
- '>'.
- '</TD></TR>'.
- '</TABLE>';
-
- $html;
- },
- 'weight' => 50,
- },
-
'bill' => {
'name' => 'Generate invoices (normally only used with a <i>Late Fee</i> event)',
'code' => '$cust_main->bill();',
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 60365f6..b3c389c 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
@@ -12,26 +13,21 @@ if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
}
my ($query) = $cgi->keywords;
-
+my $action = '';
my $part_pkg = '';
if ( $cgi->param('error') ) {
$part_pkg = new FS::part_pkg ( {
map { $_, scalar($cgi->param($_)) } fields('part_pkg')
} );
}
-
-my $action = '';
my $clone_part_pkg = '';
-my $pkgpart = '';
if ( $cgi->param('clone') ) {
- $pkgpart = $cgi->param('clone');
$action = 'Custom Pricing';
$clone_part_pkg= qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } );
$part_pkg ||= $clone_part_pkg->clone;
- $part_pkg->disabled('Y'); #isn't sticky on errors
+ $part_pkg->disabled('Y');
} elsif ( $query && $query =~ /^(\d+)$/ ) {
$part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1});
- $pkgpart = $part_pkg->pkgpart;
} else {
unless ( $part_pkg ) {
$part_pkg = new FS::part_pkg {};
@@ -59,8 +55,21 @@ my $hashref = $part_pkg->hashref;
<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
<% } %>
+<% #print '<FORM ACTION="', popurl(1), 'process/part_pkg.cgi" METHOD=POST>'; %>
+
<FORM NAME="dummy">
+<%
+#if ( $cgi->param('clone') ) {
+# print qq!<INPUT TYPE="hidden" NAME="clone" VALUE="!, $cgi->param('clone'), qq!">!;
+#}
+#if ( $cgi->param('pkgnum') ) {
+# print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="!, $cgi->param('pkgnum'), qq!">!;
+#}
+#
+#print qq!<INPUT TYPE="hidden" NAME="pkgpart" VALUE="$hashref->{pkgpart}">!,
+%>
+
<%= itable('',8,1) %><TR><TD VALIGN="top">
Package information
@@ -106,31 +115,42 @@ Tax information
<TR>
<TD ALIGN="right">Setup fee tax exempt</TD>
<TD>
- <INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y" <%= $hashref->{setuptax} eq 'Y' ? ' CHECKED' : '' %>>
- </TD>
- </TR>
- <TR>
- <TD ALIGN="right">Recurring fee tax exempt</TD>
- <TD>
- <INPUT TYPE="checkbox" NAME="recurtax" VALUE="Y" <%= $hashref->{recurtax} eq 'Y' ? ' CHECKED' : '' %>>
- </TD>
- </TR>
+<%
-<% my $conf = new FS::Conf; %>
-<% if ( $conf->exists('enable_taxclasses') ) { %>
+print '<INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y"';
+print ' CHECKED' if $hashref->{setuptax} eq "Y";
+print '>';
- <TR>
- <TD align="right">Tax class</TD>
- <TD>
- <%= include('/elements/select-taxclass.html', $hashref->{taxclass} ) %>
- </TD>
- </TR>
+print <<END;
+</TD></TR>
+<TR><TD ALIGN="right">Recurring fee tax exempt</TD><TD>
+END
-<% } else { %>
+print '<INPUT TYPE="checkbox" NAME="recurtax" VALUE="Y"';
+print ' CHECKED' if $hashref->{recurtax} eq "Y";
+print '>';
- <%= include('/elements/select-taxclass.html', $hashref->{taxclass} ) %>
+print '</TD></TR>';
-<% } %>
+my $conf = new FS::Conf;
+#false laziness w/ view/cust_main.cgi quick order
+if ( $conf->exists('enable_taxclasses') ) {
+ print '<TR><TD ALIGN="right">Tax class</TD><TD><SELECT NAME="taxclass">';
+ my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
+ or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ foreach my $taxclass ( map $_->[0], @{$sth->fetchall_arrayref} ) {
+ print qq!<OPTION VALUE="$taxclass"!;
+ print ' SELECTED' if $taxclass eq $hashref->{taxclass};
+ print qq!>$taxclass</OPTION>!;
+ }
+ print '</SELECT></TD></TR>';
+} else {
+ print
+ '<INPUT TYPE="hidden" NAME="taxclass" VALUE="'. $hashref->{taxclass}. '">';
+}
+
+%>
</TABLE>
@@ -144,76 +164,72 @@ $thead .= '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Primary</FONT></TH>'
if dbdef->table('pkg_svc')->column('primary_svc');
$thead .= '<TH BGCOLOR="#dcdcdc">Service</TH></TR>';
-%>
-
-<%= itable('', 4, 1) %><TR><TD VALIGN="top">
+#unless ( $cgi->param('clone') ) {
+#dunno why...
+unless ( 0 ) {
+ #print <<END, $thead;
+ print <<END, itable('', 4, 1), '<TR><TD VALIGN="top">', $thead;
<BR><BR>Services included
-<%= $thead %>
-
-<%
-
-my $where = "WHERE disabled IS NULL OR disabled = ''";
-if ( $pkgpart ) {
- $where .= " OR 0 < ( SELECT quantity FROM pkg_svc
- WHERE pkg_svc.svcpart = part_svc.svcpart
- AND pkgpart = $pkgpart
- )";
+END
}
-my @part_svc = qsearch('part_svc', {}, '', $where);
-my $q_part_pkg = $clone_part_pkg || $part_pkg;
-my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc;
my @fixups = ();
my $count = 0;
my $columns = 3;
+my @part_svc = qsearch( 'part_svc', { 'disabled' => '' } );
foreach my $part_svc ( @part_svc ) {
my $svcpart = $part_svc->svcpart;
- my $pkg_svc = $pkg_svc{$svcpart}
- || new FS::pkg_svc ( {
- 'pkgpart' => $pkgpart,
- 'svcpart' => $svcpart,
- 'quantity' => 0,
- 'primary_svc' => '',
- } );
+ my $pkgpart = $cgi->param('clone') || $part_pkg->pkgpart;
+ my $pkg_svc = $pkgpart && qsearchs( 'pkg_svc', {
+ 'pkgpart' => $pkgpart,
+ 'svcpart' => $svcpart,
+ } ) || new FS::pkg_svc ( {
+ 'pkgpart' => $pkgpart,
+ 'svcpart' => $svcpart,
+ 'quantity' => 0,
+ 'primary_svc' => '',
+ });
+ #? #next unless $pkg_svc;
push @fixups, "pkg_svc$svcpart";
-%>
-
- <TR>
- <TD>
- <INPUT TYPE="text" NAME="pkg_svc<%= $svcpart %>" SIZE=4 MAXLENGTH=3 VALUE="<%= $cgi->param("pkg_svc$svcpart") || $pkg_svc->quantity || 0 %>">
- </TD>
-
- <TD>
- <INPUT TYPE="radio" NAME="pkg_svc_primary" VALUE="<%= $svcpart %>" <%= $pkg_svc->primary_svc =~ /^Y/i ? ' CHECKED' : '' %>>
- </TD>
-
- <TD>
- <A HREF="part_svc.cgi?<%= $part_svc->svcpart %>"><%= $part_svc->svc %></A> <%= $part_svc->disabled =~ /^Y/i ? ' (DISABLED' : '' %>
- </TD>
- </TR>
-
- <% $count++;
- foreach ( 1 .. $columns-1 ) {
- if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) {
- %>
- </TABLE></TD><TD VALIGN="top"><%= $thead %>
-
- <% }
- }
- %>
-
-<% } %>
-
-</TR></TABLE></TD></TR></TABLE>
+ #unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) {
+ #dunno why...
+ unless ( 0 ) {
+ print '<TR>'; # if $count == 0 ;
+ print qq!<TD><INPUT TYPE="text" NAME="pkg_svc$svcpart" SIZE=4 MAXLENGTH=3 VALUE="!,
+ $cgi->param("pkg_svc$svcpart") || $pkg_svc->quantity || 0,
+ qq!"></TD>!;
+ if ( dbdef->table('pkg_svc')->column('primary_svc') ) {
+ print qq!<TD><INPUT TYPE="radio" NAME="pkg_svc_primary" VALUE="$svcpart"!;
+ print ' CHECKED' if $pkg_svc->primary_svc =~ /^Y/i;
+ print '></TD>';
+ }
+ print qq!<TD><A HREF="part_svc.cgi?!,$part_svc->svcpart,
+ qq!">!, $part_svc->getfield('svc'), "</A></TD></TR>";
+# print "</TABLE></TD><TD>$thead" if ++$count == int(scalar(@part_svc) / 2);
+ $count+=1;
+ foreach ( 1 .. $columns-1 ) {
+ print "</TABLE></TD><TD VALIGN=\"top\">$thead"
+ if $count == int( $_ * scalar(@part_svc) / $columns );
+ }
+ } else {
+ print qq!<INPUT TYPE="hidden" NAME="pkg_svc$svcpart" VALUE="!,
+ $cgi->param("pkg_svc$svcpart") || $pkg_svc->quantity || 0, qq!">\n!;
+ }
+}
-<% foreach my $f ( qw( clone pkgnum ) ) { %>
- <INPUT TYPE="hidden" NAME="<%= $f %>" VALUE="<%= $cgi->param($f) %>">
-<% } %>
-<INPUT TYPE="hidden" NAME="pkgpart" VALUE="<%= $part_pkg->pkgpart %>">
+#unless ( $cgi->param('clone') ) {
+#dunno why...
+unless ( 0 ) {
+ print "</TR></TABLE></TD></TR></TABLE>";
+ #print "</TR></TABLE>";
+}
-<%
+foreach my $f ( qw( clone pkgnum ) ) {
+ print qq!<INPUT TYPE="hidden" NAME="$f" VALUE="!. $cgi->param($f). '">';
+}
+print '<INPUT TYPE="hidden" NAME="pkgpart" VALUE="'. $part_pkg->pkgpart. '">';
# prolly should be in database
tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() };
@@ -286,12 +302,6 @@ my $widget = new HTML::Widgets::SelectLayers(
? $plandata{$field}
: $href->{$field}{'default'} ).
qq!" onChange="fchanged(this)">!;
- } elsif ( $href->{$field}{'type'} eq 'checkbox' ) {
- $html .= qq!<INPUT TYPE="checkbox" NAME="$field" VALUE=1 !.
- ( exists($plandata{$field}) && $plandata{$field}
- ? ' CHECKED'
- : ''
- ). '>';
} elsif ( $href->{$field}{'type'} =~ /^select/ ) {
$html .= '<SELECT';
$html .= ' MULTIPLE'
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 9749fc1..befd9b2 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -1,7 +1,52 @@
<%
my $part_svc;
my $clone = '';
-if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone
+my $error = '';
+if ( $cgi->param('magic') eq 'process' ) {
+
+ my $svcpart = $cgi->param('svcpart');
+ my $old = qsearchs('part_svc', { 'svcpart' => $svcpart }) if $svcpart;
+
+ $cgi->param( 'svc_acct__usergroup',
+ join(',', $cgi->param('svc_acct__usergroup') ) );
+
+ my $new = new FS::part_svc ( {
+ map {
+ $_, scalar($cgi->param($_));
+ # } qw(svcpart svc svcdb)
+ } ( fields('part_svc'),
+ map { my $svcdb = $_;
+ my @fields = fields($svcdb);
+ push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
+ map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields;
+ } grep defined( $FS::Record::dbdef->table($_) ),
+ qw( svc_acct svc_domain svc_forward svc_www svc_broadband )
+ )
+ } );
+
+ my %exportnums =
+ map { $_->exportnum => ( $cgi->param('exportnum'.$_->exportnum) || '') }
+ qsearch('part_export', {} );
+
+ if ( $svcpart ) {
+ $error = $new->replace($old, '1.3-COMPAT', [ 'usergroup' ], \%exportnums );
+ } else {
+ $error = $new->insert( [ 'usergroup' ], \%exportnums );
+ $svcpart = $new->getfield('svcpart');
+ }
+
+ unless ( $error ) { #no error, redirect
+ #print $cgi->redirect(popurl(3)."browse/part_svc.cgi");
+ print $cgi->redirect("${p}browse/part_svc.cgi");
+ myexit;
+ }
+
+ $part_svc = $new; #??
+ #$part_svc = new FS::part_svc ( {
+ # map { $_, scalar($cgi->param($_)) } fields('part_svc')
+ #} );
+
+} elsif ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone
#$cgi->param('clone') =~ /^(\d+)$/ or die "malformed query: $query";
$part_svc = qsearchs('part_svc', { 'svcpart'=>$1 } )
or die "unknown svcpart: $1";
@@ -23,6 +68,7 @@ my $hashref = $part_svc->hashref;
#" onLoad=\"visualize()\""
%>
+<!-- mason kludge -->
<%= header("$action Service Definition",
menubar( 'Main Menu' => $p,
'View all service definitions' => "${p}browse/part_svc.cgi"
@@ -30,12 +76,17 @@ my $hashref = $part_svc->hashref;
)
%>
+<% if ( $error ) { %>
+<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT>
+<% } %>
+
<FORM NAME="dummy">
Service Part #<%= $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %>
<BR><BR>
Service <INPUT TYPE="text" NAME="svc" VALUE="<%= $hashref->{svc} %>"><BR>
Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<%= $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>><BR>
+<INPUT TYPE="hidden" NAME="magic" VALUE="process">
<INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $hashref->{svcpart} %>">
<BR>
Services are items you offer to your customers.
@@ -66,8 +117,8 @@ my $conf = new FS::Conf;
my %defs = (
'svc_acct' => {
'dir' => 'Home directory',
- 'uid' => 'UID (set to fixed and blank for no UIDs)',
- 'slipip' => 'IP address',
+ 'uid' => 'UID (set to fixed and blank for dial-only)',
+ 'slipip' => 'IP address (Set to fixed and blank to disable dialin, or, set a value to be exported to RADIUS Framed-IP-Address. Use the special value <code>0e0</code> [zero e zero] to enable export to RADIUS without a Framed-IP-Address.)',
# 'popnum' => qq!<A HREF="$p/browse/svc_acct_pop.cgi/">POP number</A>!,
'popnum' => {
desc => 'Access number',
@@ -84,7 +135,7 @@ my %defs = (
'_password' => 'Password',
'gid' => 'GID (when blank, defaults to UID)',
'shell' => {
- desc =>'Shell (all service definitions should have a default or fixed shell that is present in the <b>shells</b> configuration file, set to blank for no shell tracking)',
+ desc =>'Shell (all service definitions should have a default or fixed shell that is present in the <b>shells</b> configuration file)',
type =>'select',
select_list => [ $conf->config('shells') ],
},
@@ -97,7 +148,7 @@ my %defs = (
select_label => 'domain',
},
'usergroup' => {
- desc =>'RADIUS groups',
+ desc =>'ICRADIUS/FreeRADIUS groups',
type =>'radius_usergroup_selector',
},
},
@@ -162,11 +213,10 @@ my %defs = (
'form_name' => 'dummy',
#'form_action' => 'process/part_svc.cgi',
'form_action' => 'part_svc.cgi', #self
- 'form_text' => [ qw( svc svcpart ) ],
+ 'form_text' => [ qw( magic svc svcpart ) ],
'form_checkbox' => [ 'disabled' ],
'layer_callback' => sub {
my $layer = shift;
-
my $html = qq!<INPUT TYPE="hidden" NAME="svcdb" VALUE="$layer">!;
my $columns = 3;
@@ -193,15 +243,19 @@ my %defs = (
$html .= table(). "<TH>Field</TH><TH COLSPAN=2>Modifier</TH>";
#yucky kludge
- my @fields = defined( dbdef->table($layer) )
+ my @fields = defined( $FS::Record::dbdef->table($layer) )
? grep { $_ ne 'svcnum' } fields($layer)
: ();
push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge
$part_svc->svcpart($clone) if $clone; #haha, undone below
foreach my $field (@fields) {
my $part_svc_column = $part_svc->part_svc_column($field);
- my $value = $part_svc_column->columnvalue;
- my $flag = $part_svc_column->columnflag;
+ my $value = $error
+ ? $cgi->param("${layer}__${field}")
+ : $part_svc_column->columnvalue;
+ my $flag = $error
+ ? $cgi->param("${layer}__${field}_flag")
+ : $part_svc_column->columnflag;
my $def = $defs{$layer}{$field};
my $desc = ref($def) ? $def->{desc} : $def;
@@ -263,20 +317,8 @@ my %defs = (
$part_svc->svcpart('') if $clone; #undone
$html .= "</TABLE>";
- $html .= include('/elements/progress-init.html',
- $layer, #form name
- [ qw(svc svcpart disabled exportnum), @fields ],
- 'process/part_svc.cgi',
- $p.'browse/part_svc.cgi',
- $layer,
- );
- $html .= '<BR><INPUT NAME="submit" TYPE="button" VALUE="'.
- ($hashref->{svcpart} ? 'Apply changes' : 'Add service'). '" '.
- ' onClick="document.'. "$layer.submit.disabled=true; ".
- "fixup(document.$layer); $layer". 'process();">';
-
- #$html .= '<BR><INPUT TYPE="submit" VALUE="'.
- # ($hashref->{svcpart} ? 'Apply changes' : 'Add service'). '">';
+ $html .= '<BR><INPUT TYPE="submit" VALUE="'.
+ ($hashref->{svcpart} ? 'Apply changes' : 'Add service'). '">';
$html;
diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html
deleted file mode 100644
index 33cc236..0000000
--- a/httemplate/edit/payment_gateway.html
+++ /dev/null
@@ -1,109 +0,0 @@
-<%
-
-my $payment_gateway;
-if ( $cgi->param('error') ) {
- $payment_gateway = new FS::payment_gateway ( {
- map { $_, scalar($cgi->param($_)) } fields('payment_gateway')
- } );
-} elsif ( $cgi->keywords ) {
- my($query) = $cgi->keywords;
- $query =~ /^(\d+)$/;
- $payment_gateway = qsearchs( 'payment_gateway', { 'gatewaynum' => $1 } );
-} else { #adding
- $payment_gateway = new FS::payment_gateway {};
-}
-my $action = $payment_gateway->gatewaynum ? 'Edit' : 'Add';
-#my $hashref = $payment_gateway->hashref;
-
-%>
-
-<%= header("$action Payment gateway", menubar(
- 'Main Menu' => $p,
- 'View all payment gateways' => $p. 'browse/payment_gateway.html',
-)) %>
-
-<% if ( $cgi->param('error') ) { %>
-<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
-<% } %>
-
-<FORM ACTION="<%=popurl(1)%>process/payment_gateway.html" METHOD=POST>
-<INPUT TYPE="hidden" NAME="gatewaynum" VALUE="<%= $payment_gateway->gatewaynum %>">
-Gateway #<%= $payment_gateway->gatewaynum || "(NEW)" %>
-
-<%= ntable('#cccccc', 2, '') %>
-
-<TR>
- <TH ALIGN="right">Gateway: </TH>
- <TD><SELECT NAME="gateway_module" SIZE=1>
- <% foreach my $module ( qw(
- 2CheckOut
- AuthorizeNet
- BankOfAmerica
- Beanstream
- Capstone
- Cardstream
- CashCow
- CyberSource
- eSec
- eSelectPlus
- Exact
- iAuthorizer
- IPaymentTPG
- Jettis
- LinkPoint
- MerchantCommerce
- Network1Financial
- OCV
- OpenECHO
- PayConnect
- PayflowPro
- PaymentsGateway
- PXPost
- SecureHostingUPG
- Skipjack
- StGeorge
- SurePay
- TCLink
- TransactionCentral
- VirtualNet
- ) ) {
- %>
- <OPTION VALUE="<%= $module %>"><%= $module %>
- <% } %>
- </SELECT>
- </TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">Username: </TH>
- <TD><INPUT TYPE="text" NAME="gateway_username"></TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">Password: </TH>
- <TD><INPUT TYPE="text" NAME="gateway_password"></TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">Action: </TH>
- <TD>
- <SELECT NAME="gateway_action" SIZE=1>
- <OPTION VALUE="Normal Authorization">Normal Authorization
- <OPTION VALUE="Authorization Only">Authorization Only
- <OPTION VALUE="Authorization Only, Post Authorization">Authorization Only, Post Authorization
- </SELECT>
- </TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">Options: </TH>
- <TD><TEXTAREA ROWS="5" NAME="gateway_options"></TEXTAREA></TD>
-</TR>
-
-</TABLE>
-
-<BR><INPUT TYPE="submit" VALUE="<%= $payment_gateway->gatewaynum ? "Apply changes" : "Add gateway" %>">
- </FORM>
- </BODY>
-</HTML>
-
diff --git a/httemplate/edit/prepay_credit.cgi b/httemplate/edit/prepay_credit.cgi
deleted file mode 100644
index 9cf0fc6..0000000
--- a/httemplate/edit/prepay_credit.cgi
+++ /dev/null
@@ -1,56 +0,0 @@
-<%
-my $agent = '';
-my $agentnum = '';
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $agent = qsearchs('agent', { 'agentnum' => $agentnum=$1 } );
-}
-
-tie my %multiplier, 'Tie::IxHash',
- 1 => 'seconds',
- 60 => 'minutes',
- 3600 => 'hours',
-;
-
-$cgi->param('multiplier', '60') unless $cgi->param('multiplier');
-
-%>
-
-<%= header('Generate prepaid cards'. ($agent ? ' for '. $agent->agent : ''),
- menubar( 'Main Menu' => $p, ))
-%>
-
-<% if ( $cgi->param('error') ) { %>
- <FONT SIZE="+1" COLOR="#FF0000">Error: <%= $cgi->param('error') %></FONT>
-<% } %>
-
-<FORM ACTION="<%=popurl(1)%>process/prepay_credit.cgi" METHOD="POST" NAME="OneTrueForm" onSubmit="document.OneTrueForm.submit.disabled=true">
-
-Generate
-<INPUT TYPE="text" NAME="num" VALUE="<%= $cgi->param('num') || '(quantity)' %>" SIZE=10 MAXLENGTH=10 onFocus="if ( this.value == '(quantity)' ) { this.value = ''; }">
-<SELECT NAME="type">
-<% foreach (qw(alpha alphanumeric numeric)) { %>
- <OPTION<%= $cgi->param('type') eq $_ ? ' SELECTED' : '' %>><%= $_ %>
-<% } %>
-</SELECT>
- prepaid cards
-
-<BR>for <SELECT NAME="agentnum"><OPTION>(any agent)
-<% foreach my $opt_agent ( qsearch('agent', { 'disabled' => '' } ) ) { %>
- <OPTION VALUE="<%= $opt_agent->agentnum %>"<%= $opt_agent->agentnum == $agentnum ? ' SELECTED' : '' %>><%= $opt_agent->agent %>
-<% } %>
-</SELECT>
-
-<BR>Value:
-$<INPUT TYPE="text" NAME="amount" SIZE=8 MAXLENGTH=7 VALUE="<%= $cgi->param('amount') %>">
-and/or
-<INPUT TYPE="text" NAME="seconds" SIZE=6 MAXLENGTH=5 VALUE="<%= $cgi->param('seconds') %>">
-<SELECT NAME="multiplier">
-<% foreach my $multiplier ( keys %multiplier ) { %>
- <OPTION VALUE="<%= $multiplier %>"<%= $cgi->param('multiplier') eq $multiplier ? ' SELECTED' : '' %>><%= $multiplier{$multiplier} %>
-<% } %>
-</SELECT>
-<BR><BR>
-<INPUT TYPE="submit" NAME="submit" VALUE="Generate" onSubmit="this.disabled = true">
-
-</FORM></BODY></HTML>
-
diff --git a/httemplate/edit/process/agent_payment_gateway.html b/httemplate/edit/process/agent_payment_gateway.html
deleted file mode 100644
index c306bfa..0000000
--- a/httemplate/edit/process/agent_payment_gateway.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<%
-
-$cgi->param('agentnum') =~ /(\d+)$/ or die "illegal agentnum";
-my $agent = qsearchs('agent', { 'agentnum' => $1 } );
-die "agentnum $1 not found" unless $agent;
-
-#my $old
-
-my @new = map {
- my $cardtype = $_;
- new FS::agent_payment_gateway {
- ( map { $_ => scalar($cgi->param($_)) }
- fields('agent_payment_gateway')
- ),
- 'cardtype' => $cardtype,
- };
- }
- $cgi->param('cardtype');
-
-foreach my $new (@new) {
- my $error = $new->insert;
- die $error if $error;
-}
-
-%><%= $cgi->redirect(popurl(3). "browse/agent.cgi") %>
diff --git a/httemplate/edit/process/bulk-cust_svc.cgi b/httemplate/edit/process/bulk-cust_svc.cgi
deleted file mode 100644
index dd9d1db..0000000
--- a/httemplate/edit/process/bulk-cust_svc.cgi
+++ /dev/null
@@ -1,3 +0,0 @@
-<%
- my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process_bulk_cust_svc', $cgi;
-%><%= $server->process %>
diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi
index 28f892f..23e2e6c 100755
--- a/httemplate/edit/process/cust_credit_bill.cgi
+++ b/httemplate/edit/process/cust_credit_bill.cgi
@@ -14,12 +14,11 @@ my $custnum = $cust_main->custnum;
my $new;
if ($cgi->param('invnum') =~ /^Refund$/) {
$new = new FS::cust_refund ( {
- 'reason' => ( $cust_credit->reason || 'refund from credit' ),
+ 'reason' => $cust_credit->reason,
'refund' => $cgi->param('amount'),
'payby' => 'BILL',
#'_date' => $cgi->param('_date'),
- #'payinfo' => 'Cash',
- 'payinfo' => 'Refund',
+ 'payinfo' => 'Cash',
'crednum' => $crednum,
} );
} else {
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 09a4254..a1d3698 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -8,30 +8,23 @@ $cgi->param('tax','') unless defined $cgi->param('tax');
$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] );
-#my $payby = $cgi->param('payby');
-my $payby = $cgi->param('select'); # XXX key
-
-my %noauto = (
- 'CARD' => 'DCRD',
- 'CHEK' => 'DCHK',
-);
-$payby = $noauto{$payby}
- if ! $cgi->param('payauto') && exists $noauto{$payby};
-
-$cgi->param('payby', $payby);
-
+my $payby = $cgi->param('payby');
if ( $payby ) {
if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
$cgi->param('payinfo',
- $cgi->param('payinfo1'). '@'. $cgi->param('payinfo2') );
+ $cgi->param($payby. '_payinfo1'). '@'. $cgi->param($payby. '_payinfo2') );
+ } else {
+ $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) );
}
$cgi->param('paydate',
- $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) );
+ $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) );
+ $cgi->param('payname', $cgi->param( $payby. '_payname' ) );
+ $cgi->param('paycvv', $cgi->param( $payby. '_paycvv' ) )
+ if defined $cgi->param( $payby. '_paycvv' );
}
my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') );
push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST');
-push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX');
$cgi->param('invoicing_list', join(',', @invoicing_list) );
@@ -53,9 +46,6 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) {
);
}
-$new->setfield('paid', $cgi->param('paid') )
- if $cgi->param('paid');
-
#perhaps this stuff should go to cust_main.pm
my $cust_pkg = '';
my $svc_acct = '';
@@ -121,20 +111,7 @@ if ( $new->custnum eq '' ) {
tie my %hash, 'Tie::RefHash';
%hash = ( $cust_pkg => [ $svc_acct ] ) if $cust_pkg;
$error ||= $new->insert( \%hash, \@invoicing_list );
-
- my $conf = new FS::Conf;
- if ( $conf->exists('backend-realtime') && ! $error ) {
-
- my $berror = $new->bill;
- $new->apply_payments;
- $new->apply_credits;
- $berror ||= $new->collect;
- warn "Warning, error billing during backend-realtime: $berror" if $berror;
-
- }
-
} else { #create old record object
-
my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } );
$error ||= "Old record not found!" unless $old;
if ( defined dbdef->table('cust_main')->column('paycvv')
@@ -143,7 +120,6 @@ if ( $new->custnum eq '' ) {
$new->paycvv($old->paycvv);
}
$error ||= $new->replace($old, \@invoicing_list);
-
}
if ( $error ) {
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 0d0a134..2d6b344 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -19,28 +19,22 @@ foreach (qw( setuptax recurtax disabled )) {
my $new = new FS::part_pkg ( {
map {
- $_ => scalar($cgi->param($_));
+ $_, scalar($cgi->param($_));
} fields('part_pkg')
} );
-my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) }
+my %pkg_svc = map { $_ => $cgi->param("pkg_svc$_") }
map { $_->svcpart }
qsearch('part_svc', {} );
my $error;
my $custnum = '';
-if ( $cgi->param('taxclass') eq '(select)' ) {
-
- $error = 'Must select a tax class';
-
-} elsif ( $pkgpart ) {
-
+if ( $pkgpart ) {
$error = $new->replace( $old,
pkg_svc => \%pkg_svc,
primary_svc => scalar($cgi->param('pkg_svc_primary')),
);
} else {
-
$error = $new->insert( pkg_svc => \%pkg_svc,
primary_svc => scalar($cgi->param('pkg_svc_primary')),
cust_pkg => $cgi->param('pkgnum'),
@@ -48,7 +42,6 @@ if ( $cgi->param('taxclass') eq '(select)' ) {
);
$pkgpart = $new->pkgpart;
}
-
if ( $error ) {
$cgi->param('error', $error );
print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );
diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi
deleted file mode 100755
index b92b627..0000000
--- a/httemplate/edit/process/part_svc.cgi
+++ /dev/null
@@ -1,3 +0,0 @@
-<%
- my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process', $cgi;
-%><%= $server->process %>
diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html
deleted file mode 100644
index b9e4d47..0000000
--- a/httemplate/edit/process/payment_gateway.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<%
-
-my $gatewaynum = $cgi->param('gatewaynum');
-
-my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum;
-
-my $new = new FS::payment_gateway ( {
- map {
- $_, scalar($cgi->param($_));
- } fields('payment_gateway')
-} );
-
-my @options = split(/\r?\n/, $cgi->param('gateway_options') );
-pop @options
- if scalar(@options) % 2 && $options[-1] =~ /^\s*$/;
-my %options = @options;
-
-my $error;
-if ( $gatewaynum ) {
- $error=$new->replace($old);
-} else {
- $error=$new->insert(\%options);
- $gatewaynum=$new->getfield('gatewaynum');
-}
-
-if ( $error ) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string );
-} else {
- print $cgi->redirect(popurl(3). "browse/payment_gateway.html");
-}
-
-%>
diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi
deleted file mode 100644
index 25ecbe0..0000000
--- a/httemplate/edit/process/prepay_credit.cgi
+++ /dev/null
@@ -1,51 +0,0 @@
-<%
-my $hashref = {};
-
-my $agent = '';
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } );
-}
-
-my $error = '';
-
-my $num = 0;
-if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
- $num = $1;
-} else {
- $error = 'Illegal number of prepaid cards: '. $cgi->param('num');
-}
-
-$hashref->{amount} = $cgi->param('amount');
-$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');
-
-$error ||= FS::prepay_credit::generate( $num,
- scalar($cgi->param('type')),
- $hashref
- );
-
-unless ( ref($error) ) {
- $cgi->param('error', $error );
-%><%=
- $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
-%><% } else { %>
-
-<%= header( "$num prepaid cards generated".
- ( $agent ? ' for '.$agent->agent : '' ),
- menubar( 'Main menu' => popurl(3) )
- )
-%>
-
-<FONT SIZE="+1">
-<% foreach my $card ( @$error ) { %>
- <code><%= $card %></code>
- -
- <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
- <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
- <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
- <br>
-<% } %>
-
-</FONT>
-
-</BODY></HTML>
-<% } %>
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi
index 928e3da..477f585 100644
--- a/httemplate/edit/process/quick-charge.cgi
+++ b/httemplate/edit/process/quick-charge.cgi
@@ -9,24 +9,15 @@ $cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/
or die 'illegal amount '. $cgi->param('amount');
my $amount = $1;
-my( $error, $cust_main);
-if ( $cgi->param('taxclass') eq '(select)' ) {
-
-
- $error = 'Must select a tax class';
-} else {
-
- my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
- or die "unknown custnum $custnum";
-
- $error = $cust_main->charge(
- $amount,
- $cgi->param('pkg'),
- '$'. sprintf("%.2f",$amount),
- $cgi->param('taxclass')
- );
-
-}
+my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+ or die "unknown custnum $custnum";
+
+my $error = $cust_main->charge(
+ $amount,
+ $cgi->param('pkg'),
+ '$'. sprintf("%.2f",$amount),
+ $cgi->param('taxclass')
+);
if ($error) {
%>
diff --git a/httemplate/edit/process/rate.cgi b/httemplate/edit/process/rate.cgi
index 87c082d..04ff5f8 100755
--- a/httemplate/edit/process/rate.cgi
+++ b/httemplate/edit/process/rate.cgi
@@ -1,3 +1,37 @@
<%
- my $server = new FS::UI::Web::JSRPC 'FS::rate::process', $cgi;
-%><%= $server->process %>
+
+my $ratenum = $cgi->param('ratenum');
+
+my $old = qsearchs('rate', { 'ratenum' => $ratenum } ) if $ratenum;
+
+my @rate_detail = map {
+ my $regionnum = $_->regionnum;
+ new FS::rate_detail {
+ 'dest_regionnum' => $regionnum,
+ map { $_ => $cgi->param("$_$regionnum") }
+ qw( min_included min_charge sec_granularity )
+ };
+} qsearch('rate_region', {} );
+
+my $new = new FS::rate ( {
+ map {
+ $_, scalar($cgi->param($_));
+ } fields('rate')
+} );
+
+my $error;
+if ( $ratenum ) {
+ $error = $new->replace($old, 'rate_detail' => \@rate_detail );
+} else {
+ $error = $new->insert( 'rate_detail' => \@rate_detail );
+ $ratenum = $new->getfield('ratenum');
+}
+
+if ( $error ) {
+ $cgi->param('error', $error);
+ print $cgi->redirect(popurl(2). "rate.cgi?". $cgi->query_string );
+} else {
+ print $cgi->redirect(popurl(3). "browse/rate.cgi");
+}
+
+%>
diff --git a/httemplate/edit/process/reg_code.cgi b/httemplate/edit/process/reg_code.cgi
deleted file mode 100644
index 4658257..0000000
--- a/httemplate/edit/process/reg_code.cgi
+++ /dev/null
@@ -1,44 +0,0 @@
-<%
-
-$cgi->param('agentnum') =~ /^(\d+)$/
- or eidiot 'illegal agentnum '. $cgi->param('agentnum');
-my $agentnum = $1;
-my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
-
-my $error = '';
-
-my $num = 0;
-if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
- $num = $1;
-} else {
- $error = 'Illegal number of codes: '. $cgi->param('num');
-}
-
-my @pkgparts =
- map { /^pkgpart(.*)$/; $1 }
- grep { $cgi->param($_) }
- grep { /^pkgpart/ }
- $cgi->param;
-
-$error ||= $agent->generate_reg_codes($num, \@pkgparts);
-
-unless ( ref($error) ) {
- $cgi->param('error'. $error );
-%><%=
- $cgi->redirect(popurl(3). "edit/reg_code.cgi?". $cgi->query_string )
-%><% } else { %>
-
-<%= header("$num registration codes generated for ". $agent->agent, menubar(
- 'Main menu' => popurl(3),
- 'View all agents' => popurl(3). 'browse/agent.cgi',
-) ) %>
-
-<PRE><FONT SIZE="+1">
-<% foreach my $code ( @$error ) { %>
- <%= $code %>
-<% } %>
-
-</FONT></PRE>
-
-</BODY></HTML>
-<% } %>
diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi
index a009ba2..4912a3a 100644
--- a/httemplate/edit/process/svc_broadband.cgi
+++ b/httemplate/edit/process/svc_broadband.cgi
@@ -1,5 +1,11 @@
<%
+# If it's stupid but it works, it's not stupid.
+# -- U.S. Army
+
+local $FS::UID::AutoCommit = 0;
+my $dbh = FS::UID::dbh;
+
$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
my $svcnum = $1;
@@ -25,11 +31,14 @@ if ( $svcnum ) {
$svcnum = $new->svcnum;
}
+
if ( $error ) {
$cgi->param('error', $error);
$cgi->param('ip_addr', $new->ip_addr);
+ $dbh->rollback;
print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string );
} else {
+ $dbh->commit or die $dbh->errstr;
print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum );
}
diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi
index 1771f01..4fdc837 100644
--- a/httemplate/edit/rate.cgi
+++ b/httemplate/edit/rate.cgi
@@ -1,7 +1,12 @@
+<!-- mason kludge -->
<%
my $rate;
-if ( $cgi->keywords ) {
+if ( $cgi->param('error') ) {
+ $rate = new FS::rate ( {
+ map { $_, scalar($cgi->param($_)) } fields('rate')
+ } );
+} elsif ( $cgi->keywords ) {
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
$rate = qsearchs( 'rate', { 'ratenum' => $1 } );
@@ -17,12 +22,12 @@ my %granularity = (
'60' => 'minute',
);
-#my $nous = <<END;
-# WHERE 0 < ( SELECT COUNT(*) FROM rate_prefix
-# WHERE rate_region.regionnum = rate_prefix.regionnum
-# AND countrycode != '1'
-# )
-#END
+my $nous = <<END;
+ WHERE 0 < ( SELECT COUNT(*) FROM rate_prefix
+ WHERE rate_region.regionnum = rate_prefix.regionnum
+ AND countrycode != '1'
+ )
+END
%>
@@ -32,14 +37,12 @@ my %granularity = (
))
%>
-<%= include('/elements/progress-init.html',
- 'OneTrueForm',
- [ 'rate', 'min_', 'sec_' ],
- 'process/rate.cgi',
- $p.'browse/rate.cgi',
- )
-%>
-<FORM NAME="OneTrueForm">
+<% if ( $cgi->param('error') ) { %>
+<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT><BR>
+<% } %>
+
+<FORM ACTION="<%=$p1%>process/rate.cgi" METHOD=POST>
+
<INPUT TYPE="hidden" NAME="ratenum" VALUE="<%= $rate->ratenum %>">
Rate plan
@@ -56,27 +59,20 @@ Rate plan
</TR>
<% foreach my $rate_region (
- sort { lc($a->regionname) cmp lc($b->regionname) }
- qsearch({
- 'select' => 'DISTINCT ON ( regionnum ) rate_region.*',
- 'table' => 'rate_region',
- 'addl_from' => 'INNER JOIN rate_prefix USING ( regionnum )',
- 'hashref' => {},
- 'extra_sql' => "WHERE countrycode != '1'",
- # 'ORDER BY regionname'
- # ERROR: SELECT DISTINCT ON expressions must
- # match initial ORDER BY expressions
- })
+ qsearch( 'rate_region',
+ {},
+ '',
+ "$nous ORDER BY regionname",
+ )
) {
my $n = $rate_region->regionnum;
my $rate_detail =
$rate->dest_detail($rate_region)
- || new FS::rate_detail { 'min_included' => 0,
+ || new FS::rate_region { 'min_included' => 0,
'min_charge' => 0,
'sec_granularity' => '60'
};
%>
-
<TR>
<TD><A HREF="<%=$p%>edit/rate_region.cgi?<%= $rate_region->regionnum %>"><%= $rate_region->regionname %></A></TD>
<TD><%= $rate_region->prefixes_short %></TD>
@@ -89,7 +85,6 @@ Rate plan
<% } %>
</SELECT>
</TR>
-
<% } %>
<TR>
@@ -100,9 +95,9 @@ Rate plan
</TABLE>
-<BR><INPUT NAME="submit" TYPE="button" VALUE="<%=
+<BR><INPUT TYPE="submit" VALUE="<%=
$rate->ratenum ? "Apply changes" : "Add rate plan"
-%>" onClick="document.OneTrueForm.submit.disabled=true; process();">
+%>">
</FORM>
</BODY>
diff --git a/httemplate/edit/reg_code.cgi b/httemplate/edit/reg_code.cgi
deleted file mode 100644
index 899d1ec..0000000
--- a/httemplate/edit/reg_code.cgi
+++ /dev/null
@@ -1,36 +0,0 @@
-<%
-my $agentnum = $cgi->param('agentnum');
-$agentnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum";
-$agentnum = $1;
-my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
-
-%>
-
-<%= header('Generate registration codes for '. $agent->agent, menubar(
- 'Main Menu' => $p,
- ))
-%>
-
-<% if ( $cgi->param('error') ) { %>
- <FONT SIZE="+1" COLOR="#FF0000">Error: <%= $cgi->param('error') %></FONT>
-<% } %>
-
-<FORM ACTION="<%=popurl(1)%>process/reg_code.cgi" METHOD="POST" NAME="OneTrueForm" onSubmit="document.OneTrueForm.submit.disabled=true">
-<INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agent->agentnum %>">
-
-Generate
-<INPUT TYPE="text" NAME="num" VALUE="<%= $cgi->param('num') %>" SIZE=5 MAXLENGTH=4>
-registration codes for <B><%= $agent->agent %></B> allowing the following packages:
-<BR><BR>
-
-<% foreach my $part_pkg ( qsearch('part_pkg', { 'disabled' => '' } ) ) { %>
- <INPUT TYPE="checkbox" NAME="pkgpart<%= $part_pkg->pkgpart %>">
- <%= $part_pkg->pkg %> - <%= $part_pkg->comment %>
- <BR>
-<% } %>
-
-<BR>
-<INPUT TYPE="submit" NAME="submit" VALUE="Generate">
-
-</FORM></BODY></HTML>
-
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi
index e74d84d..f1b8b80 100755
--- a/httemplate/edit/svc_acct.cgi
+++ b/httemplate/edit/svc_acct.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
my $conf = new FS::Conf;
@@ -5,7 +6,6 @@ my @shells = $conf->config('shells');
my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct, @groups);
if ( $cgi->param('error') ) {
-
$svc_acct = new FS::svc_acct ( {
map { $_, scalar($cgi->param($_)) } fields('svc_acct')
} );
@@ -15,9 +15,7 @@ if ( $cgi->param('error') ) {
$part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } );
die "No part_svc entry for svcpart $svcpart!" unless $part_svc;
@groups = $cgi->param('radius_usergroup');
-
} else {
-
my($query) = $cgi->keywords;
if ( $query =~ /^(\d+)$/ ) { #editing
$svcnum=$1;
@@ -48,43 +46,35 @@ if ( $cgi->param('error') ) {
$svcnum='';
- }
-}
-
-my( $cust_pkg, $cust_main ) = ( '', '' );
-if ( $pkgnum ) {
- $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } );
- $cust_main = $cust_pkg->cust_main;
-}
-
-unless ( $svcnum || $cgi->param('error') ) { #adding
-
- #set gecos
- if ($cust_main) {
- unless ( $part_svc->part_svc_column('uid')->columnflag eq 'F' ) {
- $svc_acct->setfield('finger',
- $cust_main->getfield('first') . " " . $cust_main->getfield('last')
- );
+ #set gecos
+ my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
+ if ($cust_pkg) {
+ my($cust_main)=qsearchs('cust_main',{'custnum'=> $cust_pkg->custnum } );
+ unless ( $part_svc->part_svc_column('uid')->columnflag eq 'F' ) {
+ $svc_acct->setfield('finger',
+ $cust_main->getfield('first') . " " . $cust_main->getfield('last')
+ );
+ }
}
- }
- #set fixed and default fields from part_svc
- foreach my $part_svc_column (
- grep { $_->columnflag } $part_svc->all_part_svc_column
- ) {
- if ( $part_svc_column->columnname eq 'usergroup' ) {
- @groups = split(',', $part_svc_column->columnvalue);
- } else {
- $svc_acct->setfield( $part_svc_column->columnname,
- $part_svc_column->columnvalue,
- );
+ #set fixed and default fields from part_svc
+ foreach my $part_svc_column (
+ grep { $_->columnflag } $part_svc->all_part_svc_column
+ ) {
+ if ( $part_svc_column->columnname eq 'usergroup' ) {
+ @groups = split(',', $part_svc_column->columnvalue);
+ } else {
+ $svc_acct->setfield( $part_svc_column->columnname,
+ $part_svc_column->columnvalue,
+ );
+ }
}
- }
+ }
}
#fixed radius groups always override & display
-if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) {
+if ( $part_svc->part_svc_column('usergroup')->columnflag eq "F" ) {
@groups = split(',', $part_svc->part_svc_column('usergroup')->columnvalue);
}
@@ -106,91 +96,55 @@ if ( $svc_acct->_password ) {
$password = '';
}
-my $ulen =
- $conf->exists('usernamemax')
- ? $conf->config('usernamemax')
- : dbdef->table('svc_acct')->column('username')->length;
+my $ulen = $conf->config('usernamemax')
+ || $svc_acct->dbdef_table->column('username')->length;
my $ulen2 = $ulen+2;
my $pmax = $conf->config('passwordmax') || 8;
my $pmax2 = $pmax+2;
my $p1 = popurl(1);
-
-%>
-
-<%= header("$action $svc account") %>
-
-<% if ( $cgi->param('error') ) { %>
- <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
- <BR><BR>
-<% } %>
-
-<% if ( $cust_main ) { %>
- <%= include( '/elements/small_custview.html', $cust_main, '', 1 ) %>
- <BR>
-<% } %>
-
-<FORM NAME="OneTrueForm" ACTION="<%= $p1 %>process/svc_acct.cgi" METHOD=POST>
-<INPUT TYPE="hidden" NAME="svcnum" VALUE="<%= $svcnum %>">
-<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>">
-<INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $svcpart %>">
-
-Service # <%= $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
-
-<%= ntable("#cccccc",2) %>
-
-<TR>
- <TD ALIGN="right">Service</TD>
- <TD BGCOLOR="#eeeeee"><%= $part_svc->svc %></TD>
-</TR>
-
-<TR>
- <TD ALIGN="right">Username</TD>
- <TD>
- <INPUT TYPE="text" NAME="username" VALUE="<%= $username %>" SIZE=<%= $ulen2 %> MAXLENGTH=<%= $ulen %>>
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right">Password</TD>
- <TD>
- <INPUT TYPE="text" NAME="_password" VALUE="<%= $password %>" SIZE=<%= $pmax2 %> MAXLENGTH=<%= $pmax %>>
- (blank to generate)
- </TD>
+print header("$action $svc account");
+
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+ "</FONT><BR><BR>"
+ if $cgi->param('error');
+
+print 'Service # '. ( $svcnum ? "<B>$svcnum</B>" : " (NEW)" ). '<BR>'.
+ 'Service: <B>'. $part_svc->svc. '</B><BR><BR>'.
+ <<END;
+ <FORM NAME="OneTrueForm" ACTION="${p1}process/svc_acct.cgi" METHOD=POST>
+ <INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">
+ <INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
+ <INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">
+END
+
+print &ntable("#cccccc",2), <<END;
+<TR><TD ALIGN="right">Username</TD>
+<TD><INPUT TYPE="text" NAME="username" VALUE="$username" SIZE=$ulen2 MAXLENGTH=$ulen></TD></TR>
+<TR><TD ALIGN="right">Password</TD>
+<TD><INPUT TYPE="text" NAME="_password" VALUE="$password" SIZE=$pmax2 MAXLENGTH=$pmax>
+(blank to generate)</TD>
</TR>
+END
-
-<%
my $sec_phrase = $svc_acct->sec_phrase;
if ( $conf->exists('security_phrase') ) {
-%>
-
- <TR>
- <TD ALIGN="right">Security phrase</TD>
- <TD>
- <INPUT TYPE="text" NAME="sec_phrase" VALUE="<%= $sec_phrase %>" SIZE=32>
- (for forgotten passwords)
- </TD>
+ print <<END;
+ <TR><TD ALIGN="right">Security phrase</TD>
+ <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase" SIZE=32>
+ (for forgotten passwords)</TD>
</TD>
+END
+} else {
+ print qq!<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="$sec_phrase">!;
+}
-<% } else { %>
-
- <INPUT TYPE="hidden" NAME="sec_phrase" VALUE="<%= $sec_phrase %>">
-
-<% } %>
-
-
-<%
#domain
my $domsvc = $svc_acct->domsvc || 0;
if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) {
-%>
-
- <INPUT TYPE="hidden" NAME="domsvc" VALUE="<%= $domsvc %>">
-
-<% } else {
-
+ print qq!<INPUT TYPE="hidden" NAME="domsvc" VALUE="$domsvc">!;
+} else {
my %svc_domain = ();
if ( $domsvc ) {
@@ -214,6 +168,7 @@ if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) {
}
}
+ my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } );
if ($cust_pkg && !$conf->exists('svc_acct-alldomains') ) {
my @cust_svc =
map { qsearch('cust_svc', { 'pkgnum' => $_->pkgnum } ) }
@@ -226,221 +181,121 @@ if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) {
} else {
%svc_domain = map { $_->svcnum => $_ } qsearch('svc_domain', {} );
}
+ print qq!<TR><TD ALIGN="right">Domain</TD>!.
+ qq!<TD><SELECT NAME="domsvc" SIZE=1>\n!;
+ foreach my $svcnum (
+ sort { $svc_domain{$a}->domain cmp $svc_domain{$b}->domain }
+ keys %svc_domain
+ ) {
+ my $svc_domain = $svc_domain{$svcnum};
+ print qq!<OPTION VALUE="!. $svc_domain->svcnum. qq!"!.
+ ( $svc_domain->svcnum == $domsvc ? ' SELECTED' : '' ).
+ '>'. $svc_domain->domain. "\n" ;
+ }
+ print "</SELECT></TD></TR>";
+}
-%>
-
- <TR>
- <TD ALIGN="right">Domain</TD>
- <TD>
- <SELECT NAME="domsvc" SIZE=1>
-
- <% foreach my $svcnum (
- sort { $svc_domain{$a}->domain cmp $svc_domain{$b}->domain }
- keys %svc_domain
- ) {
- my $svc_domain = $svc_domain{$svcnum};
- %>
-
- <OPTION VALUE="<%= $svc_domain->svcnum %>" <%= $svc_domain->svcnum == $domsvc ? ' SELECTED' : '' %>><%= $svc_domain->domain %>
-
- <% } %>
- </SELECT>
- </TD>
- </TR>
-
-<% } %>
-
-
-<%
#pop
my $popnum = $svc_acct->popnum || 0;
-if ( $part_svc->part_svc_column('popnum')->columnflag eq 'F' ) {
-%>
-
- <INPUT TYPE="hidden" NAME="popnum" VALUE="<%= $popnum %>">
-
-
-<% } else { %>
-
- <TR>
- <TD ALIGN="right">Access number</TD>
- <TD><%= FS::svc_acct_pop::popselector($popnum) %></TD>
- </TR>
-
-<% } %>
-
-
-<% #uid/gid %>
-<% foreach my $xid (qw( uid gid )) { %>
-
- <%
- if ( $part_svc->part_svc_column($xid)->columnflag eq 'F'
- || ! $conf->exists("svc_acct-edit_$xid")
- ) {
- %>
-
- <% if ( length($svc_acct->$xid()) ) { %>
-
- <TR>
- <TD ALIGN="right"><%= uc($xid) %></TD>
- <TD BGCOLOR="#eeeeee"><%= $svc_acct->$xid() %></TD>
- <TD>
- </TD>
- </TR>
-
- <% } %>
-
- <INPUT TYPE="hidden" NAME="<%= $xid %>" VALUE="<%= $svc_acct->$xid() %>">
-
- <% } else { %>
-
- <TR>
- <TD ALIGN="right"><%= uc($xid) %></TD>
- <TD>
- <INPUT TYPE="text" NAME="<%= $xid %>" SIZE=8 MAXLENGTH=6 VALUE="<%= $svc_acct->$xid() %>">
- </TD>
- </TR>
-
- <% } %>
-
-<% } %>
-
-
-<%
-#finger
-if ( $part_svc->part_svc_column('uid')->columnflag eq 'F'
- && ! $svc_acct->finger ) {
-%>
-
- <INPUT TYPE="hidden" NAME="finger" VALUE="">
-
-<% } else { %>
-
- <TR>
- <TD ALIGN="right">GECOS</TD>
- <TD>
- <INPUT TYPE="text" NAME="finger" VALUE="<%= $svc_acct->finger %>">
- </TD>
- </TR>
-
-<% } %>
+if ( $part_svc->part_svc_column('popnum')->columnflag eq "F" ) {
+ print qq!<INPUT TYPE="hidden" NAME="popnum" VALUE="$popnum">!;
+} else {
+ print qq!<TR><TD ALIGN="right">Access number</TD>!.
+ qq!<TD>!. FS::svc_acct_pop::popselector($popnum). '</TD></TR>';
+}
+my($uid,$gid,$finger,$dir)=(
+ $svc_acct->uid,
+ $svc_acct->gid,
+ $svc_acct->finger,
+ $svc_acct->dir,
+);
-<INPUT TYPE="hidden" NAME="dir" VALUE="<%= $svc_acct->dir %>">
+print <<END;
+<INPUT TYPE="hidden" NAME="uid" VALUE="$uid">
+<INPUT TYPE="hidden" NAME="gid" VALUE="$gid">
+END
+if ( !$finger && $part_svc->part_svc_column('uid')->columnflag eq 'F' ) {
+ print '<INPUT TYPE="hidden" NAME="finger" VALUE="">';
+} else {
+ print '<TR><TD ALIGN="right">GECOS</TD>'.
+ qq!<TD><INPUT TYPE="text" NAME="finger" VALUE="$finger"></TD></TR>!;
+}
+print qq!<INPUT TYPE="hidden" NAME="dir" VALUE="$dir">!;
-<%
-#shell
my $shell = $svc_acct->shell;
-if ( $part_svc->part_svc_column('shell')->columnflag eq 'F'
+if ( $part_svc->part_svc_column('shell')->columnflag eq "F"
|| ( !$shell && $part_svc->part_svc_column('uid')->columnflag eq 'F' )
) {
-%>
-
- <INPUT TYPE="hidden" NAME="shell" VALUE="<%= $shell %>">
-
-<% } else { %>
-
- <TR>
- <TD ALIGN="right">Shell</TD>
- <TD>
- <SELECT NAME="shell" SIZE=1>
-
- <%
- my($etc_shell);
- foreach $etc_shell (@shells) {
- %>
-
- <OPTION<%= $etc_shell eq $shell ? ' SELECTED' : '' %>><%= $etc_shell %>
-
- <% } %>
-
- </SELECT>
- </TD>
- </TR>
-
-<% } %>
-
-
-<% if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) { %>
-
- <INPUT TYPE="hidden" NAME="quota" VALUE="<%= $svc_acct->quota %>">
-
-<% } else { %>
-
- <TR>
- <TD ALIGN="right">Quota:</TD>
- <TD><INPUT TYPE="text" NAME="quota" VALUE="<%= $svc_acct->quota %>"></TD>
- </TR>
-
-<% } %>
-
-
-<% if ( $part_svc->part_svc_column('slipip')->columnflag eq 'F' ) { %>
-
- <INPUT TYPE="hidden" NAME="slipip" VALUE="<%= $svc_acct->slipip %>">
-
-<% } else { %>
+ print qq!<INPUT TYPE="hidden" NAME="shell" VALUE="$shell">!;
+} else {
+ print qq!<TR><TD ALIGN="right">Shell</TD><TD><SELECT NAME="shell" SIZE=1>!;
+ my($etc_shell);
+ foreach $etc_shell (@shells) {
+ print "<OPTION", $etc_shell eq $shell ? ' SELECTED' : '', ">",
+ $etc_shell, "\n";
+ }
+ print "</SELECT></TD></TR>";
+}
- <TR>
- <TD ALIGN="right">IP</TD>
- <TD><INPUT TYPE="text" NAME="slipip" VALUE="<%= $svc_acct->slipip %>"></TD>
- </TR>
+my($quota,$slipip)=(
+ $svc_acct->quota,
+ $svc_acct->slipip,
+);
-<% } %>
+if ( $part_svc->part_svc_column('quota')->columnflag eq "F" )
+{
+ print qq!<INPUT TYPE="hidden" NAME="quota" VALUE="$quota">!;
+} else {
+ print <<END;
+ <TR><TD ALIGN="right">Quota:</TD>
+ <TD> <INPUT TYPE="text" NAME="quota" VALUE="$quota" ></TD>
+ </TR>
+END
+}
+if ( $part_svc->part_svc_column('slipip')->columnflag eq "F" ) {
+ print qq!<INPUT TYPE="hidden" NAME="slipip" VALUE="$slipip">!;
+} else {
+ print qq!<TR><TD ALIGN="right">IP</TD><TD><INPUT TYPE="text" NAME="slipip" VALUE="$slipip"></TD></TR>!;
+}
-<%
foreach my $r ( grep { /^r(adius|[cr])_/ } fields('svc_acct') ) {
$r =~ /^^r(adius|[cr])_(.+)$/ or next; #?
my $a = $2;
-%>
-
- <% if ( $part_svc->part_svc_column($r)->columnflag eq 'F' ) { %>
-
- <INPUT TYPE="hidden" NAME="<%= $r %>" VALUE="<%= $svc_acct->getfield($r) %>">
-
- <% } else { %>
-
- <TR>
- <TD ALIGN="right"><%= $FS::raddb::attrib{$a} %></TD>
- <TD><INPUT TYPE="text" NAME="<%= $r %>" VALUE="<%= $svc_acct->getfield($r) %>"></TD>
- </TR>
-
- <% } %>
-
-<% } %>
-
-
-<TR>
- <TD ALIGN="right">RADIUS groups</TD>
-
- <% if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) { %>
-
- <TD BGCOLOR="#eeeeee"><%= join('<BR>', @groups) %></TD>
-
- <% } else { %>
-
- <TD><%= FS::svc_acct::radius_usergroup_selector( \@groups ) %></TD>
-
- <% } %>
-
-</TR>
-
-<% foreach my $field ($svc_acct->virtual_fields) { %>
-
- <% # If the flag is X, it won't even show up in $svc_acct->virtual_fields. %>
- <% if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { %>
-
- <%= $svc_acct->pvf($field)->widget('HTML', 'edit', $svc_acct->getfield($field)) %>
+ if ( $part_svc->part_svc_column($r)->columnflag eq 'F' ) {
+ print qq!<INPUT TYPE="hidden" NAME="$r" VALUE="!.
+ $svc_acct->getfield($r). '">';
+ } else {
+ print qq!<TR><TD ALIGN="right">$FS::raddb::attrib{$a}</TD><TD><INPUT TYPE="text" NAME="$r" VALUE="!.
+ $svc_acct->getfield($r). '"></TD></TR>';
+ }
+}
- <% } %>
+print '<TR><TD ALIGN="right">RADIUS groups</TD>';
+if ( $part_svc->part_svc_column('usergroup')->columnflag eq "F" ) {
+ print '<TD BGCOLOR="#ffffff">'. join('<BR>', @groups);
+} else {
+ print '<TD>'. &FS::svc_acct::radius_usergroup_selector( \@groups );
+}
+print '</TD></TR>';
-<% } %>
+foreach my $field ($svc_acct->virtual_fields) {
+ if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) {
+ # If the flag is X, it won't even show up in $svc_acct->virtual_fields.
+ print $svc_acct->pvf($field)->widget('HTML', 'edit',
+ $svc_acct->getfield($field));
+ }
+}
-</TABLE>
-<BR>
+#submit
+print qq!</TABLE><BR><INPUT TYPE="submit" VALUE="Submit">!;
-<INPUT TYPE="submit" VALUE="Submit">
+print <<END;
+ </FORM>
+ </BODY>
+</HTML>
+END
-</FORM></BODY></HTML>
+%>
diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi
index 3cb7528..02fa64c 100644
--- a/httemplate/edit/svc_www.cgi
+++ b/httemplate/edit/svc_www.cgi
@@ -196,7 +196,6 @@ foreach $_ (keys %arec) {
print "</SELECT></TD></TR>";
print '<TR><TD ALIGN="right">Username</TD><TD><SELECT NAME="usersvc" SIZE=1>';
-print '<OPTION VALUE="">(none)';
foreach $_ (keys %svc_acct) {
print "<OPTION", ($_ eq $usersvc) ? " SELECTED" : "",
qq! VALUE="$_">$svc_acct{$_}!;