add mac_addr to svc_broadband-manage_link, RT#21997
[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   },
1533
1534   { 
1535     'key'         => 'usage_class_as_a_section',
1536     'section'     => 'invoicing',
1537     'description' => 'Split usage into sections and label according to usage class name when enabled.  Only valid when invoice_sections is enabled.',
1538     'type'        => 'checkbox',
1539   },
1540
1541   { 
1542     'key'         => 'phone_usage_class_summary',
1543     'section'     => 'invoicing',
1544     '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.',
1545     'type'        => 'checkbox',
1546   },
1547
1548   { 
1549     'key'         => 'svc_phone_sections',
1550     'section'     => 'invoicing',
1551     'description' => 'Create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
1552     'type'        => 'checkbox',
1553   },
1554
1555   {
1556     'key'         => 'finance_pkgclass',
1557     'section'     => 'billing',
1558     'description' => 'The default package class for late fee charges, used if the fee event does not specify a package class itself.',
1559     'type'        => 'select-pkg_class',
1560   },
1561
1562   { 
1563     'key'         => 'separate_usage',
1564     'section'     => 'invoicing',
1565     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
1566     'type'        => 'checkbox',
1567   },
1568
1569   {
1570     'key'         => 'invoice_send_receipts',
1571     'section'     => 'deprecated',
1572     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
1573     'type'        => 'checkbox',
1574   },
1575
1576   {
1577     'key'         => 'payment_receipt',
1578     'section'     => 'notification',
1579     'description' => 'Send payment receipts.',
1580     'type'        => 'checkbox',
1581     'per_agent'   => 1,
1582     'agent_bool'  => 1,
1583   },
1584
1585   {
1586     'key'         => 'payment_receipt_msgnum',
1587     'section'     => 'notification',
1588     'description' => 'Template to use for payment receipts.',
1589     %msg_template_options,
1590   },
1591   
1592   {
1593     'key'         => 'payment_receipt_from',
1594     'section'     => 'notification',
1595     'description' => 'From: address for payment receipts, if not specified in the template.',
1596     'type'        => 'text',
1597     'per_agent'   => 1,
1598   },
1599
1600   {
1601     'key'         => 'payment_receipt_email',
1602     'section'     => 'deprecated',
1603     'description' => 'Template file for payment receipts.  Payment receipts are sent to the customer email invoice destination(s) when a payment is received.',
1604     'type'        => [qw( checkbox textarea )],
1605   },
1606
1607   {
1608     'key'         => 'payment_receipt-trigger',
1609     'section'     => 'notification',
1610     'description' => 'When payment receipts are triggered.  Defaults to when payment is made.',
1611     'type'        => 'select',
1612     'select_hash' => [
1613                        'cust_pay'          => 'When payment is made.',
1614                        'cust_bill_pay_pkg' => 'When payment is applied.',
1615                      ],
1616     'per_agent'   => 1,
1617   },
1618
1619   {
1620     'key'         => 'trigger_export_insert_on_payment',
1621     'section'     => 'billing',
1622     'description' => 'Enable exports on payment application.',
1623     'type'        => 'checkbox',
1624   },
1625
1626   {
1627     'key'         => 'lpr',
1628     'section'     => 'required',
1629     'description' => 'Print command for paper invoices, for example `lpr -h\'',
1630     'type'        => 'text',
1631     'per_agent'   => 1,
1632   },
1633
1634   {
1635     'key'         => 'lpr-postscript_prefix',
1636     'section'     => 'billing',
1637     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1638     'type'        => 'text',
1639   },
1640
1641   {
1642     'key'         => 'lpr-postscript_suffix',
1643     'section'     => 'billing',
1644     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1645     'type'        => 'text',
1646   },
1647
1648   {
1649     'key'         => 'money_char',
1650     'section'     => '',
1651     'description' => 'Currency symbol - defaults to `$\'',
1652     'type'        => 'text',
1653   },
1654
1655   {
1656     'key'         => 'defaultrecords',
1657     'section'     => 'BIND',
1658     'description' => 'DNS entries to add automatically when creating a domain',
1659     'type'        => 'editlist',
1660     'editlist_parts' => [ { type=>'text' },
1661                           { type=>'immutable', value=>'IN' },
1662                           { type=>'select',
1663                             select_enum => {
1664                               map { $_=>$_ }
1665                                   #@{ FS::domain_record->rectypes }
1666                                   qw(A AAAA CNAME MX NS PTR SPF SRV TXT)
1667                             },
1668                           },
1669                           { type=> 'text' }, ],
1670   },
1671
1672   {
1673     'key'         => 'passwordmin',
1674     'section'     => 'password',
1675     'description' => 'Minimum password length (default 6)',
1676     'type'        => 'text',
1677   },
1678
1679   {
1680     'key'         => 'passwordmax',
1681     'section'     => 'password',
1682     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
1683     'type'        => 'text',
1684   },
1685
1686   {
1687     'key'         => 'password-noampersand',
1688     'section'     => 'password',
1689     'description' => 'Disallow ampersands in passwords',
1690     'type'        => 'checkbox',
1691   },
1692
1693   {
1694     'key'         => 'password-noexclamation',
1695     'section'     => 'password',
1696     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1697     'type'        => 'checkbox',
1698   },
1699
1700   {
1701     'key'         => 'default-password-encoding',
1702     'section'     => 'password',
1703     'description' => 'Default storage format for passwords',
1704     'type'        => 'select',
1705     'select_hash' => [
1706       'plain'       => 'Plain text',
1707       'crypt-des'   => 'Unix password (DES encrypted)',
1708       'crypt-md5'   => 'Unix password (MD5 digest)',
1709       'ldap-plain'  => 'LDAP (plain text)',
1710       'ldap-crypt'  => 'LDAP (DES encrypted)',
1711       'ldap-md5'    => 'LDAP (MD5 digest)',
1712       'ldap-sha1'   => 'LDAP (SHA1 digest)',
1713       'legacy'      => 'Legacy mode',
1714     ],
1715   },
1716
1717   {
1718     'key'         => 'referraldefault',
1719     'section'     => 'UI',
1720     'description' => 'Default referral, specified by refnum',
1721     'type'        => 'select-sub',
1722     'options_sub' => sub { require FS::Record;
1723                            require FS::part_referral;
1724                            map { $_->refnum => $_->referral }
1725                                FS::Record::qsearch( 'part_referral', 
1726                                                     { 'disabled' => '' }
1727                                                   );
1728                          },
1729     'option_sub'  => sub { require FS::Record;
1730                            require FS::part_referral;
1731                            my $part_referral = FS::Record::qsearchs(
1732                              'part_referral', { 'refnum'=>shift } );
1733                            $part_referral ? $part_referral->referral : '';
1734                          },
1735   },
1736
1737 #  {
1738 #    'key'         => 'registries',
1739 #    'section'     => 'required',
1740 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1741 #  },
1742
1743   {
1744     'key'         => 'report_template',
1745     'section'     => 'deprecated',
1746     'description' => 'Deprecated template file for reports.',
1747     'type'        => 'textarea',
1748   },
1749
1750   {
1751     'key'         => 'maxsearchrecordsperpage',
1752     'section'     => 'UI',
1753     'description' => 'If set, number of search records to return per page.',
1754     'type'        => 'text',
1755   },
1756
1757   {
1758     'key'         => 'disable_maxselect',
1759     'section'     => 'UI',
1760     'description' => 'Prevent changing the number of records per page.',
1761     'type'        => 'checkbox',
1762   },
1763
1764   {
1765     'key'         => 'session-start',
1766     'section'     => 'session',
1767     '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.',
1768     'type'        => 'text',
1769   },
1770
1771   {
1772     'key'         => 'session-stop',
1773     'section'     => 'session',
1774     '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.',
1775     'type'        => 'text',
1776   },
1777
1778   {
1779     'key'         => 'shells',
1780     'section'     => 'shell',
1781     '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.',
1782     'type'        => 'textarea',
1783   },
1784
1785   {
1786     'key'         => 'showpasswords',
1787     'section'     => 'UI',
1788     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1789     'type'        => 'checkbox',
1790   },
1791
1792   {
1793     'key'         => 'report-showpasswords',
1794     'section'     => 'UI',
1795     'description' => 'This is a terrible idea.  Do not enable it.  STRONGLY NOT RECOMMENDED.  Enables display of passwords on services reports.',
1796     'type'        => 'checkbox',
1797   },
1798
1799   {
1800     'key'         => 'signupurl',
1801     'section'     => 'UI',
1802     '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',
1803     'type'        => 'text',
1804   },
1805
1806   {
1807     'key'         => 'smtpmachine',
1808     'section'     => 'required',
1809     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1810     'type'        => 'text',
1811   },
1812
1813   {
1814     'key'         => 'smtp-username',
1815     'section'     => '',
1816     'description' => 'Optional SMTP username for Freeside\'s outgoing mail',
1817     'type'        => 'text',
1818   },
1819
1820   {
1821     'key'         => 'smtp-password',
1822     'section'     => '',
1823     'description' => 'Optional SMTP password for Freeside\'s outgoing mail',
1824     'type'        => 'text',
1825   },
1826
1827   {
1828     'key'         => 'smtp-encryption',
1829     'section'     => '',
1830     'description' => 'Optional SMTP encryption method.  The STARTTLS methods require smtp-username and smtp-password to be set.',
1831     'type'        => 'select',
1832     'select_hash' => [ '25'           => 'None (port 25)',
1833                        '25-starttls'  => 'STARTTLS (port 25)',
1834                        '587-starttls' => 'STARTTLS / submission (port 587)',
1835                        '465-tls'      => 'SMTPS (SSL) (port 465)',
1836                      ],
1837   },
1838
1839   {
1840     'key'         => 'soadefaultttl',
1841     'section'     => 'BIND',
1842     'description' => 'SOA default TTL for new domains.',
1843     'type'        => 'text',
1844   },
1845
1846   {
1847     'key'         => 'soaemail',
1848     'section'     => 'BIND',
1849     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1850     'type'        => 'text',
1851   },
1852
1853   {
1854     'key'         => 'soaexpire',
1855     'section'     => 'BIND',
1856     'description' => 'SOA expire for new domains',
1857     'type'        => 'text',
1858   },
1859
1860   {
1861     'key'         => 'soamachine',
1862     'section'     => 'BIND',
1863     'description' => 'SOA machine for new domains, with trailing `.\'',
1864     'type'        => 'text',
1865   },
1866
1867   {
1868     'key'         => 'soarefresh',
1869     'section'     => 'BIND',
1870     'description' => 'SOA refresh for new domains',
1871     'type'        => 'text',
1872   },
1873
1874   {
1875     'key'         => 'soaretry',
1876     'section'     => 'BIND',
1877     'description' => 'SOA retry for new domains',
1878     'type'        => 'text',
1879   },
1880
1881   {
1882     'key'         => 'statedefault',
1883     'section'     => 'UI',
1884     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1885     'type'        => 'text',
1886   },
1887
1888   {
1889     'key'         => 'unsuspendauto',
1890     'section'     => 'billing',
1891     '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',
1892     'type'        => 'checkbox',
1893   },
1894
1895   {
1896     'key'         => 'unsuspend-always_adjust_next_bill_date',
1897     'section'     => 'billing',
1898     '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.',
1899     'type'        => 'checkbox',
1900   },
1901
1902   {
1903     'key'         => 'usernamemin',
1904     'section'     => 'username',
1905     'description' => 'Minimum username length (default 2)',
1906     'type'        => 'text',
1907   },
1908
1909   {
1910     'key'         => 'usernamemax',
1911     'section'     => 'username',
1912     'description' => 'Maximum username length',
1913     'type'        => 'text',
1914   },
1915
1916   {
1917     'key'         => 'username-ampersand',
1918     'section'     => 'username',
1919     '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.',
1920     'type'        => 'checkbox',
1921   },
1922
1923   {
1924     'key'         => 'username-letter',
1925     'section'     => 'username',
1926     'description' => 'Usernames must contain at least one letter',
1927     'type'        => 'checkbox',
1928     'per_agent'   => 1,
1929   },
1930
1931   {
1932     'key'         => 'username-letterfirst',
1933     'section'     => 'username',
1934     'description' => 'Usernames must start with a letter',
1935     'type'        => 'checkbox',
1936   },
1937
1938   {
1939     'key'         => 'username-noperiod',
1940     'section'     => 'username',
1941     'description' => 'Disallow periods in usernames',
1942     'type'        => 'checkbox',
1943   },
1944
1945   {
1946     'key'         => 'username-nounderscore',
1947     'section'     => 'username',
1948     'description' => 'Disallow underscores in usernames',
1949     'type'        => 'checkbox',
1950   },
1951
1952   {
1953     'key'         => 'username-nodash',
1954     'section'     => 'username',
1955     'description' => 'Disallow dashes in usernames',
1956     'type'        => 'checkbox',
1957   },
1958
1959   {
1960     'key'         => 'username-uppercase',
1961     'section'     => 'username',
1962     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1963     'type'        => 'checkbox',
1964     'per_agent'   => 1,
1965   },
1966
1967   { 
1968     'key'         => 'username-percent',
1969     'section'     => 'username',
1970     'description' => 'Allow the percent character (%) in usernames.',
1971     'type'        => 'checkbox',
1972   },
1973
1974   { 
1975     'key'         => 'username-colon',
1976     'section'     => 'username',
1977     'description' => 'Allow the colon character (:) in usernames.',
1978     'type'        => 'checkbox',
1979   },
1980
1981   { 
1982     'key'         => 'username-slash',
1983     'section'     => 'username',
1984     '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.',
1985     'type'        => 'checkbox',
1986   },
1987
1988   { 
1989     'key'         => 'username-equals',
1990     'section'     => 'username',
1991     'description' => 'Allow the equal sign character (=) in usernames.',
1992     'type'        => 'checkbox',
1993   },
1994
1995   {
1996     'key'         => 'safe-part_bill_event',
1997     'section'     => 'UI',
1998     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1999     'type'        => 'checkbox',
2000   },
2001
2002   {
2003     'key'         => 'show_ss',
2004     'section'     => 'UI',
2005     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
2006     'type'        => 'checkbox',
2007   },
2008
2009   {
2010     'key'         => 'unmask_ss',
2011     'section'     => 'UI',
2012     'description' => "Don't mask social security numbers in the web interface.",
2013     'type'        => 'checkbox',
2014   },
2015
2016   {
2017     'key'         => 'show_stateid',
2018     'section'     => 'UI',
2019     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
2020     'type'        => 'checkbox',
2021   },
2022
2023   {
2024     'key'         => 'national_id-country',
2025     'section'     => 'UI',
2026     'description' => 'Track a national identification number, for specific countries.',
2027     'type'        => 'select',
2028     'select_enum' => [ '', 'MY' ],
2029   },
2030
2031   {
2032     'key'         => 'show_bankstate',
2033     'section'     => 'UI',
2034     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
2035     'type'        => 'checkbox',
2036   },
2037
2038   { 
2039     'key'         => 'agent_defaultpkg',
2040     'section'     => 'UI',
2041     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
2042     'type'        => 'checkbox',
2043   },
2044
2045   {
2046     'key'         => 'legacy_link',
2047     'section'     => 'UI',
2048     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
2049     'type'        => 'checkbox',
2050   },
2051
2052   {
2053     'key'         => 'legacy_link-steal',
2054     'section'     => 'UI',
2055     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
2056     'type'        => 'checkbox',
2057   },
2058
2059   {
2060     'key'         => 'queue_dangerous_controls',
2061     'section'     => 'UI',
2062     '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.',
2063     'type'        => 'checkbox',
2064   },
2065
2066   {
2067     'key'         => 'security_phrase',
2068     'section'     => 'password',
2069     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
2070     'type'        => 'checkbox',
2071   },
2072
2073   {
2074     'key'         => 'locale',
2075     'section'     => 'UI',
2076     'description' => 'Default locale',
2077     'type'        => 'select-sub',
2078     'options_sub' => sub {
2079       map { $_ => FS::Locales->description($_) } FS::Locales->locales;
2080     },
2081     'option_sub'  => sub {
2082       FS::Locales->description(shift)
2083     },
2084   },
2085
2086   {
2087     'key'         => 'signup_server-payby',
2088     'section'     => 'self-service',
2089     'description' => 'Acceptable payment types for the signup server',
2090     'type'        => 'selectmultiple',
2091     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
2092   },
2093
2094   {
2095     'key'         => 'selfservice-payment_gateway',
2096     'section'     => 'self-service',
2097     'description' => 'Force the use of this payment gateway for self-service.',
2098     %payment_gateway_options,
2099   },
2100
2101   {
2102     'key'         => 'selfservice-save_unchecked',
2103     'section'     => 'self-service',
2104     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
2105     'type'        => 'checkbox',
2106   },
2107
2108   {
2109     'key'         => 'default_agentnum',
2110     'section'     => 'UI',
2111     'description' => 'Default agent for the backoffice',
2112     'type'        => 'select-agent',
2113   },
2114
2115   {
2116     'key'         => 'signup_server-default_agentnum',
2117     'section'     => 'self-service',
2118     'description' => 'Default agent for the signup server',
2119     'type'        => 'select-agent',
2120   },
2121
2122   {
2123     'key'         => 'signup_server-default_refnum',
2124     'section'     => 'self-service',
2125     'description' => 'Default advertising source for the signup server',
2126     'type'        => 'select-sub',
2127     'options_sub' => sub { require FS::Record;
2128                            require FS::part_referral;
2129                            map { $_->refnum => $_->referral }
2130                                FS::Record::qsearch( 'part_referral', 
2131                                                     { 'disabled' => '' }
2132                                                   );
2133                          },
2134     'option_sub'  => sub { require FS::Record;
2135                            require FS::part_referral;
2136                            my $part_referral = FS::Record::qsearchs(
2137                              'part_referral', { 'refnum'=>shift } );
2138                            $part_referral ? $part_referral->referral : '';
2139                          },
2140   },
2141
2142   {
2143     'key'         => 'signup_server-default_pkgpart',
2144     'section'     => 'self-service',
2145     'description' => 'Default package for the signup server',
2146     'type'        => 'select-part_pkg',
2147   },
2148
2149   {
2150     'key'         => 'signup_server-default_svcpart',
2151     'section'     => 'self-service',
2152     'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
2153     'type'        => 'select-part_svc',
2154   },
2155
2156   {
2157     'key'         => 'signup_server-mac_addr_svcparts',
2158     'section'     => 'self-service',
2159     'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
2160     'type'        => 'select-part_svc',
2161     'multiple'    => 1,
2162   },
2163
2164   {
2165     'key'         => 'signup_server-nomadix',
2166     'section'     => 'self-service',
2167     'description' => 'Signup page Nomadix integration',
2168     'type'        => 'checkbox',
2169   },
2170
2171   {
2172     'key'         => 'signup_server-service',
2173     'section'     => 'self-service',
2174     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
2175     'type'        => 'select',
2176     'select_hash' => [
2177                        'svc_acct'  => 'Account (svc_acct)',
2178                        'svc_phone' => 'Phone number (svc_phone)',
2179                        'svc_pbx'   => 'PBX (svc_pbx)',
2180                      ],
2181   },
2182   
2183   {
2184     'key'         => 'signup_server-prepaid-template-custnum',
2185     'section'     => 'self-service',
2186     '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',
2187     'type'        => 'text',
2188   },
2189
2190   {
2191     'key'         => 'signup_server-terms_of_service',
2192     'section'     => 'self-service',
2193     'description' => 'Terms of Service for the signup server.  May contain HTML.',
2194     'type'        => 'textarea',
2195     'per_agent'   => 1,
2196   },
2197
2198   {
2199     'key'         => 'selfservice_server-base_url',
2200     'section'     => 'self-service',
2201     '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.',
2202     'type'        => 'text',
2203   },
2204
2205   {
2206     'key'         => 'show-msgcat-codes',
2207     'section'     => 'UI',
2208     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
2209     'type'        => 'checkbox',
2210   },
2211
2212   {
2213     'key'         => 'signup_server-realtime',
2214     'section'     => 'self-service',
2215     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
2216     'type'        => 'checkbox',
2217   },
2218
2219   {
2220     'key'         => 'signup_server-classnum2',
2221     'section'     => 'self-service',
2222     'description' => 'Package Class for first optional purchase',
2223     'type'        => 'select-pkg_class',
2224   },
2225
2226   {
2227     'key'         => 'signup_server-classnum3',
2228     'section'     => 'self-service',
2229     'description' => 'Package Class for second optional purchase',
2230     'type'        => 'select-pkg_class',
2231   },
2232
2233   {
2234     'key'         => 'signup_server-third_party_as_card',
2235     'section'     => 'self-service',
2236     'description' => 'Allow customer payment type to be set to CARD even when using third-party credit card billing.',
2237     'type'        => 'checkbox',
2238   },
2239
2240   {
2241     'key'         => 'selfservice-xmlrpc',
2242     'section'     => 'self-service',
2243     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
2244     'type'        => 'checkbox',
2245   },
2246
2247   {
2248     'key'         => 'backend-realtime',
2249     'section'     => 'billing',
2250     'description' => 'Run billing for backend signups immediately.',
2251     'type'        => 'checkbox',
2252   },
2253
2254   {
2255     'key'         => 'decline_msgnum',
2256     'section'     => 'notification',
2257     'description' => 'Template to use for credit card and electronic check decline messages.',
2258     %msg_template_options,
2259   },
2260
2261   {
2262     'key'         => 'declinetemplate',
2263     'section'     => 'deprecated',
2264     'description' => 'Template file for credit card and electronic check decline emails.',
2265     'type'        => 'textarea',
2266   },
2267
2268   {
2269     'key'         => 'emaildecline',
2270     'section'     => 'notification',
2271     'description' => 'Enable emailing of credit card and electronic check decline notices.',
2272     'type'        => 'checkbox',
2273     'per_agent'   => 1,
2274   },
2275
2276   {
2277     'key'         => 'emaildecline-exclude',
2278     'section'     => 'notification',
2279     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
2280     'type'        => 'textarea',
2281     'per_agent'   => 1,
2282   },
2283
2284   {
2285     'key'         => 'cancel_msgnum',
2286     'section'     => 'notification',
2287     'description' => 'Template to use for cancellation emails.',
2288     %msg_template_options,
2289   },
2290
2291   {
2292     'key'         => 'cancelmessage',
2293     'section'     => 'deprecated',
2294     'description' => 'Template file for cancellation emails.',
2295     'type'        => 'textarea',
2296   },
2297
2298   {
2299     'key'         => 'cancelsubject',
2300     'section'     => 'deprecated',
2301     'description' => 'Subject line for cancellation emails.',
2302     'type'        => 'text',
2303   },
2304
2305   {
2306     'key'         => 'emailcancel',
2307     'section'     => 'notification',
2308     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
2309     'type'        => 'checkbox',
2310     'per_agent'   => 1,
2311   },
2312
2313   {
2314     'key'         => 'bill_usage_on_cancel',
2315     'section'     => 'billing',
2316     '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.',
2317     'type'        => 'checkbox',
2318   },
2319
2320   {
2321     'key'         => 'require_cardname',
2322     'section'     => 'billing',
2323     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
2324     'type'        => 'checkbox',
2325   },
2326
2327   {
2328     'key'         => 'enable_taxclasses',
2329     'section'     => 'billing',
2330     'description' => 'Enable per-package tax classes',
2331     'type'        => 'checkbox',
2332   },
2333
2334   {
2335     'key'         => 'require_taxclasses',
2336     'section'     => 'billing',
2337     'description' => 'Require a taxclass to be entered for every package',
2338     'type'        => 'checkbox',
2339   },
2340
2341   {
2342     'key'         => 'enable_taxproducts',
2343     'section'     => 'billing',
2344     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
2345     'type'        => 'checkbox',
2346   },
2347
2348   {
2349     'key'         => 'taxdatadirectdownload',
2350     'section'     => 'billing',  #well
2351     'description' => 'Enable downloading tax data directly from the vendor site. at least three lines: URL, username, and password.j',
2352     'type'        => 'textarea',
2353   },
2354
2355   {
2356     'key'         => 'ignore_incalculable_taxes',
2357     'section'     => 'billing',
2358     'description' => 'Prefer to invoice without tax over not billing at all',
2359     'type'        => 'checkbox',
2360   },
2361
2362   {
2363     'key'         => 'welcome_msgnum',
2364     'section'     => 'notification',
2365     'description' => 'Template to use for welcome messages when a svc_acct record is created.',
2366     %msg_template_options,
2367   },
2368   
2369   {
2370     'key'         => 'svc_acct_welcome_exclude',
2371     'section'     => 'notification',
2372     'description' => 'A list of svc_acct services for which no welcome email is to be sent.',
2373     'type'        => 'select-part_svc',
2374     'multiple'    => 1,
2375   },
2376
2377   {
2378     'key'         => 'welcome_email',
2379     'section'     => 'deprecated',
2380     '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.',
2381     'type'        => 'textarea',
2382     'per_agent'   => 1,
2383   },
2384
2385   {
2386     'key'         => 'welcome_email-from',
2387     'section'     => 'deprecated',
2388     'description' => 'From: address header for welcome email',
2389     'type'        => 'text',
2390     'per_agent'   => 1,
2391   },
2392
2393   {
2394     'key'         => 'welcome_email-subject',
2395     'section'     => 'deprecated',
2396     'description' => 'Subject: header for welcome email',
2397     'type'        => 'text',
2398     'per_agent'   => 1,
2399   },
2400   
2401   {
2402     'key'         => 'welcome_email-mimetype',
2403     'section'     => 'deprecated',
2404     'description' => 'MIME type for welcome email',
2405     'type'        => 'select',
2406     'select_enum' => [ 'text/plain', 'text/html' ],
2407     'per_agent'   => 1,
2408   },
2409
2410   {
2411     'key'         => 'welcome_letter',
2412     'section'     => '',
2413     '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>',
2414     'type'        => 'textarea',
2415   },
2416
2417 #  {
2418 #    'key'         => 'warning_msgnum',
2419 #    'section'     => 'notification',
2420 #    '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.',
2421 #    %msg_template_options,
2422 #  },
2423
2424   {
2425     'key'         => 'warning_email',
2426     'section'     => 'notification',
2427     '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>',
2428     'type'        => 'textarea',
2429   },
2430
2431   {
2432     'key'         => 'warning_email-from',
2433     'section'     => 'notification',
2434     'description' => 'From: address header for warning email',
2435     'type'        => 'text',
2436   },
2437
2438   {
2439     'key'         => 'warning_email-cc',
2440     'section'     => 'notification',
2441     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
2442     'type'        => 'text',
2443   },
2444
2445   {
2446     'key'         => 'warning_email-subject',
2447     'section'     => 'notification',
2448     'description' => 'Subject: header for warning email',
2449     'type'        => 'text',
2450   },
2451   
2452   {
2453     'key'         => 'warning_email-mimetype',
2454     'section'     => 'notification',
2455     'description' => 'MIME type for warning email',
2456     'type'        => 'select',
2457     'select_enum' => [ 'text/plain', 'text/html' ],
2458   },
2459
2460   {
2461     'key'         => 'payby',
2462     'section'     => 'billing',
2463     'description' => 'Available payment types.',
2464     'type'        => 'selectmultiple',
2465     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
2466   },
2467
2468   {
2469     'key'         => 'payby-default',
2470     'section'     => 'UI',
2471     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
2472     'type'        => 'select',
2473     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
2474   },
2475
2476   {
2477     'key'         => 'require_cash_deposit_info',
2478     'section'     => 'billing',
2479     'description' => 'When recording cash payments, display bank deposit information fields.',
2480     'type'        => 'checkbox',
2481   },
2482
2483   {
2484     'key'         => 'paymentforcedtobatch',
2485     'section'     => 'deprecated',
2486     '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.',
2487     'type'        => 'checkbox',
2488   },
2489
2490   {
2491     'key'         => 'svc_acct-notes',
2492     'section'     => 'deprecated',
2493     'description' => 'Extra HTML to be displayed on the Account View screen.',
2494     'type'        => 'textarea',
2495   },
2496
2497   {
2498     'key'         => 'radius-password',
2499     'section'     => '',
2500     'description' => 'RADIUS attribute for plain-text passwords.',
2501     'type'        => 'select',
2502     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
2503   },
2504
2505   {
2506     'key'         => 'radius-ip',
2507     'section'     => '',
2508     'description' => 'RADIUS attribute for IP addresses.',
2509     'type'        => 'select',
2510     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2511   },
2512
2513   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2514   {
2515     'key'         => 'radius-chillispot-max',
2516     'section'     => '',
2517     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2518     'type'        => 'checkbox',
2519   },
2520
2521   {
2522     'key'         => 'svc_broadband-radius',
2523     'section'     => '',
2524     'description' => 'Enable RADIUS groups for broadband services.',
2525     'type'        => 'checkbox',
2526   },
2527
2528   {
2529     'key'         => 'svc_acct-alldomains',
2530     'section'     => '',
2531     '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.',
2532     'type'        => 'checkbox',
2533   },
2534
2535   {
2536     'key'         => 'dump-localdest',
2537     'section'     => '',
2538     'description' => 'Destination for local database dumps (full path)',
2539     'type'        => 'text',
2540   },
2541
2542   {
2543     'key'         => 'dump-scpdest',
2544     'section'     => '',
2545     'description' => 'Destination for scp database dumps: user@host:/path',
2546     'type'        => 'text',
2547   },
2548
2549   {
2550     'key'         => 'dump-pgpid',
2551     'section'     => '',
2552     '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.",
2553     'type'        => 'text',
2554   },
2555
2556   {
2557     'key'         => 'users-allow_comp',
2558     'section'     => 'deprecated',
2559     '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.',
2560     'type'        => 'textarea',
2561   },
2562
2563   {
2564     'key'         => 'credit_card-recurring_billing_flag',
2565     'section'     => 'billing',
2566     '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. ',
2567     'type'        => 'select',
2568     'select_hash' => [
2569                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2570                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
2571                      ],
2572   },
2573
2574   {
2575     'key'         => 'credit_card-recurring_billing_acct_code',
2576     'section'     => 'billing',
2577     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2578     'type'        => 'checkbox',
2579   },
2580
2581   {
2582     'key'         => 'cvv-save',
2583     'section'     => 'billing',
2584     '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.',
2585     'type'        => 'selectmultiple',
2586     'select_enum' => \@card_types,
2587   },
2588
2589   {
2590     'key'         => 'manual_process-pkgpart',
2591     'section'     => 'billing',
2592     '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.',
2593     'type'        => 'select-part_pkg',
2594     'per_agent'   => 1,
2595   },
2596
2597   {
2598     'key'         => 'manual_process-display',
2599     'section'     => 'billing',
2600     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2601     'type'        => 'select',
2602     'select_hash' => [
2603                        'add'      => 'Add fee to amount entered',
2604                        'subtract' => 'Subtract fee from amount entered',
2605                      ],
2606   },
2607
2608   {
2609     'key'         => 'manual_process-skip_first',
2610     'section'     => 'billing',
2611     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2612     'type'        => 'checkbox',
2613   },
2614
2615   {
2616     'key'         => 'selfservice_process-pkgpart',
2617     'section'     => 'billing',
2618     '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.',
2619     'type'        => 'select-part_pkg',
2620     'per_agent'   => 1,
2621   },
2622
2623   {
2624     'key'         => 'selfservice_process-display',
2625     'section'     => 'billing',
2626     'description' => 'When using selfservice_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2627     'type'        => 'select',
2628     'select_hash' => [
2629                        'add'      => 'Add fee to amount entered',
2630                        'subtract' => 'Subtract fee from amount entered',
2631                      ],
2632   },
2633
2634   {
2635     'key'         => 'selfservice_process-skip_first',
2636     'section'     => 'billing',
2637     'description' => "When using selfservice_process-pkgpart, omit the fee if it is the customer's first payment.",
2638     'type'        => 'checkbox',
2639   },
2640
2641 #  {
2642 #    'key'         => 'auto_process-pkgpart',
2643 #    'section'     => 'billing',
2644 #    '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.',
2645 #    'type'        => 'select-part_pkg',
2646 #  },
2647 #
2648 ##  {
2649 ##    'key'         => 'auto_process-display',
2650 ##    'section'     => 'billing',
2651 ##    'description' => 'When using auto_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2652 ##    'type'        => 'select',
2653 ##    'select_hash' => [
2654 ##                       'add'      => 'Add fee to amount entered',
2655 ##                       'subtract' => 'Subtract fee from amount entered',
2656 ##                     ],
2657 ##  },
2658 #
2659 #  {
2660 #    'key'         => 'auto_process-skip_first',
2661 #    'section'     => 'billing',
2662 #    'description' => "When using auto_process-pkgpart, omit the fee if it is the customer's first payment.",
2663 #    'type'        => 'checkbox',
2664 #  },
2665
2666   {
2667     'key'         => 'allow_negative_charges',
2668     'section'     => 'billing',
2669     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2670     'type'        => 'checkbox',
2671   },
2672   {
2673       'key'         => 'auto_unset_catchall',
2674       'section'     => '',
2675       '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.',
2676       'type'        => 'checkbox',
2677   },
2678
2679   {
2680     'key'         => 'system_usernames',
2681     'section'     => 'username',
2682     '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.',
2683     'type'        => 'textarea',
2684   },
2685
2686   {
2687     'key'         => 'cust_pkg-change_svcpart',
2688     'section'     => '',
2689     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
2690     'type'        => 'checkbox',
2691   },
2692
2693   {
2694     'key'         => 'cust_pkg-change_pkgpart-bill_now',
2695     'section'     => '',
2696     '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.",
2697     'type'        => 'checkbox',
2698   },
2699
2700   {
2701     'key'         => 'disable_autoreverse',
2702     'section'     => 'BIND',
2703     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
2704     'type'        => 'checkbox',
2705   },
2706
2707   {
2708     'key'         => 'svc_www-enable_subdomains',
2709     'section'     => '',
2710     'description' => 'Enable selection of specific subdomains for virtual host creation.',
2711     'type'        => 'checkbox',
2712   },
2713
2714   {
2715     'key'         => 'svc_www-usersvc_svcpart',
2716     'section'     => '',
2717     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
2718     'type'        => 'select-part_svc',
2719     'multiple'    => 1,
2720   },
2721
2722   {
2723     'key'         => 'selfservice_server-primary_only',
2724     'section'     => 'self-service',
2725     'description' => 'Only allow primary accounts to access self-service functionality.',
2726     'type'        => 'checkbox',
2727   },
2728
2729   {
2730     'key'         => 'selfservice_server-phone_login',
2731     'section'     => 'self-service',
2732     'description' => 'Allow login to self-service with phone number and PIN.',
2733     'type'        => 'checkbox',
2734   },
2735
2736   {
2737     'key'         => 'selfservice_server-single_domain',
2738     'section'     => 'self-service',
2739     'description' => 'If specified, only use this one domain for self-service access.',
2740     'type'        => 'text',
2741   },
2742
2743   {
2744     'key'         => 'selfservice_server-login_svcpart',
2745     'section'     => 'self-service',
2746     'description' => 'If specified, only allow the specified svcparts to login to self-service.',
2747     'type'        => 'select-part_svc',
2748     'multiple'    => 1,
2749   },
2750
2751   {
2752     'key'         => 'selfservice-svc_forward_svcpart',
2753     'section'     => 'self-service',
2754     'description' => 'Service for self-service forward editing.',
2755     'type'        => 'select-part_svc',
2756   },
2757
2758   {
2759     'key'         => 'selfservice-password_reset_verification',
2760     'section'     => 'self-service',
2761     'description' => 'If enabled, specifies the type of verification required for self-service password resets.',
2762     'type'        => 'select',
2763     'select_hash' => [ '' => 'Password reset disabled',
2764                        'paymask,amount,zip' => 'Verify with credit card (or bank account) last 4 digits, payment amount and zip code',
2765                      ],
2766   },
2767
2768   {
2769     'key'         => 'selfservice-password_reset_msgnum',
2770     'section'     => 'self-service',
2771     'description' => 'Template to use for password reset emails.',
2772     %msg_template_options,
2773   },
2774
2775   {
2776     'key'         => 'selfservice-hide_invoices-taxclass',
2777     'section'     => 'self-service',
2778     '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.',
2779     'type'        => 'text',
2780   },
2781
2782   {
2783     'key'         => 'selfservice-recent-did-age',
2784     'section'     => 'self-service',
2785     'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
2786     'type'        => 'text',
2787   },
2788
2789   {
2790     'key'         => 'selfservice_server-view-wholesale',
2791     'section'     => 'self-service',
2792     'description' => 'If enabled, use a wholesale package view in the self-service.',
2793     'type'        => 'checkbox',
2794   },
2795   
2796   {
2797     'key'         => 'selfservice-agent_signup',
2798     'section'     => 'self-service',
2799     'description' => 'Allow agent signup via self-service.',
2800     'type'        => 'checkbox',
2801   },
2802
2803   {
2804     'key'         => 'selfservice-agent_signup-agent_type',
2805     'section'     => 'self-service',
2806     'description' => 'Agent type when allowing agent signup via self-service.',
2807     'type'        => 'select-sub',
2808     'options_sub' => sub { require FS::Record;
2809                            require FS::agent_type;
2810                            map { $_->typenum => $_->atype }
2811                                FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
2812                          },
2813     'option_sub'  => sub { require FS::Record;
2814                            require FS::agent_type;
2815                            my $agent = FS::Record::qsearchs(
2816                              'agent_type', { 'typenum'=>shift }
2817                            );
2818                            $agent_type ? $agent_type->atype : '';
2819                          },
2820   },
2821
2822   {
2823     'key'         => 'selfservice-agent_login',
2824     'section'     => 'self-service',
2825     'description' => 'Allow agent login via self-service.',
2826     'type'        => 'checkbox',
2827   },
2828
2829   {
2830     'key'         => 'selfservice-self_suspend_reason',
2831     'section'     => 'self-service',
2832     'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
2833     'type'        => 'select-sub',
2834     'options_sub' => sub { require FS::Record;
2835                            require FS::reason;
2836                            my $type = qsearchs('reason_type', 
2837                              { class => 'S' }) 
2838                               or return ();
2839                            map { $_->reasonnum => $_->reason }
2840                                FS::Record::qsearch('reason', 
2841                                  { reason_type => $type->typenum } 
2842                                );
2843                          },
2844     'option_sub'  => sub { require FS::Record;
2845                            require FS::reason;
2846                            my $reason = FS::Record::qsearchs(
2847                              'reason', { 'reasonnum' => shift }
2848                            );
2849                            $reason ? $reason->reason : '';
2850                          },
2851
2852     'per_agent'   => 1,
2853   },
2854
2855   {
2856     'key'         => 'card_refund-days',
2857     'section'     => 'billing',
2858     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
2859     'type'        => 'text',
2860   },
2861
2862   {
2863     'key'         => 'agent-showpasswords',
2864     'section'     => '',
2865     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
2866     'type'        => 'checkbox',
2867   },
2868
2869   {
2870     'key'         => 'global_unique-username',
2871     'section'     => 'username',
2872     '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.',
2873     'type'        => 'select',
2874     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
2875   },
2876
2877   {
2878     'key'         => 'global_unique-phonenum',
2879     'section'     => '',
2880     '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.',
2881     'type'        => 'select',
2882     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
2883   },
2884
2885   {
2886     'key'         => 'global_unique-pbx_title',
2887     'section'     => '',
2888     'description' => 'Global phone number uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2889     'type'        => 'select',
2890     'select_enum' => [ 'enabled', 'disabled' ],
2891   },
2892
2893   {
2894     'key'         => 'global_unique-pbx_id',
2895     'section'     => '',
2896     'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2897     'type'        => 'select',
2898     'select_enum' => [ 'enabled', 'disabled' ],
2899   },
2900
2901   {
2902     'key'         => 'svc_external-skip_manual',
2903     'section'     => 'UI',
2904     '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).',
2905     'type'        => 'checkbox',
2906   },
2907
2908   {
2909     'key'         => 'svc_external-display_type',
2910     'section'     => 'UI',
2911     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
2912     'type'        => 'select',
2913     'select_enum' => [ 'generic', 'artera_turbo', ],
2914   },
2915
2916   {
2917     'key'         => 'ticket_system',
2918     'section'     => 'ticketing',
2919     '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).',
2920     'type'        => 'select',
2921     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
2922     'select_enum' => [ '', qw(RT_Internal RT_External) ],
2923   },
2924
2925   {
2926     'key'         => 'network_monitoring_system',
2927     'section'     => 'network_monitoring',
2928     '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>).',
2929     'type'        => 'select',
2930     'select_enum' => [ '', qw(Torrus_Internal) ],
2931   },
2932
2933   {
2934     'key'         => 'nms-auto_add-svc_ips',
2935     'section'     => 'network_monitoring',
2936     'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
2937     'type'        => 'selectmultiple',
2938     'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
2939   },
2940
2941   {
2942     'key'         => 'nms-auto_add-community',
2943     'section'     => 'network_monitoring',
2944     'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
2945     'type'        => 'text',
2946   },
2947
2948   {
2949     'key'         => 'ticket_system-default_queueid',
2950     'section'     => 'ticketing',
2951     'description' => 'Default queue used when creating new customer tickets.',
2952     'type'        => 'select-sub',
2953     'options_sub' => sub {
2954                            my $conf = new FS::Conf;
2955                            if ( $conf->config('ticket_system') ) {
2956                              eval "use FS::TicketSystem;";
2957                              die $@ if $@;
2958                              FS::TicketSystem->queues();
2959                            } else {
2960                              ();
2961                            }
2962                          },
2963     'option_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->queue(shift);
2969                            } else {
2970                              '';
2971                            }
2972                          },
2973   },
2974   {
2975     'key'         => 'ticket_system-force_default_queueid',
2976     'section'     => 'ticketing',
2977     'description' => 'Disallow queue selection when creating new tickets from customer view.',
2978     'type'        => 'checkbox',
2979   },
2980   {
2981     'key'         => 'ticket_system-selfservice_queueid',
2982     'section'     => 'ticketing',
2983     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
2984     #false laziness w/above
2985     'type'        => 'select-sub',
2986     'options_sub' => sub {
2987                            my $conf = new FS::Conf;
2988                            if ( $conf->config('ticket_system') ) {
2989                              eval "use FS::TicketSystem;";
2990                              die $@ if $@;
2991                              FS::TicketSystem->queues();
2992                            } else {
2993                              ();
2994                            }
2995                          },
2996     'option_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->queue(shift);
3002                            } else {
3003                              '';
3004                            }
3005                          },
3006   },
3007
3008   {
3009     'key'         => 'ticket_system-requestor',
3010     'section'     => 'ticketing',
3011     'description' => 'Email address to use as the requestor for new tickets.  If blank, the customer\'s invoicing address(es) will be used.',
3012     'type'        => 'text',
3013   },
3014
3015   {
3016     'key'         => 'ticket_system-priority_reverse',
3017     'section'     => 'ticketing',
3018     '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.',
3019     'type'        => 'checkbox',
3020   },
3021
3022   {
3023     'key'         => 'ticket_system-custom_priority_field',
3024     'section'     => 'ticketing',
3025     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
3026     'type'        => 'text',
3027   },
3028
3029   {
3030     'key'         => 'ticket_system-custom_priority_field-values',
3031     'section'     => 'ticketing',
3032     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
3033     'type'        => 'textarea',
3034   },
3035
3036   {
3037     'key'         => 'ticket_system-custom_priority_field_queue',
3038     'section'     => 'ticketing',
3039     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
3040     'type'        => 'text',
3041   },
3042
3043   {
3044     'key'         => 'ticket_system-selfservice_priority_field',
3045     'section'     => 'ticketing',
3046     'description' => 'Custom field from the ticket system to use as a customer-managed priority field.',
3047     'type'        => 'text',
3048   },
3049
3050   {
3051     'key'         => 'ticket_system-selfservice_edit_subject',
3052     'section'     => 'ticketing',
3053     'description' => 'Allow customers to edit ticket subjects through selfservice.',
3054     'type'        => 'checkbox',
3055   },
3056
3057   {
3058     'key'         => 'ticket_system-escalation',
3059     'section'     => 'ticketing',
3060     'description' => 'Enable priority escalation of tickets as part of daily batch processing.',
3061     'type'        => 'checkbox',
3062   },
3063
3064   {
3065     'key'         => 'ticket_system-rt_external_datasrc',
3066     'section'     => 'ticketing',
3067     '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>',
3068     'type'        => 'text',
3069
3070   },
3071
3072   {
3073     'key'         => 'ticket_system-rt_external_url',
3074     'section'     => 'ticketing',
3075     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
3076     'type'        => 'text',
3077   },
3078
3079   {
3080     'key'         => 'company_name',
3081     'section'     => 'required',
3082     'description' => 'Your company name',
3083     'type'        => 'text',
3084     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
3085   },
3086
3087   {
3088     'key'         => 'company_url',
3089     'section'     => 'UI',
3090     'description' => 'Your company URL',
3091     'type'        => 'text',
3092     'per_agent'   => 1,
3093   },
3094
3095   {
3096     'key'         => 'company_address',
3097     'section'     => 'required',
3098     'description' => 'Your company address',
3099     'type'        => 'textarea',
3100     'per_agent'   => 1,
3101   },
3102
3103   {
3104     'key'         => 'company_phonenum',
3105     'section'     => 'notification',
3106     'description' => 'Your company phone number',
3107     'type'        => 'text',
3108     'per_agent'   => 1,
3109   },
3110
3111   {
3112     'key'         => 'echeck-void',
3113     'section'     => 'deprecated',
3114     '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',
3115     'type'        => 'checkbox',
3116   },
3117
3118   {
3119     'key'         => 'cc-void',
3120     'section'     => 'deprecated',
3121     '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',
3122     'type'        => 'checkbox',
3123   },
3124
3125   {
3126     'key'         => 'unvoid',
3127     'section'     => 'deprecated',
3128     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
3129     'type'        => 'checkbox',
3130   },
3131
3132   {
3133     'key'         => 'address1-search',
3134     'section'     => 'UI',
3135     '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.',
3136     'type'        => 'checkbox',
3137   },
3138
3139   {
3140     'key'         => 'address2-search',
3141     'section'     => 'UI',
3142     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
3143     'type'        => 'checkbox',
3144   },
3145
3146   {
3147     'key'         => 'cust_main-require_address2',
3148     'section'     => 'UI',
3149     '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',
3150     'type'        => 'checkbox',
3151   },
3152
3153   {
3154     'key'         => 'agent-ship_address',
3155     'section'     => '',
3156     '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.",
3157     'type'        => 'checkbox',
3158     'per_agent'   => 1,
3159   },
3160
3161   { 'key'         => 'referral_credit',
3162     'section'     => 'deprecated',
3163     '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.",
3164     'type'        => 'checkbox',
3165   },
3166
3167   { 'key'         => 'selfservice_server-cache_module',
3168     'section'     => 'self-service',
3169     '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.',
3170     'type'        => 'select',
3171     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
3172   },
3173
3174   {
3175     'key'         => 'hylafax',
3176     'section'     => 'billing',
3177     '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).',
3178     'type'        => [qw( checkbox textarea )],
3179   },
3180
3181   {
3182     'key'         => 'cust_bill-ftpformat',
3183     'section'     => 'invoicing',
3184     'description' => 'Enable FTP of raw invoice data - format.',
3185     'type'        => 'select',
3186     'options'     => [ spool_formats() ],
3187   },
3188
3189   {
3190     'key'         => 'cust_bill-ftpserver',
3191     'section'     => 'invoicing',
3192     'description' => 'Enable FTP of raw invoice data - server.',
3193     'type'        => 'text',
3194   },
3195
3196   {
3197     'key'         => 'cust_bill-ftpusername',
3198     'section'     => 'invoicing',
3199     'description' => 'Enable FTP of raw invoice data - server.',
3200     'type'        => 'text',
3201   },
3202
3203   {
3204     'key'         => 'cust_bill-ftppassword',
3205     'section'     => 'invoicing',
3206     'description' => 'Enable FTP of raw invoice data - server.',
3207     'type'        => 'text',
3208   },
3209
3210   {
3211     'key'         => 'cust_bill-ftpdir',
3212     'section'     => 'invoicing',
3213     'description' => 'Enable FTP of raw invoice data - server.',
3214     'type'        => 'text',
3215   },
3216
3217   {
3218     'key'         => 'cust_bill-spoolformat',
3219     'section'     => 'invoicing',
3220     'description' => 'Enable spooling of raw invoice data - format.',
3221     'type'        => 'select',
3222     'options'     => [ spool_formats() ],
3223   },
3224
3225   {
3226     'key'         => 'cust_bill-spoolagent',
3227     'section'     => 'invoicing',
3228     'description' => 'Enable per-agent spooling of raw invoice data.',
3229     'type'        => 'checkbox',
3230   },
3231
3232   {
3233     'key'         => 'bridgestone-batch_counter',
3234     'section'     => '',
3235     'description' => 'Batch counter for spool files.  Increments every time a spool file is uploaded.',
3236     'type'        => 'text',
3237     'per_agent'   => 1,
3238   },
3239
3240   {
3241     'key'         => 'bridgestone-prefix',
3242     'section'     => '',
3243     'description' => 'Agent identifier for uploading to BABT printing service.',
3244     'type'        => 'text',
3245     'per_agent'   => 1,
3246   },
3247
3248   {
3249     'key'         => 'bridgestone-confirm_template',
3250     'section'     => '',
3251     '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.',
3252     # this could use a true message template, but it's hard to see how that
3253     # would make the world a better place
3254     'type'        => 'textarea',
3255     'per_agent'   => 1,
3256   },
3257
3258   {
3259     'key'         => 'ics-confirm_template',
3260     'section'     => '',
3261     'description' => 'Confirmation email template for uploading to ICS invoice printing.  Text::Template format, with variables "%count" and "%sum".',
3262     'type'        => 'textarea',
3263     'per_agent'   => 1,
3264   },
3265
3266   {
3267     'key'         => 'svc_acct-usage_suspend',
3268     'section'     => 'billing',
3269     '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.',
3270     'type'        => 'checkbox',
3271   },
3272
3273   {
3274     'key'         => 'svc_acct-usage_unsuspend',
3275     'section'     => 'billing',
3276     '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.',
3277     'type'        => 'checkbox',
3278   },
3279
3280   {
3281     'key'         => 'svc_acct-usage_threshold',
3282     'section'     => 'billing',
3283     '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.',
3284     'type'        => 'text',
3285   },
3286
3287   {
3288     'key'         => 'overlimit_groups',
3289     'section'     => '',
3290     'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.',
3291     'type'        => 'select-sub',
3292     'per_agent'   => 1,
3293     'multiple'    => 1,
3294     'options_sub' => sub { require FS::Record;
3295                            require FS::radius_group;
3296                            map { $_->groupnum => $_->long_description }
3297                                FS::Record::qsearch('radius_group', {} );
3298                          },
3299     'option_sub'  => sub { require FS::Record;
3300                            require FS::radius_group;
3301                            my $radius_group = FS::Record::qsearchs(
3302                              'radius_group', { 'groupnum' => shift }
3303                            );
3304                $radius_group ? $radius_group->long_description : '';
3305                          },
3306   },
3307
3308   {
3309     'key'         => 'cust-fields',
3310     'section'     => 'UI',
3311     'description' => 'Which customer fields to display on reports by default',
3312     'type'        => 'select',
3313     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
3314   },
3315
3316   {
3317     'key'         => 'cust_location-label_prefix',
3318     'section'     => 'UI',
3319     'description' => 'Optional "site ID" to show in the location label',
3320     'type'        => 'select',
3321     'select_hash' => [ '' => '',
3322                        'CoStAg' => 'CoStAgXXXXX (country, state, agent name, locationnum)',
3323                       ],
3324   },
3325
3326   {
3327     'key'         => 'cust_pkg-display_times',
3328     'section'     => 'UI',
3329     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
3330     'type'        => 'checkbox',
3331   },
3332
3333   {
3334     'key'         => 'cust_pkg-always_show_location',
3335     'section'     => 'UI',
3336     'description' => "Always display package locations, even when they're all the default service address.",
3337     'type'        => 'checkbox',
3338   },
3339
3340   {
3341     'key'         => 'cust_pkg-group_by_location',
3342     'section'     => 'UI',
3343     'description' => "Group packages by location.",
3344     'type'        => 'checkbox',
3345   },
3346
3347   {
3348     'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
3349     'section'     => 'UI',
3350     'description' => "Show fields on package definitions for FCC Form 477 classification",
3351     'type'        => 'checkbox',
3352   },
3353
3354   {
3355     'key'         => 'cust_pkg-large_pkg_size',
3356     'section'     => 'UI',
3357     'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
3358     'type'        => 'text',
3359   },
3360
3361   {
3362     'key'         => 'svc_acct-edit_uid',
3363     'section'     => 'shell',
3364     'description' => 'Allow UID editing.',
3365     'type'        => 'checkbox',
3366   },
3367
3368   {
3369     'key'         => 'svc_acct-edit_gid',
3370     'section'     => 'shell',
3371     'description' => 'Allow GID editing.',
3372     'type'        => 'checkbox',
3373   },
3374
3375   {
3376     'key'         => 'svc_acct-no_edit_username',
3377     'section'     => 'shell',
3378     'description' => 'Disallow username editing.',
3379     'type'        => 'checkbox',
3380   },
3381
3382   {
3383     'key'         => 'zone-underscore',
3384     'section'     => 'BIND',
3385     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
3386     'type'        => 'checkbox',
3387   },
3388
3389   {
3390     'key'         => 'echeck-nonus',
3391     'section'     => 'billing',
3392     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
3393     'type'        => 'checkbox',
3394   },
3395
3396   {
3397     'key'         => 'echeck-country',
3398     'section'     => 'billing',
3399     'description' => 'Format electronic check information for the specified country.',
3400     'type'        => 'select',
3401     'select_hash' => [ 'US' => 'United States',
3402                        'CA' => 'Canada (enables branch)',
3403                        'XX' => 'Other',
3404                      ],
3405   },
3406
3407   {
3408     'key'         => 'voip-cust_accountcode_cdr',
3409     'section'     => 'telephony',
3410     'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
3411     'type'        => 'checkbox',
3412   },
3413
3414   {
3415     'key'         => 'voip-cust_cdr_spools',
3416     'section'     => 'telephony',
3417     'description' => 'Enable the per-customer option for individual CDR spools.',
3418     'type'        => 'checkbox',
3419   },
3420
3421   {
3422     'key'         => 'voip-cust_cdr_squelch',
3423     'section'     => 'telephony',
3424     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
3425     'type'        => 'checkbox',
3426   },
3427
3428   {
3429     'key'         => 'voip-cdr_email',
3430     'section'     => 'telephony',
3431     '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.',
3432     'type'        => 'checkbox',
3433   },
3434
3435   {
3436     'key'         => 'voip-cust_email_csv_cdr',
3437     'section'     => 'telephony',
3438     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
3439     'type'        => 'checkbox',
3440   },
3441
3442   {
3443     'key'         => 'cgp_rule-domain_templates',
3444     'section'     => '',
3445     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
3446     'type'        => 'textarea',
3447   },
3448
3449   {
3450     'key'         => 'svc_forward-no_srcsvc',
3451     'section'     => '',
3452     '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.",
3453     'type'        => 'checkbox',
3454   },
3455
3456   {
3457     'key'         => 'svc_forward-arbitrary_dst',
3458     'section'     => '',
3459     '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.",
3460     'type'        => 'checkbox',
3461   },
3462
3463   {
3464     'key'         => 'tax-ship_address',
3465     'section'     => 'billing',
3466     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
3467     'type'        => 'checkbox',
3468   }
3469 ,
3470   {
3471     'key'         => 'tax-pkg_address',
3472     'section'     => 'billing',
3473     '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).',
3474     'type'        => 'checkbox',
3475   },
3476
3477   {
3478     'key'         => 'invoice-ship_address',
3479     'section'     => 'invoicing',
3480     'description' => 'Include the shipping address on invoices.',
3481     'type'        => 'checkbox',
3482   },
3483
3484   {
3485     'key'         => 'invoice-unitprice',
3486     'section'     => 'invoicing',
3487     'description' => 'Enable unit pricing on invoices and quantities on packages.',
3488     'type'        => 'checkbox',
3489   },
3490
3491   {
3492     'key'         => 'invoice-smallernotes',
3493     'section'     => 'invoicing',
3494     'description' => 'Display the notes section in a smaller font on invoices.',
3495     'type'        => 'checkbox',
3496   },
3497
3498   {
3499     'key'         => 'invoice-smallerfooter',
3500     'section'     => 'invoicing',
3501     'description' => 'Display footers in a smaller font on invoices.',
3502     'type'        => 'checkbox',
3503   },
3504
3505   {
3506     'key'         => 'postal_invoice-fee_pkgpart',
3507     'section'     => 'billing',
3508     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
3509     'type'        => 'select-part_pkg',
3510     'per_agent'   => 1,
3511   },
3512
3513   {
3514     'key'         => 'postal_invoice-recurring_only',
3515     'section'     => 'billing',
3516     'description' => 'The postal invoice fee is omitted on invoices without recurring charges when this is set.',
3517     'type'        => 'checkbox',
3518   },
3519
3520   {
3521     'key'         => 'batch-enable',
3522     'section'     => 'deprecated', #make sure batch-enable_payby is set for
3523                                    #everyone before removing
3524     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
3525     'type'        => 'checkbox',
3526   },
3527
3528   {
3529     'key'         => 'batch-enable_payby',
3530     'section'     => 'billing',
3531     'description' => 'Enable batch processing for the specified payment types.',
3532     'type'        => 'selectmultiple',
3533     'select_enum' => [qw( CARD CHEK )],
3534   },
3535
3536   {
3537     'key'         => 'realtime-disable_payby',
3538     'section'     => 'billing',
3539     'description' => 'Disable realtime processing for the specified payment types.',
3540     'type'        => 'selectmultiple',
3541     'select_enum' => [qw( CARD CHEK )],
3542   },
3543
3544   {
3545     'key'         => 'batch-default_format',
3546     'section'     => 'billing',
3547     'description' => 'Default format for batches.',
3548     'type'        => 'select',
3549     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch',
3550                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
3551                        'paymentech', 'ach-spiritone', 'RBC'
3552                     ]
3553   },
3554
3555   { 'key'         => 'batch-gateway-CARD',
3556     'section'     => 'billing',
3557     'description' => 'Business::BatchPayment gateway for credit card batches.',
3558     %batch_gateway_options,
3559   },
3560
3561   { 'key'         => 'batch-gateway-CHEK',
3562     'section'     => 'billing', 
3563     'description' => 'Business::BatchPayment gateway for check batches.',
3564     %batch_gateway_options,
3565   },
3566
3567   {
3568     'key'         => 'batch-reconsider',
3569     'section'     => 'billing',
3570     '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.',
3571     'type'        => 'checkbox',
3572   },
3573
3574   {
3575     'key'         => 'batch-auto_resolve_days',
3576     'section'     => 'billing',
3577     'description' => 'Automatically resolve payment batches this many days after they were first downloaded.',
3578     'type'        => 'text',
3579   },
3580
3581   {
3582     'key'         => 'batch-auto_resolve_status',
3583     'section'     => 'billing',
3584     'description' => 'When automatically resolving payment batches, take this action for payments of unknown status.',
3585     'type'        => 'select',
3586     'select_enum' => [ 'approve', 'decline' ],
3587   },
3588
3589   {
3590     'key'         => 'batch-errors_to',
3591     'section'     => 'billing',
3592     'description' => 'Email errors when processing batches to this address.  If unspecified, batch processing will stop immediately on error.',
3593     'type'        => 'text',
3594   },
3595
3596   #lists could be auto-generated from pay_batch info
3597   {
3598     'key'         => 'batch-fixed_format-CARD',
3599     'section'     => 'billing',
3600     'description' => 'Fixed (unchangeable) format for credit card batches.',
3601     'type'        => 'select',
3602     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
3603                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
3604   },
3605
3606   {
3607     'key'         => 'batch-fixed_format-CHEK',
3608     'section'     => 'billing',
3609     'description' => 'Fixed (unchangeable) format for electronic check batches.',
3610     'type'        => 'select',
3611     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'BoM',
3612                        'PAP', 'paymentech', 'ach-spiritone', 'RBC',
3613                        'td_eft1464', 'eft_canada'
3614                      ]
3615   },
3616
3617   {
3618     'key'         => 'batch-increment_expiration',
3619     'section'     => 'billing',
3620     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
3621     'type'        => 'checkbox'
3622   },
3623
3624   {
3625     'key'         => 'batchconfig-BoM',
3626     'section'     => 'billing',
3627     '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',
3628     'type'        => 'textarea',
3629   },
3630
3631   {
3632     'key'         => 'batchconfig-PAP',
3633     'section'     => 'billing',
3634     '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',
3635     'type'        => 'textarea',
3636   },
3637
3638   {
3639     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
3640     'section'     => 'billing',
3641     'description' => 'Gateway ID for Chase Canada E-xact batching',
3642     'type'        => 'text',
3643   },
3644
3645   {
3646     'key'         => 'batchconfig-paymentech',
3647     'section'     => 'billing',
3648     '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.',
3649     'type'        => 'textarea',
3650   },
3651
3652   {
3653     'key'         => 'batchconfig-RBC',
3654     'section'     => 'billing',
3655     'description' => 'Configuration for Royal Bank of Canada PDS batching, four lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code.',
3656     'type'        => 'textarea',
3657   },
3658
3659   {
3660     'key'         => 'batchconfig-td_eft1464',
3661     'section'     => 'billing',
3662     '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.',
3663     'type'        => 'textarea',
3664   },
3665
3666   {
3667     'key'         => 'batchconfig-eft_canada',
3668     'section'     => 'billing',
3669     '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.',
3670     'type'        => 'textarea',
3671     'per_agent'   => 1,
3672   },
3673
3674   {
3675     'key'         => 'batchconfig-nacha-destination',
3676     'section'     => 'billing',
3677     'description' => 'Configuration for NACHA batching, Destination (9 digit transit routing number).',
3678     'type'        => 'text',
3679   },
3680
3681   {
3682     'key'         => 'batchconfig-nacha-destination_name',
3683     'section'     => 'billing',
3684     'description' => 'Configuration for NACHA batching, Destination (Bank Name, up to 23 characters).',
3685     'type'        => 'text',
3686   },
3687
3688   {
3689     'key'         => 'batchconfig-nacha-origin',
3690     'section'     => 'billing',
3691     'description' => 'Configuration for NACHA batching, Origin (your 10-digit company number, IRS tax ID recommended).',
3692     'type'        => 'text',
3693   },
3694
3695   {
3696     'key'         => 'batch-manual_approval',
3697     'section'     => 'billing',
3698     '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.',
3699     'type'        => 'checkbox',
3700   },
3701
3702   {
3703     'key'         => 'batch-spoolagent',
3704     'section'     => 'billing',
3705     'description' => 'Store payment batches per-agent.',
3706     'type'        => 'checkbox',
3707   },
3708
3709   {
3710     'key'         => 'payment_history-years',
3711     'section'     => 'UI',
3712     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
3713     'type'        => 'text',
3714   },
3715
3716   {
3717     'key'         => 'change_history-years',
3718     'section'     => 'UI',
3719     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
3720     'type'        => 'text',
3721   },
3722
3723   {
3724     'key'         => 'cust_main-packages-years',
3725     'section'     => 'UI',
3726     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
3727     'type'        => 'text',
3728   },
3729
3730   {
3731     'key'         => 'cust_main-use_comments',
3732     'section'     => 'UI',
3733     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
3734     'type'        => 'checkbox',
3735   },
3736
3737   {
3738     'key'         => 'cust_main-disable_notes',
3739     'section'     => 'UI',
3740     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
3741     'type'        => 'checkbox',
3742   },
3743
3744   {
3745     'key'         => 'cust_main_note-display_times',
3746     'section'     => 'UI',
3747     'description' => 'Display full timestamps (not just dates) for customer notes.',
3748     'type'        => 'checkbox',
3749   },
3750
3751   {
3752     'key'         => 'cust_main-ticket_statuses',
3753     'section'     => 'UI',
3754     'description' => 'Show tickets with these statuses on the customer view page.',
3755     'type'        => 'selectmultiple',
3756     'select_enum' => [qw( new open stalled resolved rejected deleted )],
3757   },
3758
3759   {
3760     'key'         => 'cust_main-max_tickets',
3761     'section'     => 'UI',
3762     'description' => 'Maximum number of tickets to show on the customer view page.',
3763     'type'        => 'text',
3764   },
3765
3766   {
3767     'key'         => 'cust_main-enable_birthdate',
3768     'section'     => 'UI',
3769     'description' => 'Enable tracking of a birth date with each customer record',
3770     'type'        => 'checkbox',
3771   },
3772
3773   {
3774     'key'         => 'cust_main-enable_spouse_birthdate',
3775     'section'     => 'UI',
3776     'description' => 'Enable tracking of a spouse birth date with each customer record',
3777     'type'        => 'checkbox',
3778   },
3779
3780   {
3781     'key'         => 'cust_main-enable_anniversary_date',
3782     'section'     => 'UI',
3783     'description' => 'Enable tracking of an anniversary date with each customer record',
3784     'type'        => 'checkbox',
3785   },
3786
3787   {
3788     'key'         => 'cust_main-edit_calling_list_exempt',
3789     'section'     => 'UI',
3790     'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
3791     'type'        => 'checkbox',
3792   },
3793
3794   {
3795     'key'         => 'support-key',
3796     'section'     => '',
3797     '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.',
3798     'type'        => 'text',
3799   },
3800
3801   {
3802     'key'         => 'card-types',
3803     'section'     => 'billing',
3804     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
3805     'type'        => 'selectmultiple',
3806     'select_enum' => \@card_types,
3807   },
3808
3809   {
3810     'key'         => 'disable-fuzzy',
3811     'section'     => 'UI',
3812     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
3813     'type'        => 'checkbox',
3814   },
3815
3816   { 'key'         => 'pkg_referral',
3817     'section'     => '',
3818     'description' => 'Enable package-specific advertising sources.',
3819     'type'        => 'checkbox',
3820   },
3821
3822   { 'key'         => 'pkg_referral-multiple',
3823     'section'     => '',
3824     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
3825     'type'        => 'checkbox',
3826   },
3827
3828   {
3829     'key'         => 'dashboard-install_welcome',
3830     'section'     => 'UI',
3831     'description' => 'New install welcome screen.',
3832     'type'        => 'select',
3833     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
3834   },
3835
3836   {
3837     'key'         => 'dashboard-toplist',
3838     'section'     => 'UI',
3839     'description' => 'List of items to display on the top of the front page',
3840     'type'        => 'textarea',
3841   },
3842
3843   {
3844     'key'         => 'impending_recur_msgnum',
3845     'section'     => 'notification',
3846     'description' => 'Template to use for alerts about first-time recurring billing.',
3847     %msg_template_options,
3848   },
3849
3850   {
3851     'key'         => 'impending_recur_template',
3852     'section'     => 'deprecated',
3853     '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>',
3854 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
3855     'type'        => 'textarea',
3856   },
3857
3858   {
3859     'key'         => 'logo.png',
3860     'section'     => 'UI',  #'invoicing' ?
3861     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
3862     'type'        => 'image',
3863     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
3864                         #old-style editor anyway...?
3865     'per_locale'  => 1,
3866   },
3867
3868   {
3869     'key'         => 'logo.eps',
3870     'section'     => 'invoicing',
3871     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
3872     'type'        => 'image',
3873     'per_agent'   => 1, #XXX as above, kinda
3874     'per_locale'  => 1,
3875   },
3876
3877   {
3878     'key'         => 'selfservice-ignore_quantity',
3879     'section'     => 'self-service',
3880     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
3881     'type'        => 'checkbox',
3882   },
3883
3884   {
3885     'key'         => 'selfservice-session_timeout',
3886     'section'     => 'self-service',
3887     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
3888     'type'        => 'select',
3889     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
3890   },
3891
3892   {
3893     'key'         => 'disable_setup_suspended_pkgs',
3894     'section'     => 'billing',
3895     'description' => 'Disables charging of setup fees for suspended packages.',
3896     'type'        => 'checkbox',
3897   },
3898
3899   {
3900     'key'         => 'password-generated-allcaps',
3901     'section'     => 'password',
3902     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
3903     'type'        => 'checkbox',
3904   },
3905
3906   {
3907     'key'         => 'datavolume-forcemegabytes',
3908     'section'     => 'UI',
3909     'description' => 'All data volumes are expressed in megabytes',
3910     'type'        => 'checkbox',
3911   },
3912
3913   {
3914     'key'         => 'datavolume-significantdigits',
3915     'section'     => 'UI',
3916     'description' => 'number of significant digits to use to represent data volumes',
3917     'type'        => 'text',
3918   },
3919
3920   {
3921     'key'         => 'disable_void_after',
3922     'section'     => 'billing',
3923     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
3924     'type'        => 'text',
3925   },
3926
3927   {
3928     'key'         => 'disable_line_item_date_ranges',
3929     'section'     => 'billing',
3930     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
3931     'type'        => 'checkbox',
3932   },
3933
3934   {
3935     'key'         => 'cust_bill-line_item-date_style',
3936     'section'     => 'billing',
3937     'description' => 'Display format for line item date ranges on invoice line items.',
3938     'type'        => 'select',
3939     'select_hash' => [ ''           => 'STARTDATE-ENDDATE',
3940                        'month_of'   => 'Month of MONTHNAME',
3941                        'X_month'    => 'DATE_DESC MONTHNAME',
3942                      ],
3943     'per_agent'   => 1,
3944   },
3945
3946   {
3947     'key'         => 'cust_bill-line_item-date_style-non_monthly',
3948     'section'     => 'billing',
3949     'description' => 'If set, override cust_bill-line_item-date_style for non-monthly charges.',
3950     'type'        => 'select',
3951     'select_hash' => [ ''           => 'Default',
3952                        'start_end'  => 'STARTDATE-ENDDATE',
3953                        'month_of'   => 'Month of MONTHNAME',
3954                        'X_month'    => 'DATE_DESC MONTHNAME',
3955                      ],
3956     'per_agent'   => 1,
3957   },
3958
3959   {
3960     'key'         => 'cust_bill-line_item-date_description',
3961     'section'     => 'billing',
3962     'description' => 'Text to display for "DATE_DESC" when using cust_bill-line_item-date_style DATE_DESC MONTHNAME.',
3963     'type'        => 'text',
3964     'per_agent'   => 1,
3965   },
3966
3967   {
3968     'key'         => 'support_packages',
3969     'section'     => '',
3970     '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...
3971     'type'        => 'select-part_pkg',
3972     'multiple'    => 1,
3973   },
3974
3975   {
3976     'key'         => 'cust_main-require_phone',
3977     'section'     => '',
3978     'description' => 'Require daytime or night phone for all customer records.',
3979     'type'        => 'checkbox',
3980     'per_agent'   => 1,
3981   },
3982
3983   {
3984     'key'         => 'cust_main-require_invoicing_list_email',
3985     'section'     => '',
3986     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
3987     'type'        => 'checkbox',
3988     'per_agent'   => 1,
3989   },
3990
3991   {
3992     'key'         => 'cust_main-check_unique',
3993     'section'     => '',
3994     'description' => 'Warn before creating a customer record where these fields duplicate another customer.',
3995     'type'        => 'select',
3996     'multiple'    => 1,
3997     'select_hash' => [ 
3998       #'address1' => 'Billing address',
3999     ],
4000   },
4001
4002   {
4003     'key'         => 'svc_acct-display_paid_time_remaining',
4004     'section'     => '',
4005     'description' => 'Show paid time remaining in addition to time remaining.',
4006     'type'        => 'checkbox',
4007   },
4008
4009   {
4010     'key'         => 'cancel_credit_type',
4011     'section'     => 'billing',
4012     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
4013     reason_type_options('R'),
4014   },
4015
4016   {
4017     'key'         => 'suspend_credit_type',
4018     'section'     => 'billing',
4019     'description' => 'The group to use for new, automatically generated credit reasons resulting from package suspension.',
4020     reason_type_options('R'),
4021   },
4022
4023   {
4024     'key'         => 'referral_credit_type',
4025     'section'     => 'deprecated',
4026     '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.',
4027     reason_type_options('R'),
4028   },
4029
4030   {
4031     'key'         => 'signup_credit_type',
4032     'section'     => 'billing', #self-service?
4033     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
4034     reason_type_options('R'),
4035   },
4036
4037   {
4038     'key'         => 'prepayment_discounts-credit_type',
4039     'section'     => 'billing',
4040     'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
4041     reason_type_options('R'),
4042   },
4043
4044   {
4045     'key'         => 'cust_main-agent_custid-format',
4046     'section'     => '',
4047     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
4048     'type'        => 'select',
4049     'select_hash' => [
4050                        ''       => 'Numeric only',
4051                        '\d{7}'  => 'Numeric only, exactly 7 digits',
4052                        'ww?d+'  => 'Numeric with one or two letter prefix',
4053                      ],
4054   },
4055
4056   {
4057     'key'         => 'card_masking_method',
4058     'section'     => 'UI',
4059     '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.',
4060     'type'        => 'select',
4061     'select_hash' => [
4062                        ''            => '123456xxxxxx1234',
4063                        'first6last2' => '123456xxxxxxxx12',
4064                        'first4last4' => '1234xxxxxxxx1234',
4065                        'first4last2' => '1234xxxxxxxxxx12',
4066                        'first2last4' => '12xxxxxxxxxx1234',
4067                        'first2last2' => '12xxxxxxxxxxxx12',
4068                        'first0last4' => 'xxxxxxxxxxxx1234',
4069                        'first0last2' => 'xxxxxxxxxxxxxx12',
4070                      ],
4071   },
4072
4073   {
4074     'key'         => 'disable_previous_balance',
4075     'section'     => 'invoicing',
4076     'description' => 'Disable inclusion of previous balance, payment, and credit lines on invoices.',
4077     'type'        => 'checkbox',
4078     'per_agent'   => 1,
4079   },
4080
4081   {
4082     'key'         => 'previous_balance-exclude_from_total',
4083     'section'     => 'invoicing',
4084     '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',
4085     'type'        => [ qw(checkbox text) ],
4086   },
4087
4088   {
4089     'key'         => 'previous_balance-summary_only',
4090     'section'     => 'invoicing',
4091     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
4092     'type'        => 'checkbox',
4093   },
4094
4095   {
4096     'key'         => 'previous_balance-show_credit',
4097     'section'     => 'invoicing',
4098     'description' => 'Show the customer\'s credit balance on invoices when applicable.',
4099     'type'        => 'checkbox',
4100   },
4101
4102   {
4103     'key'         => 'previous_balance-show_on_statements',
4104     'section'     => 'invoicing',
4105     'description' => 'Show previous invoices on statements, without itemized charges.',
4106     'type'        => 'checkbox',
4107   },
4108
4109   {
4110     'key'         => 'balance_due_below_line',
4111     'section'     => 'invoicing',
4112     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
4113     'type'        => 'checkbox',
4114   },
4115
4116   {
4117     'key'         => 'address_standardize_method',
4118     'section'     => 'UI', #???
4119     'description' => 'Method for standardizing customer addresses.',
4120     'type'        => 'select',
4121     'select_hash' => [ '' => '', 
4122                        'usps' => 'U.S. Postal Service',
4123                        'ezlocate' => 'EZLocate',
4124                      ],
4125   },
4126
4127   {
4128     'key'         => 'usps_webtools-userid',
4129     'section'     => 'UI',
4130     '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.',
4131     'type'        => 'text',
4132   },
4133
4134   {
4135     'key'         => 'usps_webtools-password',
4136     'section'     => 'UI',
4137     '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.',
4138     'type'        => 'text',
4139   },
4140
4141   {
4142     'key'         => 'ezlocate-userid',
4143     'section'     => 'UI',
4144     'description' => 'User ID for EZ-Locate service.  See <a href="http://www.geocode.com/">the TomTom website</a> for access and pricing information.',
4145     'type'        => 'text',
4146   },
4147
4148   {
4149     'key'         => 'ezlocate-password',
4150     'section'     => 'UI',
4151     'description' => 'Password for EZ-Locate service.',
4152     'type'        => 'text'
4153   },
4154
4155   {
4156     'key'         => 'cust_main-auto_standardize_address',
4157     'section'     => 'UI',
4158     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
4159     'type'        => 'checkbox',
4160   },
4161
4162   {
4163     'key'         => 'cust_main-require_censustract',
4164     'section'     => 'UI',
4165     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
4166     'type'        => 'checkbox',
4167   },
4168
4169   {
4170     'key'         => 'census_year',
4171     'section'     => 'UI',
4172     '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.',
4173     'type'        => 'select',
4174     'select_enum' => [ qw( 2012 2011 2010 ) ],
4175   },
4176
4177   {
4178     'key'         => 'tax_district_method',
4179     'section'     => 'UI',
4180     'description' => 'The method to use to look up tax district codes.',
4181     'type'        => 'select',
4182     #'select_hash' => [ FS::Misc::Geo::get_district_methods() ],
4183     #after RT#13763, using FS::Misc::Geo here now causes a dependancy loop :/
4184     'select_hash' => [
4185                        ''         => '',
4186                        'wa_sales' => 'Washington sales tax',
4187                      ],
4188   },
4189
4190   {
4191     'key'         => 'company_latitude',
4192     'section'     => 'UI',
4193     'description' => 'Your company latitude (-90 through 90)',
4194     'type'        => 'text',
4195   },
4196
4197   {
4198     'key'         => 'company_longitude',
4199     'section'     => 'UI',
4200     'description' => 'Your company longitude (-180 thru 180)',
4201     'type'        => 'text',
4202   },
4203
4204   {
4205     'key'         => 'geocode_module',
4206     'section'     => '',
4207     'description' => 'Module to geocode (retrieve a latitude and longitude for) addresses',
4208     'type'        => 'select',
4209     'select_enum' => [ 'Geo::Coder::Googlev3' ],
4210   },
4211
4212   {
4213     'key'         => 'geocode-require_nw_coordinates',
4214     'section'     => 'UI',
4215     'description' => 'Require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
4216     'type'        => 'checkbox',
4217   },
4218
4219   {
4220     'key'         => 'disable_acl_changes',
4221     'section'     => '',
4222     'description' => 'Disable all ACL changes, for demos.',
4223     'type'        => 'checkbox',
4224   },
4225
4226   {
4227     'key'         => 'disable_settings_changes',
4228     'section'     => '',
4229     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
4230     'type'        => [qw( checkbox text )],
4231   },
4232
4233   {
4234     'key'         => 'cust_main-edit_agent_custid',
4235     'section'     => 'UI',
4236     'description' => 'Enable editing of the agent_custid field.',
4237     'type'        => 'checkbox',
4238   },
4239
4240   {
4241     'key'         => 'cust_main-default_agent_custid',
4242     'section'     => 'UI',
4243     'description' => 'Display the agent_custid field when available instead of the custnum field.',
4244     'type'        => 'checkbox',
4245   },
4246
4247   {
4248     'key'         => 'cust_main-title-display_custnum',
4249     'section'     => 'UI',
4250     'description' => 'Add the display_custom (agent_custid or custnum) to the title on customer view pages.',
4251     'type'        => 'checkbox',
4252   },
4253
4254   {
4255     'key'         => 'cust_bill-default_agent_invid',
4256     'section'     => 'UI',
4257     'description' => 'Display the agent_invid field when available instead of the invnum field.',
4258     'type'        => 'checkbox',
4259   },
4260
4261   {
4262     'key'         => 'cust_main-auto_agent_custid',
4263     'section'     => 'UI',
4264     'description' => 'Automatically assign an agent_custid - select format',
4265     'type'        => 'select',
4266     'select_hash' => [ '' => 'No',
4267                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
4268                      ],
4269   },
4270
4271   {
4272     'key'         => 'cust_main-custnum-display_prefix',
4273     'section'     => 'UI',
4274     'description' => 'Prefix the customer number with this string for display purposes.',
4275     'type'        => 'text',
4276     'per_agent'   => 1,
4277   },
4278
4279   {
4280     'key'         => 'cust_main-custnum-display_special',
4281     'section'     => 'UI',
4282     'description' => 'Use this customer number prefix format',
4283     'type'        => 'select',
4284     'select_hash' => [ '' => '',
4285                        'CoStAg' => 'CoStAg (country, state, agent name or display_prefix)',
4286                        'CoStCl' => 'CoStCl (country, state, class name)' ],
4287   },
4288
4289   {
4290     'key'         => 'cust_main-custnum-display_length',
4291     'section'     => 'UI',
4292     'description' => 'Zero fill the customer number to this many digits for display purposes.',
4293     'type'        => 'text',
4294   },
4295
4296   {
4297     'key'         => 'cust_main-default_areacode',
4298     'section'     => 'UI',
4299     'description' => 'Default area code for customers.',
4300     'type'        => 'text',
4301   },
4302
4303   {
4304     'key'         => 'order_pkg-no_start_date',
4305     'section'     => 'UI',
4306     'description' => 'Don\'t set a default start date for new packages.',
4307     'type'        => 'checkbox',
4308   },
4309
4310   {
4311     'key'         => 'mcp_svcpart',
4312     'section'     => '',
4313     'description' => 'Master Control Program svcpart.  Leave this blank.',
4314     'type'        => 'text', #select-part_svc
4315   },
4316
4317   {
4318     'key'         => 'cust_bill-max_same_services',
4319     'section'     => 'invoicing',
4320     '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.',
4321     'type'        => 'text',
4322   },
4323
4324   {
4325     'key'         => 'cust_bill-consolidate_services',
4326     'section'     => 'invoicing',
4327     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
4328     'type'        => 'checkbox',
4329   },
4330
4331   {
4332     'key'         => 'suspend_email_admin',
4333     'section'     => '',
4334     'description' => 'Destination admin email address to enable suspension notices',
4335     'type'        => 'text',
4336   },
4337
4338   {
4339     'key'         => 'unsuspend_email_admin',
4340     'section'     => '',
4341     'description' => 'Destination admin email address to enable unsuspension notices',
4342     'type'        => 'text',
4343   },
4344   
4345   {
4346     'key'         => 'email_report-subject',
4347     'section'     => '',
4348     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
4349     'type'        => 'text',
4350   },
4351
4352   {
4353     'key'         => 'selfservice-head',
4354     'section'     => 'self-service',
4355     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
4356     'type'        => 'textarea', #htmlarea?
4357     'per_agent'   => 1,
4358   },
4359
4360
4361   {
4362     'key'         => 'selfservice-body_header',
4363     'section'     => 'self-service',
4364     'description' => 'HTML header for the self-service interface',
4365     'type'        => 'textarea', #htmlarea?
4366     'per_agent'   => 1,
4367   },
4368
4369   {
4370     'key'         => 'selfservice-body_footer',
4371     'section'     => 'self-service',
4372     'description' => 'HTML footer for the self-service interface',
4373     'type'        => 'textarea', #htmlarea?
4374     'per_agent'   => 1,
4375   },
4376
4377
4378   {
4379     'key'         => 'selfservice-body_bgcolor',
4380     'section'     => 'self-service',
4381     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
4382     'type'        => 'text',
4383     'per_agent'   => 1,
4384   },
4385
4386   {
4387     'key'         => 'selfservice-box_bgcolor',
4388     'section'     => 'self-service',
4389     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
4390     'type'        => 'text',
4391     'per_agent'   => 1,
4392   },
4393
4394   {
4395     'key'         => 'selfservice-stripe1_bgcolor',
4396     'section'     => 'self-service',
4397     'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF',
4398     'type'        => 'text',
4399     'per_agent'   => 1,
4400   },
4401
4402   {
4403     'key'         => 'selfservice-stripe2_bgcolor',
4404     'section'     => 'self-service',
4405     'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD',
4406     'type'        => 'text',
4407     'per_agent'   => 1,
4408   },
4409
4410   {
4411     'key'         => 'selfservice-text_color',
4412     'section'     => 'self-service',
4413     'description' => 'HTML text color for the self-service interface, for example, #000000',
4414     'type'        => 'text',
4415     'per_agent'   => 1,
4416   },
4417
4418   {
4419     'key'         => 'selfservice-link_color',
4420     'section'     => 'self-service',
4421     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
4422     'type'        => 'text',
4423     'per_agent'   => 1,
4424   },
4425
4426   {
4427     'key'         => 'selfservice-vlink_color',
4428     'section'     => 'self-service',
4429     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
4430     'type'        => 'text',
4431     'per_agent'   => 1,
4432   },
4433
4434   {
4435     'key'         => 'selfservice-hlink_color',
4436     'section'     => 'self-service',
4437     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
4438     'type'        => 'text',
4439     'per_agent'   => 1,
4440   },
4441
4442   {
4443     'key'         => 'selfservice-alink_color',
4444     'section'     => 'self-service',
4445     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
4446     'type'        => 'text',
4447     'per_agent'   => 1,
4448   },
4449
4450   {
4451     'key'         => 'selfservice-font',
4452     'section'     => 'self-service',
4453     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
4454     'type'        => 'text',
4455     'per_agent'   => 1,
4456   },
4457
4458   {
4459     'key'         => 'selfservice-no_logo',
4460     'section'     => 'self-service',
4461     'description' => 'Disable the logo in self-service',
4462     'type'        => 'checkbox',
4463     'per_agent'   => 1,
4464   },
4465
4466   {
4467     'key'         => 'selfservice-title_color',
4468     'section'     => 'self-service',
4469     'description' => 'HTML color for the self-service title, for example, #000000',
4470     'type'        => 'text',
4471     'per_agent'   => 1,
4472   },
4473
4474   {
4475     'key'         => 'selfservice-title_align',
4476     'section'     => 'self-service',
4477     'description' => 'HTML alignment for the self-service title, for example, center',
4478     'type'        => 'text',
4479     'per_agent'   => 1,
4480   },
4481   {
4482     'key'         => 'selfservice-title_size',
4483     'section'     => 'self-service',
4484     'description' => 'HTML font size for the self-service title, for example, 3',
4485     'type'        => 'text',
4486     'per_agent'   => 1,
4487   },
4488
4489   {
4490     'key'         => 'selfservice-title_left_image',
4491     'section'     => 'self-service',
4492     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4493     'type'        => 'image',
4494     'per_agent'   => 1,
4495   },
4496
4497   {
4498     'key'         => 'selfservice-title_right_image',
4499     'section'     => 'self-service',
4500     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4501     'type'        => 'image',
4502     'per_agent'   => 1,
4503   },
4504
4505   {
4506     'key'         => 'selfservice-menu_disable',
4507     'section'     => 'self-service',
4508     'description' => 'Disable the selected menu entries in the self-service menu',
4509     'type'        => 'selectmultiple',
4510     'select_enum' => [ #false laziness w/myaccount_menu.html
4511                        'Overview',
4512                        'Purchase',
4513                        'Purchase additional package',
4514                        'Recharge my account with a credit card',
4515                        'Recharge my account with a check',
4516                        'Recharge my account with a prepaid card',
4517                        'View my usage',
4518                        'Create a ticket',
4519                        'Setup my services',
4520                        'Change my information',
4521                        'Change billing address',
4522                        'Change service address',
4523                        'Change payment information',
4524                        'Change password(s)',
4525                        'Logout',
4526                      ],
4527     'per_agent'   => 1,
4528   },
4529
4530   {
4531     'key'         => 'selfservice-menu_skipblanks',
4532     'section'     => 'self-service',
4533     'description' => 'Skip blank (spacer) entries in the self-service menu',
4534     'type'        => 'checkbox',
4535     'per_agent'   => 1,
4536   },
4537
4538   {
4539     'key'         => 'selfservice-menu_skipheadings',
4540     'section'     => 'self-service',
4541     'description' => 'Skip the unclickable heading entries in the self-service menu',
4542     'type'        => 'checkbox',
4543     'per_agent'   => 1,
4544   },
4545
4546   {
4547     'key'         => 'selfservice-menu_bgcolor',
4548     'section'     => 'self-service',
4549     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
4550     'type'        => 'text',
4551     'per_agent'   => 1,
4552   },
4553
4554   {
4555     'key'         => 'selfservice-menu_fontsize',
4556     'section'     => 'self-service',
4557     'description' => 'HTML font size for the self-service menu, for example, -1',
4558     'type'        => 'text',
4559     'per_agent'   => 1,
4560   },
4561   {
4562     'key'         => 'selfservice-menu_nounderline',
4563     'section'     => 'self-service',
4564     'description' => 'Styles menu links in the self-service without underlining.',
4565     'type'        => 'checkbox',
4566     'per_agent'   => 1,
4567   },
4568
4569
4570   {
4571     'key'         => 'selfservice-menu_top_image',
4572     'section'     => 'self-service',
4573     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4574     'type'        => 'image',
4575     'per_agent'   => 1,
4576   },
4577
4578   {
4579     'key'         => 'selfservice-menu_body_image',
4580     'section'     => 'self-service',
4581     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
4582     'type'        => 'image',
4583     'per_agent'   => 1,
4584   },
4585
4586   {
4587     'key'         => 'selfservice-menu_bottom_image',
4588     'section'     => 'self-service',
4589     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
4590     'type'        => 'image',
4591     'per_agent'   => 1,
4592   },
4593   
4594   {
4595     'key'         => 'selfservice-view_usage_nodomain',
4596     'section'     => 'self-service',
4597     'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.',
4598     'type'        => 'checkbox',
4599   },
4600
4601   {
4602     'key'         => 'selfservice-login_banner_image',
4603     'section'     => 'self-service',
4604     'description' => 'Banner image shown on the login page, in PNG format.',
4605     'type'        => 'image',
4606   },
4607
4608   {
4609     'key'         => 'selfservice-login_banner_url',
4610     'section'     => 'self-service',
4611     'description' => 'Link for the login banner.',
4612     'type'        => 'text',
4613   },
4614
4615   {
4616     'key'         => 'signup-no_company',
4617     'section'     => 'self-service',
4618     'description' => "Don't display a field for company name on signup.",
4619     'type'        => 'checkbox',
4620   },
4621
4622   {
4623     'key'         => 'signup-recommend_email',
4624     'section'     => 'self-service',
4625     'description' => 'Encourage the entry of an invoicing email address on signup.',
4626     'type'        => 'checkbox',
4627   },
4628
4629   {
4630     'key'         => 'signup-recommend_daytime',
4631     'section'     => 'self-service',
4632     'description' => 'Encourage the entry of a daytime phone number on signup.',
4633     'type'        => 'checkbox',
4634   },
4635
4636   {
4637     'key'         => 'signup-duplicate_cc-warn_hours',
4638     'section'     => 'self-service',
4639     'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.',
4640     'type'        => 'text',
4641   },
4642
4643   {
4644     'key'         => 'svc_phone-radius-default_password',
4645     'section'     => 'telephony',
4646     'description' => 'Default password when exporting svc_phone records to RADIUS',
4647     'type'        => 'text',
4648   },
4649
4650   {
4651     'key'         => 'svc_phone-allow_alpha_phonenum',
4652     'section'     => 'telephony',
4653     'description' => 'Allow letters in phone numbers.',
4654     'type'        => 'checkbox',
4655   },
4656
4657   {
4658     'key'         => 'svc_phone-domain',
4659     'section'     => 'telephony',
4660     'description' => 'Track an optional domain association with each phone service.',
4661     'type'        => 'checkbox',
4662   },
4663
4664   {
4665     'key'         => 'svc_phone-phone_name-max_length',
4666     'section'     => 'telephony',
4667     '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.',
4668     'type'        => 'text',
4669   },
4670
4671   {
4672     'key'         => 'svc_phone-random_pin',
4673     'section'     => 'telephony',
4674     'description' => 'Number of random digits to generate in the "PIN" field, if empty.',
4675     'type'        => 'text',
4676   },
4677
4678   {
4679     'key'         => 'svc_phone-lnp',
4680     'section'     => 'telephony',
4681     'description' => 'Enables Number Portability features for svc_phone',
4682     'type'        => 'checkbox',
4683   },
4684
4685   {
4686     'key'         => 'default_phone_countrycode',
4687     'section'     => '',
4688     'description' => 'Default countrcode',
4689     'type'        => 'text',
4690   },
4691
4692   {
4693     'key'         => 'cdr-charged_party-field',
4694     'section'     => 'telephony',
4695     'description' => 'Set the charged_party field of CDRs to this field.',
4696     'type'        => 'select-sub',
4697     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
4698                            map { $_ => $fields->{$_}||$_ }
4699                            grep { $_ !~ /^(acctid|charged_party)$/ }
4700                            FS::Schema::dbdef->table('cdr')->columns;
4701                          },
4702     'option_sub'  => sub { my $f = shift;
4703                            FS::cdr->table_info->{'fields'}{$f} || $f;
4704                          },
4705   },
4706
4707   #probably deprecate in favor of cdr-charged_party-field above
4708   {
4709     'key'         => 'cdr-charged_party-accountcode',
4710     'section'     => 'telephony',
4711     'description' => 'Set the charged_party field of CDRs to the accountcode.',
4712     'type'        => 'checkbox',
4713   },
4714
4715   {
4716     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
4717     'section'     => 'telephony',
4718     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
4719     'type'        => 'checkbox',
4720   },
4721
4722 #  {
4723 #    'key'         => 'cdr-charged_party-truncate_prefix',
4724 #    'section'     => '',
4725 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
4726 #    'type'        => 'text',
4727 #  },
4728 #
4729 #  {
4730 #    'key'         => 'cdr-charged_party-truncate_length',
4731 #    'section'     => '',
4732 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
4733 #    'type'        => 'text',
4734 #  },
4735
4736   {
4737     'key'         => 'cdr-charged_party_rewrite',
4738     'section'     => 'telephony',
4739     '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*.',
4740     'type'        => 'checkbox',
4741   },
4742
4743   {
4744     'key'         => 'cdr-taqua-da_rewrite',
4745     'section'     => 'telephony',
4746     '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.',
4747     'type'        => 'text',
4748   },
4749
4750   {
4751     'key'         => 'cdr-taqua-accountcode_rewrite',
4752     'section'     => 'telephony',
4753     'description' => 'For the Taqua CDR format, pull accountcodes from secondary CDRs with matching sessionNumber.',
4754     'type'        => 'checkbox',
4755   },
4756
4757   {
4758     'key'         => 'cdr-taqua-callerid_rewrite',
4759     'section'     => 'telephony',
4760     'description' => 'For the Taqua CDR format, pull Caller ID blocking information from secondary CDRs.',
4761     'type'        => 'checkbox',
4762   },
4763
4764   {
4765     'key'         => 'cdr-asterisk_australia_rewrite',
4766     'section'     => 'telephony',
4767     'description' => 'For Asterisk CDRs, assign CDR type numbers based on Australian conventions.',
4768     'type'        => 'checkbox',
4769   },
4770
4771   {
4772     'key'         => 'cdr-gsm_tap3-sender',
4773     'section'     => 'telephony',
4774     'description' => 'GSM TAP3 Sender network (5 letter code)',
4775     'type'        => 'text',
4776   },
4777
4778   {
4779     'key'         => 'cust_pkg-show_autosuspend',
4780     'section'     => 'UI',
4781     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
4782     'type'        => 'checkbox',
4783   },
4784
4785   {
4786     'key'         => 'cdr-asterisk_forward_rewrite',
4787     'section'     => 'telephony',
4788     '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").',
4789     'type'        => 'checkbox',
4790   },
4791
4792   {
4793     'key'         => 'mc-outbound_packages',
4794     'section'     => '',
4795     'description' => "Don't use this.",
4796     'type'        => 'select-part_pkg',
4797     'multiple'    => 1,
4798   },
4799
4800   {
4801     'key'         => 'disable-cust-pkg_class',
4802     'section'     => 'UI',
4803     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
4804     'type'        => 'checkbox',
4805   },
4806
4807   {
4808     'key'         => 'queued-max_kids',
4809     'section'     => '',
4810     'description' => 'Maximum number of queued processes.  Defaults to 10.',
4811     'type'        => 'text',
4812   },
4813
4814   {
4815     'key'         => 'queued-sleep_time',
4816     'section'     => '',
4817     '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.',
4818     'type'        => 'text',
4819   },
4820
4821   {
4822     'key'         => 'cancelled_cust-noevents',
4823     'section'     => 'billing',
4824     'description' => "Don't run events for cancelled customers",
4825     'type'        => 'checkbox',
4826   },
4827
4828   {
4829     'key'         => 'agent-invoice_template',
4830     'section'     => 'invoicing',
4831     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
4832     'type'        => 'checkbox',
4833   },
4834
4835   {
4836     'key'         => 'svc_broadband-manage_link',
4837     'section'     => 'UI',
4838     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr and $mac_addr.',
4839     'type'        => 'text',
4840   },
4841
4842   {
4843     'key'         => 'svc_broadband-manage_link_text',
4844     'section'     => 'UI',
4845     'description' => 'Label for "Manage Device" link',
4846     'type'        => 'text',
4847   },
4848
4849   {
4850     'key'         => 'svc_broadband-manage_link_loc',
4851     'section'     => 'UI',
4852     'description' => 'Location for "Manage Device" link',
4853     'type'        => 'select',
4854     'select_hash' => [
4855       'bottom' => 'Near Unprovision link',
4856       'right'  => 'With export-related links',
4857     ],
4858   },
4859
4860   {
4861     'key'         => 'svc_broadband-manage_link-new_window',
4862     'section'     => 'UI',
4863     'description' => 'Open the "Manage Device" link in a new window',
4864     'type'        => 'checkbox',
4865   },
4866
4867   #more fine-grained, service def-level control could be useful eventually?
4868   {
4869     'key'         => 'svc_broadband-allow_null_ip_addr',
4870     'section'     => '',
4871     'description' => '',
4872     'type'        => 'checkbox',
4873   },
4874
4875   {
4876     'key'         => 'svc_hardware-check_mac_addr',
4877     'section'     => '', #?
4878     'description' => 'Require the "hardware address" field in hardware services to be a valid MAC address.',
4879     'type'        => 'checkbox',
4880   },
4881
4882   {
4883     'key'         => 'tax-report_groups',
4884     'section'     => '',
4885     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
4886     'type'        => 'textarea',
4887   },
4888
4889   {
4890     'key'         => 'tax-cust_exempt-groups',
4891     'section'     => '',
4892     '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).',
4893     'type'        => 'textarea',
4894   },
4895
4896   {
4897     'key'         => 'tax-cust_exempt-groups-require_individual_nums',
4898     'section'     => '',
4899     'description' => 'When using tax-cust_exempt-groups, require an individual tax exemption number for each exemption from different taxes.',
4900     'type'        => 'checkbox',
4901   },
4902
4903   {
4904     'key'         => 'cust_main-default_view',
4905     'section'     => 'UI',
4906     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
4907     'type'        => 'select',
4908     'select_hash' => [
4909       #false laziness w/view/cust_main.cgi and pref/pref.html
4910       'basics'          => 'Basics',
4911       'notes'           => 'Notes',
4912       'tickets'         => 'Tickets',
4913       'packages'        => 'Packages',
4914       'payment_history' => 'Payment History',
4915       'change_history'  => 'Change History',
4916       'jumbo'           => 'Jumbo',
4917     ],
4918   },
4919
4920   {
4921     'key'         => 'enable_tax_adjustments',
4922     'section'     => 'billing',
4923     'description' => 'Enable the ability to add manual tax adjustments.',
4924     'type'        => 'checkbox',
4925   },
4926
4927   {
4928     'key'         => 'rt-crontool',
4929     'section'     => '',
4930     'description' => 'Enable the RT CronTool extension.',
4931     'type'        => 'checkbox',
4932   },
4933
4934   {
4935     'key'         => 'pkg-balances',
4936     'section'     => 'billing',
4937     'description' => 'Enable experimental package balances.  Not recommended for general use.',
4938     'type'        => 'checkbox',
4939   },
4940
4941   {
4942     'key'         => 'pkg-addon_classnum',
4943     'section'     => 'billing',
4944     'description' => 'Enable the ability to restrict additional package orders based on package class.',
4945     'type'        => 'checkbox',
4946   },
4947
4948   {
4949     'key'         => 'cust_main-edit_signupdate',
4950     'section'     => 'UI',
4951     'description' => 'Enable manual editing of the signup date.',
4952     'type'        => 'checkbox',
4953   },
4954
4955   {
4956     'key'         => 'svc_acct-disable_access_number',
4957     'section'     => 'UI',
4958     'description' => 'Disable access number selection.',
4959     'type'        => 'checkbox',
4960   },
4961
4962   {
4963     'key'         => 'cust_bill_pay_pkg-manual',
4964     'section'     => 'UI',
4965     'description' => 'Allow manual application of payments to line items.',
4966     'type'        => 'checkbox',
4967   },
4968
4969   {
4970     'key'         => 'cust_credit_bill_pkg-manual',
4971     'section'     => 'UI',
4972     'description' => 'Allow manual application of credits to line items.',
4973     'type'        => 'checkbox',
4974   },
4975
4976   {
4977     'key'         => 'breakage-days',
4978     'section'     => 'billing',
4979     '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.',
4980     'type'        => 'text',
4981     'per_agent'   => 1,
4982   },
4983
4984   {
4985     'key'         => 'breakage-pkg_class',
4986     'section'     => 'billing',
4987     'description' => 'Package class to use for breakage reconciliation.',
4988     'type'        => 'select-pkg_class',
4989   },
4990
4991   {
4992     'key'         => 'disable_cron_billing',
4993     'section'     => 'billing',
4994     '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.',
4995     'type'        => 'checkbox',
4996   },
4997
4998   {
4999     'key'         => 'svc_domain-edit_domain',
5000     'section'     => '',
5001     'description' => 'Enable domain renaming',
5002     'type'        => 'checkbox',
5003   },
5004
5005   {
5006     'key'         => 'enable_legacy_prepaid_income',
5007     'section'     => '',
5008     '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.",
5009     'type'        => 'checkbox',
5010   },
5011
5012   {
5013     'key'         => 'cust_main-exports',
5014     'section'     => '',
5015     'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
5016     'type'        => 'select-sub',
5017     'multiple'    => 1,
5018     'options_sub' => sub {
5019       require FS::Record;
5020       require FS::part_export;
5021       my @part_export =
5022         map { qsearch( 'part_export', {exporttype => $_ } ) }
5023           keys %{FS::part_export::export_info('cust_main')};
5024       map { $_->exportnum => $_->exporttype.' to '.$_->machine } @part_export;
5025     },
5026     'option_sub'  => sub {
5027       require FS::Record;
5028       require FS::part_export;
5029       my $part_export = FS::Record::qsearchs(
5030         'part_export', { 'exportnum' => shift }
5031       );
5032       $part_export
5033         ? $part_export->exporttype.' to '.$part_export->machine
5034         : '';
5035     },
5036   },
5037
5038   {
5039     'key'         => 'cust_tag-location',
5040     'section'     => 'UI',
5041     'description' => 'Location where customer tags are displayed.',
5042     'type'        => 'select',
5043     'select_enum' => [ 'misc_info', 'top' ],
5044   },
5045
5046   {
5047     'key'         => 'maestro-status_test',
5048     'section'     => 'UI',
5049     'description' => 'Display a link to the maestro status test page on the customer view page',
5050     'type'        => 'checkbox',
5051   },
5052
5053   {
5054     'key'         => 'cust_main-custom_link',
5055     'section'     => 'UI',
5056     '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.',
5057     'type'        => 'textarea',
5058   },
5059
5060   {
5061     'key'         => 'cust_main-custom_content',
5062     'section'     => 'UI',
5063     '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.',
5064     'type'        => 'textarea',
5065   },
5066
5067   {
5068     'key'         => 'cust_main-custom_title',
5069     'section'     => 'UI',
5070     'description' => 'Title for the "Custom" tab in the View Customer page.',
5071     'type'        => 'text',
5072   },
5073
5074   {
5075     'key'         => 'part_pkg-default_suspend_bill',
5076     'section'     => 'billing',
5077     'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
5078     'type'        => 'checkbox',
5079   },
5080   
5081   {
5082     'key'         => 'qual-alt_address_format',
5083     'section'     => 'UI',
5084     'description' => 'Enable the alternate address format (location type, number, and kind) for qualifications.',
5085     'type'        => 'checkbox',
5086   },
5087
5088   {
5089     'key'         => 'prospect_main-alt_address_format',
5090     'section'     => 'UI',
5091     '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.',
5092     'type'        => 'checkbox',
5093   },
5094
5095   {
5096     'key'         => 'prospect_main-location_required',
5097     'section'     => 'UI',
5098     'description' => 'Require an address for prospects.  Recommended if the main use of propects is for qualifications.',
5099     'type'        => 'checkbox',
5100   },
5101
5102   {
5103     'key'         => 'note-classes',
5104     'section'     => 'UI',
5105     'description' => 'Use customer note classes',
5106     'type'        => 'select',
5107     'select_hash' => [
5108                        0 => 'Disabled',
5109                        1 => 'Enabled',
5110                        2 => 'Enabled, with tabs',
5111                      ],
5112   },
5113
5114   {
5115     'key'         => 'svc_acct-cf_privatekey-message',
5116     'section'     => '',
5117     'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
5118     'type'        => 'textarea',
5119   },
5120
5121   {
5122     'key'         => 'menu-prepend_links',
5123     'section'     => 'UI',
5124     'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
5125     'type'        => 'textarea',
5126   },
5127
5128   {
5129     'key'         => 'cust_main-external_links',
5130     'section'     => 'UI',
5131     'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
5132     'type'        => 'textarea',
5133   },
5134   
5135   {
5136     'key'         => 'svc_phone-did-summary',
5137     'section'     => 'invoicing',
5138     'description' => 'Enable DID activity summary on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage, covering period since last invoice.',
5139     'type'        => 'checkbox',
5140   },
5141
5142   {
5143     'key'         => 'svc_acct-usage_seconds',
5144     'section'     => 'invoicing',
5145     'description' => 'Enable calculation of RADIUS usage time for invoices.  You must modify your template to display this information.',
5146     'type'        => 'checkbox',
5147   },
5148   
5149   {
5150     'key'         => 'opensips_gwlist',
5151     'section'     => 'telephony',
5152     'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent',
5153     'type'        => 'text',
5154     'per_agent'   => 1,
5155     'agentonly'   => 1,
5156   },
5157
5158   {
5159     'key'         => 'opensips_description',
5160     'section'     => 'telephony',
5161     'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent',
5162     'type'        => 'text',
5163     'per_agent'   => 1,
5164     'agentonly'   => 1,
5165   },
5166   
5167   {
5168     'key'         => 'opensips_route',
5169     'section'     => 'telephony',
5170     'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent',
5171     'type'        => 'text',
5172     'per_agent'   => 1,
5173     'agentonly'   => 1,
5174   },
5175
5176   {
5177     'key'         => 'cust_bill-no_recipients-error',
5178     'section'     => 'invoicing',
5179     '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.',
5180     'type'        => 'checkbox',
5181   },
5182
5183   {
5184     'key'         => 'cust_bill-latex_lineitem_maxlength',
5185     'section'     => 'invoicing',
5186     'description' => 'Truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin.  Defaults to 50.  ',
5187     'type'        => 'text',
5188   },
5189
5190   {
5191     'key'         => 'cust_main-status_module',
5192     'section'     => 'UI',
5193     '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?
5194     'type'        => 'select',
5195     'select_enum' => [ 'Classic', 'Recurring' ],
5196   },
5197
5198   {
5199     'key'         => 'cust_main-print_statement_link',
5200     'section'     => 'UI',
5201     'description' => 'Show a link to download a current statement for the customer.',
5202     'type'        => 'checkbox',
5203   },
5204
5205   { 
5206     'key'         => 'username-pound',
5207     'section'     => 'username',
5208     'description' => 'Allow the pound character (#) in usernames.',
5209     'type'        => 'checkbox',
5210   },
5211
5212   { 
5213     'key'         => 'username-exclamation',
5214     'section'     => 'username',
5215     'description' => 'Allow the exclamation character (!) in usernames.',
5216     'type'        => 'checkbox',
5217   },
5218
5219   {
5220     'key'         => 'ie-compatibility_mode',
5221     'section'     => 'UI',
5222     '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.",
5223     'type'        => 'select',
5224     'select_enum' => [ '', '7', 'EmulateIE7', '8', 'EmulateIE8' ],
5225   },
5226
5227   {
5228     'key'         => 'disable_payauto_default',
5229     'section'     => 'UI',
5230     'description' => 'Disable the "Charge future payments to this (card|check) automatically" checkbox from defaulting to checked.',
5231     'type'        => 'checkbox',
5232   },
5233   
5234   {
5235     'key'         => 'payment-history-report',
5236     'section'     => 'UI',
5237     'description' => 'Show a link to the raw database payment history report in the Reports menu.  DO NOT ENABLE THIS for modern installations.',
5238     'type'        => 'checkbox',
5239   },
5240   
5241   {
5242     'key'         => 'svc_broadband-require-nw-coordinates',
5243     'section'     => 'deprecated',
5244     'description' => 'Deprecated; see geocode-require_nw_coordinates instead',
5245     'type'        => 'checkbox',
5246   },
5247   
5248   {
5249     'key'         => 'cust-email-high-visibility',
5250     'section'     => 'UI',
5251     'description' => 'Move the invoicing e-mail address field to the top of the billing address section and highlight it.',
5252     'type'        => 'checkbox',
5253   },
5254   
5255   {
5256     'key'         => 'cust-edit-alt-field-order',
5257     'section'     => 'UI',
5258     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
5259     'type'        => 'checkbox',
5260   },
5261
5262   {
5263     'key'         => 'cust_bill-enable_promised_date',
5264     'section'     => 'UI',
5265     'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
5266     'type'        => 'checkbox',
5267   },
5268   
5269   {
5270     'key'         => 'available-locales',
5271     'section'     => '',
5272     'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
5273     'type'        => 'select-sub',
5274     'multiple'    => 1,
5275     'options_sub' => sub { 
5276       map { $_ => FS::Locales->description($_) }
5277       grep { $_ ne 'en_US' } 
5278       FS::Locales->locales;
5279     },
5280     'option_sub'  => sub { FS::Locales->description(shift) },
5281   },
5282
5283   {
5284     'key'         => 'cust_main-require_locale',
5285     'section'     => 'UI',
5286     'description' => 'Require an explicit locale to be chosen for new customers.',
5287     'type'        => 'checkbox',
5288   },
5289   
5290   {
5291     'key'         => 'translate-auto-insert',
5292     'section'     => '',
5293     '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.',
5294     'type'        => 'select',
5295     'multiple'    => 1,
5296     'select_enum' => [ grep { $_ ne 'en_US' } FS::Locales::locales ],
5297   },
5298
5299   {
5300     'key'         => 'svc_acct-tower_sector',
5301     'section'     => '',
5302     'description' => 'Track tower and sector for svc_acct (account) services.',
5303     'type'        => 'checkbox',
5304   },
5305
5306   {
5307     'key'         => 'cdr-prerate',
5308     'section'     => 'telephony',
5309     '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.',
5310     'type'        => 'checkbox',
5311   },
5312
5313   {
5314     'key'         => 'cdr-prerate-cdrtypenums',
5315     'section'     => 'telephony',
5316     'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
5317     'type'        => 'select-sub',
5318     'multiple'    => 1,
5319     'options_sub' => sub { require FS::Record;
5320                            require FS::cdr_type;
5321                            map { $_->cdrtypenum => $_->cdrtypename }
5322                                FS::Record::qsearch( 'cdr_type', 
5323                                                     {} #{ 'disabled' => '' }
5324                                                   );
5325                          },
5326     'option_sub'  => sub { require FS::Record;
5327                            require FS::cdr_type;
5328                            my $cdr_type = FS::Record::qsearchs(
5329                              'cdr_type', { 'cdrtypenum'=>shift } );
5330                            $cdr_type ? $cdr_type->cdrtypename : '';
5331                          },
5332   },
5333
5334   {
5335     'key'         => 'cdr-minutes_priority',
5336     'section'     => 'telephony',
5337     'description' => 'Priority rule for assigning included minutes to CDRs.',
5338     'type'        => 'select',
5339     'select_hash' => [
5340       ''          => 'No specific order',
5341       'time'      => 'Chronological',
5342       'rate_high' => 'Highest rate first',
5343       'rate_low'  => 'Lowest rate first',
5344     ],
5345   },
5346   
5347   {
5348     'key'         => 'brand-agent',
5349     'section'     => 'UI',
5350     '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.',
5351     'type'        => 'select-agent',
5352   },
5353
5354   {
5355     'key'         => 'cust_class-tax_exempt',
5356     'section'     => 'billing',
5357     'description' => 'Control the tax exemption flag per customer class rather than per indivual customer.',
5358     'type'        => 'checkbox',
5359   },
5360
5361   {
5362     'key'         => 'selfservice-billing_history-line_items',
5363     'section'     => 'self-service',
5364     'description' => 'Return line item billing detail for the self-service billing_history API call.',
5365     'type'        => 'checkbox',
5366   },
5367
5368   {
5369     'key'         => 'selfservice-default_cdr_format',
5370     'section'     => 'self-service',
5371     'description' => 'Format for showing outbound CDRs in self-service.  The per-package option overrides this.',
5372     'type'        => 'select',
5373     'select_hash' => \@cdr_formats,
5374   },
5375
5376   {
5377     'key'         => 'selfservice-default_inbound_cdr_format',
5378     'section'     => 'self-service',
5379     'description' => 'Format for showing inbound CDRs in self-service.  The per-package option overrides this.  Leave blank to avoid showing these CDRs.',
5380     'type'        => 'select',
5381     'select_hash' => \@cdr_formats,
5382   },
5383
5384   {
5385     'key'         => 'logout-timeout',
5386     'section'     => 'UI',
5387     'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
5388     'type'       => 'text',
5389   },
5390   
5391   {
5392     'key'         => 'spreadsheet_format',
5393     'section'     => 'UI',
5394     'description' => 'Default format for spreadsheet download.',
5395     'type'        => 'select',
5396     'select_hash' => [
5397       'XLS' => 'XLS (Excel 97/2000/XP)',
5398       'XLSX' => 'XLSX (Excel 2007+)',
5399     ],
5400   },
5401
5402   {
5403     'key'         => 'agent-email_day',
5404     'section'     => '',
5405     '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.',
5406     'type'        => 'text',
5407   },
5408
5409   {
5410     'key'         => 'report-cust_pay-select_time',
5411     'section'     => 'UI',
5412     'description' => 'Enable time selection on payment and refund reports.',
5413     'type'        => 'checkbox',
5414   },
5415
5416   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5417   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5418   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5419   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5420   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5421   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5422   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5423   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5424   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5425   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5426   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5427   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5428   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5429   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5430   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5431   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5432   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5433   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5434   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5435   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5436   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5437   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5438   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5439   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5440   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5441   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5442   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5443   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5444   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5445   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5446   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5447   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5448   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5449   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5450   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5451   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5452   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5453   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5454   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5455   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5456   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5457
5458 );
5459
5460 1;
5461