summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/autohandler2
-rwxr-xr-xhttemplate/browse/agent.cgi178
-rwxr-xr-xhttemplate/browse/part_pkg.cgi6
-rwxr-xr-xhttemplate/browse/part_svc.cgi70
-rw-r--r--httemplate/browse/payment_gateway.html70
-rwxr-xr-xhttemplate/browse/queue.cgi10
-rw-r--r--httemplate/config/config-view.cgi26
-rw-r--r--httemplate/config/config.cgi15
-rw-r--r--httemplate/docs/ach.html4
-rwxr-xr-xhttemplate/docs/admin.html3
-rw-r--r--httemplate/docs/billing.html11
-rw-r--r--httemplate/docs/cvv2.html1
-rw-r--r--httemplate/docs/index.html3
-rw-r--r--httemplate/docs/install-rt.html78
-rw-r--r--httemplate/docs/install.html135
-rw-r--r--httemplate/docs/schema.diabin16364 -> 14438 bytes
-rw-r--r--httemplate/docs/schema.html39
-rw-r--r--httemplate/docs/selfservice.html38
-rw-r--r--httemplate/docs/upgrade10.html307
-rw-r--r--httemplate/docs/upgrade8.html4
-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
-rw-r--r--httemplate/elements/jsrsClient.js356
-rw-r--r--httemplate/elements/jsrsServer.html3
-rw-r--r--httemplate/elements/overlibmws.js709
-rw-r--r--httemplate/elements/overlibmws_draggable.js78
-rw-r--r--httemplate/elements/overlibmws_iframe.js93
-rw-r--r--httemplate/elements/progress-init.html81
-rw-r--r--httemplate/elements/progress-popup.html96
-rw-r--r--httemplate/elements/qlib/box.js29
-rw-r--r--httemplate/elements/qlib/boxctrl.js48
-rw-r--r--httemplate/elements/qlib/boxres.js42
-rw-r--r--httemplate/elements/qlib/button.js74
-rw-r--r--httemplate/elements/qlib/buttonres.js23
-rw-r--r--httemplate/elements/qlib/control.js51
-rw-r--r--httemplate/elements/qlib/counter.js81
-rw-r--r--httemplate/elements/qlib/imagelist.js25
-rw-r--r--httemplate/elements/qlib/label.js72
-rw-r--r--httemplate/elements/qlib/messagebox.js57
-rw-r--r--httemplate/elements/qlib/progress.js73
-rw-r--r--httemplate/elements/qlib/sound.js47
-rw-r--r--httemplate/elements/qlib/sprite.js125
-rw-r--r--httemplate/elements/qlib/window.js25
-rw-r--r--httemplate/elements/qlib/wndctrl.js322
-rw-r--r--httemplate/elements/select-agent.html24
-rw-r--r--httemplate/elements/select-month_year.html50
-rw-r--r--httemplate/elements/select-taxclass.html42
-rw-r--r--httemplate/elements/small_custview.html2
-rw-r--r--httemplate/elements/table-grid.html8
-rw-r--r--httemplate/elements/tr-input-beginning_ending.html39
-rw-r--r--httemplate/elements/tr-select-agent.html29
-rw-r--r--httemplate/elements/xmlhttp.html109
-rw-r--r--httemplate/images/cvv2.pngbin7791 -> 3854 bytes
-rw-r--r--httemplate/images/cvv2_amex.pngbin9539 -> 4573 bytes
-rw-r--r--httemplate/images/progressbar-empty.pngbin90 -> 0 bytes
-rw-r--r--httemplate/images/progressbar-full.pngbin79 -> 0 bytes
-rw-r--r--httemplate/index.html105
-rw-r--r--httemplate/misc/batch-cust_pay.html396
-rw-r--r--httemplate/misc/counties.cgi17
-rwxr-xr-xhttemplate/misc/cust_main-cancel.cgi16
-rwxr-xr-xhttemplate/misc/email-invoice.cgi16
-rw-r--r--httemplate/misc/email_invoice_events.cgi6
-rw-r--r--httemplate/misc/email_invoices.cgi6
-rwxr-xr-xhttemplate/misc/fax-invoice.cgi17
-rw-r--r--httemplate/misc/fax_invoice_events.cgi6
-rw-r--r--httemplate/misc/fax_invoices.cgi6
-rw-r--r--httemplate/misc/payment.cgi4
-rwxr-xr-xhttemplate/misc/print-invoice.cgi20
-rw-r--r--httemplate/misc/print_invoice_events.cgi6
-rw-r--r--httemplate/misc/print_invoices.cgi6
-rw-r--r--httemplate/misc/process/batch-cust_pay.cgi42
-rwxr-xr-xhttemplate/misc/process/link.cgi23
-rw-r--r--httemplate/misc/states.cgi16
-rwxr-xr-xhttemplate/misc/unvoid-cust_pay_void.cgi16
-rw-r--r--httemplate/misc/xmlhttp-cust_main-search.cgi21
-rw-r--r--httemplate/misc/xmlrpc.cgi17
-rwxr-xr-xhttemplate/search/cust_bill.html206
-rw-r--r--httemplate/search/cust_bill_event.cgi183
-rwxr-xr-xhttemplate/search/cust_bill_event.html68
-rw-r--r--httemplate/search/cust_bill_pkg.cgi148
-rwxr-xr-xhttemplate/search/cust_credit.html95
-rwxr-xr-xhttemplate/search/cust_main-otaker.cgi2
-rwxr-xr-xhttemplate/search/cust_main-payinfo.html2
-rwxr-xr-xhttemplate/search/cust_main-quickpay.html2
-rwxr-xr-xhttemplate/search/cust_main.cgi22
-rwxr-xr-xhttemplate/search/cust_main.html2
-rwxr-xr-xhttemplate/search/cust_pay.cgi259
-rwxr-xr-xhttemplate/search/cust_pay.html2
-rwxr-xr-xhttemplate/search/cust_pkg.cgi517
-rwxr-xr-xhttemplate/search/cust_pkg_report.cgi52
-rw-r--r--httemplate/search/elements/search.html439
-rw-r--r--httemplate/search/prepay_credit.html43
-rw-r--r--httemplate/search/reg_code.html36
-rw-r--r--httemplate/search/report_cust_bill.html28
-rw-r--r--httemplate/search/report_cust_credit.html36
-rw-r--r--httemplate/search/report_cust_pay.html43
-rw-r--r--httemplate/search/report_prepaid_income.html2
-rwxr-xr-xhttemplate/search/report_receivables.cgi204
-rwxr-xr-xhttemplate/search/report_tax.cgi305
-rwxr-xr-xhttemplate/search/report_tax.html38
-rw-r--r--httemplate/search/sqlradius.html2
-rwxr-xr-xhttemplate/search/svc_acct.cgi336
-rwxr-xr-xhttemplate/search/svc_acct.html2
-rwxr-xr-xhttemplate/search/svc_domain.cgi210
-rwxr-xr-xhttemplate/search/svc_domain.html2
-rwxr-xr-xhttemplate/search/svc_forward.cgi159
-rwxr-xr-xhttemplate/search/svc_www.cgi61
-rwxr-xr-xhttemplate/view/cust_bill-logo.cgi15
-rwxr-xr-xhttemplate/view/cust_bill-pdf.cgi3
-rwxr-xr-xhttemplate/view/cust_bill-ps.cgi3
-rwxr-xr-xhttemplate/view/cust_bill.cgi179
-rwxr-xr-xhttemplate/view/cust_main.cgi50
-rw-r--r--httemplate/view/cust_main/billing.html93
-rwxr-xr-xhttemplate/view/cust_main/packages.html338
-rw-r--r--httemplate/view/cust_main/payment_history.html89
-rw-r--r--httemplate/view/cust_main/quick-charge.html28
-rw-r--r--httemplate/view/cust_main/tickets.html2
-rwxr-xr-xhttemplate/view/cust_pkg.cgi5
-rwxr-xr-xhttemplate/view/svc_acct.cgi310
-rwxr-xr-xhttemplate/view/svc_domain.cgi12
-rw-r--r--httemplate/view/svc_www.cgi20
153 files changed, 3160 insertions, 9144 deletions
diff --git a/httemplate/autohandler b/httemplate/autohandler
index a3f7eb008..2bd3adffd 100644
--- a/httemplate/autohandler
+++ b/httemplate/autohandler
@@ -9,7 +9,7 @@ if ( UNIVERSAL::can(dbh, 'sprintProfile') ) {
if ( lc($r->content_type) eq 'text/html' ) {
- $profile = '<PRE>'. encode_entities(dbh->sprintProfile()).
+ $profile = '<PRE>'. ("\n"x4096). encode_entities(dbh->sprintProfile()).
#"\n\n". &sprintAutoProfile(). '</PRE>';
"\n\n". '</PRE>';
}
diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi
index 05300d0bd..f38934297 100755
--- a/httemplate/browse/agent.cgi
+++ b/httemplate/browse/agent.cgi
@@ -1,3 +1,5 @@
+<!-- mason kludge -->
+
<%
my %search;
@@ -8,9 +10,8 @@
%search = ( 'disabled' => '' );
}
- my $conf = new FS::Conf;
-
%>
+
<%= header('Agent Listing', menubar(
'Main Menu' => $p,
'Agent Types' => $p. 'browse/agent_type.cgi',
@@ -34,14 +35,6 @@ full offerings (via their type).<BR><BR>
<TH COLSPAN=<%= ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH>
<TH>Type</TH>
<TH>Customers</TH>
- <TH><FONT SIZE=-1>Customer<BR>packages</FONT></TH>
- <TH>Reports</TH>
- <TH>Registration codes</TH>
- <TH>Prepaid cards</TH>
- <% if ( $conf->config('ticket_system') ) { %>
- <TH>Ticketing</TH>
- <% } %>
- <TH><FONT SIZE=-1>Payment Gateway Overrides</FONT></TH>
<TH><FONT SIZE=-1>Freq.</FONT></TH>
<TH><FONT SIZE=-1>Prog.</FONT></TH>
</TR>
@@ -57,8 +50,6 @@ foreach my $agent ( sort {
my $cust_main_link = $p. 'search/cust_main.cgi?agentnum_on=1&'.
'agentnum='. $agent->agentnum;
- my $cust_pkg_link = $p. 'search/cust_pkg.cgi?agentnum='. $agent->agentnum;
-
%>
<TR>
@@ -72,151 +63,34 @@ foreach my $agent ( sort {
<TD><A HREF="<%=$p%>edit/agent.cgi?<%= $agent->agentnum %>">
<%= $agent->agent %></A></TD>
<TD><A HREF="<%=$p%>edit/agent_type.cgi?<%= $agent->typenum %>"><%= $agent->agent_type->atype %></A></TD>
-
<TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <%= my $num_prospect = $agent->num_prospect_cust_main %>&nbsp;
- </TH>
- <TD>
- <% if ( $num_prospect ) { %>
- <A HREF="<%= $cust_main_link %>&prospect=1"><% } %>prospects<% if ($num_prospect ) { %></A><% } %>
- <TD>
- </TR>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#00CC00">
- <%= my $num_active = $agent->num_active_cust_main %>&nbsp;
- </FONT>
- </TH>
- <TD>
- <% if ( $num_active ) { %>
- <A HREF="<%= $cust_main_link %>&active=1"><% } %>active<% if ( $num_active ) { %></A><% } %>
- </TD>
- </TR>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF9900">
- <%= my $num_susp = $agent->num_susp_cust_main %>&nbsp;
- </FONT>
- </TH>
- <TD>
- <% if ( $num_susp ) { %>
- <A HREF="<%= $cust_main_link %>&suspended=1"><% } %>suspended<% if ( $num_susp ) { %></A><% } %>
- </TD>
- </TR>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF0000">
- <%= my $num_cancel = $agent->num_cancel_cust_main %>&nbsp;
- </FONT>
- </TH>
- <TD>
- <% if ( $num_cancel ) { %>
- <A HREF="<%= $cust_main_link %>&showcancelledcustomers=1&cancelled=1"><% } %>cancelled<% if ( $num_cancel ) { %></A><% } %>
- </TD>
- </TR>
- </TABLE>
- </TD>
- <TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#00CC00">
- <%= my $num_active_pkg = $agent->num_active_cust_pkg %>&nbsp;
- </FONT>
- </TH>
- <TD>
- <% if ( $num_active_pkg ) { %>
- <A HREF="<%= $cust_pkg_link %>&magic=active"><% } %>active<% if ( $num_active_pkg ) { %></A><% } %>
- </TD>
- </TR>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF9900">
- <%= my $num_susp_pkg = $agent->num_susp_cust_pkg %>&nbsp;
- </FONT>
- </TH>
- <TD>
- <% if ( $num_susp_pkg ) { %>
- <A HREF="<%= $cust_pkg_link %>&magic=suspended"><% } %>suspended<% if ( $num_susp_pkg ) { %></A><% } %>
- </TD>
- </TR>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF0000">
- <%= my $num_cancel_pkg = $agent->num_cancel_cust_pkg %>&nbsp;
- </FONT>
- </TH>
- <TD>
- <% if ( $num_cancel_pkg ) { %>
- <A HREF="<%= $cust_pkg_link %>&magic=cancelled"><% } %>cancelled<% if ( $num_cancel_pkg ) { %></A><% } %>
- </TD>
- </TR>
- </TABLE>
+ <B>
+ <%= my $num_prospect = $agent->num_prospect_cust_main %>
+ </B>
+ <% if ( $num_prospect ) { %>
+ <A HREF="<%= $cust_main_link %>&prospect=1"><% } %>prospects<% if ($num_prospect ) { %></A><% } %>
+
+ <BR><FONT COLOR="#00CC00"><B>
+ <%= my $num_active = $agent->num_active_cust_main %>
+ </B></FONT>
+ <% if ( $num_active ) { %>
+ <A HREF="<%= $cust_main_link %>&active=1"><% } %>active<% if ( $num_active ) { %></A><% } %>
+
+ <BR><FONT COLOR="#FF9900"><B>
+ <%= my $num_susp = $agent->num_susp_cust_main %>
+ </B></FONT>
+ <% if ( $num_susp ) { %>
+ <A HREF="<%= $cust_main_link %>&suspended=1"><% } %>suspended<% if ( $num_susp ) { %></A><% } %>
+
+ <BR><FONT COLOR="#FF0000"><B>
+ <%= my $num_cancel = $agent->num_cancel_cust_main %>
+ </B></FONT>
+ <% if ( $num_cancel ) { %>
+ <A HREF="<%= $cust_main_link %>&showcancelledcustomers=1&cancelled=1"><% } %>cancelled<% if ( $num_cancel ) { %></A><% } %>
</TD>
-
- <TD>
- <A HREF="<%= $p %>search/report_cust_pay.html?agentnum=<%= $agent->agentnum %>">Payments</A>
- <BR><A HREF="<%= $p %>search/report_cust_credit.html?agentnum=<%= $agent->agentnum %>">Credits</A>
- <BR><A HREF="<%= $p %>search/report_receivables.cgi?agentnum=<%= $agent->agentnum %>">A/R Aging</A>
- <!--<BR><A HREF="<%= $p %>search/money_time.cgi?agentnum=<%= $agent->agentnum %>">Sales/Credits/Receipts</A>-->
-
- </TD>
-
- <TD>
- <%= my $num_reg_code = $agent->num_reg_code %>
- <% if ( $num_reg_code ) { %>
- <A HREF="<%=$p%>search/reg_code.html?agentnum=<%= $agent->agentnum %>"><% } %>Unused<% if ( $num_reg_code ) { %></A><% } %>
- <BR><A HREF="<%=$p%>edit/reg_code.cgi?agentnum=<%= $agent->agentnum %>">Generate codes</A>
- </TD>
-
- <TD>
- <%= my $num_prepay_credit = $agent->num_prepay_credit %>
- <% if ( $num_prepay_credit ) { %>
- <A HREF="<%=$p%>search/prepay_credit.html?agentnum=<%= $agent->agentnum %>"><% } %>Unused<% if ( $num_prepay_credit ) { %></A><% } %>
- <BR><A HREF="<%=$p%>edit/prepay_credit.cgi?agentnum=<%= $agent->agentnum %>">Generate cards</A>
- </TD>
-
- <% if ( $conf->config('ticket_system') ) { %>
-
- <TD>
- <% if ( $agent->ticketing_queueid ) { %>
- Queue: <%= $agent->ticketing_queueid %>: <%= $agent->ticketing_queue %><BR>
- <% } %>
- </TD>
-
- <% } %>
-
- <TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
- <% foreach my $override (
- # sort { } want taxclass-full stuff first? and default cards (empty cardtype)
- qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } )
- ) {
- %>
- <TR>
- <TD>
- <%= $override->cardtype || 'Default' %> to <%= $override->payment_gateway->gateway_module %> (<%= $override->payment_gateway->gateway_username %>)
- <%= $override->taxclass
- ? ' for '. $override->taxclass. ' only'
- : ''
- %>
- <FONT SIZE=-1><A HREF="<%=$p%>misc/delete-agent_payment_gateway.cgi?<%= 'XXXoverridenum' %>">(delete)</A></FONT>
- </TD>
- </TR>
- <% } %>
- <TR>
- <TD><FONT SIZE=-1><A HREF="<%=$p%>edit/agent_payment_gateway.html?agentnum=<%= $agent->agentnum %>">(add override)</A></FONT></TD>
- </TR>
- </TABLE>
- </TD>
-
<TD><%= $agent->freq %></TD>
<TD><%= $agent->prog %></TD>
-
</TR>
<% } %>
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index 8d5b55451..48b0ab2b3 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -89,7 +89,8 @@ my $taxclasses = $conf->exists('enable_taxclasses');
<%
foreach my $part_pkg ( sort $sortby @part_pkg ) {
- my @pkg_svc = $part_pkg->pkg_svc;
+ my(@pkg_svc)=grep $_->getfield('quantity'),
+ qsearch( 'pkg_svc', { 'pkgpart' => $part_pkg->pkgpart } );
my($rowspan)=scalar(@pkg_svc);
my $plandata;
if ( $part_pkg->plan ) {
@@ -144,8 +145,9 @@ foreach my $part_pkg ( sort $sortby @part_pkg ) {
<TD ROWSPAN=<%= $rowspan %>><%= $plandata %></TD>
<%
+ my($pkg_svc);
my($n)="";
- foreach my $pkg_svc ( @pkg_svc ) {
+ foreach $pkg_svc ( @pkg_svc ) {
my($svcpart)=$pkg_svc->getfield('svcpart');
my($part_svc) = qsearchs('part_svc',{'svcpart'=> $svcpart });
print $n,qq!<TD><A HREF="${p}edit/part_svc.cgi?$svcpart">!,
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index a725dc051..ef0de13cc 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -1,11 +1,6 @@
+<!-- mason kludge -->
<%
-my %flag = (
- 'D' => 'Default',
- 'F' => 'Fixed',
- '' => '',
-);
-
my %search;
if ( $cgi->param('showdisabled') ) {
%search = ();
@@ -18,13 +13,18 @@ my @part_svc =
qsearch('part_svc', \%search );
my $total = scalar(@part_svc);
-my %num_active_cust_svc = map { $_->svcpart => $_->num_cust_svc } @part_svc;
-
-if ( $cgi->param('orderby') eq 'active' ) {
+my %num_active_cust_svc = ();
+if ( $cgi->param('active') ) {
+ my $active_sth = dbh->prepare(
+ 'SELECT COUNT(*) FROM cust_svc WHERE svcpart = ?'
+ ) or die dbh->errstr;
+ foreach my $part_svc ( @part_svc ) {
+ $active_sth->execute($part_svc->svcpart) or die $active_sth->errstr;
+ $num_active_cust_svc{$part_svc->svcpart} =
+ $active_sth->fetchrow_arrayref->[0];
+ }
@part_svc = sort { $num_active_cust_svc{$b->svcpart} <=>
$num_active_cust_svc{$a->svcpart} } @part_svc;
-} elsif ( $cgi->param('orderby') eq 'svc' ) {
- @part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc;
}
%>
@@ -55,23 +55,21 @@ function part_export_areyousure(href) {
: do { $cgi->param('showdisabled', 1);
'( <a href="'. $cgi->self_url. '">show disabled services</a> )'; }
%>
-<% $cgi->param('showdisabled', ( 1 ^ $cgi->param('showdisabled') ) ); %>
<%= table() %>
<TR>
- <TH><A HREF="<%= do { $cgi->param('orderby', 'svcpart'); $cgi->self_url } %>">#</A></TH>
- <% if ( $cgi->param('showdisabled') ) { %>
- <TH>Status</TH>
- <% } %>
- <TH><A HREF="<%= do { $cgi->param('orderby', 'svc'); $cgi->self_url; } %>">Service</A></TH>
+ <TH COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Service</TH>
<TH>Table</TH>
- <TH><A HREF="<%= do { $cgi->param('orderby', 'active'); $cgi->self_url; } %>"><FONT SIZE=-1>Customer<BR>Services</FONT></A></TH>
+<% if ( $cgi->param('active') ) { %>
+ <TH><FONT SIZE=-1>Customer<BR>Services</FONT></TH>
+<% } %>
<TH>Export</TH>
<TH>Field</TH>
<TH COLSPAN=2>Modifier</TH>
</TR>
<% foreach my $part_svc ( @part_svc ) {
- my $svcdb = $part_svc->svcdb;
+ my $hashref = $part_svc->hashref;
+ my $svcdb = $hashref->{svcdb};
my $svc_x = "FS::$svcdb"->new( { svcpart => $part_svc->svcpart } );
my @dfields = $svc_x->fields;
push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
@@ -80,30 +78,25 @@ function part_export_areyousure(href) {
or $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag }
@dfields ;
my $rowspan = scalar(@fields) || 1;
- my $url = "${p}edit/part_svc.cgi?". $part_svc->svcpart;
+ my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}";
%>
<TR>
<TD ROWSPAN=<%= $rowspan %>><A HREF="<%= $url %>">
- <%= $part_svc->svcpart %></A></TD>
-<% if ( $cgi->param('showdisabled') ) { %>
+ <%= $hashref->{svcpart} %></A></TD>
+<% unless ( $cgi->param('showdisabled') ) { %>
<TD ROWSPAN=<%= $rowspan %>>
- <%= $part_svc->disabled
- ? '<FONT COLOR="#FF0000"><B>Disabled</B></FONT>'
- : '<FONT COLOR="#00CC00"><B>Enabled</B></FONT>'
- %>
- </TD>
+ <%= $hashref->{disabled} ? 'DISABLED' : '' %></TD>
<% } %>
<TD ROWSPAN=<%= $rowspan %>><A HREF="<%= $url %>">
- <%= $part_svc->svc %></A></TD>
+ <%= $hashref->{svc} %></A></TD>
<TD ROWSPAN=<%= $rowspan %>>
- <%= $svcdb %></TD>
+ <%= $hashref->{svcdb} %></TD>
+<% if ( $cgi->param('active') ) { %>
<TD ROWSPAN=<%= $rowspan %>>
- <FONT COLOR="#00CC00"><B><%= $num_active_cust_svc{$part_svc->svcpart} %></B></FONT>&nbsp;<A HREF="<%=$p%>search/<%= $svcdb %>.cgi?svcpart=<%= $part_svc->svcpart %>">active</A>
- <% if ( $num_active_cust_svc{$part_svc->svcpart} ) { %>
- <BR><FONT SIZE="-1">[ <A HREF="<%=$p%>edit/bulk-cust_svc.html?svcpart=<%= $part_svc->svcpart %>">change</A> ]</FONT>
- <% } %>
+ <FONT COLOR="#00CC00"><B><%= $num_active_cust_svc{$hashref->{svcpart}} %></B></FONT>&nbsp;<A HREF="<%=$p%>search/<%= $hashref->{svcdb} %>.cgi?svcpart=<%= $hashref->{svcpart} %>">active</A>
</TD>
+<% } %>
<TD ROWSPAN=<%= $rowspan %>><%= itable() %>
<%
# my @part_export =
@@ -122,11 +115,14 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export
foreach my $field ( @fields ) {
my $flag = $part_svc->part_svc_column($field)->columnflag;
%>
- <%= $n1 %>
- <TD><%= $field %></TD>
- <TD><%= $flag{$flag} %></TD>
- <TD><%= $part_svc->part_svc_column($field)->columnvalue%></TD>
+ <%= $n1 %><TD><%= $field %></TD><TD>
+<% if ( $flag eq "D" ) { print "Default"; }
+ elsif ( $flag eq "F" ) { print "Fixed"; }
+ elsif ( not $flag ) { }
+ else { print "(Unknown!)"; }
+%>
+ </TD><TD><%= $part_svc->part_svc_column($field)->columnvalue%></TD>
<% $n1="</TR><TR>";
}
%>
diff --git a/httemplate/browse/payment_gateway.html b/httemplate/browse/payment_gateway.html
deleted file mode 100644
index bb7f31514..000000000
--- a/httemplate/browse/payment_gateway.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<%
-
- my %search;
- if ( $cgi->param('showdisabled') ) {
- %search = ();
- } else {
- %search = ( 'disabled' => '' );
- }
-
-%>
-<%= header('Payment gateways', menubar(
- 'Main Menu' => $p,
- 'Agents' => $p. 'browse/agent.cgi',
-)) %>
-
-<A HREF="<%= $p %>edit/payment_gateway.html"><I>Add a new payment gateway</I></A><BR><BR>
-
-<%= $cgi->param('showdisabled')
- ? do { $cgi->param('showdisabled', 0);
- '( <a href="'. $cgi->self_url. '">hide disabled gateways</a> )'; }
- : do { $cgi->param('showdisabled', 1);
- '( <a href="'. $cgi->self_url. '">show disabled gateways</a> )'; }
-%>
-
-<%= table() %>
-<TR>
- <TH COLSPAN=<%= $cgi->param('showdisabled') ? 1 : 2 %>>#</TH>
- <TH>Gateway</TH>
- <TH>Username</TH>
- <TH>Password</TH>
- <TH>Action</TH>
- <TH>Options</TH>
-</TR>
-
-<% foreach my $payment_gateway ( qsearch( 'payment_gateway', \%search ) ) { %>
-
- <TR>
- <TD><%= $payment_gateway->gatewaynum %></TD>
- <% if ( !$cgi->param('showdisabled') ) { %>
- <TD><%= $payment_gateway->disabled ? 'DISABLED' : '' %></TD>
- <% } %>
- <TD><%= $payment_gateway->gateway_module %>
- <%= !$payment_gateway->disabled
- ? '<FONT SIZE="-1"> <A HREF="misc/disable-payment_gateway.cgi?'. $payment_gateway->gatewaynum.'">(disable)</A></FONT>'
- : ''
- %>
- </TD>
- <TD><%= $payment_gateway->gateway_username %></TD>
- <TD> - </TD>
- <TD><%= $payment_gateway->gateway_action %></TD>
- <TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
- <% my %options = $payment_gateway->options;
- foreach my $option ( keys %options ) {
- %>
- <TR>
- <TH><%= $option %>:</TH>
- <TD><%= $options{$option} %></TD>
- </TR>
- <% } %>
- </TABLE>
- </TD>
- </TR>
-
-<% } %>
-
-</TABLE>
-</BODY>
-</HTML>
-
diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi
index 0afdd48d7..b53c1402d 100755
--- a/httemplate/browse/queue.cgi
+++ b/httemplate/browse/queue.cgi
@@ -1,5 +1,7 @@
<!-- mason kludge -->
-<%= header("Job Queue", menubar( 'Main Menu' => $p, )) %>
-<%= joblisting({}) %>
-</BODY>
-</HTML>
+<%
+
+print header("Job Queue", menubar( 'Main Menu' => $p, )).
+ joblisting({}). '</BODY></HTML>';
+
+%>
diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi
index 8011e7697..9a0006792 100644
--- a/httemplate/config/config-view.cgi
+++ b/httemplate/config/config-view.cgi
@@ -36,35 +36,19 @@
<% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
my $n = 0; %>
<% if ( $type eq '' ) { %>
- <tr>
- <td><font color="#ff0000">no type</font></td>
- </tr>
+ <tr><td><font color="#ff0000">no type</font></td></tr>
<% } elsif ( $type eq 'textarea'
|| $type eq 'editlist'
|| $type eq 'selectmultiple' ) { %>
- <tr>
- <td bgcolor="#ffffff">
+ <tr><td bgcolor="#ffffff">
<pre>
<%= encode_entities(join("\n", $conf->config($i->key) ) ) %>
</pre>
- </td>
- </tr>
+ </td></tr>
<% } elsif ( $type eq 'checkbox' ) { %>
- <tr>
- <td bgcolor="#<%= $conf->exists($i->key) ? '00ff00">YES' : 'ff0000">NO' %></td>
- </tr>
+ <tr><td bgcolor="#<%= $conf->exists($i->key) ? '00ff00">YES' : 'ff0000">NO' %></td></tr>
<% } elsif ( $type eq 'text' || $type eq 'select' ) { %>
- <tr>
- <td bgcolor="#ffffff">
- <%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>
- </td></tr>
- <% } elsif ( $type eq 'select-sub' ) { %>
- <tr>
- <td bgcolor="#ffffff">
- <%= $conf->config($i->key) %>:
- <%= &{ $i->option_sub }( $conf->config($i->key) ) %>
- </td>
- </tr>
+ <tr><td bgcolor="#ffffff"><%= $conf->exists($i->key) ? $conf->config($i->key) : '' %></td></tr>
<% } else { %>
<tr><td>
<font color="#ff0000">unknown type <%= $type %></font>
diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
index ff29d8578..409869e11 100644
--- a/httemplate/config/config.cgi
+++ b/httemplate/config/config.cgi
@@ -73,21 +73,6 @@ function SafeOnsubmit() {
<option value=<%= $conf->config($i->key) %> SELECTED><%= $conf->config($i->key) %>
<% } %>
</select>
- <% } elsif ( $type eq 'select-sub' ) { %>
- <select name="<%= $i->key. $n %>">
- <option value="">
- <% my %options = &{$i->options_sub};
- my @options = sort { $a <=> $b } keys %options;
- my %saw;
- foreach my $value ( @options ) {
- local($^W)=0; next if $saw{$value}++;
- %>
- <option value="<%= $value %>"<%= $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><%= $value %>: <%= $options{$value} %>
- <% } %>
- <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! exists $options{$conf->config($i->key)} ) { %>
- <option value=<%= $conf->config($i->key) %> SELECTED><%= $conf->config($i->key) %>: <%= &{ $i->option_sub }( $conf->config($i->key) ) %>
- <% } %>
- </select>
<% } elsif ( $type eq 'editlist' ) { %>
<script>
function doremove<%= $i->key. $n %>() {
diff --git a/httemplate/docs/ach.html b/httemplate/docs/ach.html
index b8a17c87d..b79df78fe 100644
--- a/httemplate/docs/ach.html
+++ b/httemplate/docs/ach.html
@@ -4,7 +4,9 @@
Electronic check (ACH) information
</TITLE>
</HEAD>
- <BODY BGCOLOR="#ffffff">
+ <BODY BGCOLOR="#e8e8e8">
<IMG BORDER=0 SRC="../images/ach.png">
+ <BR>
+ <CENTER><A HREF="javascript:close()">(close window)</A></CENTER>
</BODY>
</HTML>
diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html
index 9ce259c2b..50beafe78 100755
--- a/httemplate/docs/admin.html
+++ b/httemplate/docs/admin.html
@@ -42,8 +42,7 @@
sources</u> and <u>Add a new advertising source</u>.
<li>Click on <u>New Customer</u> and create a new customer for your system
- accounts with billing type <b>Complimentary</b>. Leave the <i>First
- package</i> dropdown set to <b>(none)</b>.
+ accounts with billing type <b>Complimentary</b>.
<li>From the Customer View screen of the newly created customer, order the
package you defined above.
diff --git a/httemplate/docs/billing.html b/httemplate/docs/billing.html
index adaac17dc..a9d7508fc 100644
--- a/httemplate/docs/billing.html
+++ b/httemplate/docs/billing.html
@@ -13,8 +13,8 @@
<li>Typeset (LaTeX) invoice templates
<ul>
<li>Install teTeX and Ghostscript (included with most distributions).
- <li>Place your logo in EPS (Encapsulated PostScript) format with size 90pt X 36pt (<code>epsffit -c 0 0 90 33 yourlogo.eps &gt;logo.eps</code>) at <code>/usr/local/etc/freeside/conf.<i>your_datasrc</i>/logo.eps</code>.
- <li>Edit the <b>invoice_latexreturnaddress</b>, <b>invoice_latexfooter</b>, <b>invoice_latexnotes</b>, and <b>invoice_latexsmallfooter</b> configuration options. If you are adventurous, edit <b>invoice_latex</b> as well.
+ <li>Place your logo in EPS (Encapsulated PostScript) format at <code>/usr/local/etc/freeside/conf.<i>your_datasrc</i>/logo.eps</code>.
+ <li>Edit the <b>invoice_latexfooter</b>, <b>invoice_latexnotes</b>, and <b>invoice_latexsmallfooter</b> configuration files. If you are adventurous, edit <b>invoice_latex</b> as well.
</ul>
<li>Plaintext invoice templates
<ul>
@@ -30,13 +30,6 @@
<!-- <li>$overdue - true if this invoice is overdue -->
</ul>
</ul>
- <li>HTML invoice templates
- <ul>
- <li>Place your logo in PNG format at <code>/usr/local/etc/freeside/conf.<i>your_datasrc</i>/logo.png</code>.
- <li>HTML invoices also use <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a>.
- <li>Edit the <b>invoice_html</b> configuration option.
- <li>The following configuration options can be set to override the default behaviour of using the invoice_latex* data: <b>invoice_htmlreturnaddress</b>, and <b>invoice_htmlfooter</b>, <b>invoice_htmlnotes</b>.
- </ul>
<!-- <li>Batch credit card processing
<ul>
<li>After <a href="man/bin/freeside-daily.html"><b>freeside-daily</b></a> is run, a credit card batch will be in the <a href="schema.html#cust_pay_batch">cust_pay_batch</a> table. Export this table to your credit card batching.
diff --git a/httemplate/docs/cvv2.html b/httemplate/docs/cvv2.html
index 767098537..fe8a17f6f 100644
--- a/httemplate/docs/cvv2.html
+++ b/httemplate/docs/cvv2.html
@@ -20,5 +20,6 @@
<IMG BORDER=0 ALT="American Express" SRC="../images/cvv2_amex.png">
</TD>
</TABLE>
+ <CENTER><A HREF="javascript:close()">(close window)</A></CENTER>
</BODY>
</HTML>
diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html
index 7254d76f3..d0151edeb 100644
--- a/httemplate/docs/index.html
+++ b/httemplate/docs/index.html
@@ -7,12 +7,11 @@
<h3>Installation and upgrades</h3>
<ul>
<li><a href="install.html">New Installation</a>
- <li><a href="install-rt.html">Installing integrated RT ticketing</a>
<li><a href="upgrade7.html">Upgrading from 1.3.0 to 1.3.1</a>
<li><a href="upgrade8.html">Upgrading from 1.3.1 to 1.4.0</a>
<li><a href="upgrade9.html">Upgrading from 1.4.0 to 1.4.1</a>
<li><a href="upgrade-1.4.2.html">Upgrading from 1.4.1 to 1.4.2</a>
- <li><a href="upgrade10.html">Upgrading from 1.4.1 (or 1.4.2) to 1.5.7</a>
+ <li><a href="upgrade10.html">Upgrading from 1.4.1 (or 1.4.2?) to 1.5.0</a>
</ul>
<h3>Configuration and setup</h3>
<ul>
diff --git a/httemplate/docs/install-rt.html b/httemplate/docs/install-rt.html
deleted file mode 100644
index da0941a09..000000000
--- a/httemplate/docs/install-rt.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<head>
- <title>Installing integrated RT ticketing</title>
-</head>
-<body>
-<h1>Installing integrated RT ticketing</h1>
-
-<p><i>Integrated ticketing is an new feature and these instructions are preliminary. Documentation contributions are welcome.</i>
-
-<p><i>There is also support for running this integration against an external RT installation, but it is not (yet) documented.</i>
-
-<p>Perl minimum version 5.8.3 is required. HTML::Mason is required.
-
-<p>Install the following perl modules:
- <ul>
- <li><a href="http://search.cpan.org/search?dist=Apache-Session">Apache::Session</a>
- <li><a href="http://search.cpan.org/search?dist=HTML-Tree">HTML::TreeBuilder (HTML-Tree)</a>
- <li><a href="http://search.cpan.org/search?dist=HTML-Format">HTML::FormatText (HTML-Format)</a>
- <li><a href="http://search.cpan.org/search?dist=Test-Inline">Test::Inline</a>
- <li><a href="http://search.cpan.org/search?dist=Class-ReturnValue">Class::ReturnValue</a>
- <li><a href="http://search.cpan.org/search?dist=DBIx-SearchBuilder">DBIx::SearchBuilder</a>
- <li><a href="http://search.cpan.org/search?dist=Log-Dispatch">Log::Dispatch</a>
- <li><a href="http://search.cpan.org/search?dist=Locale-Maketext-Lexicon">Locale::Maketext::Lexicon</a>
- <li><a href="http://search.cpan.org/search?dist=Locale-Maketext-Fuzzy">Locale::Maketext::Fuzzy</a>
- <li><a href="http://search.cpan.org/search?dist=Text-Wrapper">Text::Wrapper</a>
- <li><a href="http://search.cpan.org/search?dist=Time-modules">Time::ParseDate (Time-modules)</a>
- <li><a href="http://search.cpan.org/search?dist=TermReadKey">Term::ReadKey (TermReadKey)</a>
- <li><a href="http://search.cpan.org/search?dist=Text-Autoformat">Text::Autoformat</a>
- <li><a href="http://search.cpan.org/search?dist=Text-Quoted">Text::Quoted</a>
- <li><a href="http://search.cpan.org/search?dist=Regexp-Common">Regexp::Common</a>
- <li><a href="http://search.cpan.org/search?dist=HTML-Scrubber">HTML::Scrubber</a>
- <li><a href="http://search.cpan.org/search?dist=Tree-Simple">Tree::Simple</a>
- </ul>
-
-<p>Create a new Unix group called 'rt'
-
-<p>Edit the top-level Makefile, set RT_ENABLED to 1 and set the RT_DOMAIN, RT_TIMEZONE, and FREESIDE_URL variables.
-
-<p><pre>make configure-rt
-make create-rt
-make install-rt
-</pre>
-
-<p>Add the following to your httpd.conf:
-<pre>
-# replace /var/www/freeside with your freeside document root
-&lt;DirectoryMatch "^/var/www/freeside/rt/.*NoAuth"&gt;
-&lt;Limit GET POST&gt;
-allow from all
-Satisfy any
-SetHandler perl-script
-PerlHandler HTML::Mason
-&lt;/Limit&gt;
-&lt;/DirectoryMatch&gt;
-# replace /var/www/freeside with your freeside document root
-&lt;DirectoryMatch "^/var/www/freeside/rt/.*NoAuth/images"&gt;
-SetHandler None
-&lt;/DirectoryMatch&gt;
-# replace /var/www/freeside with your freeside document root
-&lt;Directory /var/www/freeside/rt/Ticket/Attachment&gt;
-SetHandler perl-script
-PerlHandler HTML::Mason
-&lt;/Directory&gt;
-</pre>
-
-<p>Set the <b>ticket_system</b> configuration value to <b>RT_Internal</b>. You may also wish to set <b>ticket_system-default_queueid</b> once you have RT configured.
-
-<p>Bootstrap RT's permissions:
- <ul>
- <li>Click on "Ticketing Main" on the Freeside main menu to auto-create an RT login for your username
- <li>Run <code>freeside-adduser -h /usr/local/etc/freeside/htpasswd root</code> and set a (temporary) password
- <li>Log into your Freeside installation as the "root" user you just created, by closing your browser or using <code>https://root@yourmachone/freeside/</code> syntax.
- <li>Click on "Ticketing Main" on the Freeside main menu. Click on "Configuration", then "Global", and then "User Rights". Grant the "SuperUser" right to your RT login.
- <li>Remove the temporary "root" user from /usr/local/etc/freeside/mapsecrets and /usr/local/etc/freeside/htpasswd
- </ul>
-
-<p>Follow the <A HREF="http://wiki.bestpractical.com/">regular RT documentation</A> to configure RT, setup the mailgate, etc.
-
-</body>
diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html
index 1f80db1a7..86e2a6b8c 100644
--- a/httemplate/docs/install.html
+++ b/httemplate/docs/install.html
@@ -14,65 +14,51 @@ Before installing, you need:
<li>Optional, enables typeset invoices: teTeX and Ghostscript (included with most distributions).
<li>A <b>transactional</b> database engine <a href="http://search.cpan.org/search?mode=module&query=DBD%3A%3A">supported</a> by Perl's <a href="http://dbi.perl.org">DBI</a>.
<ul>
- <li><a href="http://www.postgresql.org/">PostgreSQL</a> is recommended (v7.2 or later, 7.4 or later recommended).
- <li> <a href="http://www.mysql.com/">MySQL</a> is <b>not currently supported</b>. <FONT SIZE="-1"><i>Developers intersted in maintaining MySQL support are welcome to ask on the -devel mailing list; many things work, but MySQL support needs a maintainer to update it for recent (and future) changes.</i></FONT>
- <!-- <li><a href="http://www.mysql.com/">MySQL</a> <b>MINIMUM VERSION 4.1</b> is untested but may work. Versions before 4.1 do not support standard SQL subqueries and are <b>NOT SUPPORTED</b>.
-<!-- <li>MySQL has been reported to work.
- MySQL's default <a href="http://www.mysql.com/doc/M/y/MyISAM.html">MyISAM</a> and <a href="http://www.mysql.com/doc/I/S/ISAM.html">ISAM</a> table types are not supported. You <b>must</b> use one of the new <a href="http://www.mysql.com/doc/T/a/Table_types.html">transaction-safe table types</a> such as <a href="http://www.mysql.com/doc/I/n/InnoDB.html">InnoDB</a>. Set it as the default table type using the <code>--default-table-type=InnoDB</code> <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Command-line_options">mysqld command-line option</a> or by setting <code>default-table-type=InnoDB</code> in the <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Option_files">my.cnf option file</a>.
--->
+ <li><a href="http://www.postgresql.org/">PostgreSQL</a> is recommended (v7or later).
+ <li><a href="http://www.mysql.com/">MySQL</a> <b>MINIMUM VERSION 4.1</b> is untested but may work. Versions before 4.1 do not support standard SQL subqueries and are <b>NOT SUPPORTED</b>.<!-- If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see <a href="http://pouncequick.420.am/rt/Ticket/Display.html?id=438">ticket #438</a> in the bug-tracking system and ask on the -devel mailing list. -->
+<!-- <li>MySQL has been reported to work. -->
+ MySQL's default <a href="http://www.mysql.com/doc/M/y/MyISAM.html">MyISAM</a> and <a href="http://www.mysql.com/doc/I/S/ISAM.html">ISAM</a> table types are not supported. You <b>must</b> use one of the new <a href="http://www.mysql.com/doc/T/a/Table_types.html">transaction-safe table types</a> such as <!-- <a href="http://www.mysql.com/doc/B/D/BDB.html">BDB</a> or --><a href="http://www.mysql.com/doc/I/n/InnoDB.html">InnoDB</a>. Set it as the default table type using the <!-- <code>--default-table-type=BDB</code> or --><code>--default-table-type=InnoDB</code> <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Command-line_options">mysqld command-line option</a> or by setting <!--<code>default-table-type=BDB</code> or --><code>default-table-type=InnoDB</code> in the <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Option_files">my.cnf option file</a>.
</ul>
- <i>Note: the above only applies to the database used by the Freeside software itself. Freeside can integrate with RADIUS and other servers running MySQL <!--(any version)--> or any other DBI-supported database.</i>
<li>Perl modules (<a href="http://search.cpan.org/~andk/CPAN/lib/CPAN.pm">CPAN</a> will query, download and build perl modules automatically)
<ul>
-<!-- <li><a href="http://search.cpan.org/dist/Array-PrintCols">Array-PrintCols</a>
- <li><a href="http://search.cpan.org/dist/Term-Query">Term-Query</a> (make test broken; install manually) -->
- <li><a href="http://search.cpan.org/dist/MIME-Base64">MIME-Base64</a>
- <li><a href="http://search.cpan.org/dist/Digest-MD5">Digest-MD5</a>
-<!-- <li><a href="http://search.cpan.org/dist/MD5">MD5</a> -->
- <li><a href="http://search.cpan.org/dist/URI">URI</a>
- <li><a href="http://search.cpan.org/dist/HTML-Tagset">HTML-Tagset</a>
- <li><a href="http://search.cpan.org/dist/HTML-Parser">HTML-Parser</a>
- <li><a href="http://search.cpan.org/dist/libnet">libnet</a>
- <li><a href="http://search.cpan.org/dist/Locale-Codes">Locale-Codes</a>
- <li><a href="http://search.cpan.org/dist/Net-Whois-Raw">Net-Whois-Raw</a>
- <li><a href="http://search.cpan.org/dist/libwww-perl">libwww-perl</a>
- <li><a href="http://search.cpan.org/dist/Business-CreditCard">Business-CreditCard</a>
-<!-- <li><a href="http://search.cpan.org/dist/Data-ShowTable">Data-ShowTable</a> -->
- <li><a href="http://search.cpan.org/dist/MailTools">MailTools</a>
- <li><a href="http://search.cpan.org/dist/TimeDate">TimeDate</a>
- <li><a href="http://search.cpan.org/dist/DateManip">DateManip</a>
- <li><a href="http://search.cpan.org/dist/File-CounterFile">File-CounterFile</a>
- <li><a href="http://search.cpan.org/dist/FreezeThaw">FreezeThaw</a>
- <li><a href="http://search.cpan.org/dist/String-Approx">String-Approx</a>
- <li><a href="http://search.cpan.org/dist/Text-Template">Text-Template</a>
- <li><a href="http://search.cpan.org/dist/DBI">DBI</a>
- <li><a href="http://search.cpan.org/search?mode=module&query=DBD">DBD for your database engine</a> (<a href="http://search.cpan.org/dist/DBD-Pg">DBD::Pg</a> for PostgreSQL<!--, <a href="http://search.cpan.org/search?dist=DBD-mysql">DBD::mysql</a> for MySQL-->)
-<!-- <li><a href="http://search.cpan.org/dist/DBIx-DataSource">DBIx-DataSource</a> -->
- <li><a href="http://search.cpan.org/dist/DBIx-DBSchema">DBIx-DBSchema</a>
- <li><a href="http://search.cpan.org/dist/Net-SSH">Net-SSH</a>
- <li><a href="http://search.cpan.org/dist/String-ShellQuote">String-ShellQuote</a>
- <li><a href="http://search.cpan.org/dist/Net-SCP">Net-SCP</a>
+<!-- <li><a href="http://search.cpan.org/search?dist=Array-PrintCols">Array-PrintCols</a>
+ <li><a href="http://search.cpan.org/search?dist=Term-Query">Term-Query</a> (make test broken; install manually) -->
+ <li><a href="http://search.cpan.org/search?dist=MIME-Base64">MIME-Base64</a>
+ <li><a href="http://search.cpan.org/search?dist=Digest-MD5">Digest-MD5</a>
+<!-- <li><a href="http://search.cpan.org/search?dist=MD5">MD5</a> -->
+ <li><a href="http://search.cpan.org/search?dist=URI">URI</a>
+ <li><a href="http://search.cpan.org/search?dist=HTML-Tagset">HTML-Tagset</a>
+ <li><a href="http://search.cpan.org/search?dist=HTML-Parser">HTML-Parser</a>
+ <li><a href="http://search.cpan.org/search?dist=libnet">libnet</a>
+ <li><a href="http://search.cpan.org/search?dist=Locale-Codes">Locale-Codes</a>
+ <li><a href="http://search.cpan.org/search?dist=Net-Whois-Raw">Net-Whois-Raw</a>
+ <li><a href="http://search.cpan.org/search?dist=libwww-perl">libwww-perl</a>
+ <li><a href="http://search.cpan.org/search?dist=Business-CreditCard">Business-CreditCard</a>
+<!-- <li><a href="http://search.cpan.org/search?dist=Data-ShowTable">Data-ShowTable</a> -->
+ <li><a href="http://search.cpan.org/search?dist=MailTools">MailTools</a>
+ <li><a href="http://search.cpan.org/search?dist=TimeDate">TimeDate</a>
+ <li><a href="http://search.cpan.org/search?dist=DateManip">DateManip</a>
+ <li><a href="http://search.cpan.org/search?dist=File-CounterFile">File-CounterFile</a>
+ <li><a href="http://search.cpan.org/search?dist=FreezeThaw">FreezeThaw</a>
+ <li><a href="http://search.cpan.org/search?dist=String-Approx">String-Approx</a>
+ <li><a href="http://search.cpan.org/search?dist=Text-Template">Text-Template</a>
+ <li><a href="http://search.cpan.org/search?dist=DBI">DBI</a>
+ <li><a href="http://search.cpan.org/search?mode=module&query=DBD">DBD for your database engine</a> (<a href="http://search.cpan.org/search?dist=DBD-Pg">DBD::Pg</a> for PostgreSQL, <a href="http://search.cpan.org/search?dist=DBD-mysql">DBD::mysql</a> for MySQL)
+<!-- <li><a href="http://search.cpan.org/search?dist=DBIx-DataSource">DBIx-DataSource</a> -->
+ <li><a href="http://search.cpan.org/search?dist=DBIx-DBSchema">DBIx-DBSchema</a>
+ <li><a href="http://search.cpan.org/search?dist=Net-SSH">Net-SSH</a>
+ <li><a href="http://search.cpan.org/search?dist=String-ShellQuote">String-ShellQuote</a>
+ <li><a href="http://search.cpan.org/search?dist=Net-SCP">Net-SCP</a>
<li><a href="http://www.masonhq.com/">HTML::Mason</a> (recommended, enables full functionality) or <a href="http://www.apache-asp.org/">Apache::ASP</a> (deprecated, integrated RT ticketing will not be available)
- <li><a href="http://search.cpan.org/dist/Tie-IxHash">Tie-IxHash</a>
- <li><a href="http://search.cpan.org/dist/Time-Duration">Time-Duration</a>
- <li><a href="http://search.cpan.org/dist/HTML-Widgets-SelectLayers">HTML-Widgets-SelectLayers</a>
- <li><a href="http://search.cpan.org/dist/Storable">Storable</a>
- <li><a href="http://search.cpan.org/dist/Cache-Cache">Cache::Cache</a>
- <li><a href="http://search.cpan.org/dist/NetAddr-IP">NetAddr-IP</a>
- <li><a href="http://search.cpan.org/dist/Chart">Chart</a>
- <li><a href="http://search.cpan.org/dist/Crypt-PasswdMD5">Crypt::PasswdMD5</a>
- <li><a href="http://search.cpan.org/dist/Locale-SubCountry">Locale::SubCountry</a>
- <li><a href="http://search.cpan.org/dist/Frontier-RPC">Frontier::RPC</a>
- <li><a href="http://search.cpan.org/dist/Text-CSV_XS">Text::CSV_XS</a>
- <li><a href="http://search.cpan.org/dist/Spreadsheet-WriteExcel">Spreadsheet::WriteExcel</a>
- <li><a href="http://search.cpan.org/dist/IO-stringy">IO-stringy (IO::Scalar)</a>
- <li><a href="http://search.cpan.org/dist/Frontier-RPC">Frontier::RPC (Frontier::RPC2)</a>
- <li><a href="http://search.cpan.org/dist/MIME-tools">MIME::Entity (MIME-tools)</a>
- <li><a href="http://search.cpan.org/dist/IPC-Run3">IPC::Run3</a>
- <li><a href="http://search.cpan.org/dist/Term-ReadKey">Term::ReadKey</a>
-<!-- <li><a href="http://search.cpan.org/dist/Crypt-YAPassGen">Crypt::YAPassGen</a> -->
- <li><a href="http://search.cpan.org/search?mode=module&query=MIME::Entity">Fax::Hylafax::Client</a> <i>(Required if using FAX invoice destinations)</i>
- <li><a href="http://search.cpan.org/dist/ApacheDBI">Apache::DBI</a> <i>(optional but recommended for better webinterface performance)</i>
+ <li><a href="http://search.cpan.org/search?dist=Tie-IxHash">Tie-IxHash</a>
+ <li><a href="http://search.cpan.org/search?dist=Time-Duration">Time-Duration</a>
+ <li><a href="http://search.cpan.org/search?dist=HTML-Widgets-SelectLayers">HTML-Widgets-SelectLayers</a>
+ <li><a href="http://search.cpan.org/search?dist=Storable">Storable</a>
+<!-- MyAccounts, maybe only for dev <li><a href="http://search.cpan.org/search?dist=Cache-Cache">Cache::Cache</a> -->
+ <li><a href="http://search.cpan.org/search?dist=NetAddr-IP">NetAddr-IP</a>
+ <li><a href="http://search.cpan.org/search?dist=Chart">Chart</a>
+ <li><a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a>
+ <li><a href="http://search.cpan.org/search?dist=ApacheDBI">Apache::DBI</a> <i>(optional but recommended for better webinterface performance)</i>
</ul>
</ul>
Install the Freeside distribution:
@@ -126,49 +112,46 @@ $ su
</ul>
<table>
<tr>
- <th>Mason (recommended)</th><th>Apache::ASP (deprecated)</th>
+ <th>Apache::ASP</th><th>Mason</th>
</tr>
<tr>
-
<td valign="top"><ul>
<li>Configure Apache:
<font size="-1"><pre>
-PerlModule HTML::Mason
-# your freeside docuemnt root
+PerlModule Apache::ASP
+# your freeside document root
&lt;Directory&nbsp;/var/www/freeside&gt;
&lt;Files ~ (\.cgi|\.html)&gt;
AddHandler perl-script .cgi .html
-PerlHandler HTML::Mason
+PerlHandler Apache::ASP
&lt;/Files&gt;
&lt;Perl&gt;
-require&nbsp;"/usr/local/etc/freeside/handler.pl";
+$MLDBM::RemoveTaint = 1;
&lt;/Perl&gt;
+PerlSetVar&nbsp;Global&nbsp;/usr/local/etc/freeside/asp-global/
+PerlSetVar&nbsp;Debug&nbsp;2
+PerlSetVar&nbsp;RequestBinaryRead&nbsp;Off
+# your freeside document root
+PerlSetVar&nbsp;IncludesDir&nbsp;/var/www/freeside
&lt;/Directory&gt;
</pre></font>
</ul></td>
-
<td valign="top"><ul>
<li>Configure Apache:
<font size="-1"><pre>
-PerlModule Apache::ASP
-# your freeside document root
+PerlModule HTML::Mason
+# your freeside docuemnt root
&lt;Directory&nbsp;/var/www/freeside&gt;
&lt;Files ~ (\.cgi|\.html)&gt;
AddHandler perl-script .cgi .html
-PerlHandler Apache::ASP
+PerlHandler HTML::Mason
&lt;/Files&gt;
&lt;Perl&gt;
-$MLDBM::RemoveTaint = 1;
+require&nbsp;"/usr/local/etc/freeside/handler.pl";
&lt;/Perl&gt;
-PerlSetVar&nbsp;Global&nbsp;/usr/local/etc/freeside/asp-global/
-PerlSetVar&nbsp;Debug&nbsp;2
-PerlSetVar&nbsp;RequestBinaryRead&nbsp;Off
-# your freeside document root
-PerlSetVar&nbsp;IncludesDir&nbsp;/var/www/freeside
&lt;/Directory&gt;
</pre></font>
</ul></td>
-
</tr>
</table>
<ul>
@@ -186,16 +169,12 @@ require valid-user
<ul>
<li>First user:<font size="-1">
<pre>$ su
-# <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -c -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
+$ <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -c -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
<li>Additional users:<font size="-1">
<pre>$ su
-# <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
+$ <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
</ul>
<i>(using other auth types, add each user to your <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache authentication</a> and then run: <tt>freeside-adduser <b>username</b></tt>)</i>
- <li>Create the Freeside system users:
-<pre>$ su
-# <a href="man/bin/freeside-adduser.html">freeside-adduser</a> fs_queue
-# <a href="man/bin/freeside-adduser.html">freeside-adduser</a> fs_selfservice</pre>
<li>As the freeside UNIX user, run <tt>freeside-setup <b>username</b></tt> to create the database tables, passing the username of a Freeside user you created above:
<pre>
$ su freeside
diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia
index e00f59ce1..746561550 100644
--- a/httemplate/docs/schema.dia
+++ b/httemplate/docs/schema.dia
Binary files differ
diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html
index cdb59a2e9..c5cfd5119 100644
--- a/httemplate/docs/schema.html
+++ b/httemplate/docs/schema.html
@@ -23,7 +23,6 @@
</ul>
<li><a name="cust_bill" href="man/FS/cust_bill.html">cust_bill</a> - Invoices. Declarations that a customer owes you money. The specific charges are itemized in <a href="#cust_bill_pkg">cust_bill_pkg</a>.
<ul>
- <li>billpkgnum - primary_key
<li>invnum - primary key
<li>custnum - <a href="#cust_main">customer</a>
<li>_date
@@ -286,18 +285,6 @@
<li>optionname - option name
<li>optionvalue - option value
</ul>
- <li><a name="reg_code" href="man/FS/reg_code.html">reg_code</A> - One-time registration codes
- <ul>
- <li>codenum - primary key
- <li>code
- <li>agentnum - <a href="#agent">Agent</a>
- </ul>
- <li><a name="reg_code_pkg" href="man/FS/reg_code_pkg.html">reg_code_pkg</A> - Registration code link to package definitions
- <ul>
- <li>codepkgnum - primary key
- <li>codenum - <a href="#reg_code">Registration code</a>
- <li>pkgpart - <a href="#part_pkg">Package definition</a>
- </ul>
<li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
<ul>
<li>refnum - primary key
@@ -323,7 +310,6 @@
</ul>
<li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
<ul>
- <li>pkgsvcnum - primary key
<li>pkgpart - <a href="#part_pkg">Package definition</a>
<li>svcpart - <a href="#part_svc">Service definition</a>
<li>quantity - quantity of this service that this package includes
@@ -356,13 +342,11 @@
<li>nasport - port number on the NAS
<li>nasnum - <a href="#nas">NAS</a>
</ul>
- <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a> - prepaid cards
+ <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
<ul>
<li>prepaynum - primary key
- <li>identifier - text or numeric string of prepaid card
- <li>amount - amount of prepayment
- <li>seconds - prepaid time instead of (or in addition to) monetary value
- <li>agentnum - optional agent assignment for prepaid cards
+ <li>identifier - text or numeric string used to receive this credit
+ <li>amount - amount of credit
</ul>
<li><a name="session" href="man/FS/session.html">session</a>
<ul>
@@ -440,7 +424,6 @@
</ul>
<li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
<ul>
- <li>typepkgnum - primary key
<li>typenum - <a href="#agent_type">agent type</a>
<li>pkgpart - <a href="#part_pkg">Package definition</a>
</ul>
@@ -478,7 +461,6 @@
</ul>
<li><a name="rate_detail" href="man/FS/rate_detail.html">rate_detail</a> - Call rate detail
<ul>
- <li>ratedetailnum - primary key
<li>ratenum - <a href="#rate">rate plan</a>
<li>orig_regionnum - call origination <a href="#rate_region">region</a>
<li>dest_regionnum - call destination <a href="#rate_region">region</a>
@@ -494,7 +476,7 @@
<li><a name="rate_prefix" href="man/FS/rate_prefix.html">rate_prefix</a> - Call rate prefix
<ul>
<li>prefixnum - primary key
- <li>regionnum - <a href="#rate_region">rate region</a>
+ <li>regionnum <a href="#rate_region">rate region</a>
<li>countrycode
<li>npa
<li>nxx
@@ -506,18 +488,5 @@
<li>locale - locale
<li>msg - Message text
</ul>
- <li><a name="clientapi_session" href="man/FS/clientapi_session.html">clientapi_session</a> - ClientAPI session store
- <ul>
- <li>sessionnum - primary key
- <li>sessionid - session ID
- <li>namespace - session namespace
- </ul>
- <li><a name="clientapi_session_field" href="man/FS/clientapi_session_field.html">clientapi_session_field</a> - Client API session store data
- <ul>
- <li>fieldnum - primary key
- <li>sessionnum - <a href="#session">session</a>
- <li>fieldname
- <li>fieldvalue
- </ul>
</ul>
</body>
diff --git a/httemplate/docs/selfservice.html b/httemplate/docs/selfservice.html
index 9dc8f2a5e..e533ed2ee 100644
--- a/httemplate/docs/selfservice.html
+++ b/httemplate/docs/selfservice.html
@@ -14,38 +14,24 @@ machine, not the backend Freeside server. On the public machine, install:
<li><a href="http://search.cpan.org/search?dist=Storable">Storable</a>
<li><a href="http://search.cpan.org/search?dist=Business-CreditCard">Business-CreditCard</a>
<li><a href="http://search.cpan.org/search?dist=HTTP-BrowserDetect">HTTP::BrowserDetect</a>
- <li><a href="http://search.cpan.org/search?dist=HTML-Parser">HTML::Parser</a>
<li><a href="man/FS/SelfService.html">FS::SelfService</a> (copy the fs_selfservice/FS-SelfService directory to the external machine, then: perl Makefile.PL; make; make install)
+ <li><a href="man/FS/SignupClient.html">FS::SignupClient</a> (copy the fs_signup/FS-SignupClient directory to the external machine, then: perl Makefile.PL; make; make install)
</ul>
Then:
<ul>
<li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-default_agentnum</i></a> configuration value to a default <a href="../browse/agent.cgi">agent number</a>.
- <li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-default_refnum</i></a> configuration value to a default <a href="../browse/part_referral.cgi">advertising source</a>.
- <li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-payby</i></a> configuration value to the acceptable payment types for signups.
- <li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-realtime</i></a> configuration value to run billing for signups immediately.
+ <li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-default_refnum</i></a> to a default <a href="../browse/part_referral.cgi">advertising source</a>.
<li>Add the user `freeside' to the the external machine.
- <li>Copy or symlink the <code>fs_selfservice/FS-SelfService/cgi/</code> directory into the web server's document space. Optionally, customize the .html templates. "Entry points" (useful places to link to) are:
- <ul>
- <li>signup.cgi - Signup
- <li>selfservice.cgi - Customer self-service
- <li>agent.cgi - Reseller interface
- <li>passwd.cgi - Simple password-changing interface
- <li>promocode.html - Promotional code pre-signup
- <li>regcode.html - Registration code pre-signup
- <li>stateselect.html - State selection pre-signup
- </ul>
- <li>Enable CGI execution for files with the `.cgi' extension. (with <a href="http://www.apache.org/docs/mod/mod_mime.html#addhandler">Apache</a>), for example: <pre>
-#directory where selfservice .cgi scripts and .html templates are located
-&lt;Directory /var/www/selfservice&gt;
-AddHandler cgi-script .cgi
-Options +ExecCGI
-&lt;/Directory&gt;</pre>
+ <li>Copy or symlink the <pre>fs_selfservice/FS-SelfService/cgi/</pre> directory into the web server's document space, for customer self-service and reseller access. Optionally, customize the .html templates.
+ <li>Copy or symlink the <pre>fs_signup/FS-SignupClient/cgi/</pre> directory into the web server's document space, for signups. Optionally, customize the .html templates.
+ <li>When linking to signup.cgi, you can include a referring custnum in the URL as follows: <code>http://public.web.server/path/signup.cgi?ref=1542</code>
+ <li>Enable CGI execution for files with the `.cgi' extension. (with <a href="http://www.apache.org/docs/mod/mod_mime.html#addhandler">Apache</a>)
<li>Create the /usr/local/freeside directory on the external machine (owned by the freeside user).
- <li>touch /usr/local/freeside/selfservice_socket; chown freeside /usr/local/freeside/selfservice_socket; chmod 600 /usr/local/freeside/selfservice_socket
- <li>Use <a href="http://www.apache.org/docs/suexec.html">suEXEC</a> or <a href="http://www.perl.com/CPAN-local/doc/manual/html/pod/perlsec.html#Security_Bugs">setuid</a> to run signup.cgi, selfservice.cgi, agent.cgi and passwd.cgi as the freeside user. <b>Do not run your public web server as the freeside user!</b>
+ <li>touch /usr/local/freeside/fs_signupd_socket; chown freeside /usr/local/freeside/fs_signupd_socket; chmod 600 /usr/local/freeside/fs_signupd_socket
+ <li>Use <a href="http://www.apache.org/docs/suexec.html">suEXEC</a> or <a href="http://www.perl.com/CPAN-local/doc/manual/html/pod/perlsec.html#Security_Bugs">setuid</a> (see <a href="install.html">install.html</a> for details) to run signup.cgi, selfservice.cgi, agent.cgi and passwd.cgi as the freeside user.
<li>Append the identity.pub from the freeside user on your freeside machine to the authorized_keys file of the newly created freeside user on the external machine(s).
- <li>Run an instance of <pre>freeside-selfservice-server <i>user</i> <i>machine</i></pre> on the Freeside machine for each external machine.
+ <li>Run an instance of <pre>freeside-selfservice-server <i>user</i> <i>machine</i> <i>agentnum</i> <i>refnum</i></pre> on the Freeside machine for each external machine.
<ul>
<li><i>user</i> is a user from the mapsecrets file.
<li><i>machine</i> is the name of the external machine.
@@ -55,12 +41,8 @@ Options +ExecCGI
</ul>
Optional:
<ul>
- <li>You can install the files in the <code>fs_selfservice/FS-SelfService/cgi/</code> directory multiple places in your web server's document space, and customize the .html templates differently for each. You can set the agentnum used for each signup by editing signup.html and including a hidden field with the agentnum:
- <pre>
- &lt;INPUT TYPE="hidden" NAME="agentnum" VALUE="3"&gt;</pre>
- <li>When linking to signup.cgi, you can include a referring custnum in the URL as follows: <code>http://public.web.server/path/signup.cgi?ref=1542</code>
<li>If you create a <b>/usr/local/freeside/ieak.template</b> file on the external machine, it will be sent to IE users with MIME type <i>application/x-Internet-signup</i>. This file will be processed with <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> with the variables listed below available.
- (an example file is included as <b>fs_selfservice/FS-SelfService/ieak.template</b>) See the section on <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/INS.HTM">internet settings files</a> in the <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/toc.asp">IEAK documentation</a> for more information.
+ (an example file is included as <b>fs_signup/ieak.template</b>) See the section on <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/INS.HTM">internet settings files</a> in the <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/toc.asp">IEAK documentation</a> for more information.
<!-- <li>If you create a <b>/usr/local/freeside/success.html</b> file on the external machine, it will be used as the success HTML page. Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html. An example file is included as <b>fs_signup/FS-SignupClient/cgi/success.html</b>-->
<li>Variable substitutions available in <b>ieak.template</b> and <b>success.html</b>:
<ul>
diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html
index ac2c6238d..d8186858f 100644
--- a/httemplate/docs/upgrade10.html
+++ b/httemplate/docs/upgrade10.html
@@ -1,44 +1,259 @@
<pre>
this is incomplete
-NOTE: Version numbering has been simplified. 1.5.7 is the version after
-1.5.0pre6. It is still a development version - releases with odd numbered
-middle parts (NN in x.NN.x) are development versions, like Perl or Linux.
-
-If migrating from 1.5.7, see README.1.5.8 instead
-
-If migrating from 1.5.0pre6, see README.1.5.7 instead
-
-install DBD::Pg 1.32, 1.41 or later (not 1.40) (or, if you're using a Perl version before 5.6, you could try installing DBD::Pg 1.22 with <a href="http://420.am/~ivan/DBD-Pg-1.22-fixvercmp.patch">this patch</a> and commenting out the "use DBD::Pg 1.32" at the top of DBIx/DBSchema/DBD/Pg.pm)
-install DBIx::DBSchema 0.27 (or later)
- (if you are running Pg version 7.2.x or earlier, install at least
- DBIx::DBSchema 0.29)
+install DBD::Pg 1.32 (or, if you're using a Perl version before 5.6, you could try installing DBD::Pg 1.22 with <a href="http://420.am/~ivan/DBD-Pg-1.22-fixvercmp.patch">this patch</a> and commenting out the "use DBD::Pg 1.32" at the top of DBIx/DBSchema/DBD/Pg.pm)
+install DBIx::DBSchema 0.23
install Net::SSH 0.08
-install HTML::Widgets::SelectLayers 0.05
-install Business::CreditCard 0.28
-
- If using Apache::ASP, add PerlSetVar RequestBinaryRead Off and PerlSetVar IncludesDir /your/freeside/document/root/ to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55.
- In httpd.conf, change &lt;Files ~ \.cgi&gt; to &lt;Files ~ (\.cgi|\.html)&gt;
- In httpd.conf, change <b>AddHandler perl-script .cgi</b> or <b>SetHandler perl-script</b> to <b>AddHandler perl-script .cgi .html</b>
-install NetAddr::IP, Chart::Base, Locale::SubCountry, Text::CSV_XS,
-Spreadsheet::WriteExcel, IO-stringy (IO::Scalar), Frontier::RPC
-(Frontier::RPC2), MIME::Entity (MIME-tools), IPC::Run3, Net::Whois::Raw,
-JSON and Term::ReadKey
-<!-- and Crypt::YAPassGen-->
+install NetAddr::IP, Chart::Base, IPC::ShareLite and Locale::SubCountry
INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 20, 'svc_external-id', 'en_US', 'External ID' );
INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 21, 'svc_external-title', 'en_US', 'Title' );
-DROP INDEX cust_bill_pkg1;
+CREATE TABLE cust_bill_pkg_detail (
+ detailnum serial,
+ pkgnum int NOT NULL,
+ invnum int NOT NULL,
+ detail varchar(80),
+ PRIMARY KEY (detailnum)
+);
+CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum );
-On recent Pg versions:
+CREATE TABLE part_virtual_field (
+ vfieldpart int NOT NULL,
+ dbtable varchar(32) NOT NULL,
+ name varchar(32) NOT NULL,
+ check_block text,
+ list_source text,
+ length integer,
+ label varchar(80),
+ PRIMARY KEY (vfieldpart)
+);
+
+CREATE TABLE virtual_field (
+ recnum integer NOT NULL,
+ vfieldpart integer NOT NULL,
+ value varchar(128) NOT NULL,
+ PRIMARY KEY (vfieldpart, recnum)
+);
+
+CREATE TABLE router (
+ routernum serial,
+ routername varchar(80),
+ svcnum int,
+ PRIMARY KEY (routernum)
+);
+
+CREATE TABLE part_svc_router (
+ svcpart int NOT NULL,
+ routernum int NOT NULL
+);
+
+CREATE TABLE addr_block (
+ blocknum serial,
+ routernum int NOT NULL,
+ ip_gateway varchar(15) NOT NULL,
+ ip_netmask int NOT NULL,
+ PRIMARY KEY (blocknum)
+);
+CREATE UNIQUE INDEX addr_block1 ON addr_block ( blocknum, routernum );
+
+CREATE TABLE svc_broadband (
+ svcnum int NOT NULL,
+ blocknum int NOT NULL,
+ speed_up int NOT NULL,
+ speed_down int NOT NULL,
+ ip_addr varchar(15),
+ PRIMARY KEY (svcnum)
+);
+
+CREATE TABLE acct_snarf (
+ snarfnum serial,
+ svcnum int NOT NULL,
+ machine varchar(255) NULL,
+ protocol varchar(80) NULL,
+ username varchar(80) NULL,
+ _password varchar(80) NULL,
+ PRIMARY KEY (snarfnum)
+);
+CREATE INDEX acct_snarf1 ON acct_snarf ( svcnum );
+
+CREATE TABLE svc_external (
+ svcnum int NOT NULL,
+ id int,
+ title varchar(80),
+ PRIMARY KEY (svcnum)
+);
+
+CREATE TABLE part_pkg_temp (
+ pkgpart serial NOT NULL,
+ pkg varchar(80) NOT NULL,
+ "comment" varchar(80) NOT NULL,
+ setup text NULL,
+ freq varchar(80) NOT NULL,
+ recur text NULL,
+ setuptax char(1) NULL,
+ recurtax char(1) NULL,
+ plan varchar(80) NULL,
+ plandata text NULL,
+ disabled char(1) NULL,
+ taxclass varchar(80) NULL,
+ PRIMARY KEY (pkgpart)
+);
+INSERT INTO part_pkg_temp SELECT * from part_pkg;
+DROP TABLE part_pkg;
+ALTER TABLE part_pkg_temp RENAME TO part_pkg;
+CREATE INDEX part_pkg1 ON part_pkg(disabled);
+
+On modern Pg:
+ALTER TABLE part_pkg DROP CONSTRAINT part_pkg_temp_pkey;
+ALTER TABLE part_pkg ADD PRIMARY KEY (pkgpart);
+select setval('public.part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
+
+Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 and 7.2 so far):
+DROP INDEX part_pkg_temp_pkey;
+CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg (pkgpart);
+probably this one?: select setval('part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
+probably not this one?: select setval('part_pkg_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
+
+CREATE TABLE h_part_pkg_temp (
+ historynum serial NOT NULL,
+ history_date int,
+ history_user varchar(80) NOT NULL,
+ history_action varchar(80) NOT NULL,
+ pkgpart int NOT NULL,
+ pkg varchar(80) NOT NULL,
+ "comment" varchar(80) NOT NULL,
+ setup text NULL,
+ freq varchar(80) NOT NULL,
+ recur text NULL,
+ setuptax char(1) NULL,
+ recurtax char(1) NULL,
+ plan varchar(80) NULL,
+ plandata text NULL,
+ disabled char(1) NULL,
+ taxclass varchar(80) NULL,
+ PRIMARY KEY (historynum)
+);
+INSERT INTO h_part_pkg_temp SELECT * from h_part_pkg;
+DROP TABLE h_part_pkg;
+ALTER TABLE h_part_pkg_temp RENAME TO h_part_pkg;
+CREATE INDEX h_part_pkg1 ON h_part_pkg(disabled);
+
+On modern Pg:
+ALTER TABLE h_part_pkg DROP CONSTRAINT h_part_pkg_temp_pkey;
+ALTER TABLE h_part_pkg ADD PRIMARY KEY (historynum);
+select setval('public.h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
+
+Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 and 7.2 so far):
+DROP INDEX h_part_pkg_temp_pkey;
+CREATE UNIQUE INDEX h_part_pkg_pkey ON h_part_pkg (historynum);
+probably this one?: select setval('h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
+probably not this one?: select setval('h_part_pkg_historynum_seq', ( select max(historynum) from h_part_pkg) );
+
+CREATE TABLE cust_pay_refund (
+ payrefundnum serial NOT NULL,
+ paynum int NOT NULL,
+ refundnum int NOT NULL,
+ _date int NOT NULL,
+ amount decimal(10,2) NOT NULL,
+ PRIMARY KEY (payrefundnum)
+);
+CREATE INDEX cust_pay_refund1 ON cust_pay_refund(paynum);
+CREATE INDEX cust_pay_refund2 ON cust_pay_refund(refundnum);
-ALTER TABLE cust_main ALTER COLUMN payinfo varchar(512) NULL;
-ALTER TABLE h_cust_main ALTER COLUMN payinfo varchar(512) NULL;
+CREATE TABLE cust_pay_void (
+ paynum int NOT NULL,
+ custnum int NOT NULL,
+ paid decimal(10,2) NOT NULL,
+ _date int,
+ payby char(4) NOT NULL,
+ payinfo varchar(80),
+ paybatch varchar(80),
+ closed char(1),
+ void_date int,
+ reason varchar(80),
+ otaker varchar(32) NOT NULL,
+ PRIMARY KEY (paynum)
+);
+CREATE INDEX cust_pay_void1 ON cust_pay_void(custnum);
-Or on older Pg versions that don't support altering columns directly:
-(dump database, edit & reload)
+CREATE TABLE part_pkg_option (
+ optionnum int primary key,
+ pkgpart int not null,
+ optionname varchar(80) not null,
+ optionvalue text NULL
+);
+CREATE INDEX part_pkg_option1 ON part_export_option ( pkgpart );
+CREATE INDEX part_pkg_option2 ON part_export_option ( optionname );
+
+CREATE TABLE rate (
+ ratenum serial NOT NULL,
+ reatename varchar(80) NOT NULL,
+ PRIMARY KEY (ratenum)
+);
+
+CREATE TABLE rate_detail (
+ ratenum int NOT NULL,
+ orig_regionnum int NULL,
+ dest_regionnum int NOT NULL,
+ min_included int NOT NULL,
+ min_charge decimal(10,2) NOT NULL,
+ sec_granularity int NOT NULL
+);
+CREATE UNIQUE INDEX rate_detail1 ON rate_detail ( ratenum, orig_regionnum, dest_regionnum );
+
+CREATE TABLE rate_region (
+ regionnum serial NOT NULL,
+ regionname varchar(80) NOT NULL,
+ PRIMARY KEY (regionnum)
+);
+
+CREATE TABLE rate_prefix (
+ prefixnum serial NOT NULL,
+ regionnum int NOT NULL,
+ countrycode varchar(3) NOT NULL,
+ npa varchar(6) NULL,
+ nxx varchar(3) NULL,
+ PRIMARY KEY (prefixnum)
+);
+CREATE INDEX rate_prefix1 ON rate_prefix ( countrycode );
+CREATE INDEX rate_prefix2 ON rate_prefix ( regionnum );
+
+DROP INDEX cust_bill_pkg1;
+
+ALTER TABLE cust_bill_pkg ADD itemdesc varchar(80) NULL;
+ALTER TABLE h_cust_bill_pkg ADD itemdesc varchar(80) NULL;
+ALTER TABLE cust_main_county ADD taxname varchar(80) NULL;
+ALTER TABLE h_cust_main_county ADD taxname varchar(80) NULL;
+ALTER TABLE cust_main_county ADD setuptax char(1) NULL;
+ALTER TABLE h_cust_main_county ADD setuptax char(1) NULL;
+ALTER TABLE cust_main_county ADD recurtax char(1) NULL;
+ALTER TABLE h_cust_main_county ADD recurtax char(1) NULL;
+ALTER TABLE cust_pkg ADD last_bill int NULL;
+ALTER TABLE h_cust_pkg ADD last_bill int NULL;
+ALTER TABLE agent ADD disabled char(1) NULL;
+ALTER TABLE h_agent ADD disabled char(1) NULL;
+ALTER TABLE agent ADD username varchar(80) NULL;
+ALTER TABLE h_agent ADD username varchar(80) NULL;
+ALTER TABLE agent ADD _password varchar(80) NULL;
+ALTER TABLE h_agent ADD _password varchar(80) NULL;
+ALTER TABLE cust_main ADD paycvv varchar(4) NULL;
+ALTER TABLE h_cust_main ADD paycvv varchar(4) NULL;
+ALTER TABLE part_referral ADD disabled char(1) NULL;
+ALTER TABLE h_part_referral ADD disabled char(1) NULL;
+CREATE INDEX part_referral1 ON part_referral ( disabled );
+ALTER TABLE pkg_svc ADD primary_svc char(1) NULL;
+ALTER TABLE h_pkg_svc ADD primary_svc char(1) NULL;
+ALTER TABLE svc_forward ADD src varchar(255) NULL;
+ALTER TABLE h_svc_forward ADD src varchar(255) NULL;
+ALTER TABLE part_pkg ADD promo_code varchar(80) NULL;
+ALTER TABLE h_part_pkg ADD promo_code varchar(80) NULL;
+CREATE INDEX part_pkg2 ON part_pkg ( promo_code );
+CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code );
On recent Pg versions:
@@ -64,30 +279,26 @@ If you created your database with a version before 1.4.2, dump database, edit:
- domain_record and h_domain_record: increase recdata from 80 to 255
then reload
-mandatory again:
+optionally:
-make install-perl-modules to install the new libraries and CLI utilities
-run "freeside-upgrade username" to create the remaining new tables and columns
+ CREATE INDEX cust_main6 ON cust_main ( daytime );
+ CREATE INDEX cust_main7 ON cust_main ( night );
+ CREATE INDEX cust_main8 ON cust_main ( fax );
+ CREATE INDEX cust_main9 ON cust_main ( ship_daytime );
+ CREATE INDEX cust_main10 ON cust_main ( ship_night );
+ CREATE INDEX cust_main11 ON cust_main ( ship_fax );
+ CREATE INDEX agent2 ON agent ( disabled );
+ CREATE INDEX part_bill_event2 ON part_bill_event ( disabled );
+ CREATE INDEX cust_pay4 ON cust_pay (_date);
-optionally:
+ serial columns
-CREATE INDEX cust_main4 ON cust_main ( daytime );
-CREATE INDEX cust_main5 ON cust_main ( night );
-CREATE INDEX cust_main6 ON cust_main ( fax );
-CREATE INDEX cust_main7 ON cust_main ( refnum );
-CREATE INDEX cust_main8 ON cust_main ( county );
-CREATE INDEX cust_main9 ON cust_main ( state );
-CREATE INDEX cust_main10 ON cust_main ( country );
-CREATE INDEX cust_main11 ON cust_main ( ship_last );
-CREATE INDEX cust_main12 ON cust_main ( ship_company );
-CREATE INDEX cust_main13 ON cust_main ( ship_daytime );
-CREATE INDEX cust_main14 ON cust_main ( ship_night );
-CREATE INDEX cust_main15 ON cust_main ( ship_fax );
-CREATE INDEX agent2 ON agent ( disabled );
-CREATE INDEX part_bill_event2 ON part_bill_event ( disabled );
-CREATE INDEX cust_pay4 ON cust_pay (_date);
-CREATE INDEX part_referral1 ON part_referral ( disabled );
-CREATE INDEX part_pkg2 ON part_pkg ( promo_code );
-CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code );
+mandatory again:
+
+dbdef-create username
+create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband acct_snarf svc_external cust_pay_refund cust_pay_void part_pkg_option rate rate_detail rate_region rate_prefix
+dbdef-create username
+
+apache - fix <Files> sections to include .html also
</pre>
diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html
index 9ca7cb7b9..cf60a8582 100644
--- a/httemplate/docs/upgrade8.html
+++ b/httemplate/docs/upgrade8.html
@@ -149,9 +149,7 @@ CREATE TABLE cust_bill_event (
eventnum int primary key,
invnum int not null,
eventpart int not null,
- _date int not null,
- status varchar(80) not null,
- statustext text
+ _date int not null
);
CREATE UNIQUE INDEX cust_bill_event1 ON cust_bill_event ( eventpart, invnum );
CREATE INDEX cust_bill_event2 ON cust_bill_event ( invnum );
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi
index 78dd0fafa..9cbab2a16 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 cb64ad8cd..8a1cb2ae1 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 61d29e0e9..000000000
--- 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 5addbbd4c..637c710ab 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 332b5b67c..000000000
--- 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 144d5405c..a18114c9d 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 96f777baa..000000000
--- 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 e0cd06f56..7b88ccbcb 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 014effd66..000000000
--- 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 3de380b31..000000000
--- 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 98e685ab8..000000000
--- 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 0370ab726..755050bd8 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 ce1c86612..485d601eb 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 32ca47af4..99bc2609f 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 60365f628..b3c389c9d 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 9749fc12d..befd9b24a 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 33cc236d0..000000000
--- 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 9cf0fc6e1..000000000
--- 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 c306bfa3f..000000000
--- 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 dd9d1dbd2..000000000
--- 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 28f892f62..23e2e6ce5 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 09a42544c..a1d36986d 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 0d0a13491..2d6b34432 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 b92b62739..000000000
--- 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 b9e4d47da..000000000
--- 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 25ecbe079..000000000
--- 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 928e3daad..477f58508 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 87c082d64..04ff5f8f7 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 4658257f3..000000000
--- 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 a009ba218..4912a3a9f 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 1771f0105..4fdc837bb 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 899d1ec45..000000000
--- 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 e74d84d53..f1b8b800b 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 3cb752850..02fa64c07 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{$_}!;
diff --git a/httemplate/elements/jsrsClient.js b/httemplate/elements/jsrsClient.js
deleted file mode 100644
index 3a2572ccb..000000000
--- a/httemplate/elements/jsrsClient.js
+++ /dev/null
@@ -1,356 +0,0 @@
-//
-// jsrsClient.js - javascript remote scripting client include
-//
-// Author: Brent Ashley [jsrs@megahuge.com]
-//
-// make asynchronous remote calls to server without client page refresh
-//
-// see license.txt for copyright and license information
-
-/*
-see history.txt for full history
-2.0 26 Jul 2001 - added POST capability for IE/MOZ
-2.2 10 Aug 2003 - added Opera support
-2.3(beta) 10 Oct 2003 - added Konqueror support - **needs more testing**
-*/
-
-// callback pool needs global scope
-var jsrsContextPoolSize = 0;
-var jsrsContextMaxPool = 10;
-var jsrsContextPool = new Array();
-var jsrsBrowser = jsrsBrowserSniff();
-var jsrsPOST = true;
-var containerName;
-
-// constructor for context object
-function jsrsContextObj( contextID ){
-
- // properties
- this.id = contextID;
- this.busy = true;
- this.callback = null;
- this.container = contextCreateContainer( contextID );
-
- // methods
- this.GET = contextGET;
- this.POST = contextPOST;
- this.getPayload = contextGetPayload;
- this.setVisibility = contextSetVisibility;
-}
-
-// method functions are not privately scoped
-// because Netscape's debugger chokes on private functions
-function contextCreateContainer( containerName ){
- // creates hidden container to receive server data
- var container;
- switch( jsrsBrowser ) {
- case 'NS':
- container = new Layer(100);
- container.name = containerName;
- container.visibility = 'hidden';
- container.clip.width = 100;
- container.clip.height = 100;
- break;
-
- case 'IE':
- document.body.insertAdjacentHTML( "afterBegin", '<span id="SPAN' + containerName + '"></span>' );
- var span = document.all( "SPAN" + containerName );
- var html = '<iframe name="' + containerName + '" src=""></iframe>';
- span.innerHTML = html;
- span.style.display = 'none';
- container = window.frames[ containerName ];
- break;
-
- case 'MOZ':
- var span = document.createElement('SPAN');
- span.id = "SPAN" + containerName;
- document.body.appendChild( span );
- var iframe = document.createElement('IFRAME');
- iframe.name = containerName;
- iframe.id = containerName;
- span.appendChild( iframe );
- container = iframe;
- break;
-
- case 'OPR':
- var span = document.createElement('SPAN');
- span.id = "SPAN" + containerName;
- document.body.appendChild( span );
- var iframe = document.createElement('IFRAME');
- iframe.name = containerName;
- iframe.id = containerName;
- span.appendChild( iframe );
- container = iframe;
- break;
-
- case 'KONQ':
- var span = document.createElement('SPAN');
- span.id = "SPAN" + containerName;
- document.body.appendChild( span );
- var iframe = document.createElement('IFRAME');
- iframe.name = containerName;
- iframe.id = containerName;
- span.appendChild( iframe );
- container = iframe;
-
- // Needs to be hidden for Konqueror, otherwise it'll appear on the page
- span.style.display = none;
- iframe.style.display = none;
- iframe.style.visibility = hidden;
- iframe.height = 0;
- iframe.width = 0;
-
- break;
- }
- return container;
-}
-
-function contextPOST( rsPage, func, parms ){
-
- var d = new Date();
- var unique = d.getTime() + '' + Math.floor(1000 * Math.random());
- var doc = (jsrsBrowser == "IE" ) ? this.container.document : this.container.contentDocument;
- doc.open();
- doc.write('<html><body>');
- doc.write('<form name="jsrsForm" method="post" target="" ');
- doc.write(' action="' + rsPage + '?U=' + unique + '">');
- doc.write('<input type="hidden" name="C" value="' + this.id + '">');
-
- // func and parms are optional
- if (func != null){
- doc.write('<input type="hidden" name="F" value="' + func + '">');
-
- if (parms != null){
- if (typeof(parms) == "string"){
- // single parameter
- doc.write( '<input type="hidden" name="P0" '
- + 'value="[' + jsrsEscapeQQ(parms) + ']">');
- } else {
- // assume parms is array of strings
- for( var i=0; i < parms.length; i++ ){
- doc.write( '<input type="hidden" name="P' + i + '" '
- + 'value="[' + jsrsEscapeQQ(parms[i]) + ']">');
- }
- } // parm type
- } // parms
- } // func
-
- doc.write('</form></body></html>');
- doc.close();
- doc.forms['jsrsForm'].submit();
-}
-
-function contextGET( rsPage, func, parms ){
-
- // build URL to call
- var URL = rsPage;
-
- // always send context
- URL += "?C=" + this.id;
-
- // func and parms are optional
- if (func != null){
- URL += "&F=" + escape(func);
-
- if (parms != null){
- if (typeof(parms) == "string"){
- // single parameter
- URL += "&P0=[" + escape(parms+'') + "]";
- } else {
- // assume parms is array of strings
- for( var i=0; i < parms.length; i++ ){
- URL += "&P" + i + "=[" + escape(parms[i]+'') + "]";
- }
- } // parm type
- } // parms
- } // func
-
- // unique string to defeat cache
- var d = new Date();
- URL += "&U=" + d.getTime();
-
- // make the call
- switch( jsrsBrowser ) {
- case 'NS':
- this.container.src = URL;
- break;
- case 'IE':
- this.container.document.location.replace(URL);
- break;
- case 'MOZ':
- this.container.src = '';
- this.container.src = URL;
- break;
- case 'OPR':
- this.container.src = '';
- this.container.src = URL;
- break;
- case 'KONQ':
- this.container.src = '';
- this.container.src = URL;
- break;
- }
-}
-
-function contextGetPayload(){
- switch( jsrsBrowser ) {
- case 'NS':
- return this.container.document.forms['jsrs_Form'].elements['jsrs_Payload'].value;
- case 'IE':
- return this.container.document.forms['jsrs_Form']['jsrs_Payload'].value;
- case 'MOZ':
- return window.frames[this.container.name].document.forms['jsrs_Form']['jsrs_Payload'].value;
- case 'OPR':
- var textElement = window.frames[this.container.name].document.getElementById("jsrs_Payload");
- case 'KONQ':
- var textElement = window.frames[this.container.name].document.getElementById("jsrs_Payload");
- return textElement.value;
- }
-}
-
-function contextSetVisibility( vis ){
- switch( jsrsBrowser ) {
- case 'NS':
- this.container.visibility = (vis)? 'show' : 'hidden';
- break;
- case 'IE':
- document.all("SPAN" + this.id ).style.display = (vis)? '' : 'none';
- break;
- case 'MOZ':
- document.getElementById("SPAN" + this.id).style.visibility = (vis)? '' : 'hidden';
- case 'OPR':
- document.getElementById("SPAN" + this.id).style.visibility = (vis)? '' : 'hidden';
- this.container.width = (vis)? 250 : 0;
- this.container.height = (vis)? 100 : 0;
- break;
- }
-}
-
-// end of context constructor
-
-function jsrsGetContextID(){
- var contextObj;
- for (var i = 1; i <= jsrsContextPoolSize; i++){
- contextObj = jsrsContextPool[ 'jsrs' + i ];
- if ( !contextObj.busy ){
- contextObj.busy = true;
- return contextObj.id;
- }
- }
- // if we got here, there are no existing free contexts
- if ( jsrsContextPoolSize <= jsrsContextMaxPool ){
- // create new context
- var contextID = "jsrs" + (jsrsContextPoolSize + 1);
- jsrsContextPool[ contextID ] = new jsrsContextObj( contextID );
- jsrsContextPoolSize++;
- return contextID;
- } else {
- alert( "jsrs Error: context pool full" );
- return null;
- }
-}
-
-function jsrsExecute( rspage, callback, func, parms, visibility ){
- // call a server routine from client code
- //
- // rspage - href to asp file
- // callback - function to call on return
- // or null if no return needed
- // (passes returned string to callback)
- // func - sub or function name to call
- // parm - string parameter to function
- // or array of string parameters if more than one
- // visibility - optional boolean to make container visible for debugging
-
- // get context
- var contextObj = jsrsContextPool[ jsrsGetContextID() ];
- contextObj.callback = callback;
-
- var vis = (visibility == null)? false : visibility;
- contextObj.setVisibility( vis );
-
- if ( jsrsPOST && ((jsrsBrowser == 'IE') || (jsrsBrowser == 'MOZ'))){
- contextObj.POST( rspage, func, parms );
- } else {
- contextObj.GET( rspage, func, parms );
- }
-
- return contextObj.id;
-}
-
-function jsrsLoaded( contextID ){
- // get context object and invoke callback
- var contextObj = jsrsContextPool[ contextID ];
- if( contextObj.callback != null){
- contextObj.callback( jsrsUnescape( contextObj.getPayload() ), contextID );
- }
- // clean up and return context to pool
- contextObj.callback = null;
- contextObj.busy = false;
-}
-
-function jsrsError( contextID, str ){
- alert( unescape(str) );
- jsrsContextPool[ contextID ].busy = false
-}
-
-function jsrsEscapeQQ( thing ){
- return thing.replace(/'"'/g, '\\"');
-}
-
-function jsrsUnescape( str ){
- // payload has slashes escaped with whacks
- return str.replace( /\\\//g, "/" );
-}
-
-function jsrsBrowserSniff(){
- if (document.layers) return "NS";
- if (document.all) {
- // But is it really IE?
- // convert all characters to lowercase to simplify testing
- var agt=navigator.userAgent.toLowerCase();
- var is_opera = (agt.indexOf("opera") != -1);
- var is_konq = (agt.indexOf("konqueror") != -1);
- if(is_opera) {
- return "OPR";
- } else {
- if(is_konq) {
- return "KONQ";
- } else {
- // Really is IE
- return "IE";
- }
- }
- }
- if (document.getElementById) return "MOZ";
- return "OTHER";
-}
-
-/////////////////////////////////////////////////
-//
-// user functions
-
-function jsrsArrayFromString( s, delim ){
- // rebuild an array returned from server as string
- // optional delimiter defaults to ~
- var d = (delim == null)? '~' : delim;
- return s.split(d);
-}
-
-function jsrsDebugInfo(){
- // use for debugging by attaching to f1 (works with IE)
- // with onHelp = "return jsrsDebugInfo();" in the body tag
- var doc = window.open().document;
- doc.open;
- doc.write( 'Pool Size: ' + jsrsContextPoolSize + '<br><font face="arial" size="2"><b>' );
- for( var i in jsrsContextPool ){
- var contextObj = jsrsContextPool[i];
- doc.write( '<hr>' + contextObj.id + ' : ' + (contextObj.busy ? 'busy' : 'available') + '<br>');
- doc.write( contextObj.container.document.location.pathname + '<br>');
- doc.write( contextObj.container.document.location.search + '<br>');
- doc.write( '<table border="1"><tr><td>' + contextObj.container.document.body.innerHTML + '</td></tr></table>' );
- }
- doc.write('</table>');
- doc.close();
- return false;
-}
diff --git a/httemplate/elements/jsrsServer.html b/httemplate/elements/jsrsServer.html
deleted file mode 100644
index fd6dc5465..000000000
--- a/httemplate/elements/jsrsServer.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<%
- my $server = new FS::UI::Web::JSRPC '', $cgi;
-%><%= $server->process %>
diff --git a/httemplate/elements/overlibmws.js b/httemplate/elements/overlibmws.js
deleted file mode 100644
index fba1105b5..000000000
--- a/httemplate/elements/overlibmws.js
+++ /dev/null
@@ -1,709 +0,0 @@
-/*
- Do not remove or change this notice.
- overlibmws.js core module - Copyright Foteos Macrides 2002-2005. All rights reserved.
- Initial: August 18, 2002 - Last Revised: February 10, 2005
- This module is subject to the same terms of usage as for Erik Bosrup's overLIB,
- though only a minority of the code and API now correspond with Erik's version.
- See the overlibmws Change History and Command Reference via:
-
- http://www.macridesweb.com/oltest/
-
- Published under an open source license: http://www.macridesweb.com/oltest/license.html
- Give credit on sites that use overlibmws and submit changes so others can use them as well.
- You can get Erik's version via: http://www.bosrup.com/web/overlib/
-*/
-
-// PRE-INIT -- Ignore these lines, configuration is below.
-var OLloaded=0,pmCnt=1,pMtr=new Array(),OLv,OLudf,OLrefXY;
-var OLpct=new Array("83%","67%","83%","100%","117%","150%","200%","267%");
-var OLbubblePI=0,OLcrossframePI=0,OLdebugPI=0,OLdraggablePI=0,OLexclusivePI=0,OLfilterPI=0;
-var OLfunctionPI=0,OLhidePI=0,OLiframePI=0,OLovertwoPI=0,OLscrollPI=0,OLshadowPI=0;
-if(typeof OLgateOK=='undefined')var OLgateOK=1;
-OLregCmds(
- 'inarray,caparray,caption,sticky,nofollow,background,noclose,mouseoff,offdelay,right,left,'
-+'center,offsetx,offsety,fgcolor,bgcolor,cgcolor,textcolor,capcolor,closecolor,width,wrap,'
-+'wrapmax,height,border,base,status,autostatus,autostatuscap,snapx,snapy,fixx,fixy,relx,rely,'
-+'midx,midy,ref,refc,refp,refx,refy,fgbackground,bgbackground,cgbackground,padx,pady,fullhtml,'
-+'below,above,vcenter,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,'
-+'timeout,delay,hauto,vauto,nojustx,nojusty,closetext,closeclick,closetitle,fgclass,bgclass,'
-+'cgclass,capbelow,textpadding,textfontclass,captionpadding,captionfontclass,closefontclass,'
-+'label,donothing');
-
-function OLud(v){return eval('typeof ol_'+v+'=="undefined"')?1:0;}
-
-// DEFAULT CONFIGURATION -- See overlibConfig.txt for descriptions.
-if(OLud('fgcolor'))var ol_fgcolor="#CCCCFF";
-if(OLud('bgcolor'))var ol_bgcolor="#333399";
-if(OLud('cgcolor'))var ol_cgcolor="#333399";
-if(OLud('textcolor'))var ol_textcolor="#000000";
-if(OLud('capcolor'))var ol_capcolor="#FFFFFF";
-if(OLud('closecolor'))var ol_closecolor="#EEEEFF";
-if(OLud('textfont'))var ol_textfont="Verdana,Arial,Helvetica";
-if(OLud('captionfont'))var ol_captionfont="Verdana,Arial,Helvetica";
-if(OLud('closefont'))var ol_closefont="Verdana,Arial,Helvetica";
-if(OLud('textsize'))var ol_textsize=1;
-if(OLud('captionsize'))var ol_captionsize=1;
-if(OLud('closesize'))var ol_closesize=1;
-if(OLud('fgclass'))var ol_fgclass="";
-if(OLud('bgclass'))var ol_bgclass="";
-if(OLud('cgclass'))var ol_cgclass="";
-if(OLud('textpadding'))var ol_textpadding=2;
-if(OLud('textfontclass'))var ol_textfontclass="";
-if(OLud('captionpadding'))var ol_captionpadding=2;
-if(OLud('captionfontclass'))var ol_captionfontclass="";
-if(OLud('closefontclass'))var ol_closefontclass="";
-if(OLud('close'))var ol_close="Close";
-if(OLud('closeclick'))var ol_closeclick=0;
-if(OLud('closetitle'))var ol_closetitle="Click to Close";
-if(OLud('text'))var ol_text="Default Text";
-if(OLud('cap'))var ol_cap="";
-if(OLud('capbelow'))var ol_capbelow=0;
-if(OLud('background'))var ol_background="";
-if(OLud('width'))var ol_width=200;
-if(OLud('wrap'))var ol_wrap=0;
-if(OLud('wrapmax'))var ol_wrapmax=0;
-if(OLud('height'))var ol_height= -1;
-if(OLud('border'))var ol_border=1;
-if(OLud('base'))var ol_base=0;
-if(OLud('offsetx'))var ol_offsetx=10;
-if(OLud('offsety'))var ol_offsety=10;
-if(OLud('sticky'))var ol_sticky=0;
-if(OLud('nofollow'))var ol_nofollow=0;
-if(OLud('noclose'))var ol_noclose=0;
-if(OLud('mouseoff'))var ol_mouseoff=0;
-if(OLud('offdelay'))var ol_offdelay=300;
-if(OLud('hpos'))var ol_hpos=RIGHT;
-if(OLud('vpos'))var ol_vpos=BELOW;
-if(OLud('status'))var ol_status="";
-if(OLud('autostatus'))var ol_autostatus=0;
-if(OLud('snapx'))var ol_snapx=0;
-if(OLud('snapy'))var ol_snapy=0;
-if(OLud('fixx'))var ol_fixx= -1;
-if(OLud('fixy'))var ol_fixy= -1;
-if(OLud('relx'))var ol_relx=null;
-if(OLud('rely'))var ol_rely=null;
-if(OLud('midx'))var ol_midx=null;
-if(OLud('midy'))var ol_midy=null;
-if(OLud('ref'))var ol_ref="";
-if(OLud('refc'))var ol_refc='UL';
-if(OLud('refp'))var ol_refp='UL';
-if(OLud('refx'))var ol_refx=0;
-if(OLud('refy'))var ol_refy=0;
-if(OLud('fgbackground'))var ol_fgbackground="";
-if(OLud('bgbackground'))var ol_bgbackground="";
-if(OLud('cgbackground'))var ol_cgbackground="";
-if(OLud('padxl'))var ol_padxl=1;
-if(OLud('padxr'))var ol_padxr=1;
-if(OLud('padyt'))var ol_padyt=1;
-if(OLud('padyb'))var ol_padyb=1;
-if(OLud('fullhtml'))var ol_fullhtml=0;
-if(OLud('capicon'))var ol_capicon="";
-if(OLud('frame'))var ol_frame=self;
-if(OLud('timeout'))var ol_timeout=0;
-if(OLud('delay'))var ol_delay=0;
-if(OLud('hauto'))var ol_hauto=0;
-if(OLud('vauto'))var ol_vauto=0;
-if(OLud('nojustx'))var ol_nojustx=0;
-if(OLud('nojusty'))var ol_nojusty=0;
-if(OLud('label'))var ol_label="";
-// ARRAY CONFIGURATION - See overlibConfig.txt for descriptions.
-if(OLud('texts'))var ol_texts=new Array("Text 0","Text 1");
-if(OLud('caps'))var ol_caps=new Array("Caption 0","Caption 1");
-// END CONFIGURATION -- Don't change anything below, all configuration is above.
-
-// INIT -- Runtime variables.
-var o3_text="",o3_cap="",o3_sticky=0,o3_nofollow=0,o3_background="",o3_noclose=0,o3_mouseoff=0;
-var o3_offdelay=300,o3_hpos=RIGHT,o3_offsetx=10,o3_offsety=10,o3_fgcolor="",o3_bgcolor="";
-var o3_cgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=200,o3_wrap=0;
-var o3_wrapmax=0,o3_height= -1,o3_border=1,o3_base=0,o3_status="",o3_autostatus=0,o3_snapx=0;
-var o3_snapy=0,o3_fixx= -1,o3_fixy= -1,o3_relx=null,o3_rely=null,o3_midx=null,o3_midy=null;
-var o3_ref="",o3_refc='UL',o3_refp='UL',o3_refx=0,o3_refy=0,o3_fgbackground="";
-var o3_bgbackground="",o3_cgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0;
-var o3_fullhtml=0,o3_vpos=BELOW,o3_capicon="",o3_textfont="Verdana,Arial,Helvetica";
-var o3_captionfont="Verdana,Arial,Helvetica",o3_closefont="Verdana,Arial,Helvetica";
-var o3_textsize=1,o3_captionsize=1,o3_closesize=1,o3_frame=self,o3_timeout=0,o3_delay=0;
-var o3_hauto=0,o3_vauto=0,o3_nojustx=0,o3_nojusty=0,o3_close="Close",o3_closeclick=0;
-var o3_closetitle="",o3_fgclass="",o3_bgclass="",o3_cgclass="",o3_textpadding=2;
-var o3_textfontclass="",o3_captionpadding=2,o3_captionfontclass="",o3_closefontclass="";
-var o3_capbelow=0,o3_label="",CSSOFF=DONOTHING,CSSCLASS=DONOTHING;
-var OLx=0,OLy=0,OLshowingsticky=0,OLallowmove=0,OLremovecounter=0;
-var OLdelayid=0,OLtimerid=0,OLshowid=0,OLndt=0;
-var over=null,OLfnRef="",OLhover=0;
-var OLua=navigator.userAgent.toLowerCase();
-var OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4);
-var OLns6=(document.getElementById)?1:0;
-var OLie4=(document.all)?1:0;
-var OLgek=(OLv=OLua.match(/gecko\/(\d{8})/i))?parseInt(OLv[1]):0;
-var OLmac=(OLua.indexOf('mac')>=0)?1:0;
-var OLsaf=(OLua.indexOf('safari')>=0)?1:0;
-var OLkon=(OLua.indexOf('konqueror')>=0)?1:0;
-var OLkht=(OLsaf||OLkon)?1:0;
-var OLopr=(OLua.indexOf('opera')>=0)?1:0;
-var OLop7=(OLopr&&document.createTextNode)?1:0;
-if(OLopr){OLns4=OLns6=0;if(!OLop7)OLie4=0;}
-var OLieM=((OLie4&&OLmac)&&!(OLkht||OLopr))?1:0;
-var OLie5=0,OLie55=0;if(OLie4&&!OLop7){
-if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){
-OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;}if(OLns6)OLie4=0;}
-if(OLns4)window.onresize=function(){location.reload();}
-var OLchkMh=1,OLdw;
-if(OLns4||OLie4||OLns6)OLmh();
-else{overlib=nd=cClick=OLpageDefaults=no_overlib;}
-
-/*
- PUBLIC FUNCTIONS
-*/
-// Loads defaults then args into runtime variables.
-function overlib(){
-if(!(OLloaded&&OLgateOK))return;
-if((OLexclusivePI)&&OLisExclusive(overlib.arguments))return true;
-if(OLchkMh)OLmh();
-if(OLndt&&!OLtimerid)OLndt=0;if(over)cClick();
-OLloadP1or2();OLload('close,closeclick,closetitle,noclose,mouseoff,offdelay,sticky,'
-+'closecolor,closefont,closesize,closefontclass,frame,label');OLfnRef="";OLhover=0;
-OLsetRunTimeVar();
-OLparseTokens('o3_',overlib.arguments);
-if(!(over=OLmkLyr()))return false;
-if(OLbubblePI)OLchkForBubbleEffect();
-if(OLdebugPI)OLsetDebugCanShow();
-if(OLshadowPI)OLinitShadow();
-if(OLiframePI)OLinitIfs();
-if(OLfilterPI)OLinitFilterLyr();
-if(OLexclusivePI&&o3_exclusive&&o3_exclusivestatus!="")o3_status=o3_exclusivestatus;
-else if(o3_autostatus==2&&o3_cap!="")o3_status=o3_cap;
-else if(o3_autostatus==1&&o3_text!="")o3_status=o3_text;
-if(o3_delay==0){return OLmain();
-}else{OLdelayid=setTimeout("OLmain()",o3_delay);
-if(o3_status!=""){self.status=o3_status;return true;}
-else if(!(OLop7&&event&&event.type=='mouseover'))return false;}
-}
-
-// Clears popups if appropriate
-function nd(time){
-if(!(OLloaded&&OLgateOK))return;
-if((OLexclusivePI)&&OLisExclusive())return true;
-if(time&&over&&!o3_delay){if(OLtimerid>0)clearTimeout(OLtimerid);
-OLtimerid=(OLhover&&o3_frame==self&&!OLcursorOff())?0:
-setTimeout("cClick()",(o3_timeout=OLndt=time));
-}else{if(OLremovecounter>=1)OLshowingsticky=0;if(!OLshowingsticky){
-OLallowmove=0;if(over)OLhideObject(over);}else{OLremovecounter++;}}
-return true;
-}
-
-// Close function for stickies
-function cClick(){
-if(OLloaded&&OLgateOK){OLhover=0;if(over)OLhideObject(over);OLshowingsticky=0;}
-return false;
-}
-
-// Sets page-specific defaults.
-function OLpageDefaults(){
-OLparseTokens('ol_',OLpageDefaults.arguments);
-}
-
-// For unsupported browsers.
-function no_overlib(){return false;}
-
-/*
- OVERLIB MAIN FUNCTION SET
-*/
-function OLmain(){
-o3_delay=0;
-if(o3_frame==self){if(o3_noclose)OLoptMOUSEOFF(0);else if(o3_mouseoff)OLoptMOUSEOFF(1);}
-OLdoLyr();
-OLallowmove=0;if(o3_timeout>0){
-if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("cClick()",o3_timeout);}
-if(o3_ref){OLrefXY=OLgetRefXY(o3_ref);if(OLrefXY[0]==null){o3_ref="";o3_midx=0;o3_midy=0;}}
-OLdisp(o3_status);
-if(OLdraggablePI)OLcheckDrag();
-if(o3_status!="")return true;else if(!(OLop7&&event&&event.type=='mouseover'))return false;
-}
-
-// Loads defaults for primaries or secondaries
-function OLloadP1or2(){
-OLload('text,cap,capbelow,textpadding,captionpadding,border,base,status,autostatus,nofollow,'
-+'width,wrap,wrapmax,height,hpos,vpos,offsetx,offsety,snapx,snapy,relx,rely,midx,midy,ref,'
-+'refc,refp,refx,refy,fixx,fixy,nojustx,nojusty,hauto,vauto,timeout,delay,fgcolor,bgcolor,'
-+'cgcolor,textcolor,capcolor,textfont,captionfont,textsize,captionsize,fgbackground,'
-+'bgbackground,cgbackground,capicon,background,padxl,padxr,padyt,padyb,fullhtml,fgclass,'
-+'bgclass,cgclass,textfontclass,captionfontclass');
-}
-function OLload(c){var i,m=c.split(',');for(i=0;i<m.length;i++)eval('o3_'+m[i]+'=ol_'+m[i]);}
-
-// Chooses LGF
-function OLdoLGF(){
-return (o3_background!=''||o3_fullhtml)?OLcontentBackground(o3_text,o3_background,o3_fullhtml):
-(o3_cap=="")?OLcontentSimple(o3_text):
-(o3_sticky)?OLcontentCaption(o3_text,o3_cap,o3_close):OLcontentCaption(o3_text,o3_cap,'');
-}
-
-// Makes Layer
-function OLmkLyr(id,f,z){
-id=(id||'overDiv');f=(f||o3_frame);z=(z||1000);var fd=f.document,d=OLgetRefById(id,fd);
-if(!d){if(OLns4)d=fd.layers[id]=new Layer(1024,f);else if(OLie4&&!document.getElementById){
-fd.body.insertAdjacentHTML('BeforeEnd','<div id="'+id+'"></div>');d=fd.all[id];
-}else{d=fd.createElement('div');if(d){d.id=id;fd.body.appendChild(d);}}if(!d)return null;
-if(OLns4)d.zIndex=z;else{var o=d.style;o.position='absolute';o.visibility='hidden';o.zIndex=z;}}
-return d;
-}
-
-// Creates and writes layer content
-function OLdoLyr(){
-if(o3_background==''&&!o3_fullhtml){
-if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"';
-if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"';
-if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"';
-if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"';
-if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"';
-if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"';
-if(o3_height>0)o3_height=' height="'+o3_height+'"';else o3_height='';}
-if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);var lyrHtml=OLdoLGF();
-if(o3_sticky){if(OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}
-OLshowingsticky=1;OLremovecounter=0;}
-if(o3_wrap&&!o3_fullhtml){OLlayerWrite(lyrHtml);
-o3_width=(OLns4?over.clip.width:over.offsetWidth);
-if(OLns4&&o3_wrapmax<1)o3_wrapmax=o3_frame.innerWidth-40;
-o3_wrap=0;if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;lyrHtml=OLdoLGF();}
-OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);
-if(OLbubblePI)OLgenerateBubble(lyrHtml);
-}
-
-/*
- LAYER GENERATION FUNCTIONS
-*/
-// Makes simple table without caption
-function OLcontentSimple(txt){
-var t=OLbgLGF()+OLfgLGF(txt)+OLbaseLGF();
-OLsetBackground('');return t;
-}
-
-// Makes table with caption and optional close link
-function OLcontentCaption(txt,title,close){
-var closing='',closeevent='onmouseover',caption,t;
-if(o3_closeclick==1)closeevent=(o3_closetitle?'title="'+o3_closetitle+'" ':'')+'onclick';
-if(o3_capicon!='')o3_capicon='<img src="'+o3_capicon+'" /> ';
-if(close!=''){closing='<td align="right"><a href="javascript:return '+OLfnRef+'cClick();" '
-+closeevent+'="return '+OLfnRef+'cClick();"'+(o3_closefontclass?' class="'+o3_closefontclass
-+'">':'>'+OLlgfUtil(0,'','span',o3_closecolor,o3_closefont,o3_closesize))+close
-+(o3_closefontclass?'':OLlgfUtil(1,'','span'))+'</a></td>';}
-caption='<table'+OLwd(0)+' border="0" cellpadding="'+o3_captionpadding+'" cellspacing="0"'
-+(o3_cgclass?' class="'+o3_cgclass+'"':o3_cgcolor+o3_cgbackground)+'><tr><td'+OLwd(0)
-+(o3_cgclass?' class="'+o3_cgclass+'">':'>')+(o3_captionfontclass?'<div class="'
-+o3_captionfontclass+'">':'<strong>'
-+OLlgfUtil(0,'','div',o3_capcolor,o3_captionfont,o3_captionsize))+o3_capicon+title
-+OLlgfUtil(1,'','div')+(o3_captionfontclass?'':'</strong>')+'</td>'+closing+'</tr></table>';
-t=OLbgLGF()+(o3_capbelow?OLfgLGF(txt)+caption:caption+OLfgLGF(txt))+OLbaseLGF();
-OLsetBackground('');return t;
-}
-
-// For BACKGROUND and FULLHTML commands
-function OLcontentBackground(txt, image, hasfullhtml){
-var t;if(hasfullhtml){t=txt;}else{t='<table'+OLwd(1)
-+' border="0" cellpadding="0" cellspacing="0" '+'height="'+o3_height
-+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'
-+o3_padxl+'"></td><td valign="top"'+OLwd(2)+'>'
-+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+txt+
-OLlgfUtil(1,'','div')+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'
-+o3_padyb+'"></td></tr></table>';}
-OLsetBackground(image);return t;
-}
-
-// LGF utilities
-function OLbgLGF(){
-return '<table'+OLwd(1)+o3_height+' border="0" cellpadding="'+o3_border+'" cellspacing="0"'
-+(o3_bgclass?' class="'+o3_bgclass+'"':o3_bgcolor+o3_bgbackground)+'><tr><td>';
-}
-function OLfgLGF(t){
-return '<table'+OLwd(0)+o3_height+' border="0" cellpadding="'+o3_textpadding
-+'" cellspacing="0"'+(o3_fgclass?' class="'+o3_fgclass+'"':o3_fgcolor+o3_fgbackground)
-+'><tr><td valign="top"'+(o3_fgclass?' class="'+o3_fgclass+'"':'')+'>'
-+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+t
-+OLlgfUtil(1,'','div')+'</td></tr></table>';
-}
-function OLlgfUtil(end,tfc,ele,col,fac,siz){
-if(end)return ('</'+(OLns4?'font':ele)+'>');else return (tfc?'<div class="'+tfc+'">':
-('<'+(OLns4?'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:ele
-+' style="color:'+col+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';'
-+(ele=='span'?'text-decoration:underline;':''))+'">'));
-}
-function OLquoteMultiNameFonts(f){
-var i,v,pM=f.split(',');
-for(i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');
-if(/\s/.test(v) && !/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}
-return pM.join();
-}
-function OLbaseLGF(){
-return ((o3_base>0&&!o3_wrap)?('<table width="100%" border="0" cellpadding="0" cellspacing="0"'
-+(o3_bgclass?' class="'+o3_bgclass+'"':'')+'><tr><td height="'+o3_base
-+'"></td></tr></table>'):'')+'</td></tr></table>';
-}
-function OLwd(a){
-return(o3_wrap?'':' width="'+(!a?'100%':(a==1?o3_width:(o3_width-o3_padxl-o3_padxr)))+'"');
-}
-
-// Loads image into the div.
-function OLsetBackground(i){
-if(i==''){if(OLns4)over.background.src=null;
-else{if(OLns6)over.style.width='';over.style.backgroundImage='none';}
-}else{if(OLns4)over.background.src=i;
-else{if(OLns6)over.style.width=o3_width+'px';over.style.backgroundImage='url('+i+')';}}
-}
-
-/*
- HANDLING FUNCTIONS
-*/
-// Displays layer
-function OLdisp(s){
-if(OLallowmove==0){if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfs();OLplaceLayer();
-if(OLndt)OLshowObject(over);else OLshowid=setTimeout("OLshowObject(over)",1);
-OLallowmove=(o3_sticky||o3_nofollow)?0:1;}OLndt=0;if(s!="")self.status=s;
-}
-
-// Decides placement of layer.
-function OLplaceLayer(){
-var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0;
-var o=OLfd(),nsb=(OLgek>=20010505&&!o3_frame.scrollbars.visible)?1:0;
-if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth;
-else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));
-if(SB>20)SB=20;iWd=o3_frame.innerWidth;}
-pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset;
-if(OLie55&&OLfilterPI&&o3_filtershadow)SB=CX=5;else
-if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0);
-LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);}
-if(o3_ref!=""||o3_fixx> -1||o3_relx!=null||o3_midx!=null){
-if(o3_ref!=""){
-X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filtershadow){if(o3_refp=='UR'||o3_refp=='LR')X -= 5;}
-else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){
-if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X += o3_shadowx;
-else if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X -= o3_shadowx;}
-}else{if(o3_midx!=null){
-X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx);
-}else{if(o3_relx!=null){
-if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB;
-}else{
-X=o3_fixx+LM;}}}
-}else{
-if(o3_hauto){
-if(o3_hpos==LEFT&&OLx-pgLeft<iWd/2&&OLx-pWd-o3_offsetx<pgLeft+LM)o3_hpos=RIGHT;else
-if(o3_hpos==RIGHT&&OLx-pgLeft>iWd/2&&OLx+pWd+o3_offsetx>pgLeft+iWd-SB)o3_hpos=LEFT;}
-X=(o3_hpos==CENTER)?parseInt(OLx-((pWd+CX)/2)+o3_offsetx):
-(o3_hpos==LEFT)?OLx-o3_offsetx-pWd:OLx+o3_offsetx;
-if(o3_snapx>1){
-snp=X % o3_snapx;
-if(o3_hpos==LEFT){X=X-(o3_snapx+snp);}else{X=X+(o3_snapx-snp);}}}
-if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB)
-X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM<pgLeft)X=pgLeft+LM;
-pgTop=OLie4?o.scrollTop:o3_frame.pageYOffset;
-if(!OLkht&&!nsb&&o&&o.clientHeight)iHt=o.clientHeight;
-else if(o3_frame.innerHeight)iHt=o3_frame.innerHeight;
-if(OLbubblePI&&o3_bubble)pHt=OLbubbleHt;else pHt=OLns4?over.clip.height:over.offsetHeight;
-if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){TM=(o3_shadowy<0)?Math.abs(o3_shadowy):0;
-if(OLie55&&OLfilterPI&&o3_filtershadow)BM=CY=5;else
-BM=(o3_shadowy>0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);}
-if(o3_ref!=""||o3_fixy> -1||o3_rely!=null||o3_midy!=null){
-if(o3_ref!=""){
-Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filtershadow){if(o3_refp=='LL'||o3_refp=='LR')Y -= 5;}
-else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){
-if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y+=o3_shadowy;else
-if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;}
-}else{if(o3_midy!=null){
-Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy);
-}else{if(o3_rely!=null){
-if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{
-Y=o3_fixy+TM;}}}
-}else{
-if(o3_vauto){
-if(o3_vpos==ABOVE&&OLy-pgTop<iHt/2&&OLy-pHt-o3_offsety<pgTop)o3_vpos=BELOW;else
-if(o3_vpos==BELOW&&OLy-pgTop>iHt/2&&OLy+pHt+o3_offsety+((OLns4||OLkht)?17:0)>pgTop+iHt-BM)
-o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(OLy-((pHt+CY)/2)+o3_offsety):
-(o3_vpos==ABOVE)?OLy-(pHt+o3_offsety+BM):OLy+o3_offsety+TM;
-if(o3_snapy>1){
-snp=Y % o3_snapy;
-if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snp);}else{Y=Y+(o3_snapy-snp);}}}
-if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM<pgTop)Y=pgTop+TM;
-OLrepositionTo(over,X,Y);
-if(OLshadowPI)OLrepositionShadow(X,Y);if(OLiframePI)OLrepositionIfs(X,Y);
-if(OLns6&&o3_frame.innerHeight){iHt=o3_frame.innerHeight;OLrepositionTo(over,X,Y);}
-if(OLscrollPI)OLchkScroll(X-pgLeft,Y-pgTop);
-}
-
-// Chooses body or documentElement
-function OLfd(f){
-var fd=((f)?f:o3_frame).document,fdc=fd.compatMode,fdd=fd.documentElement;
-return (!OLop7&&fdc&&fdc!='BackCompat'&&fdd&&fdd.clientWidth)?fd.documentElement:fd.body;
-}
-
-// Gets location of REFerence object
-function OLgetRefXY(r){
-var mn=r,mr=OLgetRef(mn),o,of,rXY;
-if(!mr)return [null,null];
-o=mr;rXY=[o3_refx,o3_refy];
-if(OLns4){if(typeof mr.length!='undefined'&&mr.length>1){
-o=mr[0];rXY[0]+=mr[0].x+mr[1].pageX;rXY[1]+=mr[0].y+mr[1].pageY;
-}else{if((mr.toString().indexOf('Image')!= -1)||(mr.toString().indexOf('Anchor')!= -1)){
-rXY[0]+=mr.x;rXY[1]+=mr.y;}else{rXY[0]+=mr.pageX;rXY[1]+=mr.pageY;}}
-}else{rXY[0]+=OLpageLoc(mr,'Left');rXY[1]+=OLpageLoc(mr,'Top');}
-of=OLgetRefOffsets(o);rXY[0]+=of[0];rXY[1]+=of[1];
-return rXY;
-}
-function OLgetRef(l){var r=OLgetRefById(l);return (r)?r:OLgetRefByName(l);}
-
-// Seeks REFerence by id
-function OLgetRefById(l,d){
-var r="",j;l=(l||'overDiv');d=(d||o3_frame.document);
-if(OLie4&&d.all){return d.all[l];}else if(d.getElementById){return d.getElementById(l);
-}else if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l];
-for(j=0;j<d.layers.length;j++){r=OLgetRefById(l,d.layers[j].document);if(r)return r;}}
-return null;
-}
-
-// Seeks REFerence by name (for img and a)
-function OLgetRefByName(l,d){
-var r=null,j;d=(d||o3_frame.document);
-if(typeof d.images[l]!='undefined'&&d.images[l]){return d.images[l];
-}else if(typeof d.anchors[l]!='undefined'&&d.anchors[l]){return d.anchors[l];
-}else if(d.layers&&d.layers.length>0){
-for(j=0;j<d.layers.length;j++){r=OLgetRefByName(l,d.layers[j].document);
-if(r&&r.length>0)return r;else if(r)return [r,d.layers[j]];}}
-return null;
-}
-
-// Gets layer vs REFerence offsets
-function OLgetRefOffsets(o){
-var mc=o3_refc.toUpperCase(),mp=o3_refp.toUpperCase(),mW=0,mH=0,pW=0,pH=0,off=[0,0];
-pW=(OLbubblePI&&o3_bubble)?o3_width:OLns4?over.clip.width:over.offsetWidth;
-pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?over.clip.height:over.offsetHeight;
-if((!OLop7)&&o.toString().indexOf('Image')!= -1){mW=o.width;mH=o.height;
-}else if((!OLop7)&&o.toString().indexOf('Anchor')!= -1){mc=o3_refc='UL';}else{
-mW=(OLns4)?o.clip.width:o.offsetWidth;mH=(OLns4)?o.clip.height:o.offsetHeight;}
-if(mc=='UL'){off=(mp=='UR')?[-pW,0]:(mp=='LL')?[0,-pH]:(mp=='LR')?[-pW,-pH]:[0,0];
-}else if(mc=='UR'){off=(mp=='UR')?[mW-pW,0]:(mp=='LL')?[mW,-pH]:(mp=='LR')?[mW-pW,-pH]:[mW,0];
-}else if(mc=='LL'){off=(mp=='UR')?[-pW,mH]:(mp=='LL')?[0,mH-pH]:(mp=='LR')?[-pW,mH-pH]:[0,mH];
-}else if(mc=='LR'){off=(mp=='UR')?[mW-pW,mH]:(mp=='LL')?[mW,mH-pH]:(mp=='LR')?[mW-pW,mH-pH]:
-[mW,mH];}
-return off;
-}
-
-// Gets x or y location of object
-function OLpageLoc(o,t){
-var l=0;while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){
-l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t];
-return l;
-}
-
-// Moves layer
-function OLmouseMove(e){
-var e=(e||event);
-OLx=(e.pageX||e.clientX+OLfd().scrollLeft);OLy=(e.pageY||e.clientY+OLfd().scrollTop);
-if((OLallowmove&&over)&&(o3_frame==self||over==OLgetRefById())){
-OLplaceLayer();if(OLhidePI)OLhideUtil(0,1,1,0,0,0);}
-if(OLhover&&over&&o3_frame==self&&OLcursorOff())if(o3_offdelay<1)cClick();else
-{if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("cClick()",o3_offdelay);}
-}
-
-// Capture mouse and chain other scripts.
-function OLmh(){
-var fN,f,j,k,s,mh=OLmouseMove,w=(OLns4&&window.onmousemove),re=/function[ ]*(\w*)\(/;
-OLdw=document;if(document.onmousemove||w){if(w)OLdw=window;f=OLdw.onmousemove.toString();
-fN=f.match(re);if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMh=0;return;}
-if(fN[1])s=fN[1]+'(e)';else{j=f.indexOf('{');k=f.lastIndexOf('}')+1;s=f.substring(j,k);}
-s+=';OLmouseMove(e);';mh=new Function('e',s);}
-OLdw.onmousemove=mh;if(OLns4)OLdw.captureEvents(Event.MOUSEMOVE);
-}
-
-/*
- PARSING
-*/
-function OLparseTokens(pf,ar){
-var i,v,md= -1,par=(pf!='ol_'),e=eval,p=OLpar,q=OLparQuo,t=OLtoggle;OLudf=(par&&!ar.length?1:0);
-for(i=0;i< ar.length;i++){if(md<0){if(typeof ar[i]=='number'){OLudf=(par?1:0);i--;}
-else{switch(pf){case 'ol_':ol_text=ar[i];break;default:o3_text=ar[i];}}md=0;
-}else{
-if(ar[i]==INARRAY){OLudf=0;e(pf+'text=ol_texts['+ar[++i]+']');continue;}
-if(ar[i]==CAPARRAY){e(pf+'cap=ol_caps['+ar[++i]+']');continue;}
-if(ar[i]==CAPTION){q(ar[++i],pf+'cap');continue;}
-if(Math.abs(ar[i])==STICKY){t(ar[i],pf+'sticky');continue;}
-if(Math.abs(ar[i])==NOFOLLOW){t(ar[i],pf+'nofollow');continue;}
-if(ar[i]==BACKGROUND){q(ar[++i],pf+'background');continue;}
-if(Math.abs(ar[i])==NOCLOSE){t(ar[i],pf+'noclose');continue;}
-if(Math.abs(ar[i])==MOUSEOFF){t(ar[i],pf+'mouseoff');continue;}
-if(ar[i]==OFFDELAY){p(ar[++i],pf+'offdelay');continue;}
-if(ar[i]==RIGHT||ar[i]==LEFT||ar[i]==CENTER){p(ar[i],pf+'hpos');continue;}
-if(ar[i]==OFFSETX){p(ar[++i],pf+'offsetx');continue;}
-if(ar[i]==OFFSETY){p(ar[++i],pf+'offsety');continue;}
-if(ar[i]==FGCOLOR){q(ar[++i],pf+'fgcolor');continue;}
-if(ar[i]==BGCOLOR){q(ar[++i],pf+'bgcolor');continue;}
-if(ar[i]==CGCOLOR){q(ar[++i],pf+'cgcolor');continue;}
-if(ar[i]==TEXTCOLOR){q(ar[++i],pf+'textcolor');continue;}
-if(ar[i]==CAPCOLOR){q(ar[++i],pf+'capcolor');continue;}
-if(ar[i]==CLOSECOLOR){q(ar[++i],pf+'closecolor');continue;}
-if(ar[i]==WIDTH){p(ar[++i],pf+'width');continue;}
-if(Math.abs(ar[i])==WRAP){t(ar[i],pf+'wrap');continue;}
-if(ar[i]==WRAPMAX){p(ar[++i],pf+'wrapmax');continue;}
-if(ar[i]==HEIGHT){p(ar[++i],pf+'height');continue;}
-if(ar[i]==BORDER){p(ar[++i],pf+'border');continue;}
-if(ar[i]==BASE){p(ar[++i],pf+'base');continue;}
-if(ar[i]==STATUS){q(ar[++i],pf+'status');continue;}
-if(Math.abs(ar[i])==AUTOSTATUS){v=pf+'autostatus';
-e(v+'=('+ar[i]+'<0)?('+v+'==2?2:0):('+v+'==1?0:1)');continue;}
-if(Math.abs(ar[i])==AUTOSTATUSCAP){v=pf+'autostatus';
-e(v+'=('+ar[i]+'<0)?('+v+'==1?1:0):('+v+'==2?0:2)');continue;}
-if(ar[i]==CLOSETEXT){q(ar[++i],pf+'close');continue;}
-if(ar[i]==SNAPX){p(ar[++i],pf+'snapx');continue;}
-if(ar[i]==SNAPY){p(ar[++i],pf+'snapy');continue;}
-if(ar[i]==FIXX){p(ar[++i],pf+'fixx');continue;}
-if(ar[i]==FIXY){p(ar[++i],pf+'fixy');continue;}
-if(ar[i]==RELX){p(ar[++i],pf+'relx');continue;}
-if(ar[i]==RELY){p(ar[++i],pf+'rely');continue;}
-if(ar[i]==MIDX){p(ar[++i],pf+'midx');continue;}
-if(ar[i]==MIDY){p(ar[++i],pf+'midy');continue;}
-if(ar[i]==REF){q(ar[++i],pf+'ref');continue;}
-if(ar[i]==REFC){q(ar[++i],pf+'refc');continue;}
-if(ar[i]==REFP){q(ar[++i],pf+'refp');continue;}
-if(ar[i]==REFX){p(ar[++i],pf+'refx');continue;}
-if(ar[i]==REFY){p(ar[++i],pf+'refy');continue;}
-if(ar[i]==FGBACKGROUND){q(ar[++i],pf+'fgbackground');continue;}
-if(ar[i]==BGBACKGROUND){q(ar[++i],pf+'bgbackground');continue;}
-if(ar[i]==CGBACKGROUND){q(ar[++i],pf+'cgbackground');continue;}
-if(ar[i]==PADX){p(ar[++i],pf+'padxl');p(ar[++i],pf+'padxr');continue;}
-if(ar[i]==PADY){p(ar[++i],pf+'padyt');p(ar[++i],pf+'padyb');continue;}
-if(Math.abs(ar[i])==FULLHTML){t(ar[i],pf+'fullhtml');continue;}
-if(ar[i]==BELOW||ar[i]==ABOVE||ar[i]==VCENTER){p(ar[i],pf+'vpos');continue;}
-if(ar[i]==CAPICON){q(ar[++i],pf+'capicon');continue;}
-if(ar[i]==TEXTFONT){q(ar[++i],pf+'textfont');continue;}
-if(ar[i]==CAPTIONFONT){q(ar[++i],pf+'captionfont');continue;}
-if(ar[i]==CLOSEFONT){q(ar[++i],pf+'closefont');continue;}
-if(ar[i]==TEXTSIZE){q(ar[++i],pf+'textsize');continue;}
-if(ar[i]==CAPTIONSIZE){q(ar[++i],pf+'captionsize');continue;}
-if(ar[i]==CLOSESIZE){q(ar[++i],pf+'closesize');continue;}
-if(ar[i]==TIMEOUT){p(ar[++i],pf+'timeout');continue;}
-if(ar[i]==DELAY){p(ar[++i],pf+'delay');continue;}
-if(Math.abs(ar[i])==HAUTO){t(ar[i],pf+'hauto');continue;}
-if(Math.abs(ar[i])==VAUTO){t(ar[i],pf+'vauto');continue;}
-if(Math.abs(ar[i])==NOJUSTX){t(ar[i],pf+'nojustx');continue;}
-if(Math.abs(ar[i])==NOJUSTY){t(ar[i],pf+'nojusty');continue;}
-if(Math.abs(ar[i])==CLOSECLICK){t(ar[i],pf+'closeclick');continue;}
-if(ar[i]==CLOSETITLE){q(ar[++i],pf+'closetitle');continue;}
-if(ar[i]==FGCLASS){q(ar[++i],pf+'fgclass');continue;}
-if(ar[i]==BGCLASS){q(ar[++i],pf+'bgclass');continue;}
-if(ar[i]==CGCLASS){q(ar[++i],pf+'cgclass');continue;}
-if(ar[i]==TEXTPADDING){p(ar[++i],pf+'textpadding');continue;}
-if(ar[i]==TEXTFONTCLASS){q(ar[++i],pf+'textfontclass');continue;}
-if(ar[i]==CAPTIONPADDING){p(ar[++i],pf+'captionpadding');continue;}
-if(ar[i]==CAPTIONFONTCLASS){q(ar[++i],pf+'captionfontclass');continue;}
-if(ar[i]==CLOSEFONTCLASS){q(ar[++i],pf+'closefontclass');continue;}
-if(Math.abs(ar[i])==CAPBELOW){t(ar[i],pf+'capbelow');continue;}
-if(ar[i]==LABEL){q(ar[++i],pf+'label');continue;}
-if(ar[i]==DONOTHING){continue;}
-i=OLparseCmdLine(pf,i,ar);}}
-if((OLfunctionPI)&&OLudf&&o3_function)o3_text=o3_function();
-if(pf=='o3_')OLfontSize();
-}
-function OLpar(a,v){eval(v+'='+a);}
-function OLparQuo(a,v){eval(v+"='"+OLescSglQt(a)+"'");}
-function OLescSglQt(s){return s.toString().replace(/'/g,"\\'");}
-function OLtoggle(a,v){eval(v+'=('+v+'==0&&'+a+'>=0)?1:0');}
-function OLhasDims(s){return /[%\-a-z]+$/.test(s);}
-function OLfontSize(){
-var i;if(OLhasDims(o3_textsize)){if(OLns4)o3_textsize="2";}else
-if(!OLns4){i=parseInt(o3_textsize);o3_textsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
-if(OLhasDims(o3_captionsize)){if(OLns4)o3_captionsize="2";}else
-if(!OLns4){i=parseInt(o3_captionsize);o3_captionsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
-if(OLhasDims(o3_closesize)){if(OLns4)o3_closesize="2";}else
-if(!OLns4){i=parseInt(o3_closesize);o3_closesize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
-}
-
-/*
- LAYER FUNCTIONS
-*/
-// Writes to layer
-function OLlayerWrite(t){
-t+="\n";
-if(OLns4){over.document.write(t);over.document.close();
-}else if(typeof over.innerHTML!='undefined'){if(OLieM)over.innerHTML='';over.innerHTML=t;
-}else{range=o3_frame.document.createRange();range.setStartAfter(over);
-domfrag=range.createContextualFragment(t);
-while(over.hasChildNodes()){over.removeChild(over.lastChild);}
-over.appendChild(domfrag);}
-}
-
-// Makes object visible
-function OLshowObject(o){
-OLshowid=0;o=(OLns4)?o:o.style;
-if(((OLfilterPI)&&!OLchkFilter(o))||!OLfilterPI)o.visibility="visible";
-if(OLshadowPI)OLshowShadow();if(OLiframePI)OLshowIfs();if(OLhidePI)OLhideUtil(1,1,0);
-}
-
-// Hides object
-function OLhideObject(o){
-if(OLshowid>0){clearTimeout(OLshowid);OLshowid=0;}
-if(OLtimerid>0)clearTimeout(OLtimerid);if(OLdelayid>0)clearTimeout(OLdelayid);
-OLtimerid=0;OLdelayid=0;self.status="";o3_label=ol_label;
-if(o3_frame!=self)o=OLgetRefById();
-if(o){if(o.onmouseover)o.onmouseover=null;
-if(OLscrollPI&&o==over)OLclearScroll();
-if(OLdraggablePI)OLclearDrag();
-if(OLfilterPI)OLcleanupFilter(o);if(OLshadowPI)OLhideShadow();
-var os=(OLns4)?o:o.style;os.visibility="hidden";
-if(OLhidePI&&o==over)OLhideUtil(0,0,1);if(OLiframePI)OLhideIfs(o);}
-}
-
-// Moves layer
-function OLrepositionTo(o,xL,yL){
-o=(OLns4)?o:o.style;
-o.left=(OLns4?xL:xL+'px');
-o.top=(OLns4?yL:yL+'px');
-}
-
-// Handle NOCLOSE-MOUSEOFF
-function OLoptMOUSEOFF(c){
-if(!c)o3_close="";
-over.onmouseover=function(){OLhover=1;if(OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}}
-}
-function OLcursorOff(){
-if(OLovertwoPI&&over==over2)return false;
-var o=(OLns4?over:over.style),pHt=OLns4?over.clip.height:over.offsetHeight;
-var left=parseInt(o.left),top=parseInt(o.top);
-var right=left+o3_width,bottom=top+((OLbubblePI&&o3_bubble)?OLbubbleHt:pHt);
-if(OLx<left||OLx>right||OLy<top||OLy>bottom)return true;
-return false;
-}
-
-/*
- REGISTRATION
-*/
-var OLcmdLine=null,OLrunTime=null;
-function OLsetRunTimeVar(){
-if(OLrunTime&&OLrunTime.length)for(var k=0;k<OLrunTime.length;k++)OLrunTime[k]();
-}
-function OLparseCmdLine(pf,i,ar){
-if(OLcmdLine&&OLcmdLine.length){for(var k=0;k<OLcmdLine.length;k++){
-var j=OLcmdLine[k](pf,i,ar);if(j>-1){i=j;break;}}}
-return i;
-}
-function OLisFunc(f){
-var r=1;
-if(typeof f=='object'){for(var i=0;i<f.length;i++){
-if(typeof f[i]=='function')continue;r=0;break;}
-}else if(typeof f!='function')r=0;
-return r;
-}
-function OLregCmds(c){
-if(typeof c!='string')return;
-var pM=c.split(',');pMtr=pMtr.concat(pM);
-for(var i=0;i<pM.length;i++)eval(pM[i].toUpperCase()+'='+pmCnt++);
-}
-function OLregRunTimeFunc(f){
-if(OLisFunc(f)){
-if(!OLrunTime)OLrunTime=new Array();
-if(typeof f=='object')OLrunTime=OLrunTime.concat(f);
-else OLrunTime[OLrunTime.length++]=f;}
-}
-function OLregCmdLineFunc(f){
-if(OLisFunc(f)){
-if(!OLcmdLine)OLcmdLine=new Array();
-if(typeof f=='object')OLcmdLine=OLcmdLine.concat(f);
-else OLcmdLine[OLcmdLine.length++]=f;}
-}
-
-OLloaded=1;
diff --git a/httemplate/elements/overlibmws_draggable.js b/httemplate/elements/overlibmws_draggable.js
deleted file mode 100644
index 14e4a6062..000000000
--- a/httemplate/elements/overlibmws_draggable.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- overlibmws_draggable.js plug-in module - Copyright Foteos Macrides 2002=2005
- For support of the DRAGGABLE feature.
- Initial: August 24, 2002 - Last Revised: January 12, 2005
- See the Change History and Command Reference for overlibmws via:
-
- http://www.macridesweb.com/oltest/
-
- Published under an open source license: http://www.macridesweb.com/oltest/license.html
-*/
-
-OLloaded=0;
-OLregCmds('draggable');
-
-// DEFAULT CONFIGURATION
-if(OLud('draggable'))var ol_draggable=0;
-// END CONFIGURATION
-
-var o3_draggable=0,o3_dragging=0,OLmMv,OLcX,OLcY,OLcbX,OLcbY;
-function OLloadDraggable(){OLload('draggable');}
-function OLparseDraggable(pf,i,ar){
-var k=i;
-if(k<ar.length){if(Math.abs(ar[k])==DRAGGABLE){OLtoggle(ar[k],pf+'draggable');return k;}}
-return -1;
-}
-
-function OLcheckDrag(){
-if(o3_draggable){if(o3_sticky&&(o3_frame==self))initDrag();else o3_draggable=0;}
-}
-function initDrag(){
-OLmMv=OLdw.onmousemove;o3_dragging=0;
-if(OLns4){document.captureEvents(Event.MOUSEDOWN|Event.CLICK);
-document.onmousedown=OLgrabEl;;document.onclick=function(e){return routeEvent(e);}}
-else{over.onmousedown=OLgrabEl;OLsetDrgCur(1);}
-}
-function OLsetDrgCur(d){if(!OLns4)over.style.cursor=(d?'move':'auto');}
-
-function OLgrabEl(e){
-var e=(e||event);
-var cKy=(OLns4?e.modifiers&Event.ALT_MASK:(!OLop7?e.altKey:e.ctrlKey));o3_dragging=1;
-if(cKy){OLsetDrgCur(0);document.onmouseup=function(){OLsetDrgCur(1);o3_dragging=0;}
-return(OLns4?routeEvent(e):true);}
-OLx=(e.pageX||e.clientX+OLfd().scrollLeft);OLy=(e.pageY||e.clientY+OLfd().scrollTop);
-if(OLie4)over.onselectstart=function(){return false;}
-if(OLns4){OLcX=OLx;OLcY=OLy;document.captureEvents(Event.MOUSEUP)}else{
-OLcX=OLx-(OLns4?over.left:parseInt(over.style.left));
-OLcY=OLy-(OLns4?over.top:parseInt(over.style.top));
-if((OLshadowPI)&&bkdrop&&o3_shadow){OLcbX=OLx-(parseInt(bkdrop.style.left));
-OLcbY=OLy-(parseInt(bkdrop.style.top));}}OLdw.onmousemove=OLmoveEl;
-document.onmouseup=function(){
-if(OLie4)over.onselectstart=null;o3_dragging=0;OLdw.onmousemove=OLmMv;}
-return(OLns4?routeEvent(e):false);
-}
-
-function OLmoveEl(e){
-var e=(e||event);
-OLx=(e.pageX||e.clientX+OLfd().scrollLeft);OLy=(e.pageY||e.clientY+OLfd().scrollTop);
-if(o3_dragging){if(OLns4){over.moveBy(OLx-OLcX,OLy-OLcY);
-if(OLshadowPI&&bkdrop&&o3_shadow)bkdrop.moveBy(OLx-OLcX,OLy-OLcY);}
-else{OLrepositionTo(over,OLx-OLcX,OLy-OLcY);
-if((OLiframePI)&&OLie55&&OLifsP1)OLrepositionTo(OLifsP1,OLx-OLcX,OLy-OLcY);
-if((OLshadowPI)&&bkdrop&&o3_shadow){OLrepositionTo(bkdrop,OLx-OLcbX,OLy-OLcbY);
-if((OLiframePI)&&OLie55&&OLifsSh)OLrepositionTo(OLifsSh,OLx-OLcbX,OLy-OLcbY);}}
-if(OLhidePI)OLhideUtil(0,1,1,0,0,0);}if(OLns4){OLcX=OLx;OLcY=OLy;}
-return false;
-}
-
-function OLclearDrag(){
-if(OLns4){document.releaseEvents(Event.MOUSEDOWN|Event.MOUSEUP|Event.CLICK);
-document.onmousedown=document.onclick=null;}else{over.onmousedown=null;OLsetDrgCur(0);}
-document.onmouseup=null;o3_dragging=0;
-}
-
-OLregRunTimeFunc(OLloadDraggable);
-OLregCmdLineFunc(OLparseDraggable);
-
-OLdraggablePI=1;
-OLloaded=1;
diff --git a/httemplate/elements/overlibmws_iframe.js b/httemplate/elements/overlibmws_iframe.js
deleted file mode 100644
index e3032f2ee..000000000
--- a/httemplate/elements/overlibmws_iframe.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- overlibmws_iframe.js plug-in module - Copyright Foteos Macrides 2003-2005
- Masks system controls to prevent obscuring of popops for IE v5.5 or higher.
- Initial: October 19, 2003 - Last Revised: May 15, 2005
- See the Change History and Command Reference for overlibmws via:
-
- http://www.macridesweb.com/oltest/
-
- Published under an open source license: http://www.macridesweb.com/oltest/license.html
-*/
-
-OLloaded=0;
-
-var OLifsP1=null,OLifsSh=null,OLifsP2=null;
-
-// IFRAME SHIM SUPPORT FUNCTIONS
-function OLinitIfs(){
-if(!OLie55)return;
-if((OLovertwoPI)&&over2&&over==over2){
-var o=o3_frame.document.all['overIframeOvertwo'];
-if(!o||OLifsP2!=o){OLifsP2=null;OLgetIfsP2Ref();}return;}
-o=o3_frame.document.all['overIframe'];
-if(!o||OLifsP1!=o){OLifsP1=null;OLgetIfsRef();}
-if((OLshadowPI)&&o3_shadow){o=o3_frame.document.all['overIframeShadow'];
-if(!o||OLifsSh!=o){OLifsSh=null;OLgetIfsShRef();}}
-}
-
-function OLsetIfsRef(o,i,z){
-o.id=i;o.src='javascript:false;';o.scrolling='no';var os=o.style;
-os.position='absolute';os.top=0;os.left=0;os.width=1;os.height=1;os.visibility='hidden';
-os.zIndex=over.style.zIndex-z;os.filter='Alpha(style=0,opacity=0)';
-}
-
-function OLgetIfsRef(){
-if(OLifsP1||!OLie55)return;
-OLifsP1=o3_frame.document.createElement('iframe');
-OLsetIfsRef(OLifsP1,'overIframe',2);
-o3_frame.document.body.appendChild(OLifsP1);
-}
-
-function OLgetIfsShRef(){
-if(OLifsSh||!OLie55)return;
-OLifsSh=o3_frame.document.createElement('iframe');
-OLsetIfsRef(OLifsSh,'overIframeShadow',3);
-o3_frame.document.body.appendChild(OLifsSh);
-}
-
-function OLgetIfsP2Ref(){
-if(OLifsP2||!OLie55)return;
-OLifsP2=o3_frame.document.createElement('iframe');
-OLsetIfsRef(OLifsP2,'overIframeOvertwo',1);
-o3_frame.document.body.appendChild(OLifsP2);
-}
-
-function OLsetDispIfs(o,w,h){
-var os=o.style;
-os.width=w+'px';os.height=h+'px';os.clip='rect(0px '+w+'px '+h+'px 0px)';
-o.filters.alpha.enabled=true;
-}
-
-function OLdispIfs(){
-if(!OLie55)return;
-var wd=over.offsetWidth,ht=over.offsetHeight;
-if(OLfilterPI&&o3_filter&&o3_filtershadow){wd+=5;ht+=5;}
-if((OLovertwoPI)&&over2&&over==over2){
-if(!OLifsP2)return;
-OLsetDispIfs(OLifsP2,wd,ht);return;}
-if(!OLifsP1)return;
-OLsetDispIfs(OLifsP1,wd,ht);
-if((!OLshadowPI)||!o3_shadow||!OLifsSh)return;
-OLsetDispIfs(OLifsSh,wd,ht);
-}
-
-function OLshowIfs(){
-if(OLifsP1){OLifsP1.style.visibility="visible";
-if((OLshadowPI)&&o3_shadow&&OLifsSh)OLifsSh.style.visibility="visible";}
-}
-
-function OLhideIfs(o){
-if(!OLie55||o!=over)return;
-if(OLifsP1)OLifsP1.style.visibility="hidden";
-if((OLshadowPI)&&o3_shadow&&OLifsSh)OLifsSh.style.visibility="hidden";
-}
-
-function OLrepositionIfs(X,Y){
-if(OLie55){if((OLovertwoPI)&&over2&&over==over2){
-if(OLifsP2)OLrepositionTo(OLifsP2,X,Y);}
-else{if(OLifsP1){OLrepositionTo(OLifsP1,X,Y);if((OLshadowPI)&&o3_shadow&&OLifsSh)
-OLrepositionTo(OLifsSh,X+o3_shadowx,Y+o3_shadowy);}}}
-}
-
-OLiframePI=1;
-OLloaded=1;
diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html
deleted file mode 100644
index 7844f5678..000000000
--- a/httemplate/elements/progress-init.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<%
- my( $formname, $fields, $action, $url_or_message, $key ) = @_;
- $key = '' unless defined $key;
-
- my $url_or_message_link;
- if ( ref($url_or_message) ) { #its a message or something
- $url_or_message_link =
- 'message='. uri_escape( $url_or_message->{'message'} )
- } else {
- $url_or_message_link = "url=$url_or_message";
- }
-%>
-
-<%= include('/elements/xmlhttp.html',
- 'method' => 'POST',
- 'url' => $action,
- 'subs' => [ 'start_job' ],
- )
-%>
-<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.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>');
-}
-
-function <%=$key%>process () {
-
- //alert('<%=$key%>process for form <%=$formname%>');
-
- document.<%=$formname%>.submit.disabled=true;
-
- overlib( 'Submitting job to server...', WIDTH, 432, HEIGHT, 136, CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
-
- var Hash = new Array();
- var x = 0;
- var fieldName;
- for (var i = 0; i<document.<%=$formname%>.elements.length; i++) {
- field = document.<%=$formname%>.elements[i];
- if ( <%= join(' || ', map { "(field.name.indexOf('$_') > -1)" } @$fields ) %>
- )
- {
- if ( field.type == 'select-multiple' ) {
- //alert('select-multiple ' + field.name);
- for (var j=0; j < field.options.length; j++) {
- if ( field.options[j].selected ) {
- //alert(field.name + ' => ' + field.options[j].value);
- Hash[x++] = field.name;
- Hash[x++] = field.options[j].value;
- }
- }
- } else if ( ( field.type != 'radio' && field.type != 'checkbox' )
- || ( ( field.type == 'radio' || field.type == 'checkbox' )
- && document.<%=$formname%>.elements[i].checked
- )
- )
- {
- Hash[x++] = field.name;
- Hash[x++] = field.value;
- }
- }
- }
-
- // jsrsPOST = true;
- // jsrsExecute( '<%= $action %>', <%=$key%>myCallback, 'start_job', Hash );
-
- //alert('start_job( ' + Hash + ', <%=$key%>myCallback )' );
- //alert('start_job()' );
- start_job( Hash, <%=$key%>myCallback );
-
-}
-
-function <%=$key%>myCallback( jobnum ) {
-
- overlib( OLiframeContent('<%=$p%>elements/progress-popup.html?jobnum=' + jobnum + ';<%=$url_or_message_link%>;formname=<%=$formname%>' , 432, 136, 'progress_popup'), CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
-
-}
-
-</SCRIPT>
diff --git a/httemplate/elements/progress-popup.html b/httemplate/elements/progress-popup.html
deleted file mode 100644
index 200f97d9b..000000000
--- a/httemplate/elements/progress-popup.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<%
- my $jobnum = $cgi->param('jobnum');
- my $url = $cgi->param('url');
- my $message = $cgi->param('message');
- my $formname = scalar($cgi->param('formname'));
-%>
-<HTML>
- <HEAD>
- <TITLE></TITLE>
- </HEAD>
- <BODY BGCOLOR="#ccccff" onLoad="refreshStatus()">
-
-<%= include('/elements/xmlhttp.html',
- 'url' => $p.'elements/jsrsServer.html',
- 'subs' => [ 'job_status' ],
- )
-%>
-<SCRIPT TYPE="text/javascript" src="../elements/qlib/control.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" src="../elements/qlib/imagelist.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" src="../elements/qlib/progress.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript">
-function refreshStatus () {
- //jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' );
-
- job_status( '<%= $jobnum %>', updateStatus );
-}
-function updateStatus( status_statustext ) {
-
- //var Array = status_statustext.split("\n");
- var statusArray = eval('(' + status_statustext + ')');
- var status = statusArray[0];
- var statustext = statusArray[1];
-
- //if ( status == 'progress' ) {
- //IE workaround, no i have no idea why
- if ( status.indexOf('progress') > -1 ) {
- document.getElementById("progress_percent").innerHTML = statustext + '%';
- bar1.set(statustext);
- bar1.update;
- //jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' );
- job_status( '<%= $jobnum %>', updateStatus );
- } else if ( status.indexOf('complete') > -1 ) {
-<% if ( $message ) { %>
- document.getElementById("progress_message").innerHTML = "<%= $message %>";
- document.getElementById("progress_bar").innerHTML = '';
- document.getElementById("progress_percent").innerHTML = '<INPUT TYPE="button" VALUE="OK" onClick="parent.nd(1);">';
- document.getElementById("progress_jobnum").innerHTML = '';
- parent.document.<%=$formname%>.submit.disabled=false;
-<% } elsif ( $url ) { %>
- window.top.location.href = '<%= $url %>';
-<% } else { %>
- alert('job done but no url or message specified');
-<% } %>
- } else if ( status.indexOf('error') > -1 ) {
- document.getElementById("progress_message").innerHTML = '<FONT SIZE="+1" COLOR="#FF0000">Error: ' + statustext + '</FONT>';
- document.getElementById("progress_bar").innerHTML = '';
- document.getElementById("progress_percent").innerHTML = '<INPUT TYPE="button" VALUE="OK" onClick="parent.nd(1);">';
- document.getElementById("progress_jobnum").innerHTML = '';
- parent.document.<%=$formname%>.submit.disabled=false;
- } else {
- alert('XXX unknown status returned from server: ' + status);
- }
-
-}
-</SCRIPT>
-
- <TABLE>
- <TR>
- <TD ALIGN="center" ID="progress_message">
- Server processing job...
- </TD>
- </TR><TR>
- <TD ALIGN="center" ID="progress_bar">
- <SCRIPT TYPE="text/javascript">
- // Create imagelist
- SEGS = new QImageList(4, 23, "../images/progressbar-empty.png", "../images/progressbar-full.png");
- // Create bars
- bar1 = new QProgress(null, "bar1", SEGS, 100);
- // bar1.set(0);
- // bar1.update;
- </SCRIPT>
- </TD>
- </TR><TR>
- <TD ALIGN="center">
- <DIV ID="progress_percent">%</DIV>
- </TD>
- </TR><TR>
- <TD ALIGN="center" ID="progress_jobnum">
- (progress of job #<%= $jobnum %>)
- </TD>
- </TR>
- </TABLE>
-
- </BODY>
-</HTML>
-
diff --git a/httemplate/elements/qlib/box.js b/httemplate/elements/qlib/box.js
deleted file mode 100644
index 537aac4c8..000000000
--- a/httemplate/elements/qlib/box.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * QLIB 1.0 Box Control
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QBox(parent, name, res, x, y, width, height, body, visible, effects, opacity, zindex) {
- this.init(parent, name);
- if (this.res = res) {
- this.x = x - 0;
- this.y = y - 0;
- this.width = width - 0;
- this.height = (typeof(height) == "number") ? height : null;
- this.body = body || "&nbsp;";
- var j = QBox.arguments.length;
- this.visible = (j > 8) ? visible : true;
- this.effects = (j > 9) ? effects : (res.effects || 0);
- this.opacity = (j > 10) ? opacity : (res.opacity != null ? res.opacity : 100);
- this.zindex = (j > 11) ? zindex : null;
- this.create();
- } else {
- this.document.write("invalid resource");
- }
-}
-QBox.prototype = new QBoxCtrl();
diff --git a/httemplate/elements/qlib/boxctrl.js b/httemplate/elements/qlib/boxctrl.js
deleted file mode 100644
index 417b204e4..000000000
--- a/httemplate/elements/qlib/boxctrl.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * QLIB 1.0 Box Abstraction
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QBoxCtrl_content() {
- with (this) {
- if (res) {
- this.cwidth = width - res.L - res.R - 8;
- this.cheight = height && (height - res.T - res.B - 8);
- var ec = '"><table border="0" cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td>';
- document.write('<table class="qbox" border="0" cellspacing="0" cellpadding="0" width="' +
- (width - 8) + (height != null ? '" height="' + (height - 8) : '') + '"><tr><td width="' +
- res.L + '" height="' + res.T + '"><img src="' + res.TL.src + '" border="0" width="' +
- res.L + '" height="' + res.T + '"></td><td width="' + cwidth + '" height="' + res.T +
- '" background="' + res.TC.src + ec + '<td width="' + res.R + '" height="' + res.T +
- '"><img src="' + res.TR.src + '" border="0" width="' + res.R + '" height="' + res.T +
- '"></td></tr><tr><td width="' + res.L + (cheight != null ? '" height="' + cheight : '') +
- '" background="' + res.ML.src + ec + '<td width="' + cwidth + '" bgcolor="' + res.bgcolor +
- (cheight != null ? '" height="' + cheight : '') + (res.bgtile ? '" background="' +
- res.bgtile.src : '') + '" align="left" valign="top" class="body" unselectable="on">');
- if (typeof(body) == "function") {
- this.body();
- } else {
- document.write(body);
- }
- document.write('</td><td width="' + res.R + (cheight != null ? '" height="' + cheight : '') +
- '" background="' + res.MR.src + ec + '</tr><tr><td width="' + res.L + '" height="' + res.B +
- '"><img src="' + res.BL.src + '" border="0" width="' + res.L + '" height="' + res.B +
- '"></td><td width="' + cwidth + '" height="' + res.B + '" background="' + res.BC.src + ec +
- '<td width="' + res.R + '" height="' + res.B + '"><img src="' + res.BR.src +
- '" border="0" width="' + res.R + '" height="' + res.B + '"></td></tr></table><br>');
- }
- }
-}
-
-function QBoxCtrl() {
- this.res = false;
- this.body = "&nbsp;";
- this.cwidth = this.cheight = 0;
- this.content = QBoxCtrl_content;
-}
-QBoxCtrl.prototype = new QWndCtrl();
diff --git a/httemplate/elements/qlib/boxres.js b/httemplate/elements/qlib/boxres.js
deleted file mode 100644
index 087817211..000000000
--- a/httemplate/elements/qlib/boxres.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * QLIB 1.0 Box Resource
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QBoxRes(t, r, b, l, tc, tr, mr, br, bc, bl, ml, tl, bgcolor, bgtile, effects, opacity) {
- var args = QBoxRes.arguments.length;
- this.T = t;
- this.R = r;
- this.B = b;
- this.L = l;
- this.TC = new Image();
- this.TC.src = tc;
- this.TR = new Image(r, t);
- this.TR.src = tr;
- this.MR = new Image();
- this.MR.src = mr;
- this.BR = new Image(r, b);
- this.BR.src = br;
- this.BC = new Image();
- this.BC.src = bc;
- this.BL = new Image(l, b);
- this.BL.src = bl;
- this.ML = new Image();
- this.ML.src = ml;
- this.TL = new Image(l, t);
- this.TL.src = tl;
- this.bgcolor = bgcolor || "#FFFFFF";
- if (bgtile) {
- this.bgtile = new Image();
- this.bgtile.src = bgtile;
- } else {
- this.bgtile = false;
- }
- this.effects = (args > 13) ? effects : null;
- this.opacity = (args > 14) ? opacity : null;
-}
diff --git a/httemplate/elements/qlib/button.js b/httemplate/elements/qlib/button.js
deleted file mode 100644
index 05247d5f8..000000000
--- a/httemplate/elements/qlib/button.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * QLIB 1.0 Button Control
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QButton_update() {
- with (this) {
- image.src = ((!enabled && res.imgD) || (value ? res.imgP : res.imgN)).src;
- }
-}
-
-function QButton_doEvent() {
- with (this) {
- if (enabled) {
- if (res.style == 1) {
- this.value = value ? 0 : 1;
- update();
- }
- onClick(value, tag);
- }
- }
- return false;
-}
-
-function QButton_enable(state) {
- this.enabled = state;
- this.update();
-}
-
-function QButton_set(value) {
- if (this.enabled) {
- this.value = value ? 1 : 0;
- this.update();
- }
- return true;
-}
-
-function QButton(parent, name, res, tooltip) {
- this.init(parent, name);
- if (res) {
- this.res = res;
- this.tip = tooltip || "";
- this.enabled = true;
- this.value = 0;
- this.set = QButton_set;
- this.enable = QButton_enable;
- this.update = QButton_update;
- this.doEvent = QButton_doEvent;
- this.onClick = QControl.event;
- with (this) {
- document.write('<a href="#" hidefocus="true" unselectable="on"' +
- (tip ? ' title="' + tip + '"' : '') + ' onClick="return ' + name +
- '.doEvent()" onMouseOver="' + (res.style == 2 ? name + '.set(1);' : '') +
- 'window.top.status=' + name + '.tip;return true" onMouseOut="' +
- (!res.style || (res.style == 2) ? name + '.set();' : '') + 'window.top.status=\'\'"' +
- (!res.style ? ' onMouseDown="return ' + name + '.set(1)" onMouseUp="return ' + name + '.set()"' : '') +
- '><img class="qbutton" name="' + id + '" src="' + res.imgN.src + '" border="0" width="' +
- res.width + '" height="' + res.height + '"></a>');
- this.image = document.images[id] || new Image(1, 1);
- }
- } else {
- this.document.write("invalid resource");
- }
-}
-QButton.prototype = new QControl();
-QButton.NORMAL = 0;
-QButton.CHECKBOX = 1;
-QButton.WEB = 2;
-QButton.SIGNAL = 3;
diff --git a/httemplate/elements/qlib/buttonres.js b/httemplate/elements/qlib/buttonres.js
deleted file mode 100644
index 97f6dfccc..000000000
--- a/httemplate/elements/qlib/buttonres.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * QLIB 1.0 Button Resource
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QButtonRes(style, width, height, normal, pressed, disabled) {
- this.style = style;
- this.width = width;
- this.height = height;
- this.imgN = new Image(width, height);
- this.imgN.src = normal;
- this.imgP = new Image(width, height);
- this.imgP.src = pressed;
- if (disabled) {
- this.imgD = new Image(width, height);
- this.imgD.src = disabled;
- }
-}
diff --git a/httemplate/elements/qlib/control.js b/httemplate/elements/qlib/control.js
deleted file mode 100644
index f50206e27..000000000
--- a/httemplate/elements/qlib/control.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * QLIB 1.0 Base Abstract Control
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QControl_init(parent, name) {
- this.parent = parent || self;
- this.window = (parent && parent.window) || self;
- this.document = (parent && parent.document) || self.document;
- this.name = (parent && parent.name) ? (parent.name + "." + name) : ("self." + name);
- this.id = "Q";
- var h = this.hash(this.name);
- for (var j=0; j<8; j++) {
- this.id += QControl.HEXTABLE.charAt(h & 15);
- h >>>= 4;
- }
-}
-
-function QControl_hash(str) {
- var h = 0;
- if (str) {
- for (var j=str.length-1; j>=0; j--) {
- h ^= QControl.ANTABLE.indexOf(str.charAt(j)) + 1;
- for (var i=0; i<3; i++) {
- var m = (h = h<<7 | h>>>25) & 150994944;
- h ^= m ? (m == 150994944 ? 1 : 0) : 1;
- }
- }
- }
- return h;
-}
-
-function QControl_nop() {
-}
-
-function QControl() {
- this.init = QControl_init;
- this.hash = QControl_hash;
- this.window = self;
- this.document = self.document;
- this.tag = null;
-}
-QControl.ANTABLE = "w5Q2KkFts3deLIPg8Nynu_JAUBZ9YxmH1XW47oDpa6lcjMRfi0CrhbGSOTvqzEV";
-QControl.HEXTABLE = "0123456789ABCDEF";
-QControl.nop = QControl_nop;
-QControl.event = QControl_nop;
diff --git a/httemplate/elements/qlib/counter.js b/httemplate/elements/qlib/counter.js
deleted file mode 100644
index 72aeddbdb..000000000
--- a/httemplate/elements/qlib/counter.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * QLIB 1.0 Animated Digital Counter
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QCounter_update() {
- with (this) {
- var v = Math.max(value, 0);
- var mod;
- for (var j=0; j<size; j++) {
- mod = Math.floor(v % 10);
- images[j].src = (v >= 1) || (!j) ? res.list[mod].src : res.list[10].src;
- v /= 10;
- }
- }
-}
-
-function QCounter_count(value, step) {
- this._cntt = false;
- this.value += step;
- if ((step * (this.value - value)) >= 0) {
- this.value = value - 0; // convert to number
- } else {
- this._cntt = setTimeout(this.name + ".count(" + value + "," + step + ")", 50);
- }
- this.update();
-}
-
-function QCounter_set(value) {
- this.setval = value;
- if (value != this.value) {
- if (this._cntt) {
- clearTimeout(this._cntt);
- this._cntt = false;
- }
- var dv = value - this.value;
- if (this.effect == 2) {
- dv = dv / Math.min(10, Math.abs(dv));
- } else if (this.effect == 3) {
- dv = dv / Math.abs(dv);
- }
- this.count(value, dv);
- }
-}
-
-function QCounter(parent, name, res, size, effect) {
- this.init(parent, name);
- if (res) {
- this.res = res;
- this.setval = this.value = 0;
- this.size = size || 4;
- this.effect = effect || 2;
- this._cntt = false;
- this.images = new Array(this.size);
- this.set = QCounter_set;
- this.update = QCounter_update;
- this.count = QCounter_count;
- with (this) {
- document.write('<table class="qcounter" width="' + (res.width * size) + '" height="' + res.height +
- '" border="0" cellspacing="0" cellpadding="0" unselectable="on"><tr>');
- for (var j=(size - 1); j>=0; j--) {
- document.write('<td width="' + res.width + '" height="' + res.height +
- '" unselectable="on"><img name="' + id + j + '" src="' + (j ? res.list[10].src : res.list[0].src) +
- '" border="0" width="' + res.width + '" height="' + res.height + '"></td>');
- images[j] = document.images[id + j] || new Image(1, 1);
- }
- document.write('</tr></table>');
- }
- } else {
- this.document.write("invalid resource");
- }
-}
-QCounter.prototype = new QControl();
-QCounter.INSTANT = 1;
-QCounter.FAST = 2;
-QCounter.SLOW = 3;
diff --git a/httemplate/elements/qlib/imagelist.js b/httemplate/elements/qlib/imagelist.js
deleted file mode 100644
index 9f12de053..000000000
--- a/httemplate/elements/qlib/imagelist.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * QLIB 1.0 ImageList Resource
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QImageList(width, height) {
- var len = QImageList.arguments.length - 2;
- if (len > 0) {
- this.list = new Array(len);
- this.length = len;
- this.width = width;
- this.height = height;
- var im;
- for (var j=0; j<len; j++) {
- im = new Image(width, height);
- im.src = QImageList.arguments[j + 2];
- this.list[j] = im;
- }
- }
-} \ No newline at end of file
diff --git a/httemplate/elements/qlib/label.js b/httemplate/elements/qlib/label.js
deleted file mode 100644
index 2d8b1e710..000000000
--- a/httemplate/elements/qlib/label.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * QLIB 1.0 Text Label
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QLabel_set_ie(value) {
- this.label.innerText = (this.value = value) || "\xA0";
-}
-
-function QLabel_set_dom2(value) {
- with (this.label) {
- replaceChild(this.document.createTextNode((this.value = value) || "\xA0"), firstChild);
- }
-}
-
-function QLabel_set_ns4(value) {
- this.value = value || "";
- with (this) {
- document.open();
- document.write('<div class="qlabel">' + (clickable ? '<a href="#" title="' + tooltip + '" onClick="return ' +
- name + '.doEvent()" onMouseOut="window.top.status=\'\'" onMouseOver="window.top.status=' + name +
- '.tooltip;return true">' + value + '</a>' : value) + '</div>');
- document.close();
- }
-}
-
-function QLabel_doEvent() {
- this.onClick(this.value, this.tag);
- return false;
-}
-
-function QLabel(parent, name, value, clickable, tooltip) {
- this.init(parent, name);
- this.value = value || "";
- this.clickable = clickable || false;
- this.tooltip = tooltip || "";
- this.doEvent = QLabel_doEvent;
- this.onClick = QControl.event;
- with (this) {
- if (document.getElementById || document.all) {
- document.write(clickable ? '<div class="qlabel" unselectable="on"><a id="' + id + '" href="#" title="' +
- tooltip + '" onClick="return ' + name + '.doEvent()" onMouseOver="window.top.status=' + name +
- '.tooltip;return true" onMouseOut="window.top.status=\'\'" hidefocus="true" unselectable="on">' +
- (value || '&nbsp;') + '</a></div>' : '<div id="' + id + '" class="qlabel" unselectable="on">' +
- (value || '&nbsp;') + '</div>');
- this.label = document.getElementById ? document.getElementById(id) :
- (document.all.item ? document.all.item(id) : document.all[id]);
- this.set = (label && (label.innerText ? QLabel_set_ie :
- (label.replaceChild && QLabel_set_dom2))) || QControl.nop;
- } else if (document.layers) {
- var suffix = "";
- for (var j=value.length; j<QLabel.TEXTQUOTA; j++) suffix += " &nbsp;";
- document.write('<div><ilayer id="i' + id + '"><layer id="' + id + '"><div class="qlabel">' +
- (clickable ? '<a href="#" title="' + tooltip + '" onClick="return ' + name +
- '.doEvent()" onMouseOver="window.top.status=' + name +
- '.tooltip;return true" onMouseOut="window.top.status=\'\'">' + value + suffix + '</a>' :
- value + suffix) + '</div></layer></ilayer></div>');
- this.label = (this.label = document.layers["i" + id]) && label.document.layers[id];
- this.document = label && label.document;
- this.set = (label && document) ? QLabel_set_ns4 : QControl.nop;
- } else {
- document.write("Object is not supported");
- }
- }
-}
-QLabel.prototype = new QControl();
-QLabel.TEXTQUOTA = 50;
diff --git a/httemplate/elements/qlib/messagebox.js b/httemplate/elements/qlib/messagebox.js
deleted file mode 100644
index 2e458393d..000000000
--- a/httemplate/elements/qlib/messagebox.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * QLIB 1.0 Message Box Control
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QMessageBox_alert(msg) {
- if (typeof(msg) == "string") {
- this.label.set(this.value = msg);
- }
- this.center();
- this.focus();
- this.show(true);
-}
-
-function QMessageBox_close() {
- with (this.parent) {
- if (!onClose(tag)) show(false);
- }
-}
-
-function QMessageBox_body() {
- with (this) {
- document.write('<table border="0" width="' + cwidth + '"><tr><td align="left" valign="top" unselectable="on">');
- this.label = new QLabel(this, "label", value);
- document.write('</td></tr><tr><td height="' + (bres.height + 14) + '" align="center" valign="bottom" unselectable="on">');
- this.button = new QButton(this, "button", bres, "Close");
- document.write('</td></tr></table>');
- button.onClick = QMessageBox_close;
- }
-}
-
-function QMessageBox(parent, name, box, btn, msg, effects, opacity) {
- this.init(parent, name);
- if ((this.res = box) && (this.bres = btn)) {
- this.value = typeof(msg) == "string" ? msg : "";
- this.width = Math.max(200, Math.floor(Math.sqrt(555 * this.value.length)));
- this.height = null;
- this.x = this.y = 0;
- this.visible = false;
- this.zindex = null;
- this.body = QMessageBox_body;
- var j = QMessageBox.arguments.length;
- this.effects = j > 5 ? effects : (box.effects != null ? box.effects : 0);
- this.opacity = j > 6 ? opacity : (box.opacity != null ? box.opacity : 100);
- this.create();
- this.alert = QMessageBox_alert;
- this.onClose = QControl.event;
- } else {
- this.document.write("invalid resource");
- }
-}
-QMessageBox.prototype = new QBoxCtrl();
diff --git a/httemplate/elements/qlib/progress.js b/httemplate/elements/qlib/progress.js
deleted file mode 100644
index 2de077eac..000000000
--- a/httemplate/elements/qlib/progress.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * QLIB 1.0 Progress Control
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QProgress_update() {
- with (this) {
- var i = low;
- for (var j=0; j<size; j++) {
- images[j].src = i < value ? imgsrc1 : imgsrc0;
- i += delta;
- }
- }
-}
-
-function QProgress_set(value) {
- this.value = value - 0;
- this.update();
-}
-
-function QProgress_setBounds(low, high) {
- this.low = Math.min(low, high);
- this.high = Math.max(low, high);
- this.delta = (this.high - this.low) / this.size;
- this.update();
-}
-
-function QProgress(parent, name, res, size, style) {
- this.init(parent, name);
- if (res) {
- this.res = res;
- this.value = 0;
- this.low = 0;
- this.high = 100;
- this.size = size || 10;
- this.delta = 100 / this.size;
- this.style = style || 0;
- this.images = new Array(this.size);
- this.imgsrc0 = res.list[0] && res.list[0].src;
- this.imgsrc1 = res.list[1] && res.list[1].src;
- this.set = QProgress_set;
- this.update = QProgress_update;
- this.setBounds = QProgress_setBounds;
- with (this) {
- var hor = this.style < 2;
- var rev = this.style % 2;
- document.write('<table class="qprogress" border="0" cellspacing="0" cellpadding="0" unselectable="on" ' +
- (hor ? 'width="' + (size * res.width) + '" height="' + res.height + '"><tr>' : 'width="' + res.width +
- '" height="' + (size * res.height) + '">'));
- for (var j=0; j<size; j++) {
- document.write((hor ? '' : '<tr>') + '<td width="' + res.width + '" height="' + res.height +
- '" unselectable="on"><img name="' + id + (rev ? size - j - 1 : j) + '" src="' + res.list[0].src +
- '" border="0" width="' + res.width + '" height="' + res.height + '"></td>' + (hor ? '' : '</tr>'));
- }
- document.write((hor ? '</tr>' : '') + '</table>');
- for (var j=0; j<size; j++) {
- images[j] = document.images[id + j] || new Image(1, 1);
- }
- }
- } else {
- this.document.write("invalid resource");
- }
-}
-QProgress.prototype = new QControl();
-QProgress.NORMAL = 0;
-QProgress.REVERSE = 1;
-QProgress.FALL = 2;
-QProgress.RISE = 3;
diff --git a/httemplate/elements/qlib/sound.js b/httemplate/elements/qlib/sound.js
deleted file mode 100644
index 3d1aaf660..000000000
--- a/httemplate/elements/qlib/sound.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * QLIB 1.0 Preloaded Sound
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QSound_play(loop) {
- this._out.loop = loop || 0;
- this._out.src = this._buf.src;
-}
-
-function QSound_stop() {
- this._out.loop = 0;
- this._out.src = "";
-}
-
-function QSound_setVolume(volume) {
- this._out.volume = this.volume = volume;
-}
-
-function QSound(parent, name, src, volume) {
- this.init(parent, name);
- this.volume = volume || 0;
- this.play = this.stop = this.setVolume = QControl.nop;
- with (this) {
- document.write('<bgsound id="' + id + '" src="" volume="' + volume + '">');
- if (document.all && document.all.item) {
- this._out = document.all.item(id);
- if (_out && (typeof _out.src != "undefined") && (_out.volume === volume)) {
- document.write('<bgsound id="b' + id + '" src="' + src + '" volume="-10000">');
- this._buf = document.all.item("b" + id);
- if (_buf) {
- this.play = QSound_play;
- this.stop = QSound_stop;
- this.setVolume = QSound_setVolume;
-
- _out.onreadystatechange = new Function("alert(0)");
- }
- }
- }
- }
-}
-QSound.prototype = new QControl();
diff --git a/httemplate/elements/qlib/sprite.js b/httemplate/elements/qlib/sprite.js
deleted file mode 100644
index 72a68fb7c..000000000
--- a/httemplate/elements/qlib/sprite.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * QLIB 1.0 Sprite Object
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QSprite_load(src) {
- if (src) {
- this.face = new Image(this.cwidth, this.cheight);
- this.face.src = src;
- this.valid = false;
- }
-}
-
-function QSprite_show(show) {
- if (show && !this.valid && this.face.complete) {
- this._img.src = this.face.src;
- this.valid = true;
- }
- this._show(show);
-}
-
-function QSprite_moveTo(x, y) {
- this.stop();
- this._move(x, y);
-}
-
-function QSprite_slideTo(x, y) {
- this.stop();
- if (this.visible) {
- this.doSlide(++this._spro, x, y);
- } else {
- this.moveTo(x, y);
- }
-}
-
-function QSprite_shake() {
- this.stop();
- if (this.visible) {
- this.doShake(++this._spro, 0, this.x, this.y);
- }
-}
-
-function QSprite_stop() {
- this._spro++;
- if (this._sprt) {
- clearTimeout(this._sprt);
- this._sprt = false;
- }
-}
-
-function QSprite_doSlide(id, x, y) {
- if (this._spro == id) {
- this._sprt = false;
- var dx = Math.round(x - this.x);
- var dy = Math.round(y - this.y);
- if (dx || dy) {
- if (dx) dx = dx > 0 ? Math.ceil(dx/4) : Math.floor(dx/4);
- if (dy) dy = dy > 0 ? Math.ceil(dy/4) : Math.floor(dy/4);
- this._move(this.x + dx, this.y + dy);
- this._sprt = setTimeout(this.name + ".doSlide(" + id + "," + x + "," + y + ")", 30);
- } else {
- this._move(x, y);
- }
- }
-}
-
-function QSprite_doShake(id, phase, x, y) {
- if (this._spro == id) {
- this._sprt = false;
- if (phase < 20) {
- var m = 3 * Math.sin(.16 * phase);
- this._move(x + m * Math.sin(phase), y + m * Math.cos(phase));
- this._sprt = setTimeout(this.name + ".doShake(" + id + "," + (++phase) + "," + x + "," + y + ")", 20);
- } else {
- this._move(x, y);
- }
- }
-}
-
-function QSprite_doClick() {
- if (!this._sprt) {
- this.onClick(this.tag);
- }
- return false;
-}
-
-function QSprite(parent, name, x, y, width, height, src, visible, effects, opacity, zindex) {
- this.init(parent, name);
- this.x = x - 0;
- this.y = y - 0;
- this.width = (this.cwidth = width - 0) + 8;
- this.height = (this.cheight = height - 0) + 8;
- var j = QSprite.arguments.length;
- this.visible = (j > 7) ? visible : true;
- this.effects = (j > 8) ? effects : 0;
- this.opacity = (j > 9) ? opacity : 100;
- this.zindex = (j > 10) ? zindex : null;
- this.valid = !!src;
- this.content = '<a href="#" title="" onclick="return false" onmousedown="return ' + this.name +
- '.doClick()" onmouseover="window.top.status=\'\';return true" hidefocus="true" unselectable="on"><img name="' +
- this.id + '" src="' + (src || '') + '" border="0" width="' + this.cwidth + '" height="' + this.cheight +
- '" alt="" unselectable="on"></a>';
- this.doClick = QSprite_doClick;
- this.doSlide = QSprite_doSlide;
- this.doShake = QSprite_doShake;
- this.onClick = QControl.event;
- this.create();
- this.face = this._img = this.document.images[this.id] || new Image(1, 1);
- this._spro = 0;
- this._sprt = false;
- this._show = this.show;
- this._move = this.moveTo;
- this.load = QSprite_load;
- this.show = QSprite_show;
- this.moveTo = QSprite_moveTo;
- this.slideTo = QSprite_slideTo;
- this.shake = QSprite_shake;
- this.stop = QSprite_stop;
-}
-QSprite.prototype = new QWndCtrl();
diff --git a/httemplate/elements/qlib/window.js b/httemplate/elements/qlib/window.js
deleted file mode 100644
index 6056fda9b..000000000
--- a/httemplate/elements/qlib/window.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * QLIB 1.0 Window Control
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QWindow(parent, name, x, y, width, height, content, visible, effects, opacity, zindex) {
- this.init(parent, name);
- this.x = x - 0;
- this.y = y - 0;
- this.width = width - 0;
- this.height = (typeof(height) == "number") ? height : null;
- this.content = content;
- var j = QWindow.arguments.length;
- this.visible = (j > 7) ? visible : true;
- this.effects = (j > 8) ? effects : 0;
- this.opacity = (j > 9) ? opacity : 100;
- this.zindex = (j > 10) ? zindex : null;
- this.create();
-}
-QWindow.prototype = new QWndCtrl();
diff --git a/httemplate/elements/qlib/wndctrl.js b/httemplate/elements/qlib/wndctrl.js
deleted file mode 100644
index b3bde4e92..000000000
--- a/httemplate/elements/qlib/wndctrl.js
+++ /dev/null
@@ -1,322 +0,0 @@
-/**
- * QLIB 1.0 Window Abstraction
- * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * http://qlib.quazzle.com
- */
-
-function QWndCtrl_center_ie4() {
- var b = this.document.body;
- this.moveTo(b.scrollLeft + Math.max(0, Math.floor((b.clientWidth -
- this.width) / 2)), b.scrollTop + 100);
-}
-
-function QWndCtrl_center_moz() {
- this.moveTo(self.pageXOffset + Math.max(0, Math.floor((self.innerWidth -
- this.width) / 2)), self.pageYOffset + 100);
-}
-
-function QWndCtrl_setEffects_ie4(fx) {
- this.effects = fx;
- with (this.wnd) {
- filters[0].enabled = (fx & 256) != 0;
- filters[1].enabled = (fx & 512) != 0;
- filters[2].enabled = (fx & 1024) != 0;
- filters[4].enabled = (fx & 2048) != 0;
- }
-}
-
-function QWndCtrl_setEffects_moz(fx) {
- this.effects = fx;
-}
-
-function QWndCtrl_setOpacity_ie4(op) {
- this.opacity = Math.max(0, Math.min(100, Math.floor(op - 0)));
- this.wnd.filters[3].opacity = this.opacity;
- this.wnd.filters[3].enabled = (this.opacity < 100);
-}
-
-function QWndCtrl_setOpacity_moz(op) {
- this.opacity = Math.max(0, Math.min(100, Math.floor(op - 0)));
- this.wnd.style.MozOpacity = this.opacity + "%";
-}
-
-function QWndCtrl_setSize_css(w, h) {
- this.wnd.style.width = (this.width = Math.floor(w - 0)) + "px";
- this.wnd.style.height = typeof(h) == "number" ? (this.height = Math.floor(h)) + "px" : "auto";
-}
-
-function QWndCtrl_setSize_ns4(w, h) {
- this.wnd.clip.width = this.width = Math.floor(w - 0);
- if (typeof(h) == "number") {
- this.wnd.clip.height = this.height = Math.floor(h);
- }
-}
-
-function QWndCtrl_focus() {
- this.setZIndex(QWndCtrl.TOPZINDEX++);
-}
-
-function QWndCtrl_setZIndex_css(z) {
- this.wnd.style.zIndex = this.zindex = z || 0;
-}
-
-function QWndCtrl_setZIndex_ns4(z) {
- this.wnd.zIndex = this.zindex = z || 0;
-}
-
-function QWndCtrl_moveTo_css(x, y) {
- this.wnd.style.left = (this.x = Math.floor(x - 0)) + "px";
- this.wnd.style.top = (this.y = Math.floor(y - 0)) + "px";
-}
-
-function QWndCtrl_moveTo_ns4(x, y) {
- this.wnd.moveTo(this.x = Math.floor(x - 0), this.y = Math.floor(y - 0));
-}
-
-function QWndCtrl_fxhandler() {
- this.fxhandler = QControl.nop;
- this.onShow(this.visible, this.tag);
-}
-
-function QWndCtrl_show_ie4(show) {
- if (this.visible != show) {
- var fx = false;
- switch (show ? this.effects & 15 : (this.effects & 240) >>> 4) {
- case 1:
- fx = this.wnd.filters[5];
- break;
- case 2:
- (fx = this.wnd.filters[6]).transition = show ? 1 : 0;
- break;
- case 3:
- (fx = this.wnd.filters[6]).transition = show ? 3 : 2;
- break;
- case 4:
- (fx = this.wnd.filters[6]).transition = show ? 5 : 4;
- break;
- case 5:
- (fx = this.wnd.filters[6]).transition = show ? 14 : 13;
- break;
- case 6:
- (fx = this.wnd.filters[6]).transition = show ? 16 : 15;
- break;
- case 7:
- (fx = this.wnd.filters[6]).transition = 12;
- break;
- case 8:
- (fx = this.wnd.filters[6]).transition = 8;
- break;
- case 9:
- (fx = this.wnd.filters[6]).transition = 9;
- }
- if (fx) {
- fx.apply();
- this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";
- this.fxhandler = QWndCtrl_fxhandler;
- fx.play(0.3);
- } else {
- this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";
- this.onShow(show, this.tag);
- }
- }
-}
-
-function QWndCtrl_fade_moz(op, step) {
- this._wndt = false;
- if (step) {
- op += step;
- if ((op > 0) && (op < this.opacity)) {
- this.wnd.style.MozOpacity = op + "%";
- this._wndt = setTimeout(this.name + ".fade(" + op + "," + step + ")", 50);
- } else {
- if (op <= 0) {
- this.wnd.style.visibility = "hidden";
- this.visible = false;
- }
- this.wnd.style.MozOpacity = this.opacity + "%";
- this.onShow(this.visible, this.tag);
- }
- }
-}
-
-function QWndCtrl_show_moz(show) {
- if (this.visible != show) {
- if (this._wndt) {
- clearTimeout(this._wndt);
- this._wndt = false;
- }
- var step = show ? ((this.effects & 15) == 1) && Math.floor(this.opacity / 5) :
- ((this.effects & 240) == 16) && -Math.floor(this.opacity / 5);
- if (step) {
- if (this.visible) {
- this.fade(this.opacity - 0, step);
- } else {
- this.wnd.style.MozOpacity = "0%";
- this.wnd.style.visibility = "visible";
- this.visible = true;
- this.fade(0, step);
- }
- } else {
- this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";
- this.onShow(show, this.tag);
- }
- }
-}
-
-function QWndCtrl_show_css(show) {
- if (this.visible != show) {
- this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";
- this.onShow(show, this.tag);
- }
-}
-
-function QWndCtrl_show_ns4(show) {
- if (this.visible != show) {
- this.wnd.visibility = (this.visible = show) ? "show" : "hidden";
- this.onShow(show, this.tag);
- }
-}
-
-function QWndCtrl_create_dom2() {
- with (this) {
- this.fxhandler = QControl.nop;
- var ie4 = document.body && document.body.filters;
- var moz = document.body && document.body.style &&
- typeof(document.body.style.MozOpacity) == "string";
- document.write('<div unselectable="on" id="' + id +
- (ie4 ? '" onfilterchange="' + name + '.fxhandler()': '') +
- '" style="position:absolute;left:' + x + 'px;top:' + y +
- 'px;width:' + width + (height != null ? 'px;height:' + height : '') +
- 'px;visibility:' + (visible ? 'visible' : 'hidden') +
- ';overflow:hidden' + (zindex ? ';z-index:' + zindex : '') +
- (ie4 ? ';filter:Gray(enabled=' + (effects & 256 ? '1' : '0') +
- ') Xray(enabled=' + (effects & 512 ? '1' : '0') +
- ') Invert(enabled=' + (effects & 1024 ? '1' : '0') +
- ') alpha(enabled=' + (opacity < 100 ? '1' : '0') + ',opacity=' + opacity +
- ') shadow(enabled=' + (effects & 2048 ? '1' : '0') +
- ',direction=135) BlendTrans(enabled=0) RevealTrans(enabled=0)' : '') +
- (moz && (opacity < 100) ? ';-moz-opacity:' + opacity + '%' : '') +
- '"><div unselectable="on" class="qwindow">');
- if (typeof(content) == "function") {
- this.content();
- } else {
- document.write(content);
- }
- document.write('</div></div>');
- if (this.wnd = document.getElementById ? document.getElementById(id) :
- (document.all.item ? document.all.item(id) : document.all[id])) {
- if (wnd.style) {
- ie4 = ie4 && wnd.filters;
- moz = moz && typeof(wnd.style.MozOpacity) == "string";
- this.moveTo = QWndCtrl_moveTo_css;
- this.setZIndex = QWndCtrl_setZIndex_css;
- this.focus = QWndCtrl_focus;
- this.setSize = QWndCtrl_setSize_css;
- this.show = ie4 ? QWndCtrl_show_ie4 : (moz ? QWndCtrl_show_moz : QWndCtrl_show_css);
- this.fade = moz ? QWndCtrl_fade_moz : QControl.nop;
- this.setOpacity = ie4 ? QWndCtrl_setOpacity_ie4 : (moz ? QWndCtrl_setOpacity_moz : QControl.nop);
- this.setEffects = ie4 ? QWndCtrl_setEffects_ie4 : (moz ? QWndCtrl_setEffects_moz : QControl.nop);
- this.center = self.innerWidth ? QWndCtrl_center_moz :
- (document.body && document.body.clientWidth ? QWndCtrl_center_ie4 : QControl.nop);
- }
- }
- }
-}
-
-function QWndCtrl_create_ns4(finalize) {
- with (this) {
- if (finalize) {
- if (_wnde) {
- parent.window.onload = _wnde;
- parent.window.onload();
- }
- document.open();
- document.write('<div class="qwindow">');
- this.content();
- document.write('</div>');
- document.close();
- } else {
- document.write('<layer id="' + id + '" left="' + x + '" top="' + y +
- '" width="' + width + '" visibility="' + (visible ? 'show' : 'hidden') +
- (height != null ? '" height="' + height + '" clip="' + width + ',' + height : '') +
- (zindex ? '" z-index="' + zindex : '') + (typeof(content) != "function" ?
- '"><div class="qwindow">' + content + '</div></layer>' : '">&nbsp;</layer>'));
- if (this.window = this.wnd = document.layers[id]) {
- if (this.document = wnd.document) {
- this.show = QWndCtrl_show_ns4;
- this.moveTo = QWndCtrl_moveTo_ns4;
- this.setZIndex = QWndCtrl_setZIndex_ns4;
- this.focus = QWndCtrl_focus;
- this.center = QWndCtrl_center_moz;
- this.setSize = QWndCtrl_setSize_ns4;
- if (typeof(content) == "function") {
- this._wnde = parent.window.onload;
- parent.window.onload = new Function(name + ".create(true)");
- }
- }
- }
- }
- }
-}
-
-function QWndCtrl_create_na() {
- this.document.write('Object is not supported.');
- this.wnd = null;
-}
-
-function QWndCtrl_create() {
- with (this) {
- this.create = (document.getElementById || document.all) ? QWndCtrl_create_dom2 :
- (document.layers ? QWndCtrl_create_ns4 : QWndCtrl_create_na);
- create();
- }
-}
-
-function QWndCtrl() {
- this.x = this.y = 0;
- this.width = this.height = 0;
- this.content = "";
- this.visible = true;
- this.effects = 0;
- this.opacity = 100;
- this.zindex = null;
- this._wndt = this._wnde = false;
- this.create = QWndCtrl_create;
- this.show = QControl.nop;
- this.focus = QControl.nop;
- this.center = QControl.nop;
- this.moveTo = QControl.nop;
- this.setSize = QControl.nop;
- this.setOpacity = QControl.nop;
- this.setEffects = QControl.nop;
- this.setZIndex = QControl.nop;
- this.onShow = QControl.event;
-}
-QWndCtrl.prototype = new QControl();
-QWndCtrl.TOPZINDEX = 1000;
-QWndCtrl.GRAY = 256;
-QWndCtrl.XRAY = 512;
-QWndCtrl.INVERT = 1024;
-QWndCtrl.SHADOW = 2048;
-QWndCtrl.FADEIN = 1;
-QWndCtrl.FADEOUT = 16;
-QWndCtrl.BOXIN = 2;
-QWndCtrl.BOXOUT = 32;
-QWndCtrl.CIRCLEIN = 3;
-QWndCtrl.CIRCLEOUT = 48;
-QWndCtrl.WIPEIN = 4;
-QWndCtrl.WIPEOUT = 64;
-QWndCtrl.HBARNIN = 5;
-QWndCtrl.HBARNOUT = 80;
-QWndCtrl.VBARNIN = 6;
-QWndCtrl.VBARNOUT = 96;
-QWndCtrl.DISSOLVEIN = 7;
-QWndCtrl.DISSOLVEOUT = 112;
-QWndCtrl.HBLINDSIN = 8;
-QWndCtrl.HBLINDSOUT = 128;
-QWndCtrl.VBLINDSIN = 9;
-QWndCtrl.VBLINDSOUT = 144;
diff --git a/httemplate/elements/select-agent.html b/httemplate/elements/select-agent.html
deleted file mode 100644
index c2a5e4bde..000000000
--- a/httemplate/elements/select-agent.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<%
- my( $agentnum, %opt ) = @_;
-
- my @agents;
- if ( $opt{'agents'} ) {
- @agents = @{ $opt{'agents'} };
- } else {
- @agents = qsearch( 'agent', { disabled=>'' } );
- }
-
-%>
-
-<SELECT NAME="agentnum">
-
- <OPTION VALUE="">all</OPTION>
-
- <% foreach my $agent ( sort { $a->agent cmp $b->agent } @agents ) { %>
-
- <OPTION VALUE="<%= $agent->agentnum %>"<%= $agentnum == $agent->agentnum ? ' SELECTED' : '' %>><%= $agent->agent %>
-
- <% } %>
-
-</SELECT>
-
diff --git a/httemplate/elements/select-month_year.html b/httemplate/elements/select-month_year.html
deleted file mode 100644
index a0ea74ddd..000000000
--- a/httemplate/elements/select-month_year.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<%
-
- my %opt = @_;
-
- my $prefix = $opt{'prefix'} || '';
- my $disabled = $opt{'disabled'} || '';
- my $empty = $opt{'empty_option'} || '';
- my $date = $opt{'selected_date'} || '';
- $date = '' if $date eq '-';
- #$date ||= '01-2000' unless $empty;
- my $start_year = $opt{'start_year'};
- my $end_year = $opt{'end_year'} || '2037';
-
- my( $mon, $year ) = (0, 0);
- if ( $date ) {
- 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";
- }
- }
-
- unless ( $start_year ) {
- my @t = localtime;
- $start_year = $t[5] + 1900;
- }
- $start_year = $year if $start_year > $year && $year > 0;
-
-%>
-
-<SELECT NAME="<%= $prefix %>_month" SIZE="1" <%= $disabled%>>
-
-<%= $empty ? '<OPTION VALUE="">' : '' %>
-
-<% for ( 1 .. 12 ) { %>
- <OPTION<%= $_ == $mon ? ' SELECTED' : '' %> VALUE="<%= $_ %>"><%= $_ %>
-<% } %>
-
-</SELECT>/<SELECT NAME="<%= $prefix %>_year" SIZE="1" <%= $disabled%>>
-
-<%= $empty ? '<OPTION VALUE="">' : '' %>
-
-<% for ( $start_year .. $end_year ) { %>
- <OPTION<%= $_ == $year ? ' SELECTED' : '' %> VALUE="<%= $_ %>"><%= $_ %>
-<% } %>
-
-</SELECT>
-
diff --git a/httemplate/elements/select-taxclass.html b/httemplate/elements/select-taxclass.html
deleted file mode 100644
index e5a1abba1..000000000
--- a/httemplate/elements/select-taxclass.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<%
- my $conf = new FS::Conf;
- my $selected_taxclass = scalar(@_) ? shift : '';
-%>
-
-<% if ( $conf->exists('enable_taxclasses') ) { %>
-
- <SELECT NAME="taxclass">
-
- <% if ( $conf->exists('require_taxclasses') ) { %>
-
- <OPTION VALUE="(select)">Select tax class
-
- <% } else { %>
-
- <OPTION VALUE="">
-
- <% } %>
-
- <%
- my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
- or die dbh->errstr;
- $sth->execute or die $sth->errstr;
- my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
- my @taxclasses = grep $_, keys %taxclasses;
- %>
-
- <% foreach my $taxclass ( @taxclasses ) { %>
-
- <OPTION VALUE="<%= $taxclass %>"<%= $taxclass eq $selected_taxclass ? ' SELECTED' : '' %>><%= $taxclass %>
-
- <% } %>
-
- </SELECT>
-
-<% } else { %>
-
- <INPUT TYPE="hidden" NAME="taxclass" VALUE="<%= $selected_taxclass %>">
-
-<% } %>
-
-
diff --git a/httemplate/elements/small_custview.html b/httemplate/elements/small_custview.html
index e0c22e0c4..1e8ae739a 100644
--- a/httemplate/elements/small_custview.html
+++ b/httemplate/elements/small_custview.html
@@ -1,2 +1,2 @@
<% my $conf = new FS::Conf; %>
-<%= small_custview( shift, shift || scalar($conf->config('countrydefault')), @_ ) %>
+<%= small_custview( shift, shift || $conf->config('countrydefault') ) %>
diff --git a/httemplate/elements/table-grid.html b/httemplate/elements/table-grid.html
deleted file mode 100644
index 80611f511..000000000
--- a/httemplate/elements/table-grid.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<STYLE TYPE="text/css">
-.grid table { border: solid; empty-cells: show }
-.grid TH { padding-left: 3px; padding-right: 3px; border: 1px solid #dddddd; border-bottom: dashed 1px black; border-right: none }
-.grid TD { padding-left: 3px; padding-right: 3px; empty-cells: show; border: 1px solid #cccccc; border-bottom: none; border-right: none }
-</STYLE>
-
-<TABLE CLASS="grid" CELLSPACING=0 CELLPADDING=0 BORDER=1 BORDERCOLOR="#000000" STYLE="border: solid 1px black; empty-cells: show">
-
diff --git a/httemplate/elements/tr-input-beginning_ending.html b/httemplate/elements/tr-input-beginning_ending.html
deleted file mode 100644
index 9fa936bca..000000000
--- a/httemplate/elements/tr-input-beginning_ending.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<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>
-
-
-<TR>
- <TD ALIGN="right">From: </TD>
- <TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
-<SCRIPT TYPE="text/javascript">
- Calendar.setup({
- inputField: "beginning_text",
- ifFormat: "%m/%d/%Y",
- button: "beginning_button",
- align: "BR"
- });
-</SCRIPT>
-</TR>
-
-<TR>
- <TD ALIGN="right">To: </TD>
- <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
-<SCRIPT TYPE="text/javascript">
- Calendar.setup({
- inputField: "ending_text",
- ifFormat: "%m/%d/%Y",
- button: "ending_button",
- align: "BR"
- });
-</SCRIPT>
-</TR>
-
-<TR>
- <TD></TD>
- <TD>
- <FONT SIZE="-1">(leave one or both dates blank for an open-ended search)</FONT>
- </TD>
-</TR>
-
diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html
deleted file mode 100644
index 2227262b6..000000000
--- a/httemplate/elements/tr-select-agent.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<%
- my( $agentnum, %opt ) = @_;
-
- my @agents;
- if ( $opt{'agents'} ) {
- @agents = @{ $opt{'agents'} };
- } else {
- @agents = qsearch( 'agent', { disabled=>'' } );
- }
-
-%>
-
-<% if ( scalar(@agents) == 1 ) { %>
-
- <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agents[0]->agentnum %>">
-
-<% } else { %>
-
- <TR>
- <TD ALIGN="right"><%= $opt{'label'} || 'Agent: ' %></TD>
- <TD>
- <%= include( '/elements/select-agent.html', $agentnum,
- 'agents' => \@agents,
- )
- %>
- </TD>
- </TR>
-
-<% } %>
diff --git a/httemplate/elements/xmlhttp.html b/httemplate/elements/xmlhttp.html
deleted file mode 100644
index 28130e501..000000000
--- a/httemplate/elements/xmlhttp.html
+++ /dev/null
@@ -1,109 +0,0 @@
-<%
- my ( %opt ) = @_;
-
- my $url = $opt{'url'};
- my $method = exists($opt{'method'}) ? $opt{'method'} : 'GET';
- #my @subs = @{ $opt{'subs'};
-
- $url .= ( ($url =~ /\?/) ? '&' : '?' )
- if $method eq 'GET';
-
-%>
-
-<SCRIPT TYPE="text/javascript">
-
- function rs_init_object() {
- var A;
- try {
- A=new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- A=new ActiveXObject("Microsoft.XMLHTTP");
- } catch (oc) {
- A=null;
- }
- }
- if(!A && typeof XMLHttpRequest != "undefined")
- A = new XMLHttpRequest();
- if (!A)
- alert("Can't create XMLHttpRequest object");
- return A;
-
- }
-
- <% foreach my $func ( @{$opt{'subs'}} ) {
-
- my $furl = $url;
- $furl =~ s/\"/\\\\\"/; #javascript escape
-
- %>
-
- function <%=$func%>() {
- // count args; build URL
- var url = "<%=$furl%>";
- var a = <%=$func%>.arguments;
-
- var args;
- var len;
- var content = 'sub=<%= uri_escape($func) %>';
- if ( a && typeof a == 'object' && a[0].constructor == Array ) {
- args = a[0];
- len = args.length
- } else {
- args = a;
- len = args.length - 1;
- }
- for (var i = 0; i < len; i++)
- content = content + "&arg=" + escape(args[i]);
- content = content.replace( /[+]/g, '%2B'); // fix unescaped plus signs
-
- if ( '<%=$method%>' == 'GET' ) {
- url = url + content;
- }
-
- //alert('<%=$method%> ' + url);
-
- var xmlhttp = rs_init_object();
- xmlhttp.open("<%=$method%>", url, true);
-
- xmlhttp.onreadystatechange = function() {
- if (xmlhttp.readyState != 4)
- return;
-
- if (xmlhttp.status != 200) {
- alert(xmlhttp.status + " status connecting to " + url);
- } else {
- var data = xmlhttp.responseText;
- //alert('received response: ' + data);
- a[a.length-1](data);
- if ( data.indexOf("<b>System error</b>") > -1 ) {
- var w;
- if ( w = window.open("about:blank") ) {
- w.document.write(data);
- } else {
- // popup blocking? should use an overlib popup instead
- alert("Error popup disabled; try disabling popup blocking to see");
- }
- }
- }
- }
-
- if ( '<%=$method%>' == 'POST' ) {
-
- xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xmlhttp.send(content);
-
- } else {
-
- xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
- xmlhttp.send(null);
-
- }
-
- //rs_debug("x_$func_name url = " + url);
- //rs_debug("x_$func_name waiting..");
- }
-
- <% } %>
-
-</SCRIPT>
diff --git a/httemplate/images/cvv2.png b/httemplate/images/cvv2.png
index 48c58d561..4610dcbe6 100644
--- a/httemplate/images/cvv2.png
+++ b/httemplate/images/cvv2.png
Binary files differ
diff --git a/httemplate/images/cvv2_amex.png b/httemplate/images/cvv2_amex.png
index 82d1f4715..21c36a0ab 100644
--- a/httemplate/images/cvv2_amex.png
+++ b/httemplate/images/cvv2_amex.png
Binary files differ
diff --git a/httemplate/images/progressbar-empty.png b/httemplate/images/progressbar-empty.png
deleted file mode 100644
index 318219c77..000000000
--- a/httemplate/images/progressbar-empty.png
+++ /dev/null
Binary files differ
diff --git a/httemplate/images/progressbar-full.png b/httemplate/images/progressbar-full.png
deleted file mode 100644
index 863d8e1ee..000000000
--- a/httemplate/images/progressbar-full.png
+++ /dev/null
Binary files differ
diff --git a/httemplate/index.html b/httemplate/index.html
index b8f300d2d..2d326b539 100644
--- a/httemplate/index.html
+++ b/httemplate/index.html
@@ -62,16 +62,16 @@
<TR><TD>
<BR><FONT SIZE="+1"><A HREF="edit/cust_main.cgi">New Customer</A></FONT>
<BR>
- <BR><FORM ACTION="search/cust_main.cgi" METHOD="GET"><INPUT TYPE="hidden" NAME="custnum_on" VALUE="1">Customer # <INPUT TYPE="text" NAME="custnum_text"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/cust_main.cgi?browse=custnum">all customers by customer number</A></FORM>
- <FORM ACTION="search/cust_main.cgi" METHOD="GET"><INPUT TYPE="hidden" NAME="last_on" VALUE="1">Last name <INPUT TYPE="text" NAME="last_text"><SELECT NAME="last_type"><OPTION SELECTED VALUE="All">(all)</OPTION><OPTION>Fuzzy<OPTION>Substring</OPTION><OPTION>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/cust_main.cgi?browse=last">all customers by last name</A></FORM>
- <FORM ACTION="search/cust_main.cgi" METHOD="GET"><INPUT TYPE="hidden" NAME="company_on" VALUE="1">Company <INPUT TYPE="text" NAME="company_text"><SELECT NAME="company_type"><OPTION SELECTED VALUE="All">(all)</OPTION><OPTION>Fuzzy<OPTION>Substring</OPTION><OPTION>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/cust_main.cgi?browse=company">all customers by company</A></FORM>
+ <BR><FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="custnum_on" VALUE="1">Customer # <INPUT TYPE="text" NAME="custnum_text"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/cust_main.cgi?browse=custnum">all customers by customer number</A></FORM>
+ <FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="last_on" VALUE="1">Last name <INPUT TYPE="text" NAME="last_text"><SELECT NAME="last_type"><OPTION SELECTED VALUE="All">(all)</OPTION><OPTION>Fuzzy<OPTION>Substring</OPTION><OPTION>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/cust_main.cgi?browse=last">all customers by last name</A></FORM>
+ <FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="company_on" VALUE="1">Company <INPUT TYPE="text" NAME="company_text"><SELECT NAME="company_type"><OPTION SELECTED VALUE="All">(all)</OPTION><OPTION>Fuzzy<OPTION>Substring</OPTION><OPTION>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/cust_main.cgi?browse=company">all customers by company</A></FORM>
<% if ( $conf->exists('address2-search') ) { %>
- <FORM ACTION="search/cust_main.cgi" METHOD="GET"><INPUT TYPE="hidden" NAME="address2_on" VALUE="1">Unit <INPUT TYPE="text" NAME="address2_text"><INPUT TYPE="submit" VALUE="Search"></FORM>
+ <FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="address2_on" VALUE="1">Unit <INPUT TYPE="text" NAME="address2_text"><INPUT TYPE="submit" VALUE="Search"></FORM>
<% } %>
- <FORM ACTION="search/cust_main.cgi" METHOD="GET"><INPUT TYPE="hidden" NAME="phone_on" VALUE="1">Phone # <INPUT TYPE="text" NAME="phone_text"><INPUT TYPE="submit" VALUE="Search"></FORM>
- <BR><FORM ACTION="search/svc_acct.cgi" METHOD="GET">Username <INPUT TYPE="text" NAME="username"><SELECT NAME="username_type"><OPTION VALUE="All">(all)</OPTION><OPTION>Fuzzy</OPTION><OPTION>Substring</OPTION><OPTION SELECTED>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_acct.cgi?username">all accounts by username</A> or <A HREF="search/svc_acct.cgi?uid">uid</A></FORM>
- <BR><FORM ACTION="search/svc_domain.cgi" METHOD="GET">Domain <INPUT TYPE="text" NAME="domain"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_domain.cgi?domain">all domains</A></FORM>
- <BR><FORM ACTION="search/svc_broadband.cgi" METHOD="GET">IP Address <INPUT TYPE="text" NAME="ip_addr"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_broadband.cgi?svcnum">all services by svcnum</A> or <A HREF="search/svc_broadband.cgi?blocknum">address block</A></FORM>
+ <FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="phone_on" VALUE="1">Phone # <INPUT TYPE="text" NAME="phone_text"><INPUT TYPE="submit" VALUE="Search"></FORM>
+ <BR><FORM ACTION="search/svc_acct.cgi" METHOD="POST">Username <INPUT TYPE="text" NAME="username"><SELECT NAME="username_type"><OPTION VALUE="All">(all)</OPTION><OPTION>Fuzzy</OPTION><OPTION>Substring</OPTION><OPTION SELECTED>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_acct.cgi?username">all accounts by username</A> or <A HREF="search/svc_acct.cgi?uid">uid</A></FORM>
+ <BR><FORM ACTION="search/svc_domain.cgi" METHOD="POST">Domain <INPUT TYPE="text" NAME="domain"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_domain.cgi?domain">all domains</A></FORM>
+ <BR><FORM ACTION="search/svc_broadband.cgi" METHOD="POST">IP Address <INPUT TYPE="text" NAME="ip_addr"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_broadband.cgi?svcnum">all services by svcnum</A> or <A HREF="search/svc_broadband.cgi?blocknum">address block</A></FORM>
<BR><A HREF="search/svc_forward.cgi?svcnum">all mail forwards by svcnum</A><BR>
<BR><A HREF="search/svc_www.cgi?svcnum">all virtual hosts by svcnum</A><BR>
<BR><A HREF="search/svc_external.cgi?svcnum">all external services by svcnum</A><BR>
@@ -91,17 +91,12 @@
<TABLE CELLSPACING=2 CELLPADDING=0 BORDER=0" WIDTH="100%" BGCOLOR="#eeeeee">
<TR><TH BGCOLOR="#cccccc">Support/Ticketing</TH></TR>
<TR><TD>
- <% if ( $conf->config('ticket_system') eq 'RT_Internal' ) { %>
<BR><FONT SIZE="+1"><A HREF="rt/">Ticketing Main</A></FONT>
<BR><BR>
Reports
<UL>
<LI><A HREF="search/cust_main.cgi?browse=tickets">Customers sorted by active tickets</A>
- <!-- <LI><A HREF="">Active tickets not assigned to a customer</A> -->
- <% } else { %>
- <BR><FONT SIZE="+1"><A HREF="<%=FS::TicketSystem->baseurl()%>">Ticketing Main</A></FONT>
- <BR><BR>
- <% } %>
+ <!-- <LI><A HREF="">Active tickets not assigned to a customer</A> -->
</TD></TR>
</TABLE>
@@ -120,14 +115,15 @@
<TABLE CELLSPACING=2 CELLPADDING=0 BORDER=0 WIDTH="100%" BGCOLOR="#eeeeee">
<TR><TH BGCOLOR="#cccccc">Bookkeeping / Collections</TH></TR>
<TR><TD>
- <BR><A HREF="misc/batch-cust_pay.html">Quick payment entry</A>
+ <BR><A HREF="search/cust_main-quickpay.html">Quick payment entry</A>
<BR>
- <BR><FORM ACTION="search/cust_main.cgi" METHOD="GET">Credit card # <INPUT TYPE="hidden" NAME="card_on" VALUE="1"><INPUT TYPE="text" NAME="card"><INPUT TYPE="submit" VALUE="Search"></FORM>
- <FORM ACTION="search/cust_bill.html" METHOD="GET">Invoice # <INPUT TYPE="text" NAME="invnum" SIZE="8"><INPUT TYPE="submit" VALUE="Search"></FORM>
- <FORM ACTION="search/cust_pay.cgi" METHOD="GET">Check # <INPUT TYPE="text" NAME="payinfo" SIZE="8"><INPUT TYPE="hidden" NAME="payby" VALUE="BILL"><INPUT TYPE="submit" VALUE="Search"></FORM>
+ <BR><FORM ACTION="search/cust_main.cgi" METHOD="POST">Credit card # <INPUT TYPE="hidden" NAME="card_on" VALUE="1"><INPUT TYPE="text" NAME="card"><INPUT TYPE="submit" VALUE="Search"></FORM>
+ <FORM ACTION="search/cust_bill.html" METHOD="POST">Invoice # <INPUT TYPE="text" NAME="invnum" SIZE="8"><INPUT TYPE="submit" VALUE="Search"></FORM>
+ <FORM ACTION="search/cust_pay.cgi" METHOD="POST">Check # <INPUT TYPE="text" NAME="payinfo" SIZE="8"><INPUT TYPE="hidden" NAME="payby" VALUE="BILL"><INPUT TYPE="submit" VALUE="Search"></FORM>
<BR><A HREF="browse/cust_pay_batch.cgi">View pending credit card batch</A> <BR><BR><A HREF="search/cust_pkg_report.cgi">Packages (by next bill date range)</A>
<BR><BR>Invoice reports
<UL>
+ <LI><a href="search/cust_bill_event.html">Invoice event errors (failed credit cards, processor or printer problems, etc.)</a>
<LI>open invoices (<A HREF="search/cust_bill.html?OPEN_invnum">by invoice number</A>) (<A HREF="search/cust_bill.html?OPEN_date">by date</A>) (<A HREF="search/cust_bill.html?OPEN_custnum">by customer number</A>)
<LI>15 day open invoices (<A HREF="search/cust_bill.html?OPEN15_invnum">by invoice number</A>) (<A HREF="search/cust_bill.html?OPEN15_date">by date</A>) (<A HREF="search/cust_bill.html?OPEN15_custnum">by customer number</A>)
<LI>30 day open invoices (<A HREF="search/cust_bill.html?OPEN30_invnum">by invoice number</A>) (<A HREF="search/cust_bill.html?OPEN30_date">by date</A>) (<A HREF="search/cust_bill.html?OPEN30_custnum">by customer number</A>)
@@ -136,12 +132,6 @@
<LI>120 day open invoices (<A HREF="search/cust_bill.html?OPEN120_invnum">by invoice number</A>) (<A HREF="search/cust_bill.html?OPEN120_date">by date</A>) (<A HREF="search/cust_bill.html?OPEN120_custnum">by customer number</A>)
<LI>all invoices (<A HREF="search/cust_bill.html?invnum">by invoice number</A>) (<A HREF="search/cust_bill.html?date">by date</A>) (<A HREF="search/cust_bill.html?custnum">by customer number</A>)
</UL>
- <A HREF="search/report_cust_bill.html">Advanced invoice reports</A><BR><BR>
- Invoice event reports
- <UL>
- <LI><a href="search/cust_bill_event.html">All invoice events for a date range</a>
- <LI><a href="search/cust_bill_event.html?failed=1">Invoice event errors for a date range (failed credit cards, processor or printer problems, etc.)</a>
- </UL>
<A HREF="search/report_cust_pay.html">Payment report (by type and/or date range)</A>
<BR><BR><A HREF="search/report_cust_credit.html">Credit report (by employee and/or date range)</A>
<BR><BR><A HREF="graph/money_time.cgi">Sales, Credits and Receipts Summary</A>
@@ -149,6 +139,26 @@
<BR><BR><A HREF="search/report_prepaid_income.html">Prepaid Income (Unearned Revenue) Report</A>
<BR><BR><A HREF="search/report_tax.html">Sales Tax Liability Report</A>
<BR><BR>
+ <CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR>
+ <A NAME="admin">Administration</a>
+ <ul>
+ <LI><A HREF="browse/part_pkg.cgi">View/Edit package definitions</A>
+ - One or more services are grouped together into a package and
+ given pricing information. Customers purchase packages, not
+ services.
+<!-- <LI><A HREF="browse/agent_type.cgi">View/Edit agent types</A>
+ - Agent types define groups of package definitions that you can
+ then assign to particular agents.
+ <LI><A HREF="browse/agent.cgi">View/Edit agents</A>
+ - Agents are resellers of your service. Agents may be limited
+ to a subset of your full offerings (via their type).
+-->
+ <LI><A HREF="browse/cust_main_county.cgi">View/Edit locales and tax rates</A>
+ - Change tax rates, or break down a country into states, or a state
+ into counties and assign different tax rates to each.
+ <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> - Actions for overdue invoices
+ </ul>
+ <BR>
</TD></TR>
</TABLE>
@@ -173,7 +183,7 @@
Auditing pre-Freeside services with no customer record
<UL>
<LI>unlinked accounts (<A HREF="search/svc_acct.cgi?UN_svcnum">by service number</A>) (<A HREF="search/svc_acct.cgi?UN_username">by username</A>) (<A HREF="search/svc_acct.cgi?UN_uid">by uid</A>)
- <LI>unlinked mail forwards (<A HREF="search/svc_forward.cgi?UN_svcnum">by service number</A>)
+<!-- <LI>unlinked mail forwards (<A HREF="search/svc_forward.cgi?UN_svcnum">by service number</A>) (by ?)) -->
<LI>unlinked domains (<A HREF="search/svc_domain.cgi?UN_svcnum">by service number</A>) (<A HREF="search/svc_domain.cgi?UN_domain">by domain</A>)
<LI>unlinked externals (<A HREF="search/svc_external.cgi?UN_svcnum">by service number</A>) (<A HREF="search/svc_external.cgi?UN_id">by id</A>)
</UL>
@@ -185,12 +195,12 @@
<LI><A HREF="search/cust_pkg_report.cgi">packages (by next bill date range)</A>
</UL>
<A HREF="browse/part_pkg.cgi?active=1">Package definitions (by number of active packages)</A><BR><BR>
- <A HREF="browse/part_svc.cgi?orderby=active">Service definitions (by number of active services)</A><BR><BR>
+ <A HREF="browse/part_svc.cgi?active=1">Service definitions (by number of active services)</A><BR><BR>
Customers
<UL>
<LI><A HREF="search/cust_main-otaker.cgi">Search customers by ordering employee</A>
</UL>
- <FORM ACTION="search/sql.html" METHOD="GET">SQL query: <TT>SELECT </TT><INPUT TYPE="text" NAME="sql" SIZE=32><INPUT TYPE="submit" VALUE="Query"></FORM>
+ <FORM ACTION="search/sql.html" METHOD="POST">SQL query: <TT>SELECT </TT><INPUT TYPE="text" NAME="sql" SIZE=32><INPUT TYPE="submit" VALUE="Query"></FORM>
<BR>
</TD></TR>
@@ -222,7 +232,7 @@
<BR><A HREF="misc/dump.cgi">Download database dump</A>
<BR><BR><CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR>
<A NAME="config" HREF="config/config-view.cgi">Configuration</a><!-- - <font size="+2" color="#ff0000">start here</font> -->
- <BR><BR><A NAME="admin">Provisioning, services and packages</a>
+ <BR><BR><A NAME="admin">Administration</a>
<ul>
<LI><A HREF="browse/part_export.cgi">View/Edit exports</A>
- Provisioning services to external machines, databases and APIs.
@@ -232,51 +242,30 @@
- One or more services are grouped together into a package and
given pricing information. Customers purchase packages, not
services.
- </ul>
- <A NAME="admin_agent">Resellers</a>
- <ul>
<LI><A HREF="browse/agent_type.cgi">View/Edit agent types</A>
- Agent types define groups of package definitions that you can
then assign to particular agents.
<LI><A HREF="browse/agent.cgi">View/Edit agents</A>
- Agents are resellers of your service. Agents may be limited
to a subset of your full offerings (via their type).
- </ul>
- <A NAME="admin_billing">Billing</a>
- <ul>
- <LI><A HREF="browse/payment_gateway.html">View/Edit payment gateways</A>
- - Credit card and electronic check processors
- <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A>
- - Actions for overdue invoices
- <LI><A HREF="search/prepay_credit.html">View/Edit prepaid cards</A>
- - View outstanding cards, generate new cards
- <LI><A HREF="browse/rate.cgi">View/Edit call rates and regions</A>
- - Manage rate plans, regions and prefixes for VoIP and call billing.
+ <LI><A HREF="browse/part_referral.cgi">View/Edit advertising sources</A>
+ - Where a customer heard about your service. Tracked for
+ informational purposes.
<LI><A HREF="browse/cust_main_county.cgi">View/Edit locales and tax rates</A>
- Change tax rates, or break down a country into states, or a state
into counties and assign different tax rates to each.
- </ul>
- <A NAME="admin_svc_acct">Dialup</a>
- <ul>
<LI><A HREF="browse/svc_acct_pop.cgi">View/Edit access numbers</A>
- Points of Presence
- </ul>
- <A NAME="admin_svc_broadband">Fixed (username-less) broadband</a>
- <ul>
+ <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> - Actions for overdue invoices
+ <LI><A HREF="browse/msgcat.cgi">View/Edit message catalog</A> - Change error messages and other customizable labels.
+ <LI><A HREF="browse/part_virtual_field.cgi">View/Edit virtual fields</A>
+ - Locally defined fields
<LI><A HREF="browse/router.cgi">View/Edit routers</A>
- Broadband access routers
<LI><A HREF="browse/addr_block.cgi">View/Edit address blocks</A>
- Manage address blocks and block assignments to broadband routers.
- </ul>
- <A NAME="admin_misc">Miscellaneous</a>
- <ul>
- <LI><A HREF="browse/part_referral.cgi">View/Edit advertising sources</A>
- - Where a customer heard about your service. Tracked for
- informational purposes.
- <LI><A HREF="browse/part_virtual_field.cgi">View/Edit virtual fields</A>
- - Locally defined fields
- <LI><A HREF="browse/msgcat.cgi">View/Edit message catalog</A>
- - Change error messages and other customizable labels.
+ <LI><A HREF="browse/rate.cgi">View/Edit call rates and regions</A>
+ - Manage rate plans, regions and prefixes for VoIP and call billing.
</ul>
<BR>
</TD></TR>
diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html
deleted file mode 100644
index 20cc89045..000000000
--- a/httemplate/misc/batch-cust_pay.html
+++ /dev/null
@@ -1,396 +0,0 @@
-<%= header( 'Quick payment entry',
- menubar(
- 'Main Menu' => $p, #popurl(1),
- 'Old-style quick payment entry' =>
- $p. 'search/cust_main-quickpay.html',
- ),
- ( $cgi->param('error') ? '' : 'onload="addRow()"' ),
- )
-%>
-
-<% if ( $cgi->param('error') ) { %>
- <FONT SIZE="+1" COLOR="#ff0000"><%= $cgi->param('error') %></FONT><BR><BR>
-<% } %>
-
-
-<FORM ACTION="process/batch-cust_pay.cgi" NAME="OneTrueForm" METHOD="POST" onsubmit="document.OneTrueForm.submit.disabled=true;">
-
-<!-- <B>Batch</B> <INPUT TYPE="text" NAME="paybatch"><BR><BR> -->
-
-<SCRIPT TYPE="text/javascript">
-
- function clearhint_custnum() {
-
- //this.style.color = '#000000';
-
- if ( this.value == 'Not found' || this.value == 'Multiple' ) {
- this.value = '';
- this.style.color = '#000000';
- }
-
- }
-
- function clearhint_customer() {
-
- this.style.color = '#000000';
-
- if ( this.value == '(last name or company)' || this.value == 'Not found' )
- this.value = '';
-
- }
-
- function search_custnum() {
-
- this.style.color = '#000000'
-
- var custnum_obj = this;
- var searchrow = this.getAttribute('rownum');
- var custnum = this.value;
-
- if ( custnum == 'searching...' || custnum == 'Not found' || custnum == '' )
- return;
-
- if ( this.getAttribute('magic') == 'nosearch' ) {
- this.setAttribute('magic', '');
- return;
- }
-
- if ( ( rownum - searchrow ) == 1 ) {
- addRow();
- }
- var customer = document.getElementById('customer'+searchrow);
- customer.value = 'searching...';
- customer.disabled = true;
- customer.style.color = '#000000';
- customer.style.backgroundColor = '#dddddd';
-
- var customer_select = document.getElementById('cust_select'+searchrow);
-
- //alert('search for custnum ' + custnum + ', row#' + searchrow );
-
- customer.style.display = '';
- customer_select.style.display = 'none';
-
- function search_custnum_update(name) {
-
- var name = eval('(' + name + ')' );
-
- customer.disabled = false;
- customer.style.backgroundColor = '#ffffff';
-
- if ( name.length > 0 ) {
- //alert('custnum found: ' + name);
- customer.value = name;
- customer.setAttribute('magic', 'nosearch');
- } else {
- customer.value = 'Not found';
- customer.style.color = '#ff0000';
- custnum_obj.style.color = '#ff0000';
-
- }
-
- }
-
- custnum_search( custnum, search_custnum_update );
-
- }
-
- function search_customer() {
-
- var customer_obj = this;
- var searchrow = this.getAttribute('rownum');
- var customer = this.value;
-
- if ( customer == 'searching...' || customer == 'Not found' || customer == '' )
- return;
-
- if ( this.getAttribute('magic') == 'nosearch' ) {
- this.setAttribute('magic', '');
- return;
- }
-
- if ( ( rownum - searchrow ) == 1 ) {
- addRow();
- }
-
- var custnum_obj = document.getElementById('custnum'+searchrow);
- custnum_obj.value = 'searching...';
- custnum_obj.disabled = true;
- custnum_obj.style.color = '#000000';
- custnum_obj.style.backgroundColor = '#dddddd';
-
- var customer_select = document.getElementById('cust_select'+searchrow);
-
- //alert('search for customer ' + customer + ', row#' + searchrow );
-
- function search_customer_update(customers) {
-
- //alert('customers returned: ' + customers);
-
- var customerArray = eval('(' + customers + ')');
-
- custnum_obj.disabled = false;
- custnum_obj.style.backgroundColor = '#ffffff';
-
- if ( customerArray.length == 0 ) {
-
- custnum_obj.value = 'Not found';
- custnum_obj.style.color = '#ff0000';
- customer_obj.style.color = '#ff0000';
-
- customer_obj.style.display = '';
- customer_select.style.display = 'none';
-
-
- } else if ( customerArray.length == 1 ) {
-
- //alert('one customer found: ' + customerArray[0]);
-
- custnum_obj.value = customerArray[0][0];
- customer_obj.value = customerArray[0][1];
-
- customer_obj.style.display = '';
- customer_select.style.display = 'none';
-
-
- } else {
-
- custnum_obj.value = 'Multiple'; // or something
- custnum_obj.style.color = '#ff0000';
-
- //alert('multiple customers found, have to create select dropdown');
-
- //blank the current list
- for ( var i = customer_select.length; i >= 0; i-- )
- customer_select.options[i] = null;
-
- opt(customer_select, '', 'Multiple customers match "' + customer + '" - select one', '#ff0000');
-
- //add the multiple customers
- for ( var s = 0; s < customerArray.length; s++ )
- opt(customer_select, customerArray[s][0], customerArray[s][1], '#000000');
-
- opt(customer_select, 'cancel', '(Edit search string)', '#000000');
-
- customer_obj.style.display = 'none';
-
- customer_select.style.display = '';
-
- }
-
- }
-
- smart_search( customer, search_customer_update );
-
- }
-
- function select_customer() {
-
- var custnum = this.options[this.selectedIndex].value;
- var customer = this.options[this.selectedIndex].text;
-
- var searchrow = this.getAttribute('rownum');
- var custnum_obj = document.getElementById('custnum'+searchrow);
- var customer_obj = document.getElementById('customer'+searchrow);
-
- if ( custnum == '' ) {
- //this.style.color = '#ff0000';
-
- } else if ( custnum == 'cancel' ) {
-
- custnum_obj.value = '';
- custnum_obj.style.color = '#000000';
-
- this.style.display = 'none';
- customer_obj.style.display = '';
- customer_obj.focus();
-
- } else {
-
-
- custnum_obj.value = custnum;
- custnum_obj.style.color = '#000000';
-
- customer_obj.value = customer;
- customer_obj.style.color = '#000000';
-
- this.style.display = 'none';
- customer_obj.style.display = '';
-
- }
-
- }
-
- function opt(what,value,text,color) {
- var optionName = new Option(text, value, false, false);
- optionName.style.color = color;
- var length = what.length;
- what.options[length] = optionName;
- }
-
-</SCRIPT>
-
-<TABLE ID="OneTrueTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
-
-<TR>
- <TH>Cust #</TH>
- <TH>Customer</TH>
- <TH>Amount</TH>
- <TH>Check #</TH>
- <TH BGCOLOR="#e8e8e8"></TH>
-</TR>
-
-<% my $row = 0;
- if ( $cgi->param('error') ) {
- my $param = $cgi->Vars;
-%>
-
- <% for ( $row = 0; exists($param->{"custnum$row"}); $row++ ) { %>
-
- <TR>
-
- <TD>
- <INPUT TYPE="text" NAME="custnum<%= $row %>" ID="custnum<%= $row %>" SIZE=8 MAXLENGTH=12 VALUE="<%= $param->{"custnum$row"} %>" rownum="<%= $row %>">
- <SCRIPT TYPE="text/javascript">
- var custnum_input<%= $row %> = document.getElementById("custnum<%= $row %>");
- custnum_input<%= $row %>.onfocus = clearhint_custnum;
- custnum_input<%= $row %>.onchange = search_custnum;
- </SCRIPT>
- </TD>
-
- <TD>
- <INPUT TYPE="text" NAME="customer<%= $row %>" ID="customer<%= $row %>" SIZE=64 VALUE="<%= $param->{"customer$row"} %>" rownum="<%= $row %>">
- <SCRIPT TYPE="text/javascript">
- var customer_input<%= $row %> = document.getElementById("customer<%= $row %>");
- customer_input<%= $row %>.onfocus = clearhint_customer;
- customer_input<%= $row %>.onclick = clearhint_customer;
- customer_input<%= $row %>.onchange = search_customer;
- </SCRIPT>
- <SELECT NAME="cust_select<%= $row %>" ID="cust_select<%= $row %>" rownum="<%= $row %>" STYLE="color:#ff0000; display:none"">
- </SELECT>
- <SCRIPT TYPE="text/javascript">
- var customer_select<%= $row %> = document.getElementById("cust_select<%= $row %>");
- customer_select<%= $row %>.onchange = select_customer;
- </SCRIPT>
- </TD>
-
- <TD>
- $<INPUT TYPE="text" NAME="paid<%= $row %>" SIZE=8 MAXLENGTH=8 VALUE="<%= $param->{"paid$row"} %>" >
- </TD>
-
- <TD>
- <INPUT TYPE="text" NAME="payinfo<%= $row %>" SIZE=10 VALUE="<%= $param->{"payinfo$row"} %>" >
- </TD>
-
- <TD BGCOLOR="#e8e8e8">
- <% if ( $param->{"error$row"} ) { %>
- <FONT SIZE="-1" COLOR="#ff0000">Error: <%= $param->{"error$row"} %></FONT>
- <% } %>
- </TD>
-
- </TR>
-
- <% } %>
-
-<% } %>
-
-</TABLE>
-
-<!-- <BR>
-<INPUT TYPE="button" VALUE="TEST addrow" onclick="addRow()"> -->
-
-<BR>
-<INPUT TYPE="submit" NAME="submit" VALUE="Post payment batch">
-
-</FORM>
-
-
-<%= include('/elements/xmlhttp.html',
- 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi',
- 'subs' => [qw( custnum_search smart_search )],
- )
-%>
-
-<SCRIPT TYPE="text/javascript">
-
- var rownum = <%= $row %>;
-
- function addRow() {
-
- var table = document.getElementById('OneTrueTable');
- var tablebody = table.getElementsByTagName('tbody').item(0);
-
- var row = document.createElement('TR');
-
- var custnum_cell = document.createElement('TD');
-
- var custnum_input = document.createElement('INPUT');
- custnum_input.setAttribute('name', 'custnum'+rownum);
- custnum_input.setAttribute('id', 'custnum'+rownum);
- custnum_input.setAttribute('size', 8);
- custnum_input.setAttribute('maxlength', 12);
- custnum_input.setAttribute('rownum', rownum);
- custnum_input.onfocus = clearhint_custnum;
- custnum_input.onchange = search_custnum;
- custnum_cell.appendChild(custnum_input);
-
- row.appendChild(custnum_cell);
-
- var customer_cell = document.createElement('TD');
-
- var customer_input = document.createElement('INPUT');
- customer_input.setAttribute('name', 'customer'+rownum);
- customer_input.setAttribute('id', 'customer'+rownum);
- customer_input.setAttribute('size', 64);
- customer_input.setAttribute('value', '(last name or company)' );
- customer_input.setAttribute('rownum', rownum);
- customer_input.onfocus = clearhint_customer;
- customer_input.onclick = clearhint_customer;
- customer_input.onchange = search_customer;
- customer_cell.appendChild(customer_input);
-
- var customer_select = document.createElement('SELECT');
- customer_select.setAttribute('name', 'cust_select'+rownum);
- customer_select.setAttribute('id', 'cust_select'+rownum);
- customer_select.setAttribute('rownum', rownum);
- customer_select.style.color = '#ff0000';
- customer_select.style.display = 'none';
- customer_select.onchange = select_customer;
- customer_cell.appendChild(customer_select);
-
- row.appendChild(customer_cell);
-
- var paid_cell = document.createElement('TD');
-
- var paid_text = document.createTextNode('$');
- paid_cell.appendChild(paid_text);
-
- var paid_input = document.createElement('INPUT');
- paid_input.setAttribute('name', 'paid'+rownum);
- paid_input.setAttribute('size', 8);
- paid_input.setAttribute('maxlength', 8);
- paid_cell.appendChild(paid_input);
-
- row.appendChild(paid_cell);
-
- var payinfo_cell = document.createElement('TD');
- var payinfo_input = document.createElement('INPUT');
- payinfo_input.setAttribute('name', 'payinfo'+rownum);
- payinfo_input.setAttribute('size', 10);
- payinfo_cell.appendChild(payinfo_input);
- row.appendChild(payinfo_cell);
-
- var error_cell = document.createElement('TD');
- error_cell.style.backgroundColor = '#e8e8e8';
- row.appendChild(error_cell);
-
- tablebody.appendChild(row);
-
- rownum++;
-
- }
-
-</SCRIPT>
-
-</BODY>
-</HTML>
diff --git a/httemplate/misc/counties.cgi b/httemplate/misc/counties.cgi
deleted file mode 100644
index 80ae616c9..000000000
--- a/httemplate/misc/counties.cgi
+++ /dev/null
@@ -1,17 +0,0 @@
-<%
-
- my( $state, $country ) = $cgi->param('arg');
-
- my @counties =
- sort
- map { s/[\n\r]//g; $_; }
- map { $_->county; }
- qsearch( 'cust_main_county',
- { 'state' => $state,
- 'country' => $country,
- },
- )
- ;
-
-
-%>[ <%= join(', ', map { qq("$_") } @counties) %> ]
diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi
index 519e6c2b2..257c3384f 100755
--- a/httemplate/misc/cust_main-cancel.cgi
+++ b/httemplate/misc/cust_main-cancel.cgi
@@ -1,19 +1,13 @@
<%
-my $custnum;
-my $ban = '';
-if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
- $custnum = $1;
- $ban = $cgi->param('ban');
-} else {
- my($query) = $cgi->keywords;
- $query =~ /^(\d+)$/ || die "Illegal custnum";
- $custnum = $1;
-}
+#untaint custnum
+my($query) = $cgi->keywords;
+$query =~ /^(\d+)$/ || die "Illegal custnum";
+my $custnum = $1;
my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
-my @errors = $cust_main->cancel( 'ban' => $ban );
+my @errors = $cust_main->cancel;
eidiot(join(' / ', @errors)) if scalar(@errors);
#print $cgi->redirect($p. "view/cust_main.cgi?". $cust_main->custnum);
diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi
index ad9ba1abb..a560a1838 100755
--- a/httemplate/misc/email-invoice.cgi
+++ b/httemplate/misc/email-invoice.cgi
@@ -1,17 +1,23 @@
<%
+my $conf = new FS::Conf;
+
#untaint invnum
my($query) = $cgi->keywords;
-$query =~ /^((.+)-)?(\d+)$/;
-my $template = $2;
-my $invnum = $3;
+$query =~ /^(\d*)$/;
+my $invnum = $1;
my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
die "Can't find invoice!\n" unless $cust_bill;
-$cust_bill->email($template);
+my $error = send_email(
+ 'from' => $cust_bill->_agent_invoice_from || $conf->config('invoice_from'),
+ 'to' => [ grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ],
+ 'subject' => 'Invoice',
+ 'body' => [ $cust_bill->print_text ],
+);
+eidiot($error) if $error;
my $custnum = $cust_bill->getfield('custnum');
-
print $cgi->redirect("${p}view/cust_main.cgi?$custnum");
%>
diff --git a/httemplate/misc/email_invoice_events.cgi b/httemplate/misc/email_invoice_events.cgi
deleted file mode 100644
index 12d58d608..000000000
--- a/httemplate/misc/email_invoice_events.cgi
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-
-my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_reemail';
-$server->process;
-
-%>
diff --git a/httemplate/misc/email_invoices.cgi b/httemplate/misc/email_invoices.cgi
deleted file mode 100644
index 0a3978395..000000000
--- a/httemplate/misc/email_invoices.cgi
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-
-my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_reemail';
-$server->process;
-
-%>
diff --git a/httemplate/misc/fax-invoice.cgi b/httemplate/misc/fax-invoice.cgi
deleted file mode 100755
index 94fee2cf2..000000000
--- a/httemplate/misc/fax-invoice.cgi
+++ /dev/null
@@ -1,17 +0,0 @@
-<%
-
-#untaint invnum
-my($query) = $cgi->keywords;
-$query =~ /^((.+)-)?(\d+)$/;
-my $template = $2;
-my $invnum = $3;
-my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
-die "Can't find invoice!\n" unless $cust_bill;
-
-$cust_bill->fax($template);
-
-my $custnum = $cust_bill->getfield('custnum');
-
-print $cgi->redirect("${p}view/cust_main.cgi?$custnum");
-
-%>
diff --git a/httemplate/misc/fax_invoice_events.cgi b/httemplate/misc/fax_invoice_events.cgi
deleted file mode 100644
index a8ded0550..000000000
--- a/httemplate/misc/fax_invoice_events.cgi
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-
-my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_refax';
-$server->process;
-
-%>
diff --git a/httemplate/misc/fax_invoices.cgi b/httemplate/misc/fax_invoices.cgi
deleted file mode 100644
index f16ba8b5e..000000000
--- a/httemplate/misc/fax_invoices.cgi
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-
-my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_refax';
-$server->process;
-
-%>
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index d4fb4a2be..02c6c5428 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -22,7 +22,7 @@
my $conf = new FS::Conf;
my %states = map { $_->state => 1 }
qsearch('cust_main_county', {
- 'country' => $conf->config('countrydefault') || 'US'
+ 'country' => $conf->config('defaultcountry') || 'US'
} );
my @states = sort { $a cmp $b } keys %states;
@@ -183,7 +183,7 @@ function achclose() {
<TR>
<TD ALIGN="right">
Account&nbsp;holder<BR>
- Social&nbsp;security&nbsp;or&nbsp;tax&nbsp;ID&nbsp;#
+ Social&nbsp;security&nbsp;or&nbsp;tax&nbspID&nbsp;#
</TD>
<TD><INPUT TYPE="text" NAME="ss" VALUE="<%=$ss%>"></TD>
</TR>
diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi
index 6a4c2d7f1..144f6156a 100755
--- a/httemplate/misc/print-invoice.cgi
+++ b/httemplate/misc/print-invoice.cgi
@@ -1,14 +1,26 @@
<%
+my $conf = new FS::Conf;
+my $lpr = $conf->config('lpr');
+
#untaint invnum
my($query) = $cgi->keywords;
-$query =~ /^((.+)-)?(\d+)$/;
-my $template = $2;
-my $invnum = $3;
+$query =~ /^(\d*)$/;
+my $invnum = $1;
my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
die "Can't find invoice!\n" unless $cust_bill;
-$cust_bill->print($template);
+ open(LPR,"|$lpr") or die "Can't open $lpr: $!";
+
+ if ( $conf->exists('invoice_latex') ) {
+ print LPR $cust_bill->print_ps; #( date )
+ } else {
+ print LPR $cust_bill->print_text; #( date )
+ }
+
+ close LPR
+ or die $! ? "Error closing $lpr: $!"
+ : "Exit status $? from $lpr";
my $custnum = $cust_bill->getfield('custnum');
diff --git a/httemplate/misc/print_invoice_events.cgi b/httemplate/misc/print_invoice_events.cgi
deleted file mode 100644
index c6a7885a4..000000000
--- a/httemplate/misc/print_invoice_events.cgi
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-
-my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_reprint';
-$server->process;
-
-%>
diff --git a/httemplate/misc/print_invoices.cgi b/httemplate/misc/print_invoices.cgi
deleted file mode 100644
index d7b271c37..000000000
--- a/httemplate/misc/print_invoices.cgi
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-
-my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_reprint';
-$server->process;
-
-%>
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi
deleted file mode 100644
index 12d72e8a0..000000000
--- a/httemplate/misc/process/batch-cust_pay.cgi
+++ /dev/null
@@ -1,42 +0,0 @@
-<%
- my $param = $cgi->Vars;
-
- #my $paybatch = $param->{'paybatch'};
- my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
-
- my @cust_pay = ();
- #my $row = 0;
- #while ( exists($param->{"custnum$row"}) ) {
- for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
- push @cust_pay, new FS::cust_pay {
- 'custnum' => $param->{"custnum$row"},
- 'paid' => $param->{"paid$row"},
- 'payby' => 'BILL',
- 'payinfo' => $param->{"payinfo$row"},
- 'paybatch' => $paybatch,
- }
- if $param->{"custnum$row"}
- || $param->{"paid$row"}
- || $param->{"payinfo$row"};
- #$row++;
- }
-
- my @errors = FS::cust_pay->batch_insert(@cust_pay);
- my $num_errors = scalar(grep $_, @errors);
-
- if ( $num_errors ) {
-
- $cgi->param('error', "$num_errors error". ($num_errors>1 ? 's' : '').
- ' - Batch not processed, correct and resubmit'
- );
-
- my $erow=0;
- $cgi->param('error'. $erow++, shift @errors) while @errors;
-
- %><%= $cgi->redirect($p.'batch-cust_pay.html?'. $cgi->query_string)
-
- %><% } else {
-
- %><%= $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
-
- <% } %>
diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi
index c3d79e22c..acdd1ad03 100755
--- a/httemplate/misc/process/link.cgi
+++ b/httemplate/misc/process/link.cgi
@@ -1,7 +1,5 @@
<%
-my $DEBUG = 0;
-
$cgi->param('pkgnum') =~ /^(\d+)$/;
my $pkgnum = $1;
$cgi->param('svcpart') =~ /^(\d+)$/;
@@ -18,31 +16,14 @@ unless ( $svcnum ) {
if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) {
$search{$1} = $cgi->param('link_value2');
}
-
- my @svc_x = ( sort { ($a->cust_svc->pkgnum > 0) <=> ($b->cust_svc->pkgnum > 0)
+ my $svc_x = ( sort { ($b->cust_svc->pkgnum > 0) <=> ($a->cust_svc->pkgnum > 0)
or ($b->cust_svc->svcpart == $svcpart)
<=> ($a->cust_svc->svcpart == $svcpart)
}
qsearch( $svcdb, \%search )
- );
-
- if ( $DEBUG ) {
- warn scalar(@svc_x). " candidate accounts found for linking ".
- "(svcpart $svcpart):\n";
- foreach my $svc_x ( @svc_x ) {
- warn " ". $svc_x->email.
- " (svcnum ". $svc_x->svcnum. ",".
- " pkgnum ". $svc_x->cust_svc->pkgnum. ",".
- " svcpart ". $svc_x->cust_svc->svcpart. ")\n";
- }
- }
-
- my $svc_x = $svc_x[0];
-
+ )[0];
eidiot("$link_field not found!") unless $svc_x;
-
$svcnum = $svc_x->svcnum;
-
}
my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum});
diff --git a/httemplate/misc/states.cgi b/httemplate/misc/states.cgi
deleted file mode 100644
index cff2c9774..000000000
--- a/httemplate/misc/states.cgi
+++ /dev/null
@@ -1,16 +0,0 @@
-<%
-
- my $country = $cgi->param('arg');
-
- my @states =
- sort
- map { s/[\n\r]//g; $_; }
- map { $_->state; }
- qsearch( 'cust_main_county',
- { 'country' => $country },
- 'DISTINCT ON ( state ) *',
- )
- ;
-
-
-%>[ <%= join(', ', map { qq("$_") } @states) %> ]
diff --git a/httemplate/misc/unvoid-cust_pay_void.cgi b/httemplate/misc/unvoid-cust_pay_void.cgi
deleted file mode 100755
index 539cd4a23..000000000
--- a/httemplate/misc/unvoid-cust_pay_void.cgi
+++ /dev/null
@@ -1,16 +0,0 @@
-<%
-
-#untaint paynum
-my($query) = $cgi->keywords;
-$query =~ /^(\d+)$/ || die "Illegal paynum";
-my $paynum = $1;
-
-my $cust_pay_void = qsearchs('cust_pay_void', { 'paynum' => $paynum } );
-my $custnum = $cust_pay_void->custnum;
-
-my $error = $cust_pay_void->unvoid;
-eidiot($error) if $error;
-
-print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
-
-%>
diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi
deleted file mode 100644
index 8dbd5a4f2..000000000
--- a/httemplate/misc/xmlhttp-cust_main-search.cgi
+++ /dev/null
@@ -1,21 +0,0 @@
-<%
- my $sub = $cgi->param('sub');
-
- if ( $sub eq 'custnum_search' ) {
-
- my $custnum = $cgi->param('arg');
- my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
-
- %>"<%= $cust_main ? $cust_main->name : '' %>"
-
-<% } elsif ( $sub eq 'smart_search' ) {
-
- my $string = $cgi->param('arg');
- my @cust_main = smart_search( 'search' => $string );
- my $return = [ map [ $_->custnum, $_->name ], @cust_main ];
-
- %><%= objToJson($return) %>
-
-<% } %>
-
-
diff --git a/httemplate/misc/xmlrpc.cgi b/httemplate/misc/xmlrpc.cgi
deleted file mode 100644
index 53ef8fb80..000000000
--- a/httemplate/misc/xmlrpc.cgi
+++ /dev/null
@@ -1,17 +0,0 @@
-<%
-
- my $request_xml = $cgi->param('POSTDATA');
-
- #$r->log_error($request_xml);
-
- my $fsxmlrpc = new FS::XMLRPC;
- my ($error, $response_xml) = $fsxmlrpc->serve($request_xml);
-
- #$r->log_error($error) if $error;
-
- http_header('Content-Type' => 'text/xml',
- 'Content-Length' => length($response_xml));
-
- print $response_xml;
-
-%>
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 2108653a8..3ae624af2 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -1,52 +1,6 @@
<%
my( $count_query, $sql_query );
- my( $count_addl ) = ( '' );
- my( $distinct ) = ( '' );
- my($begin, $end) = ( '', '' );
- my($agentnum) = ( '' );
- my($open, $days) = ( '', '' );
- if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
- $count_query = "SELECT COUNT(*) FROM cust_bill WHERE invnum = $2";
- $sql_query = {
- 'table' => 'cust_bill',
- 'hashref' => { 'invnum' => $2 },
- #'select' => '*',
- };
- } else {
- #if ( $cgi->param('begin') || $cgi->param('end')
- # || $cgi->param('beginning') || $cgi->param('ending')
- # || $cgi->keywords
- # )
- #{
-
- #some false laziness w/cust_bill::re_X
- my @where;
- my $orderby = 'ORDER BY cust_bill._date';
-
- if ( $cgi->param('beginning')
- && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) {
- $begin = str2time($1);
- push @where, "cust_bill._date >= $begin";
- }
- if ( $cgi->param('ending')
- && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) {
- $end = str2time($1) + 86399;
- push @where, "cust_bill._date < $end";
- }
-
- if ( $cgi->param('begin') =~ /^(\d+)$/ ) {
- $begin = $1;
- push @where, "cust_bill._date >= $begin";
- }
- if ( $cgi->param('end') =~ /^(\d+)$/ ) {
- $end = $1;
- push @where, "cust_bill._date < $end";
- }
-
- if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $agentnum = $1;
- push @where, "cust_main.agentnum = $agentnum";
- }
+ if ( $cgi->param('begin') || $cgi->param('end') || $cgi->keywords ) {
my $owed =
"charged - ( SELECT COALESCE(SUM(amount),0) FROM cust_bill_pay
@@ -54,126 +8,94 @@
- ( SELECT COALESCE(SUM(amount),0) FROM cust_credit_bill
WHERE cust_credit_bill.invnum = cust_bill.invnum )";
- if ( $cgi->param('open') ) {
- push @where, "0 != $owed";
- $open = 1;
+ my @where;
+ my $orderby = 'ORDER BY cust_bill._date';
+
+ if ( $cgi->param('begin') =~ /^(\d+)$/ ) {
+ push @where, "cust_bill._date >= $1",
+ }
+ if ( $cgi->param('end') =~ /^(\d+)$/ ) {
+ push @where, "cust_bill._date < $1",
}
my($query) = $cgi->keywords;
if ( $query =~ /^(OPEN(\d*)_)?(invnum|date|custnum)$/ ) {
- ($open, $days, my $field) = ($1, $2, $3);
+ my($open, $days, $field) = ($1, $2, $3);
$field = "_date" if $field eq 'date';
$orderby = "ORDER BY cust_bill.$field";
push @where, "0 != $owed" if $open;
push @where, "cust_bill._date < ". (time-86400*$days) if $days;
}
-
+
my $extra_sql = scalar(@where) ? 'WHERE '. join(' AND ', @where) : '';
-
- my $addl_from = 'left join cust_main using ( custnum )';
-
- if ( $cgi->param('newest_percust') ) {
- $distinct = 'DISTINCT ON ( cust_bill.custnum )';
- $orderby = 'ORDER BY cust_bill.custnum ASC, cust_bill._date DESC';
- #$count_query = "SELECT 'N/A', 'N/A', 'N/A'"; #XXXXXXX fix
- $count_query = "SELECT COUNT(DISTINCT cust_bill.custnum), 'N/A', 'N/A'";
- }
- unless ( $count_query ) {
- $count_query = "SELECT COUNT(*), sum(charged), sum($owed)";
- $count_addl = [ '$%.2f total invoiced',
- '$%.2f total outstanding balance',
- ];
- }
- $count_query .= " FROM cust_bill $addl_from $extra_sql";
+ $count_query = "SELECT COUNT(*), sum(charged), sum($owed)
+ FROM cust_bill $extra_sql";
$sql_query = {
'table' => 'cust_bill',
- 'addl_from' => $addl_from,
'hashref' => {},
- 'select' => "$distinct ". join(', ',
- 'cust_bill.*',
- #( map "cust_main.$_", qw(custnum last first company) ),
- 'cust_main.custnum as cust_main_custnum',
- FS::UI::Web::cust_sql_fields(),
- "$owed as owed",
- ),
+ 'select' => "cust_bill.*, $owed as owed",
'extra_sql' => "$extra_sql $orderby"
};
+ } else {
+ $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/;
+ $count_query = "SELECT COUNT(*) FROM cust_bill WHERE invnum = $2";
+ $sql_query = {
+ 'table' => 'cust_bill',
+ 'hashref' => { 'invnum' => $2 },
+ #'select' => '*',
+ };
}
my $link = [ "${p}view/cust_bill.cgi?", 'invnum', ];
my $clink = sub {
my $cust_bill = shift;
- $cust_bill->cust_main_custnum
+ my $cust_main = $cust_bill->cust_main;
+ $cust_main
? [ "${p}view/cust_main.cgi?", 'custnum' ]
: '';
};
- my $conf = new FS::Conf;
- my $money_char = $conf->config('money_char') || '$';
-
- my $html_init = join("\n", map {
- ( my $action = $_ ) =~ s/_$//;
- include('/elements/progress-init.html',
- $_.'form',
- [ 'begin', 'end', 'agentnum', 'open', 'days', 'newest_percust' ],
- "../misc/${_}invoices.cgi",
- { 'message' => "Invoices re-${action}ed" }, #would be nice to show the number of them, but...
- $_, #key
- ),
- qq!<FORM NAME="${_}form">!,
- qq!<INPUT TYPE="hidden" NAME="begin" VALUE="$begin">!,
- qq!<INPUT TYPE="hidden" NAME="end" VALUE="$end">!,
- qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$agentnum">!,
- qq!<INPUT TYPE="hidden" NAME="open" VALUE="$open">!,
- qq!<INPUT TYPE="hidden" NAME="days" VALUE="$days">!,
- qq!</FORM>!
- } qw( print_ email_ fax_ ) );
-
- my $menubar = [
- 'Main menu' => $p,
- 'Print these invoices' =>
- "javascript:print_process()",
- 'Email these invoices' =>
- "javascript:email_process()",
- ];
-
- push @$menubar, 'Fax these invoices' =>
- "javascript:fax_process()"
- if $conf->exists('hylafax');
-
-%><%= include( 'elements/search.html',
- 'title' => 'Invoice Search Results',
- 'html_init' => $html_init,
- 'menubar' => $menubar,
- 'name' => 'invoices',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'count_addl' => $count_addl,
- 'redirect' => $link,
- 'header' => [ 'Invoice #',
- 'Balance',
- 'Amount',
- 'Date',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [
- 'invnum',
- sub { sprintf($money_char.'%.2f', shift->get('owed') ) },
- sub { sprintf($money_char.'%.2f', shift->charged ) },
- sub { time2str('%b %d %Y', shift->_date ) },
- \&FS::UI::Web::cust_fields,
- ],
- 'align' => 'rrrrll',
- 'links' => [
- $link,
- $link,
- $link,
- $link,
- ( map { $clink } FS::UI::Web::cust_header() ),
- ],
-
- )
+%>
+<%= include( 'elements/search.html',
+ 'title' => 'Invoice Search Results',
+ 'name' => 'invoices',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'count_addl' => [ '$%.2f total invoiced',
+ '$%.2f total outstanding balance',
+ ],
+ 'redirect' => $link,
+ 'header' =>
+ [ 'Invoice #', qw(Balance Amount Date), 'Contact name',
+ 'Company' ],
+ 'fields' => [
+ 'invnum',
+ sub { sprintf('$%.2f', shift->get('owed') ) },
+ sub { sprintf('$%.2f', shift->charged ) },
+ sub { time2str('%b %d %Y', shift->_date ) },
+ sub { my $cust_bill = shift;
+ my $cust_main = $cust_bill->cust_main;
+ $cust_main
+ ? $cust_main->get('last'). ', '. $cust_main->first
+ : "WARNING: can't find cust_main.custnum ".
+ $cust_bill->custnum. ' (cust_bill.invnum '.
+ $cust_bill->invnum. ')';
+ },
+ sub { my $cust_main = shift->cust_main;
+ $cust_main ? $cust_main->company : '';
+ },
+ ],
+ 'links' => [
+ $link,
+ $link,
+ $link,
+ $link,
+ $clink,
+ $clink,
+ ],
+
+ )
%>
diff --git a/httemplate/search/cust_bill_event.cgi b/httemplate/search/cust_bill_event.cgi
index d82a83368..7c2b3a24c 100644
--- a/httemplate/search/cust_bill_event.cgi
+++ b/httemplate/search/cust_bill_event.cgi
@@ -1,137 +1,62 @@
+<!-- mason kludge -->
<%
-my $title = $cgi->param('failed') ? 'Failed invoice events' : 'Invoice events';
+#false laziness with view/cust_bill.cgi
-my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
+$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
+my $beginning = str2time($1) || 0;
-##tie my %hash, 'Tie::DxHash',
-#my %hash = (
-# _date => { op=> '>=', value=>$beginning },
-## i wish...
-## _date => { op=> '<=', value=>$ending },
-#);
-#$hash{'statustext'} = { op=> '!=', value=>'' }
-# if $cgi->param('failed');
+$cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
+my $ending = ( $1 ? str2time($1) : 4294880896 ) + 86399;
-my $where = " WHERE cust_bill_event._date >= $beginning".
- " AND cust_bill_event._date <= $ending";
+my @cust_bill_event =
+ sort { $a->_date <=> $b->_date }
+ qsearch('cust_bill_event', {
+ _date => { op=> '>=', value=>$beginning },
+ statustext => { op=> '!=', value=>'' },
+# i wish...
+# _date => { op=> '<=', value=>$ending },
+ }, '', "AND _date <= $ending");
-if ( $cgi->param('failed') ) {
- $where .= " AND statustext != '' ".
- " AND statustext IS NOT NULL ".
- " AND statustext != 'N/A' "
-}
-
-if ( $cgi->param('part_bill_event.payby') =~ /^(\w+)$/ ) {
- $where .= " AND part_bill_event.payby = '$1' ";
-}
-
-my $sql_query = {
- 'table' => 'cust_bill_event',
- #'hashref' => \%hash,
- 'hashref' => {},
- 'select' => join(', ',
- 'cust_bill_event.*',
- 'part_bill_event.event',
- 'cust_bill.custnum',
- 'cust_bill._date AS cust_bill_date',
- 'cust_main.custnum AS cust_main_custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'extra_sql' => "$where ORDER BY _date ASC",
- 'addl_from' => 'LEFT JOIN part_bill_event USING ( eventpart ) '.
- 'LEFT JOIN cust_bill USING ( invnum ) '.
- 'LEFT JOIN cust_main USING ( custnum ) ',
-};
-
-my $count_sql = "SELECT COUNT(*) FROM cust_bill_event ".
- "LEFT JOIN part_bill_event USING ( eventpart ) ".
- $where;
-
-my $conf = new FS::Conf;
-
-my $failed = $cgi->param('failed');
-
-my $html_init = join("\n", map {
- ( my $action = $_ ) =~ s/_$//;
- include('/elements/progress-init.html',
- $_.'form',
- [ 'action', 'beginning', 'ending', 'failed' ],
- "../misc/${_}invoice_events.cgi",
- { 'message' => "Invoices re-${action}ed" }, #would be nice to show the number of them, but...
- $_, #key
- ),
- qq!<FORM NAME="${_}form">!,
- qq!<INPUT TYPE="hidden" NAME="action" VALUE="$_">!, #not used though
- qq!<INPUT TYPE="hidden" NAME="beginning" VALUE="$beginning">!,
- qq!<INPUT TYPE="hidden" NAME="ending" VALUE="$ending">!,
- qq!<INPUT TYPE="hidden" NAME="failed" VALUE="$failed">!,
- qq!</FORM>!
-} qw( print_ email_ fax_ ) );
-
-my $menubar = [
- 'Main menu' => $p,
- 'Re-print these events' =>
- "javascript:print_process()",
- 'Re-email these events' =>
- "javascript:email_process()",
- ];
-
-push @$menubar, 'Re-fax these events' =>
- "javascript:fax_process()"
- if $conf->exists('hylafax');
-
-my $link_cust = sub {
- my $cust_bill_event = shift;
- $cust_bill_event->cust_main_custnum
- ? [ "${p}view/cust_main.cgi?", 'custnum' ]
- : '';
-};
+%>
-%><%= include( 'elements/search.html',
- 'title' => $title,
- 'html_init' => $html_init,
- 'menubar' => $menubar,
- 'name' => 'billing events',
- 'query' => $sql_query,
- 'count_query' => $count_sql,
- 'header' => [ 'Event',
- 'Date',
- 'Status',
- #'Inv #', 'Inv Date', 'Cust #',
- 'Invoice',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [
- 'event',
- sub { time2str("%b %d %Y %T", $_[0]->_date) },
- sub {
- #my $cust_bill_event = shift;
- my $status = $_[0]->status;
- $status .= ': '.$_[0]->statustext
- if $_[0]->statustext;
- $status;
- },
- sub {
- #my $cust_bill_event = shift;
- 'Invoice #'. $_[0]->invnum.
- ' ('.
- time2str("%D", $_[0]->cust_bill_date).
- ')';
- },
- \&FS::UI::Web::cust_fields,
- ],
- 'links' => [
- '',
- '',
- '',
- sub {
- my $part_bill_event = shift;
- my $template = $part_bill_event->templatename;
- $template .= '-' if $template;
- [ "${p}view/cust_bill.cgi?$template", 'invnum'];
- },
- ( map { $link_cust } FS::UI::Web::cust_header() ),
- ],
- )
+<%= header('Failed billing events') %>
+
+<%= table() %>
+<TR>
+ <TH>Event</TH>
+ <TH>Date</TH>
+ <TH>Status</TH>
+ <TH>Invoice</TH>
+ <TH>(bill) name</TH>
+ <TH>company</TH>
+<% if ( defined dbdef->table('cust_main')->column('ship_last') ) { %>
+ <TH>(service) name</TH>
+ <TH>company</TH>
+<% } %>
+</TR>
+
+<% foreach my $cust_bill_event ( @cust_bill_event ) {
+ my $status = $cust_bill_event->status;
+ $status .= ': '.$cust_bill_event->statustext if $cust_bill_event->statustext;
+ my $cust_bill = $cust_bill_event->cust_bill;
+ my $cust_main = $cust_bill->cust_main;
+ my $invlink = "${p}view/cust_bill.cgi?". $cust_bill->invnum;
+ my $custlink = "${p}view/cust_main.cgi?". $cust_main->custnum;
%>
+<TR>
+ <TD><%= $cust_bill_event->part_bill_event->event %></TD>
+ <TD><%= time2str("%a %b %e %T %Y", $cust_bill_event->_date) %></TD>
+ <TD><%= $status %></TD>
+ <TD><A HREF="<%=$invlink%>">Invoice #<%= $cust_bill->invnum %> (<%= time2str("%D", $cust_bill->_date ) %>)</A></TD>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->last. ', '. $cust_main->first %></A></TD>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->company %></A></TD>
+ <% if ( defined dbdef->table('cust_main')->column('ship_last') ) { %>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->ship_last. ', '. $cust_main->ship_first %></A></TD>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->ship_company %></A></TD>
+ <% } %>
+</TR>
+<% } %>
+</TABLE>
+
+</BODY></HTML>
diff --git a/httemplate/search/cust_bill_event.html b/httemplate/search/cust_bill_event.html
index 197f28028..cd96ddf51 100755
--- a/httemplate/search/cust_bill_event.html
+++ b/httemplate/search/cust_bill_event.html
@@ -1,15 +1,14 @@
-<%= include(
- '/elements/header.html',
- ( $cgi->param('failed') ? 'Failed invoice events' : 'Invoice events' ),
- include('/elements/menubar.html',
- 'Main menu' => $p, # popurl(2),
- ),
-
- )
-%>
-
- <FORM ACTION="cust_bill_event.cgi" METHOD="GET">
- <INPUT TYPE="hidden" NAME="failed" VALUE="<%= $cgi->param('failed') %>">
+<HTML>
+ <HEAD>
+ <TITLE>Invoice event errors</TITLE>
+ <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>
+ </HEAD>
+ <BODY BGCOLOR="#e8e8e8">
+ <H1>Invoice event errors</H1>
+ <FORM ACTION="cust_bill_event.cgi" METHOD="post">
<TABLE>
<!--<TR>
<TD ALIGN="right">Customer type</TD>
@@ -23,36 +22,33 @@
</TD>
</TR>
-->
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
- <!--
<TR>
- <TD ALIGN="right">Events: </TD>
- <TD>
- <SELECT NAME="eventpart">
- <OPTION SELECTED VALUE=""><%= $cgi->param('failed') ? '(all failed events)' : '(all events)' %>
- <% foreach my $part_bill_event ( qsearch( 'part_bill_event', {} ) ) { %>
- <% } %>
- </SELECT>
- </TD>
+ <TD ALIGN="right">From: </TD>
+ <TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "beginning_text",
+ ifFormat: "%m/%d/%Y",
+ button: "beginning_button",
+ align: "BR"
+ });
+</SCRIPT>
</TR>
- -->
<TR>
- <TD ALIGN="right">Events for payment type: </TD>
- <TD>
- <SELECT NAME="part_bill_event.payby">
- <OPTION SELECTED VALUE="">(all)
- <OPTION VALUE="CARD">Credit card (automatic)
- <OPTION VALUE="BILL">Billing
- <OPTION VALUE="CHEK">Electronic check (automatic)
- <OPTION VALUE="DCRD">Credit card (on-demand)
- <OPTION VALUE="DCHK">Electronic check (on-demand)
- <OPTION VALUE="LECB">Phone bill billing
- <OPTION VALUE="COMP">Complimentary
- </SELECT>
- </TD>
+ <TD ALIGN="right">To: </TD>
+ <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "ending_text",
+ ifFormat: "%m/%d/%Y",
+ button: "ending_button",
+ align: "BR"
+ });
+</SCRIPT>
</TR>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Get Report">
</FORM>
</BODY>
</HTML>
+
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
deleted file mode 100644
index 082ccc893..000000000
--- a/httemplate/search/cust_bill_pkg.cgi
+++ /dev/null
@@ -1,148 +0,0 @@
-<%
-
-my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
-
-my $join_cust = "
- JOIN cust_bill USING ( invnum )
- JOIN cust_main USING ( custnum )
-";
-
-my $join_pkg = "
- LEFT JOIN cust_pkg USING ( pkgnum )
- LEFT JOIN part_pkg USING ( pkgpart )
-";
-
-my $where = "
- WHERE _date >= $beginning AND _date <= $ending
- AND payby != 'COMP'
-";
-
-if ( $cgi->param('out') ) {
-
- $where .= "
- AND 0 = (
- SELECT COUNT(*) FROM cust_main_county
- WHERE ( cust_main_county.county = cust_main.county
- OR ( cust_main_county.county IS NULL AND cust_main.county = '' )
- OR ( cust_main_county.county = '' AND cust_main.county IS NULL)
- OR ( cust_main_county.county IS NULL AND cust_main.county IS NULL)
- )
- AND ( cust_main_county.state = cust_main.state
- OR ( cust_main_county.state IS NULL AND cust_main.state = '' )
- OR ( cust_main_county.state = '' AND cust_main.state IS NULL )
- OR ( cust_main_county.state IS NULL AND cust_main.state IS NULL )
- )
- AND cust_main_county.country = cust_main.country
- AND cust_main_county.tax > 0
- )
- ";
-
-} elsif ( $cgi->param('country' ) ) {
-
- my $county = dbh->quote( $cgi->param('county') );
- my $state = dbh->quote( $cgi->param('state') );
- my $country = dbh->quote( $cgi->param('country') );
- $where .= "
- AND ( county = $county OR $county = '' )
- AND ( state = $state OR $state = '' )
- AND country = $country
- ";
- $where .= ' AND taxclass = '. dbh->quote( $cgi->param('taxclass') )
- if $cgi->param('taxclass');
-
-}
-
-$where .= ' AND pkgnum != 0' if $cgi->param('nottax');
-
-$where .= ' AND pkgnum = 0' if $cgi->param('istax');
-
-$where .= " AND tax = 'Y'" if $cgi->param('cust_tax');
-
-my $count_query;
-if ( $cgi->param('pkg_tax') ) {
-
- $count_query =
- "SELECT COUNT(*), SUM( ( CASE WHEN part_pkg.setuptax = 'Y'
- THEN cust_bill_pkg.setup
- ELSE 0 )
- +
- ( CASE WHEN part_pkg.recurtax = 'Y'
- THEN cust_bill_pkg.recur
- ELSE 0 )
- )";
-
- $where .= " AND (
- ( part_pkg.setuptax = 'Y' AND cust_bill_pkg.setup > 0 )
- OR ( part_pkg.recurtax = 'Y' AND cust_bill_pkg.recur > 0 )
- )";
-
-} else {
-
- $count_query =
- "SELECT COUNT(*), SUM(cust_bill_pkg.setup + cust_bill_pkg.recur)";
-
-}
-$count_query .= " FROM cust_bill_pkg $join_cust $join_pkg $where";
-
-my $query = {
- 'table' => 'cust_bill_pkg',
- 'addl_from' => "$join_cust $join_pkg",
- 'hashref' => {},
- 'select' => join(', ',
- 'cust_bill_pkg.*',
- 'cust_bill._date',
- 'part_pkg.pkg',
- 'cust_main.custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'extra_sql' => $where,
-};
-
-my $ilink = [ "${p}view/cust_bill.cgi?", 'invnum' ];
-my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
-
-my $conf = new FS::Conf;
-my $money_char = $conf->config('money_char') || '$';
-
-%><%= include( 'elements/search.html',
- 'title' => 'Line items',
- 'name' => 'line items',
- 'query' => $query,
- 'count_query' => $count_query,
- 'count_addl' => [ $money_char. '%.2f total', ],
- 'header' => [
- '#',
- 'Description',
- 'Setup charge',
- 'Recurring charge',
- 'Invoice',
- 'Date',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [
- 'billpkgnum',
- sub { $_[0]->pkgnum > 0
- ? $_[0]->get('pkg')
- : $_[0]->get('itemdesc')
- },
- #strikethrough or "N/A ($amount)" or something these when
- # they're not applicable to pkg_tax search
- sub { sprintf($money_char.'%.2f', shift->setup ) },
- sub { sprintf($money_char.'%.2f', shift->recur ) },
- 'invnum',
- sub { time2str('%b %d %Y', shift->_date ) },
- \&FS::UI::Web::cust_fields,
- ],
- 'links' => [
- '',
- '',
- '',
- '',
- $ilink,
- $ilink,
- ( map { $clink } FS::UI::Web::cust_header() ),
- ],
- 'align' => 'rlrrrc',
- )
-%>
-
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index 279d682cd..faaa7a817 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -1,18 +1,10 @@
<%
- my $title = 'Credit Search Results';
#my( $count_query, $sql_query );
my @search = ();
if ( $cgi->param('otaker') && $cgi->param('otaker') =~ /^([\w\.\-]+)$/ ) {
- push @search, "cust_credit.otaker = '$1'";
- }
-
- if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- push @search, "agentnum = $1";
- my $agent = qsearchs('agent', { 'agentnum' => $1 } );
- die "unknown agentnum $1" unless $agent;
- $title = $agent->agent. " $title";
+ push @search, "otaker = '$1'";
}
#false laziness with cust_pkg.cgi and cust_pay.cgi
@@ -40,58 +32,49 @@
? 'WHERE '. join(' AND ', @search)
: '';
- my $count_query = 'SELECT COUNT(*), SUM(amount) '.
- 'FROM cust_credit LEFT JOIN cust_main USING ( custnum ) '.
- $where;
-
+ my $count_query = "SELECT COUNT(*), SUM(amount) FROM cust_credit $where";
my $sql_query = {
'table' => 'cust_credit',
- 'select' => join(', ',
- 'cust_credit.*',
- 'cust_main.custnum as cust_main_custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
'hashref' => {},
'extra_sql' => $where,
- 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
};
- my $clink = sub {
- my $cust_bill = shift;
- $cust_bill->cust_main_custnum
- ? [ "${p}view/cust_main.cgi?", 'custnum' ]
- : '';
- };
+ my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
-%><%= include( 'elements/search.html',
- 'title' => $title,
- 'name' => 'credits',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'count_addl' => [ '$%.2f total credited', ],
- #'redirect' => $link,
- 'header' => [ 'Amount',
- 'Date',
- FS::UI::Web::cust_header(),
- 'By',
- 'Reason'
- ],
- 'fields' => [
- #'crednum',
- sub { sprintf('$%.2f', shift->amount ) },
- sub { time2str('%b %d %Y', shift->_date ) },
- \&FS::UI::Web::cust_fields,
- 'otaker',
- 'reason',
- ],
- #'align' => 'rrrllll',
- 'align' => 'rr',
- 'links' => [
- '',
- '',
- ( map { $clink } FS::UI::Web::cust_header() ),
- '',
- '',
- ],
- )
+%>
+<%= include( 'elements/search.html',
+ 'title' => 'Credit Search Results',
+ 'name' => 'credits',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'count_addl' => [ '$%.2f total credited', ],
+ #'redirect' => $link,
+ 'header' =>
+ [ qw(Amount Date), 'Cust #', 'Contact name',
+ qw(Company By Reason) ],
+ 'fields' => [
+ #'crednum',
+ sub { sprintf('$%.2f', shift->amount ) },
+ sub { time2str('%b %d %Y', shift->_date ) },
+ 'custnum',
+ sub { my $cust_main = shift->cust_main;
+ $cust_main->get('last'). ', '. $cust_main->first;
+ },
+ sub { my $cust_main = shift->cust_main;
+ $cust_main->company;
+ },
+ 'otaker',
+ 'reason',
+ ],
+ 'align' => 'rrrllll',
+ 'links' => [
+ '',
+ '',
+ $clink,
+ $clink,
+ $clink,
+ '',
+ '',
+ ],
+ )
%>
diff --git a/httemplate/search/cust_main-otaker.cgi b/httemplate/search/cust_main-otaker.cgi
index 03c2619af..44214368a 100755
--- a/httemplate/search/cust_main-otaker.cgi
+++ b/httemplate/search/cust_main-otaker.cgi
@@ -7,7 +7,7 @@
Customer Search
</FONT>
<BR>
- <FORM ACTION="cust_main.cgi" METHOD="GET">
+ <FORM ACTION="cust_main.cgi" METHOD="post">
Search for <B>Order taker</B>:
<INPUT TYPE="hidden" NAME="otaker_on" VALUE="TRUE">
<% my $sth = dbh->prepare("SELECT DISTINCT otaker FROM cust_main")
diff --git a/httemplate/search/cust_main-payinfo.html b/httemplate/search/cust_main-payinfo.html
index b82b610d8..671b5ef08 100755
--- a/httemplate/search/cust_main-payinfo.html
+++ b/httemplate/search/cust_main-payinfo.html
@@ -7,7 +7,7 @@
Customer Search
</FONT>
<BR>
- <FORM ACTION="cust_main.cgi" METHOD="GET">
+ <FORM ACTION="cust_main.cgi" METHOD="post">
Search for <B>Credit card #</B>:
<INPUT TYPE="hidden" NAME="card_on" VALUE="TRUE">
<INPUT TYPE="text" NAME="card">
diff --git a/httemplate/search/cust_main-quickpay.html b/httemplate/search/cust_main-quickpay.html
index 154a64199..077d290d9 100755
--- a/httemplate/search/cust_main-quickpay.html
+++ b/httemplate/search/cust_main-quickpay.html
@@ -8,7 +8,7 @@
</FONT>
<BR><BR>
<A HREF="../">Main Menu</A><BR><BR>
- <FORM ACTION="cust_main.cgi" METHOD="GET">
+ <FORM ACTION="cust_main.cgi" METHOD="post">
<INPUT TYPE="hidden" NAME="quickpay" VALUE="yes">
<INPUT TYPE="checkbox" NAME="last_on" CHECKED> Search for <B>last name</B>:
<INPUT TYPE="text" NAME="last_text">
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi
index 665f5637d..ecff4bf3b 100755
--- a/httemplate/search/cust_main.cgi
+++ b/httemplate/search/cust_main.cgi
@@ -57,7 +57,6 @@ if ( $cgi->param('browse')
) {
my %search = ();
-
if ( $cgi->param('browse') ) {
my $query = $cgi->param('browse');
if ( $query eq 'custnum' ) {
@@ -81,16 +80,15 @@ if ( $cgi->param('browse')
} else {
$sortby = \*last_sort; #??
$orderby = "ORDER BY LOWER(last || ' ' || first)"; #??
- }
-
- if ( $cgi->param('otaker_on') ) {
- $cgi->param('otaker') =~ /^(\w{1,32})$/ or eidiot "Illegal otaker\n";
- $search{otaker} = $1;
- } elsif ( $cgi->param('agentnum_on') ) {
- $cgi->param('agentnum') =~ /^(\d+)$/ or eidiot "Illegal agentnum\n";
- $search{agentnum} = $1;
-# } else {
-# die "unknown query...";
+ if ( $cgi->param('otaker_on') ) {
+ $cgi->param('otaker') =~ /^(\w{1,32})$/ or eidiot "Illegal otaker\n";
+ $search{otaker} = $1;
+ } elsif ( $cgi->param('agentnum_on') ) {
+ $cgi->param('agentnum') =~ /^(\d+)$/ or eidiot "Illegal agentnum\n";
+ $search{agentnum} = $1;
+ } else {
+ die "unknown query...";
+ }
}
my @qual = ();
@@ -287,7 +285,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
or eidiot "Illegal referral_custnum\n";
my $referral_custnum = $1;
my $cust_main = qsearchs('cust_main', { custnum => $referral_custnum } );
- print '<FORM METHOD="GET">'.
+ print '<FORM METHOD=POST>'.
qq!<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="$referral_custnum">!.
'referrals of <A HREF="'. popurl(2).
"view/cust_main.cgi?$referral_custnum\">$referral_custnum: ".
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 4f7508447..5a066e453 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -7,7 +7,7 @@
Customer Search
</FONT>
<BR><BR>
- <FORM ACTION="cust_main.cgi" METHOD="GET">
+ <FORM ACTION="cust_main.cgi" METHOD="post">
<INPUT TYPE="checkbox" NAME="last_on" CHECKED> Search for <B>last name</B>:
<INPUT TYPE="text" NAME="last_text">
using search method: <SELECT NAME="last_type">
diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi
index 99ffc3d20..3f5b72ab5 100755
--- a/httemplate/search/cust_pay.cgi
+++ b/httemplate/search/cust_pay.cgi
@@ -1,122 +1,74 @@
<%
- my $title = 'Payment Search Results';
my( $count_query, $sql_query );
- if ( $cgi->param('magic') ) {
-
- my @search = ();
- my $orderby;
- if ( $cgi->param('magic') eq '_date' ) {
+ if ( $cgi->param('magic') && $cgi->param('magic') eq '_date' ) {
-
- if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- push @search, "agentnum = $1"; # $search{'agentnum'} = $1;
- my $agent = qsearchs('agent', { 'agentnum' => $1 } );
- die "unknown agentnum $1" unless $agent;
- $title = $agent->agent. " $title";
- }
-
- if ( $cgi->param('payby') ) {
- $cgi->param('payby') =~
- /^(CARD|CHEK|BILL|PREP|CASH|WEST|MCRD)(-(VisaMC|Amex|Discover|Maestro))?$/
- or die "illegal payby ". $cgi->param('payby');
- push @search, "cust_pay.payby = '$1'";
- if ( $3 ) {
- if ( $3 eq 'VisaMC' ) {
- #avoid posix regexes for portability
- push @search,
- " ( ( substring(cust_pay.payinfo from 1 for 1) = '4' ".
- " AND substring(cust_pay.payinfo from 1 for 4) != '4936' ".
- " AND substring(cust_pay.payinfo from 1 for 6) ".
- " NOT SIMILAR TO '49030[2-9]' ".
- " AND substring(cust_pay.payinfo from 1 for 6) ".
- " NOT SIMILAR TO '49033[5-9]' ".
- " AND substring(cust_pay.payinfo from 1 for 6) ".
- " NOT SIMILAR TO '49110[1-2]' ".
- " AND substring(cust_pay.payinfo from 1 for 6) ".
- " NOT SIMILAR TO '49117[4-9]' ".
- " AND substring(cust_pay.payinfo from 1 for 6) ".
- " NOT SIMILAR TO '49118[1-2]' ".
- " )".
- " OR substring(cust_pay.payinfo from 1 for 2) = '51' ".
- " OR substring(cust_pay.payinfo from 1 for 2) = '52' ".
- " OR substring(cust_pay.payinfo from 1 for 2) = '53' ".
- " OR substring(cust_pay.payinfo from 1 for 2) = '54' ".
- " OR substring(cust_pay.payinfo from 1 for 2) = '54' ".
- " OR substring(cust_pay.payinfo from 1 for 2) = '55' ".
- " ) ";
- } elsif ( $3 eq 'Amex' ) {
- push @search,
- " ( substring(cust_pay.payinfo from 1 for 2 ) = '34' ".
- " OR substring(cust_pay.payinfo from 1 for 2 ) = '37' ".
- " ) ";
- } elsif ( $3 eq 'Discover' ) {
- push @search,
- " ( substring(cust_pay.payinfo from 1 for 4 ) = '6011' ".
- " OR substring(cust_pay.payinfo from 1 for 3 ) = '650' ".
- " ) ";
- } elsif ( $3 eq 'Maestro' ) {
- push @search,
- " ( substring(cust_pay.payinfo from 1 for 2 ) = '63' ".
- " OR substring(cust_pay.payinfo from 1 for 2 ) = '67' ".
- " OR substring(cust_pay.payinfo from 1 for 6 ) = '564182' ".
- " OR substring(cust_pay.payinfo from 1 for 4 ) = '4936' ".
- " OR substring(cust_pay.payinfo from 1 for 6 ) ".
- " SIMILAR TO '49030[2-9]' ".
- " OR substring(cust_pay.payinfo from 1 for 6 ) ".
- " SIMILAR TO '49033[5-9]' ".
- " OR substring(cust_pay.payinfo from 1 for 6 ) ".
- " SIMILAR TO '49110[1-2]' ".
- " OR substring(cust_pay.payinfo from 1 for 6 ) ".
- " SIMILAR TO '49117[4-9]' ".
- " OR substring(cust_pay.payinfo from 1 for 6 ) ".
- " SIMILAR TO '49118[1-2]' ".
- " ) ";
- } else {
- die "unknown card type $3";
- }
+ my %search;
+ my @search;
+
+ if ( $cgi->param('payby') ) {
+ $cgi->param('payby') =~ /^(CARD|CHEK|BILL)(-(VisaMC|Amex|Discover))?$/
+ or die "illegal payby ". $cgi->param('payby');
+ $search{'payby'} = $1;
+ if ( $3 ) {
+ if ( $3 eq 'VisaMC' ) {
+ #avoid posix regexes for portability
+ push @search, " ( substring(payinfo from 1 for 1) = '4' ".
+ " OR substring(payinfo from 1 for 2) = '51' ".
+ " OR substring(payinfo from 1 for 2) = '52' ".
+ " OR substring(payinfo from 1 for 2) = '53' ".
+ " OR substring(payinfo from 1 for 2) = '54' ".
+ " OR substring(payinfo from 1 for 2) = '54' ".
+ " OR substring(payinfo from 1 for 2) = '55' ".
+ " ) ";
+ } elsif ( $3 eq 'Amex' ) {
+ push @search, " ( substring(payinfo from 1 for 2 ) = '34' ".
+ " OR substring(payinfo from 1 for 2 ) = '37' ".
+ " ) ";
+ } elsif ( $3 eq 'Discover' ) {
+ push @search, " substring(payinfo from 1 for 4 ) = '6011' ";
+ } else {
+ die "unknown card type $3";
}
}
-
- my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
- push @search, "_date >= $beginning ",
- "_date <= $ending";
-
- $orderby = '_date';
+ }
- } elsif ( $cgi->param('magic') eq 'paybatch' ) {
-
- $cgi->param('paybatch') =~ /^([\w\/\:\-\.]+)$/
- or die "illegal paybatch: ". $cgi->param('paybatch');
-
- push @search, "paybatch = '$1'";
-
- $orderby = "LOWER(company || ' ' || last || ' ' || first )";
-
- } else {
- die "unknown search magic: ". $cgi->param('magic');
+ #false laziness with cust_pkg.cgi
+ if ( $cgi->param('beginning')
+ && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+ my $beginning = str2time($1);
+ push @search, "_date >= $beginning ";
}
-
- my $search = '';
+ if ( $cgi->param('ending')
+ && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+ my $ending = str2time($1) + 86399;
+ push @search, " _date <= $ending ";
+ }
+ if ( $cgi->param('begin')
+ && $cgi->param('begin') =~ /^(\d+)$/ ) {
+ push @search, "_date >= $1 ";
+ }
+ if ( $cgi->param('end')
+ && $cgi->param('end') =~ /^(\d+)$/ ) {
+ push @search, " _date < $1 ";
+ }
+
+ my $search;
if ( @search ) {
- $search = ' WHERE '. join(' AND ', @search);
+ $search = ( scalar(keys %search) ? ' AND ' : ' WHERE ' ).
+ join(' AND ', @search);
}
-
- $count_query = "SELECT COUNT(*), SUM(paid) ".
- "FROM cust_pay LEFT JOIN cust_main USING ( custnum )".
- $search;
+ my $hsearch = join(' AND ', map { "$_ = '$search{$_}'" } keys %search );
+ $count_query = "SELECT COUNT(*), SUM(paid) FROM cust_pay ".
+ ( $hsearch ? " WHERE $hsearch " : '' ).
+ $search;
+
$sql_query = {
'table' => 'cust_pay',
- 'select' => join(', ',
- 'cust_pay.*',
- 'cust_main.custnum as cust_main_custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'hashref' => {},
- 'extra_sql' => "$search ORDER BY $orderby",
- 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+ 'hashref' => \%search,
+ 'extra_sql' => "$search ORDER BY _date",
};
-
+
} else {
$cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo";
@@ -137,56 +89,49 @@
}
- my $link = sub {
- my $cust_pay = shift;
- $cust_pay->cust_main_custnum
- ? [ "${p}view/cust_main.cgi?", 'custnum' ]
- : '';
- };
+ my $link = [ "${p}view/cust_main.cgi?", 'custnum' ];
-%><%= include( 'elements/search.html',
- 'title' => $title,
- 'name' => 'payments',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'count_addl' => [ '$%.2f total paid', ],
- 'header' => [ 'Payment',
- 'Amount',
- 'Date',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [
- sub {
- my $cust_pay = shift;
- if ( $cust_pay->payby eq 'CARD' ) {
- 'Card #'. $cust_pay->payinfo_masked;
- } elsif ( $cust_pay->payby eq 'CHEK' ) {
- 'E-check acct#'. $cust_pay->payinfo;
- } elsif ( $cust_pay->payby eq 'BILL' ) {
- 'Check #'. $cust_pay->payinfo;
- } elsif ( $cust_pay->payby eq 'PREP' ) {
- 'Prepaid card #'. $cust_pay->payinfo;
- } elsif ( $cust_pay->payby eq 'CASH' ) {
- 'Cash '. $cust_pay->payinfo;
- } elsif ( $cust_pay->payby eq 'WEST' ) {
- 'Western Union'; #. $cust_pay->payinfo;
- } elsif ( $cust_pay->payby eq 'MCRD' ) {
- 'Manual credit card'; #. $cust_pay->payinfo;
- } else {
- $cust_pay->payby. ' '. $cust_pay->payinfo;
- }
- },
- sub { sprintf('$%.2f', shift->paid ) },
- sub { time2str('%b %d %Y', shift->_date ) },
- \&FS::UI::Web::cust_fields,
- ],
- #'align' => 'lrrrll',
- 'align' => 'rrr',
- 'links' => [
- '',
- '',
- '',
- ( map { $link } FS::UI::Web::cust_header() ),
- ],
- )
+%>
+<%= include( 'elements/search.html',
+ 'title' => 'Payment Search Results',
+ 'name' => 'payments',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'count_addl' => [ '$%.2f total paid', ],
+ 'header' =>
+ [ qw(Payment Amount Date), 'Cust #', 'Contact name',
+ 'Company', ],
+ 'fields' => [
+ sub {
+ my $cust_pay = shift;
+ if ( $cust_pay->payby eq 'CARD' ) {
+ 'Card #'. $cust_pay->payinfo_masked;
+ } elsif ( $cust_pay->payby eq 'CHEK' ) {
+ 'E-check acct#'. $cust_pay->payinfo;
+ } elsif ( $cust_pay->payby eq 'BILL' ) {
+ 'Check #'. $cust_pay->payinfo;
+ } else {
+ $cust_pay->payby. ' '. $cust_pay->payinfo;
+ }
+ },
+ sub { sprintf('$%.2f', shift->paid ) },
+ sub { time2str('%b %d %Y', shift->_date ) },
+ 'custnum',
+ sub { my $cust_main = shift->cust_main;
+ $cust_main->get('last'). ', '. $cust_main->first;
+ },
+ sub { my $cust_main = shift->cust_main;
+ $cust_main->company;
+ },
+ ],
+ 'align' => 'lrrrll',
+ 'links' => [
+ '',
+ '',
+ '',
+ $link,
+ $link,
+ $link,
+ ],
+ )
%>
diff --git a/httemplate/search/cust_pay.html b/httemplate/search/cust_pay.html
index 6414cf771..3848d66f7 100755
--- a/httemplate/search/cust_pay.html
+++ b/httemplate/search/cust_pay.html
@@ -7,7 +7,7 @@
Check # Search
</FONT>
<BR><BR>
- <FORM ACTION="cust_pay.cgi" METHOD="GET">
+ <FORM ACTION="cust_pay.cgi" METHOD="post">
Search for <B>check #</B>:
<INPUT TYPE="text" NAME="payinfo">
<INPUT TYPE="hidden" NAME="payby" VALUE="BILL">
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 5da4d82fb..6d26317e0 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -1,234 +1,363 @@
<%
+my $conf = new FS::Conf;
+my $maxrecords = $conf->config('maxsearchrecordsperpage');
+
my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {});
-my($query) = $cgi->keywords;
+my $limit = '';
+$limit .= "LIMIT $maxrecords" if $maxrecords;
-my $orderby;
-my @where;
-my $cjoin = '';
+my $offset = $cgi->param('offset') || 0;
+$limit .= " OFFSET $offset" if $offset;
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
- $cjoin = "LEFT JOIN cust_main USING ( custnum )";
- push @where,
- "agentnum = $1";
-}
+my $total;
+
+my($query) = $cgi->keywords;
+my $sortby;
+my @cust_pkg;
if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) {
- $orderby = 'ORDER BY bill';
+ $sortby=\*bill_sort;
+
+ #false laziness with cust_pay.cgi
+ my $range = '';
+ if ( $cgi->param('beginning')
+ && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+ my $beginning = str2time($1);
+ $range = " WHERE bill >= $beginning ";
+ }
+ if ( $cgi->param('ending')
+ && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+ my $ending = str2time($1) + 86399;
+ $range .= ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending ";
+ }
- my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
- push @where,
- "bill >= $beginning ",
- "bill <= $ending",
- '( cancel IS NULL OR cancel = 0 )';
+ $range .= ( $range ? 'AND ' : ' WHERE ' ). '( cancel IS NULL OR cancel = 0 )';
+
+ if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
+ $range .= ( $range ? 'AND ' : ' WHERE ' ).
+ "$1 = ( SELECT agentnum FROM cust_main".
+ " WHERE cust_main.custnum = cust_pkg.custnum )";
+ }
+
+ #false laziness with below
+ my $statement = "SELECT COUNT(*) FROM cust_pkg $range";
+ warn $statement;
+ my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement";
+ $sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
+
+ $total = $sth->fetchrow_arrayref->[0];
+
+ @cust_pkg = qsearch('cust_pkg',{}, '', " $range ORDER BY bill $limit" );
} else {
+ my $qual = '';
if ( $cgi->param('magic') &&
- $cgi->param('magic') =~ /^(active|suspended|cancell?ed)$/
+ $cgi->param('magic') =~ /^(active|suspended|canceled)$/
) {
- $orderby = 'ORDER BY pkgnum';
-
if ( $cgi->param('magic') eq 'active' ) {
-
- #push @where,
- # '( susp IS NULL OR susp = 0 )',
- # '( cancel IS NULL OR cancel = 0)';
- push @where, FS::cust_pkg->active_sql();
-
+ $qual = 'WHERE ( susp IS NULL OR susp = 0 )'.
+ ' AND ( cancel IS NULL OR cancel = 0)';
} elsif ( $cgi->param('magic') eq 'suspended' ) {
-
- push @where,
- 'susp IS NOT NULL',
- 'susp != 0',
- '( cancel IS NULL OR cancel = 0)';
-
- } elsif ( $cgi->param('magic') =~ /^cancell?ed$/ ) {
-
- push @where,
- 'cancel IS NOT NULL',
- 'cancel != 0';
-
+ $qual = 'WHERE susp IS NOT NULL AND susp != 0'.
+ ' AND ( cancel IS NULL OR cancel = 0)';
+ } elsif ( $cgi->param('magic') eq 'canceled' ) {
+ $qual = 'WHERE cancel IS NOT NULL AND cancel != 0';
} else {
die "guru meditation #420";
}
+ $sortby = \*pkgnum_sort;
+
if ( $cgi->param('pkgpart') =~ /^(\d+)$/ ) {
- push @where, "pkgpart = $1";
+ $qual .= " AND pkgpart = $1";
}
} elsif ( $query eq 'pkgnum' ) {
- $orderby = 'ORDER BY pkgnum';
+ $sortby=\*pkgnum_sort;
} elsif ( $query eq 'APKG_pkgnum' ) {
- $orderby = 'ORDER BY pkgnum';
+ $sortby=\*pkgnum_sort;
+
+ #@cust_pkg=();
+ ##perhaps this should go in cust_pkg as a qsearch-like constructor?
+ #my($cust_pkg);
+ #foreach $cust_pkg (
+ # qsearch('cust_pkg',{}, '', "ORDER BY pkgnum $limit" )
+ #) {
+ # my($flag)=0;
+ # my($pkg_svc);
+ # PKG_SVC:
+ # foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart })) {
+ # if ( $pkg_svc->quantity
+ # > scalar(qsearch('cust_svc',{
+ # 'pkgnum' => $cust_pkg->pkgnum,
+ # 'svcpart' => $pkg_svc->svcpart,
+ # }))
+ # )
+ # {
+ # $flag=1;
+ # last PKG_SVC;
+ # }
+ # }
+ # push @cust_pkg, $cust_pkg if $flag;
+ #}
+
+ if ( driver_name eq 'mysql' ) {
+ #$query = "DROP TABLE temp1_$$,temp2_$$;";
+ #my $sth = dbh->prepare($query);
+ #$sth->execute;
+
+ $query = "CREATE TEMPORARY TABLE temp1_$$ TYPE=MYISAM
+ SELECT cust_svc.pkgnum,cust_svc.svcpart,COUNT(*) as count
+ FROM cust_pkg,cust_svc,pkg_svc
+ WHERE cust_pkg.pkgnum = cust_svc.pkgnum
+ AND cust_svc.svcpart = pkg_svc.svcpart
+ AND cust_pkg.pkgpart = pkg_svc.pkgpart
+ GROUP BY cust_svc.pkgnum,cust_svc.svcpart";
+ my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query";
+
+ $sth->execute or die "Error executing \"$query\": ". $sth->errstr;
- push @where, '0 < (
- SELECT count(*) FROM pkg_svc
- WHERE pkg_svc.pkgpart = cust_pkg.pkgpart
- AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc
- WHERE cust_svc.pkgnum = cust_pkg.pkgnum
- AND cust_svc.svcpart = pkg_svc.svcpart
- )
- )';
+ $query = "CREATE TEMPORARY TABLE temp2_$$ TYPE=MYISAM
+ SELECT cust_pkg.pkgnum FROM cust_pkg
+ LEFT JOIN pkg_svc ON (cust_pkg.pkgpart=pkg_svc.pkgpart)
+ LEFT JOIN temp1_$$ ON (cust_pkg.pkgnum = temp1_$$.pkgnum
+ AND pkg_svc.svcpart=temp1_$$.svcpart)
+ WHERE ( pkg_svc.quantity > temp1_$$.count
+ OR temp1_$$.pkgnum IS NULL )
+ AND pkg_svc.quantity != 0;";
+ $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query";
+ $sth->execute or die "Error executing \"$query\": ". $sth->errstr;
+ $qual = " LEFT JOIN temp2_$$ ON cust_pkg.pkgnum = temp2_$$.pkgnum
+ WHERE temp2_$$.pkgnum IS NOT NULL";
+
+ } else {
+
+ $qual = "
+ WHERE 0 <
+ ( SELECT count(*) FROM pkg_svc
+ WHERE pkg_svc.pkgpart = cust_pkg.pkgpart
+ AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc
+ WHERE cust_svc.pkgnum = cust_pkg.pkgnum
+ AND cust_svc.svcpart = pkg_svc.svcpart
+ )
+ )
+ ";
+
+ }
} else {
die "Empty or unknown QUERY_STRING!";
}
+
+ my $statement = "SELECT COUNT(*) FROM cust_pkg $qual";
+ my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement";
+ $sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
+
+ $total = $sth->fetchrow_arrayref->[0];
+
+ my $tblname = driver_name eq 'mysql' ? 'cust_pkg.' : '';
+ @cust_pkg =
+ qsearch('cust_pkg',{}, '', "$qual ORDER BY ${tblname}pkgnum $limit" );
+
+ if ( driver_name eq 'mysql' ) {
+ $query = "DROP TABLE temp1_$$,temp2_$$;";
+ my $sth = dbh->prepare($query) or die dbh->errstr. " doing $query";
+ $sth->execute; # or die "Error executing \"$query\": ". $sth->errstr;
+ }
+
+}
+
+if ( scalar(@cust_pkg) == 1 ) {
+ print $cgi->redirect("${p}view/cust_main.cgi?". $cust_pkg[0]->custnum.
+ "#cust_pkg". $cust_pkg[0]->pkgnum );
+ #exit;
+} elsif ( scalar(@cust_pkg) == 0 ) { #error
+%>
+<!-- mason kludge -->
+<%
+ eidiot("No packages found");
+} else {
+%>
+<!-- mason kludge -->
+<%
+ $total ||= scalar(@cust_pkg);
+
+ #begin pager
+ my $pager = '';
+ if ( $total != scalar(@cust_pkg) && $maxrecords ) {
+ unless ( $offset == 0 ) {
+ $cgi->param('offset', $offset - $maxrecords);
+ $pager .= '<A HREF="'. $cgi->self_url.
+ '"><B><FONT SIZE="+1">Previous</FONT></B></A> ';
+ }
+ my $poff;
+ my $page;
+ for ( $poff = 0; $poff < $total; $poff += $maxrecords ) {
+ $page++;
+ if ( $offset == $poff ) {
+ $pager .= qq!<FONT SIZE="+2">$page</FONT> !;
+ } else {
+ $cgi->param('offset', $poff);
+ $pager .= qq!<A HREF="!. $cgi->self_url. qq!">$page</A> !;
+ }
+ }
+ unless ( $offset + $maxrecords > $total ) {
+ $cgi->param('offset', $offset + $maxrecords);
+ $pager .= '<A HREF="'. $cgi->self_url.
+ '"><B><FONT SIZE="+1">Next</FONT></B></A> ';
+ }
+ }
+ #end pager
+
+ print header('Package Search Results',''),
+ "$total matching packages found<BR><BR>$pager", &table(), <<END;
+ <TR>
+ <TH>Package</TH>
+ <TH><FONT SIZE=-1>Setup</FONT></TH>
+END
+
+ print '<TH><FONT SIZE=-1>Last<BR>bill</FONT></TH>'
+ if defined dbdef->table('cust_pkg')->column('last_bill');
+
+ print <<END;
+ <TH><FONT SIZE=-1>Next<BR>bill</FONT></TH>
+ <TH><FONT SIZE=-1>Susp.</FONT></TH>
+ <TH><FONT SIZE=-1>Expire</FONT></TH>
+ <TH><FONT SIZE=-1>Cancel</FONT></TH>
+ <TH><FONT SIZE=-1>Cust#</FONT></TH>
+ <TH>(bill) name</TH>
+ <TH>company</TH>
+END
+
+ print '<TH>(service) name</TH><TH>company</TH>'
+ if defined dbdef->table('cust_main')->column('ship_last');
+
+ print '<TH COLSPAN=2>Services</TH></TR>';
+
+ my $n1 = '<TR>';
+ my(%saw,$cust_pkg);
+ foreach $cust_pkg (
+ sort $sortby grep(!$saw{$_->pkgnum}++, @cust_pkg)
+ ) {
+ my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum});
+ my($pkgnum, $setup, $bill, $susp, $expire, $cancel,
+ $custnum, $last, $first, $company ) = (
+ $cust_pkg->pkgnum,
+ $cust_pkg->getfield('setup')
+ ? time2str("%D", $cust_pkg->getfield('setup') )
+ : '',
+ $cust_pkg->getfield('bill')
+ ? time2str("%D", $cust_pkg->getfield('bill') )
+ : '',
+ $cust_pkg->getfield('susp')
+ ? time2str("%D", $cust_pkg->getfield('susp') )
+ : '',
+ $cust_pkg->getfield('expire')
+ ? time2str("%D", $cust_pkg->getfield('expire') )
+ : '',
+ $cust_pkg->getfield('cancel')
+ ? time2str("%D", $cust_pkg->getfield('cancel') )
+ : '',
+ $cust_pkg->custnum,
+ $cust_main ? $cust_main->last : '',
+ $cust_main ? $cust_main->first : '',
+ $cust_main ? $cust_main->company : '',
+ );
+
+ my $last_bill = $cust_pkg->getfield('last_bill')
+ ? time2str("%D", $cust_pkg->getfield('last_bill') )
+ : ''
+ if defined dbdef->table('cust_pkg')->column('last_bill');
+
+ my($ship_last, $ship_first, $ship_company);
+ if ( defined dbdef->table('cust_main')->column('ship_last') ) {
+ ($ship_last, $ship_first, $ship_company) = (
+ $cust_main
+ ? ( $cust_main->ship_last || $cust_main->getfield('last') )
+ : '',
+ $cust_main
+ ? ( $cust_main->ship_last
+ ? $cust_main->ship_first
+ : $cust_main->first )
+ : '',
+ $cust_main
+ ? ( $cust_main->ship_last
+ ? $cust_main->ship_company
+ : $cust_main->company )
+ : '',
+ );
+ }
+ my $pkg = $part_pkg{$cust_pkg->pkgpart}->pkg;
+ #$pkg .= ' - '. $part_pkg{$cust_pkg->pkgpart}->comment;
+ my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } );
+ my $rowspan = scalar(@cust_svc) || 1;
+ my $p = popurl(2);
+ print $n1, <<END;
+ <TD ROWSPAN=$rowspan><A HREF="${p}view/cust_main.cgi?$custnum#cust_pkg$pkgnum"><FONT SIZE=-1>$pkgnum - $pkg</FONT></A></TD>
+ <TD ROWSPAN=$rowspan>$setup</TD>
+END
+
+ print "<TD ROWSPAN=$rowspan>$last_bill</TD>"
+ if defined dbdef->table('cust_pkg')->column('last_bill');
+
+ print <<END;
+ <TD ROWSPAN=$rowspan>$bill</TD>
+ <TD ROWSPAN=$rowspan>$susp</TD>
+ <TD ROWSPAN=$rowspan>$expire</TD>
+ <TD ROWSPAN=$rowspan>$cancel</TD>
+END
+ if ( $cust_main ) {
+ print <<END;
+ <TD ROWSPAN=$rowspan><FONT SIZE=-1><A HREF="${p}view/cust_main.cgi?$custnum">$custnum</A></FONT></TD>
+ <TD ROWSPAN=$rowspan><FONT SIZE=-1><A HREF="${p}view/cust_main.cgi?$custnum">$last, $first</A></FONT></TD>
+ <TD ROWSPAN=$rowspan><FONT SIZE=-1><A HREF="${p}view/cust_main.cgi?$custnum">$company</A></FONT></TD>
+END
+ if ( defined dbdef->table('cust_main')->column('ship_last') ) {
+ print <<END;
+ <TD ROWSPAN=$rowspan><FONT SIZE=-1><A HREF="${p}view/cust_main.cgi?$custnum">$ship_last, $ship_first</A></FONT></TD>
+ <TD ROWSPAN=$rowspan><FONT SIZE=-1><A HREF="${p}view/cust_main.cgi?$custnum">$ship_company</A></FONT></TD>
+END
+ }
+ } else {
+ my $colspan = defined dbdef->table('cust_main')->column('ship_last')
+ ? 5 : 3;
+ print <<END;
+ <TD ROWSPAN=$rowspan COLSPAN=$colspan>WARNING: couldn't find cust_main.custnum $custnum (cust_pkg.pkgnum $pkgnum)</TD>
+END
+ }
+
+ my $n2 = '';
+ foreach my $cust_svc ( @cust_svc ) {
+ my($label, $value, $svcdb) = $cust_svc->label;
+ my $svcnum = $cust_svc->svcnum;
+ my $sview = $p. "view";
+ print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!,
+ qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!;
+ $n2="</TR><TR>";
+ }
+
+ $n1 = "</TR><TR>";
+
+ }
+ print '</TR>';
+
+ print "</TABLE>$pager</BODY></HTML>";
+
+}
+sub pkgnum_sort {
+ $a->getfield('pkgnum') <=> $b->getfield('pkgnum');
}
-my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : '';
-
-my $count_query = "SELECT COUNT(*) FROM cust_pkg $cjoin $extra_sql";
-
-my $sql_query = {
- 'table' => 'cust_pkg',
- 'hashref' => {},
- 'select' => join(', ',
- 'cust_pkg.*',
- 'cust_main.custnum as cust_main_custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'extra_sql' => "$extra_sql $orderby",
- 'addl_from' => ' LEFT JOIN cust_main USING ( custnum ) ',
- #' LEFT JOIN part_pkg USING ( pkgpart ) '
-};
-
-my $link = sub {
- [ "${p}view/cust_main.cgi?".shift->custnum.'#cust_pkg', 'pkgnum' ];
-};
-
-my $clink = sub {
- my $cust_pkg = shift;
- $cust_pkg->cust_main_custnum
- ? [ "${p}view/cust_main.cgi?", 'custnum' ]
- : '';
-};
-
-#if ( scalar(@cust_pkg) == 1 ) {
-# print $cgi->redirect("${p}view/cust_main.cgi?". $cust_pkg[0]->custnum.
-# "#cust_pkg". $cust_pkg[0]->pkgnum );
-
-# my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } );
-# my $rowspan = scalar(@cust_svc) || 1;
-
-# my $n2 = '';
-# foreach my $cust_svc ( @cust_svc ) {
-# my($label, $value, $svcdb) = $cust_svc->label;
-# my $svcnum = $cust_svc->svcnum;
-# my $sview = $p. "view";
-# print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!,
-# qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!;
-# $n2="</TR><TR>";
-# }
-
-sub time_or_blank {
- my $column = shift;
- return sub {
- my $record = shift;
- my $value = $record->get($column); #mmm closures
- $value ? time2str('%b %d %Y', $value ) : '';
- };
+sub bill_sort {
+ $a->getfield('bill') <=> $b->getfield('bill');
}
-%><%= include( 'elements/search.html',
- 'title' => 'Package Search Results',
- 'name' => 'packages',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'redirect' => $link,
- 'header' => [ '#',
- 'Package',
- 'Status',
- 'Freq.',
- 'Setup',
- 'Last bill',
- 'Next bill',
- 'Susp.',
- 'Expire',
- 'Cancel',
- FS::UI::Web::cust_header(),
- 'Services',
- ],
- 'fields' => [
- 'pkgnum',
- sub { my $part_pkg = $part_pkg{shift->pkgpart};
- $part_pkg->pkg; # ' - '. $part_pkg->comment;
- },
- sub { ucfirst(shift->status); },
- sub { #shift->part_pkg->freq_pretty;
- my $part_pkg = $part_pkg{shift->pkgpart};
- $part_pkg->freq_pretty;
- },
-
- #sub { time2str('%b %d %Y', shift->setup); },
- #sub { time2str('%b %d %Y', shift->last_bill); },
- #sub { time2str('%b %d %Y', shift->bill); },
- #sub { time2str('%b %d %Y', shift->susp); },
- #sub { time2str('%b %d %Y', shift->expire); },
- #sub { time2str('%b %d %Y', shift->get('cancel')); },
- ( map { time_or_blank($_) }
- qw( setup last_bill bill susp expire cancel ) ),
-
- \&FS::UI::Web::cust_fields,
- #sub { '<table border=0 cellspacing=0 cellpadding=0 STYLE="border:none">'.
- # join('', map { '<tr><td align="right" style="border:none">'. $_->[0].
- # ':</td><td style="border:none">'. $_->[1]. '</td></tr>' }
- # shift->labels
- # ).
- # '</table>';
- # },
- sub {
- [ map {
- [
- { 'data' => $_->[0]. ':',
- 'align'=> 'right',
- },
- { 'data' => $_->[1],
- 'align'=> 'left',
- 'link' => $p. 'view/' .
- $_->[2]. '.cgi?'. $_->[3],
- },
- ];
- } shift->labels
- ];
- },
- ],
- 'color' => [
- '',
- '',
- sub { shift->statuscolor; },
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- ( map { '' } FS::UI::Web::cust_header() ),
- '',
- ],
- 'style' => [ '', '', 'b' ],
- 'size' => [ '', '', '-1', ],
- 'align' => 'rlclrrrrrr',
- 'links' => [
- $link,
- $link,
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- ( map { $clink } FS::UI::Web::cust_header() ),
- '',
- ],
- )
%>
diff --git a/httemplate/search/cust_pkg_report.cgi b/httemplate/search/cust_pkg_report.cgi
index 412c3f79d..b31674540 100755
--- a/httemplate/search/cust_pkg_report.cgi
+++ b/httemplate/search/cust_pkg_report.cgi
@@ -1,18 +1,58 @@
<HTML>
<HEAD>
<TITLE>Packages</TITLE>
+ <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>
</HEAD>
<BODY BGCOLOR="#e8e8e8">
<H1>Packages</H1>
- <FORM ACTION="cust_pkg.cgi" METHOD="GET">
+ <FORM ACTION="cust_pkg.cgi" METHOD="post">
<INPUT TYPE="hidden" NAME="magic" VALUE="bill">
Return packages with next bill date:<BR><BR>
<TABLE>
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
- <%= include( '/elements/tr-select-agent.html',
- $cgi->param('agentnum'),
- )
- %>
+ <TR>
+ <TD ALIGN="right">From: </TD>
+ <TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><I>m/d/y</I></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "beginning_text",
+ ifFormat: "%m/%d/%Y",
+ button: "beginning_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
+ <TR>
+ <TD ALIGN="right">To: </TD>
+ <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><I>m/d/y</I></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "ending_text",
+ ifFormat: "%m/%d/%Y",
+ button: "ending_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
+<% my %agent_search = dbdef->table('agent')->column('disabled')
+ ? ( 'disabled' => '' ) : ();
+ my @agents = qsearch( 'agent', \%agent_search );
+ if ( scalar(@agents) == 1 ) {
+%>
+ <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agents[0]->agentnum %>">
+<% } else { %>
+
+ <TR>
+ <TD ALIGN="right">Agent: </TD>
+ <TD><SELECT NAME="agentnum"><OPTION VALUE="">(all)
+ <% foreach my $agent ( sort { $a->agent cmp $b->agent; } @agents) { %>
+ <OPTION VALUE="<%= $agent->agentnum %>"><%= $agent->agent %>
+ <% } %>
+ </TD>
+ </TR>
+<% } %>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Get Report">
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index d19fb4acd..566ea8391 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -1,7 +1,6 @@
<%
my(%opt) = @_;
- #warn join(' / ', map { "$_ => $opt{$_}" } keys %opt ). "\n";
my %align = (
'l' => 'left',
@@ -13,39 +12,31 @@
$opt{align} = [ map $align{$_}, split(//, $opt{align}) ],
unless !$opt{align} || ref($opt{align});
- my $type = '';
- my $limit = '';
- my($maxrecords, $total, $offset, $count_arrayref);
-
- if ( $cgi->param('_type') =~ /^(csv|\w*\.xls)$/ ) {
-
- $type = $1;
-
- } else { #setup some pagination things if we're in html mode
+ if ( ref($opt{'query'}) ) {
- unless (exists($opt{'count_query'}) && length($opt{'count_query'})) {
- ( $opt{'count_query'} = $opt{'query'} ) =~
- s/^\s*SELECT\s*(.*?)\s+FROM\s/SELECT COUNT(*) FROM /i;
- }
+ }
- my $conf = new FS::Conf;
- $maxrecords = $conf->config('maxsearchrecordsperpage');
+ unless (exists($opt{'count_query'}) && length($opt{'count_query'})) {
+ ( $opt{'count_query'} = $opt{'query'} ) =~
+ s/^\s*SELECT\s*(.*?)\s+FROM\s/SELECT COUNT(*) FROM /i;
+ }
- $limit = $maxrecords ? "LIMIT $maxrecords" : '';
+ my $conf = new FS::Conf;
+ my $maxrecords = $conf->config('maxsearchrecordsperpage');
- $offset = $cgi->param('offset') || 0;
- $limit .= " OFFSET $offset" if $offset;
+ my $limit = $maxrecords ? "LIMIT $maxrecords" : '';
- my $count_sth = dbh->prepare($opt{'count_query'})
- or die "Error preparing $opt{'count_query'}: ". dbh->errstr;
- $count_sth->execute
- or die "Error executing $opt{'count_query'}: ". $count_sth->errstr;
- $count_arrayref = $count_sth->fetchrow_arrayref;
- $total = $count_arrayref->[0];
+ my $offset = $cgi->param('offset') || 0;
+ $limit .= " OFFSET $offset" if $offset;
- }
+ my $count_sth = dbh->prepare($opt{'count_query'})
+ or die "Error preparing $opt{'count_query'}: ". dbh->errstr;
+ $count_sth->execute
+ or die "Error executing $opt{'count_query'}: ". $count_sth->errstr;
+ my $count_arrayref = $count_sth->fetchrow_arrayref;
+ my $total = $count_arrayref->[0];
- # run the query
+ #warn join(' / ', map { "$_ => $opt{$_}" } keys %opt ). "\n";
my $header = $opt{'header'};
my $rows;
@@ -56,8 +47,6 @@
$opt{'query'}->{'hashref'} || {},
$opt{'query'}->{'select'},
$opt{'query'}->{'extra_sql'}. " $limit",
- '',
- (exists($opt{'query'}->{'addl_from'}) ? $opt{'query'}->{'addl_from'} : '')
) ];
} else {
my $sth = dbh->prepare("$opt{'query'} $limit")
@@ -71,322 +60,80 @@
$header ||= $sth->{NAME};
}
- if ( $type eq 'csv' ) {
-
- #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
- http_header('Content-Type' => 'text/plain' );
-
- my $csv = new Text::CSV_XS { 'always_quote' => 1,
- 'eol' => "\n", #"\015\012", #"\012"
- };
-
- $csv->combine(@$header); #or die $csv->status;
- %><%= $csv->string %><%
-
- foreach my $row ( @$rows ) {
-
- if ( $opt{'fields'} ) {
-
- my @line = ();
-
- foreach my $field ( @{$opt{'fields'}} ) {
- if ( ref($field) eq 'CODE' ) {
- push @line, map {
- ref($_) eq 'ARRAY'
- ? '(N/A)' #unimplemented
- : $_;
- }
- &{$field}($row);
- } else {
- push @line, $row->$field();
- }
- }
-
- $csv->combine(@line); #or die $csv->status;
-
- } else {
- $csv->combine(@$row); #or die $csv->status;
- }
-
- %><%= $csv->string %><%
-
- }
-
- #} elsif ( $type eq 'excel' ) {
- } elsif ( $type =~ /\.xls$/ ) {
-
- #http_header('Content-Type' => 'application/excel' ); #eww
- http_header('Content-Type' => 'application/vnd.ms-excel' );
- #http_header('Content-Type' => 'application/msexcel' ); #alas
-
- my $data = '';
- my $XLS = new IO::Scalar \$data;
- my $workbook = Spreadsheet::WriteExcel->new($XLS)
- or die "Error opening .xls file: $!";
-
- my $worksheet = $workbook->add_worksheet(substr($opt{'title'},0,31));
-
- my($r,$c) = (0,0);
-
- $worksheet->write($r, $c++, $_) foreach @$header;
-
- foreach my $row ( @$rows ) {
- $r++;
- $c = 0;
-
- if ( $opt{'fields'} ) {
-
- #my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : '';
- #my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : '';
-
- foreach my $field ( @{$opt{'fields'}} ) {
- #my $align = $aligns ? shift @$aligns : '';
- #$align = " ALIGN=$align" if $align;
- #my $a = '';
- #if ( $links ) {
- # my $link = shift @$links;
- # $link = &{$link}($row) if ref($link) eq 'CODE';
- # if ( $link ) {
- # my( $url, $method ) = @{$link};
- # if ( ref($method) eq 'CODE' ) {
- # $a = $url. &{$method}($row);
- # } else {
- # $a = $url. $row->$method();
- # }
- # $a = qq(<A HREF="$a">);
- # }
- #}
- if ( ref($field) eq 'CODE' ) {
- foreach my $value ( &{$field}($row) ) {
- if ( ref($value) eq 'ARRAY' ) {
- $worksheet->write($r, $c++, '(N/A)' ); #unimplemented
- } else {
- $worksheet->write($r, $c++, $value );
- }
- }
- } else {
- $worksheet->write($r, $c++, $row->$field() );
- }
- }
-
- } else {
- $worksheet->write($r, $c++, $_) foreach @$row;
- }
-
- }
-
- $workbook->close();# or die "Error creating .xls file: $!";
-
- http_header('Content-Length' => length($data) );
- %><%= $data %><%
-
- } else { # regular HTML
-
- if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 && $total == 1 ) {
- my $redirect = $opt{'redirect'};
- $redirect = &{$redirect}($rows->[0]) if ref($redirect) eq 'CODE';
- my( $url, $method ) = @$redirect;
- redirect( $url. $rows->[0]->$method() );
- } else {
- ( my $xlsname = $opt{'name'} ) =~ s/\W//g;
- $opt{'name'} =~ s/s$// if $total == 1;
-
- my @menubar = ();
- if ( $opt{'menubar'} ) {
- @menubar = @{ $opt{'menubar'} };
- } else {
- @menubar = ( 'Main menu' => $p );
- }
- %>
- <%= include( '/elements/header.html', $opt{'title'},
- include( '/elements/menubar.html', @menubar )
- )
- %>
- <%= defined($opt{'html_init'}) ? $opt{'html_init'} : '' %>
- <% my $pager = include ( '/elements/pager.html',
- 'offset' => $offset,
- 'num_rows' => scalar(@$rows),
- 'total' => $total,
- 'maxrecords' => $maxrecords,
- );
- %>
- <% unless ( $total ) { %>
- No matching <%= $opt{'name'} %> found.<BR>
- <% } else { %>
-
- <TABLE>
- <TR>
- <TD VALIGN="bottom">
- <%= $total %> total <%= $opt{'name'} %><BR>
- <% if ( $opt{'count_addl'} ) { %>
- <% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { %>
- <%= sprintf( $count, $count_arrayref->[++$n] ) %><BR>
- <% } %>
- <% } %>
- </TD>
- <TD ALIGN="right">
- <% $cgi->param('_type', "$xlsname.xls" ); %>
- Download full results<BR>
- as <A HREF="<%= $cgi->self_url %>">Excel spreadsheet</A><BR>
- <% $cgi->param('_type', 'csv'); %>
- as <A HREF="<%= $cgi->self_url %>">CSV file</A>
- </TD>
- </TR>
- <TR>
- <TD COLSPAN=2>
- <%= $pager %>
-
- <%= include('/elements/table-grid.html') %>
-
- <TR>
- <% foreach my $header ( @$header ) { %>
- <TH CLASS="grid" BGCOLOR="#cccccc"><%= $header %></TH>
- <% } %>
- </TR>
- <% my $bgcolor1 = '#eeeeee';
- my $bgcolor2 = '#ffffff';
- my $bgcolor;
- foreach my $row ( @$rows ) {
- if ( $bgcolor eq $bgcolor1 ) {
- $bgcolor = $bgcolor2;
- } else {
- $bgcolor = $bgcolor1;
- }
- %>
- <TR>
- <% if ( $opt{'fields'} ) {
-
- my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : '';
- my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : '';
- my $colors = $opt{'color'} ? [ @{$opt{'color'}} ] : [];
- my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
- my $styles = $opt{'style'} ? [ @{$opt{'style'}} ] : [];
-
- foreach my $field (
-
- map {
- if ( ref($_) eq 'ARRAY' ) {
-
- my $tableref = $_;
-
- '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0'.
- ' STYLE="border:none">'.
-
- join('', map {
-
- my $rowref = $_;
-
- '<tr>'.
-
- join('', map {
-
- my $element = $_;
-
- '<TD STYLE="border:none"'.
- ( $element->{'align'}
- ? ' ALIGN="'. $element->{'align'}. '"'
- : ''
- ). '>'.
- ( $element->{'link'}
- ? '<A HREF="'. $element->{'link'}.'">'
- : ''
- ).
- $element->{'data'}.
- ( $element->{'link'}
- ? '</A>'
- : ''
- ).
- '</td>';
-
- } @$rowref ).
-
- '</tr>';
- } @$tableref ).
-
- '</table>';
-
- } else {
- $_;
- }
- }
-
- map {
- if ( ref($_) eq 'CODE' ) {
- &{$_}($row);
- } else {
- $row->$_();
- }
- }
- @{$opt{'fields'}}
-
- ) {
-
- my $align = $aligns ? shift @$aligns : '';
- $align = " ALIGN=$align" if $align;
-
- my $a = '';
- if ( $links ) {
- my $link = shift @$links;
- $link = &{$link}($row) if ref($link) eq 'CODE';
- if ( $link ) {
- my( $url, $method ) = @{$link};
- if ( ref($method) eq 'CODE' ) {
- $a = $url. &{$method}($row);
- } else {
- $a = $url. $row->$method();
- }
- $a = qq(<A HREF="$a">);
- }
- }
-
- my $font = '';
- my $color = shift @$colors;
- $color = &{$color}($row) if ref($color) eq 'CODE';
- my $size = shift @$sizes;
- $size = &{$size}($row) if ref($size) eq 'CODE';
- if ( $color || $size ) {
- $font = '<FONT '.
- ( $color ? "COLOR=#$color " : '' ).
- ( $size ? qq(SIZE="$size" ) : '' ).
- '>';
- }
-
- my($s, $es) = ( '', '' );
- my $style = shift @$styles;
- $style = &{$style}($row) if ref($style) eq 'CODE';
- if ( $style ) {
- $s = join( '', map "<$_>", split('', $style) );
- $es = join( '', map "</$_>", split('', $style) );
- }
-
- %>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"<%= $align %>><%= $font %><%= $a %><%= $s %><%= $field %><%= $es %><%= $a ? '</A>' : '' %><%= $font ? '</FONT>' : '' %></TD>
- <% } %>
- <% } else { %>
- <% foreach ( @$row ) { %>
- <TD CLASS="grid" BGCOLOR="$bgcolor"><%= $_ %></TD>
- <% } %>
- <% } %>
- </TR>
- <% } %>
-
- <% if ( $opt{'footer'} ) { %>
- <TR>
- <% foreach my $footer ( @{ $opt{'footer'} } ) { %>
- <TD CLASS="grid" BGCOLOR="#dddddd" STYLE="border-top: dashed 1px black;"><i><%= $footer %></i></TH>
- <% } %>
- </TR>
- <% } %>
-
- </TABLE>
- <%= $pager %>
-
- </TD>
- </TR>
- </TABLE>
-
- <% } %>
- </BODY>
- </HTML>
+ if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 && $total == 1 ) {
+ my( $url, $method ) = @{$opt{'redirect'}};
+ redirect( $url. $rows->[0]->$method() );
+ } else {
+ $opt{'name'} =~ s/s$// if $total == 1;
+%>
+<%= include( '/elements/header.html', $opt{'title'},
+ include( '/elements/menubar.html', 'Main menu' => $p )
+ )
+%>
+<% my $pager = include ( '/elements/pager.html',
+ 'offset' => $offset,
+ 'num_rows' => scalar(@$rows),
+ 'total' => $total,
+ 'maxrecords' => $maxrecords,
+ );
+%>
+<% unless ( $total ) { %>
+ No matching <%= $opt{'name'} %> found.<BR>
+<% } else { %>
+ <%= $total %> total <%= $opt{'name'} %><BR>
+ <% if ( $opt{'count_addl'} ) { %>
+ <% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { %>
+ <%= sprintf( $count, $count_arrayref->[++$n] ) %><BR>
+ <% } %>
<% } %>
+ <BR><%= $pager %>
+ <%= include( '/elements/table.html' ) %>
+ <TR>
+ <% foreach my $header ( @$header ) { %>
+ <TH><%= $header %></TH>
+ <% } %>
+ </TR>
+ <% foreach my $row ( @$rows ) { %>
+ <TR>
+ <% if ( $opt{'fields'} ) {
+ my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : '';
+ my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : '';
+ foreach my $field ( @{$opt{'fields'}} ) {
+ my $align = $aligns ? shift @$aligns : '';
+ $align = " ALIGN=$align" if $align;
+ my $a = '';
+ if ( $links ) {
+ my $link = shift @$links;
+ $link = &{$link}($row) if ref($link) eq 'CODE';
+ if ( $link ) {
+ my( $url, $method ) = @{$link};
+ if ( ref($method) eq 'CODE' ) {
+ $a = $url. &{$method}($row);
+ } else {
+ $a = $url. $row->$method();
+ }
+ $a = qq(<A HREF="$a">);
+ }
+ }
+ %>
+ <% if ( ref($field) eq 'CODE' ) { %>
+ <TD<%= $align %>><%= $a %><%= &{$field}($row) %><%= $a ? '</A>' : '' %></TD>
+ <% } else { %>
+ <TD<%= $align %>><%= $a %><%= $row->$field() %><%= $a ? '</A>' : '' %></TD>
+ <% } %>
+ <% } %>
+ <% } else { %>
+ <% foreach ( @$row ) { %>
+ <TD><%= $_ %></TD>
+ <% } %>
+ <% } %>
+ </TR>
+ <% } %>
+
+ </TABLE>
+ <%= $pager %>
<% } %>
+</BODY>
+</HTML>
+<% } %>
+
diff --git a/httemplate/search/prepay_credit.html b/httemplate/search/prepay_credit.html
deleted file mode 100644
index 8c8f57b5a..000000000
--- a/httemplate/search/prepay_credit.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<%
-my $agent = '';
-my $hashref = {};
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $hashref->{agentnum} = $1;
- $agent = qsearchs('agent', { 'agentnum' => $1 } );
-}
-
-my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
-$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;
-
-%><%= include( 'elements/search.html',
- 'title' => 'Unused Prepaid Cards'.
- ($agent ? ' for '. $agent->agent : ''),
- 'menubar' => [
- 'Main menu' => $p,
- 'Generate cards' => $p.'edit/prepay_credit.cgi',
- ],
- 'name' => 'prepaid cards',
- 'query' => { 'table' => 'prepay_credit',
- 'hashref' => $hashref,
- },
- 'count_query' => $count_query,
- #'redirect' => $link,
- 'header' => [ '#', qw(Amount Time Agent) ],
- 'fields' => [
- 'identifier',
- sub { sprintf('$%.2f', shift->amount ) },
- sub { my $c = shift; $c ? duration_exact($c->seconds) : '' },
- sub { my $agent = shift->agent;
- $agent ? $agent->agent : '';
- },
- ],
- 'links' => [
- '',
- '',
- '',
- sub { my $agent = shift->agent;
- $agent ? [ "${p}view/agent.cgi?", 'agentnum' ] : '';
- },
- ],
- )
-%>
diff --git a/httemplate/search/reg_code.html b/httemplate/search/reg_code.html
deleted file mode 100644
index 52a99ff66..000000000
--- a/httemplate/search/reg_code.html
+++ /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 } );
-
-my $count_query = "SELECT COUNT(*) FROM reg_code WHERE agentnum = $agentnum";
-
-%><%= include( 'elements/search.html',
- 'title' => 'Unused Registration Codes for '.
- $agent->agent,
- 'name' => 'registration codes',
- 'query' => { 'table' => 'reg_code',
- 'hashref' => { 'agentnum' => $agentnum, },
- },
- 'count_query' => $count_query,
- #'redirect' => $link,
- 'header' => [ qw(Code Packages) ],
- 'fields' => [
- 'code',
- sub {
- map {
- qq!<A HREF="${p}edit/part_pkg.cgi?!. $_->pkgpart. '">'.
- $_->pkg. ' - '. $_->comment.
- '</A><BR>'
- } $_[0]->part_pkg
- },
- ],
- 'links' => [
- '',
- #$plink,
- '',
- ],
- )
-%>
diff --git a/httemplate/search/report_cust_bill.html b/httemplate/search/report_cust_bill.html
deleted file mode 100644
index a7be76689..000000000
--- a/httemplate/search/report_cust_bill.html
+++ /dev/null
@@ -1,28 +0,0 @@
- <HEAD>
- <TITLE>Invoice report criteria</TITLE>
- </HEAD>
- <BODY BGCOLOR="#e8e8e8">
- <H1>Invoice report criteria</H1>
- <FORM ACTION="cust_bill.html" METHOD="GET">
- <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
- <TABLE>
- <%= include( '/elements/tr-select-agent.html',
- $cgi->param('agentnum'),
- 'label' => 'Invoices for agent: ',
- )
- %>
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
- <TR>
- <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="open" VALUE="1" CHECKED></TD>
- <TD>Show only open invoices</TD>
- </TR>
- <TR>
- <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="newest_percust" VALUE="1"></TD>
- <TD>Show only the single most recent invoice per-customer</TD>
- </TR>
- </TABLE>
- <BR><INPUT TYPE="submit" VALUE="Get Report">
- </FORM>
- </BODY>
-</HTML>
-
diff --git a/httemplate/search/report_cust_credit.html b/httemplate/search/report_cust_credit.html
index 56bbd0ac0..ceffca75d 100644
--- a/httemplate/search/report_cust_credit.html
+++ b/httemplate/search/report_cust_credit.html
@@ -1,10 +1,14 @@
<HTML>
<HEAD>
<TITLE>Credit report criteria</TITLE>
+ <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>
</HEAD>
<BODY BGCOLOR="#e8e8e8">
<H1>Credit report criteria</H1>
- <FORM ACTION="cust_credit.html" METHOD="GET">
+ <FORM ACTION="cust_credit.html" METHOD="post">
<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
<TABLE>
<TR>
@@ -23,12 +27,30 @@
</SELECT>
</TD>
</TR>
- <%= include( '/elements/tr-select-agent.html',
- $cgi->param('agentnum'),
- 'label' => 'for agent: ',
- )
- %>
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
+ <TR>
+ <TD ALIGN="right">From: </TD>
+ <TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "beginning_text",
+ ifFormat: "%m/%d/%Y",
+ button: "beginning_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
+ <TR>
+ <TD ALIGN="right">To: </TD>
+ <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "ending_text",
+ ifFormat: "%m/%d/%Y",
+ button: "ending_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Get Report">
</FORM>
diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html
index 5d8b74e77..95198c7b2 100644
--- a/httemplate/search/report_cust_pay.html
+++ b/httemplate/search/report_cust_pay.html
@@ -1,10 +1,14 @@
<HTML>
<HEAD>
<TITLE>Payment report criteria</TITLE>
+ <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>
</HEAD>
<BODY BGCOLOR="#e8e8e8">
<H1>Payment report criteria</H1>
- <FORM ACTION="cust_pay.cgi" METHOD="GET">
+ <FORM ACTION="cust_pay.cgi" METHOD="post">
<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
<TABLE>
<TR>
@@ -15,22 +19,35 @@
<OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION>
<OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION>
<OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION>
- <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION>
<OPTION VALUE="CHEK">electronic check / ACH</OPTION>
- <OPTION VALUE="BILL">check</OPTION>
- <OPTION VALUE="PREP">prepaid card</OPTION>
- <OPTION VALUE="CASH">cash</OPTION>
- <OPTION VALUE="WEST">Western Union</OPTION>
- <OPTION VALUE="MCRD">manual credit card</OPTION>
+ <OPTION VALUE="BILL">check / cash</OPTION>
</SELECT>
</TD>
</TR>
- <%= include( '/elements/tr-select-agent.html',
- $cgi->param('agentnum'),
- 'label' => 'for agent: ',
- )
- %>
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
+ <TR>
+ <TD ALIGN="right">From: </TD>
+ <TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "beginning_text",
+ ifFormat: "%m/%d/%Y",
+ button: "beginning_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
+ <TR>
+ <TD ALIGN="right">To: </TD>
+ <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "ending_text",
+ ifFormat: "%m/%d/%Y",
+ button: "ending_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Get Report">
</FORM>
diff --git a/httemplate/search/report_prepaid_income.html b/httemplate/search/report_prepaid_income.html
index 57c318eba..e8b6ac4b1 100644
--- a/httemplate/search/report_prepaid_income.html
+++ b/httemplate/search/report_prepaid_income.html
@@ -8,7 +8,7 @@
</HEAD>
<BODY BGCOLOR="#e8e8e8">
<H1>Prepaid Income (Unearned Revenue) Report</H1>
- <FORM ACTION="report_prepaid_income.cgi" METHOD="GET">
+ <FORM ACTION="report_prepaid_income.cgi" METHOD="post">
<TABLE>
<TR>
<TD>Prepaid income (unearned revenue) as of </TD>
diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
index d675346f0..0e95ad73c 100755
--- a/httemplate/search/report_receivables.cgi
+++ b/httemplate/search/report_receivables.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
my $charged = <<END;
@@ -49,7 +50,7 @@ END
and cust_main.custnum = cust_bill.custnum
)
,0
- ) as owed_90_pl,
+ ) as owed_90_plus,
coalesce(
( select $charged from cust_bill
@@ -60,8 +61,8 @@ END
END
my $recurring = <<END;
- '0' != ( select freq from part_pkg
- where cust_pkg.pkgpart = part_pkg.pkgpart )
+ 0 < ( select freq from part_pkg
+ where cust_pkg.pkgpart = part_pkg.pkgpart )
END
my $packages_cols = <<END;
@@ -81,7 +82,9 @@ END
END
- my $where = <<END;
+ my $sql = <<END;
+
+select *, $owed_cols, $packages_cols from cust_main
where 0 <
coalesce(
( select $charged from cust_bill
@@ -89,144 +92,67 @@ where 0 <
)
,0
)
+
+order by coalesce(lower(company), ''), lower(last)
+
END
- my $agentnum = '';
- if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $agentnum = $1;
- $where .= " AND agentnum = '$agentnum' ";
- }
-
- my $count_sql = "select count(*) from cust_main $where";
-
- my $sql_query = {
- 'table' => 'cust_main',
- 'hashref' => {},
- 'select' => "*, $owed_cols, $packages_cols",
- 'extra_sql' => "$where order by coalesce(lower(company), ''), lower(last)",
- };
-
- if ( $agentnum ) {
- $owed_cols =~
- s/cust_bill\.custnum/cust_bill.custnum AND cust_main.agentnum = '$agentnum'/g;
- }
my $total_sql = "select $owed_cols";
+
+ my $sth = dbh->prepare($sql) or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+
my $total_sth = dbh->prepare($total_sql) or die dbh->errstr;
$total_sth->execute or die $total_sth->errstr;
- my $row = $total_sth->fetchrow_hashref();
-
- my $conf = new FS::Conf;
- my $money_char = $conf->config('money_char') || '$';
-
- my $align = join('', map { /#/ ? 'r' : 'l' } FS::UI::Web::cust_header() ).
- 'crrrrr';
-
- my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
-
-%><%= include( 'elements/search.html',
- 'title' => 'Accounts Receivable Aging Summary',
- 'name' => 'customers',
- 'query' => $sql_query,
- 'count_query' => $count_sql,
- 'header' => [
- FS::UI::Web::cust_header(),
- 'Status', # (me)',
- #'Status', # (cust_main)',
- '0-30',
- '30-60',
- '60-90',
- '90+',
- 'Total',
- ],
- 'footer' => [
- 'Total',
- ( map '',
- ( 1 ..
- scalar(FS::UI::Web::cust_header()-1)
- )
- ),
- '',
- #'',
- sprintf( $money_char.'%.2f',
- $row->{'owed_0_30'} ),
- sprintf( $money_char.'%.2f',
- $row->{'owed_30_60'} ),
- sprintf( $money_char.'%.2f',
- $row->{'owed_60_90'} ),
- sprintf( $money_char.'%.2f',
- $row->{'owed_90_pl'} ),
- sprintf( '<b>'. $money_char.'%.2f'. '</b>',
- $row->{'owed_total'} ),
- ],
- 'fields' => [
- \&FS::UI::Web::cust_fields,
- sub {
- my $row = shift;
- my $status = 'Cancelled';
- my $statuscol = 'FF0000';
- if ( $row->uncancelled_pkgs ) {
- $status = 'Suspended';
- $statuscol = 'FF9900';
- if ( $row->active_pkgs ) {
- $status = 'Active';
- $statuscol = '00CC00';
- }
- }
- $status;
- },
- #sub { ucfirst(shift->status) },
- sub { sprintf( $money_char.'%.2f',
- shift->get('owed_0_30') ) },
- sub { sprintf( $money_char.'%.2f',
- shift->get('owed_30_60') ) },
- sub { sprintf( $money_char.'%.2f',
- shift->get('owed_60_90') ) },
- sub { sprintf( $money_char.'%.2f',
- shift->get('owed_90_pl') ) },
- sub { sprintf( $money_char.'%.2f',
- shift->get('owed_total') ) },
- ],
- 'links' => [
- ( map $clink, FS::UI::Web::cust_header() ),
- '',
- #'',
- '',
- '',
- '',
- '',
- '',
- ],
- #'align' => 'rlccrrrrr',
- 'align' => $align,
- #'size' => [ '', '', '-1', '-1', '', '', '', '', '', ],
- #'style' => [ '', '', 'b', 'b', '', '', '', '', 'b', ],
- 'size' => [ ( map '', FS::UI::Web::cust_header() ),
- '-1', '', '', '', '', '', ],
- 'style' => [ ( map '', FS::UI::Web::cust_header() ),
- 'b', '', '', '', '', 'b', ],
- 'color' => [
- ( map '', FS::UI::Web::cust_header() ),
- sub {
- my $row = shift;
- my $status = 'Cancelled';
- my $statuscol = 'FF0000';
- if ( $row->uncancelled_pkgs ) {
- $status = 'Suspended';
- $statuscol = 'FF9900';
- if ( $row->active_pkgs ) {
- $status = 'Active';
- $statuscol = '00CC00';
- }
- }
- $statuscol;
- },
- #sub { shift->statuscolor; },
- '',
- '',
- '',
- '',
- '',
- ],
-
- )
+
+%>
+<%= header('Accounts Receivable Aging Summary', menubar( 'Main Menu'=>$p, ) ) %>
+<%= table() %>
+ <TR>
+ <TH>Customer</TH>
+ <TH>Status</TH>
+ <TH>0-30</TH>
+ <TH>30-60</TH>
+ <TH>60-90</TH>
+ <TH>90+</TH>
+ <TH>Total</TH>
+ </TR>
+<% while ( my $row = $sth->fetchrow_hashref() ) {
+ my $status = 'Cancelled';
+ my $statuscol = 'FF0000';
+ if ( $row->{uncancelled_pkgs} ) {
+ $status = 'Suspended';
+ $statuscol = 'FF9900';
+ if ( $row->{active_pkgs} ) {
+ $status = 'Active';
+ $statuscol = '00CC00';
+ }
+ }
%>
+ <TR>
+ <TD><A HREF="<%= $p %>view/cust_main.cgi?<%= $row->{'custnum'} %>"><%= $row->{'custnum'} %>:
+ <%= $row->{'company'} ? $row->{'company'}. ' (' : '' %><%= $row->{'last'}. ', '. $row->{'first'} %><%= $row->{'company'} ? ')' : '' %></A>
+ </TD>
+ <TD><B><FONT SIZE=-1 COLOR="#<%= $statuscol %>"><%= $status %></FONT></B></TD>
+ <TD ALIGN="right">$<%= sprintf("%.2f", $row->{'owed_0_30'} ) %></TD>
+ <TD ALIGN="right">$<%= sprintf("%.2f", $row->{'owed_30_60'} ) %></TD>
+ <TD ALIGN="right">$<%= sprintf("%.2f", $row->{'owed_60_90'} ) %></TD>
+ <TD ALIGN="right">$<%= sprintf("%.2f", $row->{'owed_90_plus'} ) %></TD>
+ <TD ALIGN="right"><B>$<%= sprintf("%.2f", $row->{'owed_total'} ) %></B></TD>
+ </TR>
+<% } %>
+<% my $row = $total_sth->fetchrow_hashref(); %>
+ <TR>
+ <TD COLSPAN=6>&nbsp;</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN=2><I>Total</I></TD>
+ <TD ALIGN="right"><I>$<%= sprintf("%.2f", $row->{'owed_0_30'} ) %></TD>
+ <TD ALIGN="right"><I>$<%= sprintf("%.2f", $row->{'owed_30_60'} ) %></TD>
+ <TD ALIGN="right"><I>$<%= sprintf("%.2f", $row->{'owed_60_90'} ) %></TD>
+ <TD ALIGN="right"><I>$<%= sprintf("%.2f", $row->{'owed_90_plus'} ) %></TD>
+ <TD ALIGN="right"><I><B>$<%= sprintf("%.2f", $row->{'owed_total'} ) %></B></I></TD>
+ </TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index 9062f0626..587665740 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -1,11 +1,15 @@
+<!-- mason kludge -->
<%
-my $conf = new FS::Conf;
-my $money_char = $conf->config('money_char') || '$';
-
my $user = getotaker;
-my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
+$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
+my $pbeginning = $1;
+my $beginning = $1 ? str2time($1) : 0;
+
+$cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
+my $pending = $1;
+my $ending = ( $1 ? str2time($1) : 4294880896 ) + 86399;
my $from_join_cust = "
FROM cust_bill_pkg
@@ -20,19 +24,11 @@ my $where = "
WHERE _date >= $beginning AND _date <= $ending
AND ( county = ? OR ? = '' )
AND ( state = ? OR ? = '' )
- AND country = ?
+ AND ( country = ? )
AND payby != 'COMP'
";
my @base_param = qw( county county state state country );
-my $agentname = '';
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- my $agent = qsearchs('agent', { 'agentnum' => $1 } );
- die "agent not found" unless $agent;
- $agentname = $agent->agent;
- $where .= ' AND agentnum = '. $agent->agentnum;
-}
-
my $gotcust = "
WHERE 0 < ( SELECT COUNT(*) FROM cust_main
WHERE ( cust_main.county = cust_main_county.county
@@ -47,72 +43,52 @@ my $gotcust = "
";
my $monthly_exempt_warning = 0;
-my $taxclass_flag = 0;
-my($total, $tot_taxable, $owed, $tax) = ( 0, 0, 0, 0, 0 );
-my( $exempt_cust, $exempt_pkg, $exempt_monthly ) = ( 0, 0 );
+my($total, $exempt, $taxable, $owed, $tax) = ( 0, 0, 0, 0, 0 );
my $out = 'Out of taxable region(s)';
-my %regions = ();
+my %regions;
foreach my $r (qsearch('cust_main_county', {}, '', $gotcust) ) {
#warn $r->county. ' '. $r->state. ' '. $r->country. "\n";
my $label = getlabel($r);
$regions{$label}->{'label'} = $label;
- $regions{$label}->{'url_param'} = join(';', map "$_=".$r->$_(), qw( county state country ) );
my $fromwhere = $from_join_cust. $join_pkg. $where;
- my @param = @base_param;
+ my @param = @base_param;
if ( $r->taxclass ) {
- $fromwhere .= " AND taxclass = ? ";
+ $fromwhere .= " AND ( taxclass = ? ) ";
push @param, 'taxclass';
- $regions{$label}->{'url_param'} .= ';taxclass='. $r->taxclass
- if $cgi->param('show_taxclasses');
- $taxclass_flag = 1;
}
-# my $label = getlabel($r);
-# $regions{$label}->{'label'} = $label;
-
my $nottax = 'pkgnum != 0';
- ## calculate total for this region
-
- my $t = scalar_sql($r, \@param,
+ my $a = scalar_sql($r, \@param,
"SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) $fromwhere AND $nottax"
);
- $total += $t;
- $regions{$label}->{'total'} += $t;
-
- ## calculate package-exemption for this region
+ $total += $a;
+ $regions{$label}->{'total'} += $a;
foreach my $e ( grep { $r->get($_.'tax') =~ /^Y/i }
qw( cust_bill_pkg.setup cust_bill_pkg.recur ) ) {
my $x = scalar_sql($r, \@param,
"SELECT SUM($e) $fromwhere AND $nottax"
);
- $exempt_pkg += $x;
- $regions{$label}->{'exempt_pkg'} += $x;
+ $exempt += $x;
+ $regions{$label}->{'exempt'} += $x;
}
- ## calculate customer-exemption for this region
-
- my($taxable, $x_cust) = (0, 0);
+ my($t, $x) = (0, 0);
foreach my $e ( grep { $r->get($_.'tax') !~ /^Y/i }
qw( cust_bill_pkg.setup cust_bill_pkg.recur ) ) {
- $taxable += scalar_sql($r, \@param,
+ $t += scalar_sql($r, \@param,
"SELECT SUM($e) $fromwhere AND $nottax AND ( tax != 'Y' OR tax IS NULL )"
);
- $x_cust += scalar_sql($r, \@param,
+ $x += scalar_sql($r, \@param,
"SELECT SUM($e) $fromwhere AND $nottax AND tax = 'Y'"
);
}
- $exempt_cust += $x_cust;
- $regions{$label}->{'exempt_cust'} += $x_cust;
-
- ## calculate monthly exemption (texas tax) for this region
-
my($sday,$smon,$syear) = (localtime($beginning) )[ 3, 4, 5 ];
$monthly_exempt_warning=1 if $sday != 1 && $beginning;
$smon++; $syear+=1900;
@@ -121,24 +97,25 @@ foreach my $r (qsearch('cust_main_county', {}, '', $gotcust) ) {
my($eday,$emon,$eyear) = (localtime($eending) )[ 3, 4, 5 ];
$emon++; $eyear+=1900;
- my $x_monthly = scalar_sql($r, [ 'taxnum' ],
+ my $monthly_exemption = scalar_sql($r, [ 'taxnum' ],
"SELECT SUM(amount) FROM cust_tax_exempt where taxnum = ? ".
" AND ( year > $syear OR ( year = $syear and month >= $smon ) )".
" AND ( year < $eyear OR ( year = $eyear and month <= $emon ) )"
);
- if ( $x_monthly ) {
- warn $r->taxnum(). ": $x_monthly\n";
- $taxable -= $x_monthly;
+ #warn $r->taxnum(). ": $monthly_exemption\n";
+ if ( $monthly_exemption ) {
+ $t -= $monthly_exemption;
+ $x += $monthly_exemption;
}
- $exempt_monthly += $x_monthly;
- $regions{$label}->{'exempt_monthly'} += $x_monthly;
+ $taxable += $t;
+ $regions{$label}->{'taxable'} += $t;
- $tot_taxable += $taxable;
- $regions{$label}->{'taxable'} += $taxable;
+ $exempt += $x;
+ $regions{$label}->{'exempt'} += $x;
- $owed += $taxable * ($r->tax/100);
- $regions{$label}->{'owed'} += $taxable * ($r->tax/100);
+ $owed += $t * ($r->tax/100);
+ $regions{$label}->{'owed'} += $t * ($r->tax/100);
if ( defined($regions{$label}->{'rate'})
&& $regions{$label}->{'rate'} != $r->tax.'%' ) {
@@ -151,7 +128,7 @@ foreach my $r (qsearch('cust_main_county', {}, '', $gotcust) ) {
my $taxwhere = "$from_join_cust $where";
my @taxparam = @base_param;
-my %base_regions = ();
+
#foreach my $label ( keys %regions ) {
foreach my $r (
qsearch( 'cust_main_county',
@@ -180,58 +157,30 @@ foreach my $r (
$tax += $x;
$regions{$label}->{'tax'} += $x;
- if ( $cgi->param('show_taxclasses') ) {
- my $base_label = getlabel($r, 'no_taxclass'=>1 );
- $base_regions{$base_label}->{'label'} = $base_label;
- $base_regions{$base_label}->{'url_param'} =
- join(';', map "$_=".$r->$_(), qw( county state country ) );
- $base_regions{$base_label}->{'tax'} += $x;
- }
-
}
#ordering
-my @regions =
- map $regions{$_},
- sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
- keys %regions;
-
-my @base_regions =
- map $base_regions{$_},
- sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
- keys %base_regions;
+my @regions = map $regions{$_},
+ sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
+ keys %regions;
push @regions, {
- 'label' => 'Total',
- 'url_param' => '',
- 'total' => $total,
- 'exempt_cust' => $exempt_cust,
- 'exempt_pkg' => $exempt_pkg,
- 'exempt_monthly' => $exempt_monthly,
- 'taxable' => $tot_taxable,
- 'rate' => '',
- 'owed' => $owed,
- 'tax' => $tax,
+ 'label' => 'Total',
+ 'total' => $total,
+ 'exempt' => $exempt,
+ 'taxable' => $taxable,
+ 'rate' => '',
+ 'owed' => $owed,
+ 'tax' => $tax,
};
#--
sub getlabel {
my $r = shift;
- my %opt = @_;
my $label;
- if (
- $r->tax == 0
- && ! scalar( qsearch('cust_main_county', { 'state' => $r->state,
- 'county' => $r->county,
- 'country' => $r->country,
- 'tax' => { op=>'>', value=>0 },
- }
- )
- )
-
- ) {
+ if ( $r->tax == 0 ) {
#kludge to avoid "will not stay shared" warning
my $out = 'Out of taxable region(s)';
$label = $out;
@@ -243,10 +192,6 @@ sub getlabel {
$label = $r->country;
$label = $r->state.", $label" if $r->state;
$label = $r->county." county, $label" if $r->county;
- $label = "$label (". $r->taxclass. ")"
- if $r->taxclass
- && $cgi->param('show_taxclasses')
- && ! $opt{'no_taxclasses'};
#$label = $r->taxname. " ($label)" if $r->taxname;
}
return $label;
@@ -265,159 +210,35 @@ sub scalar_sql {
%>
-<%
-
-my $baselink = $p. "search/cust_bill_pkg.cgi?begin=$beginning;end=$ending";
-
-%>
-
-
-<%= header( "$agentname Sales Tax Report - ".
- time2str('%h %o %Y through ', $beginning ).
- ( $ending == 4294967295
- ? 'now'
- : time2str('%h %o %Y', $ending )
- ),
- menubar( 'Main Menu'=>$p, )
- )
-%>
-
-<%= include('/elements/table-grid.html') %>
-
+<%= header( "Sales Tax Report - $pbeginning through ".($pending||'now'),
+ menubar( 'Main Menu'=>$p, ) ) %>
+<%= table() %>
<TR>
- <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=9>Sales</TH>
- <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Rate</TH>
- <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Tax owed</TH>
- <% unless ( $cgi->param('show_taxclasses') ) { %>
- <TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Tax invoiced</TH>
- <% } %>
+ <TH ROWSPAN=2></TH>
+ <TH COLSPAN=3>Sales</TH>
+ <TH ROWSPAN=2>Rate</TH>
+ <TH ROWSPAN=2>Tax owed</TH>
+ <TH ROWSPAN=2>Tax invoiced</TH>
</TR>
<TR>
- <TH CLASS="grid" BGCOLOR="#cccccc">Total</TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc">Non-taxable<BR><FONT SIZE=-1>(tax-exempt customer)</FONT></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc">Non-taxable<BR><FONT SIZE=-1>(tax-exempt package)</FONT></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc">Non-taxable<BR><FONT SIZE=-1>(monthly exemption)</FONT></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc">Taxable</TH>
+ <TH>Total</TH>
+ <TH>Non-taxable</TH>
+ <TH>Taxable</TH>
</TR>
-
-<% my $bgcolor1 = '#eeeeee';
- my $bgcolor2 = '#ffffff';
- my $bgcolor;
-%>
-
- <% foreach my $region ( @regions ) {
-
- if ( $bgcolor eq $bgcolor1 ) {
- $bgcolor = $bgcolor2;
- } else {
- $bgcolor = $bgcolor1;
- }
-
- my $link = $baselink;
- if ( $region->{'label'} ne 'Total' ) {
- if ( $region->{'label'} eq $out ) {
- $link .= ';out=1';
- } else {
- $link .= ';'. $region->{'url_param'};
- }
- }
- %>
-
+ <% foreach my $region ( @regions ) { %>
<TR>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $region->{'label'} %></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <A HREF="<%= $link %>;nottax=1"><%= $money_char %><%= sprintf('%.2f', $region->{'total'} ) %></A>
- </TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><FONT SIZE="+1"><B> - </B></FONT></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <A HREF="<%= $link %>;nottax=1;cust_tax=Y"><%= $money_char %><%= sprintf('%.2f', $region->{'exempt_cust'} ) %></A>
- </TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><FONT SIZE="+1"><B> - </B></FONT></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <A HREF="<%= $link %>;nottax=1;pkg_tax=Y"><%= $money_char %><%= sprintf('%.2f', $region->{'exempt_pkg'} ) %></A>
- </TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><FONT SIZE="+1"><B> - </B></FONT></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <%= $money_char %><%= sprintf('%.2f', $region->{'exempt_monthly'} ) %></A>
- </TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><FONT SIZE="+1"><B> = </B></FONT></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <%= $money_char %><%= sprintf('%.2f', $region->{'taxable'} ) %></A>
- </TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $region->{'label'} eq 'Total' ? '' : '<FONT FACE="sans-serif" SIZE="+1"><B> X </B></FONT>' %></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right"><%= $region->{'rate'} %></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $region->{'label'} eq 'Total' ? '' : '<FONT FACE="sans-serif" SIZE="+1"><B> = </B></FONT>' %></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <%= $money_char %><%= sprintf('%.2f', $region->{'owed'} ) %>
- </TD>
- <% unless ( $cgi->param('show_taxclasses') ) { %>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <A HREF="<%= $link %>;istax=1"><%= $money_char %><%= sprintf('%.2f', $region->{'tax'} ) %></A>
- </TD>
- <% } %>
+ <TD><%= $region->{'label'} %></TD>
+ <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'total'} ) %></TD>
+ <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'exempt'} ) %></TD>
+ <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'taxable'} ) %></TD>
+ <TD ALIGN="right"><%= $region->{'rate'} %></TD>
+ <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'owed'} ) %></TD>
+ <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'tax'} ) %></TD>
</TR>
-
<% } %>
</TABLE>
-
-<% if ( $cgi->param('show_taxclasses') ) { %>
-
- <BR>
- <%= include('/elements/table-grid.html') %>
- <TR>
- <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc">Tax invoiced</TH>
- </TR>
-
- <% #some false laziness w/above
- foreach my $region ( @base_regions ) {
-
- if ( $bgcolor eq $bgcolor1 ) {
- $bgcolor = $bgcolor2;
- } else {
- $bgcolor = $bgcolor1;
- }
-
- my $link = $baselink;
- #if ( $region->{'label'} ne 'Total' ) {
- if ( $region->{'label'} eq $out ) {
- $link .= ';out=1';
- } else {
- $link .= ';'. $region->{'url_param'};
- }
- #}
- %>
-
- <TR>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $region->{'label'} %></TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <A HREF="<%= $link %>;istax=1"><%= $money_char %><%= sprintf('%.2f', $region->{'tax'} ) %></A>
- </TD>
- </TR>
-
- <% } %>
-
- <TR>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">Total</TD>
- <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right">
- <A HREF="<%= $baselink %>;istax=1"><%= $money_char %><%= sprintf('%.2f', $tax ) %></A>
- </TD>
- </TR>
-
- </TABLE>
-
-<% } %>
-
-
<% if ( $monthly_exempt_warning ) { %>
<BR>
Partial-month tax reports (except for current month) may not be correct due
diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html
index eeaccc1ab..d217e5671 100755
--- a/httemplate/search/report_tax.html
+++ b/httemplate/search/report_tax.html
@@ -1,17 +1,39 @@
<HTML>
<HEAD>
<TITLE>Tax Report Criteria</TITLE>
- </HEAD>
+ <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> </HEAD>
<BODY BGCOLOR="#e8e8e8">
<H1>Tax Report Criteria</H1>
- <FORM ACTION="report_tax.cgi" METHOD="GET">
+ <FORM ACTION="report_tax.cgi" METHOD="post">
+ Return <B>tax report</B> for period:
<TABLE>
- <%= include( '/elements/tr-select-agent.html' ) %>
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
- <TR>
- <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_taxclasses" VALUE="1"></TD>
- <TD>Show tax classes</TD>
- </TR>
+ <TR>
+ <TD ALIGN="right">From: </TD>
+ <TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "beginning_text",
+ ifFormat: "%m/%d/%Y",
+ button: "beginning_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
+ <TR>
+ <TD ALIGN="right">To: </TD>
+ <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
+<SCRIPT TYPE="text/javascript">
+ Calendar.setup({
+ inputField: "ending_text",
+ ifFormat: "%m/%d/%Y",
+ button: "ending_button",
+ align: "BR"
+ });
+</SCRIPT>
+ </TR>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Get Report">
diff --git a/httemplate/search/sqlradius.html b/httemplate/search/sqlradius.html
index 8f4878dbc..20e8fb817 100644
--- a/httemplate/search/sqlradius.html
+++ b/httemplate/search/sqlradius.html
@@ -4,7 +4,7 @@
<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
') %>
-<FORM NAME="OneTrueForm" ACTION="sqlradius.cgi" METHOD="GET">
+<FORM NAME="OneTrueForm" ACTION="sqlradius.cgi" METHOD="POST">
<% #include( '/elements/table.html' ) %>
<%= ntable('#cccccc') %>
<TR>
diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi
index b14591958..1e4a03d84 100755
--- a/httemplate/search/svc_acct.cgi
+++ b/httemplate/search/svc_acct.cgi
@@ -1,37 +1,250 @@
<%
-my $orderby = 'ORDER BY svcnum';
+my $conf = new FS::Conf;
+my $maxrecords = $conf->config('maxsearchrecordsperpage');
+
+my $orderby = ''; #removeme
+
+my $limit = '';
+$limit .= "LIMIT $maxrecords" if $maxrecords;
+
+my $offset = $cgi->param('offset') || 0;
+$limit .= " OFFSET $offset" if $offset;
+
+my $total;
my($query)=$cgi->keywords;
$query ||= ''; #to avoid use of unitialized value errors
-my $cjoin = '';
-my @extra_sql = ();
+my $unlinked = '';
if ( $query =~ /^UN_(.*)$/ ) {
$query = $1;
- $cjoin = 'LEFT JOIN cust_svc USING ( svcnum )';
- push @extra_sql, 'pkgnum IS NULL';
+ my $empty = driver_name eq 'Pg' ? qq('') : qq("");
+ if ( driver_name eq 'mysql' ) {
+ $unlinked = "LEFT JOIN cust_svc ON cust_svc.svcnum = svc_acct.svcnum
+ WHERE cust_svc.pkgnum IS NULL
+ OR cust_svc.pkgnum = 0
+ OR cust_svc.pkgnum = $empty";
+ } else {
+ $unlinked = "
+ WHERE 0 <
+ ( SELECT count(*) FROM cust_svc
+ WHERE cust_svc.svcnum = svc_acct.svcnum
+ AND ( pkgnum IS NULL OR pkgnum = 0 )
+ )
+ ";
+ }
}
+my $tblname = driver_name eq 'mysql' ? 'svc_acct.' : '';
+my(@svc_acct, $sortby);
if ( $query eq 'svcnum' ) {
- #$orderby = "ORDER BY svcnum";
+ $sortby=\*svcnum_sort;
+ $orderby = "ORDER BY ${tblname}svcnum";
} elsif ( $query eq 'username' ) {
- $orderby = "ORDER BY LOWER(username)";
+ $sortby=\*username_sort;
+ $orderby = "ORDER BY ${tblname}username";
} elsif ( $query eq 'uid' ) {
- $orderby = "ORDER BY uid";
- push @extra_sql, "uid IS NOT NULL";
+ $sortby=\*uid_sort;
+ $orderby = ( $unlinked ? ' AND' : ' WHERE' ).
+ " ${tblname}uid IS NOT NULL ORDER BY ${tblname}uid";
} elsif ( $cgi->param('popnum') =~ /^(\d+)$/ ) {
- push @extra_sql, "popnum = $1";
- $orderby = "ORDER BY LOWER(username)";
+ $unlinked .= ( $unlinked ? 'AND' : 'WHERE' ).
+ " popnum = $1";
+ $sortby=\*username_sort;
+ $orderby = "ORDER BY ${tblname}username";
} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
- $cjoin ||= 'LEFT JOIN cust_svc USING ( svcnum )';
- push @extra_sql, "svcpart = $1";
- $orderby = "ORDER BY uid";
- #$orderby = "ORDER BY svcnum";
+ $unlinked .= ( $unlinked ? ' AND' : ' WHERE' ).
+ " $1 = ( SELECT svcpart FROM cust_svc ".
+ " WHERE cust_svc.svcnum = svc_acct.svcnum ) ";
+ $sortby=\*uid_sort;
+ #$sortby=\*svcnum_sort;
} else {
- $orderby = "ORDER BY uid";
+ $sortby=\*uid_sort;
+ @svc_acct = @{&usernamesearch};
+}
+
+
+if ( $query eq 'svcnum'
+ || $query eq 'username'
+ || $query eq 'uid'
+ || $cgi->param('popnum') =~ /^(\d+)$/
+ || $cgi->param('svcpart') =~ /^(\d+)$/
+ ) {
+
+ my $statement = "SELECT COUNT(*) FROM svc_acct $unlinked";
+ my $sth = dbh->prepare($statement)
+ or die dbh->errstr. " doing $statement";
+ $sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
+
+ $total = $sth->fetchrow_arrayref->[0];
+
+ @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $orderby $limit");
+
+}
+
+if ( scalar(@svc_acct) == 1 ) {
+ my($svcnum)=$svc_acct[0]->svcnum;
+ print $cgi->redirect(popurl(2). "view/svc_acct.cgi?$svcnum"); #redirect
+ #exit;
+} elsif ( scalar(@svc_acct) == 0 ) { #error
+%>
+<!-- mason kludge -->
+<%
+ idiot("Account not found");
+} else {
+%>
+<!-- mason kludge -->
+<%
+ $total ||= scalar(@svc_acct);
+
+ #begin pager
+ my $pager = '';
+ if ( $total != scalar(@svc_acct) && $maxrecords ) {
+ unless ( $offset == 0 ) {
+ $cgi->param('offset', $offset - $maxrecords);
+ $pager .= '<A HREF="'. $cgi->self_url.
+ '"><B><FONT SIZE="+1">Previous</FONT></B></A> ';
+ }
+ my $poff;
+ my $page;
+ for ( $poff = 0; $poff < $total; $poff += $maxrecords ) {
+ $page++;
+ if ( $offset == $poff ) {
+ $pager .= qq!<FONT SIZE="+2">$page</FONT> !;
+ } else {
+ $cgi->param('offset', $poff);
+ $pager .= qq!<A HREF="!. $cgi->self_url. qq!">$page</A> !;
+ }
+ }
+ unless ( $offset + $maxrecords > $total ) {
+ $cgi->param('offset', $offset + $maxrecords);
+ $pager .= '<A HREF="'. $cgi->self_url.
+ '"><B><FONT SIZE="+1">Next</FONT></B></A> ';
+ }
+ }
+ #end pager
+
+ print header("Account Search Results",menubar('Main Menu'=>popurl(2))),
+ "$total matching accounts found<BR><BR>$pager",
+ &table(), <<END;
+ <TR>
+ <TH><FONT SIZE=-1>#</FONT></TH>
+ <TH><FONT SIZE=-1>Username</FONT></TH>
+ <TH><FONT SIZE=-1>Domain</FONT></TH>
+ <TH><FONT SIZE=-1>UID</FONT></TH>
+ <TH><FONT SIZE=-1>Service</FONT></TH>
+ <TH><FONT SIZE=-1>Cust#</FONT></TH>
+ <TH><FONT SIZE=-1>(bill) name</FONT></TH>
+ <TH><FONT SIZE=-1>company</FONT></TH>
+END
+ if ( defined dbdef->table('cust_main')->column('ship_last') ) {
+ print <<END;
+ <TH><FONT SIZE=-1>(service) name</FONT></TH>
+ <TH><FONT SIZE=-1>company</FONT></TH>
+END
+ }
+ print "</TR>";
- my @username_sql;
+ my(%saw,$svc_acct);
+ my $p = popurl(2);
+ foreach $svc_acct (
+ sort $sortby grep(!$saw{$_->svcnum}++, @svc_acct)
+ ) {
+ my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_acct->svcnum })
+ or die "No cust_svc record for svcnum ". $svc_acct->svcnum;
+ my $part_svc = qsearchs('part_svc', { 'svcpart' => $cust_svc->svcpart })
+ or die "No part_svc record for svcpart ". $cust_svc->svcpart;
+
+ my $domain;
+ my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc });
+ if ( $svc_domain ) {
+ $domain = "<A HREF=\"${p}view/svc_domain.cgi?". $svc_domain->svcnum.
+ "\">". $svc_domain->domain. "</A>";
+ } else {
+ die "No svc_domain.svcnum record for svc_acct.domsvc: ".
+ $svc_acct->domsvc;
+ }
+ my($cust_pkg,$cust_main);
+ if ( $cust_svc->pkgnum ) {
+ $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_svc->pkgnum })
+ or die "No cust_pkg record for pkgnum ". $cust_svc->pkgnum;
+ $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pkg->custnum })
+ or die "No cust_main record for custnum ". $cust_pkg->custnum;
+ }
+ my($svcnum, $username, $uid, $svc, $custnum, $last, $first, $company) = (
+ $svc_acct->svcnum,
+ $svc_acct->getfield('username'),
+ $svc_acct->getfield('uid'),
+ $part_svc->svc,
+ $cust_svc->pkgnum ? $cust_main->custnum : '',
+ $cust_svc->pkgnum ? $cust_main->getfield('last') : '',
+ $cust_svc->pkgnum ? $cust_main->getfield('first') : '',
+ $cust_svc->pkgnum ? $cust_main->company : '',
+ );
+ my($pcustnum) = $custnum
+ ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\"><FONT SIZE=-1>$custnum</FONT></A>"
+ : "<I>(unlinked)</I>"
+ ;
+ my $pname = $custnum ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\">$last, $first</A>" : '';
+ my $pcompany = $custnum ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\">$company</A>" : '';
+ my($pship_name, $pship_company);
+ if ( defined dbdef->table('cust_main')->column('ship_last') ) {
+ my($ship_last, $ship_first, $ship_company) = (
+ $cust_svc->pkgnum ? ( $cust_main->ship_last || $last ) : '',
+ $cust_svc->pkgnum ? ( $cust_main->ship_last
+ ? $cust_main->ship_first
+ : $first
+ ) : '',
+ $cust_svc->pkgnum ? ( $cust_main->ship_last
+ ? $cust_main->ship_company
+ : $company
+ ) : '',
+ );
+ $pship_name = $custnum ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\">$ship_last, $ship_first</A>" : '';
+ $pship_company = $custnum ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\">$ship_company</A>" : '';
+ }
+ print <<END;
+ <TR>
+ <TD><A HREF="${p}view/svc_acct.cgi?$svcnum"><FONT SIZE=-1>$svcnum</FONT></A></TD>
+ <TD><A HREF="${p}view/svc_acct.cgi?$svcnum"><FONT SIZE=-1>$username</FONT></A></TD>
+ <TD><FONT SIZE=-1>$domain</FONT></TD>
+ <TD><A HREF="${p}view/svc_acct.cgi?$svcnum"><FONT SIZE=-1>$uid</FONT></A></TD>
+ <TD><FONT SIZE=-1>$svc</FONT></TH>
+ <TD><FONT SIZE=-1>$pcustnum</FONT></TH>
+ <TD><FONT SIZE=-1>$pname<FONT></TH>
+ <TD><FONT SIZE=-1>$pcompany</FONT></TH>
+END
+ if ( defined dbdef->table('cust_main')->column('ship_last') ) {
+ print <<END;
+ <TD><FONT SIZE=-1>$pship_name<FONT></TH>
+ <TD><FONT SIZE=-1>$pship_company</FONT></TH>
+END
+ }
+ print "</TR>";
+
+ }
+
+ print "</TABLE>$pager<BR>".
+ '</BODY></HTML>';
+
+}
+
+sub svcnum_sort {
+ $a->getfield('svcnum') <=> $b->getfield('svcnum');
+}
+
+sub username_sort {
+ $a->getfield('username') cmp $b->getfield('username');
+}
+
+sub uid_sort {
+ $a->getfield('uid') <=> $b->getfield('uid');
+}
+
+sub usernamesearch {
+
+ my @svc_acct;
my %username_type;
foreach ( $cgi->param('username_type') ) {
@@ -41,13 +254,17 @@ if ( $query eq 'svcnum' ) {
$cgi->param('username') =~ /^([\w\-\.\&]+)$/; #untaint username_text
my $username = $1;
- push @username_sql, "username ILIKE '$username'"
- if $username_type{'Exact'}
- || $username_type{'Fuzzy'};
+ if ( $username_type{'Exact'} || $username_type{'Fuzzy'} ) {
+ push @svc_acct, qsearch( 'svc_acct',
+ { 'username' => { 'op' => 'ILIKE',
+ 'value' => $username } } );
+ }
- push @username_sql, "username ILIKE '\%$username\%'"
- if $username_type{'Substring'}
- || $username_type{'All'};
+ if ( $username_type{'Substring'} || $username_type{'All'} ) {
+ push @svc_acct, qsearch( 'svc_acct',
+ { 'username' => { 'op' => 'ILIKE',
+ 'value' => "%$username%" } } );
+ }
if ( $username_type{'Fuzzy'} || $username_type{'All'} ) {
&FS::svc_acct::check_and_rebuild_fuzzyfiles;
@@ -63,78 +280,15 @@ if ( $query eq 'svcnum' ) {
#if ($username_type{'Sound-alike'}) {
#}
- push @username_sql, "username = '$_'"
- foreach (keys %username);
+ foreach ( keys %username ) {
+ push @svc_acct, qsearch('svc_acct',{'username'=>$_});
+ }
}
- push @extra_sql, '( '. join( ' OR ', @username_sql). ' )';
+ #[ qsearch('svc_acct',{'username'=>$username}) ];
+ \@svc_acct;
}
-my $extra_sql =
- scalar(@extra_sql)
- ? ' WHERE '. join(' AND ', @extra_sql )
- : '';
-
-my $count_query = "SELECT COUNT(*) FROM svc_acct $cjoin $extra_sql";
-#if ( keys %svc_acct ) {
-# $count_query .= ' WHERE '.
-# join(' AND ', map "$_ = ". dbh->quote($svc_acct{$_}),
-# keys %svc_acct
-# );
-#}
-
-my $sql_query = {
- 'table' => 'svc_acct',
- 'hashref' => {}, # \%svc_acct,
- 'select' => join(', ',
- 'svc_acct.*',
- 'cust_main.custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'extra_sql' => "$extra_sql $orderby",
- 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
- ' LEFT JOIN part_svc USING ( svcpart ) '.
- ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
- ' LEFT JOIN cust_main USING ( custnum ) ',
-};
-
-my $link = [ "${p}view/svc_acct.cgi?", 'svcnum' ];
-my $link_cust = sub {
- my $svc_acct = shift;
- if ( $svc_acct->custnum ) {
- [ "${p}view/cust_main.cgi?", 'custnum' ];
- } else {
- '';
- }
-};
-
-%><%= include( 'elements/search.html',
- 'title' => 'Account Search Results',
- 'name' => 'accounts',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'redirect' => $link,
- 'header' => [ '#',
- 'Account',
- 'UID',
- 'Service',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [ 'svcnum',
- 'email',
- 'uid',
- 'svc',
- \&FS::UI::Web::cust_fields,
- ],
- 'links' => [ $link,
- $link,
- $link,
- '',
- ( map { $link_cust }
- FS::UI::Web::cust_header()
- ),
- ],
- )
%>
diff --git a/httemplate/search/svc_acct.html b/httemplate/search/svc_acct.html
index c504c2f34..742360596 100755
--- a/httemplate/search/svc_acct.html
+++ b/httemplate/search/svc_acct.html
@@ -7,7 +7,7 @@
Account Search
</FONT>
<BR><BR>
- <FORM ACTION="svc_acct.cgi" METHOD="GET">
+ <FORM ACTION="svc_acct.cgi" METHOD="post">
Search for <B>username</B>:
<INPUT TYPE="text" NAME="username">
diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi
index f261ea9f3..948b1d9ae 100755
--- a/httemplate/search/svc_domain.cgi
+++ b/httemplate/search/svc_domain.cgi
@@ -4,82 +4,158 @@ my $conf = new FS::Conf;
my($query)=$cgi->keywords;
$query ||= ''; #to avoid use of unitialized value errors
-
-my $orderby = 'ORDER BY svcnum';
-my $join = '';
-my %svc_domain = ();
-my $extra_sql = '';
+my(@svc_domain,$sortby);
if ( $query eq 'svcnum' ) {
- #$orderby = 'ORDER BY svcnum';
+ $sortby=\*svcnum_sort;
+ @svc_domain=qsearch('svc_domain',{});
} elsif ( $query eq 'domain' ) {
- $orderby = 'ORDER BY domain';
+ $sortby=\*domain_sort;
+ @svc_domain=qsearch('svc_domain',{});
} elsif ( $query eq 'UN_svcnum' ) {
- #$orderby = 'ORDER BY svcnum';
- $join = 'LEFT JOIN cust_svc USING ( svcnum )';
- $extra_sql = ' WHERE pkgnum IS NULL';
+ $sortby=\*svcnum_sort;
+ @svc_domain = grep qsearchs('cust_svc',{
+ 'svcnum' => $_->svcnum,
+ 'pkgnum' => '',
+ }), qsearch('svc_domain',{});
} elsif ( $query eq 'UN_domain' ) {
- $orderby = 'ORDER BY domain';
- $join = 'LEFT JOIN cust_svc USING ( svcnum )';
- $extra_sql = ' WHERE pkgnum IS NULL';
+ $sortby=\*domain_sort;
+ @svc_domain = grep qsearchs('cust_svc',{
+ 'svcnum' => $_->svcnum,
+ 'pkgnum' => '',
+ }), qsearch('svc_domain',{});
} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
- #$orderby = 'ORDER BY svcnum';
- $join = 'LEFT JOIN cust_svc USING ( svcnum )';
- $extra_sql = " WHERE svcpart = $1";
+ @svc_domain =
+ qsearch( 'svc_domain', {}, '',
+ " WHERE $1 = ( SELECT svcpart FROM cust_svc ".
+ " WHERE cust_svc.svcnum = svc_domain.svcnum ) "
+ );
+ $sortby=\*svcnum_sort;
} else {
$cgi->param('domain') =~ /^([\w\-\.]+)$/;
- $join = '';
- $svc_domain{'domain'} = $1;
+ my($domain)=$1;
+ #push @svc_domain, qsearchs('svc_domain',{'domain'=>$domain});
+ @svc_domain = qsearchs('svc_domain',{'domain'=>$domain});
+}
+
+if ( scalar(@svc_domain) == 1 ) {
+ print $cgi->redirect(popurl(2). "view/svc_domain.cgi?". $svc_domain[0]->svcnum);
+ #exit;
+} elsif ( scalar(@svc_domain) == 0 ) {
+%>
+<!-- mason kludge -->
+<%
+ eidiot "No matching domains found!\n";
+} else {
+%>
+<!-- mason kludge -->
+<%
+ my($total)=scalar(@svc_domain);
+ print header("Domain Search Results",''), <<END;
+
+ $total matching domains found
+ <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
+ <TR>
+ <TH>Service #</TH>
+ <TH>Domain</TH>
+<!-- <TH>Mail to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
+ <TH>Forwards to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
+-->
+ </TR>
+END
+
+# my(%saw); # if we've multiple domains with the same
+ # svcnum, then we've a corrupt database
+
+ foreach my $svc_domain (
+# sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain)
+ sort $sortby (@svc_domain)
+ ) {
+ my($svcnum,$domain)=(
+ $svc_domain->svcnum,
+ $svc_domain->domain,
+ );
+
+ #don't display all accounts here
+ my $rowspan = 1;
+
+ #my @svc_acct=qsearch('svc_acct',{'domsvc' => $svcnum});
+ #my $rowspan = 0;
+ #
+ #my $n1 = '';
+ #my($svc_acct, @rows);
+ #foreach $svc_acct (
+ # sort {$b->getfield('username') cmp $a->getfield('username')} (@svc_acct)
+ #) {
+ #
+ # my (@forwards) = ();
+ #
+ # my($svcnum,$username)=(
+ # $svc_acct->svcnum,
+ # $svc_acct->username,
+ # );
+ #
+ # my @svc_forward = qsearch( 'svc_forward', { 'srcsvc' => $svcnum } );
+ # my $svc_forward;
+ # foreach $svc_forward (@svc_forward) {
+ # my($dstsvc,$dst) = (
+ # $svc_forward->dstsvc,
+ # $svc_forward->dst,
+ # );
+ # if ($dstsvc) {
+ # my $dst_svc_acct=qsearchs( 'svc_acct', { 'svcnum' => $dstsvc } );
+ # my $destination=$dst_svc_acct->email;
+ # push @forwards, qq!<TD><A HREF="!, popurl(2),
+ # qq!view/svc_acct.cgi?$dstsvc">$destination</A>!,
+ # qq!</TD></TR>!
+ # ;
+ # }else{
+ # push @forwards, qq!<TD>$dst</TD></TR>!
+ # ;
+ # }
+ # }
+ #
+ # push @rows, qq!$n1<TD ROWSPAN=!, (scalar(@svc_forward) || 1),
+ # qq!><A HREF="!. popurl(2). qq!view/svc_acct.cgi?$svcnum">!,
+ # #print '', ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser );
+ # ( ($username eq '*') ? "<I>(anything)</I>" : $username ),
+ # qq!\@$domain</A> </TD>!,
+ # ;
+ #
+ # push @rows, @forwards;
+ #
+ # $rowspan += (scalar(@svc_forward) || 1);
+ # $n1 = "</TR><TR>";
+ #}
+ ##end of false laziness
+ #
+ #
+
+ print <<END;
+ <TR>
+ <TD ROWSPAN=$rowspan><A HREF="${p}view/svc_domain.cgi?$svcnum">$svcnum</A></TD>
+ <TD ROWSPAN=$rowspan><A HREF="${p}view/svc_domain.cgi?$svcnum">$domain</A></TD>
+END
+
+ #print @rows;
+ print "</TR>";
+
+ }
+
+ print <<END;
+ </TABLE>
+ </BODY>
+</HTML>
+END
+
}
-my $count_query = "SELECT COUNT(*) FROM svc_domain $join $extra_sql";
-if ( keys %svc_domain ) {
- $count_query .= ' WHERE '.
- join(' AND ', map "$_ = ". dbh->quote($svc_domain{$_}),
- keys %svc_domain
- );
+sub svcnum_sort {
+ $a->getfield('svcnum') <=> $b->getfield('svcnum');
}
-my $sql_query = {
- 'table' => 'svc_domain',
- 'hashref' => \%svc_domain,
- 'select' => join(', ',
- 'svc_domain.*',
- 'cust_main.custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'extra_sql' => "$extra_sql $orderby",
- 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum ) '.
- 'LEFT JOIN cust_pkg USING ( pkgnum ) '.
- 'LEFT JOIN cust_main USING ( custnum ) ',
-};
-
-my $link = [ "${p}view/svc_domain.cgi?", 'svcnum' ];
-
-#smaller false laziness w/svc_*.cgi here
-my $link_cust = sub {
- my $svc_x = shift;
- $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';
-};
-
-%><%= include ('elements/search.html',
- 'title' => "Domain Search Results",
- 'name' => 'domains',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'redirect' => $link,
- 'header' => [ '#',
- 'Domain',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [ 'svcnum',
- 'domain',
- \&FS::UI::Web::cust_fields,
- ],
- 'links' => [ $link,
- $link,
- ( map { $link_cust }
- FS::UI::Web::cust_header()
- ),
- ],
- )
+sub domain_sort {
+ $a->getfield('domain') cmp $b->getfield('domain');
+}
+
+
%>
diff --git a/httemplate/search/svc_domain.html b/httemplate/search/svc_domain.html
index b759102f4..94bb9a66d 100755
--- a/httemplate/search/svc_domain.html
+++ b/httemplate/search/svc_domain.html
@@ -7,7 +7,7 @@
Domain Search
</FONT>
<BR><BR>
- <FORM ACTION="svc_domain.cgi" METHOD="GET">
+ <FORM ACTION="svc_domain.cgi" METHOD="post">
Search for <B>domain</B>:
<INPUT TYPE="text" NAME="domain">
diff --git a/httemplate/search/svc_forward.cgi b/httemplate/search/svc_forward.cgi
index a204e345f..10094bc99 100755
--- a/httemplate/search/svc_forward.cgi
+++ b/httemplate/search/svc_forward.cgi
@@ -4,117 +4,76 @@ my $conf = new FS::Conf;
my($query)=$cgi->keywords;
$query ||= ''; #to avoid use of unitialized value errors
-
-
-my $orderby;
-
-my $cjoin = '';
-my @extra_sql = ();
-if ( $query =~ /^UN_(.*)$/ ) {
- $query = $1;
- $cjoin = 'LEFT JOIN cust_svc USING ( svcnum )';
- push @extra_sql, 'pkgnum IS NULL';
-}
-
+my(@svc_forward,$sortby);
if ( $query eq 'svcnum' ) {
- $orderby = 'ORDER BY svcnum';
+ $sortby=\*svcnum_sort;
+ @svc_forward=qsearch('svc_forward',{});
} else {
eidiot('unimplemented');
}
-my $extra_sql =
- scalar(@extra_sql)
- ? ' WHERE '. join(' AND ', @extra_sql )
- : '';
-
-my $count_query = "SELECT COUNT(*) FROM svc_forward $cjoin $extra_sql";
-my $sql_query = {
- 'table' => 'svc_forward',
- 'hashref' => {},
- 'select' => join(', ',
- 'svc_forward.*',
- 'cust_main.custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
- 'extra_sql' => "$extra_sql $orderby",
- 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
- ' LEFT JOIN part_svc USING ( svcpart ) '.
- ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
- ' LEFT JOIN cust_main USING ( custnum ) ',
-};
-
-# <TH>Service #<BR><FONT SIZE=-1>(click to view forward)</FONT></TH>
-# <TH>Mail to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
-# <TH>Forwards to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
-
-my $link = [ "${p}view/svc_forward.cgi?", 'svcnum' ];
+if ( scalar(@svc_forward) == 1 ) {
+ print $cgi->redirect(popurl(2). "view/svc_forward.cgi?". $svc_forward[0]->svcnum);
+ #exit;
+} elsif ( scalar(@svc_forward) == 0 ) {
+%>
+<!-- mason kludge -->
+<%
+ eidiot "No matching forwards found!\n";
+} else {
+%>
+<!-- mason kludge -->
+<%
+ my $total = scalar(@svc_forward);
+ print header("Mail forward Search Results",''), <<END;
+
+ $total matching mail forwards found
+ <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
+ <TR>
+ <TH>Service #<BR><FONT SIZE=-1>(click to view forward)</FONT></TH>
+ <TH>Mail to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
+ <TH>Forwards to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
+ </TR>
+END
+
+ foreach my $svc_forward (
+ sort $sortby (@svc_forward)
+ ) {
+ my $svcnum = $svc_forward->svcnum;
-my $format_src = sub {
- my $svc_forward = shift;
- if ( $svc_forward->srcsvc_acct ) {
- $svc_forward->srcsvc_acct->email;
- } else {
my $src = $svc_forward->src;
$src = "<I>(anything)</I>$src" if $src =~ /^@/;
- $src;
- }
-};
+ if ( $svc_forward->srcsvc_acct ) {
+ $src = qq!<A HREF="${p}view/svc_acct.cgi?!. $svc_forward->srcsvc. '">'.
+ $svc_forward->srcsvc_acct->email. '</A>';
+ }
+
+ my $dst = $svc_forward->dst;
+ if ( $svc_forward->dstsvc_acct ) {
+ $dst = qq!<A HREF="${p}view/svc_acct.cgi?!. $svc_forward->dstsvc. '">'.
+ $svc_forward->dstsvc_acct->email. '</A>';
+ }
+
+ print <<END;
+ <TR>
+ <TD><A HREF="${p}view/svc_forward.cgi?$svcnum">$svcnum</A></TD>
+ <TD>$src</TD>
+ <TD>$dst</TD>
+ </TR>
+END
-my $link_src = sub {
- my $svc_forward = shift;
- if ( $svc_forward->srcsvc_acct ) {
- [ "${p}view/svc_acct.cgi?", 'srcsvc' ];
- } else {
- '';
}
-};
+
+ print <<END;
+ </TABLE>
+ </BODY>
+</HTML>
+END
-my $format_dst = sub {
- my $svc_forward = shift;
- if ( $svc_forward->dstsvc_acct ) {
- $svc_forward->dstsvc_acct->email;
- } else {
- $svc_forward->dst;
- }
-};
-
-my $link_dst = sub {
- my $svc_forward = shift;
- if ( $svc_forward->dstsvc_acct ) {
- [ "${p}view/svc_acct.cgi?", 'dstsvc' ];
- } else {
- '';
- }
-};
+}
-#smaller false laziness w/svc_*.cgi here
-my $link_cust = sub {
- my $svc_x = shift;
- $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';
-};
+sub svcnum_sort {
+ $a->getfield('svcnum') <=> $b->getfield('svcnum');
+}
-%><%= include( 'elements/search.html',
- 'title' => "Mail forward Search Results",
- 'name' => 'mail forwards',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'redirect' => $link,
- 'header' => [ '#',
- 'Mail to',
- 'Forwards to',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [ 'svcnum',
- $format_src,
- $format_dst,
- \&FS::UI::Web::cust_fields,
- ],
- 'links' => [ $link,
- $link_src,
- $link_dst,
- ( map { $link_cust }
- FS::UI::Web::cust_header()
- ),
- ],
- )
%>
diff --git a/httemplate/search/svc_www.cgi b/httemplate/search/svc_www.cgi
index ae51c61fc..1f05c2377 100755
--- a/httemplate/search/svc_www.cgi
+++ b/httemplate/search/svc_www.cgi
@@ -4,7 +4,7 @@
my($query)=$cgi->keywords;
$query ||= ''; #to avoid use of unitialized value errors
-my $orderby;
+my(@svc_www, $orderby);
if ( $query eq 'svcnum' ) {
$orderby = 'ORDER BY svcnum';
} else {
@@ -15,55 +15,28 @@ my $count_query = 'SELECT COUNT(*) FROM svc_www';
my $sql_query = {
'table' => 'svc_www',
'hashref' => {},
- 'select' => join(', ',
- 'svc_www.*',
- 'cust_main.custnum',
- FS::UI::Web::cust_sql_fields(),
- ),
'extra_sql' => $orderby,
- 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum )'.
- 'LEFT JOIN cust_pkg USING ( pkgnum )'.
- 'LEFT JOIN cust_main USING ( custnum )',
};
my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ];
#my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ];
my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ];
-#smaller false laziness w/svc_*.cgi here
-my $link_cust = sub {
- my $svc_x = shift;
- $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';
-};
-%><%= include( 'elements/search.html',
- 'title' => 'Virtual Host Search Results',
- 'name' => 'virtual hosts',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'redirect' => $link,
- 'header' => [ '#',
- 'Zone',
- 'User',
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [ 'svcnum',
- sub { $_[0]->domain_record->zone },
- sub {
- my $svc_www = shift;
- my $svc_acct = $svc_www->svc_acct;
- $svc_acct
- ? $svc_acct->email
- : '';
- },
- \&FS::UI::Web::cust_fields,
- ],
- 'links' => [ $link,
- '',
- $ulink,
- ( map { $link_cust }
- FS::UI::Web::cust_header()
- ),
- ],
- )
+%>
+<%= include( 'elements/search.html',
+ 'title' => 'Virtual Host Search Results',
+ 'name' => 'virtual hosts',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'header' => [ '#', 'Zone', 'User', ],
+ 'fields' => [ 'svcnum',
+ sub { $_[0]->domain_record->zone },
+ sub { $_[0]->svc_acct->email },
+ ],
+ 'links' => [ $link,
+ '',
+ $ulink,
+ ],
+ )
%>
diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi
deleted file mode 100755
index 235485f6b..000000000
--- a/httemplate/view/cust_bill-logo.cgi
+++ /dev/null
@@ -1,15 +0,0 @@
-<%
-
-my $conf = new FS::Conf;
-
-my($query) = $cgi->keywords;
-$query =~ /^([^\.\/]*)$/;
-my $templatename = $1;
-if ( $templatename && $conf->exists("logo_$templatename.png") ) {
- $templatename = "_$templatename";
-} else {
- $templatename = '';
-}
-
-http_header('Content-Type' => 'image/png' );
-%><%= $conf->config_binary("logo$templatename.png") %>
diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi
index ce7ab0c5c..a72a60551 100755
--- a/httemplate/view/cust_bill-pdf.cgi
+++ b/httemplate/view/cust_bill-pdf.cgi
@@ -14,4 +14,5 @@ my $pdf = $cust_bill->print_pdf( '', $templatename);
http_header('Content-Type' => 'application/pdf' );
http_header('Content-Length' => length($pdf) );
http_header('Cache-control' => 'max-age=60' );
-%><%= $pdf %>
+%>
+<%= $pdf %>
diff --git a/httemplate/view/cust_bill-ps.cgi b/httemplate/view/cust_bill-ps.cgi
index e730a822a..8485a150f 100755
--- a/httemplate/view/cust_bill-ps.cgi
+++ b/httemplate/view/cust_bill-ps.cgi
@@ -10,4 +10,5 @@ my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
die "Invoice #$invnum not found!" unless $cust_bill;
http_header('Content-Type' => 'application/postscript' );
-%><%= $cust_bill->print_ps( '', $templatename) %>
+%>
+<%= $cust_bill->print_ps( '', $templatename) %>
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 56c0c1736..ca0612d09 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
#untaint invnum
@@ -6,146 +7,76 @@ $query =~ /^((.+)-)?(\d+)$/;
my $templatename = $2;
my $invnum = $3;
-my $conf = new FS::Conf;
-
-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;
-my %payby = map { $_=>1 } @payby;
-
my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
die "Invoice #$invnum not found!" unless $cust_bill;
my $custnum = $cust_bill->getfield('custnum');
#my $printed = $cust_bill->printed;
-my $link = $templatename ? "$templatename-$invnum" : $invnum;
-
-%>
-<%= header('Invoice View', menubar(
+print header('Invoice View', menubar(
"Main Menu" => $p,
"View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
-)) %>
+));
-<% if ( $cust_bill->owed > 0
- && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} || $payby{'MCRD'} )
- )
- {
- my $s = 0;
-%>
+print qq!<A HREF="${p}edit/cust_pay.cgi?$invnum">Enter payments (check/cash) against this invoice</A> | !
+ if $cust_bill->owed > 0;
- Post
+print qq!<A HREF="${p}misc/print-invoice.cgi?$invnum">Reprint this invoice</A>!;
+if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) {
+ print qq! | <A HREF="${p}misc/email-invoice.cgi?$invnum">!.
+ qq!Re-email this invoice</A>!;
+}
- <% if ( $payby{'BILL'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=BILL;invnum=<%= $invnum %>">check</A>
-
- <% } %>
-
- <% if ( $payby{'CASH'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=CASH;invnum=<%= $invnum %>">cash</A>
-
- <% } %>
-
- <% if ( $payby{'WEST'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=WEST;invnum=<%= $invnum %>">Western Union</A>
-
- <% } %>
-
- <% if ( $payby{'MCRD'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<%= $invnum %>">manual credit card</A>
-
- <% } %>
-
- payment against this invoice<BR>
-
-<% } %>
-
-<A HREF="<%= $p %>misc/print-invoice.cgi?<%= $link %>">Re-print this invoice</A>
-
-<% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { %>
- | <A HREF="<%= $p %>misc/email-invoice.cgi?<%= $link %>">Re-email
- this invoice</A>
-<% } %>
-
-<% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { %>
- | <A HREF="<%= $p %>misc/fax-invoice.cgi?<%= $link %>">Re-fax
- this invoice</A>
-<% } %>
-
-<BR><BR>
-
-<% if ( $conf->exists('invoice_latex') ) { %>
- <A HREF="<%= $p %>view/cust_bill-pdf.cgi?<%= $link %>.pdf">View typeset invoice</A>
- <BR><BR>
-<% } %>
-
-<% #false laziness with search/cust_bill_event.cgi
- unless ( $templatename ) { %>
-
- <%= table() %>
- <TR>
- <TH>Event</TH>
- <TH>Date</TH>
- <TH>Status</TH>
- </TR>
-
- <% foreach my $cust_bill_event (
- sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
- ) {
+print '<BR><BR>';
+my $conf = new FS::Conf;
+if ( $conf->exists('invoice_latex') ) {
+ my $link = "${p}view/cust_bill-pdf.cgi?";
+ $link .= "$templatename-" if $templatename;
+ $link .= "$invnum.pdf";
+ print menubar(
+ 'View typeset invoice' => $link,
+ ), '<BR><BR>';
+}
+
+#false laziness with search/cust_bill_event.cgi
+
+unless ( $templatename ) {
+ print table(). '<TR><TH>Event</TH><TH>Date</TH><TH>Status</TH></TR>';
+ foreach my $cust_bill_event (
+ sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
+ ) {
my $status = $cust_bill_event->status;
$status .= ': '. encode_entities($cust_bill_event->statustext)
if $cust_bill_event->statustext;
my $part_bill_event = $cust_bill_event->part_bill_event;
- %>
- <TR>
- <TD><%= $part_bill_event->event %>
+ print '<TR><TD>'. $part_bill_event->event;
- <% if ( $part_bill_event->templatename ) {
- my $alt_templatename = $part_bill_event->templatename;
- my $alt_link = "$alt_templatename-$invnum";
- %>
- ( <A HREF="<%= $p %>view/cust_bill.cgi?<%= $alt_link %>">view</A>
- | <A HREF="<%= $p %>view/cust_bill-pdf.cgi?<%= $alt_link %>.pdf">view
- typeset</A>
- | <A HREF="<%= $p %>misc/print-invoice.cgi?<%= $alt_link %>">re-print</A>
- <% if ( grep { $_ ne 'POST' }
- $cust_bill->cust_main->invoicing_list ) { %>
- | <A HREF="<%= $p %>misc/email-invoice.cgi?<%= $alt_link %>">re-email</A>
- <% } %>
-
- <% if ( $conf->exists('hylafax')
- && length($cust_bill->cust_main->fax) ) { %>
- | <A HREF="<%= $p %>misc/fax-invoice.cgi?<%= $alt_link %>">re-fax</A>
- <% } %>
-
- )
- <% } %>
+ if (
+ $part_bill_event->plan eq 'send_alternate'
+ && $part_bill_event->plandata =~ /^templatename (.*)$/m
+ ) {
+ my $templatename = $1;
+ print qq! ( <A HREF="${p}view/cust_bill.cgi?$templatename-$invnum">!.
+ 'view text</A> | '.
+ qq!<A HREF="${p}view/cust_bill-pdf.cgi?$templatename-$invnum.pdf">!.
+ 'view typeset</A> )';
+ }
- </TD>
- <TD><%= time2str("%a %b %e %T %Y", $cust_bill_event->_date) %></TD>
- <TD><%= $status %></TD>
- </TR>
- <% } %>
+ print '</TD><TD>'.
+ time2str("%a %b %e %T %Y", $cust_bill_event->_date). '</TD><TD>'.
+ $status. '</TD></TR>';
+ }
+ print '</TABLE><BR>';
+}
+
+print '<PRE>', $cust_bill->print_text('', $templatename);
+
+ #formatting
+ print <<END;
+ </PRE></FONT>
+ </BODY>
+</HTML>
+END
- </TABLE>
- <BR>
-
-<% } %>
-
-<% if ( $conf->exists('invoice_html') ) { %>
- <%= join('', $cust_bill->print_html('', $templatename) ) %>
-<% } else { %>
- <PRE><%= join('', $cust_bill->print_text('', $templatename) ) %></PRE>
-<% } %>
-
-</BODY></HTML>
+%>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 59c1a4b73..d5d77f2a5 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -16,6 +16,12 @@ foreach my $part_svc ( qsearch('part_svc',{}) ) {
'Main Menu' => $p,
)) %>
+<STYLE TYPE="text/css">
+.package TH { font-size: medium }
+.package TR { font-size: smaller }
+.package .provision { font-weight: bold }
+</STYLE>
+
<%
die "No customer specified (bad URL)!" unless $cgi->keywords;
@@ -29,43 +35,18 @@ print qq!<A HREF="${p}edit/cust_main.cgi?$custnum">Edit this customer</A>!;
%>
-<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">
+<SCRIPT>
function areyousure(href, message) {
- if (confirm(message) == true)
- window.location.href = href;
+ if (confirm(message) == true)
+ window.location.href = href;
}
</SCRIPT>
-<SCRIPT TYPE="text/javascript">
-
<%
-my $ban = '';
-if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
- $ban = '<BR><P ALIGN="center">'.
- '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\\\'s ';
- if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
- $ban .= 'credit card';
- } elsif ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
- $ban .= 'ACH account';
- }
-}
-%>
-
-var confirm_cancel = '<FORM METHOD="POST" ACTION="<%= $p %>misc/cust_main-cancel.cgi"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> <BR><P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B> <%= $ban%><BR><P ALIGN="CENTER"> <INPUT TYPE="submit" VALUE="Cancel customer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don\'t cancel" onClick="cClick()"> </FORM> ';
-
-</SCRIPT>
-
-<% if ( $cust_main->ncancelled_pkgs ) { %>
- | <A HREF="javascript:void(0);" onClick="overlib(confirm_cancel, CAPTION, 'Confirm cancellation', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' ); return false; ">Cancel this customer</A>
-
-<% } %>
-
-<%
+print qq! | <A HREF="javascript:areyousure('${p}misc/cust_main-cancel.cgi?$custnum', 'Perminantly delete all services and cancel this customer?')">!.
+ 'Cancel this customer</A>'
+ if $cust_main->ncancelled_pkgs;
print qq! | <A HREF="${p}misc/delete-customer.cgi?$custnum">!.
'Delete this customer</A>'
@@ -128,6 +109,13 @@ Comments
<% } %>
<BR><BR>
+<%= include('cust_main/order_pkg.html', $cust_main ) %>
+
+<% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
+ <%= include('cust_main/quick-charge.html', $cust_main ) %>
+ <BR>
+<% } %>
+
<%= include('cust_main/packages.html', $cust_main ) %>
<% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 5786a0711..18a203bd6 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -6,7 +6,22 @@
Billing information
(<A HREF="<%= $p %>misc/bill.cgi?<%= $cust_main->custnum %>">Bill now</A>)
<%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
-
+<TR>
+ <TD ALIGN="right">Tax&nbsp;exempt</TD>
+ <TD BGCOLOR="#ffffff"><%= $cust_main->tax ? 'yes' : 'no' %></TD>
+</TR>
+<TR>
+ <TD ALIGN="right">Postal&nbsp;invoices</TD>
+ <TD BGCOLOR="#ffffff">
+ <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %>
+ </TD>
+</TR>
+<TR>
+ <TD ALIGN="right">Email&nbsp;invoices</TD>
+ <TD BGCOLOR="#ffffff">
+ <%= join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no' %>
+ </TD>
+</TR>
<TR>
<TD ALIGN="right">Billing&nbsp;type</TD>
<TD BGCOLOR="#ffffff">
@@ -20,37 +35,10 @@ Billing information
<TD ALIGN="right">Card number</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->payinfo_masked %></TD>
</TR>
-
-<%
-#false laziness w/elements/select-month_year.html & edit/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 {
- warn "unrecognized expiration date format: $date";
- ( $mon, $year ) = ( '', '' );
-}
-%>
<TR>
<TD ALIGN="right">Expiration</TD>
- <TD BGCOLOR="#ffffff"><%= "$mon/$year" %></TD>
-</TR>
-
-<% if ( $cust_main->paystart_month ) { %>
- <TR>
- <TD ALIGN="right">Start date</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->paystart_month. '/'. $cust_main->paystart_year %>
- </TR>
-<% } elsif ( $cust_main->payissue ) { %>
- <TR>
- <TD ALIGN="right">Issue #</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->payissue %>
- </TR>
-<% } %>
-
+ <TD BGCOLOR="#ffffff"><%= $cust_main->paydate %></TD>
+</TR>
<TR>
<TD ALIGN="right">Name on card</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->payname %></TD>
@@ -69,7 +57,7 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
</TR>
<TR>
<TD ALIGN="right">Account number</TD>
- <TD BGCOLOR="#ffffff"><%= 'x'x(length($account)-2). substr($account,(length($account)-2)) %></TD>
+ <TD BGCOLOR="#ffffff"><%= $account %></TD>
</TR>
<TR>
<TD ALIGN="right">Bank name</TD>
@@ -103,6 +91,10 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
<% } %>
<TR>
+ <TD ALIGN="right">Expiration</TD>
+ <TD BGCOLOR="#ffffff"><%= $cust_main->paydate %></TD>
+</TR>
+<TR>
<TD ALIGN="right">Attention</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->payname %></TD>
</TR>
@@ -116,49 +108,12 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
<TD ALIGN="right">Authorized&nbsp;by</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->payinfo %></TD>
</TR>
-
-<%
-#false laziness w/above etc.
-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 {
- warn "unrecognized expiration date format: $date";
- ( $mon, $year ) = ( '', '' );
-}
-%>
<TR>
<TD ALIGN="right">Expiration</TD>
- <TD BGCOLOR="#ffffff"><%= "$mon/$year" %></TD>
+ <TD BGCOLOR="#ffffff"><%= $cust_main->paydate %></TD>
</TR>
<% } %>
-<TR>
- <TD ALIGN="right">Tax&nbsp;exempt</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->tax ? 'yes' : 'no' %></TD>
-</TR>
-<TR>
- <TD ALIGN="right">Postal&nbsp;invoices</TD>
- <TD BGCOLOR="#ffffff">
- <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %>
- </TD>
-</TR>
-<TR>
- <TD ALIGN="right">FAX&nbsp;invoices</TD>
- <TD BGCOLOR="#ffffff">
- <%= ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %>
- </TD>
-</TR>
-<TR>
- <TD ALIGN="right">Email&nbsp;invoices</TD>
- <TD BGCOLOR="#ffffff">
- <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
- </TD>
-</TR>
-
</TABLE></TD></TR></TABLE>
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index ece1b62bb..c5a0706d6 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -5,42 +5,8 @@
my $packages = get_packages($cust_main, $conf);
%>
-<STYLE TYPE="text/css">
-.package .provision { font-weight: bold }
-</STYLE>
-
-<A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A>
-
-<%= include('order_pkg.html', $cust_main ) %>
-
-<% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
- <%= include('quick-charge.html', $cust_main ) %>
-<% } %>
-
-<A HREF="<%= $p %>edit/cust_pkg.cgi?<%= $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
-<BR><BR>
-
-<% if ( @$packages ) { %>
-Current packages
-<% } %>
-
-<% if ( $cust_main->num_cancelled_pkgs ) {
- if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
- || ( $conf->exists('hidecancelledpackages')
- && ! $cgi->param('showcancelledpackages')
- )
- )
- {
- $cgi->param('showcancelledpackages', 1);
-%>
- ( <a href="<%= $cgi->self_url %>">show
-<% } else {
- $cgi->param('showcancelledpackages', 0);
-%>
- ( <a href="<%= $cgi->self_url %>">hide
-<% } %>
- cancelled packages</a> )
-<% } %>
+<A NAME="cust_pkg">Packages</A>
+( <A HREF="<%= $p %>edit/cust_pkg.cgi?<%= $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services) )
<% if ( @$packages ) { %>
@@ -75,10 +41,12 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
(&nbsp;<%=pkg_dates_link($pkg)%>&nbsp;|&nbsp;<%=pkg_customize_link($pkg,$cust_main->custnum)%>&nbsp;)
<% } %>
</TD>
- <TD ROWSPAN=<%=$rowspan%>>
- <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
-
<%
+ #foreach (qw(setup last_bill next_bill susp expire cancel)) {
+ # print qq! <TD ROWSPAN=$rowspan>! . pkg_datestr($pkg,$_,$conf) . qq!</TD>\n!;
+ #}
+ print "<TD ROWSPAN=$rowspan>". &itable('');
+
sub myfreq {
my $part_pkg = shift;
my $freq = $part_pkg->freq_pretty;
@@ -86,190 +54,92 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
$freq;
}
- #this should use cust_pkg->status and cust_pkg->statuscolor eventually
-
- my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4;
- my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%';
+ if ( $pkg->{cancel} ) { #status: cancelled
+
+ print '<TR><TD><FONT COLOR="#ff0000"><B>Cancelled&nbsp;</B></FONT></TD>'.
+ '<TD>'. pkg_datestr($pkg,'cancel',$conf). '</TD></TR>';
+ unless ( $pkg->{setup} ) {
+ print '<TR><TD COLSPAN=2>Never billed</TD></TR>';
+ } else {
+ print "<TR><TD>Setup&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
+ print "<TR><TD>Last&nbsp;bill&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
+ if $pkg->{'last_bill'};
+ print "<TR><TD>Suspended&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'susp',$conf). '</TD></TR>'
+ if $pkg->{'susp'};
+ }
- #false laziness w/edit/REAL_cust_pkg.cgi
- my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until );
- unless ( $pkg->{'part_pkg'}->is_prepaid ) {
- $billed_or_prepaid = 'billed';
- $last_bill_or_renewed = 'Last&nbsp;bill';
- $next_bill_or_prepaid_until = 'Next&nbsp;bill';
} else {
- $billed_or_prepaid = 'prepaid';
- $last_bill_or_renewed = 'Renewed';
- $next_bill_or_prepaid_until = 'Prepaid&nbsp;until';
- }
-
-%>
-
-<% if ( $pkg->{cancel} ) { %> <!-- #status: cancelled -->
-
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right"><FONT COLOR="#ff0000"><B>Cancelled&nbsp;</B></FONT></TD>
- <%= pkg_datestr($pkg,'cancel',$conf) %>
- </TR>
-
- <% unless ( $pkg->{setup} ) { %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>Never billed</TD>
- </TR>
-
- <% } else { %>
-
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Setup&nbsp;</TD>
- <%= pkg_datestr($pkg, 'setup',$conf) %>
- </TR>
-
- <% if ( $pkg->{'last_bill'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right"><%= $last_bill_or_renewed %>&nbsp;</TD>
- <%= pkg_datestr($pkg, 'last_bill',$conf) %>
- </TR>
- <% } %>
-
- <% if ( $pkg->{'susp'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Suspended&nbsp;</TD>
- <%= pkg_datestr($pkg, 'susp',$conf) %>
- </TR>
- <% } %>
-
- <% } %>
-
-<% } else { %>
-
- <% if ( $pkg->{susp} ) { %> <!-- #status: suspended -->
-
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right"><FONT COLOR="#FF9900"><B>Suspended</B>&nbsp;</FONT></TD>
- <%= pkg_datestr($pkg,'susp',$conf) %>
- </TR>
-
- <% unless ( $pkg->{setup} ) { %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>Never billed</TD>
- </TR>
-
- <% } else { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Setup&nbsp;</TD>
- <%= pkg_datestr($pkg, 'setup',$conf) %>
- </TR>
-
- <% } %>
+ if ( $pkg->{susp} ) { #status: suspended
+ print '<TR><TD><FONT COLOR="#FF9900"><B>Suspended</B>&nbsp;</FONT></TD>'.
+ '<TD>'. pkg_datestr($pkg,'susp',$conf). '</TD></TR>';
+ unless ( $pkg->{setup} ) {
+ print '<TR><TD COLSPAN=2>Never billed</TD></TR>';
+ } else {
+ print "<TR><TD>Setup&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
+ }
+ print "<TR><TD>Last&nbsp;bill&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
+ if $pkg->{'last_bill'};
+ # next bill ??
+ print "<TR><TD>Expires&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'expire',$conf). '</TD></TR>'
+ if $pkg->{'expire'};
+ print '<TR><TD COLSPAN=2>(&nbsp;'. pkg_unsuspend_link($pkg).
+ '&nbsp;|&nbsp;'. pkg_cancel_link($pkg). '&nbsp;)</TD></TR>';
+
+ } else { #status: active
+
+ unless ( $pkg->{setup} ) { #not setup
+
+ print '<TR><TD COLSPAN=2>Not&nbsp;yet&nbsp;billed&nbsp;(';
+ unless ( $pkg->{freq} ) {
+ print 'one-time&nbsp;charge)</TD></TR>';
+ print '<TR><TD COLSPAN=2>(&nbsp;'. pkg_cancel_link($pkg).
+ '&nbsp;)</TD</TR>';
+ } else {
+ print 'billed&nbsp;'. myfreq($pkg->{part_pkg}). ')</TD></TR>';
+ }
+
+ } else { #setup
+
+ unless ( $pkg->{freq} ) {
+ print "<TR><TD COLSPAN=2>One-time&nbsp;charge</TD></TR>".
+ '<TR><TD>Billed&nbsp;</TD><TD>'.
+ pkg_datestr($pkg,'setup',$conf). '</TD></TR>';
+ } else {
+ print '<TR><TD COLSPAN=2><FONT COLOR="#00CC00"><B>Active</B></FONT>'.
+ ',&nbsp;billed&nbsp;'. myfreq($pkg->{part_pkg}). '</TD></TR>'.
+ '<TR><TD>Setup&nbsp;</TD><TD>'.
+ pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
+ }
+
+ }
+
+ print "<TR><TD>Last&nbsp;bill&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
+ if $pkg->{'last_bill'};
+ print "<TR><TD>Next&nbsp;bill&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'next_bill',$conf). '</TD></TR>'
+ if $pkg->{'next_bill'};
+ print "<TR><TD>Expires&nbsp;</TD><TD>".
+ pkg_datestr($pkg, 'expire',$conf). '</TD></TR>'
+ if $pkg->{'expire'};
+ if ( $pkg->{freq} ) {
+ print '<TR><TD COLSPAN=2>(&nbsp;'. pkg_suspend_link($pkg).
+ '&nbsp;|&nbsp;'. pkg_cancel_link($pkg). '&nbsp;)</TD></TR>';
+ }
- <% if ( $pkg->{'last_bill'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right"><%= $last_bill_or_renewed %>&nbsp;</TD>
- <%= pkg_datestr($pkg, 'last_bill',$conf) %>
- </TR>
- <% } %>
-
- <!-- # next bill ?? -->
-
- <% if ( $pkg->{'expire'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Expires&nbsp;</TD>
- <%= pkg_datestr($pkg, 'expire',$conf) %>
- </TR>
- <% } %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>(&nbsp;<%= pkg_unsuspend_link($pkg) %>&nbsp;|&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)</TD>
- </TR>
-
- <% } else { %> <!-- #status: active -->
-
- <% unless ( $pkg->{setup} ) { %> <!-- #not setup -->
-
- <% unless ( $pkg->{'freq'} ) { %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>Not&nbsp;yet&nbsp;billed&nbsp;(one-time&nbsp;charge)</TD>
- </TR>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>(&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)</TD>
- </TR>
-
- <% } else { %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>Not&nbsp;yet&nbsp;billed&nbsp;(<%= $billed_or_prepaid %>&nbsp;<%= myfreq($pkg->{part_pkg}) %>)</TD>
- </TR>
-
- <% } %>
-
- <% } else { %> <!-- #setup -->
-
- <% unless ( $pkg->{freq} ) { %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>>One-time&nbsp;charge</TD>
- </TR>
-
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Billed&nbsp;</TD>
- <%= pkg_datestr($pkg,'setup',$conf) %>
- </TR>
-
- <% } else { %>
-
- <TR>
- <TD COLSPAN=<%=$colspan%>><FONT COLOR="#00CC00"><B>Active</B></FONT>,&nbsp;<%= $billed_or_prepaid %>&nbsp;<%= myfreq($pkg->{part_pkg}) %></TD>
- </TR>
-
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Setup&nbsp;</TD>
- <%= pkg_datestr($pkg, 'setup',$conf) %>
- </TR>
-
- <% } %>
-
- <% } %>
-
- <% if ( $pkg->{'last_bill'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right"><%= $last_bill_or_renewed %>&nbsp;</TD>
- <%= pkg_datestr($pkg, 'last_bill',$conf) %>
- </TR>
- <% } %>
-
- <% if ( $pkg->{'next_bill'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right"><%= $next_bill_or_prepaid_until %>&nbsp;</TD>
- <%= pkg_datestr($pkg, 'next_bill',$conf) %>
- </TR>
- <% } %>
-
- <% if ( $pkg->{'expire'} ) { %>
- <TR>
- <TD WIDTH="<%=$width%>" ALIGN="right">Expires&nbsp;</TD>
- <%= pkg_datestr($pkg, 'expire',$conf) %>
- </TR>
- <% } %>
-
- <% if ( $pkg->{freq} ) { %>
- <TR>
- <TD COLSPAN=<%=$colspan%>>(&nbsp;<%= pkg_suspend_link($pkg) %>&nbsp;|&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)</TD>
- </TR>
- <% } %>
-
- <% } %>
+ }
-<% } %>
+ }
-</TABLE>
-</TD>
+ print "</TABLE></TD>\n";
-<%
if ($rowspan == 0) { print qq!</TR>\n!; next; }
my $cnt = 0;
@@ -289,14 +159,12 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
}
}
}
+print '</TABLE>';
+}
+
#end display packages
%>
-</TABLE>
-<% } else { %>
-<BR>
-<% } %>
-
<%
#subroutines
@@ -305,18 +173,12 @@ sub get_packages {
my $conf = shift;
my @packages = ();
- my $method;
- if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
- || ( $conf->exists('hidecancelledpackages')
- && ! $cgi->param('showcancelledpackages') )
- )
- {
- $method = 'ncancelled_pkgs';
- } else {
- $method = 'all_pkgs';
- }
- foreach my $cust_pkg ( $cust_main->$method() ) {
+ foreach my $cust_pkg (
+ $conf->exists('hidecancelledpackages')
+ ? $cust_main->ncancelled_pkgs
+ : $cust_main->all_pkgs
+ ) {
my $part_pkg = $cust_pkg->part_pkg;
@@ -442,15 +304,9 @@ sub pkgsort_pkgnum_cancel {
sub pkg_datestr {
my($pkg, $field, $conf) = @_ or return '';
return '&nbsp;' unless $pkg->{$field};
- my $format = '<TD align="left"><B>%b</B></TD>'.
- '<TD align="right"><B>&nbsp;%o,</B></TD>'.
- '<TD align="right"><B>&nbsp;%Y</B></TD>';
- #$format .= '&nbsp;<FONT SIZE=-3>%l:%M:%S%P&nbsp;%z</FONT>'
- $format .= '<TD ALIGN="right"><B>&nbsp;%l</TD>'.
- '<TD ALIGN="center"><B>:</B></TD>'.
- '<TD ALIGN="left"><B>%M</B></TD>'.
- '<TD ALIGN="left"><B>&nbsp;%P</B></TD>'
- if $conf->exists('cust_pkg-display_times');
+ my $format = $conf->exists('pkg_showtimes')
+ ? '<B>%D</B>&nbsp;<FONT SIZE=-3>%l:%M:%S%P&nbsp;%z</FONT>'
+ : '<B>%b&nbsp;%o,&nbsp;%Y</B>';
( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g;
$strip;
}
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index ec99b8c54..0f3a98702 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -1,63 +1,13 @@
<%
my( $cust_main ) = @_;
- my $custnum = $cust_main->custnum;
-
my $conf = new FS::Conf;
-
- 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;
- my %payby = map { $_=>1 } @payby;
-
- my $s = 0;
-
+ my $custnum = $cust_main->custnum;
%>
<BR><BR><A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
-
-<% if ( $payby{'BILL'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=BILL;custnum=<%= $custnum %>">Post check payment</A>
-
-<% } %>
-
-<% if ( $payby{'CASH'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=CASH;custnum=<%= $custnum %>">Post cash payment</A>
-
-<% } %>
-
-<% if ( $payby{'WEST'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=WEST;custnum=<%= $custnum %>">Post Western Union payment</A>
-
-<% } %>
-
-<% if ( $payby{'CARD'} || $payby{'DCRD'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>misc/payment.cgi?payby=CARD;custnum=<%= $custnum %>">Process credit card payment</A>
-
-<% } %>
-
-<% if ( $payby{'CHEK'} || $payby{'DCHK'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>misc/payment.cgi?payby=CHEK;custnum=<%= $custnum %>">Process electronic check (ACH) payment</A>
-
-<% } %>
-
-<% if ( $payby{'MCRD'} ) { %>
-
- <%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=MCRD;custnum=<%= $custnum %>">Post manual credit card payment</A>
-
-<% } %>
-
+<A HREF="<%= $p %>edit/cust_pay.cgi?custnum=<%= $custnum %>">Post cash/check payment</A>
+| <A HREF="<%= $p %>misc/payment.cgi?payby=CARD;custnum=<%= $custnum %>">Process credit card payment</A>
+| <A HREF="<%= $p %>misc/payment.cgi?payby=CHEK;custnum=<%= $custnum %>">Process electronic check (ACH) payment</A>
<BR><A HREF="<%= $p %>edit/cust_credit.cgi?<%= $custnum %>">Post credit</A>
<BR>
@@ -100,13 +50,8 @@ foreach my $cust_pay ($cust_main->cust_pay) {
my $target = "$payby$payinfo";
$payby =~ s/^BILL$/Check #/ if $payinfo;
$payby =~ s/^CHEK$/Electronic check /;
- $payby =~ s/^PREP$/Prepaid card /;
- $payby =~ s/^CARD$/Credit card #/;
- $payby =~ s/^COMP$/Complimentary by /;
- $payby =~ s/^CASH$/Cash/;
- $payby =~ s/^WEST$/Western Union/;
- $payby =~ s/^MCRD$/Manual credit card/;
$payby =~ s/^BILL$//;
+ $payby =~ s/^(CARD|COMP)$/$1 /;
my $info = $payby ? " ($payby$payinfo)" : '';
my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' );
@@ -172,14 +117,14 @@ foreach my $cust_pay ($cust_main->cust_pay) {
my $void = '';
if ( $cust_pay->closed !~ /^Y/i
- && ( $cust_pay->payby ne 'CARD' || $conf->exists('cc-void') )
+ && $cust_pay->payby ne 'CARD'
&& ( $cust_pay->payby ne 'CHEK' || $conf->exists('echeck-void') )
) {
$void = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/void-cust_pay.cgi?!. $cust_pay->paynum.
qq!', 'Are you sure you want to void this payment?')"!.
qq! TITLE="Void this payment from the database!.
- ( $cust_pay->payby =~ /^(CARD|CHEK)$/
+ ( $cust_pay->payby eq 'CHEK'
? ' (do not send anything to the payment gateway)'
: ''
). '"'.
@@ -229,24 +174,11 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) {
$payby =~ s/^(CARD|COMP)$/$1 /;
my $info = $payby ? " ($payby$payinfo)" : '';
- my $unvoid = '';
- if ( $cust_pay_void->closed !~ /^Y/i && $conf->exists('unvoid') ) {
- $unvoid = qq! (<A HREF="javascript:areyousure('!.
- qq!${p}misc/unvoid-cust_pay_void.cgi?!. $cust_pay_void->paynum.
- qq!', 'Are you sure you want to unvoid this payment?')"!.
- qq! TITLE="Unvoid this payment from the database!.
- ( $cust_pay_void->payby =~ /^(CARD|CHEK)$/
- ? ' (do not send anything to the payment gateway)'
- : ''
- ). '"'.
- qq!>unvoid</A>)!;
- }
-
push @history, {
'date' => $cust_pay_void->_date,
'desc' => "<DEL>Payment $info</DEL> <I>voided ".
time2str("%D", $cust_pay_void->void_date).
- " by ". $cust_pay_void->otaker. '</i>'. $unvoid,
+ " by ". $cust_pay_void->otaker. '</i>',
'void_payment' => $cust_pay_void->paid,
};
@@ -326,10 +258,7 @@ foreach my $cust_credit ($cust_main->cust_credit) {
push @history, {
'date' => $cust_credit->_date,
'desc' => $pre. "Credit$post by ". $cust_credit->otaker.
- ( $cust_credit->reason
- ? ' ('. $cust_credit->reason. ')'
- : ''
- ).
+ ' ('. $cust_credit->reason. ')'.
"$desc$apply$delete$unapply",
'credit' => $cust_credit->amount,
};
diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html
index 2fe3d5f3d..0b51586d1 100644
--- a/httemplate/view/cust_main/quick-charge.html
+++ b/httemplate/view/cust_main/quick-charge.html
@@ -1,18 +1,32 @@
<%
my( $cust_main ) = @_;
+ my $conf = new FS::Conf;
%>
<FORM ACTION="<%=$p%>edit/process/quick-charge.cgi" METHOD="POST">
-
<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $cust_main->custnum %>">
-
Description:<INPUT TYPE="text" NAME="pkg">
+&nbsp;Amount:<INPUT TYPE="text" NAME="amount" SIZE=6>
+&nbsp;<%
+
+ #false laziness w/ edit/part_pkg.cgi
+ if ( $conf->exists('enable_taxclasses') ) {
+ print '<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>';
+ } else {
+ print '<INPUT TYPE="hidden" NAME="taxclass" VALUE="">';
+ }
-Amount:<INPUT TYPE="text" NAME="amount" SIZE=6>
-
-<%= include('/elements/select-taxclass.html') %>
-
+%>
+
<INPUT TYPE="submit" VALUE="One-time charge">
-
</FORM>
diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html
index 72d68152a..d6ddfa64c 100644
--- a/httemplate/view/cust_main/tickets.html
+++ b/httemplate/view/cust_main/tickets.html
@@ -30,7 +30,7 @@
Highest priority tickets
(<A HREF="<%= FS::TicketSystem->href_customer_tickets($cust_main->custnum) %>">View all tickets for this customer</A>)
-(<A HREF="<%= FS::TicketSystem->href_new_ticket($cust_main, join(', ', grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list ) ) %>">New ticket for this customer</A>)
+(<A HREF="<%= FS::TicketSystem->href_new_ticket($cust_main->custnum, join(', ', grep { $_ ne 'POST' } $cust_main->invoicing_list ) ) %>">New ticket for this customer</A>)
<%= table() %>
<TR>
<TH>#</TH>
diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi
index a20149ae2..5f0e6bffc 100755
--- a/httemplate/view/cust_pkg.cgi
+++ b/httemplate/view/cust_pkg.cgi
@@ -104,9 +104,8 @@ unless ($cancel) {
#list of services this pkgpart includes
my $pkg_svc;
- my %pkg_svc;
- #foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) {
- foreach $pkg_svc ( $cust_pkg->part_pkg->pkg_svc ) {
+ my %pkg_svc = ();
+ foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) {
$pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity if $pkg_svc->quantity;
}
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index b42362d91..6ca9bf071 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -1,3 +1,4 @@
+<!-- mason kludge -->
<%
my $conf = new FS::Conf;
@@ -23,46 +24,41 @@ if ($pkgnum) {
my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
die "Unknown svcpart" unless $part_svc;
-my $svc = $part_svc->svc;
-die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum
- unless $svc_acct->domsvc;
-my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
-die 'Unknown domain (domsvc '. $svc_acct->domsvc.
- ' for svc_acct.svcnum '. $svc_acct->svcnum. ')'
- unless $svc_domain;
-my $domain = $svc_domain->domain;
+my $domain;
+if ( $svc_acct->domsvc ) {
+ my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
+ die "Unknown domain" unless $svc_domain;
+ $domain = $svc_domain->domain;
+} else {
+ die "No svc_domain.svcnum record for svc_acct.domsvc: ". $cust_svc->domsvc;
+}
%>
-<% if ( $custnum ) { %>
-
- <%= header("View $svc account", menubar(
- "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
- "Main menu" => $p,
- )) %>
-
- <%= include( '/elements/small_custview.html', $custnum, '', 1 ) %>
- <BR>
-
-<% } else { %>
+<SCRIPT>
+function areyousure(href) {
+ if (confirm("Permanently delete this account?") == true)
+ window.location.href = href;
+}
+</SCRIPT>
- <SCRIPT>
- function areyousure(href) {
- if (confirm("Permanently delete this account?") == true)
- window.location.href = href;
- }
- </SCRIPT>
-
- <%= header('Account View', menubar(
- "Cancel this (unaudited) account" =>
- "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')",
- "Main menu" => $p,
- )) %>
+<%= header('Account View', menubar(
+ ( ( $pkgnum || $custnum )
+ ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
+ )
+ : ( "Cancel this (unaudited) account" =>
+ "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )
+ ),
+ "Main menu" => $p,
+)) %>
-<% } %>
+<%
-<% if ( $part_svc->part_export_usage ) {
+#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) {
+if ( $part_svc->part_export('sqlradius')
+ || $part_svc->part_export('sqlradius_withdomain')
+) {
my $last_bill;
my %plandata;
@@ -155,178 +151,122 @@ function enable_change () {
}
%>
-Service #<B><%= $svcnum %></B>
-| <A HREF="<%=$p%>edit/svc_acct.cgi?<%=$svcnum%>">Edit this service</A>
+Service Information
+| <A HREF="<%=$p%>edit/svc_acct.cgi?<%=$svcnum%>">Edit this information</A>
<% if ( @part_svc ) { %>
| <SELECT NAME="svcpart" onChange="enable_change()">
<OPTION VALUE="">Change service</OPTION>
<OPTION VALUE="">--------------</OPTION>
- <% foreach my $opt_part_svc ( @part_svc ) { %>
- <OPTION VALUE="<%= $opt_part_svc->svcpart %>"><%= $opt_part_svc->svc %></OPTION>
+ <% foreach my $part_svc ( @part_svc ) { %>
+ <OPTION VALUE="<%= $part_svc->svcpart %>"><%= $part_svc->svc %></OPTION>
<% } %>
</SELECT>
<INPUT NAME="submit" TYPE="submit" VALUE="Change" disabled>
<% } %>
<%= &ntable("#cccccc") %><TR><TD><%= &ntable("#cccccc",2) %>
+<TR><TD ALIGN="right">Service number</TD>
+ <TD BGCOLOR="#ffffff"><%= $svcnum %></TD></TR>
+<TR><TD ALIGN="right">Service</TD>
+ <TD BGCOLOR="#ffffff"><%= $part_svc->svc %></TD></TR>
+<TR><TD ALIGN="right">Username</TD>
+ <TD BGCOLOR="#ffffff"><%= $svc_acct->username %></TD></TR>
+<TR><TD ALIGN="right">Domain</TD>
+ <TD BGCOLOR="#ffffff"><%= $domain %></TD></TR>
+
+<TR><TD ALIGN="right">Password</TD>
+ <TD BGCOLOR="#ffffff"><%
+
+my $password = $svc_acct->_password;
+if ( $password =~ /^\*\w+\* (.*)$/ ) {
+ $password = $1;
+ print "<I>(login disabled)</I> ";
+}
+if ( $conf->exists('showpasswords') ) {
+ print '<PRE>'. encode_entities($password). '</PRE>';
+} else {
+ print "<I>(hidden)</I>";
+}
+print "</TR></TD>";
+$password = '';
-<TR>
- <TD ALIGN="right">Service</TD>
- <TD BGCOLOR="#ffffff"><%= $part_svc->svc %></TD>
-</TR>
-<TR>
- <TD ALIGN="right">Username</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->username %></TD>
-</TR>
-<TR>
- <TD ALIGN="right">Domain</TD>
- <TD BGCOLOR="#ffffff"><%= $domain %></TD>
-</TR>
-
-<TR>
- <TD ALIGN="right">Password</TD>
- <TD BGCOLOR="#ffffff">
-
- <% my $password = $svc_acct->_password; %>
- <% if ( $password =~ /^\*\w+\* (.*)$/ ) {
- $password = $1;
- %>
- <I>(login disabled)</I>
- <% } %>
-
- <% if ( $conf->exists('showpasswords') ) { %>
- <PRE><%= encode_entities($password) %></PRE>
- <% } else { %>
- <I>(hidden)</I>
- <% } %>
-
- </TD>
-</TR>
-<% $password = ''; %>
-
-<% if ( $conf->exists('security_phrase') ) {
- my $sec_phrase = $svc_acct->sec_phrase;
-%>
- <TR>
- <TD ALIGN="right">Security phrase</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->sec_phrase %></TD>
- </TR>
-<% } %>
-
-<% if ( $svc_acct->popnum ) {
- my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
-%>
- <TR>
- <TD ALIGN="right">Access number</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct_pop->text %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->uid ne '') { %>
- <TR>
- <TD ALIGN="right">UID</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->uid %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->gid ne '') { %>
- <TR>
- <TD ALIGN="right">GID</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->gid %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->finger ne '') { %>
- <TR>
- <TD ALIGN="right">GECOS</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->finger %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->dir ne '') { %>
- <TR>
- <TD ALIGN="right">Home directory</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->dir %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->shell ne '') { %>
- <TR>
- <TD ALIGN="right">Shell</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->shell %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->quota ne '') { %>
- <TR>
- <TD ALIGN="right">Quota</TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->quota %></TD>
- </TR>
-<% } %>
-
-<% if ($svc_acct->slipip) { %>
- <TR>
- <TD ALIGN="right">IP address</TD>
- <TD BGCOLOR="#ffffff">
- <%= ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
- ? "<I>(Dynamic)</I>"
- : $svc_acct->slipip
- %>
- </TD>
- </TR>
-<% } %>
-
-<% foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) {
- $attribute =~ /^radius_(.*)$/;
- my $pattribute = $FS::raddb::attrib{$1};
-%>
- <TR>
- <TD ALIGN="right">Radius (reply) <%= $pattribute %></TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->getfield($attribute) %></TD>
- </TR>
-<% } %>
+if ( $conf->exists('security_phrase') ) {
+ my $sec_phrase = $svc_acct->sec_phrase;
+ print '<TR><TD ALIGN="right">Security phrase</TD><TD BGCOLOR="#ffffff">'.
+ $svc_acct->sec_phrase. '</TD></TR>';
+}
-<% foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) {
- $attribute =~ /^rc_(.*)$/;
- my $pattribute = $FS::raddb::attrib{$1};
-%>
- <TR>
- <TD ALIGN="right">Radius (check) <%= $pattribute %></TD>
- <TD BGCOLOR="#ffffff"><%= $svc_acct->getfield($attribute) %></TD>
- </TR>
-<% } %>
+my $svc_acct_pop = $svc_acct->popnum
+ ? qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum})
+ : '';
+print "<TR><TD ALIGN=\"right\">Access number</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct_pop->text. '</TD></TR>'
+ if $svc_acct_pop;
+
+if ($svc_acct->uid ne '') {
+ print "<TR><TD ALIGN=\"right\">Uid</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->uid. "</TD></TR>",
+ "<TR><TD ALIGN=\"right\">Gid</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->gid. "</TD></TR>",
+ "<TR><TD ALIGN=\"right\">GECOS</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->finger. "</TD></TR>",
+ "<TR><TD ALIGN=\"right\">Home directory</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->dir. "</TD></TR>",
+ "<TR><TD ALIGN=\"right\">Shell</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->shell. "</TD></TR>",
+ "<TR><TD ALIGN=\"right\">Quota</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->quota. "</TD></TR>"
+ ;
+} else {
+ print "<TR><TH COLSPAN=2>(No shell account)</TH></TR>";
+}
-<TR>
- <TD ALIGN="right">RADIUS groups</TD>
- <TD BGCOLOR="#ffffff"><%= join('<BR>', $svc_acct->radius_groups) %></TD>
-</TR>
+if ($svc_acct->slipip) {
+ print "<TR><TD ALIGN=\"right\">IP address</TD><TD BGCOLOR=\"#ffffff\">".
+ ( ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
+ ? "<I>(Dynamic)</I>"
+ : $svc_acct->slipip
+ ). "</TD>";
+ my($attribute);
+ foreach $attribute ( grep /^radius_/, $svc_acct->fields ) {
+ #warn $attribute;
+ $attribute =~ /^radius_(.*)$/;
+ my $pattribute = $FS::raddb::attrib{$1};
+ print "<TR><TD ALIGN=\"right\">Radius (reply) $pattribute</TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->getfield($attribute).
+ "</TD></TR>";
+ }
+ foreach $attribute ( grep /^rc_/, $svc_acct->fields ) {
+ #warn $attribute;
+ $attribute =~ /^rc_(.*)$/;
+ my $pattribute = $FS::raddb::attrib{$1};
+ print "<TR><TD ALIGN=\"right\">Radius (check) $pattribute: </TD>".
+ "<TD BGCOLOR=\"#ffffff\">". $svc_acct->getfield($attribute).
+ "</TD></TR>";
+ }
+} else {
+ print "<TR><TH COLSPAN=2>(No SLIP/PPP account)</TH></TR>";
+}
-<% if ( $svc_acct->seconds =~ /^\d+$/ ) { %>
- <TR>
- <TD ALIGN="right">Prepaid time</TD>
- <TD BGCOLOR="#ffffff"><%= duration_exact($svc_acct->seconds) %></TD>
- </TR>
-<% } %>
+print '<TR><TD ALIGN="right">RADIUS groups</TD><TD BGCOLOR="#ffffff">'.
+ join('<BR>', $svc_acct->radius_groups). '</TD></TR>';
-<%
# Can this be abstracted further? Maybe a library function like
# widget('HTML', 'view', $svc_acct) ? It would definitely make UI
# style management easier.
-%>
-
-<% foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { %>
- <%= $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %>
-<% } %>
-</TABLE></TD></TR></TABLE>
-</FORM>
-<BR><BR>
+foreach (sort { $a cmp $b } $svc_acct->virtual_fields) {
+ print $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)),
+ "\n";
+}
+%>
+</TABLE></TD></TR></TABLE></FORM>
+<%
-<%= join("<BR>", $conf->config('svc_acct-notes') ) %>
-<BR><BR>
+print '<BR><BR>';
-<%= joblisting({'svcnum'=>$svcnum}, 1) %>
+print join("\n", $conf->config('svc_acct-notes') ). '<BR><BR>'.
+ joblisting({'svcnum'=>$svcnum}, 1). '</BODY></HTML>';
-</BODY>
-</HTML>
+%>
diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi
index 428f3e9bf..cd9f79d36 100755
--- a/httemplate/view/svc_domain.cgi
+++ b/httemplate/view/svc_domain.cgi
@@ -36,8 +36,8 @@ my $domain = $svc_domain->domain;
( ( $pkgnum || $custnum )
? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
)
- : ( "Delete this (unaudited) domain" =>
- "javascript:areyousure('${p}misc/cancel-unaudited.cgi?$svcnum', 'Delete $domain and all records?' )" )
+ : ( "Cancel this (unaudited) domain" =>
+ "${p}misc/cancel-unaudited.cgi?$svcnum" )
),
"Main menu" => $p,
)) %>
@@ -50,8 +50,8 @@ Service #<%= $svcnum %>
<BR><BR><A HREF="<%= ${p} %>misc/whois.cgi?custnum=<%=$custnum%>;svcnum=<%=$svcnum%>;domain=<%=$domain%>">View whois information.</A>
<BR><BR>
<SCRIPT>
- function areyousure(href, message) {
- if ( confirm(message) == true )
+ function areyousure(href) {
+ if ( confirm("Remove this record?") == true )
window.location.href = href;
}
function slave_areyousure() {
@@ -74,7 +74,7 @@ Service #<%= $svcnum %>
<td><%= $domain_record->recdata %>
<% unless ( $domain_record->rectype eq 'SOA' ) { %>
- (<A HREF="javascript:areyousure('<%=$p%>misc/delete-domain_record.cgi?<%=$domain_record->recnum%>', 'Delete \'<%= $domain_record->reczone %> <%= $type %> <%= $domain_record->recdata %>\' ?' )">delete</A>)
+ (<A HREF="javascript:areyousure('<%=$p%>misc/delete-domain_record.cgi?<%=$domain_record->recnum%>')">delete</A>)
<% } %>
</td></tr>
<% } %>
@@ -87,7 +87,7 @@ Service #<%= $svcnum %>
<INPUT TYPE="text" NAME="reczone">
<INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN
<SELECT NAME="rectype">
-<% foreach (qw( A NS CNAME MX PTR TXT) ) { %>
+<% foreach (qw( A NS CNAME MX PTR) ) { %>
<OPTION VALUE="<%=$_%>"><%=$_%></OPTION>
<% } %>
</SELECT>
diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi
index 6c8cd6a0b..2980f846b 100644
--- a/httemplate/view/svc_www.cgi
+++ b/httemplate/view/svc_www.cgi
@@ -21,13 +21,9 @@ if ($pkgnum) {
#eofalse
my $usersvc = $svc_www->usersvc;
-my $svc_acct = '';
-my $email = '';
-if ( $usersvc ) {
- $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } )
- or die "svc_www: Unknown usersvc $usersvc";
- $email = $svc_acct->email;
-}
+my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } )
+ or die "svc_www: Unknown usersvc $usersvc";
+my $email = $svc_acct->email;
my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } )
or die "svc_www: Unknown recnum ". $svc_www->recnum;
@@ -50,15 +46,7 @@ print header('Website View', menubar(
qq!<TR><TD ALIGN="right">Website name</TD>!.
qq!<TD BGCOLOR="#ffffff"><A HREF="http://$www">$www<A></TD></TR>!.
qq!<TR><TD ALIGN="right">Account</TD>!.
- qq!<TD BGCOLOR="#ffffff">!;
-
-if ( $usersvc ) {
- print qq!<A HREF="${p}view/svc_acct.cgi?$usersvc">$email</A>!;
-} else {
- print '</i>(none)</i>';
-}
-
-print '</TD></TR>';
+ qq!<TD BGCOLOR="#ffffff"><A HREF="${p}view/svc_acct.cgi?$usersvc">$email</A></TD></TR>!;
foreach (sort { $a cmp $b } $svc_www->virtual_fields) {
print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)),