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