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