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