[freeside-commits] freeside/httemplate/search svc_phone.cgi, NONE,
1.1 cdr.html, 1.2, 1.3 report_cdr.html, 1.2, 1.3
Ivan,,,
ivan at wavetail.420.am
Tue Jul 11 17:20:24 PDT 2006
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail:/tmp/cvs-serv17459/httemplate/search
Modified Files:
cdr.html report_cdr.html
Added Files:
svc_phone.cgi
Log Message:
svc_phone service and CDR billing from imported CDRs
Index: report_cdr.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cdr.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- report_cdr.html 20 Mar 2006 19:13:27 -0000 1.2
+++ report_cdr.html 12 Jul 2006 00:20:22 -0000 1.3
@@ -4,7 +4,7 @@
Status: <SELECT NAME="freesidestatus">
<OPTION VALUE="">(all)
<OPTION VALUE="NULL">unprocessed
- <OPTION VALUE="done"">processed
+ <OPTION VALUE="done">processed
</SELECT><BR>
<INPUT TYPE="submit" VALUE="Search Call Detail Records">
Index: cdr.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cdr.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cdr.html 20 Mar 2006 19:13:27 -0000 1.2
+++ cdr.html 12 Jul 2006 00:20:22 -0000 1.3
@@ -11,13 +11,15 @@
my $title = "Unprocessed $title";
$hashref->{'freesidestatus'} = ''; # Record.pm will take care of it
- $count_query .= " AND ( freesidestatus IS NULL OR freesidestatus = '' )";
+ #$count_query .= " AND ( freesidestatus IS NULL OR freesidestatus = '' )";
+ $count_query .= " WHERE ( freesidestatus IS NULL OR freesidestatus = '' )";
} elsif ( $cgi->param('freesidestatus') =~ /^([\w ]+)$/ ) {
my $title = "Processed $title";
$hashref->{'freesidestatus'} = $1;
- $count_query .= " AND freesidestatus = '$1'";
+ #$count_query .= " AND freesidestatus = '$1'";
+ $count_query .= " WHERE freesidestatus = '$1'";
}
--- NEW FILE: svc_phone.cgi ---
<%
my $conf = new FS::Conf;
my($query)=$cgi->keywords;
$query ||= ''; #to avoid use of unitialized value errors
my $orderby = 'ORDER BY svcnum';
my %svc_phone = ();
my @extra_sql = ();
if ( $query eq 'svcnum' ) {
#$orderby = 'ORDER BY svcnum';
} elsif ( $query eq 'phonenum' ) {
$orderby = 'ORDER BY phonenum';
} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
#$orderby = 'ORDER BY svcnum';
push @extra_sql, "svcpart = $1";
} else {
$cgi->param('phonenum') =~ /^([\d\- ]+)$/;
( $svc_phone{'phonenum'} = $1 ) =~ s/\D//g;
}
my $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 ) ';
#here is the agent virtualization
push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql;
my $extra_sql = '';
if ( @extra_sql ) {
$extra_sql = ( keys(%svc_phone) ? ' AND ' : ' WHERE ' ).
join(' AND ', @extra_sql );
}
my $count_query = "SELECT COUNT(*) FROM svc_phone $addl_from ";
if ( keys %svc_phone ) {
$count_query .= ' WHERE '.
join(' AND ', map "$_ = ". dbh->quote($svc_phone{$_}),
keys %svc_phone
);
}
$count_query .= $extra_sql;
my $sql_query = {
'table' => 'svc_phone',
'hashref' => \%svc_phone,
'select' => join(', ',
'svc_phone.*',
'part_svc.svc',
'cust_main.custnum',
FS::UI::Web::cust_sql_fields(),
),
'extra_sql' => "$extra_sql $orderby",
'addl_from' => $addl_from,
};
my $link = [ "${p}view/svc_phone.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' => "Phone number search results",
'name' => 'phone numbers',
'query' => $sql_query,
'count_query' => $count_query,
'redirect' => $link,
'header' => [ '#',
'Service',
'Country code',
'Phone number',
FS::UI::Web::cust_header(),
],
'fields' => [ 'svcnum',
'svc',
'countrycode',
'phonenum',
\&FS::UI::Web::cust_fields,
],
'links' => [ $link,
$link,
$link,
$link,
( map { $link_cust }
FS::UI::Web::cust_header()
),
],
)
%>
More information about the freeside-commits
mailing list