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