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