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