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