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