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