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