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