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