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