[Astpp-commit] SF.net SVN: astpp:[2318] trunk
Brought to you by:
darrenkw
From: <dar...@us...> - 2010-09-13 23:25:13
|
Revision: 2318 http://astpp.svn.sourceforge.net/astpp/?rev=2318&view=rev Author: darrenkw Date: 2010-09-13 23:25:06 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Added support to view callingcard cdrs from the interface. Modified Paths: -------------- trunk/web_interface/astpp-admin.cgi Added Paths: ----------- trunk/templates/callingcards-cdrs.tpl Added: trunk/templates/callingcards-cdrs.tpl =================================================================== --- trunk/templates/callingcards-cdrs.tpl (rev 0) +++ trunk/templates/callingcards-cdrs.tpl 2010-09-13 23:25:06 UTC (rev 2318) @@ -0,0 +1,43 @@ +<table class="viewcdrs"> + <tr> + <td colspan=7><form method="post" action="/cgi-bin/astpp-admin/astpp-admin.cgi?mode=List%20Errors" enctype="multipart/form-data"></td> + </tr> + <tr class="header"> + <td>Card Number</td> + <td>UniqueID</td> + <td>Date</td> + <td>CallerID</td> + <td>Dest</td> + <td>BillSec</td> + <td>Disposition</td> + <td>Debit</td> + <td>Credit</td> + <td>Notes</td> + <td>Pricelist</td> + <td>Pattern</td> + </tr> + <TMPL_LOOP NAME="cdrlist"> + <tr class="<TMPL_VAR NAME="class">"> + <td><TMPL_VAR NAME="cardnumber"></td> + <td><TMPL_VAR NAME="uniqueid"></td> + <td><TMPL_VAR NAME="callstart"></td> + <td><TMPL_VAR NAME="clid"></td> + <td><TMPL_VAR NAME="destination"></td> + <td><TMPL_VAR NAME="seconds"></td> + <td><TMPL_VAR NAME="disposition"></td> + <td><TMPL_VAR NAME="debit"></td> + <td><TMPL_VAR NAME="credit"></td> + <td><TMPL_VAR NAME="notes"></td> + <td><TMPL_VAR NAME="pricelist"></td> + <td><TMPL_VAR NAME="pattern"></td> + </tr> + </TMPL_LOOP> +</table> + +<table> + <tr> + <td><TMPL_VAR NAME="pagination"></td> + <td><TMPL_VAR NAME="status"></td> + </tr> + </table> +</form> Modified: trunk/web_interface/astpp-admin.cgi =================================================================== --- trunk/web_interface/astpp-admin.cgi 2010-09-13 04:14:22 UTC (rev 2317) +++ trunk/web_interface/astpp-admin.cgi 2010-09-13 23:25:06 UTC (rev 2318) @@ -99,7 +99,8 @@ gettext("List Cards"), gettext("Add Cards"), gettext("Delete Card"), gettext("Refill Card"), gettext("View Card"), gettext("Update Card(s) Status"), - gettext("Reset InUse"), gettext("CC Brands") + gettext("Reset InUse"), gettext("CC Brands"), + gettext("Callingcard CDRs") ); my @SwitchConfig = (); my @CallShops = ( gettext("Create CallShop"), gettext("Remove CallShop") ); @@ -445,6 +446,8 @@ return &build_view_card() if $params->{mode} eq gettext("View Card"); return &build_cc_brands() if $params->{mode} eq gettext("CC Brands"); + return &build_callingcard_cdrs() + if $params->{mode} eq gettext("Callingcard CDRs"); return &build_delete_cards() if $params->{mode} eq gettext("Delete Card"); return &build_refill_card() @@ -464,6 +467,8 @@ return &build_periodic_charges() if $params->{mode} eq gettext("Periodic Charges"); return &build_view_cdrs() if $params->{mode} eq gettext("View CDRs"); + return &build_view_cdrs_asterisk() if $params->{mode} eq gettext("View Asterisk(TM) CDRs"); + return &build_view_cdrs_freeswitch() if $params->{mode} eq gettext("View FreeSwitch(TM) CDRs"); return &build_configuration() if $params->{mode} eq gettext("Configuration"); return &build_view_invoice() @@ -488,6 +493,8 @@ if $params->{mode} eq gettext("Trunk Statistics"); return &logout() if $params->{mode} eq gettext("Logout"); return &build_view_cdrs() if $params->{mode} eq gettext("View CDRs"); + return &build_view_cdrs_asterisk() if $params->{mode} eq gettext("View Asterisk CDRs"); + return &build_view_cdrs_freeswitch() if $params->{mode} eq gettext("View FreeSwitch CDRs"); return &build_outbound_routes() if $params->{mode} eq gettext("Outbound Routes"); $params->{mode} = gettext("Home"); @@ -1356,6 +1363,15 @@ } #################### Stats stuff ########################### +sub build_view_cdrs_asterisk() { + return &build_view_cdrs(); +} + +sub build_view_cdrs_freeswitch() { + $config->{cdr_table} = $config->{freeswitch_cdr_table}; + return &build_view_cdrs(); +} + sub build_view_cdrs() { my ( @trunklist, $body, $id, $tmp, @@ -4082,7 +4098,52 @@ } ### End of Code from convergence.com.pk +sub build_callingcard_cdrs() { + my ( @cdrlist, $results, $body, $status, $count, $pageno, $pagesrequired ); + $count = 0; + my $template = HTML::Template->new( + filename => '/var/lib/astpp/templates/callingcards-cdrs.tpl', + die_on_bad_params => $config->{template_die_on_bad_params} + ); + my $sql_select = +"SELECT * FROM callingcardcdrs ORDER BY callstart DESC"; + my $sql_count = +"SELECT COUNT(*) FROM callingcardcdrs"; + my ( $sql, $pagination ) = $ASTPP->pagination( + sql_select => $sql_select, + sql_count => $sql_count, + results_per_page => $config->{results_per_page}, + ve => $params->{ve}, + te => $params->{ee}, + db => $astpp_db, + mode => $params->{mode}, + ); + + $ASTPP->debug( user => $params->{username}, debug => $sql ); + $results = $astpp_db->prepare($sql); + $results->execute; + + while ( my $record = $results->fetchrow_hashref ) { + $ASTPP->debug( + user => $params->{username}, + debug => $record->{uniqueid} + ); + $count++; + if ( $count % 2 == 0 ) { + $record->{class} = "rowtwo"; + } + else { + $record->{class} = "rowone"; + } + push( @cdrlist, $record ); + } + $results->finish; + $template->param( cdrlist => \@cdrlist ); + $template->param( pagination => $pagination ); + return $template->output; +} + sub build_list_errors() { my ( @cdrlist, $results, $body, $status, $count, $pageno, $pagesrequired ); $cdr_db = &cdr_connect_db( $config, @output ); @@ -12062,9 +12123,15 @@ gettext("Asterisk(TM) SIP Devices"), gettext("Asterisk(TM) Dialplan") ); + push @Statistics,( + gettext("View Asterisk(TM) CDRs") + ); } if ( $config->{users_dids_freeswitch} == 1 ) { push @SwitchConfig, ( gettext("Freeswitch(TM) SIP Devices") ); + push @Statistics,( + gettext("View FreeSwitch(TM) CDRs") + ); } } if ( $config->{callingcards} == 1 ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |