[freeside-commits] freeside/httemplate/search report_svc_acct.html, NONE, 1.1.2.1 svc_acct.cgi, 1.40.2.3, 1.40.2.4
Jeff Finucane,420,,
jeff at wavetail.420.am
Fri Dec 28 10:58:25 PST 2007
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail:/tmp/cvs-serv13699/httemplate/search
Modified Files:
Tag: FREESIDE_1_7_BRANCH
svc_acct.cgi
Added Files:
Tag: FREESIDE_1_7_BRANCH
report_svc_acct.html
Log Message:
advanced account reports (RT#2954)
Index: svc_acct.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_acct.cgi,v
retrieving revision 1.40.2.3
retrieving revision 1.40.2.4
diff -u -d -r1.40.2.3 -r1.40.2.4
--- svc_acct.cgi 28 Dec 2007 15:10:20 -0000 1.40.2.3
+++ svc_acct.cgi 28 Dec 2007 18:58:22 -0000 1.40.2.4
@@ -9,7 +9,9 @@
'Account',
'UID',
'Last Login',
- FS::UI::Web::cust_header(),
+ FS::UI::Web::cust_header(
+ $cgi->param('cust_fields')
+ ),
],
'fields' => [ 'svcnum',
'svc',
@@ -24,7 +26,9 @@
$link,
$link,
( map { $_ ne 'Cust. Status' ? $link_cust : '' }
- FS::UI::Web::cust_header()
+ FS::UI::Web::cust_header(
+ $cgi->param('cust_fields')
+ )
),
],
'align' => 'rlllr'. FS::UI::Web::cust_aligns(),
@@ -90,6 +94,42 @@
$orderby = "ORDER BY $sortby";
}
+} elsif ( $cgi->param('magic') =~ /^advanced$/ ) {
+ $orderby = "";
+
+ if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
+ push @extra_sql, "agentnum = $1";
+ }
+
+ my $pkgpart = join (' OR cust_pkg.pkgpart=',
+ grep {$_} map { /^(\d+)$/; } ($cgi->param('pkgpart')));
+ push @extra_sql, '(cust_pkg.pkgpart=' . $pkgpart . ')' if $pkgpart;
+
+ foreach my $field (qw( last_login last_logout )) {
+
+ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
+
+ next if $beginning == 0 && $ending == 4294967295;
+
+ if ($cgi->param($field."_invert")) {
+ push @extra_sql,
+ "(svc_acct.$field IS NULL OR ".
+ "svc_acct.$field < $beginning AND ".
+ "svc_acct.$field > $ending)";
+ } else {
+ push @extra_sql,
+ "svc_acct.$field IS NOT NULL",
+ "svc_acct.$field >= $beginning",
+ "svc_acct.$field <= $ending";
+ }
+
+ $orderby ||= "ORDER BY svc_acct.$field" .
+ ($cgi->param($field."_invert") ? ' DESC' : '');
+
+ }
+
+ $orderby ||= "ORDER BY svcnum";
+
} elsif ( $cgi->param('popnum') =~ /^(\d+)$/ ) {
push @extra_sql, "popnum = $1";
$orderby = "ORDER BY LOWER(username)";
--- NEW FILE: report_svc_acct.html ---
<% include('/elements/header.html', 'Account Report' ) %>
<FORM ACTION="svc_acct.cgi" METHOD="GET">
<INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
<TR>
<TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
</TR>
<% include( '/elements/tr-select-agent.html',
($cgi->param('agentnum') || ''),
)
%>
<SCRIPT type="text/javascript">
function toggle(what) {
label = document.getElementById (what + '_label');
field = document.getElementById ( what + '_invert');
if (field.value == 1) {
field.value = 0;
} else {
field.value = 1;
}
if (field.value == 1) {
label.firstChild.nodeValue = 'Did not ' + label.firstChild.nodeValue;
}else{
text = label.firstChild.nodeValue;
label.firstChild.nodeValue = text.replace(/Did not /, '');
}
}
</SCRIPT>
% foreach my $field (qw( last_login last_logout )) {
% my $invert = $field."_invert";
<TR>
<TD>
<TABLE>
<TR>
<TD ALIGN="right" VALIGN="center" ID="<% $field."_label" %>">
<% $label{$field} %>
</TD>
<TD>
<INPUT NAME="<% $invert %>" ID="<% $invert %>" TYPE="hidden">
<A HREF="javascript:void(0)" onClick="toggle('<% $field %>'); return false;">Invert</A>
</TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE>
<% include( '/elements/tr-input-beginning_ending.html',
prefix => $field,
layout => 'horiz',
)
%>
</TABLE>
</TD>
</TR>
% }
<% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
<TR>
<TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
</TR>
<% include( '/elements/tr-select-cust-fields.html' ) %>
</TABLE>
<BR>
<INPUT TYPE="submit" VALUE="Get Report">
</FORM>
<% include('/elements/footer.html') %>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('List packages');
</%init>
<%once>
my %label = (
'last_login' => 'Last login',
'last_logout' => 'Last logout',
);
</%once>
More information about the freeside-commits
mailing list