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