start of auth plugin work
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($base_dir @config_items @base_items @card_types $DEBUG);
4 use Carp;
5 use IO::File;
6 use File::Basename;
7 use MIME::Base64;
8 use FS::ConfItem;
9 use FS::ConfDefaults;
10 use FS::Conf_compat17;
11 use FS::Locales;
12 use FS::payby;
13 use FS::conf;
14 use FS::Record qw(qsearch qsearchs);
15 use FS::UID qw(dbh datasrc use_confcompat);
16 use FS::Misc::Invoicing qw( spool_formats );
17
18 $base_dir = '%%%FREESIDE_CONF%%%';
19
20 $DEBUG = 0;
21
22 =head1 NAME
23
24 FS::Conf - Freeside configuration values
25
26 =head1 SYNOPSIS
27
28   use FS::Conf;
29
30   $conf = new FS::Conf;
31
32   $value = $conf->config('key');
33   @list  = $conf->config('key');
34   $bool  = $conf->exists('key');
35
36   $conf->touch('key');
37   $conf->set('key' => 'value');
38   $conf->delete('key');
39
40   @config_items = $conf->config_items;
41
42 =head1 DESCRIPTION
43
44 Read and write Freeside configuration values.  Keys currently map to filenames,
45 but this may change in the future.
46
47 =head1 METHODS
48
49 =over 4
50
51 =item new [ HASHREF ]
52
53 Create a new configuration object.
54
55 HASHREF may contain options to set the configuration context.  Currently 
56 accepts C<locale>, and C<localeonly> to disable fallback to the null locale.
57
58 =cut
59
60 sub new {
61   my($proto) = shift;
62   my $opts = shift || {};
63   my($class) = ref($proto) || $proto;
64   my $self = {
65     'base_dir'    => $base_dir,
66     'locale'      => $opts->{locale},
67     'localeonly'  => $opts->{localeonly}, # for config-view.cgi ONLY
68   };
69   warn "FS::Conf created with no locale fallback.\n" if $self->{localeonly};
70   bless ($self, $class);
71 }
72
73 =item base_dir
74
75 Returns the base directory.  By default this is /usr/local/etc/freeside.
76
77 =cut
78
79 sub base_dir {
80   my($self) = @_;
81   my $base_dir = $self->{base_dir};
82   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
83   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
84   -r $base_dir or die "FATAL: Can't read $base_dir!";
85   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
86   $base_dir =~ /^(.*)$/;
87   $1;
88 }
89
90 =item conf KEY [ AGENTNUM [ NODEFAULT ] ]
91
92 Returns the L<FS::conf> record for the key and agent.
93
94 =cut
95
96 sub conf {
97   my $self = shift;
98   $self->_config(@_);
99 }
100
101 =item config KEY [ AGENTNUM [ NODEFAULT ] ]
102
103 Returns the configuration value or values (depending on context) for key.
104 The optional agent number selects an agent specific value instead of the
105 global default if one is present.  If NODEFAULT is true only the agent
106 specific value(s) is returned.
107
108 =cut
109
110 sub _usecompat {
111   my ($self, $method) = (shift, shift);
112   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
113     if use_confcompat;
114   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
115   $compat->$method(@_);
116 }
117
118 sub _config {
119   my($self,$name,$agentnum,$agentonly)=@_;
120   my $hashref = { 'name' => $name };
121   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
122   my $cv;
123   my @a = (
124     ($agentnum || ()),
125     ($agentonly && $agentnum ? () : '')
126   );
127   my @l = (
128     ($self->{locale} || ()),
129     ($self->{localeonly} && $self->{locale} ? () : '')
130   );
131   # try with the agentnum first, then fall back to no agentnum if allowed
132   foreach my $a (@a) {
133     $hashref->{agentnum} = $a;
134     foreach my $l (@l) {
135       $hashref->{locale} = $l;
136       $cv = FS::Record::qsearchs('conf', $hashref);
137       return $cv if $cv;
138     }
139   }
140   return undef;
141 }
142
143 sub config {
144   my $self = shift;
145   return $self->_usecompat('config', @_) if use_confcompat;
146
147   carp "FS::Conf->config(". join(', ', @_). ") called"
148     if $DEBUG > 1;
149
150   my $cv = $self->_config(@_) or return;
151
152   if ( wantarray ) {
153     my $v = $cv->value;
154     chomp $v;
155     (split "\n", $v, -1);
156   } else {
157     (split("\n", $cv->value))[0];
158   }
159 }
160
161 =item config_binary KEY [ AGENTNUM [ NODEFAULT ] ]
162
163 Returns the exact scalar value for key.
164
165 =cut
166
167 sub config_binary {
168   my $self = shift;
169   return $self->_usecompat('config_binary', @_) if use_confcompat;
170
171   my $cv = $self->_config(@_) or return;
172   length($cv->value) ? decode_base64($cv->value) : '';
173 }
174
175 =item exists KEY [ AGENTNUM [ NODEFAULT ] ]
176
177 Returns true if the specified key exists, even if the corresponding value
178 is undefined.
179
180 =cut
181
182 sub exists {
183   my $self = shift;
184   return $self->_usecompat('exists', @_) if use_confcompat;
185
186   #my($name, $agentnum)=@_;
187
188   carp "FS::Conf->exists(". join(', ', @_). ") called"
189     if $DEBUG > 1;
190
191   defined($self->_config(@_));
192 }
193
194 #maybe this should just be the new exists instead of getting a method of its
195 #own, but i wanted to avoid possible fallout
196
197 sub config_bool {
198   my $self = shift;
199   return $self->_usecompat('exists', @_) if use_confcompat;
200
201   my($name,$agentnum,$agentonly) = @_;
202
203   carp "FS::Conf->config_bool(". join(', ', @_). ") called"
204     if $DEBUG > 1;
205
206   #defined($self->_config(@_));
207
208   #false laziness w/_config
209   my $hashref = { 'name' => $name };
210   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
211   my $cv;
212   my @a = (
213     ($agentnum || ()),
214     ($agentonly && $agentnum ? () : '')
215   );
216   my @l = (
217     ($self->{locale} || ()),
218     ($self->{localeonly} && $self->{locale} ? () : '')
219   );
220   # try with the agentnum first, then fall back to no agentnum if allowed
221   foreach my $a (@a) {
222     $hashref->{agentnum} = $a;
223     foreach my $l (@l) {
224       $hashref->{locale} = $l;
225       $cv = FS::Record::qsearchs('conf', $hashref);
226       if ( $cv ) {
227         if ( $cv->value eq '0'
228                && ($hashref->{agentnum} || $hashref->{locale} )
229            ) 
230         {
231           return 0; #an explicit false override, don't continue looking
232         } else {
233           return 1;
234         }
235       }
236     }
237   }
238   return 0;
239
240 }
241
242 =item config_orbase KEY SUFFIX
243
244 Returns the configuration value or values (depending on context) for 
245 KEY_SUFFIX, if it exists, otherwise for KEY
246
247 =cut
248
249 # outmoded as soon as we shift to agentnum based config values
250 # well, mostly.  still useful for e.g. late notices, etc. in that we want
251 # these to fall back to standard values
252 sub config_orbase {
253   my $self = shift;
254   return $self->_usecompat('config_orbase', @_) if use_confcompat;
255
256   my( $name, $suffix ) = @_;
257   if ( $self->exists("${name}_$suffix") ) {
258     $self->config("${name}_$suffix");
259   } else {
260     $self->config($name);
261   }
262 }
263
264 =item key_orbase KEY SUFFIX
265
266 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
267 KEY.  Useful for determining which exact configuration option is returned by
268 config_orbase.
269
270 =cut
271
272 sub key_orbase {
273   my $self = shift;
274   #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
275
276   my( $name, $suffix ) = @_;
277   if ( $self->exists("${name}_$suffix") ) {
278     "${name}_$suffix";
279   } else {
280     $name;
281   }
282 }
283
284 =item invoice_templatenames
285
286 Returns all possible invoice template names.
287
288 =cut
289
290 sub invoice_templatenames {
291   my( $self ) = @_;
292
293   my %templatenames = ();
294   foreach my $item ( $self->config_items ) {
295     foreach my $base ( @base_items ) {
296       my( $main, $ext) = split(/\./, $base);
297       $ext = ".$ext" if $ext;
298       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
299       $templatenames{$1}++;
300       }
301     }
302   }
303   
304   map { $_ } #handle scalar context
305   sort keys %templatenames;
306
307 }
308
309 =item touch KEY [ AGENT ];
310
311 Creates the specified configuration key if it does not exist.
312
313 =cut
314
315 sub touch {
316   my $self = shift;
317   return $self->_usecompat('touch', @_) if use_confcompat;
318
319   my($name, $agentnum) = @_;
320   #unless ( $self->exists($name, $agentnum) ) {
321   unless ( $self->config_bool($name, $agentnum) ) {
322     if ( $agentnum && $self->exists($name) && $self->config($name,$agentnum) eq '0' ) {
323       $self->delete($name, $agentnum);
324     } else {
325       $self->set($name, '', $agentnum);
326     }
327   }
328 }
329
330 =item set KEY VALUE [ AGENTNUM ];
331
332 Sets the specified configuration key to the given value.
333
334 =cut
335
336 sub set {
337   my $self = shift;
338   return $self->_usecompat('set', @_) if use_confcompat;
339
340   my($name, $value, $agentnum) = @_;
341   $value =~ /^(.*)$/s;
342   $value = $1;
343
344   warn "[FS::Conf] SET $name\n" if $DEBUG;
345
346   my $hashref = {
347     name => $name,
348     agentnum => $agentnum,
349     locale => $self->{locale}
350   };
351
352   my $old = FS::Record::qsearchs('conf', $hashref);
353   my $new = new FS::conf { $old ? $old->hash : %$hashref };
354   $new->value($value);
355
356   my $error;
357   if ($old) {
358     $error = $new->replace($old);
359   } else {
360     $error = $new->insert;
361   }
362
363   die "error setting configuration value: $error \n"
364     if $error;
365
366 }
367
368 =item set_binary KEY VALUE [ AGENTNUM ]
369
370 Sets the specified configuration key to an exact scalar value which
371 can be retrieved with config_binary.
372
373 =cut
374
375 sub set_binary {
376   my $self  = shift;
377   return if use_confcompat;
378
379   my($name, $value, $agentnum)=@_;
380   $self->set($name, encode_base64($value), $agentnum);
381 }
382
383 =item delete KEY [ AGENTNUM ];
384
385 Deletes the specified configuration key.
386
387 =cut
388
389 sub delete {
390   my $self = shift;
391   return $self->_usecompat('delete', @_) if use_confcompat;
392
393   my($name, $agentnum) = @_;
394   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum, locale => $self->{locale}}) ) {
395     warn "[FS::Conf] DELETE $name\n" if $DEBUG;
396
397     my $oldAutoCommit = $FS::UID::AutoCommit;
398     local $FS::UID::AutoCommit = 0;
399     my $dbh = dbh;
400
401     my $error = $cv->delete;
402
403     if ( $error ) {
404       $dbh->rollback if $oldAutoCommit;
405       die "error setting configuration value: $error \n"
406     }
407
408     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
409
410   }
411 }
412
413 #maybe this should just be the new delete instead of getting a method of its
414 #own, but i wanted to avoid possible fallout
415
416 sub delete_bool {
417   my $self = shift;
418   return $self->_usecompat('delete', @_) if use_confcompat;
419
420   my($name, $agentnum) = @_;
421
422   warn "[FS::Conf] DELETE $name\n" if $DEBUG;
423
424   my $cv = FS::Record::qsearchs('conf', { name     => $name,
425                                           agentnum => $agentnum,
426                                           locale   => $self->{locale},
427                                         });
428
429   if ( $cv ) {
430     my $error = $cv->delete;
431     die $error if $error;
432   } elsif ( $agentnum ) {
433     $self->set($name, '0', $agentnum);
434   }
435
436 }
437
438 =item import_config_item CONFITEM DIR 
439
440   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
441 the database as a conf record (see L<FS::conf>).  Imports from the file
442 in the directory DIR.
443
444 =cut
445
446 sub import_config_item { 
447   my ($self,$item,$dir) = @_;
448   my $key = $item->key;
449   if ( -e "$dir/$key" && ! use_confcompat ) {
450     warn "Inserting $key\n" if $DEBUG;
451     local $/;
452     my $value = readline(new IO::File "$dir/$key");
453     if ($item->type =~ /^(binary|image)$/ ) {
454       $self->set_binary($key, $value);
455     }else{
456       $self->set($key, $value);
457     }
458   }else {
459     warn "Not inserting $key\n" if $DEBUG;
460   }
461 }
462
463 =item verify_config_item CONFITEM DIR 
464
465   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
466 the database to the legacy file value in DIR.
467
468 =cut
469
470 sub verify_config_item { 
471   return '' if use_confcompat;
472   my ($self,$item,$dir) = @_;
473   my $key = $item->key;
474   my $type = $item->type;
475
476   my $compat = new FS::Conf_compat17 $dir;
477   my $error = '';
478   
479   $error .= "$key fails existential comparison; "
480     if $self->exists($key) xor $compat->exists($key);
481
482   if ( $type !~ /^(binary|image)$/ ) {
483
484     {
485       no warnings;
486       $error .= "$key fails scalar comparison; "
487         unless scalar($self->config($key)) eq scalar($compat->config($key));
488     }
489
490     my (@new) = $self->config($key);
491     my (@old) = $compat->config($key);
492     unless ( scalar(@new) == scalar(@old)) { 
493       $error .= "$key fails list comparison; ";
494     }else{
495       my $r=1;
496       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
497       $error .= "$key fails list comparison; "
498         unless $r;
499     }
500
501   } else {
502
503     no warnings 'uninitialized';
504     $error .= "$key fails binary comparison; "
505       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
506
507   }
508
509 #remove deprecated config on our own terms, not freeside-upgrade's
510 #  if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
511 #    my $proto;
512 #    for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
513 #    unless ($proto->key eq $key) { 
514 #      warn "removed config item $error\n" if $DEBUG;
515 #      $error = '';
516 #    }
517 #  }
518
519   $error;
520 }
521
522 #item _orbase_items OPTIONS
523 #
524 #Returns all of the possible extensible config items as FS::ConfItem objects.
525 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
526 #options include
527 #
528 # dir - the directory to search for configuration option files instead
529 #       of using the conf records in the database
530 #
531 #cut
532
533 #quelle kludge
534 sub _orbase_items {
535   my ($self, %opt) = @_; 
536
537   my $listmaker = sub { my $v = shift;
538                         $v =~ s/_/!_/g;
539                         if ( $v =~ /\.(png|eps)$/ ) {
540                           $v =~ s/\./!_%./;
541                         }else{
542                           $v .= '!_%';
543                         }
544                         map { $_->name }
545                           FS::Record::qsearch( 'conf',
546                                                {},
547                                                '',
548                                                "WHERE name LIKE '$v' ESCAPE '!'"
549                                              );
550                       };
551
552   if (exists($opt{dir}) && $opt{dir}) {
553     $listmaker = sub { my $v = shift;
554                        if ( $v =~ /\.(png|eps)$/ ) {
555                          $v =~ s/\./_*./;
556                        }else{
557                          $v .= '_*';
558                        }
559                        map { basename $_ } glob($opt{dir}. "/$v" );
560                      };
561   }
562
563   ( map { 
564           my $proto;
565           my $base = $_;
566           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
567           die "don't know about $base items" unless $proto->key eq $base;
568
569           map { new FS::ConfItem { 
570                   'key'         => $_,
571                   'base_key'    => $proto->key,
572                   'section'     => $proto->section,
573                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
574                   'type'        => $proto->type,
575                 };
576               } &$listmaker($base);
577         } @base_items,
578   );
579 }
580
581 =item config_items
582
583 Returns all of the possible global/default configuration items as
584 FS::ConfItem objects.  See L<FS::ConfItem>.
585
586 =cut
587
588 sub config_items {
589   my $self = shift; 
590   return $self->_usecompat('config_items', @_) if use_confcompat;
591
592   ( @config_items, $self->_orbase_items(@_) );
593 }
594
595 =back
596
597 =head1 SUBROUTINES
598
599 =over 4
600
601 =item init-config DIR
602
603 Imports the configuration items from DIR (1.7 compatible)
604 to conf records in the database.
605
606 =cut
607
608 sub init_config {
609   my $dir = shift;
610
611   {
612     local $FS::UID::use_confcompat = 0;
613     my $conf = new FS::Conf;
614     foreach my $item ( $conf->config_items(dir => $dir) ) {
615       $conf->import_config_item($item, $dir);
616       my $error = $conf->verify_config_item($item, $dir);
617       return $error if $error;
618     }
619   
620     my $compat = new FS::Conf_compat17 $dir;
621     foreach my $item ( $compat->config_items ) {
622       my $error = $conf->verify_config_item($item, $dir);
623       return $error if $error;
624     }
625   }
626
627   $FS::UID::use_confcompat = 0;
628   '';  #success
629 }
630
631 =back
632
633 =head1 BUGS
634
635 If this was more than just crud that will never be useful outside Freeside I'd
636 worry that config_items is freeside-specific and icky.
637
638 =head1 SEE ALSO
639
640 "Configuration" in the web interface (config/config.cgi).
641
642 =cut
643
644 #Business::CreditCard
645 @card_types = (
646   "VISA card",
647   "MasterCard",
648   "Discover card",
649   "American Express card",
650   "Diner's Club/Carte Blanche",
651   "enRoute",
652   "JCB",
653   "BankCard",
654   "Switch",
655   "Solo",
656 );
657
658 @base_items = qw(
659 invoice_template
660 invoice_latex
661 invoice_latexreturnaddress
662 invoice_latexfooter
663 invoice_latexsmallfooter
664 invoice_latexnotes
665 invoice_latexcoupon
666 invoice_html
667 invoice_htmlreturnaddress
668 invoice_htmlfooter
669 invoice_htmlnotes
670 logo.png
671 logo.eps
672 );
673
674 my %msg_template_options = (
675   'type'        => 'select-sub',
676   'options_sub' => sub { 
677     my @templates = qsearch({
678         'table' => 'msg_template', 
679         'hashref' => { 'disabled' => '' },
680         'extra_sql' => ' AND '. 
681           $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
682         });
683     map { $_->msgnum, $_->msgname } @templates;
684   },
685   'option_sub'  => sub { 
686                          my $msg_template = FS::msg_template->by_key(shift);
687                          $msg_template ? $msg_template->msgname : ''
688                        },
689   'per_agent' => 1,
690 );
691
692 my %payment_gateway_options = (
693   'type'        => 'select-sub',
694   'options_sub' => sub {
695     my @gateways = qsearch({
696         'table' => 'payment_gateway',
697         'hashref' => { 'disabled' => '' },
698       });
699     map { $_->gatewaynum, $_->label } @gateways;
700   },
701   'option_sub'  => sub {
702     my $gateway = FS::payment_gateway->by_key(shift);
703     $gateway ? $gateway->label : ''
704   },
705 );
706
707 my %batch_gateway_options = (
708   %payment_gateway_options,
709   'options_sub' => sub {
710     my @gateways = qsearch('payment_gateway',
711       {
712         'disabled'          => '',
713         'gateway_namespace' => 'Business::BatchPayment',
714       }
715     );
716     map { $_->gatewaynum, $_->label } @gateways;
717   },
718 );
719
720 my @cdr_formats = (
721   '' => '',
722   'default' => 'Default',
723   'source_default' => 'Default with source',
724   'accountcode_default' => 'Default plus accountcode',
725   'description_default' => 'Default with description field as destination',
726   'basic' => 'Basic',
727   'simple' => 'Simple',
728   'simple2' => 'Simple with source',
729   'accountcode_simple' => 'Simple with accountcode',
730 );
731
732 # takes the reason class (C, R, S) as an argument
733 sub reason_type_options {
734   my $reason_class = shift;
735
736   'type'        => 'select-sub',
737   'options_sub' => sub {
738     map { $_->typenum => $_->type } 
739       qsearch('reason_type', { class => $reason_class });
740   },
741   'option_sub'  => sub {
742     my $type = FS::reason_type->by_key(shift);
743     $type ? $type->type : '';
744   }
745 }
746
747 #Billing (81 items)
748 #Invoicing (50 items)
749 #UI (69 items)
750 #Self-service (29 items)
751 #...
752 #Unclassified (77 items)
753
754 @config_items = map { new FS::ConfItem $_ } (
755
756   {
757     'key'         => 'address',
758     'section'     => 'deprecated',
759     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
760     'type'        => 'text',
761   },
762
763   {
764     'key'         => 'event_log_level',
765     'section'     => 'notification',
766     'description' => 'Store events in the internal log if they are at least this severe.  "info" is the default, "debug" is very detailed and noisy.',
767     'type'        => 'select',
768     'select_enum' => [ '', 'debug', 'info', 'notice', 'warning', 'error', ],
769     # don't bother with higher levels
770   },
771
772   {
773     'key'         => 'log_sent_mail',
774     'section'     => 'notification',
775     'description' => 'Enable logging of template-generated email.',
776     'type'        => 'checkbox',
777   },
778
779   {
780     'key'         => 'alert_expiration',
781     'section'     => 'notification',
782     'description' => 'Enable alerts about billing method expiration (i.e. expiring credit cards).',
783     'type'        => 'checkbox',
784     'per_agent'   => 1,
785   },
786
787   {
788     'key'         => 'alerter_template',
789     'section'     => 'deprecated',
790     'description' => 'Template file for billing method expiration alerts (i.e. expiring credit cards).',
791     'type'        => 'textarea',
792     'per_agent'   => 1,
793   },
794   
795   {
796     'key'         => 'alerter_msgnum',
797     'section'     => 'notification',
798     'description' => 'Template to use for credit card expiration alerts.',
799     %msg_template_options,
800   },
801
802   {
803     'key'         => 'part_pkg-lineage',
804     'section'     => '',
805     'description' => 'When editing a package definition, if setup or recur fees are changed, create a new package rather than changing the existing package.',
806     'type'        => 'checkbox',
807   },
808
809   {
810     'key'         => 'apacheip',
811     #not actually deprecated yet
812     #'section'     => 'deprecated',
813     #'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be the current IP address to assign to new virtual hosts',
814     'section'     => '',
815     'description' => 'IP address to assign to new virtual hosts',
816     'type'        => 'text',
817   },
818   
819   {
820     'key'         => 'credits-auto-apply-disable',
821     'section'     => 'billing',
822     'description' => 'Disable the "Auto-Apply to invoices" UI option for new credits',
823     'type'        => 'checkbox',
824   },
825   
826   {
827     'key'         => 'credit-card-surcharge-percentage',
828     'section'     => 'billing',
829     'description' => 'Add a credit card surcharge to invoices, as a % of the invoice total. WARNING: this is usually prohibited by merchant account / other agreements and/or law, but is currently lawful in AU and UK.',
830     'type'        => 'text',
831   },
832
833   {
834     'key'         => 'discount-show-always',
835     'section'     => 'billing',
836     'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
837     'type'        => 'checkbox',
838   },
839
840   {
841     'key'         => 'discount-show_available',
842     'section'     => 'billing',
843     'description' => 'Show available prepayment discounts on invoices.',
844     'type'        => 'checkbox',
845   },
846
847   {
848     'key'         => 'invoice-barcode',
849     'section'     => 'billing',
850     'description' => 'Display a barcode on HTML and PDF invoices',
851     'type'        => 'checkbox',
852   },
853   
854   {
855     'key'         => 'cust_main-select-billday',
856     'section'     => 'billing',
857     'description' => 'When used with a specific billing event, allows the selection of the day of month on which to charge credit card / bank account automatically, on a per-customer basis',
858     'type'        => 'checkbox',
859   },
860
861   {
862     'key'         => 'cust_main-select-prorate_day',
863     'section'     => 'billing',
864     'description' => 'When used with prorate or anniversary packages, allows the selection of the prorate day of month, on a per-customer basis',
865     'type'        => 'checkbox',
866   },
867
868   {
869     'key'         => 'encryption',
870     'section'     => 'billing',
871     'description' => 'Enable encryption of credit cards and echeck numbers',
872     'type'        => 'checkbox',
873   },
874
875   {
876     'key'         => 'encryptionmodule',
877     'section'     => 'billing',
878     'description' => 'Use which module for encryption?',
879     'type'        => 'select',
880     'select_enum' => [ '', 'Crypt::OpenSSL::RSA', ],
881   },
882
883   {
884     'key'         => 'encryptionpublickey',
885     'section'     => 'billing',
886     'description' => 'Encryption public key',
887     'type'        => 'textarea',
888   },
889
890   {
891     'key'         => 'encryptionprivatekey',
892     'section'     => 'billing',
893     'description' => 'Encryption private key',
894     'type'        => 'textarea',
895   },
896
897   {
898     'key'         => 'billco-url',
899     'section'     => 'billing',
900     'description' => 'The url to use for performing uploads to the invoice mailing service.',
901     'type'        => 'text',
902     'per_agent'   => 1,
903   },
904
905   {
906     'key'         => 'billco-username',
907     'section'     => 'billing',
908     'description' => 'The login name to use for uploads to the invoice mailing service.',
909     'type'        => 'text',
910     'per_agent'   => 1,
911     'agentonly'   => 1,
912   },
913
914   {
915     'key'         => 'billco-password',
916     'section'     => 'billing',
917     'description' => 'The password to use for uploads to the invoice mailing service.',
918     'type'        => 'text',
919     'per_agent'   => 1,
920     'agentonly'   => 1,
921   },
922
923   {
924     'key'         => 'billco-clicode',
925     'section'     => 'billing',
926     'description' => 'The clicode to use for uploads to the invoice mailing service.',
927     'type'        => 'text',
928     'per_agent'   => 1,
929   },
930   
931   {
932     'key'         => 'next-bill-ignore-time',
933     'section'     => 'billing',
934     'description' => 'Ignore the time portion of next bill dates when billing, matching anything from 00:00:00 to 23:59:59 on the billing day.',
935     'type'        => 'checkbox',
936   },
937   
938   {
939     'key'         => 'business-onlinepayment',
940     'section'     => 'billing',
941     'description' => '<a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
942     'type'        => 'textarea',
943   },
944
945   {
946     'key'         => 'business-onlinepayment-ach',
947     'section'     => 'billing',
948     'description' => 'Alternate <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support for ACH transactions (defaults to regular <b>business-onlinepayment</b>).  At least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
949     'type'        => 'textarea',
950   },
951
952   {
953     'key'         => 'business-onlinepayment-namespace',
954     'section'     => 'billing',
955     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
956     'type'        => 'select',
957     'select_hash' => [
958                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
959                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
960                      ],
961   },
962
963   {
964     'key'         => 'business-onlinepayment-description',
965     'section'     => 'billing',
966     'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>.  Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages for which these charges apply - not available in all situations)',
967     'type'        => 'text',
968   },
969
970   {
971     'key'         => 'business-onlinepayment-email-override',
972     'section'     => 'billing',
973     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
974     'type'        => 'text',
975   },
976
977   {
978     'key'         => 'business-onlinepayment-email_customer',
979     'section'     => 'billing',
980     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
981     'type'        => 'checkbox',
982   },
983
984   {
985     'key'         => 'business-onlinepayment-test_transaction',
986     'section'     => 'billing',
987     'description' => 'Turns on the Business::OnlinePayment test_transaction flag.  Note that not all gateway modules support this flag; if yours does not, transactions will still be sent live.',
988     'type'        => 'checkbox',
989   },
990
991   {
992     'key'         => 'business-onlinepayment-currency',
993     'section'     => 'billing',
994     'description' => 'Currency parameter for Business::OnlinePayment transactions.',
995     'type'        => 'select',
996     'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD ) ],
997   },
998
999   {
1000     'key'         => 'currency',
1001     'section'     => 'billing',
1002     'description' => 'Currency',
1003     'type'        => 'select',
1004     'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD XAF ) ],
1005   },
1006
1007   {
1008     'key'         => 'business-batchpayment-test_transaction',
1009     'section'     => 'billing',
1010     'description' => 'Turns on the Business::BatchPayment test_mode flag.  Note that not all gateway modules support this flag; if yours does not, using the batch gateway will fail.',
1011     'type'        => 'checkbox',
1012   },
1013
1014   {
1015     'key'         => 'countrydefault',
1016     'section'     => 'UI',
1017     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
1018     'type'        => 'text',
1019   },
1020
1021   {
1022     'key'         => 'date_format',
1023     'section'     => 'UI',
1024     'description' => 'Format for displaying dates',
1025     'type'        => 'select',
1026     'select_hash' => [
1027                        '%m/%d/%Y' => 'MM/DD/YYYY',
1028                        '%d/%m/%Y' => 'DD/MM/YYYY',
1029                        '%Y/%m/%d' => 'YYYY/MM/DD',
1030                      ],
1031   },
1032
1033   {
1034     'key'         => 'date_format_long',
1035     'section'     => 'UI',
1036     'description' => 'Verbose format for displaying dates',
1037     'type'        => 'select',
1038     'select_hash' => [
1039                        '%b %o, %Y' => 'Mon DDth, YYYY',
1040                        '%e %b %Y'  => 'DD Mon YYYY',
1041                      ],
1042   },
1043
1044   {
1045     'key'         => 'deletecustomers',
1046     'section'     => 'UI',
1047     'description' => 'Enable customer deletions.  Be very careful!  Deleting a customer will remove all traces that the customer ever existed!  It should probably only be used when auditing a legacy database.  Normally, you cancel all of a customers\' packages if they cancel service.',
1048     'type'        => 'checkbox',
1049   },
1050
1051   {
1052     'key'         => 'deleteinvoices',
1053     'section'     => 'UI',
1054     'description' => 'Enable invoices deletions.  Be very careful!  Deleting an invoice will remove all traces that the invoice ever existed!  Normally, you would apply a credit against the invoice instead.',  #invoice voiding?
1055     'type'        => 'checkbox',
1056   },
1057
1058   {
1059     'key'         => 'deletepayments',
1060     'section'     => 'billing',
1061     'description' => 'Enable deletion of unclosed payments.  Really, with voids this is pretty much not recommended in any situation anymore.  Be very careful!  Only delete payments that were data-entry errors, not adjustments.  Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.',
1062     'type'        => [qw( checkbox text )],
1063   },
1064
1065   {
1066     'key'         => 'deletecredits',
1067     #not actually deprecated yet
1068     #'section'     => 'deprecated',
1069     #'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable deletion of unclosed credits.  Be very careful!  Only delete credits that were data-entry errors, not adjustments.  Optionally specify one or more comma-separated email addresses to be notified when a credit is deleted.',
1070     'section'     => '',
1071     'description' => 'One or more comma-separated email addresses to be notified when a credit is deleted.',
1072     'type'        => [qw( checkbox text )],
1073   },
1074
1075   {
1076     'key'         => 'deleterefunds',
1077     'section'     => 'billing',
1078     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
1079     'type'        => 'checkbox',
1080   },
1081
1082   {
1083     'key'         => 'unapplypayments',
1084     'section'     => 'deprecated',
1085     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable "unapplication" of unclosed payments.',
1086     'type'        => 'checkbox',
1087   },
1088
1089   {
1090     'key'         => 'unapplycredits',
1091     'section'     => 'deprecated',
1092     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to nable "unapplication" of unclosed credits.',
1093     'type'        => 'checkbox',
1094   },
1095
1096   {
1097     'key'         => 'dirhash',
1098     'section'     => 'shell',
1099     'description' => 'Optional numeric value to control directory hashing.  If positive, hashes directories for the specified number of levels from the front of the username.  If negative, hashes directories for the specified number of levels from the end of the username.  Some examples: <ul><li>1: user -> <a href="#home">/home</a>/u/user<li>2: user -> <a href="#home">/home</a>/u/s/user<li>-1: user -> <a href="#home">/home</a>/r/user<li>-2: user -> <a href="#home">home</a>/r/e/user</ul>',
1100     'type'        => 'text',
1101   },
1102
1103   {
1104     'key'         => 'disable_cust_attachment',
1105     'section'     => '',
1106     'description' => 'Disable customer file attachments',
1107     'type'        => 'checkbox',
1108   },
1109
1110   {
1111     'key'         => 'max_attachment_size',
1112     'section'     => '',
1113     'description' => 'Maximum size for customer file attachments (leave blank for unlimited)',
1114     'type'        => 'text',
1115   },
1116
1117   {
1118     'key'         => 'disable_customer_referrals',
1119     'section'     => 'UI',
1120     'description' => 'Disable new customer-to-customer referrals in the web interface',
1121     'type'        => 'checkbox',
1122   },
1123
1124   {
1125     'key'         => 'editreferrals',
1126     'section'     => 'UI',
1127     'description' => 'Enable advertising source modification for existing customers',
1128     'type'        => 'checkbox',
1129   },
1130
1131   {
1132     'key'         => 'emailinvoiceonly',
1133     'section'     => 'invoicing',
1134     'description' => 'Disables postal mail invoices',
1135     'type'        => 'checkbox',
1136   },
1137
1138   {
1139     'key'         => 'disablepostalinvoicedefault',
1140     'section'     => 'invoicing',
1141     'description' => 'Disables postal mail invoices as the default option in the UI.  Be careful not to setup customers which are not sent invoices.  See <a href ="#emailinvoiceauto">emailinvoiceauto</a>.',
1142     'type'        => 'checkbox',
1143   },
1144
1145   {
1146     'key'         => 'emailinvoiceauto',
1147     'section'     => 'invoicing',
1148     'description' => 'Automatically adds new accounts to the email invoice list',
1149     'type'        => 'checkbox',
1150   },
1151
1152   {
1153     'key'         => 'emailinvoiceautoalways',
1154     'section'     => 'invoicing',
1155     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
1156     'type'        => 'checkbox',
1157   },
1158
1159   {
1160     'key'         => 'emailinvoice-apostrophe',
1161     'section'     => 'invoicing',
1162     'description' => 'Allows the apostrophe (single quote) character in the email addresses in the email invoice list.',
1163     'type'        => 'checkbox',
1164   },
1165
1166   {
1167     'key'         => 'svc_acct-ip_addr',
1168     'section'     => '',
1169     'description' => 'Enable IP address management on login services like for broadband services.',
1170     'type'        => 'checkbox',
1171   },
1172
1173   {
1174     'key'         => 'exclude_ip_addr',
1175     'section'     => '',
1176     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
1177     'type'        => 'textarea',
1178   },
1179   
1180   {
1181     'key'         => 'auto_router',
1182     'section'     => '',
1183     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
1184     'type'        => 'checkbox',
1185   },
1186   
1187   {
1188     'key'         => 'hidecancelledpackages',
1189     'section'     => 'UI',
1190     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
1191     'type'        => 'checkbox',
1192   },
1193
1194   {
1195     'key'         => 'hidecancelledcustomers',
1196     'section'     => 'UI',
1197     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
1198     'type'        => 'checkbox',
1199   },
1200
1201   {
1202     'key'         => 'home',
1203     'section'     => 'shell',
1204     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
1205     'type'        => 'text',
1206   },
1207
1208   {
1209     'key'         => 'invoice_from',
1210     'section'     => 'required',
1211     'description' => 'Return address on email invoices',
1212     'type'        => 'text',
1213     'per_agent'   => 1,
1214   },
1215
1216   {
1217     'key'         => 'invoice_subject',
1218     'section'     => 'invoicing',
1219     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
1220     'type'        => 'text',
1221     'per_agent'   => 1,
1222     'per_locale'  => 1,
1223   },
1224
1225   {
1226     'key'         => 'invoice_usesummary',
1227     'section'     => 'invoicing',
1228     'description' => 'Indicates that html and latex invoices should be in summary style and make use of invoice_latexsummary.',
1229     'type'        => 'checkbox',
1230   },
1231
1232   {
1233     'key'         => 'invoice_template',
1234     'section'     => 'invoicing',
1235     'description' => 'Text template file for invoices.  Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
1236     'type'        => 'textarea',
1237   },
1238
1239   {
1240     'key'         => 'invoice_html',
1241     'section'     => 'invoicing',
1242     'description' => 'HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
1243
1244     'type'        => 'textarea',
1245   },
1246
1247   {
1248     'key'         => 'quotation_html',
1249     'section'     => '',
1250     'description' => 'HTML template for quotations.',
1251
1252     'type'        => 'textarea',
1253   },
1254
1255   {
1256     'key'         => 'invoice_htmlnotes',
1257     'section'     => 'invoicing',
1258     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
1259     'type'        => 'textarea',
1260     'per_agent'   => 1,
1261     'per_locale'  => 1,
1262   },
1263
1264   {
1265     'key'         => 'invoice_htmlfooter',
1266     'section'     => 'invoicing',
1267     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
1268     'type'        => 'textarea',
1269     'per_agent'   => 1,
1270     'per_locale'  => 1,
1271   },
1272
1273   {
1274     'key'         => 'invoice_htmlsummary',
1275     'section'     => 'invoicing',
1276     'description' => 'Summary initial page for HTML invoices.',
1277     'type'        => 'textarea',
1278     'per_agent'   => 1,
1279     'per_locale'  => 1,
1280   },
1281
1282   {
1283     'key'         => 'invoice_htmlreturnaddress',
1284     'section'     => 'invoicing',
1285     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
1286     'type'        => 'textarea',
1287     'per_locale'  => 1,
1288   },
1289
1290   {
1291     'key'         => 'invoice_latex',
1292     'section'     => 'invoicing',
1293     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
1294     'type'        => 'textarea',
1295   },
1296
1297   {
1298     'key'         => 'quotation_latex',
1299     'section'     => '',
1300     'description' => 'LaTeX template for typeset PostScript quotations.',
1301     'type'        => 'textarea',
1302   },
1303
1304   {
1305     'key'         => 'invoice_latextopmargin',
1306     'section'     => 'invoicing',
1307     'description' => 'Optional LaTeX invoice topmargin setting. Include units.',
1308     'type'        => 'text',
1309     'per_agent'   => 1,
1310     'validate'    => sub { shift =~
1311                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1312                              ? '' : 'Invalid LaTex length';
1313                          },
1314   },
1315
1316   {
1317     'key'         => 'invoice_latexheadsep',
1318     'section'     => 'invoicing',
1319     'description' => 'Optional LaTeX invoice headsep setting. Include units.',
1320     'type'        => 'text',
1321     'per_agent'   => 1,
1322     'validate'    => sub { shift =~
1323                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1324                              ? '' : 'Invalid LaTex length';
1325                          },
1326   },
1327
1328   {
1329     'key'         => 'invoice_latexaddresssep',
1330     'section'     => 'invoicing',
1331     'description' => 'Optional LaTeX invoice separation between invoice header
1332 and customer address. Include units.',
1333     'type'        => 'text',
1334     'per_agent'   => 1,
1335     'validate'    => sub { shift =~
1336                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1337                              ? '' : 'Invalid LaTex length';
1338                          },
1339   },
1340
1341   {
1342     'key'         => 'invoice_latextextheight',
1343     'section'     => 'invoicing',
1344     'description' => 'Optional LaTeX invoice textheight setting. Include units.',
1345     'type'        => 'text',
1346     'per_agent'   => 1,
1347     'validate'    => sub { shift =~
1348                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1349                              ? '' : 'Invalid LaTex length';
1350                          },
1351   },
1352
1353   {
1354     'key'         => 'invoice_latexnotes',
1355     'section'     => 'invoicing',
1356     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
1357     'type'        => 'textarea',
1358     'per_agent'   => 1,
1359     'per_locale'  => 1,
1360   },
1361
1362   {
1363     'key'         => 'quotation_latexnotes',
1364     'section'     => '',
1365     'description' => 'Notes section for LaTeX typeset PostScript quotations.',
1366     'type'        => 'textarea',
1367     'per_agent'   => 1,
1368     'per_locale'  => 1,
1369   },
1370
1371   {
1372     'key'         => 'invoice_latexfooter',
1373     'section'     => 'invoicing',
1374     'description' => 'Footer for LaTeX typeset PostScript invoices.',
1375     'type'        => 'textarea',
1376     'per_agent'   => 1,
1377     'per_locale'  => 1,
1378   },
1379
1380   {
1381     'key'         => 'invoice_latexsummary',
1382     'section'     => 'invoicing',
1383     'description' => 'Summary initial page for LaTeX typeset PostScript invoices.',
1384     'type'        => 'textarea',
1385     'per_agent'   => 1,
1386     'per_locale'  => 1,
1387   },
1388
1389   {
1390     'key'         => 'invoice_latexcoupon',
1391     'section'     => 'invoicing',
1392     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
1393     'type'        => 'textarea',
1394     'per_agent'   => 1,
1395     'per_locale'  => 1,
1396   },
1397
1398   {
1399     'key'         => 'invoice_latexextracouponspace',
1400     'section'     => 'invoicing',
1401     'description' => 'Optional LaTeX invoice textheight space to reserve for a tear off coupon.  Include units.  Default is 3.6cm',
1402     'type'        => 'text',
1403     'per_agent'   => 1,
1404     'validate'    => sub { shift =~
1405                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1406                              ? '' : 'Invalid LaTex length';
1407                          },
1408   },
1409
1410   {
1411     'key'         => 'invoice_latexcouponfootsep',
1412     'section'     => 'invoicing',
1413     'description' => 'Optional LaTeX invoice separation between tear off coupon and footer. Include units.',
1414     'type'        => 'text',
1415     'per_agent'   => 1,
1416     'validate'    => sub { shift =~
1417                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1418                              ? '' : 'Invalid LaTex length';
1419                          },
1420   },
1421
1422   {
1423     'key'         => 'invoice_latexcouponamountenclosedsep',
1424     'section'     => 'invoicing',
1425     'description' => 'Optional LaTeX invoice separation between total due and amount enclosed line. Include units.',
1426     'type'        => 'text',
1427     'per_agent'   => 1,
1428     'validate'    => sub { shift =~
1429                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1430                              ? '' : 'Invalid LaTex length';
1431                          },
1432   },
1433   {
1434     'key'         => 'invoice_latexcoupontoaddresssep',
1435     'section'     => 'invoicing',
1436     'description' => 'Optional LaTeX invoice separation between invoice data and the to address (usually invoice_latexreturnaddress).  Include units.',
1437     'type'        => 'text',
1438     'per_agent'   => 1,
1439     'validate'    => sub { shift =~
1440                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1441                              ? '' : 'Invalid LaTex length';
1442                          },
1443   },
1444
1445   {
1446     'key'         => 'invoice_latexreturnaddress',
1447     'section'     => 'invoicing',
1448     'description' => 'Return address for LaTeX typeset PostScript invoices.',
1449     'type'        => 'textarea',
1450   },
1451
1452   {
1453     'key'         => 'invoice_latexverticalreturnaddress',
1454     'section'     => 'invoicing',
1455     'description' => 'Place the return address under the company logo rather than beside it.',
1456     'type'        => 'checkbox',
1457     'per_agent'   => 1,
1458   },
1459
1460   {
1461     'key'         => 'invoice_latexcouponaddcompanytoaddress',
1462     'section'     => 'invoicing',
1463     'description' => 'Add the company name to the To address on the remittance coupon because the return address does not contain it.',
1464     'type'        => 'checkbox',
1465     'per_agent'   => 1,
1466   },
1467
1468   {
1469     'key'         => 'invoice_latexsmallfooter',
1470     'section'     => 'invoicing',
1471     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
1472     'type'        => 'textarea',
1473     'per_agent'   => 1,
1474     'per_locale'  => 1,
1475   },
1476
1477   {
1478     'key'         => 'invoice_email_pdf',
1479     'section'     => 'invoicing',
1480     'description' => 'Send PDF invoice as an attachment to emailed invoices.  By default, includes the plain text invoice as the email body, unless invoice_email_pdf_note is set.',
1481     'type'        => 'checkbox'
1482   },
1483
1484   {
1485     'key'         => 'invoice_email_pdf_note',
1486     'section'     => 'invoicing',
1487     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
1488     'type'        => 'textarea'
1489   },
1490
1491   {
1492     'key'         => 'invoice_print_pdf',
1493     'section'     => 'invoicing',
1494     'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.',
1495     'type'        => 'checkbox',
1496   },
1497
1498   {
1499     'key'         => 'invoice_print_pdf-spoolagent',
1500     'section'     => 'invoicing',
1501     'description' => 'Store postal invoices PDF downloads in per-agent spools.',
1502     'type'        => 'checkbox',
1503   },
1504
1505   { 
1506     'key'         => 'invoice_default_terms',
1507     'section'     => 'invoicing',
1508     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
1509     'type'        => 'select',
1510     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 3', 'Net 9', 'Net 10', 'Net 15', 'Net 18', 'Net 20', 'Net 21', 'Net 30', 'Net 45', 'Net 60', 'Net 90' ],
1511   },
1512
1513   { 
1514     'key'         => 'invoice_show_prior_due_date',
1515     'section'     => 'invoicing',
1516     'description' => 'Show previous invoice due dates when showing prior balances.  Default is to show invoice date.',
1517     'type'        => 'checkbox',
1518   },
1519
1520   { 
1521     'key'         => 'invoice_include_aging',
1522     'section'     => 'invoicing',
1523     'description' => 'Show an aging line after the prior balance section.  Only valud when invoice_sections is enabled.',
1524     'type'        => 'checkbox',
1525   },
1526
1527   { 
1528     'key'         => 'invoice_sections',
1529     'section'     => 'invoicing',
1530     'description' => 'Split invoice into sections and label according to package category when enabled.',
1531     'type'        => 'checkbox',
1532     'per_agent'   => 1,
1533   },
1534
1535   #quotations seem broken-ish with sections ATM?
1536   #{ 
1537   #  'key'         => 'quotation_sections',
1538   #  'section'     => 'invoicing',
1539   #  'description' => 'Split quotations into sections and label according to package category when enabled.',
1540   #  'type'        => 'checkbox',
1541   #  'per_agent'   => 1,
1542   #},
1543
1544   { 
1545     'key'         => 'usage_class_as_a_section',
1546     'section'     => 'invoicing',
1547     'description' => 'Split usage into sections and label according to usage class name when enabled.  Only valid when invoice_sections is enabled.',
1548     'type'        => 'checkbox',
1549   },
1550
1551   { 
1552     'key'         => 'phone_usage_class_summary',
1553     'section'     => 'invoicing',
1554     'description' => 'Summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
1555     'type'        => 'checkbox',
1556   },
1557
1558   { 
1559     'key'         => 'svc_phone_sections',
1560     'section'     => 'invoicing',
1561     'description' => 'Create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
1562     'type'        => 'checkbox',
1563   },
1564
1565   {
1566     'key'         => 'finance_pkgclass',
1567     'section'     => 'billing',
1568     'description' => 'The default package class for late fee charges, used if the fee event does not specify a package class itself.',
1569     'type'        => 'select-pkg_class',
1570   },
1571
1572   { 
1573     'key'         => 'separate_usage',
1574     'section'     => 'invoicing',
1575     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
1576     'type'        => 'checkbox',
1577   },
1578
1579   {
1580     'key'         => 'invoice_send_receipts',
1581     'section'     => 'deprecated',
1582     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
1583     'type'        => 'checkbox',
1584   },
1585
1586   {
1587     'key'         => 'payment_receipt',
1588     'section'     => 'notification',
1589     'description' => 'Send payment receipts.',
1590     'type'        => 'checkbox',
1591     'per_agent'   => 1,
1592     'agent_bool'  => 1,
1593   },
1594
1595   {
1596     'key'         => 'payment_receipt_msgnum',
1597     'section'     => 'notification',
1598     'description' => 'Template to use for payment receipts.',
1599     %msg_template_options,
1600   },
1601   
1602   {
1603     'key'         => 'payment_receipt_from',
1604     'section'     => 'notification',
1605     'description' => 'From: address for payment receipts, if not specified in the template.',
1606     'type'        => 'text',
1607     'per_agent'   => 1,
1608   },
1609
1610   {
1611     'key'         => 'payment_receipt_email',
1612     'section'     => 'deprecated',
1613     'description' => 'Template file for payment receipts.  Payment receipts are sent to the customer email invoice destination(s) when a payment is received.',
1614     'type'        => [qw( checkbox textarea )],
1615   },
1616
1617   {
1618     'key'         => 'payment_receipt-trigger',
1619     'section'     => 'notification',
1620     'description' => 'When payment receipts are triggered.  Defaults to when payment is made.',
1621     'type'        => 'select',
1622     'select_hash' => [
1623                        'cust_pay'          => 'When payment is made.',
1624                        'cust_bill_pay_pkg' => 'When payment is applied.',
1625                      ],
1626     'per_agent'   => 1,
1627   },
1628
1629   {
1630     'key'         => 'trigger_export_insert_on_payment',
1631     'section'     => 'billing',
1632     'description' => 'Enable exports on payment application.',
1633     'type'        => 'checkbox',
1634   },
1635
1636   {
1637     'key'         => 'lpr',
1638     'section'     => 'required',
1639     'description' => 'Print command for paper invoices, for example `lpr -h\'',
1640     'type'        => 'text',
1641     'per_agent'   => 1,
1642   },
1643
1644   {
1645     'key'         => 'lpr-postscript_prefix',
1646     'section'     => 'billing',
1647     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1648     'type'        => 'text',
1649   },
1650
1651   {
1652     'key'         => 'lpr-postscript_suffix',
1653     'section'     => 'billing',
1654     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1655     'type'        => 'text',
1656   },
1657
1658   {
1659     'key'         => 'money_char',
1660     'section'     => '',
1661     'description' => 'Currency symbol - defaults to `$\'',
1662     'type'        => 'text',
1663   },
1664
1665   {
1666     'key'         => 'defaultrecords',
1667     'section'     => 'BIND',
1668     'description' => 'DNS entries to add automatically when creating a domain',
1669     'type'        => 'editlist',
1670     'editlist_parts' => [ { type=>'text' },
1671                           { type=>'immutable', value=>'IN' },
1672                           { type=>'select',
1673                             select_enum => {
1674                               map { $_=>$_ }
1675                                   #@{ FS::domain_record->rectypes }
1676                                   qw(A AAAA CNAME MX NS PTR SPF SRV TXT)
1677                             },
1678                           },
1679                           { type=> 'text' }, ],
1680   },
1681
1682   {
1683     'key'         => 'passwordmin',
1684     'section'     => 'password',
1685     'description' => 'Minimum password length (default 6)',
1686     'type'        => 'text',
1687   },
1688
1689   {
1690     'key'         => 'passwordmax',
1691     'section'     => 'password',
1692     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
1693     'type'        => 'text',
1694   },
1695
1696   {
1697     'key'         => 'password-noampersand',
1698     'section'     => 'password',
1699     'description' => 'Disallow ampersands in passwords',
1700     'type'        => 'checkbox',
1701   },
1702
1703   {
1704     'key'         => 'password-noexclamation',
1705     'section'     => 'password',
1706     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1707     'type'        => 'checkbox',
1708   },
1709
1710   {
1711     'key'         => 'default-password-encoding',
1712     'section'     => 'password',
1713     'description' => 'Default storage format for passwords',
1714     'type'        => 'select',
1715     'select_hash' => [
1716       'plain'       => 'Plain text',
1717       'crypt-des'   => 'Unix password (DES encrypted)',
1718       'crypt-md5'   => 'Unix password (MD5 digest)',
1719       'ldap-plain'  => 'LDAP (plain text)',
1720       'ldap-crypt'  => 'LDAP (DES encrypted)',
1721       'ldap-md5'    => 'LDAP (MD5 digest)',
1722       'ldap-sha1'   => 'LDAP (SHA1 digest)',
1723       'legacy'      => 'Legacy mode',
1724     ],
1725   },
1726
1727   {
1728     'key'         => 'referraldefault',
1729     'section'     => 'UI',
1730     'description' => 'Default referral, specified by refnum',
1731     'type'        => 'select-sub',
1732     'options_sub' => sub { require FS::Record;
1733                            require FS::part_referral;
1734                            map { $_->refnum => $_->referral }
1735                                FS::Record::qsearch( 'part_referral', 
1736                                                     { 'disabled' => '' }
1737                                                   );
1738                          },
1739     'option_sub'  => sub { require FS::Record;
1740                            require FS::part_referral;
1741                            my $part_referral = FS::Record::qsearchs(
1742                              'part_referral', { 'refnum'=>shift } );
1743                            $part_referral ? $part_referral->referral : '';
1744                          },
1745   },
1746
1747 #  {
1748 #    'key'         => 'registries',
1749 #    'section'     => 'required',
1750 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1751 #  },
1752
1753   {
1754     'key'         => 'report_template',
1755     'section'     => 'deprecated',
1756     'description' => 'Deprecated template file for reports.',
1757     'type'        => 'textarea',
1758   },
1759
1760   {
1761     'key'         => 'maxsearchrecordsperpage',
1762     'section'     => 'UI',
1763     'description' => 'If set, number of search records to return per page.',
1764     'type'        => 'text',
1765   },
1766
1767   {
1768     'key'         => 'disable_maxselect',
1769     'section'     => 'UI',
1770     'description' => 'Prevent changing the number of records per page.',
1771     'type'        => 'checkbox',
1772   },
1773
1774   {
1775     'key'         => 'session-start',
1776     'section'     => 'session',
1777     'description' => 'If defined, the command which is executed on the Freeside machine when a session begins.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
1778     'type'        => 'text',
1779   },
1780
1781   {
1782     'key'         => 'session-stop',
1783     'section'     => 'session',
1784     'description' => 'If defined, the command which is executed on the Freeside machine when a session ends.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
1785     'type'        => 'text',
1786   },
1787
1788   {
1789     'key'         => 'shells',
1790     'section'     => 'shell',
1791     'description' => 'Legal shells (think /etc/shells).  You probably want to `cut -d: -f7 /etc/passwd | sort | uniq\' initially so that importing doesn\'t fail with `Illegal shell\' errors, then remove any special entries afterwords.  A blank line specifies that an empty shell is permitted.',
1792     'type'        => 'textarea',
1793   },
1794
1795   {
1796     'key'         => 'showpasswords',
1797     'section'     => 'UI',
1798     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1799     'type'        => 'checkbox',
1800   },
1801
1802   {
1803     'key'         => 'report-showpasswords',
1804     'section'     => 'UI',
1805     'description' => 'This is a terrible idea.  Do not enable it.  STRONGLY NOT RECOMMENDED.  Enables display of passwords on services reports.',
1806     'type'        => 'checkbox',
1807   },
1808
1809   {
1810     'key'         => 'signupurl',
1811     'section'     => 'UI',
1812     'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
1813     'type'        => 'text',
1814   },
1815
1816   {
1817     'key'         => 'smtpmachine',
1818     'section'     => 'required',
1819     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1820     'type'        => 'text',
1821   },
1822
1823   {
1824     'key'         => 'smtp-username',
1825     'section'     => '',
1826     'description' => 'Optional SMTP username for Freeside\'s outgoing mail',
1827     'type'        => 'text',
1828   },
1829
1830   {
1831     'key'         => 'smtp-password',
1832     'section'     => '',
1833     'description' => 'Optional SMTP password for Freeside\'s outgoing mail',
1834     'type'        => 'text',
1835   },
1836
1837   {
1838     'key'         => 'smtp-encryption',
1839     'section'     => '',
1840     'description' => 'Optional SMTP encryption method.  The STARTTLS methods require smtp-username and smtp-password to be set.',
1841     'type'        => 'select',
1842     'select_hash' => [ '25'           => 'None (port 25)',
1843                        '25-starttls'  => 'STARTTLS (port 25)',
1844                        '587-starttls' => 'STARTTLS / submission (port 587)',
1845                        '465-tls'      => 'SMTPS (SSL) (port 465)',
1846                      ],
1847   },
1848
1849   {
1850     'key'         => 'soadefaultttl',
1851     'section'     => 'BIND',
1852     'description' => 'SOA default TTL for new domains.',
1853     'type'        => 'text',
1854   },
1855
1856   {
1857     'key'         => 'soaemail',
1858     'section'     => 'BIND',
1859     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1860     'type'        => 'text',
1861   },
1862
1863   {
1864     'key'         => 'soaexpire',
1865     'section'     => 'BIND',
1866     'description' => 'SOA expire for new domains',
1867     'type'        => 'text',
1868   },
1869
1870   {
1871     'key'         => 'soamachine',
1872     'section'     => 'BIND',
1873     'description' => 'SOA machine for new domains, with trailing `.\'',
1874     'type'        => 'text',
1875   },
1876
1877   {
1878     'key'         => 'soarefresh',
1879     'section'     => 'BIND',
1880     'description' => 'SOA refresh for new domains',
1881     'type'        => 'text',
1882   },
1883
1884   {
1885     'key'         => 'soaretry',
1886     'section'     => 'BIND',
1887     'description' => 'SOA retry for new domains',
1888     'type'        => 'text',
1889   },
1890
1891   {
1892     'key'         => 'statedefault',
1893     'section'     => 'UI',
1894     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1895     'type'        => 'text',
1896   },
1897
1898   {
1899     'key'         => 'unsuspendauto',
1900     'section'     => 'billing',
1901     'description' => 'Enables the automatic unsuspension of suspended packages when a customer\'s balance due changes from positive to zero or negative as the result of a payment or credit',
1902     'type'        => 'checkbox',
1903   },
1904
1905   {
1906     'key'         => 'unsuspend-always_adjust_next_bill_date',
1907     'section'     => 'billing',
1908     'description' => 'Global override that causes unsuspensions to always adjust the next bill date under any circumstances.  This is now controlled on a per-package bases - probably best not to use this option unless you are a legacy installation that requires this behaviour.',
1909     'type'        => 'checkbox',
1910   },
1911
1912   {
1913     'key'         => 'usernamemin',
1914     'section'     => 'username',
1915     'description' => 'Minimum username length (default 2)',
1916     'type'        => 'text',
1917   },
1918
1919   {
1920     'key'         => 'usernamemax',
1921     'section'     => 'username',
1922     'description' => 'Maximum username length',
1923     'type'        => 'text',
1924   },
1925
1926   {
1927     'key'         => 'username-ampersand',
1928     'section'     => 'username',
1929     'description' => 'Allow the ampersand character (&amp;) in usernames.  Be careful when using this option in conjunction with <a href="../browse/part_export.cgi">exports</a> which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.',
1930     'type'        => 'checkbox',
1931   },
1932
1933   {
1934     'key'         => 'username-letter',
1935     'section'     => 'username',
1936     'description' => 'Usernames must contain at least one letter',
1937     'type'        => 'checkbox',
1938     'per_agent'   => 1,
1939   },
1940
1941   {
1942     'key'         => 'username-letterfirst',
1943     'section'     => 'username',
1944     'description' => 'Usernames must start with a letter',
1945     'type'        => 'checkbox',
1946   },
1947
1948   {
1949     'key'         => 'username-noperiod',
1950     'section'     => 'username',
1951     'description' => 'Disallow periods in usernames',
1952     'type'        => 'checkbox',
1953   },
1954
1955   {
1956     'key'         => 'username-nounderscore',
1957     'section'     => 'username',
1958     'description' => 'Disallow underscores in usernames',
1959     'type'        => 'checkbox',
1960   },
1961
1962   {
1963     'key'         => 'username-nodash',
1964     'section'     => 'username',
1965     'description' => 'Disallow dashes in usernames',
1966     'type'        => 'checkbox',
1967   },
1968
1969   {
1970     'key'         => 'username-uppercase',
1971     'section'     => 'username',
1972     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1973     'type'        => 'checkbox',
1974     'per_agent'   => 1,
1975   },
1976
1977   { 
1978     'key'         => 'username-percent',
1979     'section'     => 'username',
1980     'description' => 'Allow the percent character (%) in usernames.',
1981     'type'        => 'checkbox',
1982   },
1983
1984   { 
1985     'key'         => 'username-colon',
1986     'section'     => 'username',
1987     'description' => 'Allow the colon character (:) in usernames.',
1988     'type'        => 'checkbox',
1989   },
1990
1991   { 
1992     'key'         => 'username-slash',
1993     'section'     => 'username',
1994     'description' => 'Allow the slash character (/) in usernames.  When using, make sure to set "Home directory" to fixed and blank in all svc_acct service definitions.',
1995     'type'        => 'checkbox',
1996   },
1997
1998   { 
1999     'key'         => 'username-equals',
2000     'section'     => 'username',
2001     'description' => 'Allow the equal sign character (=) in usernames.',
2002     'type'        => 'checkbox',
2003   },
2004
2005   {
2006     'key'         => 'safe-part_bill_event',
2007     'section'     => 'UI',
2008     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
2009     'type'        => 'checkbox',
2010   },
2011
2012   {
2013     'key'         => 'show_ss',
2014     'section'     => 'UI',
2015     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
2016     'type'        => 'checkbox',
2017   },
2018
2019   {
2020     'key'         => 'unmask_ss',
2021     'section'     => 'UI',
2022     'description' => "Don't mask social security numbers in the web interface.",
2023     'type'        => 'checkbox',
2024   },
2025
2026   {
2027     'key'         => 'show_stateid',
2028     'section'     => 'UI',
2029     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
2030     'type'        => 'checkbox',
2031   },
2032
2033   {
2034     'key'         => 'national_id-country',
2035     'section'     => 'UI',
2036     'description' => 'Track a national identification number, for specific countries.',
2037     'type'        => 'select',
2038     'select_enum' => [ '', 'MY' ],
2039   },
2040
2041   {
2042     'key'         => 'show_bankstate',
2043     'section'     => 'UI',
2044     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
2045     'type'        => 'checkbox',
2046   },
2047
2048   { 
2049     'key'         => 'agent_defaultpkg',
2050     'section'     => 'UI',
2051     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
2052     'type'        => 'checkbox',
2053   },
2054
2055   {
2056     'key'         => 'legacy_link',
2057     'section'     => 'UI',
2058     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
2059     'type'        => 'checkbox',
2060   },
2061
2062   {
2063     'key'         => 'legacy_link-steal',
2064     'section'     => 'UI',
2065     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
2066     'type'        => 'checkbox',
2067   },
2068
2069   {
2070     'key'         => 'queue_dangerous_controls',
2071     'section'     => 'UI',
2072     'description' => 'Enable queue modification controls on account pages and for new jobs.  Unless you are a developer working on new export code, you should probably leave this off to avoid causing provisioning problems.',
2073     'type'        => 'checkbox',
2074   },
2075
2076   {
2077     'key'         => 'security_phrase',
2078     'section'     => 'password',
2079     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
2080     'type'        => 'checkbox',
2081   },
2082
2083   {
2084     'key'         => 'locale',
2085     'section'     => 'UI',
2086     'description' => 'Default locale',
2087     'type'        => 'select-sub',
2088     'options_sub' => sub {
2089       map { $_ => FS::Locales->description($_) } FS::Locales->locales;
2090     },
2091     'option_sub'  => sub {
2092       FS::Locales->description(shift)
2093     },
2094   },
2095
2096   {
2097     'key'         => 'signup_server-payby',
2098     'section'     => 'self-service',
2099     'description' => 'Acceptable payment types for the signup server',
2100     'type'        => 'selectmultiple',
2101     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
2102   },
2103
2104   {
2105     'key'         => 'selfservice-payment_gateway',
2106     'section'     => 'self-service',
2107     'description' => 'Force the use of this payment gateway for self-service.',
2108     %payment_gateway_options,
2109   },
2110
2111   {
2112     'key'         => 'selfservice-save_unchecked',
2113     'section'     => 'self-service',
2114     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
2115     'type'        => 'checkbox',
2116   },
2117
2118   {
2119     'key'         => 'default_agentnum',
2120     'section'     => 'UI',
2121     'description' => 'Default agent for the backoffice',
2122     'type'        => 'select-agent',
2123   },
2124
2125   {
2126     'key'         => 'signup_server-default_agentnum',
2127     'section'     => 'self-service',
2128     'description' => 'Default agent for the signup server',
2129     'type'        => 'select-agent',
2130   },
2131
2132   {
2133     'key'         => 'signup_server-default_refnum',
2134     'section'     => 'self-service',
2135     'description' => 'Default advertising source for the signup server',
2136     'type'        => 'select-sub',
2137     'options_sub' => sub { require FS::Record;
2138                            require FS::part_referral;
2139                            map { $_->refnum => $_->referral }
2140                                FS::Record::qsearch( 'part_referral', 
2141                                                     { 'disabled' => '' }
2142                                                   );
2143                          },
2144     'option_sub'  => sub { require FS::Record;
2145                            require FS::part_referral;
2146                            my $part_referral = FS::Record::qsearchs(
2147                              'part_referral', { 'refnum'=>shift } );
2148                            $part_referral ? $part_referral->referral : '';
2149                          },
2150   },
2151
2152   {
2153     'key'         => 'signup_server-default_pkgpart',
2154     'section'     => 'self-service',
2155     'description' => 'Default package for the signup server',
2156     'type'        => 'select-part_pkg',
2157   },
2158
2159   {
2160     'key'         => 'signup_server-default_svcpart',
2161     'section'     => 'self-service',
2162     'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
2163     'type'        => 'select-part_svc',
2164   },
2165
2166   {
2167     'key'         => 'signup_server-mac_addr_svcparts',
2168     'section'     => 'self-service',
2169     'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
2170     'type'        => 'select-part_svc',
2171     'multiple'    => 1,
2172   },
2173
2174   {
2175     'key'         => 'signup_server-nomadix',
2176     'section'     => 'self-service',
2177     'description' => 'Signup page Nomadix integration',
2178     'type'        => 'checkbox',
2179   },
2180
2181   {
2182     'key'         => 'signup_server-service',
2183     'section'     => 'self-service',
2184     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
2185     'type'        => 'select',
2186     'select_hash' => [
2187                        'svc_acct'  => 'Account (svc_acct)',
2188                        'svc_phone' => 'Phone number (svc_phone)',
2189                        'svc_pbx'   => 'PBX (svc_pbx)',
2190                      ],
2191   },
2192   
2193   {
2194     'key'         => 'signup_server-prepaid-template-custnum',
2195     'section'     => 'self-service',
2196     'description' => 'When the signup server is used with prepaid cards and customer info is not required for signup, the contact/address info will be copied from this customer, if specified',
2197     'type'        => 'text',
2198   },
2199
2200   {
2201     'key'         => 'signup_server-terms_of_service',
2202     'section'     => 'self-service',
2203     'description' => 'Terms of Service for the signup server.  May contain HTML.',
2204     'type'        => 'textarea',
2205     'per_agent'   => 1,
2206   },
2207
2208   {
2209     'key'         => 'selfservice_server-base_url',
2210     'section'     => 'self-service',
2211     'description' => 'Base URL for the self-service web interface - necessary for some widgets to find their way, including retrieval of non-US state information and phone number provisioning.',
2212     'type'        => 'text',
2213   },
2214
2215   {
2216     'key'         => 'show-msgcat-codes',
2217     'section'     => 'UI',
2218     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
2219     'type'        => 'checkbox',
2220   },
2221
2222   {
2223     'key'         => 'signup_server-realtime',
2224     'section'     => 'self-service',
2225     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
2226     'type'        => 'checkbox',
2227   },
2228
2229   {
2230     'key'         => 'signup_server-classnum2',
2231     'section'     => 'self-service',
2232     'description' => 'Package Class for first optional purchase',
2233     'type'        => 'select-pkg_class',
2234   },
2235
2236   {
2237     'key'         => 'signup_server-classnum3',
2238     'section'     => 'self-service',
2239     'description' => 'Package Class for second optional purchase',
2240     'type'        => 'select-pkg_class',
2241   },
2242
2243   {
2244     'key'         => 'signup_server-third_party_as_card',
2245     'section'     => 'self-service',
2246     'description' => 'Allow customer payment type to be set to CARD even when using third-party credit card billing.',
2247     'type'        => 'checkbox',
2248   },
2249
2250   {
2251     'key'         => 'selfservice-xmlrpc',
2252     'section'     => 'self-service',
2253     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
2254     'type'        => 'checkbox',
2255   },
2256
2257   {
2258     'key'         => 'backend-realtime',
2259     'section'     => 'billing',
2260     'description' => 'Run billing for backend signups immediately.',
2261     'type'        => 'checkbox',
2262   },
2263
2264   {
2265     'key'         => 'decline_msgnum',
2266     'section'     => 'notification',
2267     'description' => 'Template to use for credit card and electronic check decline messages.',
2268     %msg_template_options,
2269   },
2270
2271   {
2272     'key'         => 'declinetemplate',
2273     'section'     => 'deprecated',
2274     'description' => 'Template file for credit card and electronic check decline emails.',
2275     'type'        => 'textarea',
2276   },
2277
2278   {
2279     'key'         => 'emaildecline',
2280     'section'     => 'notification',
2281     'description' => 'Enable emailing of credit card and electronic check decline notices.',
2282     'type'        => 'checkbox',
2283     'per_agent'   => 1,
2284   },
2285
2286   {
2287     'key'         => 'emaildecline-exclude',
2288     'section'     => 'notification',
2289     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
2290     'type'        => 'textarea',
2291     'per_agent'   => 1,
2292   },
2293
2294   {
2295     'key'         => 'cancel_msgnum',
2296     'section'     => 'notification',
2297     'description' => 'Template to use for cancellation emails.',
2298     %msg_template_options,
2299   },
2300
2301   {
2302     'key'         => 'cancelmessage',
2303     'section'     => 'deprecated',
2304     'description' => 'Template file for cancellation emails.',
2305     'type'        => 'textarea',
2306   },
2307
2308   {
2309     'key'         => 'cancelsubject',
2310     'section'     => 'deprecated',
2311     'description' => 'Subject line for cancellation emails.',
2312     'type'        => 'text',
2313   },
2314
2315   {
2316     'key'         => 'emailcancel',
2317     'section'     => 'notification',
2318     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
2319     'type'        => 'checkbox',
2320     'per_agent'   => 1,
2321   },
2322
2323   {
2324     'key'         => 'bill_usage_on_cancel',
2325     'section'     => 'billing',
2326     'description' => 'Enable automatic generation of an invoice for usage when a package is cancelled.  Not all packages can do this.  Usage data must already be available.',
2327     'type'        => 'checkbox',
2328   },
2329
2330   {
2331     'key'         => 'require_cardname',
2332     'section'     => 'billing',
2333     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
2334     'type'        => 'checkbox',
2335   },
2336
2337   {
2338     'key'         => 'enable_taxclasses',
2339     'section'     => 'billing',
2340     'description' => 'Enable per-package tax classes',
2341     'type'        => 'checkbox',
2342   },
2343
2344   {
2345     'key'         => 'require_taxclasses',
2346     'section'     => 'billing',
2347     'description' => 'Require a taxclass to be entered for every package',
2348     'type'        => 'checkbox',
2349   },
2350
2351   {
2352     'key'         => 'enable_taxproducts',
2353     'section'     => 'billing',
2354     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
2355     'type'        => 'checkbox',
2356   },
2357
2358   {
2359     'key'         => 'taxdatadirectdownload',
2360     'section'     => 'billing',  #well
2361     'description' => 'Enable downloading tax data directly from the vendor site. at least three lines: URL, username, and password.j',
2362     'type'        => 'textarea',
2363   },
2364
2365   {
2366     'key'         => 'ignore_incalculable_taxes',
2367     'section'     => 'billing',
2368     'description' => 'Prefer to invoice without tax over not billing at all',
2369     'type'        => 'checkbox',
2370   },
2371
2372   {
2373     'key'         => 'welcome_msgnum',
2374     'section'     => 'notification',
2375     'description' => 'Template to use for welcome messages when a svc_acct record is created.',
2376     %msg_template_options,
2377   },
2378   
2379   {
2380     'key'         => 'svc_acct_welcome_exclude',
2381     'section'     => 'notification',
2382     'description' => 'A list of svc_acct services for which no welcome email is to be sent.',
2383     'type'        => 'select-part_svc',
2384     'multiple'    => 1,
2385   },
2386
2387   {
2388     'key'         => 'welcome_email',
2389     'section'     => 'deprecated',
2390     'description' => 'Template file for welcome email.  Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created.',
2391     'type'        => 'textarea',
2392     'per_agent'   => 1,
2393   },
2394
2395   {
2396     'key'         => 'welcome_email-from',
2397     'section'     => 'deprecated',
2398     'description' => 'From: address header for welcome email',
2399     'type'        => 'text',
2400     'per_agent'   => 1,
2401   },
2402
2403   {
2404     'key'         => 'welcome_email-subject',
2405     'section'     => 'deprecated',
2406     'description' => 'Subject: header for welcome email',
2407     'type'        => 'text',
2408     'per_agent'   => 1,
2409   },
2410   
2411   {
2412     'key'         => 'welcome_email-mimetype',
2413     'section'     => 'deprecated',
2414     'description' => 'MIME type for welcome email',
2415     'type'        => 'select',
2416     'select_enum' => [ 'text/plain', 'text/html' ],
2417     'per_agent'   => 1,
2418   },
2419
2420   {
2421     'key'         => 'welcome_letter',
2422     'section'     => '',
2423     'description' => 'Optional LaTex template file for a printed welcome letter.  A welcome letter is printed the first time a cust_pkg record is created.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation and the billing documentation for details on the template substitution language.  A variable exists for each fieldname in the customer record (<code>$first, $last, etc</code>).  The following additional variables are available<ul><li><code>$payby</code> - a friendler represenation of the field<li><code>$payinfo</code> - the masked payment information<li><code>$expdate</code> - the time at which the payment method expires (a UNIX timestamp)<li><code>$returnaddress</code> - the invoice return address for this customer\'s agent</ul>',
2424     'type'        => 'textarea',
2425   },
2426
2427 #  {
2428 #    'key'         => 'warning_msgnum',
2429 #    'section'     => 'notification',
2430 #    'description' => 'Template to use for warning messages, sent to the customer email invoice destination(s) when a svc_acct record has its usage drop below a threshold.',
2431 #    %msg_template_options,
2432 #  },
2433
2434   {
2435     'key'         => 'warning_email',
2436     'section'     => 'notification',
2437     'description' => 'Template file for warning email.  Warning emails are sent to the customer email invoice destination(s) each time a svc_acct record has its usage drop below a threshold or 0.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code> <li><code>$column</code> <li><code>$amount</code> <li><code>$threshold</code></ul>',
2438     'type'        => 'textarea',
2439   },
2440
2441   {
2442     'key'         => 'warning_email-from',
2443     'section'     => 'notification',
2444     'description' => 'From: address header for warning email',
2445     'type'        => 'text',
2446   },
2447
2448   {
2449     'key'         => 'warning_email-cc',
2450     'section'     => 'notification',
2451     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
2452     'type'        => 'text',
2453   },
2454
2455   {
2456     'key'         => 'warning_email-subject',
2457     'section'     => 'notification',
2458     'description' => 'Subject: header for warning email',
2459     'type'        => 'text',
2460   },
2461   
2462   {
2463     'key'         => 'warning_email-mimetype',
2464     'section'     => 'notification',
2465     'description' => 'MIME type for warning email',
2466     'type'        => 'select',
2467     'select_enum' => [ 'text/plain', 'text/html' ],
2468   },
2469
2470   {
2471     'key'         => 'payby',
2472     'section'     => 'billing',
2473     'description' => 'Available payment types.',
2474     'type'        => 'selectmultiple',
2475     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
2476   },
2477
2478   {
2479     'key'         => 'payby-default',
2480     'section'     => 'UI',
2481     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
2482     'type'        => 'select',
2483     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
2484   },
2485
2486   {
2487     'key'         => 'require_cash_deposit_info',
2488     'section'     => 'billing',
2489     'description' => 'When recording cash payments, display bank deposit information fields.',
2490     'type'        => 'checkbox',
2491   },
2492
2493   {
2494     'key'         => 'paymentforcedtobatch',
2495     'section'     => 'deprecated',
2496     'description' => 'See batch-enable_payby and realtime-disable_payby.  Used to (for CHEK): Cause per customer payment entry to be forced to a batch processor rather than performed realtime.',
2497     'type'        => 'checkbox',
2498   },
2499
2500   {
2501     'key'         => 'svc_acct-notes',
2502     'section'     => 'deprecated',
2503     'description' => 'Extra HTML to be displayed on the Account View screen.',
2504     'type'        => 'textarea',
2505   },
2506
2507   {
2508     'key'         => 'radius-password',
2509     'section'     => '',
2510     'description' => 'RADIUS attribute for plain-text passwords.',
2511     'type'        => 'select',
2512     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
2513   },
2514
2515   {
2516     'key'         => 'radius-ip',
2517     'section'     => '',
2518     'description' => 'RADIUS attribute for IP addresses.',
2519     'type'        => 'select',
2520     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2521   },
2522
2523   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2524   {
2525     'key'         => 'radius-chillispot-max',
2526     'section'     => '',
2527     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2528     'type'        => 'checkbox',
2529   },
2530
2531   {
2532     'key'         => 'svc_broadband-radius',
2533     'section'     => '',
2534     'description' => 'Enable RADIUS groups for broadband services.',
2535     'type'        => 'checkbox',
2536   },
2537
2538   {
2539     'key'         => 'svc_acct-alldomains',
2540     'section'     => '',
2541     'description' => 'Allow accounts to select any domain in the database.  Normally accounts can only select from the domain set in the service definition and those purchased by the customer.',
2542     'type'        => 'checkbox',
2543   },
2544
2545   {
2546     'key'         => 'dump-localdest',
2547     'section'     => '',
2548     'description' => 'Destination for local database dumps (full path)',
2549     'type'        => 'text',
2550   },
2551
2552   {
2553     'key'         => 'dump-scpdest',
2554     'section'     => '',
2555     'description' => 'Destination for scp database dumps: user@host:/path',
2556     'type'        => 'text',
2557   },
2558
2559   {
2560     'key'         => 'dump-pgpid',
2561     'section'     => '',
2562     'description' => "Optional PGP public key user or key id for database dumps.  The public key should exist on the freeside user's public keyring, and the gpg binary and GnuPG perl module should be installed.",
2563     'type'        => 'text',
2564   },
2565
2566   {
2567     'key'         => 'users-allow_comp',
2568     'section'     => 'deprecated',
2569     'description' => '<b>DEPRECATED</b>, enable the <i>Complimentary customer</i> access right instead.  Was: Usernames (Freeside users, created with <a href="../docs/man/bin/freeside-adduser.html">freeside-adduser</a>) which can create complimentary customers, one per line.  If no usernames are entered, all users can create complimentary accounts.',
2570     'type'        => 'textarea',
2571   },
2572
2573   {
2574     'key'         => 'credit_card-recurring_billing_flag',
2575     'section'     => 'billing',
2576     'description' => 'This controls when the system passes the "recurring_billing" flag on credit card transactions.  If supported by your processor (and the Business::OnlinePayment processor module), passing the flag indicates this is a recurring transaction and may turn off the CVV requirement. ',
2577     'type'        => 'select',
2578     'select_hash' => [
2579                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2580                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
2581                      ],
2582   },
2583
2584   {
2585     'key'         => 'credit_card-recurring_billing_acct_code',
2586     'section'     => 'billing',
2587     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2588     'type'        => 'checkbox',
2589   },
2590
2591   {
2592     'key'         => 'cvv-save',
2593     'section'     => 'billing',
2594     'description' => 'Save CVV2 information after the initial transaction for the selected credit card types.  Enabling this option may be in violation of your merchant agreement(s), so please check them carefully before enabling this option for any credit card types.',
2595     'type'        => 'selectmultiple',
2596     'select_enum' => \@card_types,
2597   },
2598
2599   {
2600     'key'         => 'manual_process-pkgpart',
2601     'section'     => 'billing',
2602     'description' => 'Package to add to each manual credit card and ACH payment entered by employees from the backend.  Enabling this option may be in violation of your merchant agreement(s), so please check it(/them) carefully before enabling this option.',
2603     'type'        => 'select-part_pkg',
2604     'per_agent'   => 1,
2605   },
2606
2607   {
2608     'key'         => 'manual_process-display',
2609     'section'     => 'billing',
2610     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2611     'type'        => 'select',
2612     'select_hash' => [
2613                        'add'      => 'Add fee to amount entered',
2614                        'subtract' => 'Subtract fee from amount entered',
2615                      ],
2616   },
2617
2618   {
2619     'key'         => 'manual_process-skip_first',
2620     'section'     => 'billing',
2621     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2622     'type'        => 'checkbox',
2623   },
2624
2625   {
2626     'key'         => 'selfservice_process-pkgpart',
2627     'section'     => 'billing',
2628     'description' => 'Package to add to each manual credit card and ACH payment entered by the customer themselves in the self-service interface.  Enabling this option may be in violation of your merchant agreement(s), so please check it(/them) carefully before enabling this option.',
2629     'type'        => 'select-part_pkg',
2630     'per_agent'   => 1,
2631   },
2632
2633   {
2634     'key'         => 'selfservice_process-display',
2635     'section'     => 'billing',
2636     'description' => 'When using selfservice_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2637     'type'        => 'select',
2638     'select_hash' => [
2639                        'add'      => 'Add fee to amount entered',
2640                        'subtract' => 'Subtract fee from amount entered',
2641                      ],
2642   },
2643
2644   {
2645     'key'         => 'selfservice_process-skip_first',
2646     'section'     => 'billing',
2647     'description' => "When using selfservice_process-pkgpart, omit the fee if it is the customer's first payment.",
2648     'type'        => 'checkbox',
2649   },
2650
2651 #  {
2652 #    'key'         => 'auto_process-pkgpart',
2653 #    'section'     => 'billing',
2654 #    'description' => 'Package to add to each automatic credit card and ACH payment processed by billing events.  Enabling this option may be in violation of your merchant agreement(s), so please check them carefully before enabling this option.',
2655 #    'type'        => 'select-part_pkg',
2656 #  },
2657 #
2658 ##  {
2659 ##    'key'         => 'auto_process-display',
2660 ##    'section'     => 'billing',
2661 ##    'description' => 'When using auto_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2662 ##    'type'        => 'select',
2663 ##    'select_hash' => [
2664 ##                       'add'      => 'Add fee to amount entered',
2665 ##                       'subtract' => 'Subtract fee from amount entered',
2666 ##                     ],
2667 ##  },
2668 #
2669 #  {
2670 #    'key'         => 'auto_process-skip_first',
2671 #    'section'     => 'billing',
2672 #    'description' => "When using auto_process-pkgpart, omit the fee if it is the customer's first payment.",
2673 #    'type'        => 'checkbox',
2674 #  },
2675
2676   {
2677     'key'         => 'allow_negative_charges',
2678     'section'     => 'billing',
2679     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2680     'type'        => 'checkbox',
2681   },
2682   {
2683       'key'         => 'auto_unset_catchall',
2684       'section'     => '',
2685       'description' => 'When canceling a svc_acct that is the email catchall for one or more svc_domains, automatically set their catchall fields to null.  If this option is not set, the attempt will simply fail.',
2686       'type'        => 'checkbox',
2687   },
2688
2689   {
2690     'key'         => 'system_usernames',
2691     'section'     => 'username',
2692     'description' => 'A list of system usernames that cannot be edited or removed, one per line.  Use a bare username to prohibit modification/deletion of the username in any domain, or username@domain to prohibit modification/deletetion of a specific username and domain.',
2693     'type'        => 'textarea',
2694   },
2695
2696   {
2697     'key'         => 'cust_pkg-change_svcpart',
2698     'section'     => '',
2699     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
2700     'type'        => 'checkbox',
2701   },
2702
2703   {
2704     'key'         => 'cust_pkg-change_pkgpart-bill_now',
2705     'section'     => '',
2706     'description' => "When changing packages, bill the new package immediately.  Useful for prepaid situations with RADIUS where an Expiration attribute based on the package must be present at all times.",
2707     'type'        => 'checkbox',
2708   },
2709
2710   {
2711     'key'         => 'disable_autoreverse',
2712     'section'     => 'BIND',
2713     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
2714     'type'        => 'checkbox',
2715   },
2716
2717   {
2718     'key'         => 'svc_www-enable_subdomains',
2719     'section'     => '',
2720     'description' => 'Enable selection of specific subdomains for virtual host creation.',
2721     'type'        => 'checkbox',
2722   },
2723
2724   {
2725     'key'         => 'svc_www-usersvc_svcpart',
2726     'section'     => '',
2727     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
2728     'type'        => 'select-part_svc',
2729     'multiple'    => 1,
2730   },
2731
2732   {
2733     'key'         => 'selfservice_server-primary_only',
2734     'section'     => 'self-service',
2735     'description' => 'Only allow primary accounts to access self-service functionality.',
2736     'type'        => 'checkbox',
2737   },
2738
2739   {
2740     'key'         => 'selfservice_server-phone_login',
2741     'section'     => 'self-service',
2742     'description' => 'Allow login to self-service with phone number and PIN.',
2743     'type'        => 'checkbox',
2744   },
2745
2746   {
2747     'key'         => 'selfservice_server-single_domain',
2748     'section'     => 'self-service',
2749     'description' => 'If specified, only use this one domain for self-service access.',
2750     'type'        => 'text',
2751   },
2752
2753   {
2754     'key'         => 'selfservice_server-login_svcpart',
2755     'section'     => 'self-service',
2756     'description' => 'If specified, only allow the specified svcparts to login to self-service.',
2757     'type'        => 'select-part_svc',
2758     'multiple'    => 1,
2759   },
2760
2761   {
2762     'key'         => 'selfservice-svc_forward_svcpart',
2763     'section'     => 'self-service',
2764     'description' => 'Service for self-service forward editing.',
2765     'type'        => 'select-part_svc',
2766   },
2767
2768   {
2769     'key'         => 'selfservice-password_reset_verification',
2770     'section'     => 'self-service',
2771     'description' => 'If enabled, specifies the type of verification required for self-service password resets.',
2772     'type'        => 'select',
2773     'select_hash' => [ '' => 'Password reset disabled',
2774                        'paymask,amount,zip' => 'Verify with credit card (or bank account) last 4 digits, payment amount and zip code',
2775                      ],
2776   },
2777
2778   {
2779     'key'         => 'selfservice-password_reset_msgnum',
2780     'section'     => 'self-service',
2781     'description' => 'Template to use for password reset emails.',
2782     %msg_template_options,
2783   },
2784
2785   {
2786     'key'         => 'selfservice-hide_invoices-taxclass',
2787     'section'     => 'self-service',
2788     'description' => 'Hide invoices with only this package tax class from self-service and supress sending (emailing, printing, faxing) them.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',
2789     'type'        => 'text',
2790   },
2791
2792   {
2793     'key'         => 'selfservice-recent-did-age',
2794     'section'     => 'self-service',
2795     'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
2796     'type'        => 'text',
2797   },
2798
2799   {
2800     'key'         => 'selfservice_server-view-wholesale',
2801     'section'     => 'self-service',
2802     'description' => 'If enabled, use a wholesale package view in the self-service.',
2803     'type'        => 'checkbox',
2804   },
2805   
2806   {
2807     'key'         => 'selfservice-agent_signup',
2808     'section'     => 'self-service',
2809     'description' => 'Allow agent signup via self-service.',
2810     'type'        => 'checkbox',
2811   },
2812
2813   {
2814     'key'         => 'selfservice-agent_signup-agent_type',
2815     'section'     => 'self-service',
2816     'description' => 'Agent type when allowing agent signup via self-service.',
2817     'type'        => 'select-sub',
2818     'options_sub' => sub { require FS::Record;
2819                            require FS::agent_type;
2820                            map { $_->typenum => $_->atype }
2821                                FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
2822                          },
2823     'option_sub'  => sub { require FS::Record;
2824                            require FS::agent_type;
2825                            my $agent = FS::Record::qsearchs(
2826                              'agent_type', { 'typenum'=>shift }
2827                            );
2828                            $agent_type ? $agent_type->atype : '';
2829                          },
2830   },
2831
2832   {
2833     'key'         => 'selfservice-agent_login',
2834     'section'     => 'self-service',
2835     'description' => 'Allow agent login via self-service.',
2836     'type'        => 'checkbox',
2837   },
2838
2839   {
2840     'key'         => 'selfservice-self_suspend_reason',
2841     'section'     => 'self-service',
2842     'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
2843     'type'        => 'select-sub',
2844     'options_sub' => sub { require FS::Record;
2845                            require FS::reason;
2846                            my $type = qsearchs('reason_type', 
2847                              { class => 'S' }) 
2848                               or return ();
2849                            map { $_->reasonnum => $_->reason }
2850                                FS::Record::qsearch('reason', 
2851                                  { reason_type => $type->typenum } 
2852                                );
2853                          },
2854     'option_sub'  => sub { require FS::Record;
2855                            require FS::reason;
2856                            my $reason = FS::Record::qsearchs(
2857                              'reason', { 'reasonnum' => shift }
2858                            );
2859                            $reason ? $reason->reason : '';
2860                          },
2861
2862     'per_agent'   => 1,
2863   },
2864
2865   {
2866     'key'         => 'card_refund-days',
2867     'section'     => 'billing',
2868     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
2869     'type'        => 'text',
2870   },
2871
2872   {
2873     'key'         => 'agent-showpasswords',
2874     'section'     => '',
2875     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
2876     'type'        => 'checkbox',
2877   },
2878
2879   {
2880     'key'         => 'global_unique-username',
2881     'section'     => 'username',
2882     'description' => 'Global username uniqueness control: none (usual setting - check uniqueness per exports), username (all usernames are globally unique, regardless of domain or exports), or username@domain (all username@domain pairs are globally unique, regardless of exports).  disabled turns off duplicate checking completely and is STRONGLY NOT RECOMMENDED unless you REALLY need to turn this off.',
2883     'type'        => 'select',
2884     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
2885   },
2886
2887   {
2888     'key'         => 'global_unique-phonenum',
2889     'section'     => '',
2890     'description' => 'Global phone number uniqueness control: none (usual setting - check countrycode+phonenumun uniqueness per exports), or countrycode+phonenum (all countrycode+phonenum pairs are globally unique, regardless of exports).  disabled turns off duplicate checking completely and is STRONGLY NOT RECOMMENDED unless you REALLY need to turn this off.',
2891     'type'        => 'select',
2892     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
2893   },
2894
2895   {
2896     'key'         => 'global_unique-pbx_title',
2897     'section'     => '',
2898     'description' => 'Global phone number uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2899     'type'        => 'select',
2900     'select_enum' => [ 'enabled', 'disabled' ],
2901   },
2902
2903   {
2904     'key'         => 'global_unique-pbx_id',
2905     'section'     => '',
2906     'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2907     'type'        => 'select',
2908     'select_enum' => [ 'enabled', 'disabled' ],
2909   },
2910
2911   {
2912     'key'         => 'svc_external-skip_manual',
2913     'section'     => 'UI',
2914     'description' => 'When provisioning svc_external services, skip manual entry of id and title fields in the UI.  Usually used in conjunction with an export that populates these fields (i.e. artera_turbo).',
2915     'type'        => 'checkbox',
2916   },
2917
2918   {
2919     'key'         => 'svc_external-display_type',
2920     'section'     => 'UI',
2921     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
2922     'type'        => 'select',
2923     'select_enum' => [ 'generic', 'artera_turbo', ],
2924   },
2925
2926   {
2927     'key'         => 'ticket_system',
2928     'section'     => 'ticketing',
2929     'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
2930     'type'        => 'select',
2931     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
2932     'select_enum' => [ '', qw(RT_Internal RT_External) ],
2933   },
2934
2935   {
2936     'key'         => 'network_monitoring_system',
2937     'section'     => 'network_monitoring',
2938     'description' => 'Networking monitoring system (NMS) integration.  <b>Torrus_Internal</b> uses the built-in Torrus ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Torrus_Installation">integrated networking monitoring system installation instructions</a>).',
2939     'type'        => 'select',
2940     'select_enum' => [ '', qw(Torrus_Internal) ],
2941   },
2942
2943   {
2944     'key'         => 'nms-auto_add-svc_ips',
2945     'section'     => 'network_monitoring',
2946     'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
2947     'type'        => 'selectmultiple',
2948     'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
2949   },
2950
2951   {
2952     'key'         => 'nms-auto_add-community',
2953     'section'     => 'network_monitoring',
2954     'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
2955     'type'        => 'text',
2956   },
2957
2958   {
2959     'key'         => 'ticket_system-default_queueid',
2960     'section'     => 'ticketing',
2961     'description' => 'Default queue used when creating new customer tickets.',
2962     'type'        => 'select-sub',
2963     'options_sub' => sub {
2964                            my $conf = new FS::Conf;
2965                            if ( $conf->config('ticket_system') ) {
2966                              eval "use FS::TicketSystem;";
2967                              die $@ if $@;
2968                              FS::TicketSystem->queues();
2969                            } else {
2970                              ();
2971                            }
2972                          },
2973     'option_sub'  => sub { 
2974                            my $conf = new FS::Conf;
2975                            if ( $conf->config('ticket_system') ) {
2976                              eval "use FS::TicketSystem;";
2977                              die $@ if $@;
2978                              FS::TicketSystem->queue(shift);
2979                            } else {
2980                              '';
2981                            }
2982                          },
2983   },
2984   {
2985     'key'         => 'ticket_system-force_default_queueid',
2986     'section'     => 'ticketing',
2987     'description' => 'Disallow queue selection when creating new tickets from customer view.',
2988     'type'        => 'checkbox',
2989   },
2990   {
2991     'key'         => 'ticket_system-selfservice_queueid',
2992     'section'     => 'ticketing',
2993     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
2994     #false laziness w/above
2995     'type'        => 'select-sub',
2996     'options_sub' => sub {
2997                            my $conf = new FS::Conf;
2998                            if ( $conf->config('ticket_system') ) {
2999                              eval "use FS::TicketSystem;";
3000                              die $@ if $@;
3001                              FS::TicketSystem->queues();
3002                            } else {
3003                              ();
3004                            }
3005                          },
3006     'option_sub'  => sub { 
3007                            my $conf = new FS::Conf;
3008                            if ( $conf->config('ticket_system') ) {
3009                              eval "use FS::TicketSystem;";
3010                              die $@ if $@;
3011                              FS::TicketSystem->queue(shift);
3012                            } else {
3013                              '';
3014                            }
3015                          },
3016   },
3017
3018   {
3019     'key'         => 'ticket_system-requestor',
3020     'section'     => 'ticketing',
3021     'description' => 'Email address to use as the requestor for new tickets.  If blank, the customer\'s invoicing address(es) will be used.',
3022     'type'        => 'text',
3023   },
3024
3025   {
3026     'key'         => 'ticket_system-priority_reverse',
3027     'section'     => 'ticketing',
3028     'description' => 'Enable this to consider lower numbered priorities more important.  A bad habit we picked up somewhere.  You probably want to avoid it and use the default.',
3029     'type'        => 'checkbox',
3030   },
3031
3032   {
3033     'key'         => 'ticket_system-custom_priority_field',
3034     'section'     => 'ticketing',
3035     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
3036     'type'        => 'text',
3037   },
3038
3039   {
3040     'key'         => 'ticket_system-custom_priority_field-values',
3041     'section'     => 'ticketing',
3042     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
3043     'type'        => 'textarea',
3044   },
3045
3046   {
3047     'key'         => 'ticket_system-custom_priority_field_queue',
3048     'section'     => 'ticketing',
3049     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
3050     'type'        => 'text',
3051   },
3052
3053   {
3054     'key'         => 'ticket_system-selfservice_priority_field',
3055     'section'     => 'ticketing',
3056     'description' => 'Custom field from the ticket system to use as a customer-managed priority field.',
3057     'type'        => 'text',
3058   },
3059
3060   {
3061     'key'         => 'ticket_system-selfservice_edit_subject',
3062     'section'     => 'ticketing',
3063     'description' => 'Allow customers to edit ticket subjects through selfservice.',
3064     'type'        => 'checkbox',
3065   },
3066
3067   {
3068     'key'         => 'ticket_system-escalation',
3069     'section'     => 'ticketing',
3070     'description' => 'Enable priority escalation of tickets as part of daily batch processing.',
3071     'type'        => 'checkbox',
3072   },
3073
3074   {
3075     'key'         => 'ticket_system-rt_external_datasrc',
3076     'section'     => 'ticketing',
3077     'description' => 'With external RT integration, the DBI data source for the external RT installation, for example, <code>DBI:Pg:user=rt_user;password=rt_word;host=rt.example.com;dbname=rt</code>',
3078     'type'        => 'text',
3079
3080   },
3081
3082   {
3083     'key'         => 'ticket_system-rt_external_url',
3084     'section'     => 'ticketing',
3085     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
3086     'type'        => 'text',
3087   },
3088
3089   {
3090     'key'         => 'company_name',
3091     'section'     => 'required',
3092     'description' => 'Your company name',
3093     'type'        => 'text',
3094     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
3095   },
3096
3097   {
3098     'key'         => 'company_url',
3099     'section'     => 'UI',
3100     'description' => 'Your company URL',
3101     'type'        => 'text',
3102     'per_agent'   => 1,
3103   },
3104
3105   {
3106     'key'         => 'company_address',
3107     'section'     => 'required',
3108     'description' => 'Your company address',
3109     'type'        => 'textarea',
3110     'per_agent'   => 1,
3111   },
3112
3113   {
3114     'key'         => 'company_phonenum',
3115     'section'     => 'notification',
3116     'description' => 'Your company phone number',
3117     'type'        => 'text',
3118     'per_agent'   => 1,
3119   },
3120
3121   {
3122     'key'         => 'echeck-void',
3123     'section'     => 'deprecated',
3124     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of echeck payments in addition to refunds against the payment gateway',
3125     'type'        => 'checkbox',
3126   },
3127
3128   {
3129     'key'         => 'cc-void',
3130     'section'     => 'deprecated',
3131     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of credit card payments in addition to refunds against the payment gateway',
3132     'type'        => 'checkbox',
3133   },
3134
3135   {
3136     'key'         => 'unvoid',
3137     'section'     => 'deprecated',
3138     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
3139     'type'        => 'checkbox',
3140   },
3141
3142   {
3143     'key'         => 'address1-search',
3144     'section'     => 'UI',
3145     'description' => 'Enable the ability to search the address1 field from the quick customer search.  Not recommended in most cases as it tends to bring up too many search results - use explicit address searching from the advanced customer search instead.',
3146     'type'        => 'checkbox',
3147   },
3148
3149   {
3150     'key'         => 'address2-search',
3151     'section'     => 'UI',
3152     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
3153     'type'        => 'checkbox',
3154   },
3155
3156   {
3157     'key'         => 'cust_main-require_address2',
3158     'section'     => 'UI',
3159     'description' => 'Second address field is required (on service address only, if billing and service addresses differ).  Also enables "Unit" labeling of address2 on customer view and edit pages.  Useful for multi-tenant applications.  See also: address2-search',
3160     'type'        => 'checkbox',
3161   },
3162
3163   {
3164     'key'         => 'agent-ship_address',
3165     'section'     => '',
3166     'description' => "Use the agent's master service address as the service address (only ship_address2 can be entered, if blank on the master address).  Useful for multi-tenant applications.",
3167     'type'        => 'checkbox',
3168     'per_agent'   => 1,
3169   },
3170
3171   { 'key'         => 'referral_credit',
3172     'section'     => 'deprecated',
3173     'description' => "Used to enable one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).  Replace with a billing event on appropriate packages.",
3174     'type'        => 'checkbox',
3175   },
3176
3177   { 'key'         => 'selfservice_server-cache_module',
3178     'section'     => 'self-service',
3179     'description' => 'Module used to store self-service session information.  All modules handle any number of self-service servers.  Cache::SharedMemoryCache is appropriate for a single database / single Freeside server.  Cache::FileCache is useful for multiple databases on a single server, or when IPC::ShareLite is not available (i.e. FreeBSD).', #  _Database stores session information in the database and is appropriate for multiple Freeside servers, but may be slower.',
3180     'type'        => 'select',
3181     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
3182   },
3183
3184   {
3185     'key'         => 'hylafax',
3186     'section'     => 'billing',
3187     'description' => 'Options for a HylaFAX server to enable the FAX invoice destination.  They should be in the form of a space separated list of arguments to the Fax::Hylafax::Client::sendfax subroutine.  You probably shouldn\'t override things like \'docfile\'.  *Note* Only supported when using typeset invoices (see the invoice_latex configuration option).',
3188     'type'        => [qw( checkbox textarea )],
3189   },
3190
3191   {
3192     'key'         => 'cust_bill-ftpformat',
3193     'section'     => 'invoicing',
3194     'description' => 'Enable FTP of raw invoice data - format.',
3195     'type'        => 'select',
3196     'options'     => [ spool_formats() ],
3197   },
3198
3199   {
3200     'key'         => 'cust_bill-ftpserver',
3201     'section'     => 'invoicing',
3202     'description' => 'Enable FTP of raw invoice data - server.',
3203     'type'        => 'text',
3204   },
3205
3206   {
3207     'key'         => 'cust_bill-ftpusername',
3208     'section'     => 'invoicing',
3209     'description' => 'Enable FTP of raw invoice data - server.',
3210     'type'        => 'text',
3211   },
3212
3213   {
3214     'key'         => 'cust_bill-ftppassword',
3215     'section'     => 'invoicing',
3216     'description' => 'Enable FTP of raw invoice data - server.',
3217     'type'        => 'text',
3218   },
3219
3220   {
3221     'key'         => 'cust_bill-ftpdir',
3222     'section'     => 'invoicing',
3223     'description' => 'Enable FTP of raw invoice data - server.',
3224     'type'        => 'text',
3225   },
3226
3227   {
3228     'key'         => 'cust_bill-spoolformat',
3229     'section'     => 'invoicing',
3230     'description' => 'Enable spooling of raw invoice data - format.',
3231     'type'        => 'select',
3232     'options'     => [ spool_formats() ],
3233   },
3234
3235   {
3236     'key'         => 'cust_bill-spoolagent',
3237     'section'     => 'invoicing',
3238     'description' => 'Enable per-agent spooling of raw invoice data.',
3239     'type'        => 'checkbox',
3240   },
3241
3242   {
3243     'key'         => 'bridgestone-batch_counter',
3244     'section'     => '',
3245     'description' => 'Batch counter for spool files.  Increments every time a spool file is uploaded.',
3246     'type'        => 'text',
3247     'per_agent'   => 1,
3248   },
3249
3250   {
3251     'key'         => 'bridgestone-prefix',
3252     'section'     => '',
3253     'description' => 'Agent identifier for uploading to BABT printing service.',
3254     'type'        => 'text',
3255     'per_agent'   => 1,
3256   },
3257
3258   {
3259     'key'         => 'bridgestone-confirm_template',
3260     'section'     => '',
3261     'description' => 'Confirmation email template for uploading to BABT service.  Text::Template format, with variables "$zipfile" (name of the zipped file), "$seq" (sequence number), "$prefix" (user ID string), and "$rows" (number of records in the file).  Should include Subject: and To: headers, separated from the rest of the message by a blank line.',
3262     # this could use a true message template, but it's hard to see how that
3263     # would make the world a better place
3264     'type'        => 'textarea',
3265     'per_agent'   => 1,
3266   },
3267
3268   {
3269     'key'         => 'ics-confirm_template',
3270     'section'     => '',
3271     'description' => 'Confirmation email template for uploading to ICS invoice printing.  Text::Template format, with variables "%count" and "%sum".',
3272     'type'        => 'textarea',
3273     'per_agent'   => 1,
3274   },
3275
3276   {
3277     'key'         => 'svc_acct-usage_suspend',
3278     'section'     => 'billing',
3279     'description' => 'Suspends the package an account belongs to when svc_acct.seconds or a bytecount is decremented to 0 or below (accounts with an empty seconds and up|down|totalbytes value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
3280     'type'        => 'checkbox',
3281   },
3282
3283   {
3284     'key'         => 'svc_acct-usage_unsuspend',
3285     'section'     => 'billing',
3286     'description' => 'Unuspends the package an account belongs to when svc_acct.seconds or a bytecount is incremented from 0 or below to a positive value (accounts with an empty seconds and up|down|totalbytes value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
3287     'type'        => 'checkbox',
3288   },
3289
3290   {
3291     'key'         => 'svc_acct-usage_threshold',
3292     'section'     => 'billing',
3293     'description' => 'The threshold (expressed as percentage) of acct.seconds or acct.up|down|totalbytes at which a warning message is sent to a service holder.  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
3294     'type'        => 'text',
3295   },
3296
3297   {
3298     'key'         => 'overlimit_groups',
3299     'section'     => '',
3300     'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.',
3301     'type'        => 'select-sub',
3302     'per_agent'   => 1,
3303     'multiple'    => 1,
3304     'options_sub' => sub { require FS::Record;
3305                            require FS::radius_group;
3306                            map { $_->groupnum => $_->long_description }
3307                                FS::Record::qsearch('radius_group', {} );
3308                          },
3309     'option_sub'  => sub { require FS::Record;
3310                            require FS::radius_group;
3311                            my $radius_group = FS::Record::qsearchs(
3312                              'radius_group', { 'groupnum' => shift }
3313                            );
3314                $radius_group ? $radius_group->long_description : '';
3315                          },
3316   },
3317
3318   {
3319     'key'         => 'cust-fields',
3320     'section'     => 'UI',
3321     'description' => 'Which customer fields to display on reports by default',
3322     'type'        => 'select',
3323     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
3324   },
3325
3326   {
3327     'key'         => 'cust_location-label_prefix',
3328     'section'     => 'UI',
3329     'description' => 'Optional "site ID" to show in the location label',
3330     'type'        => 'select',
3331     'select_hash' => [ '' => '',
3332                        'CoStAg' => 'CoStAgXXXXX (country, state, agent name, locationnum)',
3333                       ],
3334   },
3335
3336   {
3337     'key'         => 'cust_pkg-display_times',
3338     'section'     => 'UI',
3339     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
3340     'type'        => 'checkbox',
3341   },
3342
3343   {
3344     'key'         => 'cust_pkg-always_show_location',
3345     'section'     => 'UI',
3346     'description' => "Always display package locations, even when they're all the default service address.",
3347     'type'        => 'checkbox',
3348   },
3349
3350   {
3351     'key'         => 'cust_pkg-group_by_location',
3352     'section'     => 'UI',
3353     'description' => "Group packages by location.",
3354     'type'        => 'checkbox',
3355   },
3356
3357   {
3358     'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
3359     'section'     => 'UI',
3360     'description' => "Show fields on package definitions for FCC Form 477 classification",
3361     'type'        => 'checkbox',
3362   },
3363
3364   {
3365     'key'         => 'cust_pkg-large_pkg_size',
3366     'section'     => 'UI',
3367     'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
3368     'type'        => 'text',
3369   },
3370
3371   {
3372     'key'         => 'svc_acct-edit_uid',
3373     'section'     => 'shell',
3374     'description' => 'Allow UID editing.',
3375     'type'        => 'checkbox',
3376   },
3377
3378   {
3379     'key'         => 'svc_acct-edit_gid',
3380     'section'     => 'shell',
3381     'description' => 'Allow GID editing.',
3382     'type'        => 'checkbox',
3383   },
3384
3385   {
3386     'key'         => 'svc_acct-no_edit_username',
3387     'section'     => 'shell',
3388     'description' => 'Disallow username editing.',
3389     'type'        => 'checkbox',
3390   },
3391
3392   {
3393     'key'         => 'zone-underscore',
3394     'section'     => 'BIND',
3395     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
3396     'type'        => 'checkbox',
3397   },
3398
3399   {
3400     'key'         => 'echeck-nonus',
3401     'section'     => 'billing',
3402     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
3403     'type'        => 'checkbox',
3404   },
3405
3406   {
3407     'key'         => 'echeck-country',
3408     'section'     => 'billing',
3409     'description' => 'Format electronic check information for the specified country.',
3410     'type'        => 'select',
3411     'select_hash' => [ 'US' => 'United States',
3412                        'CA' => 'Canada (enables branch)',
3413                        'XX' => 'Other',
3414                      ],
3415   },
3416
3417   {
3418     'key'         => 'voip-cust_accountcode_cdr',
3419     'section'     => 'telephony',
3420     'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
3421     'type'        => 'checkbox',
3422   },
3423
3424   {
3425     'key'         => 'voip-cust_cdr_spools',
3426     'section'     => 'telephony',
3427     'description' => 'Enable the per-customer option for individual CDR spools.',
3428     'type'        => 'checkbox',
3429   },
3430
3431   {
3432     'key'         => 'voip-cust_cdr_squelch',
3433     'section'     => 'telephony',
3434     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
3435     'type'        => 'checkbox',
3436   },
3437
3438   {
3439     'key'         => 'voip-cdr_email',
3440     'section'     => 'telephony',
3441     'description' => 'Include the call details on emailed invoices (and HTML invoices viewed in the backend), even if the customer is configured for not printing them on the invoices.',
3442     'type'        => 'checkbox',
3443   },
3444
3445   {
3446     'key'         => 'voip-cust_email_csv_cdr',
3447     'section'     => 'telephony',
3448     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
3449     'type'        => 'checkbox',
3450   },
3451
3452   {
3453     'key'         => 'cgp_rule-domain_templates',
3454     'section'     => '',
3455     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
3456     'type'        => 'textarea',
3457   },
3458
3459   {
3460     'key'         => 'svc_forward-no_srcsvc',
3461     'section'     => '',
3462     'description' => "Don't allow forwards from existing accounts, only arbitrary addresses.  Useful when exporting to systems such as Communigate Pro which treat forwards in this fashion.",
3463     'type'        => 'checkbox',
3464   },
3465
3466   {
3467     'key'         => 'svc_forward-arbitrary_dst',
3468     'section'     => '',
3469     'description' => "Allow forwards to point to arbitrary strings that don't necessarily look like email addresses.  Only used when using forwards for weird, non-email things.",
3470     'type'        => 'checkbox',
3471   },
3472
3473   {
3474     'key'         => 'tax-ship_address',
3475     'section'     => 'billing',
3476     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
3477     'type'        => 'checkbox',
3478   }
3479 ,
3480   {
3481     'key'         => 'tax-pkg_address',
3482     'section'     => 'billing',
3483     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the package address instead (when present).',
3484     'type'        => 'checkbox',
3485   },
3486
3487   {
3488     'key'         => 'invoice-ship_address',
3489     'section'     => 'invoicing',
3490     'description' => 'Include the shipping address on invoices.',
3491     'type'        => 'checkbox',
3492   },
3493
3494   {
3495     'key'         => 'invoice-unitprice',
3496     'section'     => 'invoicing',
3497     'description' => 'Enable unit pricing on invoices and quantities on packages.',
3498     'type'        => 'checkbox',
3499   },
3500
3501   {
3502     'key'         => 'invoice-smallernotes',
3503     'section'     => 'invoicing',
3504     'description' => 'Display the notes section in a smaller font on invoices.',
3505     'type'        => 'checkbox',
3506   },
3507
3508   {
3509     'key'         => 'invoice-smallerfooter',
3510     'section'     => 'invoicing',
3511     'description' => 'Display footers in a smaller font on invoices.',
3512     'type'        => 'checkbox',
3513   },
3514
3515   {
3516     'key'         => 'postal_invoice-fee_pkgpart',
3517     'section'     => 'billing',
3518     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
3519     'type'        => 'select-part_pkg',
3520     'per_agent'   => 1,
3521   },
3522
3523   {
3524     'key'         => 'postal_invoice-recurring_only',
3525     'section'     => 'billing',
3526     'description' => 'The postal invoice fee is omitted on invoices without recurring charges when this is set.',
3527     'type'        => 'checkbox',
3528   },
3529
3530   {
3531     'key'         => 'batch-enable',
3532     'section'     => 'deprecated', #make sure batch-enable_payby is set for
3533                                    #everyone before removing
3534     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
3535     'type'        => 'checkbox',
3536   },
3537
3538   {
3539     'key'         => 'batch-enable_payby',
3540     'section'     => 'billing',
3541     'description' => 'Enable batch processing for the specified payment types.',
3542     'type'        => 'selectmultiple',
3543     'select_enum' => [qw( CARD CHEK )],
3544   },
3545
3546   {
3547     'key'         => 'realtime-disable_payby',
3548     'section'     => 'billing',
3549     'description' => 'Disable realtime processing for the specified payment types.',
3550     'type'        => 'selectmultiple',
3551     'select_enum' => [qw( CARD CHEK )],
3552   },
3553
3554   {
3555     'key'         => 'batch-default_format',
3556     'section'     => 'billing',
3557     'description' => 'Default format for batches.',
3558     'type'        => 'select',
3559     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch',
3560                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
3561                        'paymentech', 'ach-spiritone', 'RBC'
3562                     ]
3563   },
3564
3565   { 'key'         => 'batch-gateway-CARD',
3566     'section'     => 'billing',
3567     'description' => 'Business::BatchPayment gateway for credit card batches.',
3568     %batch_gateway_options,
3569   },
3570
3571   { 'key'         => 'batch-gateway-CHEK',
3572     'section'     => 'billing', 
3573     'description' => 'Business::BatchPayment gateway for check batches.',
3574     %batch_gateway_options,
3575   },
3576
3577   {
3578     'key'         => 'batch-reconsider',
3579     'section'     => 'billing',
3580     'description' => 'Allow imported batch results to change the status of payments from previous imports.  Enable this only if your gateway is known to send both positive and negative results for the same batch.',
3581     'type'        => 'checkbox',
3582   },
3583
3584   {
3585     'key'         => 'batch-auto_resolve_days',
3586     'section'     => 'billing',
3587     'description' => 'Automatically resolve payment batches this many days after they were first downloaded.',
3588     'type'        => 'text',
3589   },
3590
3591   {
3592     'key'         => 'batch-auto_resolve_status',
3593     'section'     => 'billing',
3594     'description' => 'When automatically resolving payment batches, take this action for payments of unknown status.',
3595     'type'        => 'select',
3596     'select_enum' => [ 'approve', 'decline' ],
3597   },
3598
3599   {
3600     'key'         => 'batch-errors_to',
3601     'section'     => 'billing',
3602     'description' => 'Email errors when processing batches to this address.  If unspecified, batch processing will stop immediately on error.',
3603     'type'        => 'text',
3604   },
3605
3606   #lists could be auto-generated from pay_batch info
3607   {
3608     'key'         => 'batch-fixed_format-CARD',
3609     'section'     => 'billing',
3610     'description' => 'Fixed (unchangeable) format for credit card batches.',
3611     'type'        => 'select',
3612     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
3613                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
3614   },
3615
3616   {
3617     'key'         => 'batch-fixed_format-CHEK',
3618     'section'     => 'billing',
3619     'description' => 'Fixed (unchangeable) format for electronic check batches.',
3620     'type'        => 'select',
3621     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'BoM',
3622                        'PAP', 'paymentech', 'ach-spiritone', 'RBC',
3623                        'td_eft1464', 'eft_canada'
3624                      ]
3625   },
3626
3627   {
3628     'key'         => 'batch-increment_expiration',
3629     'section'     => 'billing',
3630     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
3631     'type'        => 'checkbox'
3632   },
3633
3634   {
3635     'key'         => 'batchconfig-BoM',
3636     'section'     => 'billing',
3637     'description' => 'Configuration for Bank of Montreal batching, seven lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Long name, 6. Bank, 7. Bank account',
3638     'type'        => 'textarea',
3639   },
3640
3641   {
3642     'key'         => 'batchconfig-PAP',
3643     'section'     => 'billing',
3644     'description' => 'Configuration for PAP batching, seven lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Long name, 6. Bank, 7. Bank account',
3645     'type'        => 'textarea',
3646   },
3647
3648   {
3649     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
3650     'section'     => 'billing',
3651     'description' => 'Gateway ID for Chase Canada E-xact batching',
3652     'type'        => 'text',
3653   },
3654
3655   {
3656     'key'         => 'batchconfig-paymentech',
3657     'section'     => 'billing',
3658     'description' => 'Configuration for Chase Paymentech batching, six lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username, 5. Password (for batch uploads), 6. Flag to send recurring indicator.',
3659     'type'        => 'textarea',
3660   },
3661
3662   {
3663     'key'         => 'batchconfig-RBC',
3664     'section'     => 'billing',
3665     'description' => 'Configuration for Royal Bank of Canada PDS batching, four lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code.',
3666     'type'        => 'textarea',
3667   },
3668
3669   {
3670     'key'         => 'batchconfig-td_eft1464',
3671     'section'     => 'billing',
3672     'description' => 'Configuration for TD Bank EFT1464 batching, seven lines: 1. Originator ID, 2. Datacenter Code, 3. Short name, 4. Long name, 5. Returned payment branch number, 6. Returned payment account, 7. Transaction code.',
3673     'type'        => 'textarea',
3674   },
3675
3676   {
3677     'key'         => 'batchconfig-eft_canada',
3678     'section'     => 'billing',
3679     'description' => 'Configuration for EFT Canada batching, four lines: 1. SFTP username, 2. SFTP password, 3. Transaction code, 4. Number of days to delay process date.',
3680     'type'        => 'textarea',
3681     'per_agent'   => 1,
3682   },
3683
3684   {
3685     'key'         => 'batchconfig-nacha-destination',
3686     'section'     => 'billing',
3687     'description' => 'Configuration for NACHA batching, Destination (9 digit transit routing number).',
3688     'type'        => 'text',
3689   },
3690
3691   {
3692     'key'         => 'batchconfig-nacha-destination_name',
3693     'section'     => 'billing',
3694     'description' => 'Configuration for NACHA batching, Destination (Bank Name, up to 23 characters).',
3695     'type'        => 'text',
3696   },
3697
3698   {
3699     'key'         => 'batchconfig-nacha-origin',
3700     'section'     => 'billing',
3701     'description' => 'Configuration for NACHA batching, Origin (your 10-digit company number, IRS tax ID recommended).',
3702     'type'        => 'text',
3703   },
3704
3705   {
3706     'key'         => 'batch-manual_approval',
3707     'section'     => 'billing',
3708     'description' => 'Allow manual batch closure, which will approve all payments that do not yet have a status.  This is not advised unless needed for specific payment processors that provide a report of rejected rather than approved payments.',
3709     'type'        => 'checkbox',
3710   },
3711
3712   {
3713     'key'         => 'batch-spoolagent',
3714     'section'     => 'billing',
3715     'description' => 'Store payment batches per-agent.',
3716     'type'        => 'checkbox',
3717   },
3718
3719   {
3720     'key'         => 'payment_history-years',
3721     'section'     => 'UI',
3722     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
3723     'type'        => 'text',
3724   },
3725
3726   {
3727     'key'         => 'change_history-years',
3728     'section'     => 'UI',
3729     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
3730     'type'        => 'text',
3731   },
3732
3733   {
3734     'key'         => 'cust_main-packages-years',
3735     'section'     => 'UI',
3736     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
3737     'type'        => 'text',
3738   },
3739
3740   {
3741     'key'         => 'cust_main-use_comments',
3742     'section'     => 'UI',
3743     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
3744     'type'        => 'checkbox',
3745   },
3746
3747   {
3748     'key'         => 'cust_main-disable_notes',
3749     'section'     => 'UI',
3750     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
3751     'type'        => 'checkbox',
3752   },
3753
3754   {
3755     'key'         => 'cust_main_note-display_times',
3756     'section'     => 'UI',
3757     'description' => 'Display full timestamps (not just dates) for customer notes.',
3758     'type'        => 'checkbox',
3759   },
3760
3761   {
3762     'key'         => 'cust_main-ticket_statuses',
3763     'section'     => 'UI',
3764     'description' => 'Show tickets with these statuses on the customer view page.',
3765     'type'        => 'selectmultiple',
3766     'select_enum' => [qw( new open stalled resolved rejected deleted )],
3767   },
3768
3769   {
3770     'key'         => 'cust_main-max_tickets',
3771     'section'     => 'UI',
3772     'description' => 'Maximum number of tickets to show on the customer view page.',
3773     'type'        => 'text',
3774   },
3775
3776   {
3777     'key'         => 'cust_main-enable_birthdate',
3778     'section'     => 'UI',
3779     'description' => 'Enable tracking of a birth date with each customer record',
3780     'type'        => 'checkbox',
3781   },
3782
3783   {
3784     'key'         => 'cust_main-enable_spouse_birthdate',
3785     'section'     => 'UI',
3786     'description' => 'Enable tracking of a spouse birth date with each customer record',
3787     'type'        => 'checkbox',
3788   },
3789
3790   {
3791     'key'         => 'cust_main-enable_anniversary_date',
3792     'section'     => 'UI',
3793     'description' => 'Enable tracking of an anniversary date with each customer record',
3794     'type'        => 'checkbox',
3795   },
3796
3797   {
3798     'key'         => 'cust_main-edit_calling_list_exempt',
3799     'section'     => 'UI',
3800     'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
3801     'type'        => 'checkbox',
3802   },
3803
3804   {
3805     'key'         => 'support-key',
3806     'section'     => '',
3807     'description' => 'A support key enables access to commercial services delivered over the network, such as the payroll module, access to the internal ticket system, priority support and optional backups.',
3808     'type'        => 'text',
3809   },
3810
3811   {
3812     'key'         => 'card-types',
3813     'section'     => 'billing',
3814     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
3815     'type'        => 'selectmultiple',
3816     'select_enum' => \@card_types,
3817   },
3818
3819   {
3820     'key'         => 'disable-fuzzy',
3821     'section'     => 'UI',
3822     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
3823     'type'        => 'checkbox',
3824   },
3825
3826   { 'key'         => 'pkg_referral',
3827     'section'     => '',
3828     'description' => 'Enable package-specific advertising sources.',
3829     'type'        => 'checkbox',
3830   },
3831
3832   { 'key'         => 'pkg_referral-multiple',
3833     'section'     => '',
3834     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
3835     'type'        => 'checkbox',
3836   },
3837
3838   {
3839     'key'         => 'dashboard-install_welcome',
3840     'section'     => 'UI',
3841     'description' => 'New install welcome screen.',
3842     'type'        => 'select',
3843     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
3844   },
3845
3846   {
3847     'key'         => 'dashboard-toplist',
3848     'section'     => 'UI',
3849     'description' => 'List of items to display on the top of the front page',
3850     'type'        => 'textarea',
3851   },
3852
3853   {
3854     'key'         => 'impending_recur_msgnum',
3855     'section'     => 'notification',
3856     'description' => 'Template to use for alerts about first-time recurring billing.',
3857     %msg_template_options,
3858   },
3859
3860   {
3861     'key'         => 'impending_recur_template',
3862     'section'     => 'deprecated',
3863     'description' => 'Template file for alerts about looming first time recurrant billing.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitition language.  Also see packages with a <a href="../browse/part_pkg.cgi">flat price plan</a>  The following variables are available<ul><li><code>$packages</code> allowing <code>$packages->[0]</code> thru <code>$packages->[n]</code> <li><code>$package</code> the first package, same as <code>$packages->[0]</code> <li><code>$recurdates</code> allowing <code>$recurdates->[0]</code> thru <code>$recurdates->[n]</code> <li><code>$recurdate</code> the first recurdate, same as <code>$recurdate->[0]</code> <li><code>$first</code> <li><code>$last</code></ul>',
3864 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
3865     'type'        => 'textarea',
3866   },
3867
3868   {
3869     'key'         => 'logo.png',
3870     'section'     => 'UI',  #'invoicing' ?
3871     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
3872     'type'        => 'image',
3873     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
3874                         #old-style editor anyway...?
3875     'per_locale'  => 1,
3876   },
3877
3878   {
3879     'key'         => 'logo.eps',
3880     'section'     => 'invoicing',
3881     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
3882     'type'        => 'image',
3883     'per_agent'   => 1, #XXX as above, kinda
3884     'per_locale'  => 1,
3885   },
3886
3887   {
3888     'key'         => 'selfservice-ignore_quantity',
3889     'section'     => 'self-service',
3890     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
3891     'type'        => 'checkbox',
3892   },
3893
3894   {
3895     'key'         => 'selfservice-session_timeout',
3896     'section'     => 'self-service',
3897     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
3898     'type'        => 'select',
3899     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
3900   },
3901
3902   {
3903     'key'         => 'disable_setup_suspended_pkgs',
3904     'section'     => 'billing',
3905     'description' => 'Disables charging of setup fees for suspended packages.',
3906     'type'        => 'checkbox',
3907   },
3908
3909   {
3910     'key'         => 'password-generated-allcaps',
3911     'section'     => 'password',
3912     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
3913     'type'        => 'checkbox',
3914   },
3915
3916   {
3917     'key'         => 'datavolume-forcemegabytes',
3918     'section'     => 'UI',
3919     'description' => 'All data volumes are expressed in megabytes',
3920     'type'        => 'checkbox',
3921   },
3922
3923   {
3924     'key'         => 'datavolume-significantdigits',
3925     'section'     => 'UI',
3926     'description' => 'number of significant digits to use to represent data volumes',
3927     'type'        => 'text',
3928   },
3929
3930   {
3931     'key'         => 'disable_void_after',
3932     'section'     => 'billing',
3933     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
3934     'type'        => 'text',
3935   },
3936
3937   {
3938     'key'         => 'disable_line_item_date_ranges',
3939     'section'     => 'billing',
3940     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
3941     'type'        => 'checkbox',
3942   },
3943
3944   {
3945     'key'         => 'cust_bill-line_item-date_style',
3946     'section'     => 'billing',
3947     'description' => 'Display format for line item date ranges on invoice line items.',
3948     'type'        => 'select',
3949     'select_hash' => [ ''           => 'STARTDATE-ENDDATE',
3950                        'month_of'   => 'Month of MONTHNAME',
3951                        'X_month'    => 'DATE_DESC MONTHNAME',
3952                      ],
3953     'per_agent'   => 1,
3954   },
3955
3956   {
3957     'key'         => 'cust_bill-line_item-date_style-non_monthly',
3958     'section'     => 'billing',
3959     'description' => 'If set, override cust_bill-line_item-date_style for non-monthly charges.',
3960     'type'        => 'select',
3961     'select_hash' => [ ''           => 'Default',
3962                        'start_end'  => 'STARTDATE-ENDDATE',
3963                        'month_of'   => 'Month of MONTHNAME',
3964                        'X_month'    => 'DATE_DESC MONTHNAME',
3965                      ],
3966     'per_agent'   => 1,
3967   },
3968
3969   {
3970     'key'         => 'cust_bill-line_item-date_description',
3971     'section'     => 'billing',
3972     'description' => 'Text to display for "DATE_DESC" when using cust_bill-line_item-date_style DATE_DESC MONTHNAME.',
3973     'type'        => 'text',
3974     'per_agent'   => 1,
3975   },
3976
3977   {
3978     'key'         => 'support_packages',
3979     'section'     => '',
3980     'description' => 'A list of packages eligible for RT ticket time transfer, one pkgpart per line.', #this should really be a select multiple, or specified in the packages themselves...
3981     'type'        => 'select-part_pkg',
3982     'multiple'    => 1,
3983   },
3984
3985   {
3986     'key'         => 'cust_main-require_phone',
3987     'section'     => '',
3988     'description' => 'Require daytime or night phone for all customer records.',
3989     'type'        => 'checkbox',
3990     'per_agent'   => 1,
3991   },
3992
3993   {
3994     'key'         => 'cust_main-require_invoicing_list_email',
3995     'section'     => '',
3996     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
3997     'type'        => 'checkbox',
3998     'per_agent'   => 1,
3999   },
4000
4001   {
4002     'key'         => 'cust_main-check_unique',
4003     'section'     => '',
4004     'description' => 'Warn before creating a customer record where these fields duplicate another customer.',
4005     'type'        => 'select',
4006     'multiple'    => 1,
4007     'select_hash' => [ 
4008       #'address1' => 'Billing address',
4009     ],
4010   },
4011
4012   {
4013     'key'         => 'svc_acct-display_paid_time_remaining',
4014     'section'     => '',
4015     'description' => 'Show paid time remaining in addition to time remaining.',
4016     'type'        => 'checkbox',
4017   },
4018
4019   {
4020     'key'         => 'cancel_credit_type',
4021     'section'     => 'billing',
4022     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
4023     reason_type_options('R'),
4024   },
4025
4026   {
4027     'key'         => 'suspend_credit_type',
4028     'section'     => 'billing',
4029     'description' => 'The group to use for new, automatically generated credit reasons resulting from package suspension.',
4030     reason_type_options('R'),
4031   },
4032
4033   {
4034     'key'         => 'referral_credit_type',
4035     'section'     => 'deprecated',
4036     'description' => 'Used to be the group to use for new, automatically generated credit reasons resulting from referrals.  Now set in a package billing event for the referral.',
4037     reason_type_options('R'),
4038   },
4039
4040   {
4041     'key'         => 'signup_credit_type',
4042     'section'     => 'billing', #self-service?
4043     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
4044     reason_type_options('R'),
4045   },
4046
4047   {
4048     'key'         => 'prepayment_discounts-credit_type',
4049     'section'     => 'billing',
4050     'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
4051     reason_type_options('R'),
4052   },
4053
4054   {
4055     'key'         => 'cust_main-agent_custid-format',
4056     'section'     => '',
4057     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
4058     'type'        => 'select',
4059     'select_hash' => [
4060                        ''       => 'Numeric only',
4061                        '\d{7}'  => 'Numeric only, exactly 7 digits',
4062                        'ww?d+'  => 'Numeric with one or two letter prefix',
4063                      ],
4064   },
4065
4066   {
4067     'key'         => 'card_masking_method',
4068     'section'     => 'UI',
4069     'description' => 'Digits to display when masking credit cards.  Note that the first six digits are necessary to canonically identify the credit card type (Visa/MC, Amex, Discover, Maestro, etc.) in all cases.  The first four digits can identify the most common credit card types in most cases (Visa/MC, Amex, and Discover).  The first two digits can distinguish between Visa/MC and Amex.  Note: You should manually remove stored paymasks if you change this value on an existing database, to avoid problems using stored cards.',
4070     'type'        => 'select',
4071     'select_hash' => [
4072                        ''            => '123456xxxxxx1234',
4073                        'first6last2' => '123456xxxxxxxx12',
4074                        'first4last4' => '1234xxxxxxxx1234',
4075                        'first4last2' => '1234xxxxxxxxxx12',
4076                        'first2last4' => '12xxxxxxxxxx1234',
4077                        'first2last2' => '12xxxxxxxxxxxx12',
4078                        'first0last4' => 'xxxxxxxxxxxx1234',
4079                        'first0last2' => 'xxxxxxxxxxxxxx12',
4080                      ],
4081   },
4082
4083   {
4084     'key'         => 'disable_previous_balance',
4085     'section'     => 'invoicing',
4086     'description' => 'Disable inclusion of previous balance, payment, and credit lines on invoices.',
4087     'type'        => 'checkbox',
4088     'per_agent'   => 1,
4089   },
4090
4091   {
4092     'key'         => 'previous_balance-exclude_from_total',
4093     'section'     => 'invoicing',
4094     'description' => 'Do not include previous balance in the \'Total\' line.  Only meaningful when invoice_sections is false.  Optionally provide text to override the Total New Charges description',
4095     'type'        => [ qw(checkbox text) ],
4096   },
4097
4098   {
4099     'key'         => 'previous_balance-summary_only',
4100     'section'     => 'invoicing',
4101     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
4102     'type'        => 'checkbox',
4103   },
4104
4105   {
4106     'key'         => 'previous_balance-show_credit',
4107     'section'     => 'invoicing',
4108     'description' => 'Show the customer\'s credit balance on invoices when applicable.',
4109     'type'        => 'checkbox',
4110   },
4111
4112   {
4113     'key'         => 'previous_balance-show_on_statements',
4114     'section'     => 'invoicing',
4115     'description' => 'Show previous invoices on statements, without itemized charges.',
4116     'type'        => 'checkbox',
4117   },
4118
4119   {
4120     'key'         => 'balance_due_below_line',
4121     'section'     => 'invoicing',
4122     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
4123     'type'        => 'checkbox',
4124   },
4125
4126   {
4127     'key'         => 'address_standardize_method',
4128     'section'     => 'UI', #???
4129     'description' => 'Method for standardizing customer addresses.',
4130     'type'        => 'select',
4131     'select_hash' => [ '' => '', 
4132                        'usps' => 'U.S. Postal Service',
4133                        'ezlocate' => 'EZLocate',
4134                      ],
4135   },
4136
4137   {
4138     'key'         => 'usps_webtools-userid',
4139     'section'     => 'UI',
4140     'description' => 'Production UserID for USPS web tools.   Enables USPS address standardization.  See the <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
4141     'type'        => 'text',
4142   },
4143
4144   {
4145     'key'         => 'usps_webtools-password',
4146     'section'     => 'UI',
4147     'description' => 'Production password for USPS web tools.   Enables USPS address standardization.  See <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
4148     'type'        => 'text',
4149   },
4150
4151   {
4152     'key'         => 'ezlocate-userid',
4153     'section'     => 'UI',
4154     'description' => 'User ID for EZ-Locate service.  See <a href="http://www.geocode.com/">the TomTom website</a> for access and pricing information.',
4155     'type'        => 'text',
4156   },
4157
4158   {
4159     'key'         => 'ezlocate-password',
4160     'section'     => 'UI',
4161     'description' => 'Password for EZ-Locate service.',
4162     'type'        => 'text'
4163   },
4164
4165   {
4166     'key'         => 'cust_main-auto_standardize_address',
4167     'section'     => 'UI',
4168     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
4169     'type'        => 'checkbox',
4170   },
4171
4172   {
4173     'key'         => 'cust_main-require_censustract',
4174     'section'     => 'UI',
4175     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
4176     'type'        => 'checkbox',
4177   },
4178
4179   {
4180     'key'         => 'census_year',
4181     'section'     => 'UI',
4182     'description' => 'The year to use in census tract lookups.  NOTE: you need to select 2012 for Year 2010 Census tract codes.  A selection of 2011 or 2010 provides Year 2000 Census tract codes.  Use the freeside-censustract-update tool if exisitng customers need to be changed.',
4183     'type'        => 'select',
4184     'select_enum' => [ qw( 2012 2011 2010 ) ],
4185   },
4186
4187   {
4188     'key'         => 'tax_district_method',
4189     'section'     => 'UI',
4190     'description' => 'The method to use to look up tax district codes.',
4191     'type'        => 'select',
4192     #'select_hash' => [ FS::Misc::Geo::get_district_methods() ],
4193     #after RT#13763, using FS::Misc::Geo here now causes a dependancy loop :/
4194     'select_hash' => [
4195                        ''         => '',
4196                        'wa_sales' => 'Washington sales tax',
4197                      ],
4198   },
4199
4200   {
4201     'key'         => 'company_latitude',
4202     'section'     => 'UI',
4203     'description' => 'Your company latitude (-90 through 90)',
4204     'type'        => 'text',
4205   },
4206
4207   {
4208     'key'         => 'company_longitude',
4209     'section'     => 'UI',
4210     'description' => 'Your company longitude (-180 thru 180)',
4211     'type'        => 'text',
4212   },
4213
4214   {
4215     'key'         => 'geocode_module',
4216     'section'     => '',
4217     'description' => 'Module to geocode (retrieve a latitude and longitude for) addresses',
4218     'type'        => 'select',
4219     'select_enum' => [ 'Geo::Coder::Googlev3' ],
4220   },
4221
4222   {
4223     'key'         => 'geocode-require_nw_coordinates',
4224     'section'     => 'UI',
4225     'description' => 'Require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
4226     'type'        => 'checkbox',
4227   },
4228
4229   {
4230     'key'         => 'disable_acl_changes',
4231     'section'     => '',
4232     'description' => 'Disable all ACL changes, for demos.',
4233     'type'        => 'checkbox',
4234   },
4235
4236   {
4237     'key'         => 'disable_settings_changes',
4238     'section'     => '',
4239     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
4240     'type'        => [qw( checkbox text )],
4241   },
4242
4243   {
4244     'key'         => 'cust_main-edit_agent_custid',
4245     'section'     => 'UI',
4246     'description' => 'Enable editing of the agent_custid field.',
4247     'type'        => 'checkbox',
4248   },
4249
4250   {
4251     'key'         => 'cust_main-default_agent_custid',
4252     'section'     => 'UI',
4253     'description' => 'Display the agent_custid field when available instead of the custnum field.',
4254     'type'        => 'checkbox',
4255   },
4256
4257   {
4258     'key'         => 'cust_main-title-display_custnum',
4259     'section'     => 'UI',
4260     'description' => 'Add the display_custom (agent_custid or custnum) to the title on customer view pages.',
4261     'type'        => 'checkbox',
4262   },
4263
4264   {
4265     'key'         => 'cust_bill-default_agent_invid',
4266     'section'     => 'UI',
4267     'description' => 'Display the agent_invid field when available instead of the invnum field.',
4268     'type'        => 'checkbox',
4269   },
4270
4271   {
4272     'key'         => 'cust_main-auto_agent_custid',
4273     'section'     => 'UI',
4274     'description' => 'Automatically assign an agent_custid - select format',
4275     'type'        => 'select',
4276     'select_hash' => [ '' => 'No',
4277                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
4278                      ],
4279   },
4280
4281   {
4282     'key'         => 'cust_main-custnum-display_prefix',
4283     'section'     => 'UI',
4284     'description' => 'Prefix the customer number with this string for display purposes.',
4285     'type'        => 'text',
4286     'per_agent'   => 1,
4287   },
4288
4289   {
4290     'key'         => 'cust_main-custnum-display_special',
4291     'section'     => 'UI',
4292     'description' => 'Use this customer number prefix format',
4293     'type'        => 'select',
4294     'select_hash' => [ '' => '',
4295                        'CoStAg' => 'CoStAg (country, state, agent name or display_prefix)',
4296                        'CoStCl' => 'CoStCl (country, state, class name)' ],
4297   },
4298
4299   {
4300     'key'         => 'cust_main-custnum-display_length',
4301     'section'     => 'UI',
4302     'description' => 'Zero fill the customer number to this many digits for display purposes.',
4303     'type'        => 'text',
4304   },
4305
4306   {
4307     'key'         => 'cust_main-default_areacode',
4308     'section'     => 'UI',
4309     'description' => 'Default area code for customers.',
4310     'type'        => 'text',
4311   },
4312
4313   {
4314     'key'         => 'order_pkg-no_start_date',
4315     'section'     => 'UI',
4316     'description' => 'Don\'t set a default start date for new packages.',
4317     'type'        => 'checkbox',
4318   },
4319
4320   {
4321     'key'         => 'mcp_svcpart',
4322     'section'     => '',
4323     'description' => 'Master Control Program svcpart.  Leave this blank.',
4324     'type'        => 'text', #select-part_svc
4325   },
4326
4327   {
4328     'key'         => 'cust_bill-max_same_services',
4329     'section'     => 'invoicing',
4330     'description' => 'Maximum number of the same service to list individually on invoices before condensing to a single line listing the number of services.  Defaults to 5.',
4331     'type'        => 'text',
4332   },
4333
4334   {
4335     'key'         => 'cust_bill-consolidate_services',
4336     'section'     => 'invoicing',
4337     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
4338     'type'        => 'checkbox',
4339   },
4340
4341   {
4342     'key'         => 'suspend_email_admin',
4343     'section'     => '',
4344     'description' => 'Destination admin email address to enable suspension notices',
4345     'type'        => 'text',
4346   },
4347
4348   {
4349     'key'         => 'unsuspend_email_admin',
4350     'section'     => '',
4351     'description' => 'Destination admin email address to enable unsuspension notices',
4352     'type'        => 'text',
4353   },
4354   
4355   {
4356     'key'         => 'email_report-subject',
4357     'section'     => '',
4358     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
4359     'type'        => 'text',
4360   },
4361
4362   {
4363     'key'         => 'selfservice-head',
4364     'section'     => 'self-service',
4365     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
4366     'type'        => 'textarea', #htmlarea?
4367     'per_agent'   => 1,
4368   },
4369
4370
4371   {
4372     'key'         => 'selfservice-body_header',
4373     'section'     => 'self-service',
4374     'description' => 'HTML header for the self-service interface',
4375     'type'        => 'textarea', #htmlarea?
4376     'per_agent'   => 1,
4377   },
4378
4379   {
4380     'key'         => 'selfservice-body_footer',
4381     'section'     => 'self-service',
4382     'description' => 'HTML footer for the self-service interface',
4383     'type'        => 'textarea', #htmlarea?
4384     'per_agent'   => 1,
4385   },
4386
4387
4388   {
4389     'key'         => 'selfservice-body_bgcolor',
4390     'section'     => 'self-service',
4391     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
4392     'type'        => 'text',
4393     'per_agent'   => 1,
4394   },
4395
4396   {
4397     'key'         => 'selfservice-box_bgcolor',
4398     'section'     => 'self-service',
4399     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
4400     'type'        => 'text',
4401     'per_agent'   => 1,
4402   },
4403
4404   {
4405     'key'         => 'selfservice-stripe1_bgcolor',
4406     'section'     => 'self-service',
4407     'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF',
4408     'type'        => 'text',
4409     'per_agent'   => 1,
4410   },
4411
4412   {
4413     'key'         => 'selfservice-stripe2_bgcolor',
4414     'section'     => 'self-service',
4415     'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD',
4416     'type'        => 'text',
4417     'per_agent'   => 1,
4418   },
4419
4420   {
4421     'key'         => 'selfservice-text_color',
4422     'section'     => 'self-service',
4423     'description' => 'HTML text color for the self-service interface, for example, #000000',
4424     'type'        => 'text',
4425     'per_agent'   => 1,
4426   },
4427
4428   {
4429     'key'         => 'selfservice-link_color',
4430     'section'     => 'self-service',
4431     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
4432     'type'        => 'text',
4433     'per_agent'   => 1,
4434   },
4435
4436   {
4437     'key'         => 'selfservice-vlink_color',
4438     'section'     => 'self-service',
4439     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
4440     'type'        => 'text',
4441     'per_agent'   => 1,
4442   },
4443
4444   {
4445     'key'         => 'selfservice-hlink_color',
4446     'section'     => 'self-service',
4447     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
4448     'type'        => 'text',
4449     'per_agent'   => 1,
4450   },
4451
4452   {
4453     'key'         => 'selfservice-alink_color',
4454     'section'     => 'self-service',
4455     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
4456     'type'        => 'text',
4457     'per_agent'   => 1,
4458   },
4459
4460   {
4461     'key'         => 'selfservice-font',
4462     'section'     => 'self-service',
4463     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
4464     'type'        => 'text',
4465     'per_agent'   => 1,
4466   },
4467
4468   {
4469     'key'         => 'selfservice-no_logo',
4470     'section'     => 'self-service',
4471     'description' => 'Disable the logo in self-service',
4472     'type'        => 'checkbox',
4473     'per_agent'   => 1,
4474   },
4475
4476   {
4477     'key'         => 'selfservice-title_color',
4478     'section'     => 'self-service',
4479     'description' => 'HTML color for the self-service title, for example, #000000',
4480     'type'        => 'text',
4481     'per_agent'   => 1,
4482   },
4483
4484   {
4485     'key'         => 'selfservice-title_align',
4486     'section'     => 'self-service',
4487     'description' => 'HTML alignment for the self-service title, for example, center',
4488     'type'        => 'text',
4489     'per_agent'   => 1,
4490   },
4491   {
4492     'key'         => 'selfservice-title_size',
4493     'section'     => 'self-service',
4494     'description' => 'HTML font size for the self-service title, for example, 3',
4495     'type'        => 'text',
4496     'per_agent'   => 1,
4497   },
4498
4499   {
4500     'key'         => 'selfservice-title_left_image',
4501     'section'     => 'self-service',
4502     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4503     'type'        => 'image',
4504     'per_agent'   => 1,
4505   },
4506
4507   {
4508     'key'         => 'selfservice-title_right_image',
4509     'section'     => 'self-service',
4510     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4511     'type'        => 'image',
4512     'per_agent'   => 1,
4513   },
4514
4515   {
4516     'key'         => 'selfservice-menu_disable',
4517     'section'     => 'self-service',
4518     'description' => 'Disable the selected menu entries in the self-service menu',
4519     'type'        => 'selectmultiple',
4520     'select_enum' => [ #false laziness w/myaccount_menu.html
4521                        'Overview',
4522                        'Purchase',
4523                        'Purchase additional package',
4524                        'Recharge my account with a credit card',
4525                        'Recharge my account with a check',
4526                        'Recharge my account with a prepaid card',
4527                        'View my usage',
4528                        'Create a ticket',
4529                        'Setup my services',
4530                        'Change my information',
4531                        'Change billing address',
4532                        'Change service address',
4533                        'Change payment information',
4534                        'Change password(s)',
4535                        'Logout',
4536                      ],
4537     'per_agent'   => 1,
4538   },
4539
4540   {
4541     'key'         => 'selfservice-menu_skipblanks',
4542     'section'     => 'self-service',
4543     'description' => 'Skip blank (spacer) entries in the self-service menu',
4544     'type'        => 'checkbox',
4545     'per_agent'   => 1,
4546   },
4547
4548   {
4549     'key'         => 'selfservice-menu_skipheadings',
4550     'section'     => 'self-service',
4551     'description' => 'Skip the unclickable heading entries in the self-service menu',
4552     'type'        => 'checkbox',
4553     'per_agent'   => 1,
4554   },
4555
4556   {
4557     'key'         => 'selfservice-menu_bgcolor',
4558     'section'     => 'self-service',
4559     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
4560     'type'        => 'text',
4561     'per_agent'   => 1,
4562   },
4563
4564   {
4565     'key'         => 'selfservice-menu_fontsize',
4566     'section'     => 'self-service',
4567     'description' => 'HTML font size for the self-service menu, for example, -1',
4568     'type'        => 'text',
4569     'per_agent'   => 1,
4570   },
4571   {
4572     'key'         => 'selfservice-menu_nounderline',
4573     'section'     => 'self-service',
4574     'description' => 'Styles menu links in the self-service without underlining.',
4575     'type'        => 'checkbox',
4576     'per_agent'   => 1,
4577   },
4578
4579
4580   {
4581     'key'         => 'selfservice-menu_top_image',
4582     'section'     => 'self-service',
4583     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4584     'type'        => 'image',
4585     'per_agent'   => 1,
4586   },
4587
4588   {
4589     'key'         => 'selfservice-menu_body_image',
4590     'section'     => 'self-service',
4591     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
4592     'type'        => 'image',
4593     'per_agent'   => 1,
4594   },
4595
4596   {
4597     'key'         => 'selfservice-menu_bottom_image',
4598     'section'     => 'self-service',
4599     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
4600     'type'        => 'image',
4601     'per_agent'   => 1,
4602   },
4603   
4604   {
4605     'key'         => 'selfservice-view_usage_nodomain',
4606     'section'     => 'self-service',
4607     'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.',
4608     'type'        => 'checkbox',
4609   },
4610
4611   {
4612     'key'         => 'selfservice-login_banner_image',
4613     'section'     => 'self-service',
4614     'description' => 'Banner image shown on the login page, in PNG format.',
4615     'type'        => 'image',
4616   },
4617
4618   {
4619     'key'         => 'selfservice-login_banner_url',
4620     'section'     => 'self-service',
4621     'description' => 'Link for the login banner.',
4622     'type'        => 'text',
4623   },
4624
4625   {
4626     'key'         => 'signup-no_company',
4627     'section'     => 'self-service',
4628     'description' => "Don't display a field for company name on signup.",
4629     'type'        => 'checkbox',
4630   },
4631
4632   {
4633     'key'         => 'signup-recommend_email',
4634     'section'     => 'self-service',
4635     'description' => 'Encourage the entry of an invoicing email address on signup.',
4636     'type'        => 'checkbox',
4637   },
4638
4639   {
4640     'key'         => 'signup-recommend_daytime',
4641     'section'     => 'self-service',
4642     'description' => 'Encourage the entry of a daytime phone number on signup.',
4643     'type'        => 'checkbox',
4644   },
4645
4646   {
4647     'key'         => 'signup-duplicate_cc-warn_hours',
4648     'section'     => 'self-service',
4649     'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.',
4650     'type'        => 'text',
4651   },
4652
4653   {
4654     'key'         => 'svc_phone-radius-default_password',
4655     'section'     => 'telephony',
4656     'description' => 'Default password when exporting svc_phone records to RADIUS',
4657     'type'        => 'text',
4658   },
4659
4660   {
4661     'key'         => 'svc_phone-allow_alpha_phonenum',
4662     'section'     => 'telephony',
4663     'description' => 'Allow letters in phone numbers.',
4664     'type'        => 'checkbox',
4665   },
4666
4667   {
4668     'key'         => 'svc_phone-domain',
4669     'section'     => 'telephony',
4670     'description' => 'Track an optional domain association with each phone service.',
4671     'type'        => 'checkbox',
4672   },
4673
4674   {
4675     'key'         => 'svc_phone-phone_name-max_length',
4676     'section'     => 'telephony',
4677     'description' => 'Maximum length of the phone service "Name" field (svc_phone.phone_name).  Sometimes useful to limit this (to 15?) when exporting as Caller ID data.',
4678     'type'        => 'text',
4679   },
4680
4681   {
4682     'key'         => 'svc_phone-random_pin',
4683     'section'     => 'telephony',
4684     'description' => 'Number of random digits to generate in the "PIN" field, if empty.',
4685     'type'        => 'text',
4686   },
4687
4688   {
4689     'key'         => 'svc_phone-lnp',
4690     'section'     => 'telephony',
4691     'description' => 'Enables Number Portability features for svc_phone',
4692     'type'        => 'checkbox',
4693   },
4694
4695   {
4696     'key'         => 'default_phone_countrycode',
4697     'section'     => '',
4698     'description' => 'Default countrcode',
4699     'type'        => 'text',
4700   },
4701
4702   {
4703     'key'         => 'cdr-charged_party-field',
4704     'section'     => 'telephony',
4705     'description' => 'Set the charged_party field of CDRs to this field.',
4706     'type'        => 'select-sub',
4707     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
4708                            map { $_ => $fields->{$_}||$_ }
4709                            grep { $_ !~ /^(acctid|charged_party)$/ }
4710                            FS::Schema::dbdef->table('cdr')->columns;
4711                          },
4712     'option_sub'  => sub { my $f = shift;
4713                            FS::cdr->table_info->{'fields'}{$f} || $f;
4714                          },
4715   },
4716
4717   #probably deprecate in favor of cdr-charged_party-field above
4718   {
4719     'key'         => 'cdr-charged_party-accountcode',
4720     'section'     => 'telephony',
4721     'description' => 'Set the charged_party field of CDRs to the accountcode.',
4722     'type'        => 'checkbox',
4723   },
4724
4725   {
4726     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
4727     'section'     => 'telephony',
4728     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
4729     'type'        => 'checkbox',
4730   },
4731
4732 #  {
4733 #    'key'         => 'cdr-charged_party-truncate_prefix',
4734 #    'section'     => '',
4735 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
4736 #    'type'        => 'text',
4737 #  },
4738 #
4739 #  {
4740 #    'key'         => 'cdr-charged_party-truncate_length',
4741 #    'section'     => '',
4742 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
4743 #    'type'        => 'text',
4744 #  },
4745
4746   {
4747     'key'         => 'cdr-charged_party_rewrite',
4748     'section'     => 'telephony',
4749     'description' => 'Do charged party rewriting in the freeside-cdrrewrited daemon; useful if CDRs are being dropped off directly in the database and require special charged_party processing such as cdr-charged_party-accountcode or cdr-charged_party-truncate*.',
4750     'type'        => 'checkbox',
4751   },
4752
4753   {
4754     'key'         => 'cdr-taqua-da_rewrite',
4755     'section'     => 'telephony',
4756     'description' => 'For the Taqua CDR format, a comma-separated list of directory assistance 800 numbers.  Any CDRs with these numbers as "BilledNumber" will be rewritten to the "CallingPartyNumber" (and CallType "12") on import.',
4757     'type'        => 'text',
4758   },
4759
4760   {
4761     'key'         => 'cdr-taqua-accountcode_rewrite',
4762     'section'     => 'telephony',
4763     'description' => 'For the Taqua CDR format, pull accountcodes from secondary CDRs with matching sessionNumber.',
4764     'type'        => 'checkbox',
4765   },
4766
4767   {
4768     'key'         => 'cdr-taqua-callerid_rewrite',
4769     'section'     => 'telephony',
4770     'description' => 'For the Taqua CDR format, pull Caller ID blocking information from secondary CDRs.',
4771     'type'        => 'checkbox',
4772   },
4773
4774   {
4775     'key'         => 'cdr-asterisk_australia_rewrite',
4776     'section'     => 'telephony',
4777     'description' => 'For Asterisk CDRs, assign CDR type numbers based on Australian conventions.',
4778     'type'        => 'checkbox',
4779   },
4780
4781   {
4782     'key'         => 'cdr-gsm_tap3-sender',
4783     'section'     => 'telephony',
4784     'description' => 'GSM TAP3 Sender network (5 letter code)',
4785     'type'        => 'text',
4786   },
4787
4788   {
4789     'key'         => 'cust_pkg-show_autosuspend',
4790     'section'     => 'UI',
4791     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
4792     'type'        => 'checkbox',
4793   },
4794
4795   {
4796     'key'         => 'cdr-asterisk_forward_rewrite',
4797     'section'     => 'telephony',
4798     'description' => 'Enable special processing for CDRs representing forwarded calls: For CDRs that have a dcontext that starts with "Local/" but does not match dst, set charged_party to dst, parse a new dst from dstchannel, and set amaflags to "2" ("BILL"/"BILLING").',
4799     'type'        => 'checkbox',
4800   },
4801
4802   {
4803     'key'         => 'mc-outbound_packages',
4804     'section'     => '',
4805     'description' => "Don't use this.",
4806     'type'        => 'select-part_pkg',
4807     'multiple'    => 1,
4808   },
4809
4810   {
4811     'key'         => 'disable-cust-pkg_class',
4812     'section'     => 'UI',
4813     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
4814     'type'        => 'checkbox',
4815   },
4816
4817   {
4818     'key'         => 'queued-max_kids',
4819     'section'     => '',
4820     'description' => 'Maximum number of queued processes.  Defaults to 10.',
4821     'type'        => 'text',
4822   },
4823
4824   {
4825     'key'         => 'queued-sleep_time',
4826     'section'     => '',
4827     'description' => 'Time to sleep between attempts to find new jobs to process in the queue.  Defaults to 10.  Installations doing real-time CDR processing for prepaid may want to set it lower.',
4828     'type'        => 'text',
4829   },
4830
4831   {
4832     'key'         => 'cancelled_cust-noevents',
4833     'section'     => 'billing',
4834     'description' => "Don't run events for cancelled customers",
4835     'type'        => 'checkbox',
4836   },
4837
4838   {
4839     'key'         => 'agent-invoice_template',
4840     'section'     => 'invoicing',
4841     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
4842     'type'        => 'checkbox',
4843   },
4844
4845   {
4846     'key'         => 'svc_broadband-manage_link',
4847     'section'     => 'UI',
4848     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr and $mac_addr.',
4849     'type'        => 'text',
4850   },
4851
4852   {
4853     'key'         => 'svc_broadband-manage_link_text',
4854     'section'     => 'UI',
4855     'description' => 'Label for "Manage Device" link',
4856     'type'        => 'text',
4857   },
4858
4859   {
4860     'key'         => 'svc_broadband-manage_link_loc',
4861     'section'     => 'UI',
4862     'description' => 'Location for "Manage Device" link',
4863     'type'        => 'select',
4864     'select_hash' => [
4865       'bottom' => 'Near Unprovision link',
4866       'right'  => 'With export-related links',
4867     ],
4868   },
4869
4870   {
4871     'key'         => 'svc_broadband-manage_link-new_window',
4872     'section'     => 'UI',
4873     'description' => 'Open the "Manage Device" link in a new window',
4874     'type'        => 'checkbox',
4875   },
4876
4877   #more fine-grained, service def-level control could be useful eventually?
4878   {
4879     'key'         => 'svc_broadband-allow_null_ip_addr',
4880     'section'     => '',
4881     'description' => '',
4882     'type'        => 'checkbox',
4883   },
4884
4885   {
4886     'key'         => 'svc_hardware-check_mac_addr',
4887     'section'     => '', #?
4888     'description' => 'Require the "hardware address" field in hardware services to be a valid MAC address.',
4889     'type'        => 'checkbox',
4890   },
4891
4892   {
4893     'key'         => 'tax-report_groups',
4894     'section'     => '',
4895     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
4896     'type'        => 'textarea',
4897   },
4898
4899   {
4900     'key'         => 'tax-cust_exempt-groups',
4901     'section'     => '',
4902     'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name per line.  For example, "GST" would indicate the ability to exempt customers individually from taxes named "GST" (but not other taxes).',
4903     'type'        => 'textarea',
4904   },
4905
4906   {
4907     'key'         => 'tax-cust_exempt-groups-require_individual_nums',
4908     'section'     => '',
4909     'description' => 'When using tax-cust_exempt-groups, require an individual tax exemption number for each exemption from different taxes.',
4910     'type'        => 'checkbox',
4911   },
4912
4913   {
4914     'key'         => 'cust_main-default_view',
4915     'section'     => 'UI',
4916     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
4917     'type'        => 'select',
4918     'select_hash' => [
4919       #false laziness w/view/cust_main.cgi and pref/pref.html
4920       'basics'          => 'Basics',
4921       'notes'           => 'Notes',
4922       'tickets'         => 'Tickets',
4923       'packages'        => 'Packages',
4924       'payment_history' => 'Payment History',
4925       'change_history'  => 'Change History',
4926       'jumbo'           => 'Jumbo',
4927     ],
4928   },
4929
4930   {
4931     'key'         => 'enable_tax_adjustments',
4932     'section'     => 'billing',
4933     'description' => 'Enable the ability to add manual tax adjustments.',
4934     'type'        => 'checkbox',
4935   },
4936
4937   {
4938     'key'         => 'rt-crontool',
4939     'section'     => '',
4940     'description' => 'Enable the RT CronTool extension.',
4941     'type'        => 'checkbox',
4942   },
4943
4944   {
4945     'key'         => 'pkg-balances',
4946     'section'     => 'billing',
4947     'description' => 'Enable per-package balances.',
4948     'type'        => 'checkbox',
4949   },
4950
4951   {
4952     'key'         => 'pkg-addon_classnum',
4953     'section'     => 'billing',
4954     'description' => 'Enable the ability to restrict additional package orders based on package class.',
4955     'type'        => 'checkbox',
4956   },
4957
4958   {
4959     'key'         => 'cust_main-edit_signupdate',
4960     'section'     => 'UI',
4961     'description' => 'Enable manual editing of the signup date.',
4962     'type'        => 'checkbox',
4963   },
4964
4965   {
4966     'key'         => 'svc_acct-disable_access_number',
4967     'section'     => 'UI',
4968     'description' => 'Disable access number selection.',
4969     'type'        => 'checkbox',
4970   },
4971
4972   {
4973     'key'         => 'cust_bill_pay_pkg-manual',
4974     'section'     => 'UI',
4975     'description' => 'Allow manual application of payments to line items.',
4976     'type'        => 'checkbox',
4977   },
4978
4979   {
4980     'key'         => 'cust_credit_bill_pkg-manual',
4981     'section'     => 'UI',
4982     'description' => 'Allow manual application of credits to line items.',
4983     'type'        => 'checkbox',
4984   },
4985
4986   {
4987     'key'         => 'breakage-days',
4988     'section'     => 'billing',
4989     'description' => 'If set to a number of days, after an account goes that long without activity, recognizes any outstanding payments and credits as "breakage" by creating a breakage charge and invoice.',
4990     'type'        => 'text',
4991     'per_agent'   => 1,
4992   },
4993
4994   {
4995     'key'         => 'breakage-pkg_class',
4996     'section'     => 'billing',
4997     'description' => 'Package class to use for breakage reconciliation.',
4998     'type'        => 'select-pkg_class',
4999   },
5000
5001   {
5002     'key'         => 'disable_cron_billing',
5003     'section'     => 'billing',
5004     'description' => 'Disable billing and collection from being run by freeside-daily and freeside-monthly, while still allowing other actions to run, such as notifications and backup.',
5005     'type'        => 'checkbox',
5006   },
5007
5008   {
5009     'key'         => 'svc_domain-edit_domain',
5010     'section'     => '',
5011     'description' => 'Enable domain renaming',
5012     'type'        => 'checkbox',
5013   },
5014
5015   {
5016     'key'         => 'enable_legacy_prepaid_income',
5017     'section'     => '',
5018     'description' => "Enable legacy prepaid income reporting.  Only useful when you have imported pre-Freeside packages with longer-than-monthly duration, and need to do prepaid income reporting on them before they've been invoiced the first time.",
5019     'type'        => 'checkbox',
5020   },
5021
5022   {
5023     'key'         => 'cust_main-exports',
5024     'section'     => '',
5025     'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
5026     'type'        => 'select-sub',
5027     'multiple'    => 1,
5028     'options_sub' => sub {
5029       require FS::Record;
5030       require FS::part_export;
5031       my @part_export =
5032         map { qsearch( 'part_export', {exporttype => $_ } ) }
5033           keys %{FS::part_export::export_info('cust_main')};
5034       map { $_->exportnum => $_->exporttype.' to '.$_->machine } @part_export;
5035     },
5036     'option_sub'  => sub {
5037       require FS::Record;
5038       require FS::part_export;
5039       my $part_export = FS::Record::qsearchs(
5040         'part_export', { 'exportnum' => shift }
5041       );
5042       $part_export
5043         ? $part_export->exporttype.' to '.$part_export->machine
5044         : '';
5045     },
5046   },
5047
5048   {
5049     'key'         => 'cust_tag-location',
5050     'section'     => 'UI',
5051     'description' => 'Location where customer tags are displayed.',
5052     'type'        => 'select',
5053     'select_enum' => [ 'misc_info', 'top' ],
5054   },
5055
5056   {
5057     'key'         => 'maestro-status_test',
5058     'section'     => 'UI',
5059     'description' => 'Display a link to the maestro status test page on the customer view page',
5060     'type'        => 'checkbox',
5061   },
5062
5063   {
5064     'key'         => 'cust_main-custom_link',
5065     'section'     => 'UI',
5066     'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere.  "$agentnum" will be replaced with the agent number, and "$usernum" will be replaced with the employee number.',
5067     'type'        => 'textarea',
5068   },
5069
5070   {
5071     'key'         => 'cust_main-custom_content',
5072     'section'     => 'UI',
5073     'description' => 'As an alternative to cust_main-custom_link (leave it blank), the contant to display on this customer page, one item per line.  Available iems are: small_custview, birthdate, spouse_birthdate, svc_acct, svc_phone and svc_external.',
5074     'type'        => 'textarea',
5075   },
5076
5077   {
5078     'key'         => 'cust_main-custom_title',
5079     'section'     => 'UI',
5080     'description' => 'Title for the "Custom" tab in the View Customer page.',
5081     'type'        => 'text',
5082   },
5083
5084   {
5085     'key'         => 'part_pkg-default_suspend_bill',
5086     'section'     => 'billing',
5087     'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
5088     'type'        => 'checkbox',
5089   },
5090   
5091   {
5092     'key'         => 'qual-alt_address_format',
5093     'section'     => 'UI',
5094     'description' => 'Enable the alternate address format (location type, number, and kind) for qualifications.',
5095     'type'        => 'checkbox',
5096   },
5097
5098   {
5099     'key'         => 'prospect_main-alt_address_format',
5100     'section'     => 'UI',
5101     'description' => 'Enable the alternate address format (location type, number, and kind) for prospects.  Recommended if qual-alt_address_format is set and the main use of propects is for qualifications.',
5102     'type'        => 'checkbox',
5103   },
5104
5105   {
5106     'key'         => 'prospect_main-location_required',
5107     'section'     => 'UI',
5108     'description' => 'Require an address for prospects.  Recommended if the main use of propects is for qualifications.',
5109     'type'        => 'checkbox',
5110   },
5111
5112   {
5113     'key'         => 'note-classes',
5114     'section'     => 'UI',
5115     'description' => 'Use customer note classes',
5116     'type'        => 'select',
5117     'select_hash' => [
5118                        0 => 'Disabled',
5119                        1 => 'Enabled',
5120                        2 => 'Enabled, with tabs',
5121                      ],
5122   },
5123
5124   {
5125     'key'         => 'svc_acct-cf_privatekey-message',
5126     'section'     => '',
5127     'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
5128     'type'        => 'textarea',
5129   },
5130
5131   {
5132     'key'         => 'menu-prepend_links',
5133     'section'     => 'UI',
5134     'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
5135     'type'        => 'textarea',
5136   },
5137
5138   {
5139     'key'         => 'cust_main-external_links',
5140     'section'     => 'UI',
5141     'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
5142     'type'        => 'textarea',
5143   },
5144   
5145   {
5146     'key'         => 'svc_phone-did-summary',
5147     'section'     => 'invoicing',
5148     'description' => 'Enable DID activity summary on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage, covering period since last invoice.',
5149     'type'        => 'checkbox',
5150   },
5151
5152   {
5153     'key'         => 'svc_acct-usage_seconds',
5154     'section'     => 'invoicing',
5155     'description' => 'Enable calculation of RADIUS usage time for invoices.  You must modify your template to display this information.',
5156     'type'        => 'checkbox',
5157   },
5158   
5159   {
5160     'key'         => 'opensips_gwlist',
5161     'section'     => 'telephony',
5162     'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent',
5163     'type'        => 'text',
5164     'per_agent'   => 1,
5165     'agentonly'   => 1,
5166   },
5167
5168   {
5169     'key'         => 'opensips_description',
5170     'section'     => 'telephony',
5171     'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent',
5172     'type'        => 'text',
5173     'per_agent'   => 1,
5174     'agentonly'   => 1,
5175   },
5176   
5177   {
5178     'key'         => 'opensips_route',
5179     'section'     => 'telephony',
5180     'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent',
5181     'type'        => 'text',
5182     'per_agent'   => 1,
5183     'agentonly'   => 1,
5184   },
5185
5186   {
5187     'key'         => 'cust_bill-no_recipients-error',
5188     'section'     => 'invoicing',
5189     'description' => 'For customers with no invoice recipients, throw a job queue error rather than the default behavior of emailing the invoice to the invoice_from address.',
5190     'type'        => 'checkbox',
5191   },
5192
5193   {
5194     'key'         => 'cust_bill-latex_lineitem_maxlength',
5195     'section'     => 'invoicing',
5196     'description' => 'Truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin.  Defaults to 50.  ',
5197     'type'        => 'text',
5198   },
5199
5200   {
5201     'key'         => 'cust_main-status_module',
5202     'section'     => 'UI',
5203     'description' => 'Which module to use for customer status display.  The "Classic" module (the default) considers accounts with cancelled recurring packages but un-cancelled one-time charges Inactive.  The "Recurring" module considers those customers Cancelled.  Similarly for customers with suspended recurring packages but one-time charges.', #other differences?
5204     'type'        => 'select',
5205     'select_enum' => [ 'Classic', 'Recurring' ],
5206   },
5207
5208   {
5209     'key'         => 'cust_main-print_statement_link',
5210     'section'     => 'UI',
5211     'description' => 'Show a link to download a current statement for the customer.',
5212     'type'        => 'checkbox',
5213   },
5214
5215   { 
5216     'key'         => 'username-pound',
5217     'section'     => 'username',
5218     'description' => 'Allow the pound character (#) in usernames.',
5219     'type'        => 'checkbox',
5220   },
5221
5222   { 
5223     'key'         => 'username-exclamation',
5224     'section'     => 'username',
5225     'description' => 'Allow the exclamation character (!) in usernames.',
5226     'type'        => 'checkbox',
5227   },
5228
5229   {
5230     'key'         => 'ie-compatibility_mode',
5231     'section'     => 'UI',
5232     'description' => "Compatibility mode META tag for Internet Explorer, used on the customer view page.  Not necessary in normal operation unless custom content (notes, cust_main-custom_link) is included on customer view that is incompatibile with newer IE verisons.",
5233     'type'        => 'select',
5234     'select_enum' => [ '', '7', 'EmulateIE7', '8', 'EmulateIE8' ],
5235   },
5236
5237   {
5238     'key'         => 'disable_payauto_default',
5239     'section'     => 'UI',
5240     'description' => 'Disable the "Charge future payments to this (card|check) automatically" checkbox from defaulting to checked.',
5241     'type'        => 'checkbox',
5242   },
5243   
5244   {
5245     'key'         => 'payment-history-report',
5246     'section'     => 'UI',
5247     'description' => 'Show a link to the raw database payment history report in the Reports menu.  DO NOT ENABLE THIS for modern installations.',
5248     'type'        => 'checkbox',
5249   },
5250   
5251   {
5252     'key'         => 'svc_broadband-require-nw-coordinates',
5253     'section'     => 'deprecated',
5254     'description' => 'Deprecated; see geocode-require_nw_coordinates instead',
5255     'type'        => 'checkbox',
5256   },
5257   
5258   {
5259     'key'         => 'cust-email-high-visibility',
5260     'section'     => 'UI',
5261     'description' => 'Move the invoicing e-mail address field to the top of the billing address section and highlight it.',
5262     'type'        => 'checkbox',
5263   },
5264   
5265   {
5266     'key'         => 'cust-edit-alt-field-order',
5267     'section'     => 'UI',
5268     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
5269     'type'        => 'checkbox',
5270   },
5271
5272   {
5273     'key'         => 'cust_bill-enable_promised_date',
5274     'section'     => 'UI',
5275     'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
5276     'type'        => 'checkbox',
5277   },
5278   
5279   {
5280     'key'         => 'available-locales',
5281     'section'     => '',
5282     'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
5283     'type'        => 'select-sub',
5284     'multiple'    => 1,
5285     'options_sub' => sub { 
5286       map { $_ => FS::Locales->description($_) }
5287       grep { $_ ne 'en_US' } 
5288       FS::Locales->locales;
5289     },
5290     'option_sub'  => sub { FS::Locales->description(shift) },
5291   },
5292
5293   {
5294     'key'         => 'cust_main-require_locale',
5295     'section'     => 'UI',
5296     'description' => 'Require an explicit locale to be chosen for new customers.',
5297     'type'        => 'checkbox',
5298   },
5299   
5300   {
5301     'key'         => 'translate-auto-insert',
5302     'section'     => '',
5303     'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values.  Do not turn this on unless translating the interface into a new language.',
5304     'type'        => 'select',
5305     'multiple'    => 1,
5306     'select_enum' => [ grep { $_ ne 'en_US' } FS::Locales::locales ],
5307   },
5308
5309   {
5310     'key'         => 'svc_acct-tower_sector',
5311     'section'     => '',
5312     'description' => 'Track tower and sector for svc_acct (account) services.',
5313     'type'        => 'checkbox',
5314   },
5315
5316   {
5317     'key'         => 'cdr-prerate',
5318     'section'     => 'telephony',
5319     'description' => 'Experimental feature to rate CDRs immediately, rather than waiting until invoice generation time.  Can reduce invoice generation time when processing lots of CDRs.  Currently works with "VoIP/telco CDR rating (standard)" price plans using "Phone numbers (svc_phone.phonenum)" CDR service matching, without any included minutes.',
5320     'type'        => 'checkbox',
5321   },
5322
5323   {
5324     'key'         => 'cdr-prerate-cdrtypenums',
5325     'section'     => 'telephony',
5326     'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
5327     'type'        => 'select-sub',
5328     'multiple'    => 1,
5329     'options_sub' => sub { require FS::Record;
5330                            require FS::cdr_type;
5331                            map { $_->cdrtypenum => $_->cdrtypename }
5332                                FS::Record::qsearch( 'cdr_type', 
5333                                                     {} #{ 'disabled' => '' }
5334                                                   );
5335                          },
5336     'option_sub'  => sub { require FS::Record;
5337                            require FS::cdr_type;
5338                            my $cdr_type = FS::Record::qsearchs(
5339                              'cdr_type', { 'cdrtypenum'=>shift } );
5340                            $cdr_type ? $cdr_type->cdrtypename : '';
5341                          },
5342   },
5343
5344   {
5345     'key'         => 'cdr-minutes_priority',
5346     'section'     => 'telephony',
5347     'description' => 'Priority rule for assigning included minutes to CDRs.',
5348     'type'        => 'select',
5349     'select_hash' => [
5350       ''          => 'No specific order',
5351       'time'      => 'Chronological',
5352       'rate_high' => 'Highest rate first',
5353       'rate_low'  => 'Lowest rate first',
5354     ],
5355   },
5356   
5357   {
5358     'key'         => 'brand-agent',
5359     'section'     => 'UI',
5360     'description' => 'Brand the backoffice interface (currently Help->About) using the company_name, company_url and logo.png configuration settings of the selected agent.  Typically used when selling or bundling hosted access to the backoffice interface.  NOTE: The AGPL software license has specific requirements for source code availability in this situation.',
5361     'type'        => 'select-agent',
5362   },
5363
5364   {
5365     'key'         => 'cust_class-tax_exempt',
5366     'section'     => 'billing',
5367     'description' => 'Control the tax exemption flag per customer class rather than per indivual customer.',
5368     'type'        => 'checkbox',
5369   },
5370
5371   {
5372     'key'         => 'selfservice-billing_history-line_items',
5373     'section'     => 'self-service',
5374     'description' => 'Return line item billing detail for the self-service billing_history API call.',
5375     'type'        => 'checkbox',
5376   },
5377
5378   {
5379     'key'         => 'selfservice-default_cdr_format',
5380     'section'     => 'self-service',
5381     'description' => 'Format for showing outbound CDRs in self-service.  The per-package option overrides this.',
5382     'type'        => 'select',
5383     'select_hash' => \@cdr_formats,
5384   },
5385
5386   {
5387     'key'         => 'selfservice-default_inbound_cdr_format',
5388     'section'     => 'self-service',
5389     'description' => 'Format for showing inbound CDRs in self-service.  The per-package option overrides this.  Leave blank to avoid showing these CDRs.',
5390     'type'        => 'select',
5391     'select_hash' => \@cdr_formats,
5392   },
5393
5394   {
5395     'key'         => 'logout-timeout',
5396     'section'     => 'UI',
5397     'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
5398     'type'       => 'text',
5399   },
5400   
5401   {
5402     'key'         => 'spreadsheet_format',
5403     'section'     => 'UI',
5404     'description' => 'Default format for spreadsheet download.',
5405     'type'        => 'select',
5406     'select_hash' => [
5407       'XLS' => 'XLS (Excel 97/2000/XP)',
5408       'XLSX' => 'XLSX (Excel 2007+)',
5409     ],
5410   },
5411
5412   {
5413     'key'         => 'agent-email_day',
5414     'section'     => '',
5415     'description' => 'On this day of each month, agents with master customer records containing email addresses will be emailed a list of their customers and balances.',
5416     'type'        => 'text',
5417   },
5418
5419   {
5420     'key'         => 'report-cust_pay-select_time',
5421     'section'     => 'UI',
5422     'description' => 'Enable time selection on payment and refund reports.',
5423     'type'        => 'checkbox',
5424   },
5425
5426   {
5427     'key'         => 'authentication_module',
5428     'section'     => 'UI',
5429     'description' => '"Internal" is the default , which authenticates against the internal database.  "Legacy" is similar, but matches passwords against a legacy htpasswd file.',
5430     'type'        => 'select',
5431     'select_enum' => [qw( Internal Legacy )],
5432   },
5433
5434   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5435   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5436   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5437   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5438   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5439   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5440   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5441   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5442   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5443   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5444   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5445   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5446   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5447   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5448   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5449   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5450   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5451   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5452   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5453   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5454   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5455   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5456   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5457   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5458   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5459   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5460   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5461   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5462   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5463   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5464   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5465   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5466   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5467   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5468   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5469   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5470   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5471   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5472   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5473   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5474   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5475
5476 );
5477
5478 1;
5479