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