Add cust_attachment stuff
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($base_dir @config_items @base_items @card_types $DEBUG);
4 use Carp;
5 use IO::File;
6 use File::Basename;
7 use MIME::Base64;
8 use FS::ConfItem;
9 use FS::ConfDefaults;
10 use FS::Conf_compat17;
11 use FS::payby;
12 use FS::conf;
13 use FS::Record qw(qsearch qsearchs);
14 use FS::UID qw(dbh datasrc use_confcompat);
15
16 $base_dir = '%%%FREESIDE_CONF%%%';
17
18 $DEBUG = 0;
19
20 =head1 NAME
21
22 FS::Conf - Freeside configuration values
23
24 =head1 SYNOPSIS
25
26   use FS::Conf;
27
28   $conf = new FS::Conf;
29
30   $value = $conf->config('key');
31   @list  = $conf->config('key');
32   $bool  = $conf->exists('key');
33
34   $conf->touch('key');
35   $conf->set('key' => 'value');
36   $conf->delete('key');
37
38   @config_items = $conf->config_items;
39
40 =head1 DESCRIPTION
41
42 Read and write Freeside configuration values.  Keys currently map to filenames,
43 but this may change in the future.
44
45 =head1 METHODS
46
47 =over 4
48
49 =item new
50
51 Create a new configuration object.
52
53 =cut
54
55 sub new {
56   my($proto) = @_;
57   my($class) = ref($proto) || $proto;
58   my($self) = { 'base_dir' => $base_dir };
59   bless ($self, $class);
60 }
61
62 =item base_dir
63
64 Returns the base directory.  By default this is /usr/local/etc/freeside.
65
66 =cut
67
68 sub base_dir {
69   my($self) = @_;
70   my $base_dir = $self->{base_dir};
71   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
72   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
73   -r $base_dir or die "FATAL: Can't read $base_dir!";
74   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
75   $base_dir =~ /^(.*)$/;
76   $1;
77 }
78
79 =item config KEY [ AGENTNUM ]
80
81 Returns the configuration value or values (depending on context) for key.
82 The optional agent number selects an agent specific value instead of the
83 global default if one is present.
84
85 =cut
86
87 sub _usecompat {
88   my ($self, $method) = (shift, shift);
89   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
90     if use_confcompat;
91   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
92   $compat->$method(@_);
93 }
94
95 # needs a non _ name, called externally by config-view now (and elsewhere?)
96 sub _config {
97   my($self,$name,$agentnum)=@_;
98   my $hashref = { 'name' => $name };
99   $hashref->{agentnum} = $agentnum;
100   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
101   my $cv = FS::Record::qsearchs('conf', $hashref);
102   if (!$cv && defined($agentnum) && $agentnum) {
103     $hashref->{agentnum} = '';
104     $cv = FS::Record::qsearchs('conf', $hashref);
105   }
106   return $cv;
107 }
108
109 sub config {
110   my $self = shift;
111   return $self->_usecompat('config', @_) if use_confcompat;
112
113   my($name, $agentnum)=@_;
114
115   carp "FS::Conf->config($name, $agentnum) called"
116     if $DEBUG > 1;
117
118   my $cv = $self->_config($name, $agentnum) or return;
119
120   if ( wantarray ) {
121     my $v = $cv->value;
122     chomp $v;
123     (split "\n", $v, -1);
124   } else {
125     (split("\n", $cv->value))[0];
126   }
127 }
128
129 =item config_binary KEY [ AGENTNUM ]
130
131 Returns the exact scalar value for key.
132
133 =cut
134
135 sub config_binary {
136   my $self = shift;
137   return $self->_usecompat('config_binary', @_) if use_confcompat;
138
139   my($name,$agentnum)=@_;
140   my $cv = $self->_config($name, $agentnum) or return;
141   decode_base64($cv->value);
142 }
143
144 =item exists KEY [ AGENTNUM ]
145
146 Returns true if the specified key exists, even if the corresponding value
147 is undefined.
148
149 =cut
150
151 sub exists {
152   my $self = shift;
153   return $self->_usecompat('exists', @_) if use_confcompat;
154
155   my($name, $agentnum)=@_;
156
157   carp "FS::Conf->exists($name, $agentnum) called"
158     if $DEBUG > 1;
159
160   defined($self->_config($name, $agentnum));
161 }
162
163 =item config_orbase KEY SUFFIX
164
165 Returns the configuration value or values (depending on context) for 
166 KEY_SUFFIX, if it exists, otherwise for KEY
167
168 =cut
169
170 # outmoded as soon as we shift to agentnum based config values
171 # well, mostly.  still useful for e.g. late notices, etc. in that we want
172 # these to fall back to standard values
173 sub config_orbase {
174   my $self = shift;
175   return $self->_usecompat('config_orbase', @_) if use_confcompat;
176
177   my( $name, $suffix ) = @_;
178   if ( $self->exists("${name}_$suffix") ) {
179     $self->config("${name}_$suffix");
180   } else {
181     $self->config($name);
182   }
183 }
184
185 =item key_orbase KEY SUFFIX
186
187 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
188 KEY.  Useful for determining which exact configuration option is returned by
189 config_orbase.
190
191 =cut
192
193 sub key_orbase {
194   my $self = shift;
195   #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
196
197   my( $name, $suffix ) = @_;
198   if ( $self->exists("${name}_$suffix") ) {
199     "${name}_$suffix";
200   } else {
201     $name;
202   }
203 }
204
205 =item invoice_templatenames
206
207 Returns all possible invoice template names.
208
209 =cut
210
211 sub invoice_templatenames {
212   my( $self ) = @_;
213
214   my %templatenames = ();
215   foreach my $item ( $self->config_items ) {
216     foreach my $base ( @base_items ) {
217       my( $main, $ext) = split(/\./, $base);
218       $ext = ".$ext" if $ext;
219       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
220       $templatenames{$1}++;
221       }
222     }
223   }
224   
225   sort keys %templatenames;
226
227 }
228
229 =item touch KEY [ AGENT ];
230
231 Creates the specified configuration key if it does not exist.
232
233 =cut
234
235 sub touch {
236   my $self = shift;
237   return $self->_usecompat('touch', @_) if use_confcompat;
238
239   my($name, $agentnum) = @_;
240   unless ( $self->exists($name, $agentnum) ) {
241     $self->set($name, '', $agentnum);
242   }
243 }
244
245 =item set KEY VALUE [ AGENTNUM ];
246
247 Sets the specified configuration key to the given value.
248
249 =cut
250
251 sub set {
252   my $self = shift;
253   return $self->_usecompat('set', @_) if use_confcompat;
254
255   my($name, $value, $agentnum) = @_;
256   $value =~ /^(.*)$/s;
257   $value = $1;
258
259   warn "[FS::Conf] SET $name\n" if $DEBUG;
260
261   my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
262   my $new = new FS::conf { $old ? $old->hash 
263                                 : ('name' => $name, 'agentnum' => $agentnum)
264                          };
265   $new->value($value);
266
267   my $error;
268   if ($old) {
269     $error = $new->replace($old);
270   } else {
271     $error = $new->insert;
272   }
273
274   die "error setting configuration value: $error \n"
275     if $error;
276
277 }
278
279 =item set_binary KEY VALUE [ AGENTNUM ]
280
281 Sets the specified configuration key to an exact scalar value which
282 can be retrieved with config_binary.
283
284 =cut
285
286 sub set_binary {
287   my $self  = shift;
288   return if use_confcompat;
289
290   my($name, $value, $agentnum)=@_;
291   $self->set($name, encode_base64($value), $agentnum);
292 }
293
294 =item delete KEY [ AGENTNUM ];
295
296 Deletes the specified configuration key.
297
298 =cut
299
300 sub delete {
301   my $self = shift;
302   return $self->_usecompat('delete', @_) if use_confcompat;
303
304   my($name, $agentnum) = @_;
305   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
306     warn "[FS::Conf] DELETE $name\n";
307
308     my $oldAutoCommit = $FS::UID::AutoCommit;
309     local $FS::UID::AutoCommit = 0;
310     my $dbh = dbh;
311
312     my $error = $cv->delete;
313
314     if ( $error ) {
315       $dbh->rollback if $oldAutoCommit;
316       die "error setting configuration value: $error \n"
317     }
318
319     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
320
321   }
322 }
323
324 =item import_config_item CONFITEM DIR 
325
326   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
327 the database as a conf record (see L<FS::conf>).  Imports from the file
328 in the directory DIR.
329
330 =cut
331
332 sub import_config_item { 
333   my ($self,$item,$dir) = @_;
334   my $key = $item->key;
335   if ( -e "$dir/$key" && ! use_confcompat ) {
336     warn "Inserting $key\n" if $DEBUG;
337     local $/;
338     my $value = readline(new IO::File "$dir/$key");
339     if ($item->type =~ /^(binary|image)$/ ) {
340       $self->set_binary($key, $value);
341     }else{
342       $self->set($key, $value);
343     }
344   }else {
345     warn "Not inserting $key\n" if $DEBUG;
346   }
347 }
348
349 =item verify_config_item CONFITEM DIR 
350
351   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
352 the database to the legacy file value in DIR.
353
354 =cut
355
356 sub verify_config_item { 
357   return '' if use_confcompat;
358   my ($self,$item,$dir) = @_;
359   my $key = $item->key;
360   my $type = $item->type;
361
362   my $compat = new FS::Conf_compat17 $dir;
363   my $error = '';
364   
365   $error .= "$key fails existential comparison; "
366     if $self->exists($key) xor $compat->exists($key);
367
368   if ( $type !~ /^(binary|image)$/ ) {
369
370     {
371       no warnings;
372       $error .= "$key fails scalar comparison; "
373         unless scalar($self->config($key)) eq scalar($compat->config($key));
374     }
375
376     my (@new) = $self->config($key);
377     my (@old) = $compat->config($key);
378     unless ( scalar(@new) == scalar(@old)) { 
379       $error .= "$key fails list comparison; ";
380     }else{
381       my $r=1;
382       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
383       $error .= "$key fails list comparison; "
384         unless $r;
385     }
386
387   } else {
388
389     $error .= "$key fails binary comparison; "
390       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
391
392   }
393
394 #remove deprecated config on our own terms, not freeside-upgrade's
395 #  if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
396 #    my $proto;
397 #    for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
398 #    unless ($proto->key eq $key) { 
399 #      warn "removed config item $error\n" if $DEBUG;
400 #      $error = '';
401 #    }
402 #  }
403
404   $error;
405 }
406
407 #item _orbase_items OPTIONS
408 #
409 #Returns all of the possible extensible config items as FS::ConfItem objects.
410 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
411 #options include
412 #
413 # dir - the directory to search for configuration option files instead
414 #       of using the conf records in the database
415 #
416 #cut
417
418 #quelle kludge
419 sub _orbase_items {
420   my ($self, %opt) = @_; 
421
422   my $listmaker = sub { my $v = shift;
423                         $v =~ s/_/!_/g;
424                         if ( $v =~ /\.(png|eps)$/ ) {
425                           $v =~ s/\./!_%./;
426                         }else{
427                           $v .= '!_%';
428                         }
429                         map { $_->name }
430                           FS::Record::qsearch( 'conf',
431                                                {},
432                                                '',
433                                                "WHERE name LIKE '$v' ESCAPE '!'"
434                                              );
435                       };
436
437   if (exists($opt{dir}) && $opt{dir}) {
438     $listmaker = sub { my $v = shift;
439                        if ( $v =~ /\.(png|eps)$/ ) {
440                          $v =~ s/\./_*./;
441                        }else{
442                          $v .= '_*';
443                        }
444                        map { basename $_ } glob($opt{dir}. "/$v" );
445                      };
446   }
447
448   ( map { 
449           my $proto;
450           my $base = $_;
451           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
452           die "don't know about $base items" unless $proto->key eq $base;
453
454           map { new FS::ConfItem { 
455                   'key'         => $_,
456                   'base_key'    => $proto->key,
457                   'section'     => $proto->section,
458                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
459                   'type'        => $proto->type,
460                 };
461               } &$listmaker($base);
462         } @base_items,
463   );
464 }
465
466 =item config_items
467
468 Returns all of the possible global/default configuration items as
469 FS::ConfItem objects.  See L<FS::ConfItem>.
470
471 =cut
472
473 sub config_items {
474   my $self = shift; 
475   return $self->_usecompat('config_items', @_) if use_confcompat;
476
477   ( @config_items, $self->_orbase_items(@_) );
478 }
479
480 =back
481
482 =head1 SUBROUTINES
483
484 =over 4
485
486 =item init-config DIR
487
488 Imports the configuration items from DIR (1.7 compatible)
489 to conf records in the database.
490
491 =cut
492
493 sub init_config {
494   my $dir = shift;
495
496   {
497     local $FS::UID::use_confcompat = 0;
498     my $conf = new FS::Conf;
499     foreach my $item ( $conf->config_items(dir => $dir) ) {
500       $conf->import_config_item($item, $dir);
501       my $error = $conf->verify_config_item($item, $dir);
502       return $error if $error;
503     }
504   
505     my $compat = new FS::Conf_compat17 $dir;
506     foreach my $item ( $compat->config_items ) {
507       my $error = $conf->verify_config_item($item, $dir);
508       return $error if $error;
509     }
510   }
511
512   $FS::UID::use_confcompat = 0;
513   '';  #success
514 }
515
516 =back
517
518 =head1 BUGS
519
520 If this was more than just crud that will never be useful outside Freeside I'd
521 worry that config_items is freeside-specific and icky.
522
523 =head1 SEE ALSO
524
525 "Configuration" in the web interface (config/config.cgi).
526
527 =cut
528
529 #Business::CreditCard
530 @card_types = (
531   "VISA card",
532   "MasterCard",
533   "Discover card",
534   "American Express card",
535   "Diner's Club/Carte Blanche",
536   "enRoute",
537   "JCB",
538   "BankCard",
539   "Switch",
540   "Solo",
541 );
542
543 @base_items = qw (
544                    invoice_template
545                    invoice_latex
546                    invoice_latexreturnaddress
547                    invoice_latexfooter
548                    invoice_latexsmallfooter
549                    invoice_latexnotes
550                    invoice_latexcoupon
551                    invoice_html
552                    invoice_htmlreturnaddress
553                    invoice_htmlfooter
554                    invoice_htmlnotes
555                    logo.png
556                    logo.eps
557                  );
558
559 @config_items = map { new FS::ConfItem $_ } (
560
561   {
562     'key'         => 'address',
563     'section'     => 'deprecated',
564     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
565     'type'        => 'text',
566   },
567
568   {
569     'key'         => 'alert_expiration',
570     'section'     => 'billing',
571     'description' => 'Enable alerts about billing method expiration.',
572     'type'        => 'checkbox',
573     'per_agent'   => 1,
574   },
575
576   {
577     'key'         => 'alerter_template',
578     'section'     => 'billing',
579     'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
580     'type'        => 'textarea',
581     'per_agent'   => 1,
582   },
583
584   {
585     'key'         => 'apacheip',
586     #not actually deprecated yet
587     #'section'     => 'deprecated',
588     #'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',
589     'section'     => '',
590     'description' => 'IP address to assign to new virtual hosts',
591     'type'        => 'text',
592   },
593
594   {
595     'key'         => 'encryption',
596     'section'     => 'billing',
597     'description' => 'Enable encryption of credit cards.',
598     'type'        => 'checkbox',
599   },
600
601   {
602     'key'         => 'encryptionmodule',
603     'section'     => 'billing',
604     'description' => 'Use which module for encryption?',
605     'type'        => 'text',
606   },
607
608   {
609     'key'         => 'encryptionpublickey',
610     'section'     => 'billing',
611     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
612     'type'        => 'textarea',
613   },
614
615   {
616     'key'         => 'encryptionprivatekey',
617     'section'     => 'billing',
618     '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.',
619     'type'        => 'textarea',
620   },
621
622   {
623     'key'         => 'business-onlinepayment',
624     'section'     => 'billing',
625     '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.',
626     'type'        => 'textarea',
627   },
628
629   {
630     'key'         => 'business-onlinepayment-ach',
631     'section'     => 'billing',
632     '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.',
633     'type'        => 'textarea',
634   },
635
636   {
637     'key'         => 'business-onlinepayment-namespace',
638     'section'     => 'billing',
639     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
640     'type'        => 'select',
641     'select_hash' => [
642                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
643                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
644                      ],
645   },
646
647   {
648     'key'         => 'business-onlinepayment-description',
649     'section'     => 'billing',
650     '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)',
651     'type'        => 'text',
652   },
653
654   {
655     'key'         => 'business-onlinepayment-email-override',
656     'section'     => 'billing',
657     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
658     'type'        => 'text',
659   },
660
661   {
662     'key'         => 'business-onlinepayment-email_customer',
663     'section'     => 'billing',
664     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
665     'type'        => 'checkbox',
666   },
667
668   {
669     'key'         => 'countrydefault',
670     'section'     => 'UI',
671     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
672     'type'        => 'text',
673   },
674
675   {
676     'key'         => 'date_format',
677     'section'     => 'UI',
678     'description' => 'Format for displaying dates',
679     'type'        => 'select',
680     'select_hash' => [
681                        '%m/%d/%Y' => 'MM/DD/YYYY',
682                        '%Y/%m/%d' => 'YYYY/MM/DD',
683                      ],
684   },
685
686   {
687     'key'         => 'deletecustomers',
688     'section'     => 'UI',
689     'description' => 'Enable customer deletions.  Be very careful!  Deleting a customer will remove all traces that this 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.',
690     'type'        => 'checkbox',
691   },
692
693   {
694     'key'         => 'deletepayments',
695     'section'     => 'billing',
696     '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.',
697     'type'        => [qw( checkbox text )],
698   },
699
700   {
701     'key'         => 'deletecredits',
702     #not actually deprecated yet
703     #'section'     => 'deprecated',
704     #'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.',
705     'section'     => '',
706     'description' => 'One or more comma-separated email addresses to be notified when a credit is deleted.',
707     'type'        => [qw( checkbox text )],
708   },
709
710   {
711     'key'         => 'deleterefunds',
712     'section'     => 'billing',
713     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
714     'type'        => 'checkbox',
715   },
716
717   {
718     'key'         => 'unapplypayments',
719     'section'     => 'deprecated',
720     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable "unapplication" of unclosed payments.',
721     'type'        => 'checkbox',
722   },
723
724   {
725     'key'         => 'unapplycredits',
726     'section'     => 'deprecated',
727     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to nable "unapplication" of unclosed credits.',
728     'type'        => 'checkbox',
729   },
730
731   {
732     'key'         => 'dirhash',
733     'section'     => 'shell',
734     '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>',
735     'type'        => 'text',
736   },
737
738   {
739     'key'         => 'disable_cust_attachment',
740     'section'     => '',
741     'description' => 'Disable customer file attachments',
742     'type'        => 'checkbox',
743   },
744
745   {
746     'key'         => 'max_attachment_size',
747     'section'     => '',
748     'description' => 'Maximum size for customer file attachments (leave blank for unlimited)',
749     'type'        => 'text',
750   },
751
752   {
753     'key'         => 'disable_customer_referrals',
754     'section'     => 'UI',
755     'description' => 'Disable new customer-to-customer referrals in the web interface',
756     'type'        => 'checkbox',
757   },
758
759   {
760     'key'         => 'editreferrals',
761     'section'     => 'UI',
762     'description' => 'Enable advertising source modification for existing customers',
763     'type'       => 'checkbox',
764   },
765
766   {
767     'key'         => 'emailinvoiceonly',
768     'section'     => 'billing',
769     'description' => 'Disables postal mail invoices',
770     'type'       => 'checkbox',
771   },
772
773   {
774     'key'         => 'disablepostalinvoicedefault',
775     'section'     => 'billing',
776     '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>.',
777     'type'       => 'checkbox',
778   },
779
780   {
781     'key'         => 'emailinvoiceauto',
782     'section'     => 'billing',
783     'description' => 'Automatically adds new accounts to the email invoice list',
784     'type'       => 'checkbox',
785   },
786
787   {
788     'key'         => 'emailinvoiceautoalways',
789     'section'     => 'billing',
790     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
791     'type'       => 'checkbox',
792   },
793
794   {
795     'key'         => 'exclude_ip_addr',
796     'section'     => '',
797     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
798     'type'        => 'textarea',
799   },
800   
801   {
802     'key'         => 'auto_router',
803     'section'     => '',
804     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
805     'type'        => 'checkbox',
806   },
807   
808   {
809     'key'         => 'hidecancelledpackages',
810     'section'     => 'UI',
811     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
812     'type'        => 'checkbox',
813   },
814
815   {
816     'key'         => 'hidecancelledcustomers',
817     'section'     => 'UI',
818     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
819     'type'        => 'checkbox',
820   },
821
822   {
823     'key'         => 'home',
824     'section'     => 'shell',
825     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
826     'type'        => 'text',
827   },
828
829   {
830     'key'         => 'invoice_from',
831     'section'     => 'required',
832     'description' => 'Return address on email invoices',
833     'type'        => 'text',
834     'per_agent'   => 1,
835   },
836
837   {
838     'key'         => 'invoice_subject',
839     'section'     => 'billing',
840     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
841     'type'        => 'text',
842     'per_agent'   => 1,
843   },
844
845   {
846     'key'         => 'invoice_template',
847     'section'     => 'billing',
848     '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:1.7:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
849     'type'        => 'textarea',
850   },
851
852   {
853     'key'         => 'invoice_html',
854     'section'     => 'billing',
855     'description' => 'Optional HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
856
857     'type'        => 'textarea',
858   },
859
860   {
861     'key'         => 'invoice_htmlnotes',
862     'section'     => 'billing',
863     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
864     'type'        => 'textarea',
865     'per_agent'   => 1,
866   },
867
868   {
869     'key'         => 'invoice_htmlfooter',
870     'section'     => 'billing',
871     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
872     'type'        => 'textarea',
873     'per_agent'   => 1,
874   },
875
876   {
877     'key'         => 'invoice_htmlreturnaddress',
878     'section'     => 'billing',
879     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
880     'type'        => 'textarea',
881   },
882
883   {
884     'key'         => 'invoice_latex',
885     'section'     => 'billing',
886     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
887     'type'        => 'textarea',
888   },
889
890   {
891     'key'         => 'invoice_latexnotes',
892     'section'     => 'billing',
893     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
894     'type'        => 'textarea',
895     'per_agent'   => 1,
896   },
897
898   {
899     'key'         => 'invoice_latexfooter',
900     'section'     => 'billing',
901     'description' => 'Footer for LaTeX typeset PostScript invoices.',
902     'type'        => 'textarea',
903     'per_agent'   => 1,
904   },
905
906   {
907     'key'         => 'invoice_latexcoupon',
908     'section'     => 'billing',
909     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
910     'type'        => 'textarea',
911     'per_agent'   => 1,
912   },
913
914   {
915     'key'         => 'invoice_latexreturnaddress',
916     'section'     => 'billing',
917     'description' => 'Return address for LaTeX typeset PostScript invoices.',
918     'type'        => 'textarea',
919   },
920
921   {
922     'key'         => 'invoice_latexsmallfooter',
923     'section'     => 'billing',
924     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
925     'type'        => 'textarea',
926     'per_agent'   => 1,
927   },
928
929   {
930     'key'         => 'invoice_email_pdf',
931     'section'     => 'billing',
932     '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.',
933     'type'        => 'checkbox'
934   },
935
936   {
937     'key'         => 'invoice_email_pdf_note',
938     'section'     => 'billing',
939     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
940     'type'        => 'textarea'
941   },
942
943
944   { 
945     'key'         => 'invoice_default_terms',
946     'section'     => 'billing',
947     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
948     'type'        => 'select',
949     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
950   },
951
952   { 
953     'key'         => 'invoice_sections',
954     'section'     => 'billing',
955     'description' => 'Split invoice into sections and label according to package category when enabled.',
956     'type'        => 'checkbox',
957   },
958
959   { 
960     'key'         => 'separate_usage',
961     'section'     => 'billing',
962     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
963     'type'        => 'checkbox',
964   },
965
966   {
967     'key'         => 'invoice_send_receipts',
968     'section'     => 'deprecated',
969     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
970     'type'        => 'checkbox',
971   },
972
973   {
974     'key'         => 'payment_receipt_email',
975     'section'     => 'billing',
976     'description' => 'Template file for payment receipts.  Payment receipts are sent to the customer email invoice destination(s) when a payment is received.  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>$date</code> <li><code>$name</code> <li><code>$paynum</code> - Freeside payment number <li><code>$paid</code> - Amount of payment <li><code>$payby</code> - Payment type (Card, Check, Electronic check, etc.) <li><code>$payinfo</code> - Masked credit card number or check number <li><code>$balance</code> - New balance</ul>',
977     'type'        => [qw( checkbox textarea )],
978   },
979
980   {
981     'key'         => 'lpr',
982     'section'     => 'required',
983     'description' => 'Print command for paper invoices, for example `lpr -h\'',
984     'type'        => 'text',
985   },
986
987   {
988     'key'         => 'lpr-postscript_prefix',
989     'section'     => 'billing',
990     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
991     'type'        => 'text',
992   },
993
994   {
995     'key'         => 'lpr-postscript_suffix',
996     'section'     => 'billing',
997     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
998     'type'        => 'text',
999   },
1000
1001   {
1002     'key'         => 'money_char',
1003     'section'     => '',
1004     'description' => 'Currency symbol - defaults to `$\'',
1005     'type'        => 'text',
1006   },
1007
1008   {
1009     'key'         => 'defaultrecords',
1010     'section'     => 'BIND',
1011     'description' => 'DNS entries to add automatically when creating a domain',
1012     'type'        => 'editlist',
1013     'editlist_parts' => [ { type=>'text' },
1014                           { type=>'immutable', value=>'IN' },
1015                           { type=>'select',
1016                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
1017                           { type=> 'text' }, ],
1018   },
1019
1020   {
1021     'key'         => 'passwordmin',
1022     'section'     => 'password',
1023     'description' => 'Minimum password length (default 6)',
1024     'type'        => 'text',
1025   },
1026
1027   {
1028     'key'         => 'passwordmax',
1029     'section'     => 'password',
1030     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
1031     'type'        => 'text',
1032   },
1033
1034   {
1035     'key' => 'password-noampersand',
1036     'section' => 'password',
1037     'description' => 'Disallow ampersands in passwords',
1038     'type' => 'checkbox',
1039   },
1040
1041   {
1042     'key' => 'password-noexclamation',
1043     'section' => 'password',
1044     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1045     'type' => 'checkbox',
1046   },
1047
1048   {
1049     'key'         => 'referraldefault',
1050     'section'     => 'UI',
1051     'description' => 'Default referral, specified by refnum',
1052     'type'        => 'text',
1053   },
1054
1055 #  {
1056 #    'key'         => 'registries',
1057 #    'section'     => 'required',
1058 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1059 #  },
1060
1061   {
1062     'key'         => 'report_template',
1063     'section'     => 'deprecated',
1064     'description' => 'Deprecated template file for reports.',
1065     'type'        => 'textarea',
1066   },
1067
1068   {
1069     'key'         => 'maxsearchrecordsperpage',
1070     'section'     => 'UI',
1071     'description' => 'If set, number of search records to return per page.',
1072     'type'        => 'text',
1073   },
1074
1075   {
1076     'key'         => 'session-start',
1077     'section'     => 'session',
1078     '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.',
1079     'type'        => 'text',
1080   },
1081
1082   {
1083     'key'         => 'session-stop',
1084     'section'     => 'session',
1085     '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.',
1086     'type'        => 'text',
1087   },
1088
1089   {
1090     'key'         => 'shells',
1091     'section'     => 'shell',
1092     '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.',
1093     'type'        => 'textarea',
1094   },
1095
1096   {
1097     'key'         => 'showpasswords',
1098     'section'     => 'UI',
1099     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1100     'type'        => 'checkbox',
1101   },
1102
1103   {
1104     'key'         => 'signupurl',
1105     'section'     => 'UI',
1106     '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:1.7: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',
1107     'type'        => 'text',
1108   },
1109
1110   {
1111     'key'         => 'smtpmachine',
1112     'section'     => 'required',
1113     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1114     'type'        => 'text',
1115   },
1116
1117   {
1118     'key'         => 'soadefaultttl',
1119     'section'     => 'BIND',
1120     'description' => 'SOA default TTL for new domains.',
1121     'type'        => 'text',
1122   },
1123
1124   {
1125     'key'         => 'soaemail',
1126     'section'     => 'BIND',
1127     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1128     'type'        => 'text',
1129   },
1130
1131   {
1132     'key'         => 'soaexpire',
1133     'section'     => 'BIND',
1134     'description' => 'SOA expire for new domains',
1135     'type'        => 'text',
1136   },
1137
1138   {
1139     'key'         => 'soamachine',
1140     'section'     => 'BIND',
1141     'description' => 'SOA machine for new domains, with trailing `.\'',
1142     'type'        => 'text',
1143   },
1144
1145   {
1146     'key'         => 'soarefresh',
1147     'section'     => 'BIND',
1148     'description' => 'SOA refresh for new domains',
1149     'type'        => 'text',
1150   },
1151
1152   {
1153     'key'         => 'soaretry',
1154     'section'     => 'BIND',
1155     'description' => 'SOA retry for new domains',
1156     'type'        => 'text',
1157   },
1158
1159   {
1160     'key'         => 'statedefault',
1161     'section'     => 'UI',
1162     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1163     'type'        => 'text',
1164   },
1165
1166   {
1167     'key'         => 'unsuspendauto',
1168     'section'     => 'billing',
1169     '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',
1170     'type'        => 'checkbox',
1171   },
1172
1173   {
1174     'key'         => 'unsuspend-always_adjust_next_bill_date',
1175     'section'     => 'billing',
1176     '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.',
1177     'type'        => 'checkbox',
1178   },
1179
1180   {
1181     'key'         => 'usernamemin',
1182     'section'     => 'username',
1183     'description' => 'Minimum username length (default 2)',
1184     'type'        => 'text',
1185   },
1186
1187   {
1188     'key'         => 'usernamemax',
1189     'section'     => 'username',
1190     'description' => 'Maximum username length',
1191     'type'        => 'text',
1192   },
1193
1194   {
1195     'key'         => 'username-ampersand',
1196     'section'     => 'username',
1197     '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.',
1198     'type'        => 'checkbox',
1199   },
1200
1201   {
1202     'key'         => 'username-letter',
1203     'section'     => 'username',
1204     'description' => 'Usernames must contain at least one letter',
1205     'type'        => 'checkbox',
1206     'per_agent'   => 1,
1207   },
1208
1209   {
1210     'key'         => 'username-letterfirst',
1211     'section'     => 'username',
1212     'description' => 'Usernames must start with a letter',
1213     'type'        => 'checkbox',
1214   },
1215
1216   {
1217     'key'         => 'username-noperiod',
1218     'section'     => 'username',
1219     'description' => 'Disallow periods in usernames',
1220     'type'        => 'checkbox',
1221   },
1222
1223   {
1224     'key'         => 'username-nounderscore',
1225     'section'     => 'username',
1226     'description' => 'Disallow underscores in usernames',
1227     'type'        => 'checkbox',
1228   },
1229
1230   {
1231     'key'         => 'username-nodash',
1232     'section'     => 'username',
1233     'description' => 'Disallow dashes in usernames',
1234     'type'        => 'checkbox',
1235   },
1236
1237   {
1238     'key'         => 'username-uppercase',
1239     'section'     => 'username',
1240     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1241     'type'        => 'checkbox',
1242   },
1243
1244   { 
1245     'key'         => 'username-percent',
1246     'section'     => 'username',
1247     'description' => 'Allow the percent character (%) in usernames.',
1248     'type'        => 'checkbox',
1249   },
1250
1251   { 
1252     'key'         => 'username-colon',
1253     'section'     => 'username',
1254     'description' => 'Allow the colon character (:) in usernames.',
1255     'type'        => 'checkbox',
1256   },
1257
1258   {
1259     'key'         => 'safe-part_bill_event',
1260     'section'     => 'UI',
1261     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1262     'type'        => 'checkbox',
1263   },
1264
1265   {
1266     'key'         => 'show_ss',
1267     'section'     => 'UI',
1268     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
1269     'type'        => 'checkbox',
1270   },
1271
1272   {
1273     'key'         => 'show_stateid',
1274     'section'     => 'UI',
1275     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
1276     'type'        => 'checkbox',
1277   },
1278
1279   {
1280     'key'         => 'show_bankstate',
1281     'section'     => 'UI',
1282     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
1283     'type'        => 'checkbox',
1284   },
1285
1286   { 
1287     'key'         => 'agent_defaultpkg',
1288     'section'     => 'UI',
1289     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1290     'type'        => 'checkbox',
1291   },
1292
1293   {
1294     'key'         => 'legacy_link',
1295     'section'     => 'UI',
1296     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1297     'type'        => 'checkbox',
1298   },
1299
1300   {
1301     'key'         => 'legacy_link-steal',
1302     'section'     => 'UI',
1303     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1304     'type'        => 'checkbox',
1305   },
1306
1307   {
1308     'key'         => 'queue_dangerous_controls',
1309     'section'     => 'UI',
1310     '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.',
1311     'type'        => 'checkbox',
1312   },
1313
1314   {
1315     'key'         => 'security_phrase',
1316     'section'     => 'password',
1317     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1318     'type'        => 'checkbox',
1319   },
1320
1321   {
1322     'key'         => 'locale',
1323     'section'     => 'UI',
1324     'description' => 'Message locale',
1325     'type'        => 'select',
1326     'select_enum' => [ qw(en_US) ],
1327   },
1328
1329   {
1330     'key'         => 'signup_server-payby',
1331     'section'     => '',
1332     'description' => 'Acceptable payment types for the signup server',
1333     'type'        => 'selectmultiple',
1334     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1335   },
1336
1337   {
1338     'key'         => 'signup_server-default_agentnum',
1339     'section'     => '',
1340     'description' => 'Default agent for the signup server',
1341     'type'        => 'select-sub',
1342     'options_sub' => sub { require FS::Record;
1343                            require FS::agent;
1344                            map { $_->agentnum => $_->agent }
1345                                FS::Record::qsearch('agent', { disabled=>'' } );
1346                          },
1347     'option_sub'  => sub { require FS::Record;
1348                            require FS::agent;
1349                            my $agent = FS::Record::qsearchs(
1350                              'agent', { 'agentnum'=>shift }
1351                            );
1352                            $agent ? $agent->agent : '';
1353                          },
1354   },
1355
1356   {
1357     'key'         => 'signup_server-default_refnum',
1358     'section'     => '',
1359     'description' => 'Default advertising source for the signup server',
1360     'type'        => 'select-sub',
1361     'options_sub' => sub { require FS::Record;
1362                            require FS::part_referral;
1363                            map { $_->refnum => $_->referral }
1364                                FS::Record::qsearch( 'part_referral', 
1365                                                     { 'disabled' => '' }
1366                                                   );
1367                          },
1368     'option_sub'  => sub { require FS::Record;
1369                            require FS::part_referral;
1370                            my $part_referral = FS::Record::qsearchs(
1371                              'part_referral', { 'refnum'=>shift } );
1372                            $part_referral ? $part_referral->referral : '';
1373                          },
1374   },
1375
1376   {
1377     'key'         => 'signup_server-default_pkgpart',
1378     'section'     => '',
1379     'description' => 'Default package for the signup server',
1380     'type'        => 'select-sub',
1381     'options_sub' => sub { require FS::Record;
1382                            require FS::part_pkg;
1383                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1384                                FS::Record::qsearch( 'part_pkg',
1385                                                     { 'disabled' => ''}
1386                                                   );
1387                          },
1388     'option_sub'  => sub { require FS::Record;
1389                            require FS::part_pkg;
1390                            my $part_pkg = FS::Record::qsearchs(
1391                              'part_pkg', { 'pkgpart'=>shift }
1392                            );
1393                            $part_pkg
1394                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1395                              : '';
1396                          },
1397   },
1398
1399   {
1400     'key'         => 'signup_server-default_svcpart',
1401     'section'     => '',
1402     'description' => 'Default svcpart for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
1403     'type'        => 'select-sub',
1404     'options_sub' => sub { require FS::Record;
1405                            require FS::part_svc;
1406                            map { $_->svcpart => $_->svc }
1407                                FS::Record::qsearch( 'part_svc',
1408                                                     { 'disabled' => ''}
1409                                                   );
1410                          },
1411     'option_sub'  => sub { require FS::Record;
1412                            require FS::part_svc;
1413                            my $part_svc = FS::Record::qsearchs(
1414                              'part_svc', { 'svcpart'=>shift }
1415                            );
1416                            $part_svc ? $part_svc->svc : '';
1417                          },
1418   },
1419
1420   {
1421     'key'         => 'signup_server-service',
1422     'section'     => '',
1423     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
1424     'type'        => 'select',
1425     'select_hash' => [
1426                        'svc_acct'  => 'Account (svc_acct)',
1427                        'svc_phone' => 'Phone number (svc_phone)',
1428                      ],
1429   },
1430
1431   {
1432     'key'         => 'selfservice_server-base_url',
1433     'section'     => '',
1434     '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.',
1435     'type'        => 'text',
1436   },
1437
1438   {
1439     'key'         => 'show-msgcat-codes',
1440     'section'     => 'UI',
1441     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1442     'type'        => 'checkbox',
1443   },
1444
1445   {
1446     'key'         => 'signup_server-realtime',
1447     'section'     => '',
1448     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1449     'type'        => 'checkbox',
1450   },
1451   {
1452     'key'         => 'signup_server-classnum2',
1453     'section'     => '',
1454     'description' => 'Package Class for first optional purchase',
1455     'type'        => 'select-sub',
1456     'options_sub' => sub { require FS::Record;
1457                            require FS::pkg_class;
1458                            map { $_->classnum => $_->classname }
1459                                FS::Record::qsearch('pkg_class', {} );
1460                          },
1461     'option_sub'  => sub { require FS::Record;
1462                            require FS::pkg_class;
1463                            my $pkg_class = FS::Record::qsearchs(
1464                              'pkg_class', { 'classnum'=>shift }
1465                            );
1466                            $pkg_class ? $pkg_class->classname : '';
1467                          },
1468   },
1469
1470   {
1471     'key'         => 'signup_server-classnum3',
1472     'section'     => '',
1473     'description' => 'Package Class for second optional purchase',
1474     'type'        => 'select-sub',
1475     'options_sub' => sub { require FS::Record;
1476                            require FS::pkg_class;
1477                            map { $_->classnum => $_->classname }
1478                                FS::Record::qsearch('pkg_class', {} );
1479                          },
1480     'option_sub'  => sub { require FS::Record;
1481                            require FS::pkg_class;
1482                            my $pkg_class = FS::Record::qsearchs(
1483                              'pkg_class', { 'classnum'=>shift }
1484                            );
1485                            $pkg_class ? $pkg_class->classname : '';
1486                          },
1487   },
1488
1489   {
1490     'key'         => 'backend-realtime',
1491     'section'     => '',
1492     'description' => 'Run billing for backend signups immediately.',
1493     'type'        => 'checkbox',
1494   },
1495
1496   {
1497     'key'         => 'declinetemplate',
1498     'section'     => 'billing',
1499     'description' => 'Template file for credit card decline emails.',
1500     'type'        => 'textarea',
1501   },
1502
1503   {
1504     'key'         => 'emaildecline',
1505     'section'     => 'billing',
1506     'description' => 'Enable emailing of credit card decline notices.',
1507     'type'        => 'checkbox',
1508   },
1509
1510   {
1511     'key'         => 'emaildecline-exclude',
1512     'section'     => 'billing',
1513     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1514     'type'        => 'textarea',
1515   },
1516
1517   {
1518     'key'         => 'cancelmessage',
1519     'section'     => 'billing',
1520     'description' => 'Template file for cancellation emails.',
1521     'type'        => 'textarea',
1522   },
1523
1524   {
1525     'key'         => 'cancelsubject',
1526     'section'     => 'billing',
1527     'description' => 'Subject line for cancellation emails.',
1528     'type'        => 'text',
1529   },
1530
1531   {
1532     'key'         => 'emailcancel',
1533     'section'     => 'billing',
1534     'description' => 'Enable emailing of cancellation notices.  Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
1535     'type'        => 'checkbox',
1536   },
1537
1538   {
1539     'key'         => 'bill_usage_on_cancel',
1540     'section'     => 'billing',
1541     '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.',
1542     'type'        => 'checkbox',
1543   },
1544
1545   {
1546     'key'         => 'require_cardname',
1547     'section'     => 'billing',
1548     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1549     'type'        => 'checkbox',
1550   },
1551
1552   {
1553     'key'         => 'enable_taxclasses',
1554     'section'     => 'billing',
1555     'description' => 'Enable per-package tax classes',
1556     'type'        => 'checkbox',
1557   },
1558
1559   {
1560     'key'         => 'require_taxclasses',
1561     'section'     => 'billing',
1562     'description' => 'Require a taxclass to be entered for every package',
1563     'type'        => 'checkbox',
1564   },
1565
1566   {
1567     'key'         => 'enable_taxproducts',
1568     'section'     => 'billing',
1569     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
1570     'type'        => 'checkbox',
1571   },
1572
1573   {
1574     'key'         => 'taxdatadirectdownload',
1575     'section'     => 'billing',  #well
1576     'description' => 'Enable downloading tax data directly from the vendor site',
1577     'type'        => 'checkbox',
1578   },
1579
1580   {
1581     'key'         => 'ignore_incalculable_taxes',
1582     'section'     => 'billing',
1583     'description' => 'Prefer to invoice without tax over not billing at all',
1584     'type'        => 'checkbox',
1585   },
1586
1587   {
1588     'key'         => 'welcome_email',
1589     'section'     => '',
1590     '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.  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></ul>',
1591     'type'        => 'textarea',
1592     'per_agent'   => 1,
1593   },
1594
1595   {
1596     'key'         => 'welcome_email-from',
1597     'section'     => '',
1598     'description' => 'From: address header for welcome email',
1599     'type'        => 'text',
1600     'per_agent'   => 1,
1601   },
1602
1603   {
1604     'key'         => 'welcome_email-subject',
1605     'section'     => '',
1606     'description' => 'Subject: header for welcome email',
1607     'type'        => 'text',
1608     'per_agent'   => 1,
1609   },
1610   
1611   {
1612     'key'         => 'welcome_email-mimetype',
1613     'section'     => '',
1614     'description' => 'MIME type for welcome email',
1615     'type'        => 'select',
1616     'select_enum' => [ 'text/plain', 'text/html' ],
1617     'per_agent'   => 1,
1618   },
1619
1620   {
1621     'key'         => 'welcome_letter',
1622     'section'     => '',
1623     '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>',
1624     'type'        => 'textarea',
1625   },
1626
1627   {
1628     'key'         => 'warning_email',
1629     'section'     => '',
1630     '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>',
1631     'type'        => 'textarea',
1632   },
1633
1634   {
1635     'key'         => 'warning_email-from',
1636     'section'     => '',
1637     'description' => 'From: address header for warning email',
1638     'type'        => 'text',
1639   },
1640
1641   {
1642     'key'         => 'warning_email-cc',
1643     'section'     => '',
1644     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1645     'type'        => 'text',
1646   },
1647
1648   {
1649     'key'         => 'warning_email-subject',
1650     'section'     => '',
1651     'description' => 'Subject: header for warning email',
1652     'type'        => 'text',
1653   },
1654   
1655   {
1656     'key'         => 'warning_email-mimetype',
1657     'section'     => '',
1658     'description' => 'MIME type for warning email',
1659     'type'        => 'select',
1660     'select_enum' => [ 'text/plain', 'text/html' ],
1661   },
1662
1663   {
1664     'key'         => 'payby',
1665     'section'     => 'billing',
1666     'description' => 'Available payment types.',
1667     'type'        => 'selectmultiple',
1668     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1669   },
1670
1671   {
1672     'key'         => 'payby-default',
1673     'section'     => 'UI',
1674     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1675     'type'        => 'select',
1676     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1677   },
1678
1679   {
1680     'key'         => 'paymentforcedtobatch',
1681     'section'     => 'deprecated',
1682     '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.',
1683     'type'        => 'checkbox',
1684   },
1685
1686   {
1687     'key'         => 'svc_acct-notes',
1688     'section'     => 'UI',
1689     'description' => 'Extra HTML to be displayed on the Account View screen.',
1690     'type'        => 'textarea',
1691   },
1692
1693   {
1694     'key'         => 'radius-password',
1695     'section'     => '',
1696     'description' => 'RADIUS attribute for plain-text passwords.',
1697     'type'        => 'select',
1698     'select_enum' => [ 'Password', 'User-Password' ],
1699   },
1700
1701   {
1702     'key'         => 'radius-ip',
1703     'section'     => '',
1704     'description' => 'RADIUS attribute for IP addresses.',
1705     'type'        => 'select',
1706     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1707   },
1708
1709   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
1710   {
1711     'key'         => 'radius-chillispot-max',
1712     'section'     => '',
1713     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
1714     'type'        => 'checkbox',
1715   },
1716
1717   {
1718     'key'         => 'svc_acct-alldomains',
1719     'section'     => '',
1720     '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.',
1721     'type'        => 'checkbox',
1722   },
1723
1724   {
1725     'key'         => 'dump-scpdest',
1726     'section'     => '',
1727     'description' => 'destination for scp database dumps: user@host:/path',
1728     'type'        => 'text',
1729   },
1730
1731   {
1732     'key'         => 'dump-pgpid',
1733     'section'     => '',
1734     '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.",
1735     'type'        => 'text',
1736   },
1737
1738   {
1739     'key'         => 'users-allow_comp',
1740     'section'     => 'deprecated',
1741     '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.',
1742     'type'        => 'textarea',
1743   },
1744
1745   {
1746     'key'         => 'credit_card-recurring_billing_flag',
1747     'section'     => 'billing',
1748     '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. ',
1749     'type'        => 'select',
1750     'select_hash' => [
1751                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
1752                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
1753                      ],
1754   },
1755
1756   {
1757     'key'         => 'credit_card-recurring_billing_acct_code',
1758     'section'     => 'billing',
1759     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
1760     'type'        => 'checkbox',
1761   },
1762
1763   {
1764     'key'         => 'cvv-save',
1765     'section'     => 'billing',
1766     '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.',
1767     'type'        => 'selectmultiple',
1768     'select_enum' => \@card_types,
1769   },
1770
1771   {
1772     'key'         => 'allow_negative_charges',
1773     'section'     => 'billing',
1774     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1775     'type'        => 'checkbox',
1776   },
1777   {
1778       'key'         => 'auto_unset_catchall',
1779       'section'     => '',
1780       '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.',
1781       'type'        => 'checkbox',
1782   },
1783
1784   {
1785     'key'         => 'system_usernames',
1786     'section'     => 'username',
1787     '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.',
1788     'type'        => 'textarea',
1789   },
1790
1791   {
1792     'key'         => 'cust_pkg-change_svcpart',
1793     'section'     => '',
1794     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1795     'type'        => 'checkbox',
1796   },
1797
1798   {
1799     'key'         => 'disable_autoreverse',
1800     'section'     => 'BIND',
1801     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1802     'type'        => 'checkbox',
1803   },
1804
1805   {
1806     'key'         => 'svc_www-enable_subdomains',
1807     'section'     => '',
1808     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1809     'type'        => 'checkbox',
1810   },
1811
1812   {
1813     'key'         => 'svc_www-usersvc_svcpart',
1814     'section'     => '',
1815     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1816     'type'        => 'textarea',
1817   },
1818
1819   {
1820     'key'         => 'selfservice_server-primary_only',
1821     'section'     => '',
1822     'description' => 'Only allow primary accounts to access self-service functionality.',
1823     'type'        => 'checkbox',
1824   },
1825
1826   {
1827     'key'         => 'selfservice_server-phone_login',
1828     'section'     => '',
1829     'description' => 'Allow login to self-service with phone number and PIN.',
1830     'type'        => 'checkbox',
1831   },
1832
1833   {
1834     'key'         => 'selfservice_server-single_domain',
1835     'section'     => '',
1836     'description' => 'If specified, only use this one domain for self-service access.',
1837     'type'        => 'text',
1838   },
1839
1840   {
1841     'key'         => 'card_refund-days',
1842     'section'     => 'billing',
1843     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1844     'type'        => 'text',
1845   },
1846
1847   {
1848     'key'         => 'agent-showpasswords',
1849     'section'     => '',
1850     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1851     'type'        => 'checkbox',
1852   },
1853
1854   {
1855     'key'         => 'global_unique-username',
1856     'section'     => 'username',
1857     '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.',
1858     'type'        => 'select',
1859     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1860   },
1861
1862   {
1863     'key'         => 'global_unique-phonenum',
1864     'section'     => '',
1865     '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.',
1866     'type'        => 'select',
1867     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
1868   },
1869
1870   {
1871     'key'         => 'svc_external-skip_manual',
1872     'section'     => 'UI',
1873     '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).',
1874     'type'        => 'checkbox',
1875   },
1876
1877   {
1878     'key'         => 'svc_external-display_type',
1879     'section'     => 'UI',
1880     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1881     'type'        => 'select',
1882     'select_enum' => [ 'generic', 'artera_turbo', ],
1883   },
1884
1885   {
1886     'key'         => 'ticket_system',
1887     'section'     => '',
1888     '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:1.7:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
1889     'type'        => 'select',
1890     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1891     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1892   },
1893
1894   {
1895     'key'         => 'ticket_system-default_queueid',
1896     'section'     => '',
1897     'description' => 'Default queue used when creating new customer tickets.',
1898     'type'        => 'select-sub',
1899     'options_sub' => sub {
1900                            my $conf = new FS::Conf;
1901                            if ( $conf->config('ticket_system') ) {
1902                              eval "use FS::TicketSystem;";
1903                              die $@ if $@;
1904                              FS::TicketSystem->queues();
1905                            } else {
1906                              ();
1907                            }
1908                          },
1909     'option_sub'  => sub { 
1910                            my $conf = new FS::Conf;
1911                            if ( $conf->config('ticket_system') ) {
1912                              eval "use FS::TicketSystem;";
1913                              die $@ if $@;
1914                              FS::TicketSystem->queue(shift);
1915                            } else {
1916                              '';
1917                            }
1918                          },
1919   },
1920
1921   {
1922     'key'         => 'ticket_system-priority_reverse',
1923     'section'     => '',
1924     '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.',
1925     'type'        => 'checkbox',
1926   },
1927
1928   {
1929     'key'         => 'ticket_system-custom_priority_field',
1930     'section'     => '',
1931     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1932     'type'        => 'text',
1933   },
1934
1935   {
1936     'key'         => 'ticket_system-custom_priority_field-values',
1937     'section'     => '',
1938     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1939     'type'        => 'textarea',
1940   },
1941
1942   {
1943     'key'         => 'ticket_system-custom_priority_field_queue',
1944     'section'     => '',
1945     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1946     'type'        => 'text',
1947   },
1948
1949   {
1950     'key'         => 'ticket_system-rt_external_datasrc',
1951     'section'     => '',
1952     '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>',
1953     'type'        => 'text',
1954
1955   },
1956
1957   {
1958     'key'         => 'ticket_system-rt_external_url',
1959     'section'     => '',
1960     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1961     'type'        => 'text',
1962   },
1963
1964   {
1965     'key'         => 'company_name',
1966     'section'     => 'required',
1967     'description' => 'Your company name',
1968     'type'        => 'text',
1969     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
1970   },
1971
1972   {
1973     'key'         => 'company_address',
1974     'section'     => 'required',
1975     'description' => 'Your company address',
1976     'type'        => 'textarea',
1977     'per_agent'   => 1,
1978   },
1979
1980   {
1981     'key'         => 'echeck-void',
1982     'section'     => 'deprecated',
1983     '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',
1984     'type'        => 'checkbox',
1985   },
1986
1987   {
1988     'key'         => 'cc-void',
1989     'section'     => 'deprecated',
1990     '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',
1991     'type'        => 'checkbox',
1992   },
1993
1994   {
1995     'key'         => 'unvoid',
1996     'section'     => 'deprecated',
1997     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
1998     'type'        => 'checkbox',
1999   },
2000
2001   {
2002     'key'         => 'address2-search',
2003     'section'     => 'UI',
2004     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
2005     'type'        => 'checkbox',
2006   },
2007
2008   {
2009     'key'         => 'cust_main-require_address2',
2010     'section'     => 'UI',
2011     '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',
2012     'type'        => 'checkbox',
2013   },
2014
2015   {
2016     'key'         => 'agent-ship_address',
2017     'section'     => '',
2018     '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.",
2019     'type'        => 'checkbox',
2020   },
2021
2022   { 'key'         => 'referral_credit',
2023     'section'     => 'deprecated',
2024     '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.",
2025     'type'        => 'checkbox',
2026   },
2027
2028   { 'key'         => 'selfservice_server-cache_module',
2029     'section'     => '',
2030     '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.',
2031     'type'        => 'select',
2032     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
2033   },
2034
2035   {
2036     'key'         => 'hylafax',
2037     'section'     => 'billing',
2038     '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).',
2039     'type'        => [qw( checkbox textarea )],
2040   },
2041
2042   {
2043     'key'         => 'cust_bill-ftpformat',
2044     'section'     => 'billing',
2045     'description' => 'Enable FTP of raw invoice data - format.',
2046     'type'        => 'select',
2047     'select_enum' => [ '', 'default', 'billco', ],
2048   },
2049
2050   {
2051     'key'         => 'cust_bill-ftpserver',
2052     'section'     => 'billing',
2053     'description' => 'Enable FTP of raw invoice data - server.',
2054     'type'        => 'text',
2055   },
2056
2057   {
2058     'key'         => 'cust_bill-ftpusername',
2059     'section'     => 'billing',
2060     'description' => 'Enable FTP of raw invoice data - server.',
2061     'type'        => 'text',
2062   },
2063
2064   {
2065     'key'         => 'cust_bill-ftppassword',
2066     'section'     => 'billing',
2067     'description' => 'Enable FTP of raw invoice data - server.',
2068     'type'        => 'text',
2069   },
2070
2071   {
2072     'key'         => 'cust_bill-ftpdir',
2073     'section'     => 'billing',
2074     'description' => 'Enable FTP of raw invoice data - server.',
2075     'type'        => 'text',
2076   },
2077
2078   {
2079     'key'         => 'cust_bill-spoolformat',
2080     'section'     => 'billing',
2081     'description' => 'Enable spooling of raw invoice data - format.',
2082     'type'        => 'select',
2083     'select_enum' => [ '', 'default', 'billco', ],
2084   },
2085
2086   {
2087     'key'         => 'cust_bill-spoolagent',
2088     'section'     => 'billing',
2089     'description' => 'Enable per-agent spooling of raw invoice data.',
2090     'type'        => 'checkbox',
2091   },
2092
2093   {
2094     'key'         => 'svc_acct-usage_suspend',
2095     'section'     => 'billing',
2096     '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.',
2097     'type'        => 'checkbox',
2098   },
2099
2100   {
2101     'key'         => 'svc_acct-usage_unsuspend',
2102     'section'     => 'billing',
2103     '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.',
2104     'type'        => 'checkbox',
2105   },
2106
2107   {
2108     'key'         => 'svc_acct-usage_threshold',
2109     'section'     => 'billing',
2110     '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.',
2111     'type'        => 'text',
2112   },
2113
2114   {
2115     'key'         => 'cust-fields',
2116     'section'     => 'UI',
2117     'description' => 'Which customer fields to display on reports by default',
2118     'type'        => 'select',
2119     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
2120   },
2121
2122   {
2123     'key'         => 'cust_pkg-display_times',
2124     'section'     => 'UI',
2125     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
2126     'type'        => 'checkbox',
2127   },
2128
2129   {
2130     'key'         => 'cust_pkg-always_show_location',
2131     'section'     => 'UI',
2132     'description' => "Always display package locations, even when they're all the default service address.",
2133     'type'        => 'checkbox',
2134   },
2135
2136   {
2137     'key'         => 'svc_acct-edit_uid',
2138     'section'     => 'shell',
2139     'description' => 'Allow UID editing.',
2140     'type'        => 'checkbox',
2141   },
2142
2143   {
2144     'key'         => 'svc_acct-edit_gid',
2145     'section'     => 'shell',
2146     'description' => 'Allow GID editing.',
2147     'type'        => 'checkbox',
2148   },
2149
2150   {
2151     'key'         => 'zone-underscore',
2152     'section'     => 'BIND',
2153     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
2154     'type'        => 'checkbox',
2155   },
2156
2157   {
2158     'key'         => 'echeck-nonus',
2159     'section'     => 'billing',
2160     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
2161     'type'        => 'checkbox',
2162   },
2163
2164   {
2165     'key'         => 'voip-cust_cdr_spools',
2166     'section'     => '',
2167     'description' => 'Enable the per-customer option for individual CDR spools.',
2168     'type'        => 'checkbox',
2169   },
2170
2171   {
2172     'key'         => 'voip-cust_cdr_squelch',
2173     'section'     => '',
2174     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
2175     'type'        => 'checkbox',
2176   },
2177
2178   {
2179     'key'         => 'voip-cdr_email',
2180     'section'     => '',
2181     'description' => 'Include the call details on emailed invoices even if the customer is configured for not printing them on the invoices.',
2182     'type'        => 'checkbox',
2183   },
2184
2185   {
2186     'key'         => 'voip-cust_email_csv_cdr',
2187     'section'     => '',
2188     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
2189     'type'        => 'checkbox',
2190   },
2191
2192   {
2193     'key'         => 'svc_forward-arbitrary_dst',
2194     'section'     => '',
2195     '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.",
2196     'type'        => 'checkbox',
2197   },
2198
2199   {
2200     'key'         => 'tax-ship_address',
2201     'section'     => 'billing',
2202     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
2203     'type'        => 'checkbox',
2204   }
2205 ,
2206   {
2207     'key'         => 'tax-pkg_address',
2208     'section'     => 'billing',
2209     '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).  Note that this option is currently incompatible with vendor data taxation enabled by enable_taxproducts.',
2210     'type'        => 'checkbox',
2211   },
2212
2213   {
2214     'key'         => 'invoice-ship_address',
2215     'section'     => 'billing',
2216     'description' => 'Enable this switch to include the ship address on the invoice.',
2217     'type'        => 'checkbox',
2218   },
2219
2220   {
2221     'key'         => 'invoice-unitprice',
2222     'section'     => 'billing',
2223     'description' => 'This switch enables unit pricing on the invoice.',
2224     'type'        => 'checkbox',
2225   },
2226
2227   {
2228     'key'         => 'postal_invoice-fee_pkgpart',
2229     'section'     => 'billing',
2230     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
2231     'type'        => 'select-sub',
2232     'options_sub' => sub { require FS::Record;
2233                            require FS::part_pkg;
2234                            map { $_->pkgpart => $_->pkg }
2235                                FS::Record::qsearch('part_pkg', { disabled=>'' } );
2236                          },
2237     'option_sub'  => sub { require FS::Record;
2238                            require FS::part_pkg;
2239                            my $part_pkg = FS::Record::qsearchs(
2240                              'part_pkg', { 'pkgpart'=>shift }
2241                            );
2242                            $part_pkg ? $part_pkg->pkg : '';
2243                          },
2244   },
2245
2246   {
2247     'key'         => 'postal_invoice-recurring_only',
2248     'section'     => 'billing',
2249     'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
2250     'type'        => 'checkbox',
2251   },
2252
2253   {
2254     'key'         => 'batch-enable',
2255     'section'     => 'deprecated', #make sure batch-enable_payby is set for
2256                                    #everyone before removing
2257     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
2258     'type'        => 'checkbox',
2259   },
2260
2261   {
2262     'key'         => 'batch-enable_payby',
2263     'section'     => 'billing',
2264     'description' => 'Enable batch processing for the specified payment types.',
2265     'type'        => 'selectmultiple',
2266     'select_enum' => [qw( CARD CHEK )],
2267   },
2268
2269   {
2270     'key'         => 'realtime-disable_payby',
2271     'section'     => 'billing',
2272     'description' => 'Disable realtime processing for the specified payment types.',
2273     'type'        => 'selectmultiple',
2274     'select_enum' => [qw( CARD CHEK )],
2275   },
2276
2277   {
2278     'key'         => 'batch-default_format',
2279     'section'     => 'billing',
2280     'description' => 'Default format for batches.',
2281     'type'        => 'select',
2282     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
2283                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
2284                        'ach-spiritone',
2285                     ]
2286   },
2287
2288   {
2289     'key'         => 'batch-fixed_format-CARD',
2290     'section'     => 'billing',
2291     'description' => 'Fixed (unchangeable) format for credit card batches.',
2292     'type'        => 'select',
2293     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
2294                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
2295   },
2296
2297   {
2298     'key'         => 'batch-fixed_format-CHEK',
2299     'section'     => 'billing',
2300     'description' => 'Fixed (unchangeable) format for electronic check batches.',
2301     'type'        => 'select',
2302     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
2303                        'ach-spiritone',
2304                      ]
2305   },
2306
2307   {
2308     'key'         => 'batch-increment_expiration',
2309     'section'     => 'billing',
2310     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
2311     'type'        => 'checkbox'
2312   },
2313
2314   {
2315     'key'         => 'batchconfig-BoM',
2316     'section'     => 'billing',
2317     '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',
2318     'type'        => 'textarea',
2319   },
2320
2321   {
2322     'key'         => 'batchconfig-PAP',
2323     'section'     => 'billing',
2324     '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',
2325     'type'        => 'textarea',
2326   },
2327
2328   {
2329     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
2330     'section'     => 'billing',
2331     'description' => 'Gateway ID for Chase Canada E-xact batching',
2332     'type'        => 'text',
2333   },
2334
2335   {
2336     'key'         => 'payment_history-years',
2337     'section'     => 'UI',
2338     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
2339     'type'        => 'text',
2340   },
2341
2342   {
2343     'key'         => 'change_history-years',
2344     'section'     => 'UI',
2345     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
2346     'type'        => 'text',
2347   },
2348
2349   {
2350     'key'         => 'cust_main-packages-years',
2351     'section'     => 'UI',
2352     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
2353     'type'        => 'text',
2354   },
2355
2356   {
2357     'key'         => 'cust_main-use_comments',
2358     'section'     => 'UI',
2359     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
2360     'type'        => 'checkbox',
2361   },
2362
2363   {
2364     'key'         => 'cust_main-disable_notes',
2365     'section'     => 'UI',
2366     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
2367     'type'        => 'checkbox',
2368   },
2369
2370   {
2371     'key'         => 'cust_main_note-display_times',
2372     'section'     => 'UI',
2373     'description' => 'Display full timestamps (not just dates) for customer notes.',
2374     'type'        => 'checkbox',
2375   },
2376
2377   {
2378     'key'         => 'cust_main-ticket_statuses',
2379     'section'     => 'UI',
2380     'description' => 'Show tickets with these statuses on the customer view page.',
2381     'type'        => 'selectmultiple',
2382     'select_enum' => [qw( new open stalled resolved rejected deleted )],
2383   },
2384
2385   {
2386     'key'         => 'cust_main-max_tickets',
2387     'section'     => 'UI',
2388     'description' => 'Maximum number of tickets to show on the customer view page.',
2389     'type'        => 'text',
2390   },
2391
2392   {
2393     'key'         => 'cust_main-skeleton_tables',
2394     'section'     => '',
2395     '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.',
2396     'type'        => 'textarea',
2397   },
2398
2399   {
2400     'key'         => 'cust_main-skeleton_custnum',
2401     'section'     => '',
2402     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
2403     'type'        => 'text',
2404   },
2405
2406   {
2407     'key'         => 'cust_main-enable_birthdate',
2408     'section'     => 'UI',
2409     'descritpion' => 'Enable tracking of a birth date with each customer record',
2410     'type'        => 'checkbox',
2411   },
2412
2413   {
2414     'key'         => 'support-key',
2415     'section'     => '',
2416     '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.',
2417     'type'        => 'text',
2418   },
2419
2420   {
2421     'key'         => 'card-types',
2422     'section'     => 'billing',
2423     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
2424     'type'        => 'selectmultiple',
2425     'select_enum' => \@card_types,
2426   },
2427
2428   {
2429     'key'         => 'disable-fuzzy',
2430     'section'     => 'UI',
2431     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
2432     'type'        => 'checkbox',
2433   },
2434
2435   { 'key'         => 'pkg_referral',
2436     'section'     => '',
2437     'description' => 'Enable package-specific advertising sources.',
2438     'type'        => 'checkbox',
2439   },
2440
2441   { 'key'         => 'pkg_referral-multiple',
2442     'section'     => '',
2443     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
2444     'type'        => 'checkbox',
2445   },
2446
2447   {
2448     'key'         => 'dashboard-toplist',
2449     'section'     => 'UI',
2450     'description' => 'List of items to display on the top of the front page',
2451     'type'        => 'textarea',
2452   },
2453
2454   {
2455     'key'         => 'impending_recur_template',
2456     'section'     => 'billing',
2457     '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>',
2458 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
2459     'type'        => 'textarea',
2460   },
2461
2462   {
2463     'key'         => 'logo.png',
2464     'section'     => 'billing',  #? 
2465     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
2466     'type'        => 'image',
2467     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
2468                         #old-style editor anyway...?
2469   },
2470
2471   {
2472     'key'         => 'logo.eps',
2473     'section'     => 'billing',  #? 
2474     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
2475     'type'        => 'image',
2476     'per_agent'   => 1, #XXX as above, kinda
2477   },
2478
2479   {
2480     'key'         => 'selfservice-ignore_quantity',
2481     'section'     => '',
2482     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
2483     'type'        => 'checkbox',
2484   },
2485
2486   {
2487     'key'         => 'selfservice-session_timeout',
2488     'section'     => '',
2489     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
2490     'type'        => 'select',
2491     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
2492   },
2493
2494   {
2495     'key'         => 'disable_setup_suspended_pkgs',
2496     'section'     => 'billing',
2497     'description' => 'Disables charging of setup fees for suspended packages.',
2498     'type'       => 'checkbox',
2499   },
2500
2501   {
2502     'key' => 'password-generated-allcaps',
2503     'section' => 'password',
2504     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
2505     'type' => 'checkbox',
2506   },
2507
2508   {
2509     'key'         => 'datavolume-forcemegabytes',
2510     'section'     => 'UI',
2511     'description' => 'All data volumes are expressed in megabytes',
2512     'type'        => 'checkbox',
2513   },
2514
2515   {
2516     'key'         => 'datavolume-significantdigits',
2517     'section'     => 'UI',
2518     'description' => 'number of significant digits to use to represent data volumes',
2519     'type'        => 'text',
2520   },
2521
2522   {
2523     'key'         => 'disable_void_after',
2524     'section'     => 'billing',
2525     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
2526     'type'        => 'text',
2527   },
2528
2529   {
2530     'key'         => 'disable_line_item_date_ranges',
2531     'section'     => 'billing',
2532     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
2533     'type'        => 'checkbox',
2534   },
2535
2536   {
2537     'key'         => 'support_packages',
2538     'section'     => '',
2539     '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...
2540     'type'        => 'textarea',
2541   },
2542
2543   {
2544     'key'         => 'cust_main-require_phone',
2545     'section'     => '',
2546     'description' => 'Require daytime or night phone for all customer records.',
2547     'type'        => 'checkbox',
2548   },
2549
2550   {
2551     'key'         => 'cust_main-require_invoicing_list_email',
2552     'section'     => '',
2553     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
2554     'type'        => 'checkbox',
2555   },
2556
2557   {
2558     'key'         => 'svc_acct-display_paid_time_remaining',
2559     'section'     => '',
2560     'description' => 'Show paid time remaining in addition to time remaining.',
2561     'type'        => 'checkbox',
2562   },
2563
2564   {
2565     'key'         => 'cancel_credit_type',
2566     'section'     => 'billing',
2567     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
2568     'type'        => 'select-sub',
2569     'options_sub' => sub { require FS::Record;
2570                            require FS::reason_type;
2571                            map { $_->typenum => $_->type }
2572                                FS::Record::qsearch('reason_type', { class=>'R' } );
2573                          },
2574     'option_sub'  => sub { require FS::Record;
2575                            require FS::reason_type;
2576                            my $reason_type = FS::Record::qsearchs(
2577                              'reason_type', { 'typenum' => shift }
2578                            );
2579                            $reason_type ? $reason_type->type : '';
2580                          },
2581   },
2582
2583   {
2584     'key'         => 'referral_credit_type',
2585     'section'     => 'deprecated',
2586     '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.',
2587     'type'        => 'select-sub',
2588     'options_sub' => sub { require FS::Record;
2589                            require FS::reason_type;
2590                            map { $_->typenum => $_->type }
2591                                FS::Record::qsearch('reason_type', { class=>'R' } );
2592                          },
2593     'option_sub'  => sub { require FS::Record;
2594                            require FS::reason_type;
2595                            my $reason_type = FS::Record::qsearchs(
2596                              'reason_type', { 'typenum' => shift }
2597                            );
2598                            $reason_type ? $reason_type->type : '';
2599                          },
2600   },
2601
2602   {
2603     'key'         => 'signup_credit_type',
2604     'section'     => 'billing',
2605     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
2606     'type'        => 'select-sub',
2607     'options_sub' => sub { require FS::Record;
2608                            require FS::reason_type;
2609                            map { $_->typenum => $_->type }
2610                                FS::Record::qsearch('reason_type', { class=>'R' } );
2611                          },
2612     'option_sub'  => sub { require FS::Record;
2613                            require FS::reason_type;
2614                            my $reason_type = FS::Record::qsearchs(
2615                              'reason_type', { 'typenum' => shift }
2616                            );
2617                            $reason_type ? $reason_type->type : '';
2618                          },
2619   },
2620
2621   {
2622     'key'         => 'cust_main-agent_custid-format',
2623     'section'     => '',
2624     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
2625     'type'        => 'select',
2626     'select_hash' => [
2627                        ''      => 'Numeric only',
2628                        'ww?d+' => 'Numeric with one or two letter prefix',
2629                      ],
2630   },
2631
2632   {
2633     'key'         => 'card_masking_method',
2634     'section'     => 'UI',
2635     '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.',
2636     'type'        => 'select',
2637     'select_hash' => [
2638                        ''            => '123456xxxxxx1234',
2639                        'first6last2' => '123456xxxxxxxx12',
2640                        'first4last4' => '1234xxxxxxxx1234',
2641                        'first4last2' => '1234xxxxxxxxxx12',
2642                        'first2last4' => '12xxxxxxxxxx1234',
2643                        'first2last2' => '12xxxxxxxxxxxx12',
2644                        'first0last4' => 'xxxxxxxxxxxx1234',
2645                        'first0last2' => 'xxxxxxxxxxxxxx12',
2646                      ],
2647   },
2648
2649   {
2650     'key'         => 'disable_previous_balance',
2651     'section'     => 'billing',
2652     'description' => 'Disable inclusion of previous balancem payment, and credit lines on invoices',
2653     'type'        => 'checkbox',
2654   },
2655
2656   {
2657     'key'         => 'previous_balance-summary_only',
2658     'section'     => 'billing',
2659     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
2660     'type'        => 'checkbox',
2661   },
2662
2663   {
2664     'key'         => 'usps_webtools-userid',
2665     'section'     => 'UI',
2666     '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.',
2667     'type'        => 'text',
2668   },
2669
2670   {
2671     'key'         => 'usps_webtools-password',
2672     'section'     => 'UI',
2673     '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.',
2674     'type'        => 'text',
2675   },
2676
2677   {
2678     'key'         => 'cust_main-auto_standardize_address',
2679     'section'     => 'UI',
2680     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
2681     'type'        => 'checkbox',
2682   },
2683
2684   {
2685     'key'         => 'cust_main-require_censustract',
2686     'section'     => 'UI',
2687     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
2688     'type'        => 'checkbox',
2689   },
2690
2691   {
2692     'key'         => 'census_year',
2693     'section'     => 'UI',
2694     'description' => 'The year to use in census tract lookups',
2695     'type'        => 'select',
2696     'select_enum' => [ qw( 2008 2007 2006 ) ],
2697   },
2698
2699   {
2700     'key'         => 'company_latitude',
2701     'section'     => 'UI',
2702     'description' => 'Your company latitude (-90 through 90)',
2703     'type'        => 'text',
2704   },
2705
2706   {
2707     'key'         => 'company_longitude',
2708     'section'     => 'UI',
2709     'description' => 'Your company longitude (-180 thru 180)',
2710     'type'        => 'text',
2711   },
2712
2713   {
2714     'key'         => 'disable_acl_changes',
2715     'section'     => '',
2716     'description' => 'Disable all ACL changes, for demos.',
2717     'type'        => 'checkbox',
2718   },
2719
2720   {
2721     'key'         => 'cust_main-edit_agent_custid',
2722     'section'     => 'UI',
2723     'description' => 'Enable editing of the agent_custid field.',
2724     'type'        => 'checkbox',
2725   },
2726
2727   {
2728     'key'         => 'cust_main-default_agent_custid',
2729     'section'     => 'UI',
2730     'description' => 'Display the agent_custid field instead of the custnum field.',
2731     'type'        => 'checkbox',
2732   },
2733
2734   {
2735     'key'         => 'cust_main-auto_agent_custid',
2736     'section'     => 'UI',
2737     'description' => 'Automatically assign an agent_custid - select format',
2738     'type'        => 'select',
2739     'select_hash' => [ '' => 'No',
2740                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
2741                      ],
2742   },
2743
2744   {
2745     'key'         => 'cust_main-default_areacode',
2746     'section'     => 'UI',
2747     'description' => 'Default area code for customers.',
2748     'type'        => 'text',
2749   },
2750
2751   {
2752     'key'         => 'mcp_svcpart',
2753     'section'     => '',
2754     'description' => 'Master Control Program svcpart.  Leave this blank.',
2755     'type'        => 'text',
2756   },
2757
2758   {
2759     'key'         => 'cust_bill-max_same_services',
2760     'section'     => 'billing',
2761     '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.',
2762     'type'        => 'text',
2763   },
2764
2765   {
2766     'key'         => 'suspend_email_admin',
2767     'section'     => '',
2768     'description' => 'Destination admin email address to enable suspension notices',
2769     'type'        => 'text',
2770   },
2771
2772   {
2773     'key'         => 'email_report-subject',
2774     'section'     => '',
2775     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
2776     'type'        => 'text',
2777   },
2778
2779   {
2780     'key'         => 'selfservice-head',
2781     'section'     => '',
2782     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
2783     'type'        => 'textarea', #htmlarea?
2784   },
2785
2786
2787   {
2788     'key'         => 'selfservice-body_header',
2789     'section'     => '',
2790     'description' => 'HTML header for the self-service interface',
2791     'type'        => 'textarea', #htmlarea?
2792   },
2793
2794   {
2795     'key'         => 'selfservice-body_footer',
2796     'section'     => '',
2797     'description' => 'HTML header for the self-service interface',
2798     'type'        => 'textarea', #htmlarea?
2799   },
2800
2801
2802   {
2803     'key'         => 'selfservice-body_bgcolor',
2804     'section'     => '',
2805     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
2806     'type'        => 'text',
2807   },
2808
2809   {
2810     'key'         => 'selfservice-box_bgcolor',
2811     'section'     => '',
2812     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0"',
2813     'type'        => 'text',
2814   },
2815
2816   {
2817     'key'         => 'selfservice-bulk_format',
2818     'section'     => '',
2819     'description' => 'Parameter arrangement for selfservice bulk features',
2820     'type'        => 'select',
2821     'select_enum' => [ '', 'izoom-soap', 'izoom-ftp' ],
2822     'per_agent'   => 1,
2823   },
2824
2825   {
2826     'key'         => 'selfservice-bulk_ftp_dir',
2827     'section'     => '',
2828     'description' => 'Enable bulk ftp provisioning in this folder',
2829     'type'        => 'text',
2830     'per_agent'   => 1,
2831   },
2832
2833   {
2834     'key'         => 'signup-no_company',
2835     'section'     => '',
2836     'description' => "Don't display a field for company name on signup.",
2837     'type'        => 'checkbox',
2838   },
2839
2840   {
2841     'key'         => 'signup-recommend_email',
2842     'section'     => '',
2843     'description' => 'Encourage the entry of an invoicing email address on signup.',
2844     'type'        => 'checkbox',
2845   },
2846
2847   {
2848     'key'         => 'signup-recommend_daytime',
2849     'section'     => '',
2850     'description' => 'Encourage the entry of a daytime phone number  invoicing email address on signup.',
2851     'type'        => 'checkbox',
2852   },
2853
2854   {
2855     'key'         => 'svc_phone-radius-default_password',
2856     'section'     => '',
2857     'description' => 'Default password when exporting svc_phone records to RADIUS',
2858     'type'        => 'text',
2859   },
2860
2861   {
2862     'key'         => 'svc_phone-allow_alpha_phonenum',
2863     'section'     => '',
2864     'description' => 'Allow letters in phone numbers.',
2865     'type'        => 'checkbox',
2866   },
2867
2868   {
2869     'key'         => 'default_phone_countrycode',
2870     'section'     => '',
2871     'description' => 'Default countrcode',
2872     'type'        => 'text',
2873   },
2874
2875   {
2876     'key'         => 'cdr-charged_party-accountcode',
2877     'section'     => '',
2878     'description' => 'Set the charged_party field of CDRs to the accountcode.',
2879     'type'        => 'checkbox',
2880   },
2881
2882   {
2883     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
2884     'section'     => '',
2885     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
2886     'type'        => 'checkbox',
2887   },
2888
2889 #  {
2890 #    'key'         => 'cdr-charged_party-truncate_prefix',
2891 #    'section'     => '',
2892 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
2893 #    'type'        => 'text',
2894 #  },
2895 #
2896 #  {
2897 #    'key'         => 'cdr-charged_party-truncate_length',
2898 #    'section'     => '',
2899 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
2900 #    'type'        => 'text',
2901 #  },
2902
2903   {
2904     'key'         => 'cdr-charged_party_rewrite',
2905     'section'     => '',
2906     '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*.',
2907     'type'        => 'checkbox',
2908   },
2909
2910   {
2911     'key'         => 'cdr-taqua-da_rewrite',
2912     'section'     => '',
2913     '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.',
2914     'type'        => 'text',
2915   },
2916
2917   {
2918     'key'         => 'cust_pkg-show_autosuspend',
2919     'section'     => 'UI',
2920     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
2921     'type'       => 'checkbox',
2922   },
2923
2924   {
2925     'key'         => 'cdr-asterisk_forward_rewrite',
2926     'section'     => '',
2927     '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").',
2928     'type'        => 'checkbox',
2929   },
2930
2931   {
2932     'key'         => 'sg-multicustomer_hack',
2933     'section'     => '',
2934     'description' => "Don't use this.",
2935     'type'        => 'checkbox',
2936   },
2937
2938   {
2939     'key'         => 'disable-cust-pkg_class',
2940     'section'     => 'UI',
2941     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
2942     'type'        => 'checkbox',
2943   },
2944
2945   {
2946     'key'         => 'queued-max_kids',
2947     'section'     => '',
2948     'description' => 'Maximum number of queued processes.  Defaults to 10.',
2949     'type'        => 'text',
2950   },
2951
2952   {
2953     'key'         => 'cancelled_cust-noevents',
2954     'section'     => 'billing',
2955     'description' => "Don't run events for cancelled customers",
2956     'type'        => 'checkbox',
2957   },
2958
2959   {
2960     'key'         => 'agent-invoice_template',
2961     'section'     => 'billing',
2962     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
2963     'type'        => 'checkbox',
2964   },
2965
2966   {
2967     'key'         => 'svc_broadband-manage_link',
2968     'section'     => 'UI',
2969     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr.',
2970     'type'        => 'text',
2971   },
2972
2973   #more fine-grained, service def-level control could be useful eventually?
2974   {
2975     'key'         => 'svc_broadband-allow_null_ip_addr',
2976     'section'     => '',
2977     'description' => '',
2978     'type'        => 'checkbox',
2979   },
2980
2981   {
2982     'key'         => 'tax-report_groups',
2983     'section'     => '',
2984     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
2985     'type'        => 'textarea',
2986   },
2987
2988   {
2989     'key'         => 'tax-cust_exempt-groups',
2990     'section'     => '',
2991     '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).',
2992     'type'        => 'textarea',
2993   },
2994
2995   {
2996     'key'         => 'cust_main-default_view',
2997     'section'     => 'UI',
2998     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
2999     'type'        => 'select',
3000     'select_hash' => [
3001       #false laziness w/view/cust_main.cgi and pref/pref.html
3002       'basics'          => 'Basics',
3003       'notes'           => 'Notes',
3004       'tickets'         => 'Tickets',
3005       'packages'        => 'Packages',
3006       'payment_history' => 'Payment History',
3007       'change_history'  => 'Change History',
3008       'jumbo'           => 'Jumbo',
3009     ],
3010   },
3011
3012   {
3013     'key'         => 'enable_tax_adjustments',
3014     'section'     => 'billing',
3015     'description' => 'Enable the ability to add manual tax adjustments.',
3016     'type'        => 'checkbox',
3017   },
3018
3019   {
3020     'key'         => 'rt-crontool',
3021     'section'     => '',
3022     'description' => 'Enable the RT CronTool extension.',
3023     'type'        => 'checkbox',
3024   },
3025
3026   {
3027     'key'         => 'pkg-balances',
3028     'section'     => 'billing',
3029     'description' => 'Enable experimental package balances.  Not recommended for general use.',
3030     'type'        => 'checkbox',
3031   },
3032
3033   {
3034     'key'         => 'cust_main-edit_signupdate',
3035     'section'     => 'UI',
3036     'descritpion' => 'Enable manual editing of the signup date.',
3037     'type'        => 'checkbox',
3038   },
3039
3040   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3041   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3042   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3043   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3044   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3045   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3046   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3047   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3048   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3049   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3050   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3051   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3052   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3053   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3054   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3055   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3056   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3057   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3058   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3059   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3060   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3061   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3062   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3063   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3064   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3065   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3066   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3067   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3068   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3069   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3070   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3071   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3072   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3073   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3074   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3075   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3076   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3077   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3078   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3079   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3080   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3081
3082 );
3083
3084 1;
3085