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