import torrus 1.0.9
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($base_dir @config_items @base_items @card_types $DEBUG);
4 use Carp;
5 use IO::File;
6 use File::Basename;
7 use MIME::Base64;
8 use FS::ConfItem;
9 use FS::ConfDefaults;
10 use FS::Conf_compat17;
11 use FS::payby;
12 use FS::conf;
13 use FS::Record qw(qsearch qsearchs);
14 use FS::UID qw(dbh datasrc use_confcompat);
15
16 $base_dir = '%%%FREESIDE_CONF%%%';
17
18 $DEBUG = 0;
19
20 =head1 NAME
21
22 FS::Conf - Freeside configuration values
23
24 =head1 SYNOPSIS
25
26   use FS::Conf;
27
28   $conf = new FS::Conf;
29
30   $value = $conf->config('key');
31   @list  = $conf->config('key');
32   $bool  = $conf->exists('key');
33
34   $conf->touch('key');
35   $conf->set('key' => 'value');
36   $conf->delete('key');
37
38   @config_items = $conf->config_items;
39
40 =head1 DESCRIPTION
41
42 Read and write Freeside configuration values.  Keys currently map to filenames,
43 but this may change in the future.
44
45 =head1 METHODS
46
47 =over 4
48
49 =item new
50
51 Create a new configuration object.
52
53 =cut
54
55 sub new {
56   my($proto) = @_;
57   my($class) = ref($proto) || $proto;
58   my($self) = { 'base_dir' => $base_dir };
59   bless ($self, $class);
60 }
61
62 =item base_dir
63
64 Returns the base directory.  By default this is /usr/local/etc/freeside.
65
66 =cut
67
68 sub base_dir {
69   my($self) = @_;
70   my $base_dir = $self->{base_dir};
71   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
72   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
73   -r $base_dir or die "FATAL: Can't read $base_dir!";
74   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
75   $base_dir =~ /^(.*)$/;
76   $1;
77 }
78
79 =item conf KEY [ AGENTNUM [ NODEFAULT ] ]
80
81 Returns the L<FS::conf> record for the key and agent.
82
83 =cut
84
85 sub conf {
86   my $self = shift;
87   $self->_config(@_);
88 }
89
90 =item config KEY [ AGENTNUM [ NODEFAULT ] ]
91
92 Returns the configuration value or values (depending on context) for key.
93 The optional agent number selects an agent specific value instead of the
94 global default if one is present.  If NODEFAULT is true only the agent
95 specific value(s) is returned.
96
97 =cut
98
99 sub _usecompat {
100   my ($self, $method) = (shift, shift);
101   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
102     if use_confcompat;
103   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
104   $compat->$method(@_);
105 }
106
107 sub _config {
108   my($self,$name,$agentnum,$agentonly)=@_;
109   my $hashref = { 'name' => $name };
110   $hashref->{agentnum} = $agentnum;
111   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
112   my $cv = FS::Record::qsearchs('conf', $hashref);
113   if (!$agentonly && !$cv && defined($agentnum) && $agentnum) {
114     $hashref->{agentnum} = '';
115     $cv = FS::Record::qsearchs('conf', $hashref);
116   }
117   return $cv;
118 }
119
120 sub config {
121   my $self = shift;
122   return $self->_usecompat('config', @_) if use_confcompat;
123
124   carp "FS::Conf->config(". join(', ', @_). ") called"
125     if $DEBUG > 1;
126
127   my $cv = $self->_config(@_) or return;
128
129   if ( wantarray ) {
130     my $v = $cv->value;
131     chomp $v;
132     (split "\n", $v, -1);
133   } else {
134     (split("\n", $cv->value))[0];
135   }
136 }
137
138 =item config_binary KEY [ AGENTNUM [ NODEFAULT ] ]
139
140 Returns the exact scalar value for key.
141
142 =cut
143
144 sub config_binary {
145   my $self = shift;
146   return $self->_usecompat('config_binary', @_) if use_confcompat;
147
148   my $cv = $self->_config(@_) or return;
149   length($cv->value) ? decode_base64($cv->value) : '';
150 }
151
152 =item exists KEY [ AGENTNUM [ NODEFAULT ] ]
153
154 Returns true if the specified key exists, even if the corresponding value
155 is undefined.
156
157 =cut
158
159 sub exists {
160   my $self = shift;
161   return $self->_usecompat('exists', @_) if use_confcompat;
162
163   my($name, $agentnum)=@_;
164
165   carp "FS::Conf->exists(". join(', ', @_). ") called"
166     if $DEBUG > 1;
167
168   defined($self->_config(@_));
169 }
170
171 =item config_orbase KEY SUFFIX
172
173 Returns the configuration value or values (depending on context) for 
174 KEY_SUFFIX, if it exists, otherwise for KEY
175
176 =cut
177
178 # outmoded as soon as we shift to agentnum based config values
179 # well, mostly.  still useful for e.g. late notices, etc. in that we want
180 # these to fall back to standard values
181 sub config_orbase {
182   my $self = shift;
183   return $self->_usecompat('config_orbase', @_) if use_confcompat;
184
185   my( $name, $suffix ) = @_;
186   if ( $self->exists("${name}_$suffix") ) {
187     $self->config("${name}_$suffix");
188   } else {
189     $self->config($name);
190   }
191 }
192
193 =item key_orbase KEY SUFFIX
194
195 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
196 KEY.  Useful for determining which exact configuration option is returned by
197 config_orbase.
198
199 =cut
200
201 sub key_orbase {
202   my $self = shift;
203   #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
204
205   my( $name, $suffix ) = @_;
206   if ( $self->exists("${name}_$suffix") ) {
207     "${name}_$suffix";
208   } else {
209     $name;
210   }
211 }
212
213 =item invoice_templatenames
214
215 Returns all possible invoice template names.
216
217 =cut
218
219 sub invoice_templatenames {
220   my( $self ) = @_;
221
222   my %templatenames = ();
223   foreach my $item ( $self->config_items ) {
224     foreach my $base ( @base_items ) {
225       my( $main, $ext) = split(/\./, $base);
226       $ext = ".$ext" if $ext;
227       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
228       $templatenames{$1}++;
229       }
230     }
231   }
232   
233   map { $_ } #handle scalar context
234   sort keys %templatenames;
235
236 }
237
238 =item touch KEY [ AGENT ];
239
240 Creates the specified configuration key if it does not exist.
241
242 =cut
243
244 sub touch {
245   my $self = shift;
246   return $self->_usecompat('touch', @_) if use_confcompat;
247
248   my($name, $agentnum) = @_;
249   unless ( $self->exists($name, $agentnum) ) {
250     $self->set($name, '', $agentnum);
251   }
252 }
253
254 =item set KEY VALUE [ AGENTNUM ];
255
256 Sets the specified configuration key to the given value.
257
258 =cut
259
260 sub set {
261   my $self = shift;
262   return $self->_usecompat('set', @_) if use_confcompat;
263
264   my($name, $value, $agentnum) = @_;
265   $value =~ /^(.*)$/s;
266   $value = $1;
267
268   warn "[FS::Conf] SET $name\n" if $DEBUG;
269
270   my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
271   my $new = new FS::conf { $old ? $old->hash 
272                                 : ('name' => $name, 'agentnum' => $agentnum)
273                          };
274   $new->value($value);
275
276   my $error;
277   if ($old) {
278     $error = $new->replace($old);
279   } else {
280     $error = $new->insert;
281   }
282
283   die "error setting configuration value: $error \n"
284     if $error;
285
286 }
287
288 =item set_binary KEY VALUE [ AGENTNUM ]
289
290 Sets the specified configuration key to an exact scalar value which
291 can be retrieved with config_binary.
292
293 =cut
294
295 sub set_binary {
296   my $self  = shift;
297   return if use_confcompat;
298
299   my($name, $value, $agentnum)=@_;
300   $self->set($name, encode_base64($value), $agentnum);
301 }
302
303 =item delete KEY [ AGENTNUM ];
304
305 Deletes the specified configuration key.
306
307 =cut
308
309 sub delete {
310   my $self = shift;
311   return $self->_usecompat('delete', @_) if use_confcompat;
312
313   my($name, $agentnum) = @_;
314   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
315     warn "[FS::Conf] DELETE $name\n";
316
317     my $oldAutoCommit = $FS::UID::AutoCommit;
318     local $FS::UID::AutoCommit = 0;
319     my $dbh = dbh;
320
321     my $error = $cv->delete;
322
323     if ( $error ) {
324       $dbh->rollback if $oldAutoCommit;
325       die "error setting configuration value: $error \n"
326     }
327
328     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
329
330   }
331 }
332
333 =item import_config_item CONFITEM DIR 
334
335   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
336 the database as a conf record (see L<FS::conf>).  Imports from the file
337 in the directory DIR.
338
339 =cut
340
341 sub import_config_item { 
342   my ($self,$item,$dir) = @_;
343   my $key = $item->key;
344   if ( -e "$dir/$key" && ! use_confcompat ) {
345     warn "Inserting $key\n" if $DEBUG;
346     local $/;
347     my $value = readline(new IO::File "$dir/$key");
348     if ($item->type =~ /^(binary|image)$/ ) {
349       $self->set_binary($key, $value);
350     }else{
351       $self->set($key, $value);
352     }
353   }else {
354     warn "Not inserting $key\n" if $DEBUG;
355   }
356 }
357
358 =item verify_config_item CONFITEM DIR 
359
360   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
361 the database to the legacy file value in DIR.
362
363 =cut
364
365 sub verify_config_item { 
366   return '' if use_confcompat;
367   my ($self,$item,$dir) = @_;
368   my $key = $item->key;
369   my $type = $item->type;
370
371   my $compat = new FS::Conf_compat17 $dir;
372   my $error = '';
373   
374   $error .= "$key fails existential comparison; "
375     if $self->exists($key) xor $compat->exists($key);
376
377   if ( $type !~ /^(binary|image)$/ ) {
378
379     {
380       no warnings;
381       $error .= "$key fails scalar comparison; "
382         unless scalar($self->config($key)) eq scalar($compat->config($key));
383     }
384
385     my (@new) = $self->config($key);
386     my (@old) = $compat->config($key);
387     unless ( scalar(@new) == scalar(@old)) { 
388       $error .= "$key fails list comparison; ";
389     }else{
390       my $r=1;
391       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
392       $error .= "$key fails list comparison; "
393         unless $r;
394     }
395
396   } else {
397
398     no warnings 'uninitialized';
399     $error .= "$key fails binary comparison; "
400       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
401
402   }
403
404 #remove deprecated config on our own terms, not freeside-upgrade's
405 #  if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
406 #    my $proto;
407 #    for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
408 #    unless ($proto->key eq $key) { 
409 #      warn "removed config item $error\n" if $DEBUG;
410 #      $error = '';
411 #    }
412 #  }
413
414   $error;
415 }
416
417 #item _orbase_items OPTIONS
418 #
419 #Returns all of the possible extensible config items as FS::ConfItem objects.
420 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
421 #options include
422 #
423 # dir - the directory to search for configuration option files instead
424 #       of using the conf records in the database
425 #
426 #cut
427
428 #quelle kludge
429 sub _orbase_items {
430   my ($self, %opt) = @_; 
431
432   my $listmaker = sub { my $v = shift;
433                         $v =~ s/_/!_/g;
434                         if ( $v =~ /\.(png|eps)$/ ) {
435                           $v =~ s/\./!_%./;
436                         }else{
437                           $v .= '!_%';
438                         }
439                         map { $_->name }
440                           FS::Record::qsearch( 'conf',
441                                                {},
442                                                '',
443                                                "WHERE name LIKE '$v' ESCAPE '!'"
444                                              );
445                       };
446
447   if (exists($opt{dir}) && $opt{dir}) {
448     $listmaker = sub { my $v = shift;
449                        if ( $v =~ /\.(png|eps)$/ ) {
450                          $v =~ s/\./_*./;
451                        }else{
452                          $v .= '_*';
453                        }
454                        map { basename $_ } glob($opt{dir}. "/$v" );
455                      };
456   }
457
458   ( map { 
459           my $proto;
460           my $base = $_;
461           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
462           die "don't know about $base items" unless $proto->key eq $base;
463
464           map { new FS::ConfItem { 
465                   'key'         => $_,
466                   'base_key'    => $proto->key,
467                   'section'     => $proto->section,
468                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
469                   'type'        => $proto->type,
470                 };
471               } &$listmaker($base);
472         } @base_items,
473   );
474 }
475
476 =item config_items
477
478 Returns all of the possible global/default configuration items as
479 FS::ConfItem objects.  See L<FS::ConfItem>.
480
481 =cut
482
483 sub config_items {
484   my $self = shift; 
485   return $self->_usecompat('config_items', @_) if use_confcompat;
486
487   ( @config_items, $self->_orbase_items(@_) );
488 }
489
490 =back
491
492 =head1 SUBROUTINES
493
494 =over 4
495
496 =item init-config DIR
497
498 Imports the configuration items from DIR (1.7 compatible)
499 to conf records in the database.
500
501 =cut
502
503 sub init_config {
504   my $dir = shift;
505
506   {
507     local $FS::UID::use_confcompat = 0;
508     my $conf = new FS::Conf;
509     foreach my $item ( $conf->config_items(dir => $dir) ) {
510       $conf->import_config_item($item, $dir);
511       my $error = $conf->verify_config_item($item, $dir);
512       return $error if $error;
513     }
514   
515     my $compat = new FS::Conf_compat17 $dir;
516     foreach my $item ( $compat->config_items ) {
517       my $error = $conf->verify_config_item($item, $dir);
518       return $error if $error;
519     }
520   }
521
522   $FS::UID::use_confcompat = 0;
523   '';  #success
524 }
525
526 =back
527
528 =head1 BUGS
529
530 If this was more than just crud that will never be useful outside Freeside I'd
531 worry that config_items is freeside-specific and icky.
532
533 =head1 SEE ALSO
534
535 "Configuration" in the web interface (config/config.cgi).
536
537 =cut
538
539 #Business::CreditCard
540 @card_types = (
541   "VISA card",
542   "MasterCard",
543   "Discover card",
544   "American Express card",
545   "Diner's Club/Carte Blanche",
546   "enRoute",
547   "JCB",
548   "BankCard",
549   "Switch",
550   "Solo",
551 );
552
553 @base_items = qw(
554 invoice_template
555 invoice_latex
556 invoice_latexreturnaddress
557 invoice_latexfooter
558 invoice_latexsmallfooter
559 invoice_latexnotes
560 invoice_latexcoupon
561 invoice_html
562 invoice_htmlreturnaddress
563 invoice_htmlfooter
564 invoice_htmlnotes
565 logo.png
566 logo.eps
567 );
568
569 my %msg_template_options = (
570   'type'        => 'select-sub',
571   'options_sub' => sub { 
572     my @templates = qsearch({
573         'table' => 'msg_template', 
574         'hashref' => { 'disabled' => '' },
575         'extra_sql' => ' AND '. 
576           $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
577         });
578     map { $_->msgnum, $_->msgname } @templates;
579   },
580   'option_sub'  => sub { 
581                          my $msg_template = FS::msg_template->by_key(shift);
582                          $msg_template ? $msg_template->msgname : ''
583                        },
584   'per_agent' => 1,
585 );
586
587 my $_gateway_name = sub {
588   my $g = shift;
589   return '' if !$g;
590   ($g->gateway_username . '@' . $g->gateway_module);
591 };
592
593 my %payment_gateway_options = (
594   'type'        => 'select-sub',
595   'options_sub' => sub {
596     my @gateways = qsearch({
597         'table' => 'payment_gateway',
598         'hashref' => { 'disabled' => '' },
599       });
600     map { $_->gatewaynum, $_gateway_name->($_) } @gateways;
601   },
602   'option_sub'  => sub {
603     my $gateway = FS::payment_gateway->by_key(shift);
604     $_gateway_name->($gateway);
605   },
606 );
607
608 #Billing (81 items)
609 #Invoicing (50 items)
610 #UI (69 items)
611 #Self-service (29 items)
612 #...
613 #Unclassified (77 items)
614
615 @config_items = map { new FS::ConfItem $_ } (
616
617   {
618     'key'         => 'address',
619     'section'     => 'deprecated',
620     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
621     'type'        => 'text',
622   },
623
624   {
625     'key'         => 'alert_expiration',
626     'section'     => 'notification',
627     'description' => 'Enable alerts about billing method expiration (i.e. expiring credit cards).',
628     'type'        => 'checkbox',
629     'per_agent'   => 1,
630   },
631
632   {
633     'key'         => 'alerter_template',
634     'section'     => 'deprecated',
635     'description' => 'Template file for billing method expiration alerts (i.e. expiring credit cards).',
636     'type'        => 'textarea',
637     'per_agent'   => 1,
638   },
639   
640   {
641     'key'         => 'alerter_msgnum',
642     'section'     => 'notification',
643     'description' => 'Template to use for credit card expiration alerts.',
644     %msg_template_options,
645   },
646
647   {
648     'key'         => 'apacheip',
649     #not actually deprecated yet
650     #'section'     => 'deprecated',
651     #'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be the current IP address to assign to new virtual hosts',
652     'section'     => '',
653     'description' => 'IP address to assign to new virtual hosts',
654     'type'        => 'text',
655   },
656
657   {
658     'key'         => 'encryption',
659     'section'     => 'billing',
660     'description' => 'Enable encryption of credit cards.',
661     'type'        => 'checkbox',
662   },
663
664   {
665     'key'         => 'encryptionmodule',
666     'section'     => 'billing',
667     'description' => 'Use which module for encryption?',
668     'type'        => 'text',
669   },
670
671   {
672     'key'         => 'encryptionpublickey',
673     'section'     => 'billing',
674     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
675     'type'        => 'textarea',
676   },
677
678   {
679     'key'         => 'encryptionprivatekey',
680     'section'     => 'billing',
681     'description' => 'Your RSA Private Key - Including this will enable the "Bill Now" feature.  However if the system is compromised, a hacker can use this key to decode the stored credit card information.  This is generally not a good idea.',
682     'type'        => 'textarea',
683   },
684
685   {
686     'key'         => 'billco-url',
687     'section'     => 'billing',
688     'description' => 'The url to use for performing uploads to the invoice mailing service.',
689     'type'        => 'text',
690     'per_agent'   => 1,
691   },
692
693   {
694     'key'         => 'billco-username',
695     'section'     => 'billing',
696     'description' => 'The login name to use for uploads to the invoice mailing service.',
697     'type'        => 'text',
698     'per_agent'   => 1,
699     'agentonly'   => 1,
700   },
701
702   {
703     'key'         => 'billco-password',
704     'section'     => 'billing',
705     'description' => 'The password to use for uploads to the invoice mailing service.',
706     'type'        => 'text',
707     'per_agent'   => 1,
708     'agentonly'   => 1,
709   },
710
711   {
712     'key'         => 'billco-clicode',
713     'section'     => 'billing',
714     'description' => 'The clicode to use for uploads to the invoice mailing service.',
715     'type'        => 'text',
716     'per_agent'   => 1,
717   },
718
719   {
720     'key'         => 'business-onlinepayment',
721     'section'     => 'billing',
722     'description' => '<a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
723     'type'        => 'textarea',
724   },
725
726   {
727     'key'         => 'business-onlinepayment-ach',
728     'section'     => 'billing',
729     'description' => 'Alternate <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support for ACH transactions (defaults to regular <b>business-onlinepayment</b>).  At least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
730     'type'        => 'textarea',
731   },
732
733   {
734     'key'         => 'business-onlinepayment-namespace',
735     'section'     => 'billing',
736     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
737     'type'        => 'select',
738     'select_hash' => [
739                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
740                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
741                      ],
742   },
743
744   {
745     'key'         => 'business-onlinepayment-description',
746     'section'     => 'billing',
747     'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>.  Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages for which these charges apply - not available in all situations)',
748     'type'        => 'text',
749   },
750
751   {
752     'key'         => 'business-onlinepayment-email-override',
753     'section'     => 'billing',
754     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
755     'type'        => 'text',
756   },
757
758   {
759     'key'         => 'business-onlinepayment-email_customer',
760     'section'     => 'billing',
761     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
762     'type'        => 'checkbox',
763   },
764
765   {
766     'key'         => 'business-onlinepayment-test_transaction',
767     'section'     => 'billing',
768     'description' => 'Turns on the Business::OnlinePayment test_transaction flag.  Note that not all gateway modules support this flag; if yours does not, transactions will still be sent live.',
769     'type'        => 'checkbox',
770   },
771
772   {
773     'key'         => 'countrydefault',
774     'section'     => 'UI',
775     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
776     'type'        => 'text',
777   },
778
779   {
780     'key'         => 'date_format',
781     'section'     => 'UI',
782     'description' => 'Format for displaying dates',
783     'type'        => 'select',
784     'select_hash' => [
785                        '%m/%d/%Y' => 'MM/DD/YYYY',
786                        '%d/%m/%Y' => 'DD/MM/YYYY',
787                        '%Y/%m/%d' => 'YYYY/MM/DD',
788                      ],
789   },
790
791   {
792     'key'         => '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:1.7: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:1.7: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:1.7: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:1.7:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
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'         => 'selfservice_server-base_url',
1844     'section'     => 'self-service',
1845     '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.',
1846     'type'        => 'text',
1847   },
1848
1849   {
1850     'key'         => 'show-msgcat-codes',
1851     'section'     => 'UI',
1852     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1853     'type'        => 'checkbox',
1854   },
1855
1856   {
1857     'key'         => 'signup_server-realtime',
1858     'section'     => 'self-service',
1859     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1860     'type'        => 'checkbox',
1861   },
1862
1863   {
1864     'key'         => 'signup_server-classnum2',
1865     'section'     => 'self-service',
1866     'description' => 'Package Class for first optional purchase',
1867     'type'        => 'select-pkg_class',
1868   },
1869
1870   {
1871     'key'         => 'signup_server-classnum3',
1872     'section'     => 'self-service',
1873     'description' => 'Package Class for second optional purchase',
1874     'type'        => 'select-pkg_class',
1875   },
1876
1877   {
1878     'key'         => 'selfservice-xmlrpc',
1879     'section'     => 'self-service',
1880     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
1881     'type'        => 'checkbox',
1882   },
1883
1884   {
1885     'key'         => 'backend-realtime',
1886     'section'     => 'billing',
1887     'description' => 'Run billing for backend signups immediately.',
1888     'type'        => 'checkbox',
1889   },
1890
1891   {
1892     'key'         => 'decline_msgnum',
1893     'section'     => 'notification',
1894     'description' => 'Template to use for credit card and electronic check decline messages.',
1895     %msg_template_options,
1896   },
1897
1898   {
1899     'key'         => 'declinetemplate',
1900     'section'     => 'deprecated',
1901     'description' => 'Template file for credit card and electronic check decline emails.',
1902     'type'        => 'textarea',
1903   },
1904
1905   {
1906     'key'         => 'emaildecline',
1907     'section'     => 'notification',
1908     'description' => 'Enable emailing of credit card and electronic check decline notices.',
1909     'type'        => 'checkbox',
1910     'per_agent'   => 1,
1911   },
1912
1913   {
1914     'key'         => 'emaildecline-exclude',
1915     'section'     => 'notification',
1916     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1917     'type'        => 'textarea',
1918     'per_agent'   => 1,
1919   },
1920
1921   {
1922     'key'         => 'cancel_msgnum',
1923     'section'     => 'notification',
1924     'description' => 'Template to use for cancellation emails.',
1925     %msg_template_options,
1926   },
1927
1928   {
1929     'key'         => 'cancelmessage',
1930     'section'     => 'deprecated',
1931     'description' => 'Template file for cancellation emails.',
1932     'type'        => 'textarea',
1933   },
1934
1935   {
1936     'key'         => 'cancelsubject',
1937     'section'     => 'deprecated',
1938     'description' => 'Subject line for cancellation emails.',
1939     'type'        => 'text',
1940   },
1941
1942   {
1943     'key'         => 'emailcancel',
1944     'section'     => 'notification',
1945     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
1946     'type'        => 'checkbox',
1947     'per_agent'   => 1,
1948   },
1949
1950   {
1951     'key'         => 'bill_usage_on_cancel',
1952     'section'     => 'billing',
1953     '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.',
1954     'type'        => 'checkbox',
1955   },
1956
1957   {
1958     'key'         => 'require_cardname',
1959     'section'     => 'billing',
1960     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1961     'type'        => 'checkbox',
1962   },
1963
1964   {
1965     'key'         => 'enable_taxclasses',
1966     'section'     => 'billing',
1967     'description' => 'Enable per-package tax classes',
1968     'type'        => 'checkbox',
1969   },
1970
1971   {
1972     'key'         => 'require_taxclasses',
1973     'section'     => 'billing',
1974     'description' => 'Require a taxclass to be entered for every package',
1975     'type'        => 'checkbox',
1976   },
1977
1978   {
1979     'key'         => 'enable_taxproducts',
1980     'section'     => 'billing',
1981     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
1982     'type'        => 'checkbox',
1983   },
1984
1985   {
1986     'key'         => 'taxdatadirectdownload',
1987     'section'     => 'billing',  #well
1988     'description' => 'Enable downloading tax data directly from the vendor site. at least three lines: URL, username, and password.j',
1989     'type'        => 'textarea',
1990   },
1991
1992   {
1993     'key'         => 'ignore_incalculable_taxes',
1994     'section'     => 'billing',
1995     'description' => 'Prefer to invoice without tax over not billing at all',
1996     'type'        => 'checkbox',
1997   },
1998
1999   {
2000     'key'         => 'welcome_msgnum',
2001     'section'     => 'notification',
2002     'description' => 'Template to use for welcome messages when a svc_acct record is created.',
2003     %msg_template_options,
2004   },
2005
2006   {
2007     'key'         => 'welcome_email',
2008     'section'     => 'deprecated',
2009     '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.',
2010     'type'        => 'textarea',
2011     'per_agent'   => 1,
2012   },
2013
2014   {
2015     'key'         => 'welcome_email-from',
2016     'section'     => 'deprecated',
2017     'description' => 'From: address header for welcome email',
2018     'type'        => 'text',
2019     'per_agent'   => 1,
2020   },
2021
2022   {
2023     'key'         => 'welcome_email-subject',
2024     'section'     => 'deprecated',
2025     'description' => 'Subject: header for welcome email',
2026     'type'        => 'text',
2027     'per_agent'   => 1,
2028   },
2029   
2030   {
2031     'key'         => 'welcome_email-mimetype',
2032     'section'     => 'deprecated',
2033     'description' => 'MIME type for welcome email',
2034     'type'        => 'select',
2035     'select_enum' => [ 'text/plain', 'text/html' ],
2036     'per_agent'   => 1,
2037   },
2038
2039   {
2040     'key'         => 'welcome_letter',
2041     'section'     => '',
2042     '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>',
2043     'type'        => 'textarea',
2044   },
2045
2046 #  {
2047 #    'key'         => 'warning_msgnum',
2048 #    'section'     => 'notification',
2049 #    '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.',
2050 #    %msg_template_options,
2051 #  },
2052
2053   {
2054     'key'         => 'warning_email',
2055     'section'     => 'notification',
2056     '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>',
2057     'type'        => 'textarea',
2058   },
2059
2060   {
2061     'key'         => 'warning_email-from',
2062     'section'     => 'notification',
2063     'description' => 'From: address header for warning email',
2064     'type'        => 'text',
2065   },
2066
2067   {
2068     'key'         => 'warning_email-cc',
2069     'section'     => 'notification',
2070     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
2071     'type'        => 'text',
2072   },
2073
2074   {
2075     'key'         => 'warning_email-subject',
2076     'section'     => 'notification',
2077     'description' => 'Subject: header for warning email',
2078     'type'        => 'text',
2079   },
2080   
2081   {
2082     'key'         => 'warning_email-mimetype',
2083     'section'     => 'notification',
2084     'description' => 'MIME type for warning email',
2085     'type'        => 'select',
2086     'select_enum' => [ 'text/plain', 'text/html' ],
2087   },
2088
2089   {
2090     'key'         => 'payby',
2091     'section'     => 'billing',
2092     'description' => 'Available payment types.',
2093     'type'        => 'selectmultiple',
2094     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
2095   },
2096
2097   {
2098     'key'         => 'payby-default',
2099     'section'     => 'UI',
2100     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
2101     'type'        => 'select',
2102     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
2103   },
2104
2105   {
2106     'key'         => 'paymentforcedtobatch',
2107     'section'     => 'deprecated',
2108     '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.',
2109     'type'        => 'checkbox',
2110   },
2111
2112   {
2113     'key'         => 'svc_acct-notes',
2114     'section'     => 'deprecated',
2115     'description' => 'Extra HTML to be displayed on the Account View screen.',
2116     'type'        => 'textarea',
2117   },
2118
2119   {
2120     'key'         => 'radius-password',
2121     'section'     => '',
2122     'description' => 'RADIUS attribute for plain-text passwords.',
2123     'type'        => 'select',
2124     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
2125   },
2126
2127   {
2128     'key'         => 'radius-ip',
2129     'section'     => '',
2130     'description' => 'RADIUS attribute for IP addresses.',
2131     'type'        => 'select',
2132     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2133   },
2134
2135   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2136   {
2137     'key'         => 'radius-chillispot-max',
2138     'section'     => '',
2139     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2140     'type'        => 'checkbox',
2141   },
2142
2143   {
2144     'key'         => 'svc_acct-alldomains',
2145     'section'     => '',
2146     '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.',
2147     'type'        => 'checkbox',
2148   },
2149
2150   {
2151     'key'         => 'dump-scpdest',
2152     'section'     => '',
2153     'description' => 'destination for scp database dumps: user@host:/path',
2154     'type'        => 'text',
2155   },
2156
2157   {
2158     'key'         => 'dump-pgpid',
2159     'section'     => '',
2160     '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.",
2161     'type'        => 'text',
2162   },
2163
2164   {
2165     'key'         => 'users-allow_comp',
2166     'section'     => 'deprecated',
2167     '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.',
2168     'type'        => 'textarea',
2169   },
2170
2171   {
2172     'key'         => 'credit_card-recurring_billing_flag',
2173     'section'     => 'billing',
2174     '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. ',
2175     'type'        => 'select',
2176     'select_hash' => [
2177                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2178                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
2179                      ],
2180   },
2181
2182   {
2183     'key'         => 'credit_card-recurring_billing_acct_code',
2184     'section'     => 'billing',
2185     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2186     'type'        => 'checkbox',
2187   },
2188
2189   {
2190     'key'         => 'cvv-save',
2191     'section'     => 'billing',
2192     '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.',
2193     'type'        => 'selectmultiple',
2194     'select_enum' => \@card_types,
2195   },
2196
2197   {
2198     'key'         => 'manual_process-pkgpart',
2199     'section'     => 'billing',
2200     '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.',
2201     'type'        => 'select-part_pkg',
2202   },
2203
2204   {
2205     'key'         => 'manual_process-display',
2206     'section'     => 'billing',
2207     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2208     'type'        => 'select',
2209     'select_hash' => [
2210                        'add'      => 'Add fee to amount entered',
2211                        'subtract' => 'Subtract fee from amount entered',
2212                      ],
2213   },
2214
2215   {
2216     'key'         => 'manual_process-skip_first',
2217     'section'     => 'billing',
2218     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2219     'type'        => 'checkbox',
2220   },
2221
2222   {
2223     'key'         => 'allow_negative_charges',
2224     'section'     => 'billing',
2225     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2226     'type'        => 'checkbox',
2227   },
2228   {
2229       'key'         => 'auto_unset_catchall',
2230       'section'     => '',
2231       '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.',
2232       'type'        => 'checkbox',
2233   },
2234
2235   {
2236     'key'         => 'system_usernames',
2237     'section'     => 'username',
2238     '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.',
2239     'type'        => 'textarea',
2240   },
2241
2242   {
2243     'key'         => 'cust_pkg-change_svcpart',
2244     'section'     => '',
2245     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
2246     'type'        => 'checkbox',
2247   },
2248
2249   {
2250     'key'         => 'cust_pkg-change_pkgpart-bill_now',
2251     'section'     => '',
2252     '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.",
2253     'type'        => 'checkbox',
2254   },
2255
2256   {
2257     'key'         => 'disable_autoreverse',
2258     'section'     => 'BIND',
2259     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
2260     'type'        => 'checkbox',
2261   },
2262
2263   {
2264     'key'         => 'svc_www-enable_subdomains',
2265     'section'     => '',
2266     'description' => 'Enable selection of specific subdomains for virtual host creation.',
2267     'type'        => 'checkbox',
2268   },
2269
2270   {
2271     'key'         => 'svc_www-usersvc_svcpart',
2272     'section'     => '',
2273     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
2274     'type'        => 'select-part_svc',
2275     'multiple'    => 1,
2276   },
2277
2278   {
2279     'key'         => 'selfservice_server-primary_only',
2280     'section'     => 'self-service',
2281     'description' => 'Only allow primary accounts to access self-service functionality.',
2282     'type'        => 'checkbox',
2283   },
2284
2285   {
2286     'key'         => 'selfservice_server-phone_login',
2287     'section'     => 'self-service',
2288     'description' => 'Allow login to self-service with phone number and PIN.',
2289     'type'        => 'checkbox',
2290   },
2291
2292   {
2293     'key'         => 'selfservice_server-single_domain',
2294     'section'     => 'self-service',
2295     'description' => 'If specified, only use this one domain for self-service access.',
2296     'type'        => 'text',
2297   },
2298
2299   {
2300     'key'         => 'selfservice_server-login_svcpart',
2301     'section'     => 'self-service',
2302     'description' => 'If specified, only allow the specified svcparts to login to self-service.',
2303     'type'        => 'select-part_svc',
2304     'multiple'    => 1,
2305   },
2306   
2307   {
2308     'key'         => 'selfservice-recent-did-age',
2309     'section'     => 'self-service',
2310     'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
2311     'type'        => 'text',
2312   },
2313
2314   {
2315     'key'         => 'selfservice_server-view-wholesale',
2316     'section'     => 'self-service',
2317     'description' => 'If enabled, use a wholesale package view in the self-service.',
2318     'type'        => 'checkbox',
2319   },
2320   
2321   {
2322     'key'         => 'selfservice-agent_signup',
2323     'section'     => 'self-service',
2324     'description' => 'Allow agent signup via self-service.',
2325     'type'        => 'checkbox',
2326   },
2327
2328   {
2329     'key'         => 'selfservice-agent_signup-agent_type',
2330     'section'     => 'self-service',
2331     'description' => 'Agent type when allowing agent signup via self-service.',
2332     'type'        => 'select-sub',
2333     'options_sub' => sub { require FS::Record;
2334                            require FS::agent_type;
2335                            map { $_->typenum => $_->atype }
2336                                FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
2337                          },
2338     'option_sub'  => sub { require FS::Record;
2339                            require FS::agent_type;
2340                            my $agent = FS::Record::qsearchs(
2341                              'agent_type', { 'typenum'=>shift }
2342                            );
2343                            $agent_type ? $agent_type->atype : '';
2344                          },
2345   },
2346
2347   {
2348     'key'         => 'selfservice-agent_login',
2349     'section'     => 'self-service',
2350     'description' => 'Allow agent login via self-service.',
2351     'type'        => 'checkbox',
2352   },
2353
2354   {
2355     'key'         => 'selfservice-self_suspend_reason',
2356     'section'     => 'self-service',
2357     'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
2358     'type'        => 'select-sub',
2359     'options_sub' => sub { require FS::Record;
2360                            require FS::reason;
2361                            my $type = qsearchs('reason_type', 
2362                              { class => 'S' }) 
2363                               or return ();
2364                            map { $_->reasonnum => $_->reason }
2365                                FS::Record::qsearch('reason', 
2366                                  { reason_type => $type->typenum } 
2367                                );
2368                          },
2369     'option_sub'  => sub { require FS::Record;
2370                            require FS::reason;
2371                            my $reason = FS::Record::qsearchs(
2372                              'reason', { 'reasonnum' => shift }
2373                            );
2374                            $reason ? $reason->reason : '';
2375                          },
2376
2377     'per_agent'   => 1,
2378   },
2379
2380   {
2381     'key'         => 'card_refund-days',
2382     'section'     => 'billing',
2383     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
2384     'type'        => 'text',
2385   },
2386
2387   {
2388     'key'         => 'agent-showpasswords',
2389     'section'     => '',
2390     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
2391     'type'        => 'checkbox',
2392   },
2393
2394   {
2395     'key'         => 'global_unique-username',
2396     'section'     => 'username',
2397     '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.',
2398     'type'        => 'select',
2399     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
2400   },
2401
2402   {
2403     'key'         => 'global_unique-phonenum',
2404     'section'     => '',
2405     '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.',
2406     'type'        => 'select',
2407     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
2408   },
2409
2410   {
2411     'key'         => 'global_unique-pbx_title',
2412     'section'     => '',
2413     'description' => 'Global phone number uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2414     'type'        => 'select',
2415     'select_enum' => [ 'enabled', 'disabled' ],
2416   },
2417
2418   {
2419     'key'         => 'global_unique-pbx_id',
2420     'section'     => '',
2421     'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2422     'type'        => 'select',
2423     'select_enum' => [ 'enabled', 'disabled' ],
2424   },
2425
2426   {
2427     'key'         => 'svc_external-skip_manual',
2428     'section'     => 'UI',
2429     '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).',
2430     'type'        => 'checkbox',
2431   },
2432
2433   {
2434     'key'         => 'svc_external-display_type',
2435     'section'     => 'UI',
2436     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
2437     'type'        => 'select',
2438     'select_enum' => [ 'generic', 'artera_turbo', ],
2439   },
2440
2441   {
2442     'key'         => 'ticket_system',
2443     'section'     => '',
2444     'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
2445     'type'        => 'select',
2446     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
2447     'select_enum' => [ '', qw(RT_Internal RT_External) ],
2448   },
2449
2450   {
2451     'key'         => 'ticket_system-default_queueid',
2452     'section'     => '',
2453     'description' => 'Default queue used when creating new customer tickets.',
2454     'type'        => 'select-sub',
2455     'options_sub' => sub {
2456                            my $conf = new FS::Conf;
2457                            if ( $conf->config('ticket_system') ) {
2458                              eval "use FS::TicketSystem;";
2459                              die $@ if $@;
2460                              FS::TicketSystem->queues();
2461                            } else {
2462                              ();
2463                            }
2464                          },
2465     'option_sub'  => sub { 
2466                            my $conf = new FS::Conf;
2467                            if ( $conf->config('ticket_system') ) {
2468                              eval "use FS::TicketSystem;";
2469                              die $@ if $@;
2470                              FS::TicketSystem->queue(shift);
2471                            } else {
2472                              '';
2473                            }
2474                          },
2475   },
2476   {
2477     'key'         => 'ticket_system-force_default_queueid',
2478     'section'     => '',
2479     'description' => 'Disallow queue selection when creating new tickets from customer view.',
2480     'type'        => 'checkbox',
2481   },
2482   {
2483     'key'         => 'ticket_system-selfservice_queueid',
2484     'section'     => '',
2485     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
2486     #false laziness w/above
2487     'type'        => 'select-sub',
2488     'options_sub' => sub {
2489                            my $conf = new FS::Conf;
2490                            if ( $conf->config('ticket_system') ) {
2491                              eval "use FS::TicketSystem;";
2492                              die $@ if $@;
2493                              FS::TicketSystem->queues();
2494                            } else {
2495                              ();
2496                            }
2497                          },
2498     'option_sub'  => sub { 
2499                            my $conf = new FS::Conf;
2500                            if ( $conf->config('ticket_system') ) {
2501                              eval "use FS::TicketSystem;";
2502                              die $@ if $@;
2503                              FS::TicketSystem->queue(shift);
2504                            } else {
2505                              '';
2506                            }
2507                          },
2508   },
2509
2510   {
2511     'key'         => 'ticket_system-priority_reverse',
2512     'section'     => '',
2513     '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.',
2514     'type'        => 'checkbox',
2515   },
2516
2517   {
2518     'key'         => 'ticket_system-custom_priority_field',
2519     'section'     => '',
2520     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
2521     'type'        => 'text',
2522   },
2523
2524   {
2525     'key'         => 'ticket_system-custom_priority_field-values',
2526     'section'     => '',
2527     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
2528     'type'        => 'textarea',
2529   },
2530
2531   {
2532     'key'         => 'ticket_system-custom_priority_field_queue',
2533     'section'     => '',
2534     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
2535     'type'        => 'text',
2536   },
2537
2538   {
2539     'key'         => 'ticket_system-rt_external_datasrc',
2540     'section'     => '',
2541     '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>',
2542     'type'        => 'text',
2543
2544   },
2545
2546   {
2547     'key'         => 'ticket_system-rt_external_url',
2548     'section'     => '',
2549     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
2550     'type'        => 'text',
2551   },
2552
2553   {
2554     'key'         => 'company_name',
2555     'section'     => 'required',
2556     'description' => 'Your company name',
2557     'type'        => 'text',
2558     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
2559   },
2560
2561   {
2562     'key'         => 'company_address',
2563     'section'     => 'required',
2564     'description' => 'Your company address',
2565     'type'        => 'textarea',
2566     'per_agent'   => 1,
2567   },
2568
2569   {
2570     'key'         => 'echeck-void',
2571     'section'     => 'deprecated',
2572     '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',
2573     'type'        => 'checkbox',
2574   },
2575
2576   {
2577     'key'         => 'cc-void',
2578     'section'     => 'deprecated',
2579     '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',
2580     'type'        => 'checkbox',
2581   },
2582
2583   {
2584     'key'         => 'unvoid',
2585     'section'     => 'deprecated',
2586     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
2587     'type'        => 'checkbox',
2588   },
2589
2590   {
2591     'key'         => 'address1-search',
2592     'section'     => 'UI',
2593     '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.',
2594     'type'        => 'checkbox',
2595   },
2596
2597   {
2598     'key'         => 'address2-search',
2599     'section'     => 'UI',
2600     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
2601     'type'        => 'checkbox',
2602   },
2603
2604   {
2605     'key'         => 'cust_main-require_address2',
2606     'section'     => 'UI',
2607     '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',
2608     'type'        => 'checkbox',
2609   },
2610
2611   {
2612     'key'         => 'agent-ship_address',
2613     'section'     => '',
2614     '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.",
2615     'type'        => 'checkbox',
2616   },
2617
2618   { 'key'         => 'referral_credit',
2619     'section'     => 'deprecated',
2620     '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.",
2621     'type'        => 'checkbox',
2622   },
2623
2624   { 'key'         => 'selfservice_server-cache_module',
2625     'section'     => 'self-service',
2626     '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.',
2627     'type'        => 'select',
2628     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
2629   },
2630
2631   {
2632     'key'         => 'hylafax',
2633     'section'     => 'billing',
2634     '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).',
2635     'type'        => [qw( checkbox textarea )],
2636   },
2637
2638   {
2639     'key'         => 'cust_bill-ftpformat',
2640     'section'     => 'invoicing',
2641     'description' => 'Enable FTP of raw invoice data - format.',
2642     'type'        => 'select',
2643     'select_enum' => [ '', 'default', 'billco', ],
2644   },
2645
2646   {
2647     'key'         => 'cust_bill-ftpserver',
2648     'section'     => 'invoicing',
2649     'description' => 'Enable FTP of raw invoice data - server.',
2650     'type'        => 'text',
2651   },
2652
2653   {
2654     'key'         => 'cust_bill-ftpusername',
2655     'section'     => 'invoicing',
2656     'description' => 'Enable FTP of raw invoice data - server.',
2657     'type'        => 'text',
2658   },
2659
2660   {
2661     'key'         => 'cust_bill-ftppassword',
2662     'section'     => 'invoicing',
2663     'description' => 'Enable FTP of raw invoice data - server.',
2664     'type'        => 'text',
2665   },
2666
2667   {
2668     'key'         => 'cust_bill-ftpdir',
2669     'section'     => 'invoicing',
2670     'description' => 'Enable FTP of raw invoice data - server.',
2671     'type'        => 'text',
2672   },
2673
2674   {
2675     'key'         => 'cust_bill-spoolformat',
2676     'section'     => 'invoicing',
2677     'description' => 'Enable spooling of raw invoice data - format.',
2678     'type'        => 'select',
2679     'select_enum' => [ '', 'default', 'billco', ],
2680   },
2681
2682   {
2683     'key'         => 'cust_bill-spoolagent',
2684     'section'     => 'invoicing',
2685     'description' => 'Enable per-agent spooling of raw invoice data.',
2686     'type'        => 'checkbox',
2687   },
2688
2689   {
2690     'key'         => 'svc_acct-usage_suspend',
2691     'section'     => 'billing',
2692     '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.',
2693     'type'        => 'checkbox',
2694   },
2695
2696   {
2697     'key'         => 'svc_acct-usage_unsuspend',
2698     'section'     => 'billing',
2699     '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.',
2700     'type'        => 'checkbox',
2701   },
2702
2703   {
2704     'key'         => 'svc_acct-usage_threshold',
2705     'section'     => 'billing',
2706     '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.',
2707     'type'        => 'text',
2708   },
2709
2710   {
2711     'key'         => 'overlimit_groups',
2712     'section'     => '',
2713     'description' => 'RADIUS group (or comma-separated groups) to assign to svc_acct which has exceeded its bandwidth or time limit.',
2714     'type'        => 'text',
2715     'per_agent'   => 1,
2716   },
2717
2718   {
2719     'key'         => 'cust-fields',
2720     'section'     => 'UI',
2721     'description' => 'Which customer fields to display on reports by default',
2722     'type'        => 'select',
2723     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
2724   },
2725
2726   {
2727     'key'         => 'cust_pkg-display_times',
2728     'section'     => 'UI',
2729     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
2730     'type'        => 'checkbox',
2731   },
2732
2733   {
2734     'key'         => 'cust_pkg-always_show_location',
2735     'section'     => 'UI',
2736     'description' => "Always display package locations, even when they're all the default service address.",
2737     'type'        => 'checkbox',
2738   },
2739
2740   {
2741     'key'         => 'cust_pkg-group_by_location',
2742     'section'     => 'UI',
2743     'description' => "Group packages by location.",
2744     'type'        => 'checkbox',
2745   },
2746
2747   {
2748     'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
2749     'section'     => 'UI',
2750     'description' => "Show a field on package definitions for assigning a DSO equivalency number suitable for use on FCC form 477.",
2751     'type'        => 'checkbox',
2752   },
2753
2754   {
2755     'key'         => 'cust_pkg-large_pkg_size',
2756     'section'     => 'UI',
2757     'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
2758     'type'        => 'text',
2759   },
2760
2761   {
2762     'key'         => 'svc_acct-edit_uid',
2763     'section'     => 'shell',
2764     'description' => 'Allow UID editing.',
2765     'type'        => 'checkbox',
2766   },
2767
2768   {
2769     'key'         => 'svc_acct-edit_gid',
2770     'section'     => 'shell',
2771     'description' => 'Allow GID editing.',
2772     'type'        => 'checkbox',
2773   },
2774
2775   {
2776     'key'         => 'zone-underscore',
2777     'section'     => 'BIND',
2778     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
2779     'type'        => 'checkbox',
2780   },
2781
2782   {
2783     'key'         => 'echeck-nonus',
2784     'section'     => 'billing',
2785     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
2786     'type'        => 'checkbox',
2787   },
2788
2789   {
2790     'key'         => 'voip-cust_cdr_spools',
2791     'section'     => '',
2792     'description' => 'Enable the per-customer option for individual CDR spools.',
2793     'type'        => 'checkbox',
2794   },
2795
2796   {
2797     'key'         => 'voip-cust_cdr_squelch',
2798     'section'     => '',
2799     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
2800     'type'        => 'checkbox',
2801   },
2802
2803   {
2804     'key'         => 'voip-cdr_email',
2805     'section'     => '',
2806     '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.',
2807     'type'        => 'checkbox',
2808   },
2809
2810   {
2811     'key'         => 'voip-cust_email_csv_cdr',
2812     'section'     => '',
2813     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
2814     'type'        => 'checkbox',
2815   },
2816
2817   {
2818     'key'         => 'cgp_rule-domain_templates',
2819     'section'     => '',
2820     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
2821     'type'        => 'textarea',
2822   },
2823
2824   {
2825     'key'         => 'svc_forward-no_srcsvc',
2826     'section'     => '',
2827     '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.",
2828     'type'        => 'checkbox',
2829   },
2830
2831   {
2832     'key'         => 'svc_forward-arbitrary_dst',
2833     'section'     => '',
2834     '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.",
2835     'type'        => 'checkbox',
2836   },
2837
2838   {
2839     'key'         => 'tax-ship_address',
2840     'section'     => 'billing',
2841     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
2842     'type'        => 'checkbox',
2843   }
2844 ,
2845   {
2846     'key'         => 'tax-pkg_address',
2847     'section'     => 'billing',
2848     '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).',
2849     'type'        => 'checkbox',
2850   },
2851
2852   {
2853     'key'         => 'invoice-ship_address',
2854     'section'     => 'invoicing',
2855     'description' => 'Include the shipping address on invoices.',
2856     'type'        => 'checkbox',
2857   },
2858
2859   {
2860     'key'         => 'invoice-unitprice',
2861     'section'     => 'invoicing',
2862     'description' => 'Enable unit pricing on invoices.',
2863     'type'        => 'checkbox',
2864   },
2865
2866   {
2867     'key'         => 'invoice-smallernotes',
2868     'section'     => 'invoicing',
2869     'description' => 'Display the notes section in a smaller font on invoices.',
2870     'type'        => 'checkbox',
2871   },
2872
2873   {
2874     'key'         => 'invoice-smallerfooter',
2875     'section'     => 'invoicing',
2876     'description' => 'Display footers in a smaller font on invoices.',
2877     'type'        => 'checkbox',
2878   },
2879
2880   {
2881     'key'         => 'postal_invoice-fee_pkgpart',
2882     'section'     => 'billing',
2883     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
2884     'type'        => 'select-part_pkg',
2885   },
2886
2887   {
2888     'key'         => 'postal_invoice-recurring_only',
2889     'section'     => 'billing',
2890     'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
2891     'type'        => 'checkbox',
2892   },
2893
2894   {
2895     'key'         => 'batch-enable',
2896     'section'     => 'deprecated', #make sure batch-enable_payby is set for
2897                                    #everyone before removing
2898     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
2899     'type'        => 'checkbox',
2900   },
2901
2902   {
2903     'key'         => 'batch-enable_payby',
2904     'section'     => 'billing',
2905     'description' => 'Enable batch processing for the specified payment types.',
2906     'type'        => 'selectmultiple',
2907     'select_enum' => [qw( CARD CHEK )],
2908   },
2909
2910   {
2911     'key'         => 'realtime-disable_payby',
2912     'section'     => 'billing',
2913     'description' => 'Disable realtime processing for the specified payment types.',
2914     'type'        => 'selectmultiple',
2915     'select_enum' => [qw( CARD CHEK )],
2916   },
2917
2918   {
2919     'key'         => 'batch-default_format',
2920     'section'     => 'billing',
2921     'description' => 'Default format for batches.',
2922     'type'        => 'select',
2923     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
2924                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
2925                        'paymentech', 'ach-spiritone', 'RBC'
2926                     ]
2927   },
2928
2929   #lists could be auto-generated from pay_batch info
2930   {
2931     'key'         => 'batch-fixed_format-CARD',
2932     'section'     => 'billing',
2933     'description' => 'Fixed (unchangeable) format for credit card batches.',
2934     'type'        => 'select',
2935     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
2936                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
2937   },
2938
2939   {
2940     'key'         => 'batch-fixed_format-CHEK',
2941     'section'     => 'billing',
2942     'description' => 'Fixed (unchangeable) format for electronic check batches.',
2943     'type'        => 'select',
2944     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
2945                        'paymentech', 'ach-spiritone', 'RBC'
2946                      ]
2947   },
2948
2949   {
2950     'key'         => 'batch-increment_expiration',
2951     'section'     => 'billing',
2952     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
2953     'type'        => 'checkbox'
2954   },
2955
2956   {
2957     'key'         => 'batchconfig-BoM',
2958     'section'     => 'billing',
2959     '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',
2960     'type'        => 'textarea',
2961   },
2962
2963   {
2964     'key'         => 'batchconfig-PAP',
2965     'section'     => 'billing',
2966     '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',
2967     'type'        => 'textarea',
2968   },
2969
2970   {
2971     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
2972     'section'     => 'billing',
2973     'description' => 'Gateway ID for Chase Canada E-xact batching',
2974     'type'        => 'text',
2975   },
2976
2977   {
2978     'key'         => 'batchconfig-paymentech',
2979     'section'     => 'billing',
2980     'description' => 'Configuration for Chase Paymentech batching, five lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username, 5. Password (for batch uploads)',
2981     'type'        => 'textarea',
2982   },
2983
2984   {
2985     'key'         => 'batchconfig-RBC',
2986     'section'     => 'billing',
2987     'description' => 'Configuration for Royal Bank of Canada PDS batching, four lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code.',
2988     'type'        => 'textarea',
2989   },
2990
2991   {
2992     'key'         => 'batchconfig-td_eft1464',
2993     'section'     => 'billing',
2994     '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.',
2995     'type'        => 'textarea',
2996   },
2997
2998   {
2999     'key'         => 'batch-manual_approval',
3000     'section'     => 'billing',
3001     '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.',
3002     'type'        => 'checkbox',
3003   },
3004
3005   {
3006     'key'         => 'payment_history-years',
3007     'section'     => 'UI',
3008     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
3009     'type'        => 'text',
3010   },
3011
3012   {
3013     'key'         => 'change_history-years',
3014     'section'     => 'UI',
3015     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
3016     'type'        => 'text',
3017   },
3018
3019   {
3020     'key'         => 'cust_main-packages-years',
3021     'section'     => 'UI',
3022     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
3023     'type'        => 'text',
3024   },
3025
3026   {
3027     'key'         => 'cust_main-use_comments',
3028     'section'     => 'UI',
3029     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
3030     'type'        => 'checkbox',
3031   },
3032
3033   {
3034     'key'         => 'cust_main-disable_notes',
3035     'section'     => 'UI',
3036     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
3037     'type'        => 'checkbox',
3038   },
3039
3040   {
3041     'key'         => 'cust_main_note-display_times',
3042     'section'     => 'UI',
3043     'description' => 'Display full timestamps (not just dates) for customer notes.',
3044     'type'        => 'checkbox',
3045   },
3046
3047   {
3048     'key'         => 'cust_main-ticket_statuses',
3049     'section'     => 'UI',
3050     'description' => 'Show tickets with these statuses on the customer view page.',
3051     'type'        => 'selectmultiple',
3052     'select_enum' => [qw( new open stalled resolved rejected deleted )],
3053   },
3054
3055   {
3056     'key'         => 'cust_main-max_tickets',
3057     'section'     => 'UI',
3058     'description' => 'Maximum number of tickets to show on the customer view page.',
3059     'type'        => 'text',
3060   },
3061
3062   {
3063     'key'         => 'cust_main-skeleton_tables',
3064     'section'     => '',
3065     '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.',
3066     'type'        => 'textarea',
3067   },
3068
3069   {
3070     'key'         => 'cust_main-skeleton_custnum',
3071     'section'     => '',
3072     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
3073     'type'        => 'text',
3074   },
3075
3076   {
3077     'key'         => 'cust_main-enable_birthdate',
3078     'section'     => 'UI',
3079     'descritpion' => 'Enable tracking of a birth date with each customer record',
3080     'type'        => 'checkbox',
3081   },
3082
3083   {
3084     'key'         => 'support-key',
3085     'section'     => '',
3086     '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.',
3087     'type'        => 'text',
3088   },
3089
3090   {
3091     'key'         => 'card-types',
3092     'section'     => 'billing',
3093     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
3094     'type'        => 'selectmultiple',
3095     'select_enum' => \@card_types,
3096   },
3097
3098   {
3099     'key'         => 'disable-fuzzy',
3100     'section'     => 'UI',
3101     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
3102     'type'        => 'checkbox',
3103   },
3104
3105   { 'key'         => 'pkg_referral',
3106     'section'     => '',
3107     'description' => 'Enable package-specific advertising sources.',
3108     'type'        => 'checkbox',
3109   },
3110
3111   { 'key'         => 'pkg_referral-multiple',
3112     'section'     => '',
3113     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
3114     'type'        => 'checkbox',
3115   },
3116
3117   {
3118     'key'         => 'dashboard-install_welcome',
3119     'section'     => 'UI',
3120     'description' => 'New install welcome screen.',
3121     'type'        => 'select',
3122     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
3123   },
3124
3125   {
3126     'key'         => 'dashboard-toplist',
3127     'section'     => 'UI',
3128     'description' => 'List of items to display on the top of the front page',
3129     'type'        => 'textarea',
3130   },
3131
3132   {
3133     'key'         => 'impending_recur_msgnum',
3134     'section'     => 'notification',
3135     'description' => 'Template to use for alerts about first-time recurring billing.',
3136     %msg_template_options,
3137   },
3138
3139   {
3140     'key'         => 'impending_recur_template',
3141     'section'     => 'deprecated',
3142     '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>',
3143 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
3144     'type'        => 'textarea',
3145   },
3146
3147   {
3148     'key'         => 'logo.png',
3149     'section'     => 'UI',  #'invoicing' ?
3150     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
3151     'type'        => 'image',
3152     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
3153                         #old-style editor anyway...?
3154   },
3155
3156   {
3157     'key'         => 'logo.eps',
3158     'section'     => 'invoicing',
3159     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
3160     'type'        => 'image',
3161     'per_agent'   => 1, #XXX as above, kinda
3162   },
3163
3164   {
3165     'key'         => 'selfservice-ignore_quantity',
3166     'section'     => 'self-service',
3167     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
3168     'type'        => 'checkbox',
3169   },
3170
3171   {
3172     'key'         => 'selfservice-session_timeout',
3173     'section'     => 'self-service',
3174     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
3175     'type'        => 'select',
3176     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
3177   },
3178
3179   {
3180     'key'         => 'disable_setup_suspended_pkgs',
3181     'section'     => 'billing',
3182     'description' => 'Disables charging of setup fees for suspended packages.',
3183     'type'        => 'checkbox',
3184   },
3185
3186   {
3187     'key'         => 'password-generated-allcaps',
3188     'section'     => 'password',
3189     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
3190     'type'        => 'checkbox',
3191   },
3192
3193   {
3194     'key'         => 'datavolume-forcemegabytes',
3195     'section'     => 'UI',
3196     'description' => 'All data volumes are expressed in megabytes',
3197     'type'        => 'checkbox',
3198   },
3199
3200   {
3201     'key'         => 'datavolume-significantdigits',
3202     'section'     => 'UI',
3203     'description' => 'number of significant digits to use to represent data volumes',
3204     'type'        => 'text',
3205   },
3206
3207   {
3208     'key'         => 'disable_void_after',
3209     'section'     => 'billing',
3210     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
3211     'type'        => 'text',
3212   },
3213
3214   {
3215     'key'         => 'disable_line_item_date_ranges',
3216     'section'     => 'billing',
3217     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
3218     'type'        => 'checkbox',
3219   },
3220
3221   {
3222     'key'         => 'support_packages',
3223     'section'     => '',
3224     '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...
3225     'type'        => 'select-part_pkg',
3226     'multiple'    => 1,
3227   },
3228
3229   {
3230     'key'         => 'cust_main-require_phone',
3231     'section'     => '',
3232     'description' => 'Require daytime or night phone for all customer records.',
3233     'type'        => 'checkbox',
3234   },
3235
3236   {
3237     'key'         => 'cust_main-require_invoicing_list_email',
3238     'section'     => '',
3239     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
3240     'type'        => 'checkbox',
3241   },
3242
3243   {
3244     'key'         => 'svc_acct-display_paid_time_remaining',
3245     'section'     => '',
3246     'description' => 'Show paid time remaining in addition to time remaining.',
3247     'type'        => 'checkbox',
3248   },
3249
3250   {
3251     'key'         => 'cancel_credit_type',
3252     'section'     => 'billing',
3253     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
3254     'type'        => 'select-sub',
3255     'options_sub' => sub { require FS::Record;
3256                            require FS::reason_type;
3257                            map { $_->typenum => $_->type }
3258                                FS::Record::qsearch('reason_type', { class=>'R' } );
3259                          },
3260     'option_sub'  => sub { require FS::Record;
3261                            require FS::reason_type;
3262                            my $reason_type = FS::Record::qsearchs(
3263                              'reason_type', { 'typenum' => shift }
3264                            );
3265                            $reason_type ? $reason_type->type : '';
3266                          },
3267   },
3268
3269   {
3270     'key'         => 'referral_credit_type',
3271     'section'     => 'deprecated',
3272     '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.',
3273     'type'        => 'select-sub',
3274     'options_sub' => sub { require FS::Record;
3275                            require FS::reason_type;
3276                            map { $_->typenum => $_->type }
3277                                FS::Record::qsearch('reason_type', { class=>'R' } );
3278                          },
3279     'option_sub'  => sub { require FS::Record;
3280                            require FS::reason_type;
3281                            my $reason_type = FS::Record::qsearchs(
3282                              'reason_type', { 'typenum' => shift }
3283                            );
3284                            $reason_type ? $reason_type->type : '';
3285                          },
3286   },
3287
3288   {
3289     'key'         => 'signup_credit_type',
3290     'section'     => 'billing', #self-service?
3291     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
3292     'type'        => 'select-sub',
3293     'options_sub' => sub { require FS::Record;
3294                            require FS::reason_type;
3295                            map { $_->typenum => $_->type }
3296                                FS::Record::qsearch('reason_type', { class=>'R' } );
3297                          },
3298     'option_sub'  => sub { require FS::Record;
3299                            require FS::reason_type;
3300                            my $reason_type = FS::Record::qsearchs(
3301                              'reason_type', { 'typenum' => shift }
3302                            );
3303                            $reason_type ? $reason_type->type : '';
3304                          },
3305   },
3306
3307   {
3308     'key'         => 'prepayment_discounts-credit_type',
3309     'section'     => 'billing',
3310     'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
3311     'type'        => 'select-sub',
3312     'options_sub' => sub { require FS::Record;
3313                            require FS::reason_type;
3314                            map { $_->typenum => $_->type }
3315                                FS::Record::qsearch('reason_type', { class=>'R' } );
3316                          },
3317     'option_sub'  => sub { require FS::Record;
3318                            require FS::reason_type;
3319                            my $reason_type = FS::Record::qsearchs(
3320                              'reason_type', { 'typenum' => shift }
3321                            );
3322                            $reason_type ? $reason_type->type : '';
3323                          },
3324
3325   },
3326
3327   {
3328     'key'         => 'cust_main-agent_custid-format',
3329     'section'     => '',
3330     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
3331     'type'        => 'select',
3332     'select_hash' => [
3333                        ''      => 'Numeric only',
3334                        'ww?d+' => 'Numeric with one or two letter prefix',
3335                      ],
3336   },
3337
3338   {
3339     'key'         => 'card_masking_method',
3340     'section'     => 'UI',
3341     '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.',
3342     'type'        => 'select',
3343     'select_hash' => [
3344                        ''            => '123456xxxxxx1234',
3345                        'first6last2' => '123456xxxxxxxx12',
3346                        'first4last4' => '1234xxxxxxxx1234',
3347                        'first4last2' => '1234xxxxxxxxxx12',
3348                        'first2last4' => '12xxxxxxxxxx1234',
3349                        'first2last2' => '12xxxxxxxxxxxx12',
3350                        'first0last4' => 'xxxxxxxxxxxx1234',
3351                        'first0last2' => 'xxxxxxxxxxxxxx12',
3352                      ],
3353   },
3354
3355   {
3356     'key'         => 'disable_previous_balance',
3357     'section'     => 'invoicing',
3358     'description' => 'Disable inclusion of previous balance, payment, and credit lines on invoices',
3359     'type'        => 'checkbox',
3360   },
3361
3362   {
3363     'key'         => 'previous_balance-exclude_from_total',
3364     'section'     => 'invoicing',
3365     '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',
3366     'type'        => [ qw(checkbox text) ],
3367   },
3368
3369   {
3370     'key'         => 'previous_balance-summary_only',
3371     'section'     => 'invoicing',
3372     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
3373     'type'        => 'checkbox',
3374   },
3375
3376   {
3377     'key'         => 'balance_due_below_line',
3378     'section'     => 'invoicing',
3379     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
3380     'type'        => 'checkbox',
3381   },
3382
3383   {
3384     'key'         => 'usps_webtools-userid',
3385     'section'     => 'UI',
3386     '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.',
3387     'type'        => 'text',
3388   },
3389
3390   {
3391     'key'         => 'usps_webtools-password',
3392     'section'     => 'UI',
3393     '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.',
3394     'type'        => 'text',
3395   },
3396
3397   {
3398     'key'         => 'cust_main-auto_standardize_address',
3399     'section'     => 'UI',
3400     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
3401     'type'        => 'checkbox',
3402   },
3403
3404   {
3405     'key'         => 'cust_main-require_censustract',
3406     'section'     => 'UI',
3407     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
3408     'type'        => 'checkbox',
3409   },
3410
3411   {
3412     'key'         => 'census_year',
3413     'section'     => 'UI',
3414     'description' => 'The year to use in census tract lookups',
3415     'type'        => 'select',
3416     'select_enum' => [ qw( 2010 2009 2008 ) ],
3417   },
3418
3419   {
3420     'key'         => 'company_latitude',
3421     'section'     => 'UI',
3422     'description' => 'Your company latitude (-90 through 90)',
3423     'type'        => 'text',
3424   },
3425
3426   {
3427     'key'         => 'company_longitude',
3428     'section'     => 'UI',
3429     'description' => 'Your company longitude (-180 thru 180)',
3430     'type'        => 'text',
3431   },
3432
3433   {
3434     'key'         => 'disable_acl_changes',
3435     'section'     => '',
3436     'description' => 'Disable all ACL changes, for demos.',
3437     'type'        => 'checkbox',
3438   },
3439
3440   {
3441     'key'         => 'disable_settings_changes',
3442     'section'     => '',
3443     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
3444     'type'        => [qw( checkbox text )],
3445   },
3446
3447   {
3448     'key'         => 'cust_main-edit_agent_custid',
3449     'section'     => 'UI',
3450     'description' => 'Enable editing of the agent_custid field.',
3451     'type'        => 'checkbox',
3452   },
3453
3454   {
3455     'key'         => 'cust_main-default_agent_custid',
3456     'section'     => 'UI',
3457     'description' => 'Display the agent_custid field when available instead of the custnum field.',
3458     'type'        => 'checkbox',
3459   },
3460
3461   {
3462     'key'         => 'cust_main-title-display_custnum',
3463     'section'     => 'UI',
3464     'description' => 'Add the display_custom (agent_custid or custnum) to the title on customer view pages.',
3465     'type'        => 'checkbox',
3466   },
3467
3468   {
3469     'key'         => 'cust_bill-default_agent_invid',
3470     'section'     => 'UI',
3471     'description' => 'Display the agent_invid field when available instead of the invnum field.',
3472     'type'        => 'checkbox',
3473   },
3474
3475   {
3476     'key'         => 'cust_main-auto_agent_custid',
3477     'section'     => 'UI',
3478     'description' => 'Automatically assign an agent_custid - select format',
3479     'type'        => 'select',
3480     'select_hash' => [ '' => 'No',
3481                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
3482                      ],
3483   },
3484
3485   {
3486     'key'         => 'cust_main-default_areacode',
3487     'section'     => 'UI',
3488     'description' => 'Default area code for customers.',
3489     'type'        => 'text',
3490   },
3491
3492   {
3493     'key'         => 'order_pkg-no_start_date',
3494     'section'     => 'UI',
3495     'description' => 'Don\'t set a default start date for new packages.',
3496     'type'        => 'checkbox',
3497   },
3498
3499   {
3500     'key'         => 'mcp_svcpart',
3501     'section'     => '',
3502     'description' => 'Master Control Program svcpart.  Leave this blank.',
3503     'type'        => 'text', #select-part_svc
3504   },
3505
3506   {
3507     'key'         => 'cust_bill-max_same_services',
3508     'section'     => 'invoicing',
3509     '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.',
3510     'type'        => 'text',
3511   },
3512
3513   {
3514     'key'         => 'cust_bill-consolidate_services',
3515     'section'     => 'invoicing',
3516     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
3517     'type'        => 'checkbox',
3518   },
3519
3520   {
3521     'key'         => 'suspend_email_admin',
3522     'section'     => '',
3523     'description' => 'Destination admin email address to enable suspension notices',
3524     'type'        => 'text',
3525   },
3526
3527   {
3528     'key'         => 'email_report-subject',
3529     'section'     => '',
3530     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
3531     'type'        => 'text',
3532   },
3533
3534   {
3535     'key'         => 'selfservice-head',
3536     'section'     => 'self-service',
3537     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
3538     'type'        => 'textarea', #htmlarea?
3539     'per_agent'   => 1,
3540   },
3541
3542
3543   {
3544     'key'         => 'selfservice-body_header',
3545     'section'     => 'self-service',
3546     'description' => 'HTML header for the self-service interface',
3547     'type'        => 'textarea', #htmlarea?
3548     'per_agent'   => 1,
3549   },
3550
3551   {
3552     'key'         => 'selfservice-body_footer',
3553     'section'     => 'self-service',
3554     'description' => 'HTML footer for the self-service interface',
3555     'type'        => 'textarea', #htmlarea?
3556     'per_agent'   => 1,
3557   },
3558
3559
3560   {
3561     'key'         => 'selfservice-body_bgcolor',
3562     'section'     => 'self-service',
3563     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
3564     'type'        => 'text',
3565     'per_agent'   => 1,
3566   },
3567
3568   {
3569     'key'         => 'selfservice-box_bgcolor',
3570     'section'     => 'self-service',
3571     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
3572     'type'        => 'text',
3573     'per_agent'   => 1,
3574   },
3575
3576   {
3577     'key'         => 'selfservice-text_color',
3578     'section'     => 'self-service',
3579     'description' => 'HTML text color for the self-service interface, for example, #000000',
3580     'type'        => 'text',
3581     'per_agent'   => 1,
3582   },
3583
3584   {
3585     'key'         => 'selfservice-link_color',
3586     'section'     => 'self-service',
3587     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
3588     'type'        => 'text',
3589     'per_agent'   => 1,
3590   },
3591
3592   {
3593     'key'         => 'selfservice-vlink_color',
3594     'section'     => 'self-service',
3595     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
3596     'type'        => 'text',
3597     'per_agent'   => 1,
3598   },
3599
3600   {
3601     'key'         => 'selfservice-hlink_color',
3602     'section'     => 'self-service',
3603     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
3604     'type'        => 'text',
3605     'per_agent'   => 1,
3606   },
3607
3608   {
3609     'key'         => 'selfservice-alink_color',
3610     'section'     => 'self-service',
3611     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
3612     'type'        => 'text',
3613     'per_agent'   => 1,
3614   },
3615
3616   {
3617     'key'         => 'selfservice-font',
3618     'section'     => 'self-service',
3619     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
3620     'type'        => 'text',
3621     'per_agent'   => 1,
3622   },
3623
3624   {
3625     'key'         => 'selfservice-title_color',
3626     'section'     => 'self-service',
3627     'description' => 'HTML color for the self-service title, for example, #000000',
3628     'type'        => 'text',
3629     'per_agent'   => 1,
3630   },
3631
3632   {
3633     'key'         => 'selfservice-title_align',
3634     'section'     => 'self-service',
3635     'description' => 'HTML alignment for the self-service title, for example, center',
3636     'type'        => 'text',
3637     'per_agent'   => 1,
3638   },
3639   {
3640     'key'         => 'selfservice-title_size',
3641     'section'     => 'self-service',
3642     'description' => 'HTML font size for the self-service title, for example, 3',
3643     'type'        => 'text',
3644     'per_agent'   => 1,
3645   },
3646
3647   {
3648     'key'         => 'selfservice-title_left_image',
3649     'section'     => 'self-service',
3650     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
3651     'type'        => 'image',
3652     'per_agent'   => 1,
3653   },
3654
3655   {
3656     'key'         => 'selfservice-title_right_image',
3657     'section'     => 'self-service',
3658     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
3659     'type'        => 'image',
3660     'per_agent'   => 1,
3661   },
3662
3663   {
3664     'key'         => 'selfservice-menu_skipblanks',
3665     'section'     => 'self-service',
3666     'description' => 'Skip blank (spacer) entries in the self-service menu',
3667     'type'        => 'checkbox',
3668     'per_agent'   => 1,
3669   },
3670
3671   {
3672     'key'         => 'selfservice-menu_skipheadings',
3673     'section'     => 'self-service',
3674     'description' => 'Skip the unclickable heading entries in the self-service menu',
3675     'type'        => 'checkbox',
3676     'per_agent'   => 1,
3677   },
3678
3679   {
3680     'key'         => 'selfservice-menu_bgcolor',
3681     'section'     => 'self-service',
3682     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
3683     'type'        => 'text',
3684     'per_agent'   => 1,
3685   },
3686
3687   {
3688     'key'         => 'selfservice-menu_fontsize',
3689     'section'     => 'self-service',
3690     'description' => 'HTML font size for the self-service menu, for example, -1',
3691     'type'        => 'text',
3692     'per_agent'   => 1,
3693   },
3694   {
3695     'key'         => 'selfservice-menu_nounderline',
3696     'section'     => 'self-service',
3697     'description' => 'Styles menu links in the self-service without underlining.',
3698     'type'        => 'checkbox',
3699     'per_agent'   => 1,
3700   },
3701
3702
3703   {
3704     'key'         => 'selfservice-menu_top_image',
3705     'section'     => 'self-service',
3706     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
3707     'type'        => 'image',
3708     'per_agent'   => 1,
3709   },
3710
3711   {
3712     'key'         => 'selfservice-menu_body_image',
3713     'section'     => 'self-service',
3714     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
3715     'type'        => 'image',
3716     'per_agent'   => 1,
3717   },
3718
3719   {
3720     'key'         => 'selfservice-menu_bottom_image',
3721     'section'     => 'self-service',
3722     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
3723     'type'        => 'image',
3724     'per_agent'   => 1,
3725   },
3726
3727   {
3728     'key'         => 'selfservice-bulk_format',
3729     'section'     => 'deprecated',
3730     'description' => 'Parameter arrangement for selfservice bulk features',
3731     'type'        => 'select',
3732     'select_enum' => [ '', 'izoom-soap', 'izoom-ftp' ],
3733     'per_agent'   => 1,
3734   },
3735
3736   {
3737     'key'         => 'selfservice-bulk_ftp_dir',
3738     'section'     => 'deprecated',
3739     'description' => 'Enable bulk ftp provisioning in this folder',
3740     'type'        => 'text',
3741     'per_agent'   => 1,
3742   },
3743
3744   {
3745     'key'         => 'signup-no_company',
3746     'section'     => 'self-service',
3747     'description' => "Don't display a field for company name on signup.",
3748     'type'        => 'checkbox',
3749   },
3750
3751   {
3752     'key'         => 'signup-recommend_email',
3753     'section'     => 'self-service',
3754     'description' => 'Encourage the entry of an invoicing email address on signup.',
3755     'type'        => 'checkbox',
3756   },
3757
3758   {
3759     'key'         => 'signup-recommend_daytime',
3760     'section'     => 'self-service',
3761     'description' => 'Encourage the entry of a daytime phone number  invoicing email address on signup.',
3762     'type'        => 'checkbox',
3763   },
3764
3765   {
3766     'key'         => 'svc_phone-radius-default_password',
3767     'section'     => '',
3768     'description' => 'Default password when exporting svc_phone records to RADIUS',
3769     'type'        => 'text',
3770   },
3771
3772   {
3773     'key'         => 'svc_phone-allow_alpha_phonenum',
3774     'section'     => '',
3775     'description' => 'Allow letters in phone numbers.',
3776     'type'        => 'checkbox',
3777   },
3778
3779   {
3780     'key'         => 'svc_phone-domain',
3781     'section'     => '',
3782     'description' => 'Track an optional domain association with each phone service.',
3783     'type'        => 'checkbox',
3784   },
3785
3786   {
3787     'key'         => 'svc_phone-phone_name-max_length',
3788     'section'     => '',
3789     '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.',
3790     'type'        => 'text',
3791   },
3792   
3793   {
3794     'key'         => 'svc_phone-lnp',
3795     'section'     => '',
3796     'description' => 'Enables Number Portability features for svc_phone',
3797     'type'        => 'checkbox',
3798   },
3799
3800   {
3801     'key'         => 'default_phone_countrycode',
3802     'section'     => '',
3803     'description' => 'Default countrcode',
3804     'type'        => 'text',
3805   },
3806
3807   {
3808     'key'         => 'cdr-charged_party-field',
3809     'section'     => '',
3810     'description' => 'Set the charged_party field of CDRs to this field.',
3811     'type'        => 'select-sub',
3812     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
3813                            map { $_ => $fields->{$_}||$_ }
3814                            grep { $_ !~ /^(acctid|charged_party)$/ }
3815                            FS::Schema::dbdef->table('cdr')->columns;
3816                          },
3817     'option_sub'  => sub { my $f = shift;
3818                            FS::cdr->table_info->{'fields'}{$f} || $f;
3819                          },
3820   },
3821
3822   #probably deprecate in favor of cdr-charged_party-field above
3823   {
3824     'key'         => 'cdr-charged_party-accountcode',
3825     'section'     => '',
3826     'description' => 'Set the charged_party field of CDRs to the accountcode.',
3827     'type'        => 'checkbox',
3828   },
3829
3830   {
3831     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
3832     'section'     => '',
3833     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
3834     'type'        => 'checkbox',
3835   },
3836
3837 #  {
3838 #    'key'         => 'cdr-charged_party-truncate_prefix',
3839 #    'section'     => '',
3840 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
3841 #    'type'        => 'text',
3842 #  },
3843 #
3844 #  {
3845 #    'key'         => 'cdr-charged_party-truncate_length',
3846 #    'section'     => '',
3847 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
3848 #    'type'        => 'text',
3849 #  },
3850
3851   {
3852     'key'         => 'cdr-charged_party_rewrite',
3853     'section'     => '',
3854     '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*.',
3855     'type'        => 'checkbox',
3856   },
3857
3858   {
3859     'key'         => 'cdr-taqua-da_rewrite',
3860     'section'     => '',
3861     '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.',
3862     'type'        => 'text',
3863   },
3864
3865   {
3866     'key'         => 'cust_pkg-show_autosuspend',
3867     'section'     => 'UI',
3868     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
3869     'type'        => 'checkbox',
3870   },
3871
3872   {
3873     'key'         => 'cdr-asterisk_forward_rewrite',
3874     'section'     => '',
3875     '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").',
3876     'type'        => 'checkbox',
3877   },
3878
3879   {
3880     'key'         => 'sg-multicustomer_hack',
3881     'section'     => '',
3882     'description' => "Don't use this.",
3883     'type'        => 'checkbox',
3884   },
3885
3886   {
3887     'key'         => 'sg-ping_username',
3888     'section'     => '',
3889     'description' => "Don't use this.",
3890     'type'        => 'text',
3891   },
3892
3893   {
3894     'key'         => 'sg-ping_password',
3895     'section'     => '',
3896     'description' => "Don't use this.",
3897     'type'        => 'text',
3898   },
3899
3900   {
3901     'key'         => 'sg-login_username',
3902     'section'     => '',
3903     'description' => "Don't use this.",
3904     'type'        => 'text',
3905   },
3906
3907   {
3908     'key'         => 'mc-outbound_packages',
3909     'section'     => '',
3910     'description' => "Don't use this.",
3911     'type'        => 'select-part_pkg',
3912     'multiple'    => 1,
3913   },
3914
3915   {
3916     'key'         => 'disable-cust-pkg_class',
3917     'section'     => 'UI',
3918     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
3919     'type'        => 'checkbox',
3920   },
3921
3922   {
3923     'key'         => 'queued-max_kids',
3924     'section'     => '',
3925     'description' => 'Maximum number of queued processes.  Defaults to 10.',
3926     'type'        => 'text',
3927   },
3928
3929   {
3930     'key'         => 'queued-sleep_time',
3931     'section'     => '',
3932     '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.',
3933     'type'        => 'text',
3934   },
3935
3936   {
3937     'key'         => 'cancelled_cust-noevents',
3938     'section'     => 'billing',
3939     'description' => "Don't run events for cancelled customers",
3940     'type'        => 'checkbox',
3941   },
3942
3943   {
3944     'key'         => 'agent-invoice_template',
3945     'section'     => 'invoicing',
3946     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
3947     'type'        => 'checkbox',
3948   },
3949
3950   {
3951     'key'         => 'svc_broadband-manage_link',
3952     'section'     => 'UI',
3953     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr.',
3954     'type'        => 'text',
3955   },
3956
3957   #more fine-grained, service def-level control could be useful eventually?
3958   {
3959     'key'         => 'svc_broadband-allow_null_ip_addr',
3960     'section'     => '',
3961     'description' => '',
3962     'type'        => 'checkbox',
3963   },
3964
3965   {
3966     'key'         => 'tax-report_groups',
3967     'section'     => '',
3968     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
3969     'type'        => 'textarea',
3970   },
3971
3972   {
3973     'key'         => 'tax-cust_exempt-groups',
3974     'section'     => '',
3975     '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).',
3976     'type'        => 'textarea',
3977   },
3978
3979   {
3980     'key'         => 'cust_main-default_view',
3981     'section'     => 'UI',
3982     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
3983     'type'        => 'select',
3984     'select_hash' => [
3985       #false laziness w/view/cust_main.cgi and pref/pref.html
3986       'basics'          => 'Basics',
3987       'notes'           => 'Notes',
3988       'tickets'         => 'Tickets',
3989       'packages'        => 'Packages',
3990       'payment_history' => 'Payment History',
3991       'change_history'  => 'Change History',
3992       'jumbo'           => 'Jumbo',
3993     ],
3994   },
3995
3996   {
3997     'key'         => 'enable_tax_adjustments',
3998     'section'     => 'billing',
3999     'description' => 'Enable the ability to add manual tax adjustments.',
4000     'type'        => 'checkbox',
4001   },
4002
4003   {
4004     'key'         => 'rt-crontool',
4005     'section'     => '',
4006     'description' => 'Enable the RT CronTool extension.',
4007     'type'        => 'checkbox',
4008   },
4009
4010   {
4011     'key'         => 'pkg-balances',
4012     'section'     => 'billing',
4013     'description' => 'Enable experimental package balances.  Not recommended for general use.',
4014     'type'        => 'checkbox',
4015   },
4016
4017   {
4018     'key'         => 'pkg-addon_classnum',
4019     'section'     => 'billing',
4020     'description' => 'Enable the ability to restrict additional package orders based on package class.',
4021     'type'        => 'checkbox',
4022   },
4023
4024   {
4025     'key'         => 'cust_main-edit_signupdate',
4026     'section'     => 'UI',
4027     'descritpion' => 'Enable manual editing of the signup date.',
4028     'type'        => 'checkbox',
4029   },
4030
4031   {
4032     'key'         => 'svc_acct-disable_access_number',
4033     'section'     => 'UI',
4034     'descritpion' => 'Disable access number selection.',
4035     'type'        => 'checkbox',
4036   },
4037
4038   {
4039     'key'         => 'cust_bill_pay_pkg-manual',
4040     'section'     => 'UI',
4041     'description' => 'Allow manual application of payments to line items.',
4042     'type'        => 'checkbox',
4043   },
4044
4045   {
4046     'key'         => 'cust_credit_bill_pkg-manual',
4047     'section'     => 'UI',
4048     'description' => 'Allow manual application of credits to line items.',
4049     'type'        => 'checkbox',
4050   },
4051
4052   {
4053     'key'         => 'breakage-days',
4054     'section'     => 'billing',
4055     '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.',
4056     'type'        => 'text',
4057     'per_agent'   => 1,
4058   },
4059
4060   {
4061     'key'         => 'breakage-pkg_class',
4062     'section'     => 'billing',
4063     'description' => 'Package class to use for breakage reconciliation.',
4064     'type'        => 'select-pkg_class',
4065   },
4066
4067   {
4068     'key'         => 'disable_cron_billing',
4069     'section'     => 'billing',
4070     '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.',
4071     'type'        => 'checkbox',
4072   },
4073
4074   {
4075     'key'         => 'svc_domain-edit_domain',
4076     'section'     => '',
4077     'description' => 'Enable domain renaming',
4078     'type'        => 'checkbox',
4079   },
4080
4081   {
4082     'key'         => 'enable_legacy_prepaid_income',
4083     'section'     => '',
4084     '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.",
4085     'type'        => 'checkbox',
4086   },
4087
4088   {
4089     'key'         => 'cust_main-exports',
4090     'section'     => '',
4091     'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
4092     'type'        => 'select-sub',
4093     'multiple'    => 1,
4094     'options_sub' => sub {
4095       require FS::Record;
4096       require FS::part_export;
4097       my @part_export =
4098         map { qsearch( 'part_export', {exporttype => $_ } ) }
4099           keys %{FS::part_export::export_info('cust_main')};
4100       map { $_->exportnum => $_->exporttype.' to '.$_->machine } @part_export;
4101     },
4102     'option_sub'  => sub {
4103       require FS::Record;
4104       require FS::part_export;
4105       my $part_export = FS::Record::qsearchs(
4106         'part_export', { 'exportnum' => shift }
4107       );
4108       $part_export
4109         ? $part_export->exporttype.' to '.$part_export->machine
4110         : '';
4111     },
4112   },
4113
4114   {
4115     'key'         => 'cust_tag-location',
4116     'section'     => 'UI',
4117     'description' => 'Location where customer tags are displayed.',
4118     'type'        => 'select',
4119     'select_enum' => [ 'misc_info', 'top' ],
4120   },
4121
4122   {
4123     'key'         => 'maestro-status_test',
4124     'section'     => 'UI',
4125     'description' => 'Display a link to the maestro status test page on the customer view page',
4126     'type'        => 'checkbox',
4127   },
4128
4129   {
4130     'key'         => 'cust_main-custom_link',
4131     'section'     => 'UI',
4132     'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The custnum will be appended.',
4133     'type'        => 'text',
4134   },
4135
4136   {
4137     'key'         => 'cust_main-custom_title',
4138     'section'     => 'UI',
4139     'description' => 'Title for the "Custom" tab in the View Customer page.',
4140     'type'        => 'text',
4141   },
4142
4143   {
4144     'key'         => 'part_pkg-default_suspend_bill',
4145     'section'     => 'billing',
4146     'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
4147     'type'        => 'checkbox',
4148   },
4149   
4150   {
4151     'key'         => 'qual-alt-address-format',
4152     'section'     => 'UI',
4153     'description' => 'Enable the alternate address format (location type, number, and kind) on qualifications',
4154     'type'        => 'checkbox',
4155   },
4156   
4157   {
4158     'key'         => 'note-classes',
4159     'section'     => 'UI',
4160     'description' => 'Use customer note classes',
4161     'type'        => 'select',
4162     'select_hash' => [
4163                        0 => 'Disabled',
4164                        1 => 'Enabled',
4165                        2 => 'Enabled, with tabs',
4166                      ],
4167   },
4168
4169   {
4170     'key'         => 'svc_acct-cf_privatekey-message',
4171     'section'     => '',
4172     'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
4173     'type'        => 'textarea',
4174   },
4175
4176   {
4177     'key'         => 'menu-prepend_links',
4178     'section'     => 'UI',
4179     'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
4180     'type'        => 'textarea',
4181   },
4182
4183   {
4184     'key'         => 'cust_main-external_links',
4185     'section'     => 'UI',
4186     'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
4187     'type'        => 'textarea',
4188   },
4189
4190   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4191   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4192   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4193   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4194   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4195   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4196   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4197   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4198   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4199   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4200   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4201   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4202   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4203   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4204   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4205   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4206   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4207   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4208   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4209   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4210   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4211   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4212   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4213   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4214   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4215   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4216   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4217   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4218   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4219   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4220   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4221   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4222   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4223   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4224   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4225   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4226   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4227   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4228   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4229   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4230   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4231
4232 );
4233
4234 1;
4235