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