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