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