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