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