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