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