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