show imported region and rate #s, RT#83146
[freeside.git] / httemplate / edit / rate_region.cgi
index cae3003..b50d2da 100644 (file)
 
 %# region info
 
-<% ntable('#cccccc') %>
+<TABLE CLASS="fsinnerbox">
+
+% if ( $rate_region->agent_regionid ) {
+    <TR>
+      <TH ALIGN="right">Legacy #</TH>
+      <TD><% $rate_region->agent_regionid |h %></TD>
+    </TR>
+% }
 
   <TR>
     <TH ALIGN="right">Region name</TH>
   </TR>
 
   <TR>
-    <TD ALIGN="right">
+    <TH ALIGN="right">
       <B>Prefixes</B>
       <BR><FONT SIZE="-1">(comma-separated)</FONT>
-    </TD>
+    </TH>
     <TD>
       <TEXTAREA NAME="npa" WRAP=SOFT><% join(', ', map { $_->npa. (length($_->nxx) ? '-'.$_->nxx : '') } @rate_prefix ) %></TEXTAREA>
     </TD>
   </TR>
 
+  <& /elements/tr-checkbox.html,
+    label       => 'Exact match',
+    field       => 'exact_match',
+    cell_style  => 'font-weight: bold',
+    value       => 'Y',
+    curr_value  => $rate_region->exact_match
+  &>
+
 </TABLE>
 
-<BR><BR>
+<BR>
 <INPUT TYPE="submit" VALUE="<% $rate_region->regionnum ? "Apply changes" : "Add region" %>">
 </FORM>
 %# rate plan info, if the region has been created yet
 
 % if($rate_region->regionnum) {
-<BR>
-<BR>
-<FONT SIZE="+2">Rates in this region</FONT>
+<BR><BR><FONT SIZE="+2">Rates in this region</FONT>
+% if ( my $select_cdr_type = include('/elements/select-cdr_type.html',
+%  'curr_value'   => $cdrtypenum,
+%  'onchange'     => 'form.submit();',
+%  'name_col'     => 'cdrtypename',
+%  'value_col'    => 'cdrtypenum',
+%  'empty_label'  => '(default)',
+% ) ) {
+<FORM ACTION="<%$cgi->url%>" METHOD="GET">
+<INPUT TYPE="hidden" NAME="regionnum"   VALUE="<% $rate_region->regionnum %>">
+<FONT SIZE="+1">Usage type: <% $select_cdr_type %></FONT>
+</FORM>
+% }
 <% include('/edit/elements/rate_detail.html',
-            'regionnum' => $rate_region->regionnum,
+            'regionnum'   => $rate_region->regionnum,
+            'cdrtypenum'  => $cdrtypenum,
 ) %>
 % }
 
@@ -68,9 +94,8 @@ 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+)$/ or die "unparsable regionnum";
+} elsif ( $cgi->param('regionnum') ) {
+  $cgi->param('regionnum') =~ /^(\d+)$/ or die "unparseable regionnum";
   $rate_region = qsearchs( 'rate_region', { 'regionnum' => $1 } )
     or die "unknown regionnum $1\n";
 } else { #adding
@@ -91,5 +116,8 @@ if ( @rate_prefix ) {
       unless $rate_prefix->countrycode eq $countrycode;
   }
 }
-
+my $cdrtypenum = '';
+if ( $cgi->param('cdrtypenum') =~ /^(\d+)$/ ) {
+  $cdrtypenum = $1;
+}
 </%init>