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