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