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