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