slightly better voip_cdr package edit: use radio buttons for selecting long things
authorivan <ivan>
Sat, 15 Mar 2008 22:18:59 +0000 (22:18 +0000)
committerivan <ivan>
Sat, 15 Mar 2008 22:18:59 +0000 (22:18 +0000)
FS/FS/part_pkg/voip_cdr.pm
httemplate/edit/part_pkg.cgi

index b4ab73f..ea16031 100644 (file)
@@ -45,8 +45,8 @@ tie my %rating_method, 'Tie::IxHash',
                      'select_label' => 'ratename',
                    },
     'rating_method' => { 'name' => 'Region rating method',
                      'select_label' => 'ratename',
                    },
     'rating_method' => { 'name' => 'Region rating method',
-                         'type' => 'select',
-                         'select_options' => \%rating_method,
+                         'type' => 'radio',
+                         'options' => \%rating_method,
                        },
 
     'default_prefix' => { 'name'    => 'Default prefix optionally prepended to customer DID numbers when searching for CDR records',
                        },
 
     'default_prefix' => { 'name'    => 'Default prefix optionally prepended to customer DID numbers when searching for CDR records',
@@ -93,7 +93,7 @@ tie my %rating_method, 'Tie::IxHash',
 #                  },
 
   },
 #                  },
 
   },
-  'fieldorder' => [qw( setup_fee recur_flat unused_credit ratenum rating_method default_prefix )],
+  'fieldorder' => [qw( setup_fee recur_flat unused_credit ratenum rating_method default_prefix disable_src domestic_prefix international_prefix )],
   'weight' => 40,
 );
 
   'weight' => 40,
 );
 
index ec001cb..b1851a7 100755 (executable)
@@ -286,19 +286,25 @@ Line-item revenue recognition
 %
 %      my $format = sub { shift };
 %      $format = $href->{$field}{'format'} if exists($href->{$field}{'format'});
 %
 %      my $format = sub { shift };
 %      $format = $href->{$field}{'format'} if exists($href->{$field}{'format'});
+%
 %      if ( ! exists($href->{$field}{'type'}) ) {
 %      if ( ! exists($href->{$field}{'type'}) ) {
+%
 %        $html .= qq!<INPUT TYPE="text" NAME="$field" VALUE="!.
 %                 ( exists($plandata{$field})
 %                     ? &$format($plandata{$field})
 %                     : $href->{$field}{'default'} ).
 %                 qq!" onChange="fchanged(this)">!;
 %        $html .= qq!<INPUT TYPE="text" NAME="$field" VALUE="!.
 %                 ( exists($plandata{$field})
 %                     ? &$format($plandata{$field})
 %                     : $href->{$field}{'default'} ).
 %                 qq!" onChange="fchanged(this)">!;
+%
 %      } elsif ( $href->{$field}{'type'} eq 'checkbox' ) {
 %      } elsif ( $href->{$field}{'type'} eq 'checkbox' ) {
+%
 %        $html .= qq!<INPUT TYPE="checkbox" NAME="$field" VALUE=1 !.
 %                 ( exists($plandata{$field}) && $plandata{$field}
 %                   ? ' CHECKED'
 %                   : ''
 %                 ). '>';
 %        $html .= qq!<INPUT TYPE="checkbox" NAME="$field" VALUE=1 !.
 %                 ( exists($plandata{$field}) && $plandata{$field}
 %                   ? ' CHECKED'
 %                   : ''
 %                 ). '>';
+%
 %      } elsif ( $href->{$field}{'type'} =~ /^select/ ) {
 %      } elsif ( $href->{$field}{'type'} =~ /^select/ ) {
+%
 %        $html .= '<SELECT';
 %        $html .= ' MULTIPLE'
 %          if $href->{$field}{'type'} eq 'select_multiple';
 %        $html .= '<SELECT';
 %        $html .= ' MULTIPLE'
 %          if $href->{$field}{'type'} eq 'select_multiple';
@@ -319,13 +325,13 @@ Line-item revenue recognition
 %          }
 %        } elsif ( $href->{$field}{'select_options'} ) {
 %          foreach my $key ( keys %{ $href->{$field}{'select_options'} } ) {
 %          }
 %        } elsif ( $href->{$field}{'select_options'} ) {
 %          foreach my $key ( keys %{ $href->{$field}{'select_options'} } ) {
-%            my $value = $href->{$field}{'select_options'}{$key};
+%            my $label = $href->{$field}{'select_options'}{$key};
 %            $html .= qq!<OPTION VALUE="$key"!.
 %            $html .= qq!<OPTION VALUE="$key"!.
-%                     ( $plandata{$field} =~ /(^|, *)$value *(,|$)/
+%                     ( $plandata{$field} =~ /(^|, *)$key *(,|$)/ #XXX fix
 %                         ? ' SELECTED'
 %                         : ''
 %                     ).
 %                         ? ' SELECTED'
 %                         : ''
 %                     ).
-%                     '>'. $value;
+%                     '>'. $label;
 %          }
 %
 %        } else {
 %          }
 %
 %        } else {
@@ -334,6 +340,22 @@ Line-item revenue recognition
 %                   '</font>';
 %        }
 %        $html .= '</SELECT>';
 %                   '</font>';
 %        }
 %        $html .= '</SELECT>';
+%
+%      } elsif ( $href->{$field}{'type'} eq 'radio' ) {
+%
+%        my $radio =
+%          qq!<INPUT TYPE="radio" NAME="$field" onChange="fchanged(this)"!;
+%
+%        foreach my $key ( keys %{ $href->{$field}{'options'} } ) {
+%          my $label = $href->{$field}{'options'}{$key};
+%          $html .= qq!$radio VALUE="$key"!.
+%                   ( $plandata{$field} =~ /(^|, *)$key *(,|$)/ #XXX fix
+%                       ? ' CHECKED'
+%                       : ''
+%                   ).
+%                   "> $label<BR>";
+%        }
+%
 %      }
 %
 %      $html .= '</TD></TR>';
 %      }
 %
 %      $html .= '</TD></TR>';