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