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