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