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