freeside/httemplate/edit rate.cgi,NONE,1.1 rate_region.cgi,NONE,1.1 part_pkg.cgi,1.47,1.48
ivan
ivan at pouncequick.420.am
Sat Nov 20 09:26:58 PST 2004
- Previous message: freeside/FS/t rate.t,NONE,1.1 rate_detail.t,NONE,1.1 rate_region.t,NONE,1.1 rate_prefix.t,NONE,1.1 part_pkg-voip_sqlradacct.t,NONE,1.1
- Next message: freeside/FS/FS/part_pkg voip_sqlradacct.pm,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory pouncequick:/tmp/cvs-serv3612/httemplate/edit
Modified Files:
part_pkg.cgi
Added Files:
rate.cgi rate_region.cgi
Log Message:
first pass at VoIP rating
--- NEW FILE: rate.cgi ---
<!-- mason kludge -->
<%
my $rate;
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 } );
} else { #adding
$rate = new FS::rate {};
}
my $action = $rate->ratenum ? 'Edit' : 'Add';
my $p1 = popurl(1);
my %granularity = (
'6' => '6 second',
'60' => 'minute',
);
%>
<%= header("$action Rate plan", menubar(
'Main Menu' => $p,
'View all rate plans' => "${p}browse/rate.cgi",
))
%>
<% 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
<INPUT TYPE="text" NAME="ratename" SIZE=32 VALUE="<%= $rate->ratename %>">
<BR><BR>
<%= table() %>
<TR>
<TH>Region</TH>
<TH>Prefix(es)</TH>
<TH><FONT SIZE=-1>Included<BR>minutes</FONT></TH>
<TH><FONT SIZE=-1>Charge per<BR>minute</FONT></TH>
<TH><FONT SIZE=-1>Granularity</FONT></TH>
</TR>
<% foreach my $rate_region (
qsearch('rate_region', {}, '', 'ORDER BY regionname' )
) {
my $n = $rate_region->regionnum;
my $rate_detail =
$rate->dest_detail($rate_region)
|| 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>
<TD><INPUT TYPE="text" SIZE=5 NAME="min_included<%=$n%>" VALUE="<%= $cgi->param("min_included$n") || $rate_detail->min_included %>"></TD>
<TD>$<INPUT TYPE="text" SIZE=4 NAME="min_charge<%=$n%>" VALUE="<%= sprintf('%.2f', $cgi->param("min_charge$n") || $rate_detail->min_charge ) %>"></TD>
<TD>
<SELECT NAME="sec_granularity<%=$n%>">
<% foreach my $granularity ( keys %granularity ) { %>
<OPTION VALUE="<%=$granularity%>"<%= $granularity == ( $cgi->param("sec_granularity$n") || $rate_detail->sec_granularity ) ? ' SELECTED' : '' %>><%=$granularity{$granularity}%>
<% } %>
</SELECT>
</TR>
<% } %>
<TR>
<TD COLSPAN=5 ALIGN="center">
<A HREF="<%=$p%>edit/rate_region.cgi"><I>Add a region</I></A>
</TD>
</TR>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="<%=
$rate->ratenum ? "Apply changes" : "Add rate plan"
%>">
</FORM>
</BODY>
</HTML>
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- part_pkg.cgi 17 Nov 2004 13:22:55 -0000 1.47
+++ part_pkg.cgi 20 Nov 2004 17:26:54 -0000 1.48
@@ -295,8 +295,11 @@
? $plandata{$field}
: $href->{$field}{'default'} ).
qq!" onChange="fchanged(this)">!;
- } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) {
- $html .= qq!<SELECT MULTIPLE NAME="$field" onChange="fchanged(this)">!;
+ } elsif ( $href->{$field}{'type'} =~ /^select/ ) {
+ $html .= '<SELECT';
+ $html .= ' MULTIPLE'
+ if $href->{$field}{'type'} eq 'select_multiple';
+ $html .= qq! NAME="$field" onChange="fchanged(this)">!;
foreach my $record (
qsearch( $href->{$field}{'select_table'},
$href->{$field}{'select_hash'} )
--- NEW FILE: rate_region.cgi ---
<!-- mason kludge -->
<%
my $rate_region;
if ( $cgi->param('error') ) {
$rate_region = new FS::rate_region ( {
map { $_, scalar($cgi->param($_)) } fields('rate_region')
} );
} elsif ( $cgi->keywords ) {
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
$rate_region = qsearchs( 'rate_region', { 'regionnum' => $1 } );
} else { #adding
$rate_region = new FS::rate_region {};
}
my $action = $rate_region->regionnum ? 'Edit' : 'Add';
my $p1 = popurl(1);
my %granularity = (
'6' => '6 second',
'60' => 'minute',
);
my @rate_prefix = $rate_region->rate_prefix;
my $countrycode = '';
if ( @rate_prefix ) {
$countrycode = $rate_prefix[0]->countrycode;
foreach my $rate_prefix ( @rate_prefix ) {
eidiot 'multiple country codes per region not yet supported by web UI'
unless $rate_prefix->countrycode eq $countrycode;
}
}
%>
<%= header("$action Region", menubar(
'Main Menu' => $p,
#'View all regions' => "${p}browse/rate_region.cgi",
))
%>
<% if ( $cgi->param('error') ) { %>
<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT><BR>
<% } %>
<FORM ACTION="<%=$p1%>process/rate_region.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="regionnum" VALUE="<%= $rate_region->regionnum %>">
<%= ntable('#cccccc') %>
<TR>
<TH ALIGN="right">Region name</TH>
<TD><INPUT TYPE="text" NAME="regionname" SIZE=32 VALUE="<%= $rate_region->regionname %>"></TR>
</TR>
<TR>
<TH ALIGN="right">Country code</TH>
<TD><INPUT TYPE="text" NAME="countrycode" SIZE=4 MAXLENGTH=3 VALUE="<%= $countrycode %>"></TR>
</TR>
<TR>
<TH ALIGN="right">Prefixes</TH>
<TD>
<TEXTAREA NAME="npa" WRAP=SOFT><%= join(', ', map $_->npa, @rate_prefix ) %></TEXTAREA>
</TD>
</TR>
</TABLE>
<BR>
<%= table() %>
<TR>
<TH>Rate plan</TH>
<TH><FONT SIZE=-1>Included<BR>minutes</FONT></TH>
<TH><FONT SIZE=-1>Charge per<BR>minute</FONT></TH>
<TH><FONT SIZE=-1>Granularity</FONT></TH>
</TR>
<% foreach my $rate ( qsearch('rate', {}) ) {
my $n = $rate->ratenum;
my $rate_detail = $rate->dest_detail($rate_region)
|| new FS::rate_region { 'min_included' => 0,
'min_charge' => 0,
'sec_granularity' => '60'
};
%>
<TR>
<TD><A HREF="<%=$p%>edit/rate.cgi?<%= $rate->ratenum %>"><%= $rate->ratename %></TD>
<TD><INPUT TYPE="text" SIZE=5 NAME="min_included<%=$n%>" VALUE="<%= $cgi->param("min_included$n") || $rate_detail->min_included %>"></TD>
<TD>$<INPUT TYPE="text" SIZE=4 NAME="min_charge<%=$n%>" VALUE="<%= sprintf('%.2f', $cgi->param("min_charge$n") || $rate_detail->min_charge ) %>"></TD>
<TD>
<SELECT NAME="sec_granularity<%=$n%>">
<% foreach my $granularity ( keys %granularity ) { %>
<OPTION VALUE="<%=$granularity%>"<%= $granularity == ( $cgi->param("sec_granularity$n") || $rate_detail->sec_granularity ) ? ' SELECTED' : '' %>><%=$granularity{$granularity}%>
<% } %>
</SELECT>
</TR>
<% } %>
</TABLE>
<BR><BR><INPUT TYPE="submit" VALUE="<%=
$rate_region->regionnum ? "Apply changes" : "Add region"
%>">
</FORM>
</BODY>
</HTML>
- Previous message: freeside/FS/t rate.t,NONE,1.1 rate_detail.t,NONE,1.1 rate_region.t,NONE,1.1 rate_prefix.t,NONE,1.1 part_pkg-voip_sqlradacct.t,NONE,1.1
- Next message: freeside/FS/FS/part_pkg voip_sqlradacct.pm,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list