self-service small_custview obeys selfservice-box_color and selfservice-text_color...
[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::Locales;
12 use FS::payby;
13 use FS::conf;
14 use FS::Record qw(qsearch qsearchs);
15 use FS::UID qw(dbh datasrc use_confcompat);
16 use FS::Misc::Geo;
17
18 $base_dir = '%%%FREESIDE_CONF%%%';
19
20 $DEBUG = 0;
21
22 =head1 NAME
23
24 FS::Conf - Freeside configuration values
25
26 =head1 SYNOPSIS
27
28   use FS::Conf;
29
30   $conf = new FS::Conf;
31
32   $value = $conf->config('key');
33   @list  = $conf->config('key');
34   $bool  = $conf->exists('key');
35
36   $conf->touch('key');
37   $conf->set('key' => 'value');
38   $conf->delete('key');
39
40   @config_items = $conf->config_items;
41
42 =head1 DESCRIPTION
43
44 Read and write Freeside configuration values.  Keys currently map to filenames,
45 but this may change in the future.
46
47 =head1 METHODS
48
49 =over 4
50
51 =item new [ HASHREF ]
52
53 Create a new configuration object.
54
55 HASHREF may contain options to set the configuration context.  Currently 
56 accepts C<locale>, and C<localeonly> to disable fallback to the null locale.
57
58 =cut
59
60 sub new {
61   my($proto) = shift;
62   my $opts = shift || {};
63   my($class) = ref($proto) || $proto;
64   my $self = {
65     'base_dir'    => $base_dir,
66     'locale'      => $opts->{locale},
67     'localeonly'  => $opts->{localeonly}, # for config-view.cgi ONLY
68   };
69   warn "FS::Conf created with no locale fallback.\n" if $self->{localeonly};
70   bless ($self, $class);
71 }
72
73 =item base_dir
74
75 Returns the base directory.  By default this is /usr/local/etc/freeside.
76
77 =cut
78
79 sub base_dir {
80   my($self) = @_;
81   my $base_dir = $self->{base_dir};
82   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
83   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
84   -r $base_dir or die "FATAL: Can't read $base_dir!";
85   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
86   $base_dir =~ /^(.*)$/;
87   $1;
88 }
89
90 =item conf KEY [ AGENTNUM [ NODEFAULT ] ]
91
92 Returns the L<FS::conf> record for the key and agent.
93
94 =cut
95
96 sub conf {
97   my $self = shift;
98   $self->_config(@_);
99 }
100
101 =item config KEY [ AGENTNUM [ NODEFAULT ] ]
102
103 Returns the configuration value or values (depending on context) for key.
104 The optional agent number selects an agent specific value instead of the
105 global default if one is present.  If NODEFAULT is true only the agent
106 specific value(s) is returned.
107
108 =cut
109
110 sub _usecompat {
111   my ($self, $method) = (shift, shift);
112   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
113     if use_confcompat;
114   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
115   $compat->$method(@_);
116 }
117
118 sub _config {
119   my($self,$name,$agentnum,$agentonly)=@_;
120   my $hashref = { 'name' => $name };
121   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
122   my $cv;
123   my @a = (
124     ($agentnum || ()),
125     ($agentonly && $agentnum ? () : '')
126   );
127   my @l = (
128     ($self->{locale} || ()),
129     ($self->{localeonly} && $self->{locale} ? () : '')
130   );
131   # try with the agentnum first, then fall back to no agentnum if allowed
132   foreach my $a (@a) {
133     $hashref->{agentnum} = $a;
134     foreach my $l (@l) {
135       $hashref->{locale} = $l;
136       $cv = FS::Record::qsearchs('conf', $hashref);
137       return $cv if $cv;
138     }
139   }
140   return undef;
141 }
142
143 sub config {
144   my $self = shift;
145   return $self->_usecompat('config', @_) if use_confcompat;
146
147   carp "FS::Conf->config(". join(', ', @_). ") called"
148     if $DEBUG > 1;
149
150   my $cv = $self->_config(@_) or return;
151
152   if ( wantarray ) {
153     my $v = $cv->value;
154     chomp $v;
155     (split "\n", $v, -1);
156   } else {
157     (split("\n", $cv->value))[0];
158   }
159 }
160
161 =item config_binary KEY [ AGENTNUM [ NODEFAULT ] ]
162
163 Returns the exact scalar value for key.
164
165 =cut
166
167 sub config_binary {
168   my $self = shift;
169   return $self->_usecompat('config_binary', @_) if use_confcompat;
170
171   my $cv = $self->_config(@_) or return;
172   length($cv->value) ? decode_base64($cv->value) : '';
173 }
174
175 =item exists KEY [ AGENTNUM [ NODEFAULT ] ]
176
177 Returns true if the specified key exists, even if the corresponding value
178 is undefined.
179
180 =cut
181
182 sub exists {
183   my $self = shift;
184   return $self->_usecompat('exists', @_) if use_confcompat;
185
186   my($name, $agentnum)=@_;
187
188   carp "FS::Conf->exists(". join(', ', @_). ") called"
189     if $DEBUG > 1;
190
191   defined($self->_config(@_));
192 }
193
194 =item config_orbase KEY SUFFIX
195
196 Returns the configuration value or values (depending on context) for 
197 KEY_SUFFIX, if it exists, otherwise for KEY
198
199 =cut
200
201 # outmoded as soon as we shift to agentnum based config values
202 # well, mostly.  still useful for e.g. late notices, etc. in that we want
203 # these to fall back to standard values
204 sub config_orbase {
205   my $self = shift;
206   return $self->_usecompat('config_orbase', @_) if use_confcompat;
207
208   my( $name, $suffix ) = @_;
209   if ( $self->exists("${name}_$suffix") ) {
210     $self->config("${name}_$suffix");
211   } else {
212     $self->config($name);
213   }
214 }
215
216 =item key_orbase KEY SUFFIX
217
218 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
219 KEY.  Useful for determining which exact configuration option is returned by
220 config_orbase.
221
222 =cut
223
224 sub key_orbase {
225   my $self = shift;
226   #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
227
228   my( $name, $suffix ) = @_;
229   if ( $self->exists("${name}_$suffix") ) {
230     "${name}_$suffix";
231   } else {
232     $name;
233   }
234 }
235
236 =item invoice_templatenames
237
238 Returns all possible invoice template names.
239
240 =cut
241
242 sub invoice_templatenames {
243   my( $self ) = @_;
244
245   my %templatenames = ();
246   foreach my $item ( $self->config_items ) {
247     foreach my $base ( @base_items ) {
248       my( $main, $ext) = split(/\./, $base);
249       $ext = ".$ext" if $ext;
250       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
251       $templatenames{$1}++;
252       }
253     }
254   }
255   
256   map { $_ } #handle scalar context
257   sort keys %templatenames;
258
259 }
260
261 =item touch KEY [ AGENT ];
262
263 Creates the specified configuration key if it does not exist.
264
265 =cut
266
267 sub touch {
268   my $self = shift;
269   return $self->_usecompat('touch', @_) if use_confcompat;
270
271   my($name, $agentnum) = @_;
272   unless ( $self->exists($name, $agentnum) ) {
273     $self->set($name, '', $agentnum);
274   }
275 }
276
277 =item set KEY VALUE [ AGENTNUM ];
278
279 Sets the specified configuration key to the given value.
280
281 =cut
282
283 sub set {
284   my $self = shift;
285   return $self->_usecompat('set', @_) if use_confcompat;
286
287   my($name, $value, $agentnum) = @_;
288   $value =~ /^(.*)$/s;
289   $value = $1;
290
291   warn "[FS::Conf] SET $name\n" if $DEBUG;
292
293   my $hashref = {
294     name => $name,
295     agentnum => $agentnum,
296     locale => $self->{locale}
297   };
298
299   my $old = FS::Record::qsearchs('conf', $hashref);
300   my $new = new FS::conf { $old ? $old->hash : %$hashref };
301   $new->value($value);
302
303   my $error;
304   if ($old) {
305     $error = $new->replace($old);
306   } else {
307     $error = $new->insert;
308   }
309
310   die "error setting configuration value: $error \n"
311     if $error;
312
313 }
314
315 =item set_binary KEY VALUE [ AGENTNUM ]
316
317 Sets the specified configuration key to an exact scalar value which
318 can be retrieved with config_binary.
319
320 =cut
321
322 sub set_binary {
323   my $self  = shift;
324   return if use_confcompat;
325
326   my($name, $value, $agentnum)=@_;
327   $self->set($name, encode_base64($value), $agentnum);
328 }
329
330 =item delete KEY [ AGENTNUM ];
331
332 Deletes the specified configuration key.
333
334 =cut
335
336 sub delete {
337   my $self = shift;
338   return $self->_usecompat('delete', @_) if use_confcompat;
339
340   my($name, $agentnum) = @_;
341   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum, locale => $self->{locale}}) ) {
342     warn "[FS::Conf] DELETE $name\n" if $DEBUG;
343
344     my $oldAutoCommit = $FS::UID::AutoCommit;
345     local $FS::UID::AutoCommit = 0;
346     my $dbh = dbh;
347
348     my $error = $cv->delete;
349
350     if ( $error ) {
351       $dbh->rollback if $oldAutoCommit;
352       die "error setting configuration value: $error \n"
353     }
354
355     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
356
357   }
358 }
359
360 =item import_config_item CONFITEM DIR 
361
362   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
363 the database as a conf record (see L<FS::conf>).  Imports from the file
364 in the directory DIR.
365
366 =cut
367
368 sub import_config_item { 
369   my ($self,$item,$dir) = @_;
370   my $key = $item->key;
371   if ( -e "$dir/$key" && ! use_confcompat ) {
372     warn "Inserting $key\n" if $DEBUG;
373     local $/;
374     my $value = readline(new IO::File "$dir/$key");
375     if ($item->type =~ /^(binary|image)$/ ) {
376       $self->set_binary($key, $value);
377     }else{
378       $self->set($key, $value);
379     }
380   }else {
381     warn "Not inserting $key\n" if $DEBUG;
382   }
383 }
384
385 =item verify_config_item CONFITEM DIR 
386
387   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
388 the database to the legacy file value in DIR.
389
390 =cut
391
392 sub verify_config_item { 
393   return '' if use_confcompat;
394   my ($self,$item,$dir) = @_;
395   my $key = $item->key;
396   my $type = $item->type;
397
398   my $compat = new FS::Conf_compat17 $dir;
399   my $error = '';
400   
401   $error .= "$key fails existential comparison; "
402     if $self->exists($key) xor $compat->exists($key);
403
404   if ( $type !~ /^(binary|image)$/ ) {
405
406     {
407       no warnings;
408       $error .= "$key fails scalar comparison; "
409         unless scalar($self->config($key)) eq scalar($compat->config($key));
410     }
411
412     my (@new) = $self->config($key);
413     my (@old) = $compat->config($key);
414     unless ( scalar(@new) == scalar(@old)) { 
415       $error .= "$key fails list comparison; ";
416     }else{
417       my $r=1;
418       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
419       $error .= "$key fails list comparison; "
420         unless $r;
421     }
422
423   } else {
424
425     no warnings 'uninitialized';
426     $error .= "$key fails binary comparison; "
427       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
428
429   }
430
431 #remove deprecated config on our own terms, not freeside-upgrade's
432 #  if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
433 #    my $proto;
434 #    for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
435 #    unless ($proto->key eq $key) { 
436 #      warn "removed config item $error\n" if $DEBUG;
437 #      $error = '';
438 #    }
439 #  }
440
441   $error;
442 }
443
444 #item _orbase_items OPTIONS
445 #
446 #Returns all of the possible extensible config items as FS::ConfItem objects.
447 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
448 #options include
449 #
450 # dir - the directory to search for configuration option files instead
451 #       of using the conf records in the database
452 #
453 #cut
454
455 #quelle kludge
456 sub _orbase_items {
457   my ($self, %opt) = @_; 
458
459   my $listmaker = sub { my $v = shift;
460                         $v =~ s/_/!_/g;
461                         if ( $v =~ /\.(png|eps)$/ ) {
462                           $v =~ s/\./!_%./;
463                         }else{
464                           $v .= '!_%';
465                         }
466                         map { $_->name }
467                           FS::Record::qsearch( 'conf',
468                                                {},
469                                                '',
470                                                "WHERE name LIKE '$v' ESCAPE '!'"
471                                              );
472                       };
473
474   if (exists($opt{dir}) && $opt{dir}) {
475     $listmaker = sub { my $v = shift;
476                        if ( $v =~ /\.(png|eps)$/ ) {
477                          $v =~ s/\./_*./;
478                        }else{
479                          $v .= '_*';
480                        }
481                        map { basename $_ } glob($opt{dir}. "/$v" );
482                      };
483   }
484
485   ( map { 
486           my $proto;
487           my $base = $_;
488           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
489           die "don't know about $base items" unless $proto->key eq $base;
490
491           map { new FS::ConfItem { 
492                   'key'         => $_,
493                   'base_key'    => $proto->key,
494                   'section'     => $proto->section,
495                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
496                   'type'        => $proto->type,
497                 };
498               } &$listmaker($base);
499         } @base_items,
500   );
501 }
502
503 =item config_items
504
505 Returns all of the possible global/default configuration items as
506 FS::ConfItem objects.  See L<FS::ConfItem>.
507
508 =cut
509
510 sub config_items {
511   my $self = shift; 
512   return $self->_usecompat('config_items', @_) if use_confcompat;
513
514   ( @config_items, $self->_orbase_items(@_) );
515 }
516
517 =back
518
519 =head1 SUBROUTINES
520
521 =over 4
522
523 =item init-config DIR
524
525 Imports the configuration items from DIR (1.7 compatible)
526 to conf records in the database.
527
528 =cut
529
530 sub init_config {
531   my $dir = shift;
532
533   {
534     local $FS::UID::use_confcompat = 0;
535     my $conf = new FS::Conf;
536     foreach my $item ( $conf->config_items(dir => $dir) ) {
537       $conf->import_config_item($item, $dir);
538       my $error = $conf->verify_config_item($item, $dir);
539       return $error if $error;
540     }
541   
542     my $compat = new FS::Conf_compat17 $dir;
543     foreach my $item ( $compat->config_items ) {
544       my $error = $conf->verify_config_item($item, $dir);
545       return $error if $error;
546     }
547   }
548
549   $FS::UID::use_confcompat = 0;
550   '';  #success
551 }
552
553 =back
554
555 =head1 BUGS
556
557 If this was more than just crud that will never be useful outside Freeside I'd
558 worry that config_items is freeside-specific and icky.
559
560 =head1 SEE ALSO
561
562 "Configuration" in the web interface (config/config.cgi).
563
564 =cut
565
566 #Business::CreditCard
567 @card_types = (
568   "VISA card",
569   "MasterCard",
570   "Discover card",
571   "American Express card",
572   "Diner's Club/Carte Blanche",
573   "enRoute",
574   "JCB",
575   "BankCard",
576   "Switch",
577   "Solo",
578 );
579
580 @base_items = qw(
581 invoice_template
582 invoice_latex
583 invoice_latexreturnaddress
584 invoice_latexfooter
585 invoice_latexsmallfooter
586 invoice_latexnotes
587 invoice_latexcoupon
588 invoice_html
589 invoice_htmlreturnaddress
590 invoice_htmlfooter
591 invoice_htmlnotes
592 logo.png
593 logo.eps
594 );
595
596 my %msg_template_options = (
597   'type'        => 'select-sub',
598   'options_sub' => sub { 
599     my @templates = qsearch({
600         'table' => 'msg_template', 
601         'hashref' => { 'disabled' => '' },
602         'extra_sql' => ' AND '. 
603           $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
604         });
605     map { $_->msgnum, $_->msgname } @templates;
606   },
607   'option_sub'  => sub { 
608                          my $msg_template = FS::msg_template->by_key(shift);
609                          $msg_template ? $msg_template->msgname : ''
610                        },
611   'per_agent' => 1,
612 );
613
614 my $_gateway_name = sub {
615   my $g = shift;
616   return '' if !$g;
617   ($g->gateway_username . '@' . $g->gateway_module);
618 };
619
620 my %payment_gateway_options = (
621   'type'        => 'select-sub',
622   'options_sub' => sub {
623     my @gateways = qsearch({
624         'table' => 'payment_gateway',
625         'hashref' => { 'disabled' => '' },
626       });
627     map { $_->gatewaynum, $_gateway_name->($_) } @gateways;
628   },
629   'option_sub'  => sub {
630     my $gateway = FS::payment_gateway->by_key(shift);
631     $_gateway_name->($gateway);
632   },
633 );
634
635 # takes the reason class (C, R, S) as an argument
636 sub reason_type_options {
637   my $reason_class = shift;
638
639   'type'        => 'select-sub',
640   'options_sub' => sub {
641     map { $_->typenum => $_->type } 
642       qsearch('reason_type', { class => $reason_class });
643   },
644   'option_sub'  => sub {
645     my $type = FS::reason_type->by_key(shift);
646     $type ? $type->type : '';
647   }
648 }
649
650 #Billing (81 items)
651 #Invoicing (50 items)
652 #UI (69 items)
653 #Self-service (29 items)
654 #...
655 #Unclassified (77 items)
656
657 @config_items = map { new FS::ConfItem $_ } (
658
659   {
660     'key'         => 'address',
661     'section'     => 'deprecated',
662     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
663     'type'        => 'text',
664   },
665
666   {
667     'key'         => 'log_sent_mail',
668     'section'     => 'notification',
669     'description' => 'Enable logging of template-generated email.',
670     'type'        => 'checkbox',
671   },
672
673   {
674     'key'         => 'alert_expiration',
675     'section'     => 'notification',
676     'description' => 'Enable alerts about billing method expiration (i.e. expiring credit cards).',
677     'type'        => 'checkbox',
678     'per_agent'   => 1,
679   },
680
681   {
682     'key'         => 'alerter_template',
683     'section'     => 'deprecated',
684     'description' => 'Template file for billing method expiration alerts (i.e. expiring credit cards).',
685     'type'        => 'textarea',
686     'per_agent'   => 1,
687   },
688   
689   {
690     'key'         => 'alerter_msgnum',
691     'section'     => 'notification',
692     'description' => 'Template to use for credit card expiration alerts.',
693     %msg_template_options,
694   },
695
696   {
697     'key'         => 'part_pkg-lineage',
698     'section'     => '',
699     'description' => 'When editing a package definition, if setup or recur fees are changed, create a new package rather than changing the existing package.',
700     'type'        => 'checkbox',
701   },
702
703   {
704     'key'         => 'apacheip',
705     #not actually deprecated yet
706     #'section'     => 'deprecated',
707     #'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',
708     'section'     => '',
709     'description' => 'IP address to assign to new virtual hosts',
710     'type'        => 'text',
711   },
712   
713   {
714     'key'         => 'credits-auto-apply-disable',
715     'section'     => 'billing',
716     'description' => 'Disable the "Auto-Apply to invoices" UI option for new credits',
717     'type'        => 'checkbox',
718   },
719   
720   {
721     'key'         => 'credit-card-surcharge-percentage',
722     'section'     => 'billing',
723     'description' => 'Add a credit card surcharge to invoices, as a % of the invoice total. WARNING: this is usually prohibited by merchant account / other agreements and/or law, but is currently lawful in AU and UK.',
724     'type'        => 'text',
725   },
726
727   {
728     'key'         => 'discount-show-always',
729     'section'     => 'billing',
730     'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
731     'type'        => 'checkbox',
732   },
733
734   {
735     'key'         => 'discount-show_available',
736     'section'     => 'billing',
737     'description' => 'Show available prepayment discounts on invoices.',
738     'type'        => 'checkbox',
739   },
740
741   {
742     'key'         => 'invoice-barcode',
743     'section'     => 'billing',
744     'description' => 'Display a barcode on HTML and PDF invoices',
745     'type'        => 'checkbox',
746   },
747   
748   {
749     'key'         => 'cust_main-select-billday',
750     'section'     => 'billing',
751     'description' => 'When used with a specific billing event, allows the selection of the day of month on which to charge credit card / bank account automatically, on a per-customer basis',
752     'type'        => 'checkbox',
753   },
754
755   {
756     'key'         => 'encryption',
757     'section'     => 'billing',
758     'description' => 'Enable encryption of credit cards and echeck numbers',
759     'type'        => 'checkbox',
760   },
761
762   {
763     'key'         => 'encryptionmodule',
764     'section'     => 'billing',
765     'description' => 'Use which module for encryption?',
766     'type'        => 'select',
767     'select_enum' => [ '', 'Crypt::OpenSSL::RSA', ],
768   },
769
770   {
771     'key'         => 'encryptionpublickey',
772     'section'     => 'billing',
773     'description' => 'Encryption public key',
774     'type'        => 'textarea',
775   },
776
777   {
778     'key'         => 'encryptionprivatekey',
779     'section'     => 'billing',
780     'description' => 'Encryption private key',
781     'type'        => 'textarea',
782   },
783
784   {
785     'key'         => 'billco-url',
786     'section'     => 'billing',
787     'description' => 'The url to use for performing uploads to the invoice mailing service.',
788     'type'        => 'text',
789     'per_agent'   => 1,
790   },
791
792   {
793     'key'         => 'billco-username',
794     'section'     => 'billing',
795     'description' => 'The login name to use for uploads to the invoice mailing service.',
796     'type'        => 'text',
797     'per_agent'   => 1,
798     'agentonly'   => 1,
799   },
800
801   {
802     'key'         => 'billco-password',
803     'section'     => 'billing',
804     'description' => 'The password to use for uploads to the invoice mailing service.',
805     'type'        => 'text',
806     'per_agent'   => 1,
807     'agentonly'   => 1,
808   },
809
810   {
811     'key'         => 'billco-clicode',
812     'section'     => 'billing',
813     'description' => 'The clicode to use for uploads to the invoice mailing service.',
814     'type'        => 'text',
815     'per_agent'   => 1,
816   },
817   
818   {
819     'key'         => 'next-bill-ignore-time',
820     'section'     => 'billing',
821     'description' => 'Ignore the time portion of next bill dates when billing, matching anything from 00:00:00 to 23:59:59 on the billing day.',
822     'type'        => 'checkbox',
823   },
824   
825   {
826     'key'         => 'business-onlinepayment',
827     'section'     => 'billing',
828     '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.',
829     'type'        => 'textarea',
830   },
831
832   {
833     'key'         => 'business-onlinepayment-ach',
834     'section'     => 'billing',
835     '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.',
836     'type'        => 'textarea',
837   },
838
839   {
840     'key'         => 'business-onlinepayment-namespace',
841     'section'     => 'billing',
842     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
843     'type'        => 'select',
844     'select_hash' => [
845                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
846                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
847                      ],
848   },
849
850   {
851     'key'         => 'business-onlinepayment-description',
852     'section'     => 'billing',
853     '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)',
854     'type'        => 'text',
855   },
856
857   {
858     'key'         => 'business-onlinepayment-email-override',
859     'section'     => 'billing',
860     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
861     'type'        => 'text',
862   },
863
864   {
865     'key'         => 'business-onlinepayment-email_customer',
866     'section'     => 'billing',
867     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
868     'type'        => 'checkbox',
869   },
870
871   {
872     'key'         => 'business-onlinepayment-test_transaction',
873     'section'     => 'billing',
874     'description' => 'Turns on the Business::OnlinePayment test_transaction flag.  Note that not all gateway modules support this flag; if yours does not, transactions will still be sent live.',
875     'type'        => 'checkbox',
876   },
877
878   {
879     'key'         => 'business-onlinepayment-currency',
880     'section'     => 'billing',
881     'description' => 'Currency parameter for Business::OnlinePayment transactions.',
882     'type'        => 'select',
883     'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD ) ],
884   },
885
886   {
887     'key'         => 'countrydefault',
888     'section'     => 'UI',
889     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
890     'type'        => 'text',
891   },
892
893   {
894     'key'         => 'date_format',
895     'section'     => 'UI',
896     'description' => 'Format for displaying dates',
897     'type'        => 'select',
898     'select_hash' => [
899                        '%m/%d/%Y' => 'MM/DD/YYYY',
900                        '%d/%m/%Y' => 'DD/MM/YYYY',
901                        '%Y/%m/%d' => 'YYYY/MM/DD',
902                      ],
903   },
904
905   {
906     'key'         => 'date_format_long',
907     'section'     => 'UI',
908     'description' => 'Verbose format for displaying dates',
909     'type'        => 'select',
910     'select_hash' => [
911                        '%b %o, %Y' => 'Mon DDth, YYYY',
912                        '%e %b %Y'  => 'DD Mon YYYY',
913                      ],
914   },
915
916   {
917     'key'         => 'deletecustomers',
918     'section'     => 'UI',
919     '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.',
920     'type'        => 'checkbox',
921   },
922
923   {
924     'key'         => 'deleteinvoices',
925     'section'     => 'UI',
926     '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?
927     'type'        => 'checkbox',
928   },
929
930   {
931     'key'         => 'deletepayments',
932     'section'     => 'billing',
933     '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.',
934     'type'        => [qw( checkbox text )],
935   },
936
937   {
938     'key'         => 'deletecredits',
939     #not actually deprecated yet
940     #'section'     => 'deprecated',
941     #'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.',
942     'section'     => '',
943     'description' => 'One or more comma-separated email addresses to be notified when a credit is deleted.',
944     'type'        => [qw( checkbox text )],
945   },
946
947   {
948     'key'         => 'deleterefunds',
949     'section'     => 'billing',
950     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
951     'type'        => 'checkbox',
952   },
953
954   {
955     'key'         => 'unapplypayments',
956     'section'     => 'deprecated',
957     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable "unapplication" of unclosed payments.',
958     'type'        => 'checkbox',
959   },
960
961   {
962     'key'         => 'unapplycredits',
963     'section'     => 'deprecated',
964     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to nable "unapplication" of unclosed credits.',
965     'type'        => 'checkbox',
966   },
967
968   {
969     'key'         => 'dirhash',
970     'section'     => 'shell',
971     '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>',
972     'type'        => 'text',
973   },
974
975   {
976     'key'         => 'disable_cust_attachment',
977     'section'     => '',
978     'description' => 'Disable customer file attachments',
979     'type'        => 'checkbox',
980   },
981
982   {
983     'key'         => 'max_attachment_size',
984     'section'     => '',
985     'description' => 'Maximum size for customer file attachments (leave blank for unlimited)',
986     'type'        => 'text',
987   },
988
989   {
990     'key'         => 'disable_customer_referrals',
991     'section'     => 'UI',
992     'description' => 'Disable new customer-to-customer referrals in the web interface',
993     'type'        => 'checkbox',
994   },
995
996   {
997     'key'         => 'editreferrals',
998     'section'     => 'UI',
999     'description' => 'Enable advertising source modification for existing customers',
1000     'type'        => 'checkbox',
1001   },
1002
1003   {
1004     'key'         => 'emailinvoiceonly',
1005     'section'     => 'invoicing',
1006     'description' => 'Disables postal mail invoices',
1007     'type'        => 'checkbox',
1008   },
1009
1010   {
1011     'key'         => 'disablepostalinvoicedefault',
1012     'section'     => 'invoicing',
1013     '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>.',
1014     'type'        => 'checkbox',
1015   },
1016
1017   {
1018     'key'         => 'emailinvoiceauto',
1019     'section'     => 'invoicing',
1020     'description' => 'Automatically adds new accounts to the email invoice list',
1021     'type'        => 'checkbox',
1022   },
1023
1024   {
1025     'key'         => 'emailinvoiceautoalways',
1026     'section'     => 'invoicing',
1027     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
1028     'type'        => 'checkbox',
1029   },
1030
1031   {
1032     'key'         => 'emailinvoice-apostrophe',
1033     'section'     => 'invoicing',
1034     'description' => 'Allows the apostrophe (single quote) character in the email addresses in the email invoice list.',
1035     'type'        => 'checkbox',
1036   },
1037
1038   {
1039     'key'         => 'exclude_ip_addr',
1040     'section'     => '',
1041     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
1042     'type'        => 'textarea',
1043   },
1044   
1045   {
1046     'key'         => 'auto_router',
1047     'section'     => '',
1048     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
1049     'type'        => 'checkbox',
1050   },
1051   
1052   {
1053     'key'         => 'hidecancelledpackages',
1054     'section'     => 'UI',
1055     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
1056     'type'        => 'checkbox',
1057   },
1058
1059   {
1060     'key'         => 'hidecancelledcustomers',
1061     'section'     => 'UI',
1062     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
1063     'type'        => 'checkbox',
1064   },
1065
1066   {
1067     'key'         => 'home',
1068     'section'     => 'shell',
1069     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
1070     'type'        => 'text',
1071   },
1072
1073   {
1074     'key'         => 'invoice_from',
1075     'section'     => 'required',
1076     'description' => 'Return address on email invoices',
1077     'type'        => 'text',
1078     'per_agent'   => 1,
1079   },
1080
1081   {
1082     'key'         => 'invoice_subject',
1083     'section'     => 'invoicing',
1084     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
1085     'type'        => 'text',
1086     'per_agent'   => 1,
1087     'per_locale'  => 1,
1088   },
1089
1090   {
1091     'key'         => 'invoice_usesummary',
1092     'section'     => 'invoicing',
1093     'description' => 'Indicates that html and latex invoices should be in summary style and make use of invoice_latexsummary.',
1094     'type'        => 'checkbox',
1095   },
1096
1097   {
1098     'key'         => 'invoice_template',
1099     'section'     => 'invoicing',
1100     '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:2.1:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
1101     'type'        => 'textarea',
1102   },
1103
1104   {
1105     'key'         => 'invoice_html',
1106     'section'     => 'invoicing',
1107     'description' => 'Optional HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
1108
1109     'type'        => 'textarea',
1110   },
1111
1112   {
1113     'key'         => 'invoice_htmlnotes',
1114     'section'     => 'invoicing',
1115     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
1116     'type'        => 'textarea',
1117     'per_agent'   => 1,
1118     'per_locale'  => 1,
1119   },
1120
1121   {
1122     'key'         => 'invoice_htmlfooter',
1123     'section'     => 'invoicing',
1124     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
1125     'type'        => 'textarea',
1126     'per_agent'   => 1,
1127     'per_locale'  => 1,
1128   },
1129
1130   {
1131     'key'         => 'invoice_htmlsummary',
1132     'section'     => 'invoicing',
1133     'description' => 'Summary initial page for HTML invoices.',
1134     'type'        => 'textarea',
1135     'per_agent'   => 1,
1136     'per_locale'  => 1,
1137   },
1138
1139   {
1140     'key'         => 'invoice_htmlreturnaddress',
1141     'section'     => 'invoicing',
1142     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
1143     'type'        => 'textarea',
1144     'per_locale'  => 1,
1145   },
1146
1147   {
1148     'key'         => 'invoice_latex',
1149     'section'     => 'invoicing',
1150     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
1151     'type'        => 'textarea',
1152   },
1153
1154   {
1155     'key'         => 'invoice_latextopmargin',
1156     'section'     => 'invoicing',
1157     'description' => 'Optional LaTeX invoice topmargin setting. Include units.',
1158     'type'        => 'text',
1159     'per_agent'   => 1,
1160     'validate'    => sub { shift =~
1161                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1162                              ? '' : 'Invalid LaTex length';
1163                          },
1164   },
1165
1166   {
1167     'key'         => 'invoice_latexheadsep',
1168     'section'     => 'invoicing',
1169     'description' => 'Optional LaTeX invoice headsep setting. Include units.',
1170     'type'        => 'text',
1171     'per_agent'   => 1,
1172     'validate'    => sub { shift =~
1173                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1174                              ? '' : 'Invalid LaTex length';
1175                          },
1176   },
1177
1178   {
1179     'key'         => 'invoice_latexaddresssep',
1180     'section'     => 'invoicing',
1181     'description' => 'Optional LaTeX invoice separation between invoice header
1182 and customer address. Include units.',
1183     'type'        => 'text',
1184     'per_agent'   => 1,
1185     'validate'    => sub { shift =~
1186                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1187                              ? '' : 'Invalid LaTex length';
1188                          },
1189   },
1190
1191   {
1192     'key'         => 'invoice_latextextheight',
1193     'section'     => 'invoicing',
1194     'description' => 'Optional LaTeX invoice textheight setting. Include units.',
1195     'type'        => 'text',
1196     'per_agent'   => 1,
1197     'validate'    => sub { shift =~
1198                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1199                              ? '' : 'Invalid LaTex length';
1200                          },
1201   },
1202
1203   {
1204     'key'         => 'invoice_latexnotes',
1205     'section'     => 'invoicing',
1206     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
1207     'type'        => 'textarea',
1208     'per_agent'   => 1,
1209     'per_locale'  => 1,
1210   },
1211
1212   {
1213     'key'         => 'invoice_latexfooter',
1214     'section'     => 'invoicing',
1215     'description' => 'Footer for LaTeX typeset PostScript invoices.',
1216     'type'        => 'textarea',
1217     'per_agent'   => 1,
1218     'per_locale'  => 1,
1219   },
1220
1221   {
1222     'key'         => 'invoice_latexsummary',
1223     'section'     => 'invoicing',
1224     'description' => 'Summary initial page for LaTeX typeset PostScript invoices.',
1225     'type'        => 'textarea',
1226     'per_agent'   => 1,
1227     'per_locale'  => 1,
1228   },
1229
1230   {
1231     'key'         => 'invoice_latexcoupon',
1232     'section'     => 'invoicing',
1233     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
1234     'type'        => 'textarea',
1235     'per_agent'   => 1,
1236     'per_locale'  => 1,
1237   },
1238
1239   {
1240     'key'         => 'invoice_latexextracouponspace',
1241     'section'     => 'invoicing',
1242     'description' => 'Optional LaTeX invoice textheight space to reserve for a tear off coupon. Include units.',
1243     'type'        => 'text',
1244     'per_agent'   => 1,
1245     'validate'    => sub { shift =~
1246                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1247                              ? '' : 'Invalid LaTex length';
1248                          },
1249   },
1250
1251   {
1252     'key'         => 'invoice_latexcouponfootsep',
1253     'section'     => 'invoicing',
1254     'description' => 'Optional LaTeX invoice separation between tear off coupon and footer. Include units.',
1255     'type'        => 'text',
1256     'per_agent'   => 1,
1257     'validate'    => sub { shift =~
1258                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1259                              ? '' : 'Invalid LaTex length';
1260                          },
1261   },
1262
1263   {
1264     'key'         => 'invoice_latexcouponamountenclosedsep',
1265     'section'     => 'invoicing',
1266     'description' => 'Optional LaTeX invoice separation between total due and amount enclosed line. Include units.',
1267     'type'        => 'text',
1268     'per_agent'   => 1,
1269     'validate'    => sub { shift =~
1270                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1271                              ? '' : 'Invalid LaTex length';
1272                          },
1273   },
1274   {
1275     'key'         => 'invoice_latexcoupontoaddresssep',
1276     'section'     => 'invoicing',
1277     'description' => 'Optional LaTeX invoice separation between invoice data and the to address (usually invoice_latexreturnaddress).  Include units.',
1278     'type'        => 'text',
1279     'per_agent'   => 1,
1280     'validate'    => sub { shift =~
1281                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1282                              ? '' : 'Invalid LaTex length';
1283                          },
1284   },
1285
1286   {
1287     'key'         => 'invoice_latexreturnaddress',
1288     'section'     => 'invoicing',
1289     'description' => 'Return address for LaTeX typeset PostScript invoices.',
1290     'type'        => 'textarea',
1291   },
1292
1293   {
1294     'key'         => 'invoice_latexverticalreturnaddress',
1295     'section'     => 'invoicing',
1296     'description' => 'Place the return address under the company logo rather than beside it.',
1297     'type'        => 'checkbox',
1298     'per_agent'   => 1,
1299   },
1300
1301   {
1302     'key'         => 'invoice_latexcouponaddcompanytoaddress',
1303     'section'     => 'invoicing',
1304     'description' => 'Add the company name to the To address on the remittance coupon because the return address does not contain it.',
1305     'type'        => 'checkbox',
1306     'per_agent'   => 1,
1307   },
1308
1309   {
1310     'key'         => 'invoice_latexsmallfooter',
1311     'section'     => 'invoicing',
1312     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
1313     'type'        => 'textarea',
1314     'per_agent'   => 1,
1315     'per_locale'  => 1,
1316   },
1317
1318   {
1319     'key'         => 'invoice_email_pdf',
1320     'section'     => 'invoicing',
1321     '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.',
1322     'type'        => 'checkbox'
1323   },
1324
1325   {
1326     'key'         => 'invoice_email_pdf_note',
1327     'section'     => 'invoicing',
1328     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
1329     'type'        => 'textarea'
1330   },
1331
1332   {
1333     'key'         => 'invoice_print_pdf',
1334     'section'     => 'invoicing',
1335     'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.',
1336     'type'        => 'checkbox',
1337   },
1338
1339   {
1340     'key'         => 'invoice_print_pdf-spoolagent',
1341     'section'     => 'invoicing',
1342     'description' => 'Store postal invoices PDF downloads in per-agent spools.',
1343     'type'        => 'checkbox',
1344   },
1345
1346   { 
1347     'key'         => 'invoice_default_terms',
1348     'section'     => 'invoicing',
1349     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
1350     'type'        => 'select',
1351     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 3', 'Net 9', 'Net 10', 'Net 15', 'Net 20', 'Net 21', 'Net 30', 'Net 45', 'Net 60', 'Net 90' ],
1352   },
1353
1354   { 
1355     'key'         => 'invoice_show_prior_due_date',
1356     'section'     => 'invoicing',
1357     'description' => 'Show previous invoice due dates when showing prior balances.  Default is to show invoice date.',
1358     'type'        => 'checkbox',
1359   },
1360
1361   { 
1362     'key'         => 'invoice_include_aging',
1363     'section'     => 'invoicing',
1364     'description' => 'Show an aging line after the prior balance section.  Only valud when invoice_sections is enabled.',
1365     'type'        => 'checkbox',
1366   },
1367
1368   { 
1369     'key'         => 'invoice_sections',
1370     'section'     => 'invoicing',
1371     'description' => 'Split invoice into sections and label according to package category when enabled.',
1372     'type'        => 'checkbox',
1373   },
1374
1375   { 
1376     'key'         => 'usage_class_as_a_section',
1377     'section'     => 'invoicing',
1378     'description' => 'Split usage into sections and label according to usage class name when enabled.  Only valid when invoice_sections is enabled.',
1379     'type'        => 'checkbox',
1380   },
1381
1382   { 
1383     'key'         => 'phone_usage_class_summary',
1384     'section'     => 'invoicing',
1385     'description' => 'Summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
1386     'type'        => 'checkbox',
1387   },
1388
1389   { 
1390     'key'         => 'svc_phone_sections',
1391     'section'     => 'invoicing',
1392     'description' => 'Create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
1393     'type'        => 'checkbox',
1394   },
1395
1396   {
1397     'key'         => 'finance_pkgclass',
1398     'section'     => 'billing',
1399     'description' => 'The default package class for late fee charges, used if the fee event does not specify a package class itself.',
1400     'type'        => 'select-pkg_class',
1401   },
1402
1403   { 
1404     'key'         => 'separate_usage',
1405     'section'     => 'invoicing',
1406     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
1407     'type'        => 'checkbox',
1408   },
1409
1410   {
1411     'key'         => 'invoice_send_receipts',
1412     'section'     => 'deprecated',
1413     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
1414     'type'        => 'checkbox',
1415   },
1416
1417   {
1418     'key'         => 'payment_receipt',
1419     'section'     => 'notification',
1420     'description' => 'Send payment receipts.',
1421     'type'        => 'checkbox',
1422     'per_agent'   => 1,
1423   },
1424
1425   {
1426     'key'         => 'payment_receipt_msgnum',
1427     'section'     => 'notification',
1428     'description' => 'Template to use for payment receipts.',
1429     %msg_template_options,
1430   },
1431   
1432   {
1433     'key'         => 'payment_receipt_from',
1434     'section'     => 'notification',
1435     'description' => 'From: address for payment receipts, if not specified in the template.',
1436     'type'        => 'text',
1437     'per_agent'   => 1,
1438   },
1439
1440   {
1441     'key'         => 'payment_receipt_email',
1442     'section'     => 'deprecated',
1443     'description' => 'Template file for payment receipts.  Payment receipts are sent to the customer email invoice destination(s) when a payment is received.',
1444     'type'        => [qw( checkbox textarea )],
1445   },
1446
1447   {
1448     'key'         => 'payment_receipt-trigger',
1449     'section'     => 'notification',
1450     'description' => 'When payment receipts are triggered.  Defaults to when payment is made.',
1451     'type'        => 'select',
1452     'select_hash' => [
1453                        'cust_pay'          => 'When payment is made.',
1454                        'cust_bill_pay_pkg' => 'When payment is applied.',
1455                      ],
1456     'per_agent'   => 1,
1457   },
1458
1459   {
1460     'key'         => 'trigger_export_insert_on_payment',
1461     'section'     => 'billing',
1462     'description' => 'Enable exports on payment application.',
1463     'type'        => 'checkbox',
1464   },
1465
1466   {
1467     'key'         => 'lpr',
1468     'section'     => 'required',
1469     'description' => 'Print command for paper invoices, for example `lpr -h\'',
1470     'type'        => 'text',
1471   },
1472
1473   {
1474     'key'         => 'lpr-postscript_prefix',
1475     'section'     => 'billing',
1476     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1477     'type'        => 'text',
1478   },
1479
1480   {
1481     'key'         => 'lpr-postscript_suffix',
1482     'section'     => 'billing',
1483     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1484     'type'        => 'text',
1485   },
1486
1487   {
1488     'key'         => 'money_char',
1489     'section'     => '',
1490     'description' => 'Currency symbol - defaults to `$\'',
1491     'type'        => 'text',
1492   },
1493
1494   {
1495     'key'         => 'defaultrecords',
1496     'section'     => 'BIND',
1497     'description' => 'DNS entries to add automatically when creating a domain',
1498     'type'        => 'editlist',
1499     'editlist_parts' => [ { type=>'text' },
1500                           { type=>'immutable', value=>'IN' },
1501                           { type=>'select',
1502                             select_enum => {
1503                               map { $_=>$_ }
1504                                   #@{ FS::domain_record->rectypes }
1505                                   qw(A AAAA CNAME MX NS PTR SPF SRV TXT)
1506                             },
1507                           },
1508                           { type=> 'text' }, ],
1509   },
1510
1511   {
1512     'key'         => 'passwordmin',
1513     'section'     => 'password',
1514     'description' => 'Minimum password length (default 6)',
1515     'type'        => 'text',
1516   },
1517
1518   {
1519     'key'         => 'passwordmax',
1520     'section'     => 'password',
1521     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
1522     'type'        => 'text',
1523   },
1524
1525   {
1526     'key'         => 'password-noampersand',
1527     'section'     => 'password',
1528     'description' => 'Disallow ampersands in passwords',
1529     'type'        => 'checkbox',
1530   },
1531
1532   {
1533     'key'         => 'password-noexclamation',
1534     'section'     => 'password',
1535     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1536     'type'        => 'checkbox',
1537   },
1538
1539   {
1540     'key'         => 'default-password-encoding',
1541     'section'     => 'password',
1542     'description' => 'Default storage format for passwords',
1543     'type'        => 'select',
1544     'select_hash' => [
1545       'plain'       => 'Plain text',
1546       'crypt-des'   => 'Unix password (DES encrypted)',
1547       'crypt-md5'   => 'Unix password (MD5 digest)',
1548       'ldap-plain'  => 'LDAP (plain text)',
1549       'ldap-crypt'  => 'LDAP (DES encrypted)',
1550       'ldap-md5'    => 'LDAP (MD5 digest)',
1551       'ldap-sha1'   => 'LDAP (SHA1 digest)',
1552       'legacy'      => 'Legacy mode',
1553     ],
1554   },
1555
1556   {
1557     'key'         => 'referraldefault',
1558     'section'     => 'UI',
1559     'description' => 'Default referral, specified by refnum',
1560     'type'        => 'select-sub',
1561     'options_sub' => sub { require FS::Record;
1562                            require FS::part_referral;
1563                            map { $_->refnum => $_->referral }
1564                                FS::Record::qsearch( 'part_referral', 
1565                                                     { 'disabled' => '' }
1566                                                   );
1567                          },
1568     'option_sub'  => sub { require FS::Record;
1569                            require FS::part_referral;
1570                            my $part_referral = FS::Record::qsearchs(
1571                              'part_referral', { 'refnum'=>shift } );
1572                            $part_referral ? $part_referral->referral : '';
1573                          },
1574   },
1575
1576 #  {
1577 #    'key'         => 'registries',
1578 #    'section'     => 'required',
1579 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1580 #  },
1581
1582   {
1583     'key'         => 'report_template',
1584     'section'     => 'deprecated',
1585     'description' => 'Deprecated template file for reports.',
1586     'type'        => 'textarea',
1587   },
1588
1589   {
1590     'key'         => 'maxsearchrecordsperpage',
1591     'section'     => 'UI',
1592     'description' => 'If set, number of search records to return per page.',
1593     'type'        => 'text',
1594   },
1595
1596   {
1597     'key'         => 'disable_maxselect',
1598     'section'     => 'UI',
1599     'description' => 'Prevent changing the number of records per page.',
1600     'type'        => 'checkbox',
1601   },
1602
1603   {
1604     'key'         => 'session-start',
1605     'section'     => 'session',
1606     '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.',
1607     'type'        => 'text',
1608   },
1609
1610   {
1611     'key'         => 'session-stop',
1612     'section'     => 'session',
1613     '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.',
1614     'type'        => 'text',
1615   },
1616
1617   {
1618     'key'         => 'shells',
1619     'section'     => 'shell',
1620     '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.',
1621     'type'        => 'textarea',
1622   },
1623
1624   {
1625     'key'         => 'showpasswords',
1626     'section'     => 'UI',
1627     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1628     'type'        => 'checkbox',
1629   },
1630
1631   {
1632     'key'         => 'report-showpasswords',
1633     'section'     => 'UI',
1634     'description' => 'This is a terrible idea.  Do not enable it.  STRONGLY NOT RECOMMENDED.  Enables display of passwords on services reports.',
1635     'type'        => 'checkbox',
1636   },
1637
1638   {
1639     'key'         => 'signupurl',
1640     'section'     => 'UI',
1641     '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:2.1: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',
1642     'type'        => 'text',
1643   },
1644
1645   {
1646     'key'         => 'smtpmachine',
1647     'section'     => 'required',
1648     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1649     'type'        => 'text',
1650   },
1651
1652   {
1653     'key'         => 'smtp-username',
1654     'section'     => '',
1655     'description' => 'Optional SMTP username for Freeside\'s outgoing mail',
1656     'type'        => 'text',
1657   },
1658
1659   {
1660     'key'         => 'smtp-password',
1661     'section'     => '',
1662     'description' => 'Optional SMTP password for Freeside\'s outgoing mail',
1663     'type'        => 'text',
1664   },
1665
1666   {
1667     'key'         => 'smtp-encryption',
1668     'section'     => '',
1669     'description' => 'Optional SMTP encryption method.  The STARTTLS methods require smtp-username and smtp-password to be set.',
1670     'type'        => 'select',
1671     'select_hash' => [ '25'           => 'None (port 25)',
1672                        '25-starttls'  => 'STARTTLS (port 25)',
1673                        '587-starttls' => 'STARTTLS / submission (port 587)',
1674                        '465-tls'      => 'SMTPS (SSL) (port 465)',
1675                      ],
1676   },
1677
1678   {
1679     'key'         => 'soadefaultttl',
1680     'section'     => 'BIND',
1681     'description' => 'SOA default TTL for new domains.',
1682     'type'        => 'text',
1683   },
1684
1685   {
1686     'key'         => 'soaemail',
1687     'section'     => 'BIND',
1688     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1689     'type'        => 'text',
1690   },
1691
1692   {
1693     'key'         => 'soaexpire',
1694     'section'     => 'BIND',
1695     'description' => 'SOA expire for new domains',
1696     'type'        => 'text',
1697   },
1698
1699   {
1700     'key'         => 'soamachine',
1701     'section'     => 'BIND',
1702     'description' => 'SOA machine for new domains, with trailing `.\'',
1703     'type'        => 'text',
1704   },
1705
1706   {
1707     'key'         => 'soarefresh',
1708     'section'     => 'BIND',
1709     'description' => 'SOA refresh for new domains',
1710     'type'        => 'text',
1711   },
1712
1713   {
1714     'key'         => 'soaretry',
1715     'section'     => 'BIND',
1716     'description' => 'SOA retry for new domains',
1717     'type'        => 'text',
1718   },
1719
1720   {
1721     'key'         => 'statedefault',
1722     'section'     => 'UI',
1723     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1724     'type'        => 'text',
1725   },
1726
1727   {
1728     'key'         => 'unsuspendauto',
1729     'section'     => 'billing',
1730     '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',
1731     'type'        => 'checkbox',
1732   },
1733
1734   {
1735     'key'         => 'unsuspend-always_adjust_next_bill_date',
1736     'section'     => 'billing',
1737     '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.',
1738     'type'        => 'checkbox',
1739   },
1740
1741   {
1742     'key'         => 'usernamemin',
1743     'section'     => 'username',
1744     'description' => 'Minimum username length (default 2)',
1745     'type'        => 'text',
1746   },
1747
1748   {
1749     'key'         => 'usernamemax',
1750     'section'     => 'username',
1751     'description' => 'Maximum username length',
1752     'type'        => 'text',
1753   },
1754
1755   {
1756     'key'         => 'username-ampersand',
1757     'section'     => 'username',
1758     '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.',
1759     'type'        => 'checkbox',
1760   },
1761
1762   {
1763     'key'         => 'username-letter',
1764     'section'     => 'username',
1765     'description' => 'Usernames must contain at least one letter',
1766     'type'        => 'checkbox',
1767     'per_agent'   => 1,
1768   },
1769
1770   {
1771     'key'         => 'username-letterfirst',
1772     'section'     => 'username',
1773     'description' => 'Usernames must start with a letter',
1774     'type'        => 'checkbox',
1775   },
1776
1777   {
1778     'key'         => 'username-noperiod',
1779     'section'     => 'username',
1780     'description' => 'Disallow periods in usernames',
1781     'type'        => 'checkbox',
1782   },
1783
1784   {
1785     'key'         => 'username-nounderscore',
1786     'section'     => 'username',
1787     'description' => 'Disallow underscores in usernames',
1788     'type'        => 'checkbox',
1789   },
1790
1791   {
1792     'key'         => 'username-nodash',
1793     'section'     => 'username',
1794     'description' => 'Disallow dashes in usernames',
1795     'type'        => 'checkbox',
1796   },
1797
1798   {
1799     'key'         => 'username-uppercase',
1800     'section'     => 'username',
1801     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1802     'type'        => 'checkbox',
1803     'per_agent'   => 1,
1804   },
1805
1806   { 
1807     'key'         => 'username-percent',
1808     'section'     => 'username',
1809     'description' => 'Allow the percent character (%) in usernames.',
1810     'type'        => 'checkbox',
1811   },
1812
1813   { 
1814     'key'         => 'username-colon',
1815     'section'     => 'username',
1816     'description' => 'Allow the colon character (:) in usernames.',
1817     'type'        => 'checkbox',
1818   },
1819
1820   { 
1821     'key'         => 'username-slash',
1822     'section'     => 'username',
1823     'description' => 'Allow the slash character (/) in usernames.  When using, make sure to set "Home directory" to fixed and blank in all svc_acct service definitions.',
1824     'type'        => 'checkbox',
1825   },
1826
1827   { 
1828     'key'         => 'username-equals',
1829     'section'     => 'username',
1830     'description' => 'Allow the equal sign character (=) in usernames.',
1831     'type'        => 'checkbox',
1832   },
1833
1834   {
1835     'key'         => 'safe-part_bill_event',
1836     'section'     => 'UI',
1837     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1838     'type'        => 'checkbox',
1839   },
1840
1841   {
1842     'key'         => 'show_ss',
1843     'section'     => 'UI',
1844     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
1845     'type'        => 'checkbox',
1846   },
1847
1848   {
1849     'key'         => 'show_stateid',
1850     'section'     => 'UI',
1851     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
1852     'type'        => 'checkbox',
1853   },
1854
1855   {
1856     'key'         => 'show_bankstate',
1857     'section'     => 'UI',
1858     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
1859     'type'        => 'checkbox',
1860   },
1861
1862   { 
1863     'key'         => 'agent_defaultpkg',
1864     'section'     => 'UI',
1865     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1866     'type'        => 'checkbox',
1867   },
1868
1869   {
1870     'key'         => 'legacy_link',
1871     'section'     => 'UI',
1872     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1873     'type'        => 'checkbox',
1874   },
1875
1876   {
1877     'key'         => 'legacy_link-steal',
1878     'section'     => 'UI',
1879     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1880     'type'        => 'checkbox',
1881   },
1882
1883   {
1884     'key'         => 'queue_dangerous_controls',
1885     'section'     => 'UI',
1886     '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.',
1887     'type'        => 'checkbox',
1888   },
1889
1890   {
1891     'key'         => 'security_phrase',
1892     'section'     => 'password',
1893     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1894     'type'        => 'checkbox',
1895   },
1896
1897   {
1898     'key'         => 'locale',
1899     'section'     => 'UI',
1900     'description' => 'Default locale',
1901     'type'        => 'select',
1902     'options_sub' => sub {
1903       map { $_ => FS::Locales->description($_) } FS::Locales->locales;
1904     },
1905     'option_sub'  => sub {
1906       FS::Locales->description(shift)
1907     },
1908   },
1909
1910   {
1911     'key'         => 'signup_server-payby',
1912     'section'     => 'self-service',
1913     'description' => 'Acceptable payment types for the signup server',
1914     'type'        => 'selectmultiple',
1915     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1916   },
1917
1918   {
1919     'key'         => 'selfservice-payment_gateway',
1920     'section'     => 'self-service',
1921     'description' => 'Force the use of this payment gateway for self-service.',
1922     %payment_gateway_options,
1923   },
1924
1925   {
1926     'key'         => 'selfservice-save_unchecked',
1927     'section'     => 'self-service',
1928     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
1929     'type'        => 'checkbox',
1930   },
1931
1932   {
1933     'key'         => 'default_agentnum',
1934     'section'     => 'UI',
1935     'description' => 'Default agent for the backoffice',
1936     'type'        => 'select-agent',
1937   },
1938
1939   {
1940     'key'         => 'signup_server-default_agentnum',
1941     'section'     => 'self-service',
1942     'description' => 'Default agent for the signup server',
1943     'type'        => 'select-agent',
1944   },
1945
1946   {
1947     'key'         => 'signup_server-default_refnum',
1948     'section'     => 'self-service',
1949     'description' => 'Default advertising source for the signup server',
1950     'type'        => 'select-sub',
1951     'options_sub' => sub { require FS::Record;
1952                            require FS::part_referral;
1953                            map { $_->refnum => $_->referral }
1954                                FS::Record::qsearch( 'part_referral', 
1955                                                     { 'disabled' => '' }
1956                                                   );
1957                          },
1958     'option_sub'  => sub { require FS::Record;
1959                            require FS::part_referral;
1960                            my $part_referral = FS::Record::qsearchs(
1961                              'part_referral', { 'refnum'=>shift } );
1962                            $part_referral ? $part_referral->referral : '';
1963                          },
1964   },
1965
1966   {
1967     'key'         => 'signup_server-default_pkgpart',
1968     'section'     => 'self-service',
1969     'description' => 'Default package for the signup server',
1970     'type'        => 'select-part_pkg',
1971   },
1972
1973   {
1974     'key'         => 'signup_server-default_svcpart',
1975     'section'     => 'self-service',
1976     'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
1977     'type'        => 'select-part_svc',
1978   },
1979
1980   {
1981     'key'         => 'signup_server-mac_addr_svcparts',
1982     'section'     => 'self-service',
1983     'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
1984     'type'        => 'select-part_svc',
1985     'multiple'    => 1,
1986   },
1987
1988   {
1989     'key'         => 'signup_server-nomadix',
1990     'section'     => 'self-service',
1991     'description' => 'Signup page Nomadix integration',
1992     'type'        => 'checkbox',
1993   },
1994
1995   {
1996     'key'         => 'signup_server-service',
1997     'section'     => 'self-service',
1998     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
1999     'type'        => 'select',
2000     'select_hash' => [
2001                        'svc_acct'  => 'Account (svc_acct)',
2002                        'svc_phone' => 'Phone number (svc_phone)',
2003                        'svc_pbx'   => 'PBX (svc_pbx)',
2004                      ],
2005   },
2006   
2007   {
2008     'key'         => 'signup_server-prepaid-template-custnum',
2009     'section'     => 'self-service',
2010     'description' => 'When the signup server is used with prepaid cards and customer info is not required for signup, the contact/address info will be copied from this customer, if specified',
2011     'type'        => 'text',
2012   },
2013
2014   {
2015     'key'         => 'signup_server-terms_of_service',
2016     'section'     => 'self-service',
2017     'description' => 'Terms of Service for the signup server.  May contain HTML.',
2018     'type'        => 'textarea',
2019     'per_agent'   => 1,
2020   },
2021
2022   {
2023     'key'         => 'selfservice_server-base_url',
2024     'section'     => 'self-service',
2025     '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.',
2026     'type'        => 'text',
2027   },
2028
2029   {
2030     'key'         => 'show-msgcat-codes',
2031     'section'     => 'UI',
2032     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
2033     'type'        => 'checkbox',
2034   },
2035
2036   {
2037     'key'         => 'signup_server-realtime',
2038     'section'     => 'self-service',
2039     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
2040     'type'        => 'checkbox',
2041   },
2042
2043   {
2044     'key'         => 'signup_server-classnum2',
2045     'section'     => 'self-service',
2046     'description' => 'Package Class for first optional purchase',
2047     'type'        => 'select-pkg_class',
2048   },
2049
2050   {
2051     'key'         => 'signup_server-classnum3',
2052     'section'     => 'self-service',
2053     'description' => 'Package Class for second optional purchase',
2054     'type'        => 'select-pkg_class',
2055   },
2056
2057   {
2058     'key'         => 'signup_server-third_party_as_card',
2059     'section'     => 'self-service',
2060     'description' => 'Allow customer payment type to be set to CARD even when using third-party credit card billing.',
2061     'type'        => 'checkbox',
2062   },
2063
2064   {
2065     'key'         => 'selfservice-xmlrpc',
2066     'section'     => 'self-service',
2067     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
2068     'type'        => 'checkbox',
2069   },
2070
2071   {
2072     'key'         => 'backend-realtime',
2073     'section'     => 'billing',
2074     'description' => 'Run billing for backend signups immediately.',
2075     'type'        => 'checkbox',
2076   },
2077
2078   {
2079     'key'         => 'decline_msgnum',
2080     'section'     => 'notification',
2081     'description' => 'Template to use for credit card and electronic check decline messages.',
2082     %msg_template_options,
2083   },
2084
2085   {
2086     'key'         => 'declinetemplate',
2087     'section'     => 'deprecated',
2088     'description' => 'Template file for credit card and electronic check decline emails.',
2089     'type'        => 'textarea',
2090   },
2091
2092   {
2093     'key'         => 'emaildecline',
2094     'section'     => 'notification',
2095     'description' => 'Enable emailing of credit card and electronic check decline notices.',
2096     'type'        => 'checkbox',
2097     'per_agent'   => 1,
2098   },
2099
2100   {
2101     'key'         => 'emaildecline-exclude',
2102     'section'     => 'notification',
2103     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
2104     'type'        => 'textarea',
2105     'per_agent'   => 1,
2106   },
2107
2108   {
2109     'key'         => 'cancel_msgnum',
2110     'section'     => 'notification',
2111     'description' => 'Template to use for cancellation emails.',
2112     %msg_template_options,
2113   },
2114
2115   {
2116     'key'         => 'cancelmessage',
2117     'section'     => 'deprecated',
2118     'description' => 'Template file for cancellation emails.',
2119     'type'        => 'textarea',
2120   },
2121
2122   {
2123     'key'         => 'cancelsubject',
2124     'section'     => 'deprecated',
2125     'description' => 'Subject line for cancellation emails.',
2126     'type'        => 'text',
2127   },
2128
2129   {
2130     'key'         => 'emailcancel',
2131     'section'     => 'notification',
2132     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
2133     'type'        => 'checkbox',
2134     'per_agent'   => 1,
2135   },
2136
2137   {
2138     'key'         => 'bill_usage_on_cancel',
2139     'section'     => 'billing',
2140     '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.',
2141     'type'        => 'checkbox',
2142   },
2143
2144   {
2145     'key'         => 'require_cardname',
2146     'section'     => 'billing',
2147     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
2148     'type'        => 'checkbox',
2149   },
2150
2151   {
2152     'key'         => 'enable_taxclasses',
2153     'section'     => 'billing',
2154     'description' => 'Enable per-package tax classes',
2155     'type'        => 'checkbox',
2156   },
2157
2158   {
2159     'key'         => 'require_taxclasses',
2160     'section'     => 'billing',
2161     'description' => 'Require a taxclass to be entered for every package',
2162     'type'        => 'checkbox',
2163   },
2164
2165   {
2166     'key'         => 'enable_taxproducts',
2167     'section'     => 'billing',
2168     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
2169     'type'        => 'checkbox',
2170   },
2171
2172   {
2173     'key'         => 'taxdatadirectdownload',
2174     'section'     => 'billing',  #well
2175     'description' => 'Enable downloading tax data directly from the vendor site. at least three lines: URL, username, and password.j',
2176     'type'        => 'textarea',
2177   },
2178
2179   {
2180     'key'         => 'ignore_incalculable_taxes',
2181     'section'     => 'billing',
2182     'description' => 'Prefer to invoice without tax over not billing at all',
2183     'type'        => 'checkbox',
2184   },
2185
2186   {
2187     'key'         => 'welcome_msgnum',
2188     'section'     => 'notification',
2189     'description' => 'Template to use for welcome messages when a svc_acct record is created.',
2190     %msg_template_options,
2191   },
2192   
2193   {
2194     'key'         => 'svc_acct_welcome_exclude',
2195     'section'     => 'notification',
2196     'description' => 'A list of svc_acct services for which no welcome email is to be sent.',
2197     'type'        => 'select-part_svc',
2198     'multiple'    => 1,
2199   },
2200
2201   {
2202     'key'         => 'welcome_email',
2203     'section'     => 'deprecated',
2204     '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.',
2205     'type'        => 'textarea',
2206     'per_agent'   => 1,
2207   },
2208
2209   {
2210     'key'         => 'welcome_email-from',
2211     'section'     => 'deprecated',
2212     'description' => 'From: address header for welcome email',
2213     'type'        => 'text',
2214     'per_agent'   => 1,
2215   },
2216
2217   {
2218     'key'         => 'welcome_email-subject',
2219     'section'     => 'deprecated',
2220     'description' => 'Subject: header for welcome email',
2221     'type'        => 'text',
2222     'per_agent'   => 1,
2223   },
2224   
2225   {
2226     'key'         => 'welcome_email-mimetype',
2227     'section'     => 'deprecated',
2228     'description' => 'MIME type for welcome email',
2229     'type'        => 'select',
2230     'select_enum' => [ 'text/plain', 'text/html' ],
2231     'per_agent'   => 1,
2232   },
2233
2234   {
2235     'key'         => 'welcome_letter',
2236     'section'     => '',
2237     '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>',
2238     'type'        => 'textarea',
2239   },
2240
2241 #  {
2242 #    'key'         => 'warning_msgnum',
2243 #    'section'     => 'notification',
2244 #    '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.',
2245 #    %msg_template_options,
2246 #  },
2247
2248   {
2249     'key'         => 'warning_email',
2250     'section'     => 'notification',
2251     '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>',
2252     'type'        => 'textarea',
2253   },
2254
2255   {
2256     'key'         => 'warning_email-from',
2257     'section'     => 'notification',
2258     'description' => 'From: address header for warning email',
2259     'type'        => 'text',
2260   },
2261
2262   {
2263     'key'         => 'warning_email-cc',
2264     'section'     => 'notification',
2265     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
2266     'type'        => 'text',
2267   },
2268
2269   {
2270     'key'         => 'warning_email-subject',
2271     'section'     => 'notification',
2272     'description' => 'Subject: header for warning email',
2273     'type'        => 'text',
2274   },
2275   
2276   {
2277     'key'         => 'warning_email-mimetype',
2278     'section'     => 'notification',
2279     'description' => 'MIME type for warning email',
2280     'type'        => 'select',
2281     'select_enum' => [ 'text/plain', 'text/html' ],
2282   },
2283
2284   {
2285     'key'         => 'payby',
2286     'section'     => 'billing',
2287     'description' => 'Available payment types.',
2288     'type'        => 'selectmultiple',
2289     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
2290   },
2291
2292   {
2293     'key'         => 'payby-default',
2294     'section'     => 'UI',
2295     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
2296     'type'        => 'select',
2297     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
2298   },
2299
2300   {
2301     'key'         => 'require_cash_deposit_info',
2302     'section'     => 'billing',
2303     'description' => 'When recording cash payments, display bank deposit information fields.',
2304     'type'        => 'checkbox',
2305   },
2306
2307   {
2308     'key'         => 'paymentforcedtobatch',
2309     'section'     => 'deprecated',
2310     '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.',
2311     'type'        => 'checkbox',
2312   },
2313
2314   {
2315     'key'         => 'svc_acct-notes',
2316     'section'     => 'deprecated',
2317     'description' => 'Extra HTML to be displayed on the Account View screen.',
2318     'type'        => 'textarea',
2319   },
2320
2321   {
2322     'key'         => 'radius-password',
2323     'section'     => '',
2324     'description' => 'RADIUS attribute for plain-text passwords.',
2325     'type'        => 'select',
2326     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
2327   },
2328
2329   {
2330     'key'         => 'radius-ip',
2331     'section'     => '',
2332     'description' => 'RADIUS attribute for IP addresses.',
2333     'type'        => 'select',
2334     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2335   },
2336
2337   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2338   {
2339     'key'         => 'radius-chillispot-max',
2340     'section'     => '',
2341     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2342     'type'        => 'checkbox',
2343   },
2344
2345   {
2346     'key'         => 'svc_broadband-radius',
2347     'section'     => '',
2348     'description' => 'Enable RADIUS groups for broadband services.',
2349     'type'        => 'checkbox',
2350   },
2351
2352   {
2353     'key'         => 'svc_acct-alldomains',
2354     'section'     => '',
2355     '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.',
2356     'type'        => 'checkbox',
2357   },
2358
2359   {
2360     'key'         => 'dump-localdest',
2361     'section'     => '',
2362     'description' => 'Destination for local database dumps (full path)',
2363     'type'        => 'text',
2364   },
2365
2366   {
2367     'key'         => 'dump-scpdest',
2368     'section'     => '',
2369     'description' => 'Destination for scp database dumps: user@host:/path',
2370     'type'        => 'text',
2371   },
2372
2373   {
2374     'key'         => 'dump-pgpid',
2375     'section'     => '',
2376     '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.",
2377     'type'        => 'text',
2378   },
2379
2380   {
2381     'key'         => 'users-allow_comp',
2382     'section'     => 'deprecated',
2383     '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.',
2384     'type'        => 'textarea',
2385   },
2386
2387   {
2388     'key'         => 'credit_card-recurring_billing_flag',
2389     'section'     => 'billing',
2390     '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. ',
2391     'type'        => 'select',
2392     'select_hash' => [
2393                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2394                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
2395                      ],
2396   },
2397
2398   {
2399     'key'         => 'credit_card-recurring_billing_acct_code',
2400     'section'     => 'billing',
2401     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2402     'type'        => 'checkbox',
2403   },
2404
2405   {
2406     'key'         => 'cvv-save',
2407     'section'     => 'billing',
2408     '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.',
2409     'type'        => 'selectmultiple',
2410     'select_enum' => \@card_types,
2411   },
2412
2413   {
2414     'key'         => 'manual_process-pkgpart',
2415     'section'     => 'billing',
2416     '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.',
2417     'type'        => 'select-part_pkg',
2418   },
2419
2420   {
2421     'key'         => 'manual_process-display',
2422     'section'     => 'billing',
2423     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2424     'type'        => 'select',
2425     'select_hash' => [
2426                        'add'      => 'Add fee to amount entered',
2427                        'subtract' => 'Subtract fee from amount entered',
2428                      ],
2429   },
2430
2431   {
2432     'key'         => 'manual_process-skip_first',
2433     'section'     => 'billing',
2434     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2435     'type'        => 'checkbox',
2436   },
2437
2438   {
2439     'key'         => 'allow_negative_charges',
2440     'section'     => 'billing',
2441     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2442     'type'        => 'checkbox',
2443   },
2444   {
2445       'key'         => 'auto_unset_catchall',
2446       'section'     => '',
2447       '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.',
2448       'type'        => 'checkbox',
2449   },
2450
2451   {
2452     'key'         => 'system_usernames',
2453     'section'     => 'username',
2454     '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.',
2455     'type'        => 'textarea',
2456   },
2457
2458   {
2459     'key'         => 'cust_pkg-change_svcpart',
2460     'section'     => '',
2461     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
2462     'type'        => 'checkbox',
2463   },
2464
2465   {
2466     'key'         => 'cust_pkg-change_pkgpart-bill_now',
2467     'section'     => '',
2468     '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.",
2469     'type'        => 'checkbox',
2470   },
2471
2472   {
2473     'key'         => 'disable_autoreverse',
2474     'section'     => 'BIND',
2475     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
2476     'type'        => 'checkbox',
2477   },
2478
2479   {
2480     'key'         => 'svc_www-enable_subdomains',
2481     'section'     => '',
2482     'description' => 'Enable selection of specific subdomains for virtual host creation.',
2483     'type'        => 'checkbox',
2484   },
2485
2486   {
2487     'key'         => 'svc_www-usersvc_svcpart',
2488     'section'     => '',
2489     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
2490     'type'        => 'select-part_svc',
2491     'multiple'    => 1,
2492   },
2493
2494   {
2495     'key'         => 'selfservice_server-primary_only',
2496     'section'     => 'self-service',
2497     'description' => 'Only allow primary accounts to access self-service functionality.',
2498     'type'        => 'checkbox',
2499   },
2500
2501   {
2502     'key'         => 'selfservice_server-phone_login',
2503     'section'     => 'self-service',
2504     'description' => 'Allow login to self-service with phone number and PIN.',
2505     'type'        => 'checkbox',
2506   },
2507
2508   {
2509     'key'         => 'selfservice_server-single_domain',
2510     'section'     => 'self-service',
2511     'description' => 'If specified, only use this one domain for self-service access.',
2512     'type'        => 'text',
2513   },
2514
2515   {
2516     'key'         => 'selfservice_server-login_svcpart',
2517     'section'     => 'self-service',
2518     'description' => 'If specified, only allow the specified svcparts to login to self-service.',
2519     'type'        => 'select-part_svc',
2520     'multiple'    => 1,
2521   },
2522
2523   {
2524     'key'         => 'selfservice-svc_forward_svcpart',
2525     'section'     => 'self-service',
2526     'description' => 'Service for self-service forward editing.',
2527     'type'        => 'select-part_svc',
2528   },
2529
2530   {
2531     'key'         => 'selfservice-password_reset_verification',
2532     'section'     => 'self-service',
2533     'description' => 'If enabled, specifies the type of verification required for self-service password resets.',
2534     'type'        => 'select',
2535     'select_hash' => [ '' => 'Password reset disabled',
2536                        'paymask,amount,zip' => 'Verify with credit card (or bank account) last 4 digits, payment amount and zip code',
2537                      ],
2538   },
2539
2540   {
2541     'key'         => 'selfservice-password_reset_msgnum',
2542     'section'     => 'self-service',
2543     'description' => 'Template to use for password reset emails.',
2544     %msg_template_options,
2545   },
2546
2547   {
2548     'key'         => 'selfservice-hide_invoices-taxclass',
2549     'section'     => 'self-service',
2550     'description' => 'Hide invoices with only this package tax class from self-service and supress sending (emailing, printing, faxing) them.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',
2551     'type'        => 'text',
2552   },
2553
2554   {
2555     'key'         => 'selfservice-recent-did-age',
2556     'section'     => 'self-service',
2557     'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
2558     'type'        => 'text',
2559   },
2560
2561   {
2562     'key'         => 'selfservice_server-view-wholesale',
2563     'section'     => 'self-service',
2564     'description' => 'If enabled, use a wholesale package view in the self-service.',
2565     'type'        => 'checkbox',
2566   },
2567   
2568   {
2569     'key'         => 'selfservice-agent_signup',
2570     'section'     => 'self-service',
2571     'description' => 'Allow agent signup via self-service.',
2572     'type'        => 'checkbox',
2573   },
2574
2575   {
2576     'key'         => 'selfservice-agent_signup-agent_type',
2577     'section'     => 'self-service',
2578     'description' => 'Agent type when allowing agent signup via self-service.',
2579     'type'        => 'select-sub',
2580     'options_sub' => sub { require FS::Record;
2581                            require FS::agent_type;
2582                            map { $_->typenum => $_->atype }
2583                                FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
2584                          },
2585     'option_sub'  => sub { require FS::Record;
2586                            require FS::agent_type;
2587                            my $agent = FS::Record::qsearchs(
2588                              'agent_type', { 'typenum'=>shift }
2589                            );
2590                            $agent_type ? $agent_type->atype : '';
2591                          },
2592   },
2593
2594   {
2595     'key'         => 'selfservice-agent_login',
2596     'section'     => 'self-service',
2597     'description' => 'Allow agent login via self-service.',
2598     'type'        => 'checkbox',
2599   },
2600
2601   {
2602     'key'         => 'selfservice-self_suspend_reason',
2603     'section'     => 'self-service',
2604     'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
2605     'type'        => 'select-sub',
2606     'options_sub' => sub { require FS::Record;
2607                            require FS::reason;
2608                            my $type = qsearchs('reason_type', 
2609                              { class => 'S' }) 
2610                               or return ();
2611                            map { $_->reasonnum => $_->reason }
2612                                FS::Record::qsearch('reason', 
2613                                  { reason_type => $type->typenum } 
2614                                );
2615                          },
2616     'option_sub'  => sub { require FS::Record;
2617                            require FS::reason;
2618                            my $reason = FS::Record::qsearchs(
2619                              'reason', { 'reasonnum' => shift }
2620                            );
2621                            $reason ? $reason->reason : '';
2622                          },
2623
2624     'per_agent'   => 1,
2625   },
2626
2627   {
2628     'key'         => 'card_refund-days',
2629     'section'     => 'billing',
2630     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
2631     'type'        => 'text',
2632   },
2633
2634   {
2635     'key'         => 'agent-showpasswords',
2636     'section'     => '',
2637     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
2638     'type'        => 'checkbox',
2639   },
2640
2641   {
2642     'key'         => 'global_unique-username',
2643     'section'     => 'username',
2644     '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.',
2645     'type'        => 'select',
2646     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
2647   },
2648
2649   {
2650     'key'         => 'global_unique-phonenum',
2651     'section'     => '',
2652     '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.',
2653     'type'        => 'select',
2654     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
2655   },
2656
2657   {
2658     'key'         => 'global_unique-pbx_title',
2659     'section'     => '',
2660     'description' => 'Global phone number uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2661     'type'        => 'select',
2662     'select_enum' => [ 'enabled', 'disabled' ],
2663   },
2664
2665   {
2666     'key'         => 'global_unique-pbx_id',
2667     'section'     => '',
2668     'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
2669     'type'        => 'select',
2670     'select_enum' => [ 'enabled', 'disabled' ],
2671   },
2672
2673   {
2674     'key'         => 'svc_external-skip_manual',
2675     'section'     => 'UI',
2676     '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).',
2677     'type'        => 'checkbox',
2678   },
2679
2680   {
2681     'key'         => 'svc_external-display_type',
2682     'section'     => 'UI',
2683     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
2684     'type'        => 'select',
2685     'select_enum' => [ 'generic', 'artera_turbo', ],
2686   },
2687
2688   {
2689     'key'         => 'ticket_system',
2690     'section'     => 'ticketing',
2691     '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:2.1:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
2692     'type'        => 'select',
2693     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
2694     'select_enum' => [ '', qw(RT_Internal RT_External) ],
2695   },
2696
2697   {
2698     'key'         => 'network_monitoring_system',
2699     'section'     => 'network_monitoring',
2700     'description' => 'Networking monitoring system (NMS) integration.  <b>Torrus_Internal</b> uses the built-in Torrus ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Torrus_Installation">integrated networking monitoring system installation instructions</a>).',
2701     'type'        => 'select',
2702     'select_enum' => [ '', qw(Torrus_Internal) ],
2703   },
2704
2705   {
2706     'key'         => 'nms-auto_add-svc_ips',
2707     'section'     => 'network_monitoring',
2708     'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
2709     'type'        => 'selectmultiple',
2710     'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
2711   },
2712
2713   {
2714     'key'         => 'nms-auto_add-community',
2715     'section'     => 'network_monitoring',
2716     'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
2717     'type'        => 'text',
2718   },
2719
2720   {
2721     'key'         => 'ticket_system-default_queueid',
2722     'section'     => 'ticketing',
2723     'description' => 'Default queue used when creating new customer tickets.',
2724     'type'        => 'select-sub',
2725     'options_sub' => sub {
2726                            my $conf = new FS::Conf;
2727                            if ( $conf->config('ticket_system') ) {
2728                              eval "use FS::TicketSystem;";
2729                              die $@ if $@;
2730                              FS::TicketSystem->queues();
2731                            } else {
2732                              ();
2733                            }
2734                          },
2735     'option_sub'  => sub { 
2736                            my $conf = new FS::Conf;
2737                            if ( $conf->config('ticket_system') ) {
2738                              eval "use FS::TicketSystem;";
2739                              die $@ if $@;
2740                              FS::TicketSystem->queue(shift);
2741                            } else {
2742                              '';
2743                            }
2744                          },
2745   },
2746   {
2747     'key'         => 'ticket_system-force_default_queueid',
2748     'section'     => 'ticketing',
2749     'description' => 'Disallow queue selection when creating new tickets from customer view.',
2750     'type'        => 'checkbox',
2751   },
2752   {
2753     'key'         => 'ticket_system-selfservice_queueid',
2754     'section'     => 'ticketing',
2755     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
2756     #false laziness w/above
2757     'type'        => 'select-sub',
2758     'options_sub' => sub {
2759                            my $conf = new FS::Conf;
2760                            if ( $conf->config('ticket_system') ) {
2761                              eval "use FS::TicketSystem;";
2762                              die $@ if $@;
2763                              FS::TicketSystem->queues();
2764                            } else {
2765                              ();
2766                            }
2767                          },
2768     'option_sub'  => sub { 
2769                            my $conf = new FS::Conf;
2770                            if ( $conf->config('ticket_system') ) {
2771                              eval "use FS::TicketSystem;";
2772                              die $@ if $@;
2773                              FS::TicketSystem->queue(shift);
2774                            } else {
2775                              '';
2776                            }
2777                          },
2778   },
2779
2780   {
2781     'key'         => 'ticket_system-requestor',
2782     'section'     => 'ticketing',
2783     'description' => 'Email address to use as the requestor for new tickets.  If blank, the customer\'s invoicing address(es) will be used.',
2784     'type'        => 'text',
2785   },
2786
2787   {
2788     'key'         => 'ticket_system-priority_reverse',
2789     'section'     => 'ticketing',
2790     '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.',
2791     'type'        => 'checkbox',
2792   },
2793
2794   {
2795     'key'         => 'ticket_system-custom_priority_field',
2796     'section'     => 'ticketing',
2797     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
2798     'type'        => 'text',
2799   },
2800
2801   {
2802     'key'         => 'ticket_system-custom_priority_field-values',
2803     'section'     => 'ticketing',
2804     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
2805     'type'        => 'textarea',
2806   },
2807
2808   {
2809     'key'         => 'ticket_system-custom_priority_field_queue',
2810     'section'     => 'ticketing',
2811     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
2812     'type'        => 'text',
2813   },
2814
2815   {
2816     'key'         => 'ticket_system-selfservice_priority_field',
2817     'section'     => 'ticketing',
2818     'description' => 'Custom field from the ticket system to use as a customer-managed priority field.',
2819     'type'        => 'text',
2820   },
2821
2822   {
2823     'key'         => 'ticket_system-selfservice_edit_subject',
2824     'section'     => 'ticketing',
2825     'description' => 'Allow customers to edit ticket subjects through selfservice.',
2826     'type'        => 'checkbox',
2827   },
2828
2829   {
2830     'key'         => 'ticket_system-escalation',
2831     'section'     => 'ticketing',
2832     'description' => 'Enable priority escalation of tickets as part of daily batch processing.',
2833     'type'        => 'checkbox',
2834   },
2835
2836   {
2837     'key'         => 'ticket_system-rt_external_datasrc',
2838     'section'     => 'ticketing',
2839     '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>',
2840     'type'        => 'text',
2841
2842   },
2843
2844   {
2845     'key'         => 'ticket_system-rt_external_url',
2846     'section'     => 'ticketing',
2847     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
2848     'type'        => 'text',
2849   },
2850
2851   {
2852     'key'         => 'company_name',
2853     'section'     => 'required',
2854     'description' => 'Your company name',
2855     'type'        => 'text',
2856     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
2857   },
2858
2859   {
2860     'key'         => 'company_url',
2861     'section'     => 'UI',
2862     'description' => 'Your company URL',
2863     'type'        => 'text',
2864     'per_agent'   => 1,
2865   },
2866
2867   {
2868     'key'         => 'company_address',
2869     'section'     => 'required',
2870     'description' => 'Your company address',
2871     'type'        => 'textarea',
2872     'per_agent'   => 1,
2873   },
2874
2875   {
2876     'key'         => 'company_phonenum',
2877     'section'     => 'notification',
2878     'description' => 'Your company phone number',
2879     'type'        => 'text',
2880     'per_agent'   => 1,
2881   },
2882
2883   {
2884     'key'         => 'echeck-void',
2885     'section'     => 'deprecated',
2886     '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',
2887     'type'        => 'checkbox',
2888   },
2889
2890   {
2891     'key'         => 'cc-void',
2892     'section'     => 'deprecated',
2893     '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',
2894     'type'        => 'checkbox',
2895   },
2896
2897   {
2898     'key'         => 'unvoid',
2899     'section'     => 'deprecated',
2900     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
2901     'type'        => 'checkbox',
2902   },
2903
2904   {
2905     'key'         => 'address1-search',
2906     'section'     => 'UI',
2907     'description' => 'Enable the ability to search the address1 field from the quick customer search.  Not recommended in most cases as it tends to bring up too many search results - use explicit address searching from the advanced customer search instead.',
2908     'type'        => 'checkbox',
2909   },
2910
2911   {
2912     'key'         => 'address2-search',
2913     'section'     => 'UI',
2914     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
2915     'type'        => 'checkbox',
2916   },
2917
2918   {
2919     'key'         => 'cust_main-require_address2',
2920     'section'     => 'UI',
2921     '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',
2922     'type'        => 'checkbox',
2923   },
2924
2925   {
2926     'key'         => 'agent-ship_address',
2927     'section'     => '',
2928     '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.",
2929     'type'        => 'checkbox',
2930     'per_agent'   => 1,
2931   },
2932
2933   { 'key'         => 'referral_credit',
2934     'section'     => 'deprecated',
2935     '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.",
2936     'type'        => 'checkbox',
2937   },
2938
2939   { 'key'         => 'selfservice_server-cache_module',
2940     'section'     => 'self-service',
2941     '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.',
2942     'type'        => 'select',
2943     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
2944   },
2945
2946   {
2947     'key'         => 'hylafax',
2948     'section'     => 'billing',
2949     '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).',
2950     'type'        => [qw( checkbox textarea )],
2951   },
2952
2953   {
2954     'key'         => 'cust_bill-ftpformat',
2955     'section'     => 'invoicing',
2956     'description' => 'Enable FTP of raw invoice data - format.',
2957     'type'        => 'select',
2958     'select_enum' => [ '', 'default', 'oneline', 'billco', ],
2959   },
2960
2961   {
2962     'key'         => 'cust_bill-ftpserver',
2963     'section'     => 'invoicing',
2964     'description' => 'Enable FTP of raw invoice data - server.',
2965     'type'        => 'text',
2966   },
2967
2968   {
2969     'key'         => 'cust_bill-ftpusername',
2970     'section'     => 'invoicing',
2971     'description' => 'Enable FTP of raw invoice data - server.',
2972     'type'        => 'text',
2973   },
2974
2975   {
2976     'key'         => 'cust_bill-ftppassword',
2977     'section'     => 'invoicing',
2978     'description' => 'Enable FTP of raw invoice data - server.',
2979     'type'        => 'text',
2980   },
2981
2982   {
2983     'key'         => 'cust_bill-ftpdir',
2984     'section'     => 'invoicing',
2985     'description' => 'Enable FTP of raw invoice data - server.',
2986     'type'        => 'text',
2987   },
2988
2989   {
2990     'key'         => 'cust_bill-spoolformat',
2991     'section'     => 'invoicing',
2992     'description' => 'Enable spooling of raw invoice data - format.',
2993     'type'        => 'select',
2994     'select_enum' => [ '', 'default', 'oneline', 'billco', ],
2995   },
2996
2997   {
2998     'key'         => 'cust_bill-spoolagent',
2999     'section'     => 'invoicing',
3000     'description' => 'Enable per-agent spooling of raw invoice data.',
3001     'type'        => 'checkbox',
3002   },
3003
3004   {
3005     'key'         => 'svc_acct-usage_suspend',
3006     'section'     => 'billing',
3007     '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.',
3008     'type'        => 'checkbox',
3009   },
3010
3011   {
3012     'key'         => 'svc_acct-usage_unsuspend',
3013     'section'     => 'billing',
3014     '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.',
3015     'type'        => 'checkbox',
3016   },
3017
3018   {
3019     'key'         => 'svc_acct-usage_threshold',
3020     'section'     => 'billing',
3021     '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.',
3022     'type'        => 'text',
3023   },
3024
3025   {
3026     'key'         => 'overlimit_groups',
3027     'section'     => '',
3028     'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.',
3029     'type'        => 'select-sub',
3030     'per_agent'   => 1,
3031     'multiple'    => 1,
3032     'options_sub' => sub { require FS::Record;
3033                            require FS::radius_group;
3034                            map { $_->groupnum => $_->long_description }
3035                                FS::Record::qsearch('radius_group', {} );
3036                          },
3037     'option_sub'  => sub { require FS::Record;
3038                            require FS::radius_group;
3039                            my $radius_group = FS::Record::qsearchs(
3040                              'radius_group', { 'groupnum' => shift }
3041                            );
3042                $radius_group ? $radius_group->long_description : '';
3043                          },
3044   },
3045
3046   {
3047     'key'         => 'cust-fields',
3048     'section'     => 'UI',
3049     'description' => 'Which customer fields to display on reports by default',
3050     'type'        => 'select',
3051     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
3052   },
3053
3054   {
3055     'key'         => 'cust_location-label_prefix',
3056     'section'     => 'UI',
3057     'description' => 'Optional "site ID" to show in the location label',
3058     'type'        => 'select',
3059     'select_hash' => [ '' => '',
3060                        'CoStAg' => 'CoStAgXXXXX (country, state, agent name, locationnum)',
3061                       ],
3062   },
3063
3064   {
3065     'key'         => 'cust_location-agent_code',
3066     'section'     => 'UI',
3067     'description' => 'Optional agent string for cust_location-label_prefix',
3068     'type'        => 'text',
3069     'per_agent'   => 1,
3070   },
3071
3072   {
3073     'key'         => 'cust_pkg-display_times',
3074     'section'     => 'UI',
3075     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
3076     'type'        => 'checkbox',
3077   },
3078
3079   {
3080     'key'         => 'cust_pkg-always_show_location',
3081     'section'     => 'UI',
3082     'description' => "Always display package locations, even when they're all the default service address.",
3083     'type'        => 'checkbox',
3084   },
3085
3086   {
3087     'key'         => 'cust_pkg-group_by_location',
3088     'section'     => 'UI',
3089     'description' => "Group packages by location.",
3090     'type'        => 'checkbox',
3091   },
3092
3093   {
3094     'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
3095     'section'     => 'UI',
3096     'description' => "Show a field on package definitions for assigning a DS0 equivalency number suitable for use on FCC form 477.",
3097     'type'        => 'checkbox',
3098   },
3099
3100   {
3101     'key'         => 'cust_pkg-large_pkg_size',
3102     'section'     => 'UI',
3103     'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
3104     'type'        => 'text',
3105   },
3106
3107   {
3108     'key'         => 'svc_acct-edit_uid',
3109     'section'     => 'shell',
3110     'description' => 'Allow UID editing.',
3111     'type'        => 'checkbox',
3112   },
3113
3114   {
3115     'key'         => 'svc_acct-edit_gid',
3116     'section'     => 'shell',
3117     'description' => 'Allow GID editing.',
3118     'type'        => 'checkbox',
3119   },
3120
3121   {
3122     'key'         => 'svc_acct-no_edit_username',
3123     'section'     => 'shell',
3124     'description' => 'Disallow username editing.',
3125     'type'        => 'checkbox',
3126   },
3127
3128   {
3129     'key'         => 'zone-underscore',
3130     'section'     => 'BIND',
3131     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
3132     'type'        => 'checkbox',
3133   },
3134
3135   {
3136     'key'         => 'echeck-nonus',
3137     'section'     => 'billing',
3138     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
3139     'type'        => 'checkbox',
3140   },
3141
3142   {
3143     'key'         => 'echeck-country',
3144     'section'     => 'billing',
3145     'description' => 'Format electronic check information for the specified country.',
3146     'type'        => 'select',
3147     'select_hash' => [ 'US' => 'United States',
3148                        'CA' => 'Canada (enables branch)',
3149                        'XX' => 'Other',
3150                      ],
3151   },
3152
3153   {
3154     'key'         => 'voip-cust_accountcode_cdr',
3155     'section'     => 'telephony',
3156     'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
3157     'type'        => 'checkbox',
3158   },
3159
3160   {
3161     'key'         => 'voip-cust_cdr_spools',
3162     'section'     => 'telephony',
3163     'description' => 'Enable the per-customer option for individual CDR spools.',
3164     'type'        => 'checkbox',
3165   },
3166
3167   {
3168     'key'         => 'voip-cust_cdr_squelch',
3169     'section'     => 'telephony',
3170     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
3171     'type'        => 'checkbox',
3172   },
3173
3174   {
3175     'key'         => 'voip-cdr_email',
3176     'section'     => 'telephony',
3177     'description' => 'Include the call details on emailed invoices (and HTML invoices viewed in the backend), even if the customer is configured for not printing them on the invoices.',
3178     'type'        => 'checkbox',
3179   },
3180
3181   {
3182     'key'         => 'voip-cust_email_csv_cdr',
3183     'section'     => 'telephony',
3184     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
3185     'type'        => 'checkbox',
3186   },
3187
3188   {
3189     'key'         => 'cgp_rule-domain_templates',
3190     'section'     => '',
3191     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
3192     'type'        => 'textarea',
3193   },
3194
3195   {
3196     'key'         => 'svc_forward-no_srcsvc',
3197     'section'     => '',
3198     '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.",
3199     'type'        => 'checkbox',
3200   },
3201
3202   {
3203     'key'         => 'svc_forward-arbitrary_dst',
3204     'section'     => '',
3205     '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.",
3206     'type'        => 'checkbox',
3207   },
3208
3209   {
3210     'key'         => 'tax-ship_address',
3211     'section'     => 'billing',
3212     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
3213     'type'        => 'checkbox',
3214   }
3215 ,
3216   {
3217     'key'         => 'tax-pkg_address',
3218     'section'     => 'billing',
3219     '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).',
3220     'type'        => 'checkbox',
3221   },
3222
3223   {
3224     'key'         => 'invoice-ship_address',
3225     'section'     => 'invoicing',
3226     'description' => 'Include the shipping address on invoices.',
3227     'type'        => 'checkbox',
3228   },
3229
3230   {
3231     'key'         => 'invoice-unitprice',
3232     'section'     => 'invoicing',
3233     'description' => 'Enable unit pricing on invoices.',
3234     'type'        => 'checkbox',
3235   },
3236
3237   {
3238     'key'         => 'invoice-smallernotes',
3239     'section'     => 'invoicing',
3240     'description' => 'Display the notes section in a smaller font on invoices.',
3241     'type'        => 'checkbox',
3242   },
3243
3244   {
3245     'key'         => 'invoice-smallerfooter',
3246     'section'     => 'invoicing',
3247     'description' => 'Display footers in a smaller font on invoices.',
3248     'type'        => 'checkbox',
3249   },
3250
3251   {
3252     'key'         => 'postal_invoice-fee_pkgpart',
3253     'section'     => 'billing',
3254     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
3255     'type'        => 'select-part_pkg',
3256     'per_agent'   => 1,
3257   },
3258
3259   {
3260     'key'         => 'postal_invoice-recurring_only',
3261     'section'     => 'billing',
3262     'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
3263     'type'        => 'checkbox',
3264   },
3265
3266   {
3267     'key'         => 'batch-enable',
3268     'section'     => 'deprecated', #make sure batch-enable_payby is set for
3269                                    #everyone before removing
3270     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
3271     'type'        => 'checkbox',
3272   },
3273
3274   {
3275     'key'         => 'batch-enable_payby',
3276     'section'     => 'billing',
3277     'description' => 'Enable batch processing for the specified payment types.',
3278     'type'        => 'selectmultiple',
3279     'select_enum' => [qw( CARD CHEK )],
3280   },
3281
3282   {
3283     'key'         => 'realtime-disable_payby',
3284     'section'     => 'billing',
3285     'description' => 'Disable realtime processing for the specified payment types.',
3286     'type'        => 'selectmultiple',
3287     'select_enum' => [qw( CARD CHEK )],
3288   },
3289
3290   {
3291     'key'         => 'batch-default_format',
3292     'section'     => 'billing',
3293     'description' => 'Default format for batches.',
3294     'type'        => 'select',
3295     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
3296                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
3297                        'paymentech', 'ach-spiritone', 'RBC'
3298                     ]
3299   },
3300
3301   #lists could be auto-generated from pay_batch info
3302   {
3303     'key'         => 'batch-fixed_format-CARD',
3304     'section'     => 'billing',
3305     'description' => 'Fixed (unchangeable) format for credit card batches.',
3306     'type'        => 'select',
3307     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
3308                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
3309   },
3310
3311   {
3312     'key'         => 'batch-fixed_format-CHEK',
3313     'section'     => 'billing',
3314     'description' => 'Fixed (unchangeable) format for electronic check batches.',
3315     'type'        => 'select',
3316     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
3317                        'paymentech', 'ach-spiritone', 'RBC', 'td_eft1464',
3318                        'eft_canada'
3319                      ]
3320   },
3321
3322   {
3323     'key'         => 'batch-increment_expiration',
3324     'section'     => 'billing',
3325     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
3326     'type'        => 'checkbox'
3327   },
3328
3329   {
3330     'key'         => 'batchconfig-BoM',
3331     'section'     => 'billing',
3332     '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',
3333     'type'        => 'textarea',
3334   },
3335
3336   {
3337     'key'         => 'batchconfig-PAP',
3338     'section'     => 'billing',
3339     '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',
3340     'type'        => 'textarea',
3341   },
3342
3343   {
3344     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
3345     'section'     => 'billing',
3346     'description' => 'Gateway ID for Chase Canada E-xact batching',
3347     'type'        => 'text',
3348   },
3349
3350   {
3351     'key'         => 'batchconfig-paymentech',
3352     'section'     => 'billing',
3353     'description' => 'Configuration for Chase Paymentech batching, five lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username, 5. Password (for batch uploads)',
3354     'type'        => 'textarea',
3355   },
3356
3357   {
3358     'key'         => 'batchconfig-RBC',
3359     'section'     => 'billing',
3360     'description' => 'Configuration for Royal Bank of Canada PDS batching, four lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code.',
3361     'type'        => 'textarea',
3362   },
3363
3364   {
3365     'key'         => 'batchconfig-td_eft1464',
3366     'section'     => 'billing',
3367     'description' => 'Configuration for TD Bank EFT1464 batching, seven lines: 1. Originator ID, 2. Datacenter Code, 3. Short name, 4. Long name, 5. Returned payment branch number, 6. Returned payment account, 7. Transaction code.',
3368     'type'        => 'textarea',
3369   },
3370
3371   {
3372     'key'         => 'batch-manual_approval',
3373     'section'     => 'billing',
3374     'description' => 'Allow manual batch closure, which will approve all payments that do not yet have a status.  This is not advised, but is needed for payment processors that provide a report of rejected rather than approved payments.',
3375     'type'        => 'checkbox',
3376   },
3377
3378   {
3379     'key'         => 'batchconfig-eft_canada',
3380     'section'     => 'billing',
3381     'description' => 'Configuration for EFT Canada batching, four lines: 1. SFTP username, 2. SFTP password, 3. Transaction code, 4. Number of days to delay process date.',
3382     'type'        => 'textarea',
3383     'per_agent'   => 1,
3384   },
3385
3386   {
3387     'key'         => 'batch-spoolagent',
3388     'section'     => 'billing',
3389     'description' => 'Store payment batches per-agent.',
3390     'type'        => 'checkbox',
3391   },
3392
3393   {
3394     'key'         => 'payment_history-years',
3395     'section'     => 'UI',
3396     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
3397     'type'        => 'text',
3398   },
3399
3400   {
3401     'key'         => 'change_history-years',
3402     'section'     => 'UI',
3403     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
3404     'type'        => 'text',
3405   },
3406
3407   {
3408     'key'         => 'cust_main-packages-years',
3409     'section'     => 'UI',
3410     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
3411     'type'        => 'text',
3412   },
3413
3414   {
3415     'key'         => 'cust_main-use_comments',
3416     'section'     => 'UI',
3417     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
3418     'type'        => 'checkbox',
3419   },
3420
3421   {
3422     'key'         => 'cust_main-disable_notes',
3423     'section'     => 'UI',
3424     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
3425     'type'        => 'checkbox',
3426   },
3427
3428   {
3429     'key'         => 'cust_main_note-display_times',
3430     'section'     => 'UI',
3431     'description' => 'Display full timestamps (not just dates) for customer notes.',
3432     'type'        => 'checkbox',
3433   },
3434
3435   {
3436     'key'         => 'cust_main-ticket_statuses',
3437     'section'     => 'UI',
3438     'description' => 'Show tickets with these statuses on the customer view page.',
3439     'type'        => 'selectmultiple',
3440     'select_enum' => [qw( new open stalled resolved rejected deleted )],
3441   },
3442
3443   {
3444     'key'         => 'cust_main-max_tickets',
3445     'section'     => 'UI',
3446     'description' => 'Maximum number of tickets to show on the customer view page.',
3447     'type'        => 'text',
3448   },
3449
3450   {
3451     'key'         => 'cust_main-skeleton_tables',
3452     'section'     => '',
3453     '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.',
3454     'type'        => 'textarea',
3455   },
3456
3457   {
3458     'key'         => 'cust_main-skeleton_custnum',
3459     'section'     => '',
3460     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
3461     'type'        => 'text',
3462   },
3463
3464   {
3465     'key'         => 'cust_main-enable_birthdate',
3466     'section'     => 'UI',
3467     'descritpion' => 'Enable tracking of a birth date with each customer record',
3468     'type'        => 'checkbox',
3469   },
3470
3471   {
3472     'key'         => 'cust_main-edit_calling_list_exempt',
3473     'section'     => 'UI',
3474     'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
3475     'type'        => 'checkbox',
3476   },
3477
3478   {
3479     'key'         => 'support-key',
3480     'section'     => '',
3481     '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.',
3482     'type'        => 'text',
3483   },
3484
3485   {
3486     'key'         => 'card-types',
3487     'section'     => 'billing',
3488     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
3489     'type'        => 'selectmultiple',
3490     'select_enum' => \@card_types,
3491   },
3492
3493   {
3494     'key'         => 'disable-fuzzy',
3495     'section'     => 'UI',
3496     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
3497     'type'        => 'checkbox',
3498   },
3499
3500   { 'key'         => 'pkg_referral',
3501     'section'     => '',
3502     'description' => 'Enable package-specific advertising sources.',
3503     'type'        => 'checkbox',
3504   },
3505
3506   { 'key'         => 'pkg_referral-multiple',
3507     'section'     => '',
3508     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
3509     'type'        => 'checkbox',
3510   },
3511
3512   {
3513     'key'         => 'dashboard-install_welcome',
3514     'section'     => 'UI',
3515     'description' => 'New install welcome screen.',
3516     'type'        => 'select',
3517     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
3518   },
3519
3520   {
3521     'key'         => 'dashboard-toplist',
3522     'section'     => 'UI',
3523     'description' => 'List of items to display on the top of the front page',
3524     'type'        => 'textarea',
3525   },
3526
3527   {
3528     'key'         => 'impending_recur_msgnum',
3529     'section'     => 'notification',
3530     'description' => 'Template to use for alerts about first-time recurring billing.',
3531     %msg_template_options,
3532   },
3533
3534   {
3535     'key'         => 'impending_recur_template',
3536     'section'     => 'deprecated',
3537     '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>',
3538 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
3539     'type'        => 'textarea',
3540   },
3541
3542   {
3543     'key'         => 'logo.png',
3544     'section'     => 'UI',  #'invoicing' ?
3545     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
3546     'type'        => 'image',
3547     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
3548                         #old-style editor anyway...?
3549     'per_locale'  => 1,
3550   },
3551
3552   {
3553     'key'         => 'logo.eps',
3554     'section'     => 'invoicing',
3555     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
3556     'type'        => 'image',
3557     'per_agent'   => 1, #XXX as above, kinda
3558     'per_locale'  => 1,
3559   },
3560
3561   {
3562     'key'         => 'selfservice-ignore_quantity',
3563     'section'     => 'self-service',
3564     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
3565     'type'        => 'checkbox',
3566   },
3567
3568   {
3569     'key'         => 'selfservice-session_timeout',
3570     'section'     => 'self-service',
3571     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
3572     'type'        => 'select',
3573     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
3574   },
3575
3576   {
3577     'key'         => 'disable_setup_suspended_pkgs',
3578     'section'     => 'billing',
3579     'description' => 'Disables charging of setup fees for suspended packages.',
3580     'type'        => 'checkbox',
3581   },
3582
3583   {
3584     'key'         => 'password-generated-allcaps',
3585     'section'     => 'password',
3586     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
3587     'type'        => 'checkbox',
3588   },
3589
3590   {
3591     'key'         => 'datavolume-forcemegabytes',
3592     'section'     => 'UI',
3593     'description' => 'All data volumes are expressed in megabytes',
3594     'type'        => 'checkbox',
3595   },
3596
3597   {
3598     'key'         => 'datavolume-significantdigits',
3599     'section'     => 'UI',
3600     'description' => 'number of significant digits to use to represent data volumes',
3601     'type'        => 'text',
3602   },
3603
3604   {
3605     'key'         => 'disable_void_after',
3606     'section'     => 'billing',
3607     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
3608     'type'        => 'text',
3609   },
3610
3611   {
3612     'key'         => 'disable_line_item_date_ranges',
3613     'section'     => 'billing',
3614     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
3615     'type'        => 'checkbox',
3616   },
3617
3618   {
3619     'key'         => 'cust_bill-line_item-date_style',
3620     'section'     => 'billing',
3621     'description' => 'Display format for line item date ranges on invoice line items.',
3622     'type'        => 'select',
3623     'select_hash' => [ ''           => 'STARTDATE-ENDDATE',
3624                        'month_of'   => 'Month of MONTHNAME',
3625                        'X_month'    => 'DATE_DESC MONTHNAME',
3626                      ],
3627     'per_agent'   => 1,
3628   },
3629
3630   {
3631     'key'         => 'cust_bill-line_item-date_description',
3632     'section'     => 'billing',
3633     'description' => 'Text to display for "DATE_DESC" when using cust_bill-line_item-date_style DATE_DESC MONTHNAME.',
3634     'type'        => 'text',
3635     'per_agent'   => 1,
3636   },
3637
3638   {
3639     'key'         => 'support_packages',
3640     'section'     => '',
3641     '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...
3642     'type'        => 'select-part_pkg',
3643     'multiple'    => 1,
3644   },
3645
3646   {
3647     'key'         => 'cust_main-require_phone',
3648     'section'     => '',
3649     'description' => 'Require daytime or night phone for all customer records.',
3650     'type'        => 'checkbox',
3651     'per_agent'   => 1,
3652   },
3653
3654   {
3655     'key'         => 'cust_main-require_invoicing_list_email',
3656     'section'     => '',
3657     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
3658     'type'        => 'checkbox',
3659     'per_agent'   => 1,
3660   },
3661
3662   {
3663     'key'         => 'cust_main-check_unique',
3664     'section'     => '',
3665     'description' => 'Warn before creating a customer record where these fields duplicate another customer.',
3666     'type'        => 'select',
3667     'multiple'    => 1,
3668     'select_hash' => [ 
3669       'address1' => 'Billing address',
3670     ],
3671   },
3672
3673   {
3674     'key'         => 'svc_acct-display_paid_time_remaining',
3675     'section'     => '',
3676     'description' => 'Show paid time remaining in addition to time remaining.',
3677     'type'        => 'checkbox',
3678   },
3679
3680   {
3681     'key'         => 'cancel_credit_type',
3682     'section'     => 'billing',
3683     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
3684     reason_type_options('R'),
3685   },
3686
3687   {
3688     'key'         => 'suspend_credit_type',
3689     'section'     => 'billing',
3690     'description' => 'The group to use for new, automatically generated credit reasons resulting from package suspension.',
3691     reason_type_options('R'),
3692   },
3693
3694   {
3695     'key'         => 'referral_credit_type',
3696     'section'     => 'deprecated',
3697     '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.',
3698     reason_type_options('R'),
3699   },
3700
3701   {
3702     'key'         => 'signup_credit_type',
3703     'section'     => 'billing', #self-service?
3704     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
3705     reason_type_options('R'),
3706   },
3707
3708   {
3709     'key'         => 'prepayment_discounts-credit_type',
3710     'section'     => 'billing',
3711     'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
3712     reason_type_options('R'),
3713   },
3714
3715   {
3716     'key'         => 'cust_main-agent_custid-format',
3717     'section'     => '',
3718     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
3719     'type'        => 'select',
3720     'select_hash' => [
3721                        ''       => 'Numeric only',
3722                        '\d{7}'  => 'Numeric only, exactly 7 digits',
3723                        'ww?d+'  => 'Numeric with one or two letter prefix',
3724                      ],
3725   },
3726
3727   {
3728     'key'         => 'card_masking_method',
3729     'section'     => 'UI',
3730     '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.',
3731     'type'        => 'select',
3732     'select_hash' => [
3733                        ''            => '123456xxxxxx1234',
3734                        'first6last2' => '123456xxxxxxxx12',
3735                        'first4last4' => '1234xxxxxxxx1234',
3736                        'first4last2' => '1234xxxxxxxxxx12',
3737                        'first2last4' => '12xxxxxxxxxx1234',
3738                        'first2last2' => '12xxxxxxxxxxxx12',
3739                        'first0last4' => 'xxxxxxxxxxxx1234',
3740                        'first0last2' => 'xxxxxxxxxxxxxx12',
3741                      ],
3742   },
3743
3744   {
3745     'key'         => 'disable_previous_balance',
3746     'section'     => 'invoicing',
3747     'description' => 'Disable inclusion of previous balance, payment, and credit lines on invoices',
3748     'type'        => 'checkbox',
3749     'per_agent'   => 1,
3750   },
3751
3752   {
3753     'key'         => 'previous_balance-exclude_from_total',
3754     'section'     => 'invoicing',
3755     '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',
3756     'type'        => [ qw(checkbox text) ],
3757   },
3758
3759   {
3760     'key'         => 'previous_balance-summary_only',
3761     'section'     => 'invoicing',
3762     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
3763     'type'        => 'checkbox',
3764   },
3765
3766   {
3767     'key'         => 'previous_balance-show_credit',
3768     'section'     => 'invoicing',
3769     'description' => 'Show the customer\'s credit balance on invoices when applicable.',
3770     'type'        => 'checkbox',
3771   },
3772
3773   {
3774     'key'         => 'balance_due_below_line',
3775     'section'     => 'invoicing',
3776     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
3777     'type'        => 'checkbox',
3778   },
3779
3780   {
3781     'key'         => 'usps_webtools-userid',
3782     'section'     => 'UI',
3783     '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.',
3784     'type'        => 'text',
3785   },
3786
3787   {
3788     'key'         => 'usps_webtools-password',
3789     'section'     => 'UI',
3790     '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.',
3791     'type'        => 'text',
3792   },
3793
3794   {
3795     'key'         => 'cust_main-auto_standardize_address',
3796     'section'     => 'UI',
3797     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
3798     'type'        => 'checkbox',
3799   },
3800
3801   {
3802     'key'         => 'cust_main-require_censustract',
3803     'section'     => 'UI',
3804     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
3805     'type'        => 'checkbox',
3806   },
3807
3808   {
3809     'key'         => 'census_year',
3810     'section'     => 'UI',
3811     'description' => 'The year to use in census tract lookups',
3812     'type'        => 'select',
3813     'select_enum' => [ qw( 2012 2011 2010 ) ],
3814   },
3815
3816   {
3817     'key'         => 'tax_district_method',
3818     'section'     => 'UI',
3819     'description' => 'The method to use to look up tax district codes.',
3820     'type'        => 'select',
3821     'select_hash' => [ FS::Misc::Geo::get_district_methods() ],
3822   },
3823
3824   {
3825     'key'         => 'company_latitude',
3826     'section'     => 'UI',
3827     'description' => 'Your company latitude (-90 through 90)',
3828     'type'        => 'text',
3829   },
3830
3831   {
3832     'key'         => 'company_longitude',
3833     'section'     => 'UI',
3834     'description' => 'Your company longitude (-180 thru 180)',
3835     'type'        => 'text',
3836   },
3837
3838   {
3839     'key'         => 'geocode_module',
3840     'section'     => '',
3841     'description' => 'Module to geocode (retrieve a latitude and longitude for) addresses',
3842     'type'        => 'select',
3843     'select_enum' => [ 'Geo::Coder::Googlev3' ],
3844   },
3845
3846   {
3847     'key'         => 'geocode-require_nw_coordinates',
3848     'section'     => 'UI',
3849     'description' => 'Require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
3850     'type'        => 'checkbox',
3851   },
3852
3853   {
3854     'key'         => 'disable_acl_changes',
3855     'section'     => '',
3856     'description' => 'Disable all ACL changes, for demos.',
3857     'type'        => 'checkbox',
3858   },
3859
3860   {
3861     'key'         => 'disable_settings_changes',
3862     'section'     => '',
3863     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
3864     'type'        => [qw( checkbox text )],
3865   },
3866
3867   {
3868     'key'         => 'cust_main-edit_agent_custid',
3869     'section'     => 'UI',
3870     'description' => 'Enable editing of the agent_custid field.',
3871     'type'        => 'checkbox',
3872   },
3873
3874   {
3875     'key'         => 'cust_main-default_agent_custid',
3876     'section'     => 'UI',
3877     'description' => 'Display the agent_custid field when available instead of the custnum field.',
3878     'type'        => 'checkbox',
3879   },
3880
3881   {
3882     'key'         => 'cust_main-title-display_custnum',
3883     'section'     => 'UI',
3884     'description' => 'Add the display_custom (agent_custid or custnum) to the title on customer view pages.',
3885     'type'        => 'checkbox',
3886   },
3887
3888   {
3889     'key'         => 'cust_bill-default_agent_invid',
3890     'section'     => 'UI',
3891     'description' => 'Display the agent_invid field when available instead of the invnum field.',
3892     'type'        => 'checkbox',
3893   },
3894
3895   {
3896     'key'         => 'cust_main-auto_agent_custid',
3897     'section'     => 'UI',
3898     'description' => 'Automatically assign an agent_custid - select format',
3899     'type'        => 'select',
3900     'select_hash' => [ '' => 'No',
3901                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
3902                      ],
3903   },
3904
3905   {
3906     'key'         => 'cust_main-custnum-display_prefix',
3907     'section'     => 'UI',
3908     'description' => 'Prefix the customer number with this string for display purposes.',
3909     'type'        => 'text',
3910     'per_agent'   => 1,
3911   },
3912
3913   {
3914     'key'         => 'cust_main-custnum-display_special',
3915     'section'     => 'UI',
3916     'description' => 'Use this customer number prefix format',
3917     'type'        => 'select',
3918     'select_hash' => [ '' => '',
3919                        'CoStAg' => 'CoStAg (country, state, agent name or display_prefix)',
3920                        'CoStCl' => 'CoStCl (country, state, class name)' ],
3921   },
3922
3923   {
3924     'key'         => 'cust_main-custnum-display_length',
3925     'section'     => 'UI',
3926     'description' => 'Zero fill the customer number to this many digits for display purposes.',
3927     'type'        => 'text',
3928   },
3929
3930   {
3931     'key'         => 'cust_main-default_areacode',
3932     'section'     => 'UI',
3933     'description' => 'Default area code for customers.',
3934     'type'        => 'text',
3935   },
3936
3937   {
3938     'key'         => 'order_pkg-no_start_date',
3939     'section'     => 'UI',
3940     'description' => 'Don\'t set a default start date for new packages.',
3941     'type'        => 'checkbox',
3942   },
3943
3944   {
3945     'key'         => 'mcp_svcpart',
3946     'section'     => '',
3947     'description' => 'Master Control Program svcpart.  Leave this blank.',
3948     'type'        => 'text', #select-part_svc
3949   },
3950
3951   {
3952     'key'         => 'cust_bill-max_same_services',
3953     'section'     => 'invoicing',
3954     '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.',
3955     'type'        => 'text',
3956   },
3957
3958   {
3959     'key'         => 'cust_bill-consolidate_services',
3960     'section'     => 'invoicing',
3961     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
3962     'type'        => 'checkbox',
3963   },
3964
3965   {
3966     'key'         => 'suspend_email_admin',
3967     'section'     => '',
3968     'description' => 'Destination admin email address to enable suspension notices',
3969     'type'        => 'text',
3970   },
3971
3972   {
3973     'key'         => 'unsuspend_email_admin',
3974     'section'     => '',
3975     'description' => 'Destination admin email address to enable unsuspension notices',
3976     'type'        => 'text',
3977   },
3978   
3979   {
3980     'key'         => 'email_report-subject',
3981     'section'     => '',
3982     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
3983     'type'        => 'text',
3984   },
3985
3986   {
3987     'key'         => 'selfservice-head',
3988     'section'     => 'self-service',
3989     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
3990     'type'        => 'textarea', #htmlarea?
3991     'per_agent'   => 1,
3992   },
3993
3994
3995   {
3996     'key'         => 'selfservice-body_header',
3997     'section'     => 'self-service',
3998     'description' => 'HTML header for the self-service interface',
3999     'type'        => 'textarea', #htmlarea?
4000     'per_agent'   => 1,
4001   },
4002
4003   {
4004     'key'         => 'selfservice-body_footer',
4005     'section'     => 'self-service',
4006     'description' => 'HTML footer for the self-service interface',
4007     'type'        => 'textarea', #htmlarea?
4008     'per_agent'   => 1,
4009   },
4010
4011
4012   {
4013     'key'         => 'selfservice-body_bgcolor',
4014     'section'     => 'self-service',
4015     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
4016     'type'        => 'text',
4017     'per_agent'   => 1,
4018   },
4019
4020   {
4021     'key'         => 'selfservice-box_bgcolor',
4022     'section'     => 'self-service',
4023     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
4024     'type'        => 'text',
4025     'per_agent'   => 1,
4026   },
4027
4028   {
4029     'key'         => 'selfservice-stripe1_bgcolor',
4030     'section'     => 'self-service',
4031     'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF',
4032     'type'        => 'text',
4033     'per_agent'   => 1,
4034   },
4035
4036   {
4037     'key'         => 'selfservice-stripe2_bgcolor',
4038     'section'     => 'self-service',
4039     'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD',
4040     'type'        => 'text',
4041     'per_agent'   => 1,
4042   },
4043
4044
4045   {
4046     'key'         => 'selfservice-text_color',
4047     'section'     => 'self-service',
4048     'description' => 'HTML text color for the self-service interface, for example, #000000',
4049     'type'        => 'text',
4050     'per_agent'   => 1,
4051   },
4052
4053   {
4054     'key'         => 'selfservice-link_color',
4055     'section'     => 'self-service',
4056     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
4057     'type'        => 'text',
4058     'per_agent'   => 1,
4059   },
4060
4061   {
4062     'key'         => 'selfservice-vlink_color',
4063     'section'     => 'self-service',
4064     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
4065     'type'        => 'text',
4066     'per_agent'   => 1,
4067   },
4068
4069   {
4070     'key'         => 'selfservice-hlink_color',
4071     'section'     => 'self-service',
4072     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
4073     'type'        => 'text',
4074     'per_agent'   => 1,
4075   },
4076
4077   {
4078     'key'         => 'selfservice-alink_color',
4079     'section'     => 'self-service',
4080     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
4081     'type'        => 'text',
4082     'per_agent'   => 1,
4083   },
4084
4085   {
4086     'key'         => 'selfservice-font',
4087     'section'     => 'self-service',
4088     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
4089     'type'        => 'text',
4090     'per_agent'   => 1,
4091   },
4092
4093   {
4094     'key'         => 'selfservice-no_logo',
4095     'section'     => 'self-service',
4096     'description' => 'Disable the logo in self-service',
4097     'type'        => 'checkbox',
4098     'per_agent'   => 1,
4099   },
4100
4101   {
4102     'key'         => 'selfservice-title_color',
4103     'section'     => 'self-service',
4104     'description' => 'HTML color for the self-service title, for example, #000000',
4105     'type'        => 'text',
4106     'per_agent'   => 1,
4107   },
4108
4109   {
4110     'key'         => 'selfservice-title_align',
4111     'section'     => 'self-service',
4112     'description' => 'HTML alignment for the self-service title, for example, center',
4113     'type'        => 'text',
4114     'per_agent'   => 1,
4115   },
4116   {
4117     'key'         => 'selfservice-title_size',
4118     'section'     => 'self-service',
4119     'description' => 'HTML font size for the self-service title, for example, 3',
4120     'type'        => 'text',
4121     'per_agent'   => 1,
4122   },
4123
4124   {
4125     'key'         => 'selfservice-title_left_image',
4126     'section'     => 'self-service',
4127     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4128     'type'        => 'image',
4129     'per_agent'   => 1,
4130   },
4131
4132   {
4133     'key'         => 'selfservice-title_right_image',
4134     'section'     => 'self-service',
4135     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4136     'type'        => 'image',
4137     'per_agent'   => 1,
4138   },
4139
4140   {
4141     'key'         => 'selfservice-menu_skipblanks',
4142     'section'     => 'self-service',
4143     'description' => 'Skip blank (spacer) entries in the self-service menu',
4144     'type'        => 'checkbox',
4145     'per_agent'   => 1,
4146   },
4147
4148   {
4149     'key'         => 'selfservice-menu_skipheadings',
4150     'section'     => 'self-service',
4151     'description' => 'Skip the unclickable heading entries in the self-service menu',
4152     'type'        => 'checkbox',
4153     'per_agent'   => 1,
4154   },
4155
4156   {
4157     'key'         => 'selfservice-menu_bgcolor',
4158     'section'     => 'self-service',
4159     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
4160     'type'        => 'text',
4161     'per_agent'   => 1,
4162   },
4163
4164   {
4165     'key'         => 'selfservice-menu_fontsize',
4166     'section'     => 'self-service',
4167     'description' => 'HTML font size for the self-service menu, for example, -1',
4168     'type'        => 'text',
4169     'per_agent'   => 1,
4170   },
4171   {
4172     'key'         => 'selfservice-menu_nounderline',
4173     'section'     => 'self-service',
4174     'description' => 'Styles menu links in the self-service without underlining.',
4175     'type'        => 'checkbox',
4176     'per_agent'   => 1,
4177   },
4178
4179
4180   {
4181     'key'         => 'selfservice-menu_top_image',
4182     'section'     => 'self-service',
4183     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4184     'type'        => 'image',
4185     'per_agent'   => 1,
4186   },
4187
4188   {
4189     'key'         => 'selfservice-menu_body_image',
4190     'section'     => 'self-service',
4191     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
4192     'type'        => 'image',
4193     'per_agent'   => 1,
4194   },
4195
4196   {
4197     'key'         => 'selfservice-menu_bottom_image',
4198     'section'     => 'self-service',
4199     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
4200     'type'        => 'image',
4201     'per_agent'   => 1,
4202   },
4203   
4204   {
4205     'key'         => 'selfservice-view_usage_nodomain',
4206     'section'     => 'self-service',
4207     'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.',
4208     'type'        => 'checkbox',
4209   },
4210
4211   {
4212     'key'         => 'selfservice-login_banner_image',
4213     'section'     => 'self-service',
4214     'description' => 'Banner image shown on the login page, in PNG format.',
4215     'type'        => 'image',
4216   },
4217
4218   {
4219     'key'         => 'selfservice-login_banner_url',
4220     'section'     => 'self-service',
4221     'description' => 'Link for the login banner.',
4222     'type'        => 'text',
4223   },
4224
4225   {
4226     'key'         => 'selfservice-bulk_format',
4227     'section'     => 'deprecated',
4228     'description' => 'Parameter arrangement for selfservice bulk features',
4229     'type'        => 'select',
4230     'select_enum' => [ '', 'izoom-soap', 'izoom-ftp' ],
4231     'per_agent'   => 1,
4232   },
4233
4234   {
4235     'key'         => 'selfservice-bulk_ftp_dir',
4236     'section'     => 'deprecated',
4237     'description' => 'Enable bulk ftp provisioning in this folder',
4238     'type'        => 'text',
4239     'per_agent'   => 1,
4240   },
4241
4242   {
4243     'key'         => 'signup-no_company',
4244     'section'     => 'self-service',
4245     'description' => "Don't display a field for company name on signup.",
4246     'type'        => 'checkbox',
4247   },
4248
4249   {
4250     'key'         => 'signup-recommend_email',
4251     'section'     => 'self-service',
4252     'description' => 'Encourage the entry of an invoicing email address on signup.',
4253     'type'        => 'checkbox',
4254   },
4255
4256   {
4257     'key'         => 'signup-recommend_daytime',
4258     'section'     => 'self-service',
4259     'description' => 'Encourage the entry of a daytime phone number on signup.',
4260     'type'        => 'checkbox',
4261   },
4262
4263   {
4264     'key'         => 'signup-duplicate_cc-warn_hours',
4265     'section'     => 'self-service',
4266     'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.',
4267     'type'        => 'text',
4268   },
4269
4270   {
4271     'key'         => 'svc_phone-radius-default_password',
4272     'section'     => 'telephony',
4273     'description' => 'Default password when exporting svc_phone records to RADIUS',
4274     'type'        => 'text',
4275   },
4276
4277   {
4278     'key'         => 'svc_phone-allow_alpha_phonenum',
4279     'section'     => 'telephony',
4280     'description' => 'Allow letters in phone numbers.',
4281     'type'        => 'checkbox',
4282   },
4283
4284   {
4285     'key'         => 'svc_phone-domain',
4286     'section'     => 'telephony',
4287     'description' => 'Track an optional domain association with each phone service.',
4288     'type'        => 'checkbox',
4289   },
4290
4291   {
4292     'key'         => 'svc_phone-phone_name-max_length',
4293     'section'     => 'telephony',
4294     '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.',
4295     'type'        => 'text',
4296   },
4297
4298   {
4299     'key'         => 'svc_phone-random_pin',
4300     'section'     => 'telephony',
4301     'description' => 'Number of random digits to generate in the "PIN" field, if empty.',
4302     'type'        => 'text',
4303   },
4304
4305   {
4306     'key'         => 'svc_phone-lnp',
4307     'section'     => 'telephony',
4308     'description' => 'Enables Number Portability features for svc_phone',
4309     'type'        => 'checkbox',
4310   },
4311
4312   {
4313     'key'         => 'default_phone_countrycode',
4314     'section'     => '',
4315     'description' => 'Default countrcode',
4316     'type'        => 'text',
4317   },
4318
4319   {
4320     'key'         => 'cdr-charged_party-field',
4321     'section'     => 'telephony',
4322     'description' => 'Set the charged_party field of CDRs to this field.',
4323     'type'        => 'select-sub',
4324     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
4325                            map { $_ => $fields->{$_}||$_ }
4326                            grep { $_ !~ /^(acctid|charged_party)$/ }
4327                            FS::Schema::dbdef->table('cdr')->columns;
4328                          },
4329     'option_sub'  => sub { my $f = shift;
4330                            FS::cdr->table_info->{'fields'}{$f} || $f;
4331                          },
4332   },
4333
4334   #probably deprecate in favor of cdr-charged_party-field above
4335   {
4336     'key'         => 'cdr-charged_party-accountcode',
4337     'section'     => 'telephony',
4338     'description' => 'Set the charged_party field of CDRs to the accountcode.',
4339     'type'        => 'checkbox',
4340   },
4341
4342   {
4343     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
4344     'section'     => 'telephony',
4345     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
4346     'type'        => 'checkbox',
4347   },
4348
4349 #  {
4350 #    'key'         => 'cdr-charged_party-truncate_prefix',
4351 #    'section'     => '',
4352 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
4353 #    'type'        => 'text',
4354 #  },
4355 #
4356 #  {
4357 #    'key'         => 'cdr-charged_party-truncate_length',
4358 #    'section'     => '',
4359 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
4360 #    'type'        => 'text',
4361 #  },
4362
4363   {
4364     'key'         => 'cdr-charged_party_rewrite',
4365     'section'     => 'telephony',
4366     '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*.',
4367     'type'        => 'checkbox',
4368   },
4369
4370   {
4371     'key'         => 'cdr-taqua-da_rewrite',
4372     'section'     => 'telephony',
4373     '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.',
4374     'type'        => 'text',
4375   },
4376
4377   {
4378     'key'         => 'cdr-taqua-accountcode_rewrite',
4379     'section'     => 'telephony',
4380     'description' => 'For the Taqua CDR format, pull accountcodes from secondary CDRs with matching sessionNumber.',
4381     'type'        => 'checkbox',
4382   },
4383
4384   {
4385     'key'         => 'cdr-asterisk_australia_rewrite',
4386     'section'     => 'telephony',
4387     'description' => 'For Asterisk CDRs, assign CDR type numbers based on Australian conventions.',
4388     'type'        => 'checkbox',
4389   },
4390
4391   {
4392     'key'         => 'cust_pkg-show_autosuspend',
4393     'section'     => 'UI',
4394     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
4395     'type'        => 'checkbox',
4396   },
4397
4398   {
4399     'key'         => 'cdr-asterisk_forward_rewrite',
4400     'section'     => 'telephony',
4401     '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").',
4402     'type'        => 'checkbox',
4403   },
4404
4405   {
4406     'key'         => 'sg-multicustomer_hack',
4407     'section'     => '',
4408     'description' => "Don't use this.",
4409     'type'        => 'checkbox',
4410   },
4411
4412   {
4413     'key'         => 'sg-ping_username',
4414     'section'     => '',
4415     'description' => "Don't use this.",
4416     'type'        => 'text',
4417   },
4418
4419   {
4420     'key'         => 'sg-ping_password',
4421     'section'     => '',
4422     'description' => "Don't use this.",
4423     'type'        => 'text',
4424   },
4425
4426   {
4427     'key'         => 'sg-login_username',
4428     'section'     => '',
4429     'description' => "Don't use this.",
4430     'type'        => 'text',
4431   },
4432
4433   {
4434     'key'         => 'mc-outbound_packages',
4435     'section'     => '',
4436     'description' => "Don't use this.",
4437     'type'        => 'select-part_pkg',
4438     'multiple'    => 1,
4439   },
4440
4441   {
4442     'key'         => 'disable-cust-pkg_class',
4443     'section'     => 'UI',
4444     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
4445     'type'        => 'checkbox',
4446   },
4447
4448   {
4449     'key'         => 'queued-max_kids',
4450     'section'     => '',
4451     'description' => 'Maximum number of queued processes.  Defaults to 10.',
4452     'type'        => 'text',
4453   },
4454
4455   {
4456     'key'         => 'queued-sleep_time',
4457     'section'     => '',
4458     '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.',
4459     'type'        => 'text',
4460   },
4461
4462   {
4463     'key'         => 'cancelled_cust-noevents',
4464     'section'     => 'billing',
4465     'description' => "Don't run events for cancelled customers",
4466     'type'        => 'checkbox',
4467   },
4468
4469   {
4470     'key'         => 'agent-invoice_template',
4471     'section'     => 'invoicing',
4472     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
4473     'type'        => 'checkbox',
4474   },
4475
4476   {
4477     'key'         => 'svc_broadband-manage_link',
4478     'section'     => 'UI',
4479     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr.',
4480     'type'        => 'text',
4481   },
4482
4483   {
4484     'key'         => 'svc_broadband-manage_link_text',
4485     'section'     => 'UI',
4486     'description' => 'Label for "Manage Device" link',
4487     'type'        => 'text',
4488   },
4489
4490   {
4491     'key'         => 'svc_broadband-manage_link_loc',
4492     'section'     => 'UI',
4493     'description' => 'Location for "Manage Device" link',
4494     'type'        => 'select',
4495     'select_hash' => [
4496       'bottom' => 'Near Unprovision link',
4497       'right'  => 'With export-related links',
4498     ],
4499   },
4500
4501   {
4502     'key'         => 'svc_broadband-manage_link-new_window',
4503     'section'     => 'UI',
4504     'description' => 'Open the "Manage Device" link in a new window',
4505     'type'        => 'checkbox',
4506   },
4507
4508   #more fine-grained, service def-level control could be useful eventually?
4509   {
4510     'key'         => 'svc_broadband-allow_null_ip_addr',
4511     'section'     => '',
4512     'description' => '',
4513     'type'        => 'checkbox',
4514   },
4515
4516   {
4517     'key'         => 'svc_hardware-check_mac_addr',
4518     'section'     => '', #?
4519     'description' => 'Require the "hardware address" field in hardware services to be a valid MAC address.',
4520     'type'        => 'checkbox',
4521   },
4522
4523   {
4524     'key'         => 'tax-report_groups',
4525     'section'     => '',
4526     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
4527     'type'        => 'textarea',
4528   },
4529
4530   {
4531     'key'         => 'tax-cust_exempt-groups',
4532     'section'     => '',
4533     '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).',
4534     'type'        => 'textarea',
4535   },
4536
4537   {
4538     'key'         => 'cust_main-default_view',
4539     'section'     => 'UI',
4540     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
4541     'type'        => 'select',
4542     'select_hash' => [
4543       #false laziness w/view/cust_main.cgi and pref/pref.html
4544       'basics'          => 'Basics',
4545       'notes'           => 'Notes',
4546       'tickets'         => 'Tickets',
4547       'packages'        => 'Packages',
4548       'payment_history' => 'Payment History',
4549       'change_history'  => 'Change History',
4550       'jumbo'           => 'Jumbo',
4551     ],
4552   },
4553
4554   {
4555     'key'         => 'enable_tax_adjustments',
4556     'section'     => 'billing',
4557     'description' => 'Enable the ability to add manual tax adjustments.',
4558     'type'        => 'checkbox',
4559   },
4560
4561   {
4562     'key'         => 'rt-crontool',
4563     'section'     => '',
4564     'description' => 'Enable the RT CronTool extension.',
4565     'type'        => 'checkbox',
4566   },
4567
4568   {
4569     'key'         => 'pkg-balances',
4570     'section'     => 'billing',
4571     'description' => 'Enable experimental package balances.  Not recommended for general use.',
4572     'type'        => 'checkbox',
4573   },
4574
4575   {
4576     'key'         => 'pkg-addon_classnum',
4577     'section'     => 'billing',
4578     'description' => 'Enable the ability to restrict additional package orders based on package class.',
4579     'type'        => 'checkbox',
4580   },
4581
4582   {
4583     'key'         => 'cust_main-edit_signupdate',
4584     'section'     => 'UI',
4585     'descritpion' => 'Enable manual editing of the signup date.',
4586     'type'        => 'checkbox',
4587   },
4588
4589   {
4590     'key'         => 'svc_acct-disable_access_number',
4591     'section'     => 'UI',
4592     'descritpion' => 'Disable access number selection.',
4593     'type'        => 'checkbox',
4594   },
4595
4596   {
4597     'key'         => 'cust_bill_pay_pkg-manual',
4598     'section'     => 'UI',
4599     'description' => 'Allow manual application of payments to line items.',
4600     'type'        => 'checkbox',
4601   },
4602
4603   {
4604     'key'         => 'cust_credit_bill_pkg-manual',
4605     'section'     => 'UI',
4606     'description' => 'Allow manual application of credits to line items.',
4607     'type'        => 'checkbox',
4608   },
4609
4610   {
4611     'key'         => 'breakage-days',
4612     'section'     => 'billing',
4613     '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.',
4614     'type'        => 'text',
4615     'per_agent'   => 1,
4616   },
4617
4618   {
4619     'key'         => 'breakage-pkg_class',
4620     'section'     => 'billing',
4621     'description' => 'Package class to use for breakage reconciliation.',
4622     'type'        => 'select-pkg_class',
4623   },
4624
4625   {
4626     'key'         => 'disable_cron_billing',
4627     'section'     => 'billing',
4628     '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.',
4629     'type'        => 'checkbox',
4630   },
4631
4632   {
4633     'key'         => 'svc_domain-edit_domain',
4634     'section'     => '',
4635     'description' => 'Enable domain renaming',
4636     'type'        => 'checkbox',
4637   },
4638
4639   {
4640     'key'         => 'enable_legacy_prepaid_income',
4641     'section'     => '',
4642     '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.",
4643     'type'        => 'checkbox',
4644   },
4645
4646   {
4647     'key'         => 'cust_main-exports',
4648     'section'     => '',
4649     'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
4650     'type'        => 'select-sub',
4651     'multiple'    => 1,
4652     'options_sub' => sub {
4653       require FS::Record;
4654       require FS::part_export;
4655       my @part_export =
4656         map { qsearch( 'part_export', {exporttype => $_ } ) }
4657           keys %{FS::part_export::export_info('cust_main')};
4658       map { $_->exportnum => $_->exporttype.' to '.$_->machine } @part_export;
4659     },
4660     'option_sub'  => sub {
4661       require FS::Record;
4662       require FS::part_export;
4663       my $part_export = FS::Record::qsearchs(
4664         'part_export', { 'exportnum' => shift }
4665       );
4666       $part_export
4667         ? $part_export->exporttype.' to '.$part_export->machine
4668         : '';
4669     },
4670   },
4671
4672   {
4673     'key'         => 'cust_tag-location',
4674     'section'     => 'UI',
4675     'description' => 'Location where customer tags are displayed.',
4676     'type'        => 'select',
4677     'select_enum' => [ 'misc_info', 'top' ],
4678   },
4679
4680   {
4681     'key'         => 'maestro-status_test',
4682     'section'     => 'UI',
4683     'description' => 'Display a link to the maestro status test page on the customer view page',
4684     'type'        => 'checkbox',
4685   },
4686
4687   {
4688     'key'         => 'cust_main-custom_link',
4689     'section'     => 'UI',
4690     'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere.  "$agentnum" will be replaced with the agent number, and "$usernum" will be replaced with the employee number.',
4691     'type'        => 'textarea',
4692   },
4693
4694   {
4695     'key'         => 'cust_main-custom_title',
4696     'section'     => 'UI',
4697     'description' => 'Title for the "Custom" tab in the View Customer page.',
4698     'type'        => 'text',
4699   },
4700
4701   {
4702     'key'         => 'part_pkg-default_suspend_bill',
4703     'section'     => 'billing',
4704     'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
4705     'type'        => 'checkbox',
4706   },
4707   
4708   {
4709     'key'         => 'qual-alt_address_format',
4710     'section'     => 'UI',
4711     'description' => 'Enable the alternate address format (location type, number, and kind) for qualifications.',
4712     'type'        => 'checkbox',
4713   },
4714
4715   {
4716     'key'         => 'prospect_main-alt_address_format',
4717     'section'     => 'UI',
4718     'description' => 'Enable the alternate address format (location type, number, and kind) for prospects.  Recommended if qual-alt_address_format is set and the main use of propects is for qualifications.',
4719     'type'        => 'checkbox',
4720   },
4721
4722   {
4723     'key'         => 'prospect_main-location_required',
4724     'section'     => 'UI',
4725     'description' => 'Require an address for prospects.  Recommended if the main use of propects is for qualifications.',
4726     'type'        => 'checkbox',
4727   },
4728
4729   {
4730     'key'         => 'note-classes',
4731     'section'     => 'UI',
4732     'description' => 'Use customer note classes',
4733     'type'        => 'select',
4734     'select_hash' => [
4735                        0 => 'Disabled',
4736                        1 => 'Enabled',
4737                        2 => 'Enabled, with tabs',
4738                      ],
4739   },
4740
4741   {
4742     'key'         => 'svc_acct-cf_privatekey-message',
4743     'section'     => '',
4744     'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
4745     'type'        => 'textarea',
4746   },
4747
4748   {
4749     'key'         => 'menu-prepend_links',
4750     'section'     => 'UI',
4751     'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
4752     'type'        => 'textarea',
4753   },
4754
4755   {
4756     'key'         => 'cust_main-external_links',
4757     'section'     => 'UI',
4758     'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
4759     'type'        => 'textarea',
4760   },
4761   
4762   {
4763     'key'         => 'svc_phone-did-summary',
4764     'section'     => 'invoicing',
4765     'description' => 'Enable DID activity summary on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage, covering period since last invoice.',
4766     'type'        => 'checkbox',
4767   },
4768
4769   {
4770     'key'         => 'svc_acct-usage_seconds',
4771     'section'     => 'invoicing',
4772     'description' => 'Enable calculation of RADIUS usage time for invoices.  You must modify your template to display this information.',
4773     'type'        => 'checkbox',
4774   },
4775   
4776   {
4777     'key'         => 'opensips_gwlist',
4778     'section'     => 'telephony',
4779     'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent',
4780     'type'        => 'text',
4781     'per_agent'   => 1,
4782     'agentonly'   => 1,
4783   },
4784
4785   {
4786     'key'         => 'opensips_description',
4787     'section'     => 'telephony',
4788     'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent',
4789     'type'        => 'text',
4790     'per_agent'   => 1,
4791     'agentonly'   => 1,
4792   },
4793   
4794   {
4795     'key'         => 'opensips_route',
4796     'section'     => 'telephony',
4797     'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent',
4798     'type'        => 'text',
4799     'per_agent'   => 1,
4800     'agentonly'   => 1,
4801   },
4802
4803   {
4804     'key'         => 'cust_bill-no_recipients-error',
4805     'section'     => 'invoicing',
4806     'description' => 'For customers with no invoice recipients, throw a job queue error rather than the default behavior of emailing the invoice to the invoice_from address.',
4807     'type'        => 'checkbox',
4808   },
4809
4810   {
4811     'key'         => 'cust_bill-latex_lineitem_maxlength',
4812     'section'     => 'invoicing',
4813     'description' => 'Truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin.  Defaults to 50.  ',
4814     'type'        => 'text',
4815   },
4816
4817   {
4818     'key'         => 'cust_main-status_module',
4819     'section'     => 'UI',
4820     'description' => 'Which module to use for customer status display.  The "Classic" module (the default) considers accounts with cancelled recurring packages but un-cancelled one-time charges Inactive.  The "Recurring" module considers those customers Cancelled.  Similarly for customers with suspended recurring packages but one-time charges.', #other differences?
4821     'type'        => 'select',
4822     'select_enum' => [ 'Classic', 'Recurring' ],
4823   },
4824
4825   {
4826     'key'         => 'cust_main-print_statement_link',
4827     'section'     => 'UI',
4828     'description' => 'Show a link to download a current statement for the customer.',
4829     'type'        => 'checkbox',
4830   },
4831
4832   { 
4833     'key'         => 'username-pound',
4834     'section'     => 'username',
4835     'description' => 'Allow the pound character (#) in usernames.',
4836     'type'        => 'checkbox',
4837   },
4838
4839   {
4840     'key'         => 'ie-compatibility_mode',
4841     'section'     => 'UI',
4842     'description' => "Compatibility mode META tag for Internet Explorer, used on the customer view page.  Not necessary in normal operation unless custom content (notes, cust_main-custom_link) is included on customer view that is incompatibile with newer IE verisons.",
4843     'type'        => 'select',
4844     'select_enum' => [ '', '7', 'EmulateIE7', '8', 'EmulateIE8' ],
4845   },
4846
4847   {
4848     'key'         => 'disable_payauto_default',
4849     'section'     => 'UI',
4850     'description' => 'Disable the "Charge future payments to this (card|check) automatically" checkbox from defaulting to checked.',
4851     'type'        => 'checkbox',
4852   },
4853   
4854   {
4855     'key'         => 'payment-history-report',
4856     'section'     => 'UI',
4857     'description' => 'Show a link to the raw database payment history report in the Reports menu.  DO NOT ENABLE THIS for modern installations.',
4858     'type'        => 'checkbox',
4859   },
4860   
4861   {
4862     'key'         => 'svc_broadband-require-nw-coordinates',
4863     'section'     => 'deprecated',
4864     'description' => 'Deprecated; see geocode-require_nw_coordinates instead',
4865     'type'        => 'checkbox',
4866   },
4867   
4868   {
4869     'key'         => 'cust-email-high-visibility',
4870     'section'     => 'UI',
4871     'description' => 'Move the invoicing e-mail address field to the top of the billing address section and highlight it.',
4872     'type'        => 'checkbox',
4873   },
4874   
4875   {
4876     'key'         => 'cust-edit-alt-field-order',
4877     'section'     => 'UI',
4878     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
4879     'type'        => 'checkbox',
4880   },
4881
4882   {
4883     'key'         => 'cust_bill-enable_promised_date',
4884     'section'     => 'UI',
4885     'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
4886     'type'        => 'checkbox',
4887   },
4888   
4889   {
4890     'key'         => 'available-locales',
4891     'section'     => '',
4892     'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
4893     'type'        => 'select-sub',
4894     'multiple'    => 1,
4895     'options_sub' => sub { 
4896       map { $_ => FS::Locales->description($_) }
4897       grep { $_ ne 'en_US' } 
4898       FS::Locales->locales;
4899     },
4900     'option_sub'  => sub { FS::Locales->description(shift) },
4901   },
4902   
4903   {
4904     'key'         => 'translate-auto-insert',
4905     'section'     => '',
4906     'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values.  Do not turn this on unless translating the interface into a new language.',
4907     'type'        => 'select',
4908     'multiple'    => 1,
4909     'select_enum' => [ grep { $_ ne 'en_US' } FS::Locales::locales ],
4910   },
4911
4912   {
4913     'key'         => 'svc_acct-tower_sector',
4914     'section'     => '',
4915     'description' => 'Track tower and sector for svc_acct (account) services.',
4916     'type'        => 'checkbox',
4917   },
4918
4919   {
4920     'key'         => 'cdr-prerate',
4921     'section'     => 'telephony',
4922     'description' => 'Experimental feature to rate CDRs immediately, rather than waiting until invoice generation time.  Can reduce invoice generation time when processing lots of CDRs.  Currently works with "VoIP/telco CDR rating (standard)" price plans using "Phone numbers (svc_phone.phonenum)" CDR service matching, without any included minutes.',
4923     'type'        => 'checkbox',
4924   },
4925
4926   {
4927     'key'         => 'cdr-prerate-cdrtypenums',
4928     'section'     => 'telephony',
4929     'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
4930     'type'        => 'select-sub',
4931     'multiple'    => 1,
4932     'options_sub' => sub { require FS::Record;
4933                            require FS::cdr_type;
4934                            map { $_->cdrtypenum => $_->cdrtypename }
4935                                FS::Record::qsearch( 'cdr_type', 
4936                                                     {} #{ 'disabled' => '' }
4937                                                   );
4938                          },
4939     'option_sub'  => sub { require FS::Record;
4940                            require FS::cdr_type;
4941                            my $cdr_type = FS::Record::qsearchs(
4942                              'cdr_type', { 'cdrtypenum'=>shift } );
4943                            $cdr_type ? $cdr_type->cdrtypename : '';
4944                          },
4945   },
4946   
4947   {
4948     'key'         => 'brand-agent',
4949     'section'     => 'UI',
4950     'description' => 'Brand the backoffice interface (currently Help->About) using the company_name, company_url and logo.png configuration settings of the selected agent.  Typically used when selling or bundling hosted access to the backoffice interface.  NOTE: The AGPL software license has specific requirements for source code availability in this situation.',
4951     'type'        => 'select-agent',
4952   },
4953
4954   {
4955     'key'         => 'cust_class-tax_exempt',
4956     'section'     => 'billing',
4957     'description' => 'Control the tax exemption flag per customer class rather than per indivual customer.',
4958     'type'        => 'checkbox',
4959   },
4960
4961   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4962   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4963   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4964   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4965   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4966   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4967   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4968   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4969   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4970   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4971   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4972   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4973   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4974   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4975   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4976   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4977   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4978   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4979   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4980   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4981   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4982   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4983   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4984   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4985   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4986   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4987   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4988   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4989   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4990   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4991   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4992   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4993   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4994   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4995   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4996   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4997   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4998   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
4999   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5000   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5001   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
5002
5003 );
5004
5005 1;
5006