merge webpay support in with autoselection of old realtime_bop and realtime_refund_bop
[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     'section'     => 'deprecated',
577     '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',
578     'type'        => 'text',
579   },
580
581   {
582     'key'         => 'encryption',
583     'section'     => 'billing',
584     'description' => 'Enable encryption of credit cards.',
585     'type'        => 'checkbox',
586   },
587
588   {
589     'key'         => 'encryptionmodule',
590     'section'     => 'billing',
591     'description' => 'Use which module for encryption?',
592     'type'        => 'text',
593   },
594
595   {
596     'key'         => 'encryptionpublickey',
597     'section'     => 'billing',
598     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
599     'type'        => 'textarea',
600   },
601
602   {
603     'key'         => 'encryptionprivatekey',
604     'section'     => 'billing',
605     '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.',
606     'type'        => 'textarea',
607   },
608
609   {
610     'key'         => 'business-onlinepayment',
611     'section'     => 'billing',
612     '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.',
613     'type'        => 'textarea',
614   },
615
616   {
617     'key'         => 'business-onlinepayment-ach',
618     'section'     => 'billing',
619     '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.',
620     'type'        => 'textarea',
621   },
622
623   {
624     'key'         => 'business-onlinepayment-namespace',
625     'section'     => 'billing',
626     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
627     'type'        => 'select',
628     'select_hash' => [
629                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
630                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
631                      ],
632   },
633
634   {
635     'key'         => 'business-onlinepayment-description',
636     'section'     => 'billing',
637     '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)',
638     'type'        => 'text',
639   },
640
641   {
642     'key'         => 'business-onlinepayment-email-override',
643     'section'     => 'billing',
644     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
645     'type'        => 'text',
646   },
647
648   {
649     'key'         => 'business-onlinepayment-email_customer',
650     'section'     => 'billing',
651     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
652     'type'        => 'checkbox',
653   },
654
655   {
656     'key'         => 'countrydefault',
657     'section'     => 'UI',
658     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
659     'type'        => 'text',
660   },
661
662   {
663     'key'         => 'date_format',
664     'section'     => 'UI',
665     'description' => 'Format for displaying dates',
666     'type'        => 'select',
667     'select_hash' => [
668                        '%m/%d/%Y' => 'MM/DD/YYYY',
669                        '%Y/%m/%d' => 'YYYY/MM/DD',
670                      ],
671   },
672
673   {
674     'key'         => 'deletecustomers',
675     'section'     => 'UI',
676     '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.',
677     'type'        => 'checkbox',
678   },
679
680   {
681     'key'         => 'deletepayments',
682     'section'     => 'billing',
683     '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.',
684     'type'        => [qw( checkbox text )],
685   },
686
687   {
688     'key'         => 'deletecredits',
689     'section'     => 'deprecated',
690     '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.',
691     'type'        => [qw( checkbox text )],
692   },
693
694   {
695     'key'         => 'deleterefunds',
696     'section'     => 'billing',
697     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
698     'type'        => 'checkbox',
699   },
700
701   {
702     'key'         => 'dirhash',
703     'section'     => 'shell',
704     '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>',
705     'type'        => 'text',
706   },
707
708   {
709     'key'         => 'disable_customer_referrals',
710     'section'     => 'UI',
711     'description' => 'Disable new customer-to-customer referrals in the web interface',
712     'type'        => 'checkbox',
713   },
714
715   {
716     'key'         => 'editreferrals',
717     'section'     => 'UI',
718     'description' => 'Enable advertising source modification for existing customers',
719     'type'       => 'checkbox',
720   },
721
722   {
723     'key'         => 'emailinvoiceonly',
724     'section'     => 'billing',
725     'description' => 'Disables postal mail invoices',
726     'type'       => 'checkbox',
727   },
728
729   {
730     'key'         => 'disablepostalinvoicedefault',
731     'section'     => 'billing',
732     '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>.',
733     'type'       => 'checkbox',
734   },
735
736   {
737     'key'         => 'emailinvoiceauto',
738     'section'     => 'billing',
739     'description' => 'Automatically adds new accounts to the email invoice list',
740     'type'       => 'checkbox',
741   },
742
743   {
744     'key'         => 'emailinvoiceautoalways',
745     'section'     => 'billing',
746     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
747     'type'       => 'checkbox',
748   },
749
750   {
751     'key'         => 'exclude_ip_addr',
752     'section'     => '',
753     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
754     'type'        => 'textarea',
755   },
756   
757   {
758     'key'         => 'auto_router',
759     'section'     => '',
760     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
761     'type'        => 'checkbox',
762   },
763   
764   {
765     'key'         => 'hidecancelledpackages',
766     'section'     => 'UI',
767     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
768     'type'        => 'checkbox',
769   },
770
771   {
772     'key'         => 'hidecancelledcustomers',
773     'section'     => 'UI',
774     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
775     'type'        => 'checkbox',
776   },
777
778   {
779     'key'         => 'home',
780     'section'     => 'shell',
781     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
782     'type'        => 'text',
783   },
784
785   {
786     'key'         => 'invoice_from',
787     'section'     => 'required',
788     'description' => 'Return address on email invoices',
789     'type'        => 'text',
790     'per_agent'   => 1,
791   },
792
793   {
794     'key'         => 'invoice_subject',
795     'section'     => 'billing',
796     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
797     'type'        => 'text',
798     'per_agent'   => 1,
799   },
800
801   {
802     'key'         => 'invoice_template',
803     'section'     => 'billing',
804     '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.',
805     'type'        => 'textarea',
806   },
807
808   {
809     'key'         => 'invoice_html',
810     'section'     => 'billing',
811     '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.',
812
813     'type'        => 'textarea',
814   },
815
816   {
817     'key'         => 'invoice_htmlnotes',
818     'section'     => 'billing',
819     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
820     'type'        => 'textarea',
821   },
822
823   {
824     'key'         => 'invoice_htmlfooter',
825     'section'     => 'billing',
826     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
827     'type'        => 'textarea',
828   },
829
830   {
831     'key'         => 'invoice_htmlreturnaddress',
832     'section'     => 'billing',
833     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
834     'type'        => 'textarea',
835   },
836
837   {
838     'key'         => 'invoice_latex',
839     'section'     => 'billing',
840     '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.',
841     'type'        => 'textarea',
842   },
843
844   {
845     'key'         => 'invoice_latexnotes',
846     'section'     => 'billing',
847     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
848     'type'        => 'textarea',
849   },
850
851   {
852     'key'         => 'invoice_latexfooter',
853     'section'     => 'billing',
854     'description' => 'Footer for LaTeX typeset PostScript invoices.',
855     'type'        => 'textarea',
856   },
857
858   {
859     'key'         => 'invoice_latexcoupon',
860     'section'     => 'billing',
861     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
862     'type'        => 'textarea',
863   },
864
865   {
866     'key'         => 'invoice_latexreturnaddress',
867     'section'     => 'billing',
868     'description' => 'Return address for LaTeX typeset PostScript invoices.',
869     'type'        => 'textarea',
870   },
871
872   {
873     'key'         => 'invoice_latexsmallfooter',
874     'section'     => 'billing',
875     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
876     'type'        => 'textarea',
877   },
878
879   {
880     'key'         => 'invoice_email_pdf',
881     'section'     => 'billing',
882     '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.',
883     'type'        => 'checkbox'
884   },
885
886   {
887     'key'         => 'invoice_email_pdf_note',
888     'section'     => 'billing',
889     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
890     'type'        => 'textarea'
891   },
892
893
894   { 
895     'key'         => 'invoice_default_terms',
896     'section'     => 'billing',
897     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
898     'type'        => 'select',
899     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
900   },
901
902   { 
903     'key'         => 'invoice_sections',
904     'section'     => 'billing',
905     'description' => 'Split invoice into sections and label according to package class when enabled.',
906     'type'        => 'checkbox',
907   },
908
909   { 
910     'key'         => 'separate_usage',
911     'section'     => 'billing',
912     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
913     'type'        => 'checkbox',
914   },
915
916   {
917     'key'         => 'payment_receipt_email',
918     'section'     => 'billing',
919     '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>',
920     'type'        => [qw( checkbox textarea )],
921   },
922
923   {
924     'key'         => 'lpr',
925     'section'     => 'required',
926     'description' => 'Print command for paper invoices, for example `lpr -h\'',
927     'type'        => 'text',
928   },
929
930   {
931     'key'         => 'lpr-postscript_prefix',
932     'section'     => 'billing',
933     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
934     'type'        => 'text',
935   },
936
937   {
938     'key'         => 'lpr-postscript_suffix',
939     'section'     => 'billing',
940     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
941     'type'        => 'text',
942   },
943
944   {
945     'key'         => 'money_char',
946     'section'     => '',
947     'description' => 'Currency symbol - defaults to `$\'',
948     'type'        => 'text',
949   },
950
951   {
952     'key'         => 'defaultrecords',
953     'section'     => 'BIND',
954     'description' => 'DNS entries to add automatically when creating a domain',
955     'type'        => 'editlist',
956     'editlist_parts' => [ { type=>'text' },
957                           { type=>'immutable', value=>'IN' },
958                           { type=>'select',
959                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
960                           { type=> 'text' }, ],
961   },
962
963   {
964     'key'         => 'passwordmin',
965     'section'     => 'password',
966     'description' => 'Minimum password length (default 6)',
967     'type'        => 'text',
968   },
969
970   {
971     'key'         => 'passwordmax',
972     'section'     => 'password',
973     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
974     'type'        => 'text',
975   },
976
977   {
978     'key' => 'password-noampersand',
979     'section' => 'password',
980     'description' => 'Disallow ampersands in passwords',
981     'type' => 'checkbox',
982   },
983
984   {
985     'key' => 'password-noexclamation',
986     'section' => 'password',
987     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
988     'type' => 'checkbox',
989   },
990
991   {
992     'key'         => 'referraldefault',
993     'section'     => 'UI',
994     'description' => 'Default referral, specified by refnum',
995     'type'        => 'text',
996   },
997
998 #  {
999 #    'key'         => 'registries',
1000 #    'section'     => 'required',
1001 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1002 #  },
1003
1004   {
1005     'key'         => 'maxsearchrecordsperpage',
1006     'section'     => 'UI',
1007     'description' => 'If set, number of search records to return per page.',
1008     'type'        => 'text',
1009   },
1010
1011   {
1012     'key'         => 'session-start',
1013     'section'     => 'session',
1014     '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.',
1015     'type'        => 'text',
1016   },
1017
1018   {
1019     'key'         => 'session-stop',
1020     'section'     => 'session',
1021     '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.',
1022     'type'        => 'text',
1023   },
1024
1025   {
1026     'key'         => 'shells',
1027     'section'     => 'shell',
1028     '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.',
1029     'type'        => 'textarea',
1030   },
1031
1032   {
1033     'key'         => 'showpasswords',
1034     'section'     => 'UI',
1035     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1036     'type'        => 'checkbox',
1037   },
1038
1039   {
1040     'key'         => 'signupurl',
1041     'section'     => 'UI',
1042     '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',
1043     'type'        => 'text',
1044   },
1045
1046   {
1047     'key'         => 'smtpmachine',
1048     'section'     => 'required',
1049     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1050     'type'        => 'text',
1051   },
1052
1053   {
1054     'key'         => 'soadefaultttl',
1055     'section'     => 'BIND',
1056     'description' => 'SOA default TTL for new domains.',
1057     'type'        => 'text',
1058   },
1059
1060   {
1061     'key'         => 'soaemail',
1062     'section'     => 'BIND',
1063     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1064     'type'        => 'text',
1065   },
1066
1067   {
1068     'key'         => 'soaexpire',
1069     'section'     => 'BIND',
1070     'description' => 'SOA expire for new domains',
1071     'type'        => 'text',
1072   },
1073
1074   {
1075     'key'         => 'soamachine',
1076     'section'     => 'BIND',
1077     'description' => 'SOA machine for new domains, with trailing `.\'',
1078     'type'        => 'text',
1079   },
1080
1081   {
1082     'key'         => 'soarefresh',
1083     'section'     => 'BIND',
1084     'description' => 'SOA refresh for new domains',
1085     'type'        => 'text',
1086   },
1087
1088   {
1089     'key'         => 'soaretry',
1090     'section'     => 'BIND',
1091     'description' => 'SOA retry for new domains',
1092     'type'        => 'text',
1093   },
1094
1095   {
1096     'key'         => 'statedefault',
1097     'section'     => 'UI',
1098     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1099     'type'        => 'text',
1100   },
1101
1102   {
1103     'key'         => 'unsuspendauto',
1104     'section'     => 'billing',
1105     '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',
1106     'type'        => 'checkbox',
1107   },
1108
1109   {
1110     'key'         => 'unsuspend-always_adjust_next_bill_date',
1111     'section'     => 'billing',
1112     '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.',
1113     'type'        => 'checkbox',
1114   },
1115
1116   {
1117     'key'         => 'usernamemin',
1118     'section'     => 'username',
1119     'description' => 'Minimum username length (default 2)',
1120     'type'        => 'text',
1121   },
1122
1123   {
1124     'key'         => 'usernamemax',
1125     'section'     => 'username',
1126     'description' => 'Maximum username length',
1127     'type'        => 'text',
1128   },
1129
1130   {
1131     'key'         => 'username-ampersand',
1132     'section'     => 'username',
1133     '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.',
1134     'type'        => 'checkbox',
1135   },
1136
1137   {
1138     'key'         => 'username-letter',
1139     'section'     => 'username',
1140     'description' => 'Usernames must contain at least one letter',
1141     'type'        => 'checkbox',
1142   },
1143
1144   {
1145     'key'         => 'username-letterfirst',
1146     'section'     => 'username',
1147     'description' => 'Usernames must start with a letter',
1148     'type'        => 'checkbox',
1149   },
1150
1151   {
1152     'key'         => 'username-noperiod',
1153     'section'     => 'username',
1154     'description' => 'Disallow periods in usernames',
1155     'type'        => 'checkbox',
1156   },
1157
1158   {
1159     'key'         => 'username-nounderscore',
1160     'section'     => 'username',
1161     'description' => 'Disallow underscores in usernames',
1162     'type'        => 'checkbox',
1163   },
1164
1165   {
1166     'key'         => 'username-nodash',
1167     'section'     => 'username',
1168     'description' => 'Disallow dashes in usernames',
1169     'type'        => 'checkbox',
1170   },
1171
1172   {
1173     'key'         => 'username-uppercase',
1174     'section'     => 'username',
1175     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1176     'type'        => 'checkbox',
1177   },
1178
1179   { 
1180     'key'         => 'username-percent',
1181     'section'     => 'username',
1182     'description' => 'Allow the percent character (%) in usernames.',
1183     'type'        => 'checkbox',
1184   },
1185
1186   {
1187     'key'         => 'safe-part_bill_event',
1188     'section'     => 'UI',
1189     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1190     'type'        => 'checkbox',
1191   },
1192
1193   {
1194     'key'         => 'show_ss',
1195     'section'     => 'UI',
1196     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
1197     'type'        => 'checkbox',
1198   },
1199
1200   {
1201     'key'         => 'show_stateid',
1202     'section'     => 'UI',
1203     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
1204     'type'        => 'checkbox',
1205   },
1206
1207   {
1208     'key'         => 'show_bankstate',
1209     'section'     => 'UI',
1210     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
1211     'type'        => 'checkbox',
1212   },
1213
1214   { 
1215     'key'         => 'agent_defaultpkg',
1216     'section'     => 'UI',
1217     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1218     'type'        => 'checkbox',
1219   },
1220
1221   {
1222     'key'         => 'legacy_link',
1223     'section'     => 'UI',
1224     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1225     'type'        => 'checkbox',
1226   },
1227
1228   {
1229     'key'         => 'legacy_link-steal',
1230     'section'     => 'UI',
1231     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1232     'type'        => 'checkbox',
1233   },
1234
1235   {
1236     'key'         => 'queue_dangerous_controls',
1237     'section'     => 'UI',
1238     '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.',
1239     'type'        => 'checkbox',
1240   },
1241
1242   {
1243     'key'         => 'security_phrase',
1244     'section'     => 'password',
1245     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1246     'type'        => 'checkbox',
1247   },
1248
1249   {
1250     'key'         => 'locale',
1251     'section'     => 'UI',
1252     'description' => 'Message locale',
1253     'type'        => 'select',
1254     'select_enum' => [ qw(en_US) ],
1255   },
1256
1257   {
1258     'key'         => 'signup_server-payby',
1259     'section'     => '',
1260     'description' => 'Acceptable payment types for the signup server',
1261     'type'        => 'selectmultiple',
1262     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1263   },
1264
1265   {
1266     'key'         => 'signup_server-default_agentnum',
1267     'section'     => '',
1268     'description' => 'Default agent for the signup server',
1269     'type'        => 'select-sub',
1270     'options_sub' => sub { require FS::Record;
1271                            require FS::agent;
1272                            map { $_->agentnum => $_->agent }
1273                                FS::Record::qsearch('agent', { disabled=>'' } );
1274                          },
1275     'option_sub'  => sub { require FS::Record;
1276                            require FS::agent;
1277                            my $agent = FS::Record::qsearchs(
1278                              'agent', { 'agentnum'=>shift }
1279                            );
1280                            $agent ? $agent->agent : '';
1281                          },
1282   },
1283
1284   {
1285     'key'         => 'signup_server-default_refnum',
1286     'section'     => '',
1287     'description' => 'Default advertising source for the signup server',
1288     'type'        => 'select-sub',
1289     'options_sub' => sub { require FS::Record;
1290                            require FS::part_referral;
1291                            map { $_->refnum => $_->referral }
1292                                FS::Record::qsearch( 'part_referral', 
1293                                                     { 'disabled' => '' }
1294                                                   );
1295                          },
1296     'option_sub'  => sub { require FS::Record;
1297                            require FS::part_referral;
1298                            my $part_referral = FS::Record::qsearchs(
1299                              'part_referral', { 'refnum'=>shift } );
1300                            $part_referral ? $part_referral->referral : '';
1301                          },
1302   },
1303
1304   {
1305     'key'         => 'signup_server-default_pkgpart',
1306     'section'     => '',
1307     'description' => 'Default package for the signup server',
1308     'type'        => 'select-sub',
1309     'options_sub' => sub { require FS::Record;
1310                            require FS::part_pkg;
1311                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1312                                FS::Record::qsearch( 'part_pkg',
1313                                                     { 'disabled' => ''}
1314                                                   );
1315                          },
1316     'option_sub'  => sub { require FS::Record;
1317                            require FS::part_pkg;
1318                            my $part_pkg = FS::Record::qsearchs(
1319                              'part_pkg', { 'pkgpart'=>shift }
1320                            );
1321                            $part_pkg
1322                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1323                              : '';
1324                          },
1325   },
1326
1327   {
1328     'key'         => 'signup_server-default_svcpart',
1329     'section'     => '',
1330     'description' => 'Default svcpart for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
1331     'type'        => 'select-sub',
1332     'options_sub' => sub { require FS::Record;
1333                            require FS::part_svc;
1334                            map { $_->svcpart => $_->svc }
1335                                FS::Record::qsearch( 'part_svc',
1336                                                     { 'disabled' => ''}
1337                                                   );
1338                          },
1339     'option_sub'  => sub { require FS::Record;
1340                            require FS::part_svc;
1341                            my $part_svc = FS::Record::qsearchs(
1342                              'part_svc', { 'svcpart'=>shift }
1343                            );
1344                            $part_svc ? $part_svc->svc : '';
1345                          },
1346   },
1347
1348   {
1349     'key'         => 'signup_server-service',
1350     'section'     => '',
1351     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
1352     'type'        => 'select',
1353     'select_hash' => [
1354                        'svc_acct'  => 'Account (svc_acct)',
1355                        'svc_phone' => 'Phone number (svc_phone)',
1356                      ],
1357   },
1358
1359   {
1360     'key'         => 'selfservice_server-base_url',
1361     'section'     => '',
1362     'description' => 'Base URL for the self-service web interface - necessary for special provisioning widgets to find their way.',
1363     'type'        => 'text',
1364   },
1365
1366   {
1367     'key'         => 'show-msgcat-codes',
1368     'section'     => 'UI',
1369     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1370     'type'        => 'checkbox',
1371   },
1372
1373   {
1374     'key'         => 'signup_server-realtime',
1375     'section'     => '',
1376     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1377     'type'        => 'checkbox',
1378   },
1379   {
1380     'key'         => 'signup_server-classnum2',
1381     'section'     => '',
1382     'description' => 'Package Class for first optional purchase',
1383     'type'        => 'select-sub',
1384     'options_sub' => sub { require FS::Record;
1385                            require FS::pkg_class;
1386                            map { $_->classnum => $_->classname }
1387                                FS::Record::qsearch('pkg_class', {} );
1388                          },
1389     'option_sub'  => sub { require FS::Record;
1390                            require FS::pkg_class;
1391                            my $pkg_class = FS::Record::qsearchs(
1392                              'pkg_class', { 'classnum'=>shift }
1393                            );
1394                            $pkg_class ? $pkg_class->classname : '';
1395                          },
1396   },
1397
1398   {
1399     'key'         => 'signup_server-classnum3',
1400     'section'     => '',
1401     'description' => 'Package Class for second optional purchase',
1402     'type'        => 'select-sub',
1403     'options_sub' => sub { require FS::Record;
1404                            require FS::pkg_class;
1405                            map { $_->classnum => $_->classname }
1406                                FS::Record::qsearch('pkg_class', {} );
1407                          },
1408     'option_sub'  => sub { require FS::Record;
1409                            require FS::pkg_class;
1410                            my $pkg_class = FS::Record::qsearchs(
1411                              'pkg_class', { 'classnum'=>shift }
1412                            );
1413                            $pkg_class ? $pkg_class->classname : '';
1414                          },
1415   },
1416
1417   {
1418     'key'         => 'backend-realtime',
1419     'section'     => '',
1420     'description' => 'Run billing for backend signups immediately.',
1421     'type'        => 'checkbox',
1422   },
1423
1424   {
1425     'key'         => 'declinetemplate',
1426     'section'     => 'billing',
1427     'description' => 'Template file for credit card decline emails.',
1428     'type'        => 'textarea',
1429   },
1430
1431   {
1432     'key'         => 'emaildecline',
1433     'section'     => 'billing',
1434     'description' => 'Enable emailing of credit card decline notices.',
1435     'type'        => 'checkbox',
1436   },
1437
1438   {
1439     'key'         => 'emaildecline-exclude',
1440     'section'     => 'billing',
1441     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1442     'type'        => 'textarea',
1443   },
1444
1445   {
1446     'key'         => 'cancelmessage',
1447     'section'     => 'billing',
1448     'description' => 'Template file for cancellation emails.',
1449     'type'        => 'textarea',
1450   },
1451
1452   {
1453     'key'         => 'cancelsubject',
1454     'section'     => 'billing',
1455     'description' => 'Subject line for cancellation emails.',
1456     'type'        => 'text',
1457   },
1458
1459   {
1460     'key'         => 'emailcancel',
1461     'section'     => 'billing',
1462     'description' => 'Enable emailing of cancellation notices.  Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
1463     'type'        => 'checkbox',
1464   },
1465
1466   {
1467     'key'         => 'require_cardname',
1468     'section'     => 'billing',
1469     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1470     'type'        => 'checkbox',
1471   },
1472
1473   {
1474     'key'         => 'enable_taxclasses',
1475     'section'     => 'billing',
1476     'description' => 'Enable per-package tax classes',
1477     'type'        => 'checkbox',
1478   },
1479
1480   {
1481     'key'         => 'require_taxclasses',
1482     'section'     => 'billing',
1483     'description' => 'Require a taxclass to be entered for every package',
1484     'type'        => 'checkbox',
1485   },
1486
1487   {
1488     'key'         => 'enable_taxproducts',
1489     'section'     => 'billing',
1490     'description' => 'Enable per-package mapping to new style tax classes',
1491     'type'        => 'checkbox',
1492   },
1493
1494   {
1495     'key'         => 'ignore_incalculable_taxes',
1496     'section'     => 'billing',
1497     'description' => 'Prefer to invoice without tax over not billing at all',
1498     'type'        => 'checkbox',
1499   },
1500
1501   {
1502     'key'         => 'welcome_email',
1503     'section'     => '',
1504     '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>',
1505     'type'        => 'textarea',
1506     'per_agent'   => 1,
1507   },
1508
1509   {
1510     'key'         => 'welcome_email-from',
1511     'section'     => '',
1512     'description' => 'From: address header for welcome email',
1513     'type'        => 'text',
1514     'per_agent'   => 1,
1515   },
1516
1517   {
1518     'key'         => 'welcome_email-subject',
1519     'section'     => '',
1520     'description' => 'Subject: header for welcome email',
1521     'type'        => 'text',
1522     'per_agent'   => 1,
1523   },
1524   
1525   {
1526     'key'         => 'welcome_email-mimetype',
1527     'section'     => '',
1528     'description' => 'MIME type for welcome email',
1529     'type'        => 'select',
1530     'select_enum' => [ 'text/plain', 'text/html' ],
1531     'per_agent'   => 1,
1532   },
1533
1534   {
1535     'key'         => 'welcome_letter',
1536     'section'     => '',
1537     '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>',
1538     'type'        => 'textarea',
1539   },
1540
1541   {
1542     'key'         => 'warning_email',
1543     'section'     => '',
1544     '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>',
1545     'type'        => 'textarea',
1546   },
1547
1548   {
1549     'key'         => 'warning_email-from',
1550     'section'     => '',
1551     'description' => 'From: address header for warning email',
1552     'type'        => 'text',
1553   },
1554
1555   {
1556     'key'         => 'warning_email-cc',
1557     'section'     => '',
1558     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1559     'type'        => 'text',
1560   },
1561
1562   {
1563     'key'         => 'warning_email-subject',
1564     'section'     => '',
1565     'description' => 'Subject: header for warning email',
1566     'type'        => 'text',
1567   },
1568   
1569   {
1570     'key'         => 'warning_email-mimetype',
1571     'section'     => '',
1572     'description' => 'MIME type for warning email',
1573     'type'        => 'select',
1574     'select_enum' => [ 'text/plain', 'text/html' ],
1575   },
1576
1577   {
1578     'key'         => 'payby',
1579     'section'     => 'billing',
1580     'description' => 'Available payment types.',
1581     'type'        => 'selectmultiple',
1582     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1583   },
1584
1585   {
1586     'key'         => 'payby-default',
1587     'section'     => 'UI',
1588     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1589     'type'        => 'select',
1590     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1591   },
1592
1593   {
1594     'key'         => 'paymentforcedtobatch',
1595     'section'     => 'deprecated',
1596     '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.',
1597     'type'        => 'checkbox',
1598   },
1599
1600   {
1601     'key'         => 'svc_acct-notes',
1602     'section'     => 'UI',
1603     'description' => 'Extra HTML to be displayed on the Account View screen.',
1604     'type'        => 'textarea',
1605   },
1606
1607   {
1608     'key'         => 'radius-password',
1609     'section'     => '',
1610     'description' => 'RADIUS attribute for plain-text passwords.',
1611     'type'        => 'select',
1612     'select_enum' => [ 'Password', 'User-Password' ],
1613   },
1614
1615   {
1616     'key'         => 'radius-ip',
1617     'section'     => '',
1618     'description' => 'RADIUS attribute for IP addresses.',
1619     'type'        => 'select',
1620     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1621   },
1622
1623   {
1624     'key'         => 'svc_acct-alldomains',
1625     'section'     => '',
1626     '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.',
1627     'type'        => 'checkbox',
1628   },
1629
1630   {
1631     'key'         => 'dump-scpdest',
1632     'section'     => '',
1633     'description' => 'destination for scp database dumps: user@host:/path',
1634     'type'        => 'text',
1635   },
1636
1637   {
1638     'key'         => 'dump-pgpid',
1639     'section'     => '',
1640     '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.",
1641     'type'        => 'text',
1642   },
1643
1644   {
1645     'key'         => 'cvv-save',
1646     'section'     => 'billing',
1647     '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.',
1648     'type'        => 'selectmultiple',
1649     'select_enum' => \@card_types,
1650   },
1651
1652   {
1653     'key'         => 'allow_negative_charges',
1654     'section'     => 'billing',
1655     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1656     'type'        => 'checkbox',
1657   },
1658   {
1659       'key'         => 'auto_unset_catchall',
1660       'section'     => '',
1661       '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.',
1662       'type'        => 'checkbox',
1663   },
1664
1665   {
1666     'key'         => 'system_usernames',
1667     'section'     => 'username',
1668     '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.',
1669     'type'        => 'textarea',
1670   },
1671
1672   {
1673     'key'         => 'cust_pkg-change_svcpart',
1674     'section'     => '',
1675     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1676     'type'        => 'checkbox',
1677   },
1678
1679   {
1680     'key'         => 'disable_autoreverse',
1681     'section'     => 'BIND',
1682     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1683     'type'        => 'checkbox',
1684   },
1685
1686   {
1687     'key'         => 'svc_www-enable_subdomains',
1688     'section'     => '',
1689     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1690     'type'        => 'checkbox',
1691   },
1692
1693   {
1694     'key'         => 'svc_www-usersvc_svcpart',
1695     'section'     => '',
1696     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1697     'type'        => 'textarea',
1698   },
1699
1700   {
1701     'key'         => 'selfservice_server-primary_only',
1702     'section'     => '',
1703     'description' => 'Only allow primary accounts to access self-service functionality.',
1704     'type'        => 'checkbox',
1705   },
1706
1707   {
1708     'key'         => 'selfservice_server-phone_login',
1709     'section'     => '',
1710     'description' => 'Allow login to self-service with phone number and PIN.',
1711     'type'        => 'checkbox',
1712   },
1713
1714   {
1715     'key'         => 'selfservice_server-single_domain',
1716     'section'     => '',
1717     'description' => 'If specified, only use this one domain for self-service access.',
1718     'type'        => 'text',
1719   },
1720
1721   {
1722     'key'         => 'card_refund-days',
1723     'section'     => 'billing',
1724     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1725     'type'        => 'text',
1726   },
1727
1728   {
1729     'key'         => 'agent-showpasswords',
1730     'section'     => '',
1731     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1732     'type'        => 'checkbox',
1733   },
1734
1735   {
1736     'key'         => 'global_unique-username',
1737     'section'     => 'username',
1738     '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.',
1739     'type'        => 'select',
1740     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1741   },
1742
1743   {
1744     'key'         => 'global_unique-phonenum',
1745     'section'     => '',
1746     '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.',
1747     'type'        => 'select',
1748     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
1749   },
1750
1751   {
1752     'key'         => 'svc_external-skip_manual',
1753     'section'     => 'UI',
1754     '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).',
1755     'type'        => 'checkbox',
1756   },
1757
1758   {
1759     'key'         => 'svc_external-display_type',
1760     'section'     => 'UI',
1761     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1762     'type'        => 'select',
1763     'select_enum' => [ 'generic', 'artera_turbo', ],
1764   },
1765
1766   {
1767     'key'         => 'ticket_system',
1768     'section'     => '',
1769     '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).',
1770     'type'        => 'select',
1771     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1772     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1773   },
1774
1775   {
1776     'key'         => 'ticket_system-default_queueid',
1777     'section'     => '',
1778     'description' => 'Default queue used when creating new customer tickets.',
1779     'type'        => 'select-sub',
1780     'options_sub' => sub {
1781                            my $conf = new FS::Conf;
1782                            if ( $conf->config('ticket_system') ) {
1783                              eval "use FS::TicketSystem;";
1784                              die $@ if $@;
1785                              FS::TicketSystem->queues();
1786                            } else {
1787                              ();
1788                            }
1789                          },
1790     'option_sub'  => sub { 
1791                            my $conf = new FS::Conf;
1792                            if ( $conf->config('ticket_system') ) {
1793                              eval "use FS::TicketSystem;";
1794                              die $@ if $@;
1795                              FS::TicketSystem->queue(shift);
1796                            } else {
1797                              '';
1798                            }
1799                          },
1800   },
1801
1802   {
1803     'key'         => 'ticket_system-priority_reverse',
1804     'section'     => '',
1805     '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.',
1806     'type'        => 'checkbox',
1807   },
1808
1809   {
1810     'key'         => 'ticket_system-custom_priority_field',
1811     'section'     => '',
1812     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1813     'type'        => 'text',
1814   },
1815
1816   {
1817     'key'         => 'ticket_system-custom_priority_field-values',
1818     'section'     => '',
1819     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1820     'type'        => 'textarea',
1821   },
1822
1823   {
1824     'key'         => 'ticket_system-custom_priority_field_queue',
1825     'section'     => '',
1826     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1827     'type'        => 'text',
1828   },
1829
1830   {
1831     'key'         => 'ticket_system-rt_external_datasrc',
1832     'section'     => '',
1833     '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>',
1834     'type'        => 'text',
1835
1836   },
1837
1838   {
1839     'key'         => 'ticket_system-rt_external_url',
1840     'section'     => '',
1841     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1842     'type'        => 'text',
1843   },
1844
1845   {
1846     'key'         => 'company_name',
1847     'section'     => 'required',
1848     'description' => 'Your company name',
1849     'type'        => 'text',
1850     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
1851   },
1852
1853   {
1854     'key'         => 'company_address',
1855     'section'     => 'required',
1856     'description' => 'Your company address',
1857     'type'        => 'textarea',
1858     'per_agent'   => 1,
1859   },
1860
1861   {
1862     'key'         => 'address2-search',
1863     'section'     => 'UI',
1864     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
1865     'type'        => 'checkbox',
1866   },
1867
1868   {
1869     'key'         => 'cust_main-require_address2',
1870     'section'     => 'UI',
1871     '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',
1872     'type'        => 'checkbox',
1873   },
1874
1875   {
1876     'key'         => 'agent-ship_address',
1877     'section'     => '',
1878     '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.",
1879     'type'        => 'checkbox',
1880   },
1881
1882   { 'key'         => 'referral_credit',
1883     'section'     => 'deprecated',
1884     '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.",
1885     'type'        => 'checkbox',
1886   },
1887
1888   { 'key'         => 'selfservice_server-cache_module',
1889     'section'     => '',
1890     '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.',
1891     'type'        => 'select',
1892     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1893   },
1894
1895   {
1896     'key'         => 'hylafax',
1897     'section'     => 'billing',
1898     '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).',
1899     'type'        => [qw( checkbox textarea )],
1900   },
1901
1902   {
1903     'key'         => 'cust_bill-ftpformat',
1904     'section'     => 'billing',
1905     'description' => 'Enable FTP of raw invoice data - format.',
1906     'type'        => 'select',
1907     'select_enum' => [ '', 'default', 'billco', ],
1908   },
1909
1910   {
1911     'key'         => 'cust_bill-ftpserver',
1912     'section'     => 'billing',
1913     'description' => 'Enable FTP of raw invoice data - server.',
1914     'type'        => 'text',
1915   },
1916
1917   {
1918     'key'         => 'cust_bill-ftpusername',
1919     'section'     => 'billing',
1920     'description' => 'Enable FTP of raw invoice data - server.',
1921     'type'        => 'text',
1922   },
1923
1924   {
1925     'key'         => 'cust_bill-ftppassword',
1926     'section'     => 'billing',
1927     'description' => 'Enable FTP of raw invoice data - server.',
1928     'type'        => 'text',
1929   },
1930
1931   {
1932     'key'         => 'cust_bill-ftpdir',
1933     'section'     => 'billing',
1934     'description' => 'Enable FTP of raw invoice data - server.',
1935     'type'        => 'text',
1936   },
1937
1938   {
1939     'key'         => 'cust_bill-spoolformat',
1940     'section'     => 'billing',
1941     'description' => 'Enable spooling of raw invoice data - format.',
1942     'type'        => 'select',
1943     'select_enum' => [ '', 'default', 'billco', ],
1944   },
1945
1946   {
1947     'key'         => 'cust_bill-spoolagent',
1948     'section'     => 'billing',
1949     'description' => 'Enable per-agent spooling of raw invoice data.',
1950     'type'        => 'checkbox',
1951   },
1952
1953   {
1954     'key'         => 'svc_acct-usage_suspend',
1955     'section'     => 'billing',
1956     '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.',
1957     'type'        => 'checkbox',
1958   },
1959
1960   {
1961     'key'         => 'svc_acct-usage_unsuspend',
1962     'section'     => 'billing',
1963     '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.',
1964     'type'        => 'checkbox',
1965   },
1966
1967   {
1968     'key'         => 'svc_acct-usage_threshold',
1969     'section'     => 'billing',
1970     '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.',
1971     'type'        => 'text',
1972   },
1973
1974   {
1975     'key'         => 'cust-fields',
1976     'section'     => 'UI',
1977     'description' => 'Which customer fields to display on reports by default',
1978     'type'        => 'select',
1979     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1980   },
1981
1982   {
1983     'key'         => 'cust_pkg-display_times',
1984     'section'     => 'UI',
1985     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
1986     'type'        => 'checkbox',
1987   },
1988
1989   {
1990     'key'         => 'cust_pkg-always_show_location',
1991     'section'     => 'UI',
1992     'description' => "Always display package locations, even when they're all the default service address.",
1993     'type'        => 'checkbox',
1994   },
1995
1996   {
1997     'key'         => 'svc_acct-edit_uid',
1998     'section'     => 'shell',
1999     'description' => 'Allow UID editing.',
2000     'type'        => 'checkbox',
2001   },
2002
2003   {
2004     'key'         => 'svc_acct-edit_gid',
2005     'section'     => 'shell',
2006     'description' => 'Allow GID editing.',
2007     'type'        => 'checkbox',
2008   },
2009
2010   {
2011     'key'         => 'zone-underscore',
2012     'section'     => 'BIND',
2013     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
2014     'type'        => 'checkbox',
2015   },
2016
2017   {
2018     'key'         => 'echeck-nonus',
2019     'section'     => 'billing',
2020     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
2021     'type'        => 'checkbox',
2022   },
2023
2024   {
2025     'key'         => 'voip-cust_cdr_spools',
2026     'section'     => '',
2027     'description' => 'Enable the per-customer option for individual CDR spools.',
2028     'type'        => 'checkbox',
2029   },
2030
2031   {
2032     'key'         => 'voip-cust_cdr_squelch',
2033     'section'     => '',
2034     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
2035     'type'        => 'checkbox',
2036   },
2037
2038   {
2039     'key'         => 'svc_forward-arbitrary_dst',
2040     'section'     => '',
2041     '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.",
2042     'type'        => 'checkbox',
2043   },
2044
2045   {
2046     'key'         => 'tax-ship_address',
2047     'section'     => 'billing',
2048     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
2049     'type'        => 'checkbox',
2050   }
2051 ,
2052   {
2053     'key'         => 'tax-pkg_address',
2054     'section'     => 'billing',
2055     '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).',
2056     'type'        => 'checkbox',
2057   },
2058
2059   {
2060     'key'         => 'invoice-ship_address',
2061     'section'     => 'billing',
2062     'description' => 'Enable this switch to include the ship address on the invoice.',
2063     'type'        => 'checkbox',
2064   },
2065
2066   {
2067     'key'         => 'invoice-unitprice',
2068     'section'     => 'billing',
2069     'description' => 'This switch enables unit pricing on the invoice.',
2070     'type'        => 'checkbox',
2071   },
2072
2073   {
2074     'key'         => 'postal_invoice-fee_pkgpart',
2075     'section'     => 'billing',
2076     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
2077     'type'        => 'select-sub',
2078     'options_sub' => sub { require FS::Record;
2079                            require FS::part_pkg;
2080                            map { $_->pkgpart => $_->pkg }
2081                                FS::Record::qsearch('part_pkg', { disabled=>'' } );
2082                          },
2083     'option_sub'  => sub { require FS::Record;
2084                            require FS::part_pkg;
2085                            my $part_pkg = FS::Record::qsearchs(
2086                              'part_pkg', { 'pkgpart'=>shift }
2087                            );
2088                            $part_pkg ? $part_pkg->pkg : '';
2089                          },
2090   },
2091
2092   {
2093     'key'         => 'postal_invoice-recurring_only',
2094     'section'     => 'billing',
2095     'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
2096     'type'        => 'checkbox',
2097   },
2098
2099   {
2100     'key'         => 'batch-enable',
2101     'section'     => 'deprecated', #make sure batch-enable_payby is set for
2102                                    #everyone before removing
2103     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
2104     'type'        => 'checkbox',
2105   },
2106
2107   {
2108     'key'         => 'batch-enable_payby',
2109     'section'     => 'billing',
2110     'description' => 'Enable batch processing for the specified payment types.',
2111     'type'        => 'selectmultiple',
2112     'select_enum' => [qw( CARD CHEK )],
2113   },
2114
2115   {
2116     'key'         => 'realtime-disable_payby',
2117     'section'     => 'billing',
2118     'description' => 'Disable realtime processing for the specified payment types.',
2119     'type'        => 'selectmultiple',
2120     'select_enum' => [qw( CARD CHEK )],
2121   },
2122
2123   {
2124     'key'         => 'batch-default_format',
2125     'section'     => 'billing',
2126     'description' => 'Default format for batches.',
2127     'type'        => 'select',
2128     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
2129                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
2130                        'ach-spiritone',
2131                     ]
2132   },
2133
2134   {
2135     'key'         => 'batch-fixed_format-CARD',
2136     'section'     => 'billing',
2137     'description' => 'Fixed (unchangeable) format for credit card batches.',
2138     'type'        => 'select',
2139     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
2140                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
2141   },
2142
2143   {
2144     'key'         => 'batch-fixed_format-CHEK',
2145     'section'     => 'billing',
2146     'description' => 'Fixed (unchangeable) format for electronic check batches.',
2147     'type'        => 'select',
2148     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
2149                        'ach-spiritone',
2150                      ]
2151   },
2152
2153   {
2154     'key'         => 'batch-increment_expiration',
2155     'section'     => 'billing',
2156     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
2157     'type'        => 'checkbox'
2158   },
2159
2160   {
2161     'key'         => 'batchconfig-BoM',
2162     'section'     => 'billing',
2163     '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',
2164     'type'        => 'textarea',
2165   },
2166
2167   {
2168     'key'         => 'batchconfig-PAP',
2169     'section'     => 'billing',
2170     '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',
2171     'type'        => 'textarea',
2172   },
2173
2174   {
2175     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
2176     'section'     => 'billing',
2177     'description' => 'Gateway ID for Chase Canada E-xact batching',
2178     'type'        => 'text',
2179   },
2180
2181   {
2182     'key'         => 'payment_history-years',
2183     'section'     => 'UI',
2184     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
2185     'type'        => 'text',
2186   },
2187
2188   {
2189     'key'         => 'cust_main-use_comments',
2190     'section'     => 'UI',
2191     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
2192     'type'        => 'checkbox',
2193   },
2194
2195   {
2196     'key'         => 'cust_main-disable_notes',
2197     'section'     => 'UI',
2198     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
2199     'type'        => 'checkbox',
2200   },
2201
2202   {
2203     'key'         => 'cust_main_note-display_times',
2204     'section'     => 'UI',
2205     'description' => 'Display full timestamps (not just dates) for customer notes.',
2206     'type'        => 'checkbox',
2207   },
2208
2209   {
2210     'key'         => 'cust_main-ticket_statuses',
2211     'section'     => 'UI',
2212     'description' => 'Show tickets with these statuses on the customer view page.',
2213     'type'        => 'selectmultiple',
2214     'select_enum' => [qw( new open stalled resolved rejected deleted )],
2215   },
2216
2217   {
2218     'key'         => 'cust_main-max_tickets',
2219     'section'     => 'UI',
2220     'description' => 'Maximum number of tickets to show on the customer view page.',
2221     'type'        => 'text',
2222   },
2223
2224   {
2225     'key'         => 'cust_main-skeleton_tables',
2226     'section'     => '',
2227     '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.',
2228     'type'        => 'textarea',
2229   },
2230
2231   {
2232     'key'         => 'cust_main-skeleton_custnum',
2233     'section'     => '',
2234     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
2235     'type'        => 'text',
2236   },
2237
2238   {
2239     'key'         => 'cust_main-enable_birthdate',
2240     'section'     => 'UI',
2241     'descritpion' => 'Enable tracking of a birth date with each customer record',
2242     'type'        => 'checkbox',
2243   },
2244
2245   {
2246     'key'         => 'support-key',
2247     'section'     => '',
2248     '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.',
2249     'type'        => 'text',
2250   },
2251
2252   {
2253     'key'         => 'card-types',
2254     'section'     => 'billing',
2255     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
2256     'type'        => 'selectmultiple',
2257     'select_enum' => \@card_types,
2258   },
2259
2260   {
2261     'key'         => 'disable-fuzzy',
2262     'section'     => 'UI',
2263     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
2264     'type'        => 'checkbox',
2265   },
2266
2267   { 'key'         => 'pkg_referral',
2268     'section'     => '',
2269     'description' => 'Enable package-specific advertising sources.',
2270     'type'        => 'checkbox',
2271   },
2272
2273   { 'key'         => 'pkg_referral-multiple',
2274     'section'     => '',
2275     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
2276     'type'        => 'checkbox',
2277   },
2278
2279   {
2280     'key'         => 'dashboard-toplist',
2281     'section'     => 'UI',
2282     'description' => 'List of items to display on the top of the front page',
2283     'type'        => 'textarea',
2284   },
2285
2286   {
2287     'key'         => 'impending_recur_template',
2288     'section'     => 'billing',
2289     '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>',
2290 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
2291     'type'        => 'textarea',
2292   },
2293
2294   {
2295     'key'         => 'logo.png',
2296     'section'     => 'billing',  #? 
2297     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
2298     'type'        => 'image',
2299     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
2300                         #old-style editor anyway...?
2301   },
2302
2303   {
2304     'key'         => 'logo.eps',
2305     'section'     => 'billing',  #? 
2306     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
2307     'type'        => 'binary',
2308     'per_agent'   => 1, #XXX as above, kinda
2309   },
2310
2311   {
2312     'key'         => 'selfservice-ignore_quantity',
2313     'section'     => '',
2314     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
2315     'type'        => 'checkbox',
2316   },
2317
2318   {
2319     'key'         => 'selfservice-session_timeout',
2320     'section'     => '',
2321     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
2322     'type'        => 'select',
2323     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
2324   },
2325
2326   {
2327     'key'         => 'disable_setup_suspended_pkgs',
2328     'section'     => 'billing',
2329     'description' => 'Disables charging of setup fees for suspended packages.',
2330     'type'       => 'checkbox',
2331   },
2332
2333   {
2334     'key' => 'password-generated-allcaps',
2335     'section' => 'password',
2336     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
2337     'type' => 'checkbox',
2338   },
2339
2340   {
2341     'key'         => 'datavolume-forcemegabytes',
2342     'section'     => 'UI',
2343     'description' => 'All data volumes are expressed in megabytes',
2344     'type'        => 'checkbox',
2345   },
2346
2347   {
2348     'key'         => 'datavolume-significantdigits',
2349     'section'     => 'UI',
2350     'description' => 'number of significant digits to use to represent data volumes',
2351     'type'        => 'text',
2352   },
2353
2354   {
2355     'key'         => 'disable_void_after',
2356     'section'     => 'billing',
2357     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
2358     'type'        => 'text',
2359   },
2360
2361   {
2362     'key'         => 'disable_line_item_date_ranges',
2363     'section'     => 'billing',
2364     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
2365     'type'        => 'checkbox',
2366   },
2367
2368   {
2369     'key'         => 'support_packages',
2370     'section'     => '',
2371     '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...
2372     'type'        => 'textarea',
2373   },
2374
2375   {
2376     'key'         => 'cust_main-require_phone',
2377     'section'     => '',
2378     'description' => 'Require daytime or night phone for all customer records.',
2379     'type'        => 'checkbox',
2380   },
2381
2382   {
2383     'key'         => 'cust_main-require_invoicing_list_email',
2384     'section'     => '',
2385     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
2386     'type'        => 'checkbox',
2387   },
2388
2389   {
2390     'key'         => 'svc_acct-display_paid_time_remaining',
2391     'section'     => '',
2392     'description' => 'Show paid time remaining in addition to time remaining.',
2393     'type'        => 'checkbox',
2394   },
2395
2396   {
2397     'key'         => 'cancel_credit_type',
2398     'section'     => 'billing',
2399     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
2400     'type'        => 'select-sub',
2401     'options_sub' => sub { require FS::Record;
2402                            require FS::reason_type;
2403                            map { $_->typenum => $_->type }
2404                                FS::Record::qsearch('reason_type', { class=>'R' } );
2405                          },
2406     'option_sub'  => sub { require FS::Record;
2407                            require FS::reason_type;
2408                            my $reason_type = FS::Record::qsearchs(
2409                              'reason_type', { 'typenum' => shift }
2410                            );
2411                            $reason_type ? $reason_type->type : '';
2412                          },
2413   },
2414
2415   {
2416     'key'         => 'referral_credit_type',
2417     'section'     => 'deprecated',
2418     '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.',
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'         => 'signup_credit_type',
2436     'section'     => 'billing',
2437     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
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'         => 'cust_main-agent_custid-format',
2455     'section'     => '',
2456     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
2457     'type'        => 'select',
2458     'select_hash' => [
2459                        ''      => 'Numeric only',
2460                        'ww?d+' => 'Numeric with one or two letter prefix',
2461                      ],
2462   },
2463
2464   {
2465     'key'         => 'card_masking_method',
2466     'section'     => 'UI',
2467     '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.',
2468     'type'        => 'select',
2469     'select_hash' => [
2470                        ''            => '123456xxxxxx1234',
2471                        'first6last2' => '123456xxxxxxxx12',
2472                        'first4last4' => '1234xxxxxxxx1234',
2473                        'first4last2' => '1234xxxxxxxxxx12',
2474                        'first2last4' => '12xxxxxxxxxx1234',
2475                        'first2last2' => '12xxxxxxxxxxxx12',
2476                        'first0last4' => 'xxxxxxxxxxxx1234',
2477                        'first0last2' => 'xxxxxxxxxxxxxx12',
2478                      ],
2479   },
2480
2481   {
2482     'key'         => 'disable_previous_balance',
2483     'section'     => 'billing',
2484     'description' => 'Disable inclusion of previous balancem payment, and credit lines on invoices',
2485     'type'        => 'checkbox',
2486   },
2487
2488   {
2489     'key'         => 'usps_webtools-userid',
2490     'section'     => 'UI',
2491     '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.',
2492     'type'        => 'text',
2493   },
2494
2495   {
2496     'key'         => 'usps_webtools-password',
2497     'section'     => 'UI',
2498     '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.',
2499     'type'        => 'text',
2500   },
2501
2502   {
2503     'key'         => 'cust_main-auto_standardize_address',
2504     'section'     => 'UI',
2505     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
2506     'type'        => 'checkbox',
2507   },
2508
2509   {
2510     'key'         => 'disable_acl_changes',
2511     'section'     => '',
2512     'description' => 'Disable all ACL changes, for demos.',
2513     'type'        => 'checkbox',
2514   },
2515
2516   {
2517     'key'         => 'cust_main-edit_agent_custid',
2518     'section'     => 'UI',
2519     'description' => 'Enable editing of the agent_custid field.',
2520     'type'        => 'checkbox',
2521   },
2522
2523   {
2524     'key'         => 'cust_main-default_agent_custid',
2525     'section'     => 'UI',
2526     'description' => 'Display the agent_custid field instead of the custnum field.',
2527     'type'        => 'checkbox',
2528   },
2529
2530   {
2531     'key'         => 'cust_main-auto_agent_custid',
2532     'section'     => 'UI',
2533     'description' => 'Automatically assign an agent_custid - select format',
2534     'type'        => 'select',
2535     'select_hash' => [ '' => 'No',
2536                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
2537                      ],
2538   },
2539
2540   {
2541     'key'         => 'cust_main-default_areacode',
2542     'section'     => 'UI',
2543     'description' => 'Default area code for customers.',
2544     'type'        => 'text',
2545   },
2546
2547   {
2548     'key'         => 'mcp_svcpart',
2549     'section'     => '',
2550     'description' => 'Master Control Program svcpart.  Leave this blank.',
2551     'type'        => 'text',
2552   },
2553
2554   {
2555     'key'         => 'cust_bill-max_same_services',
2556     'section'     => 'billing',
2557     '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.',
2558     'type'        => 'text',
2559   },
2560
2561   {
2562     'key'         => 'suspend_email_admin',
2563     'section'     => '',
2564     'description' => 'Destination admin email address to enable suspension notices',
2565     'type'        => 'text',
2566   },
2567
2568   {
2569     'key'         => 'email_report-subject',
2570     'section'     => '',
2571     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
2572     'type'        => 'text',
2573   },
2574
2575   {
2576     'key'         => 'selfservice-head',
2577     'section'     => '',
2578     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
2579     'type'        => 'textarea', #htmlarea?
2580   },
2581
2582
2583   {
2584     'key'         => 'selfservice-body_header',
2585     'section'     => '',
2586     'description' => 'HTML header for the self-service interface',
2587     'type'        => 'textarea', #htmlarea?
2588   },
2589
2590   {
2591     'key'         => 'selfservice-body_footer',
2592     'section'     => '',
2593     'description' => 'HTML header for the self-service interface',
2594     'type'        => 'textarea', #htmlarea?
2595   },
2596
2597
2598   {
2599     'key'         => 'selfservice-body_bgcolor',
2600     'section'     => '',
2601     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
2602     'type'        => 'text',
2603   },
2604
2605   {
2606     'key'         => 'selfservice-box_bgcolor',
2607     'section'     => '',
2608     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0"',
2609     'type'        => 'text',
2610   },
2611
2612   {
2613     'key'         => 'signup-no_company',
2614     'section'     => '',
2615     'description' => "Don't display a field for company name on signup.",
2616     'type'        => 'checkbox',
2617   },
2618
2619   {
2620     'key'         => 'signup-recommend_email',
2621     'section'     => '',
2622     'description' => 'Encourage the entry of an invoicing email address on signup.',
2623     'type'        => 'checkbox',
2624   },
2625
2626   {
2627     'key'         => 'signup-recommend_daytime',
2628     'section'     => '',
2629     'description' => 'Encourage the entry of a daytime phone number  invoicing email address on signup.',
2630     'type'        => 'checkbox',
2631   },
2632
2633   {
2634     'key'         => 'svc_phone-radius-default_password',
2635     'section'     => '',
2636     'description' => 'Default password when exporting svc_phone records to RADIUS',
2637     'type'        => 'text',
2638   },
2639
2640   {
2641     'key'         => 'svc_phone-allow_alpha_phonenum',
2642     'section'     => '',
2643     'description' => 'Allow letters in phone numbers.',
2644     'type'        => 'checkbox',
2645   },
2646
2647   {
2648     'key'         => 'default_phone_countrycode',
2649     'section'     => '',
2650     'description' => 'Default countrcode',
2651     'type'        => 'text',
2652   },
2653
2654   {
2655     'key'         => 'cdr-charged_party-accountcode',
2656     'section'     => '',
2657     'description' => 'Set the charged_party field of CDRs to the accountcode.',
2658     'type'        => 'checkbox',
2659   },
2660
2661   {
2662     'key'         => 'cdr-charged_party_rewrite',
2663     'section'     => '',
2664     '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.',
2665     'type'        => 'checkbox',
2666   },
2667
2668   {
2669     'key'         => 'cdr-taqua-da_rewrite',
2670     'section'     => '',
2671     '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.',
2672     'type'        => 'text',
2673   },
2674
2675   {
2676     'key'         => 'cust_pkg-show_autosuspend',
2677     'section'     => 'UI',
2678     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
2679     'type'       => 'checkbox',
2680   },
2681
2682   {
2683     'key'         => 'cdr-asterisk_forward_rewrite',
2684     'section'     => '',
2685     '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").',
2686     'type'        => 'checkbox',
2687   },
2688
2689 );
2690
2691 1;