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